[CRIU] Re: [PATCH v3 4/8] dump: use switch for dumping fd

Pavel Emelyanov xemul at parallels.com
Mon Mar 5 13:15:32 EST 2012


> @@ -341,40 +341,48 @@ static int dump_one_fd(pid_t pid, int pid_fd_dir, char *d_name, struct cr_fdset
>  		return -1;
>  
>  	lfd = openat(pid_fd_dir, d_name, O_RDONLY);
> -	if (lfd < 0) {
> -		err = try_dump_socket(pid, atoi(d_name), cr_fdset, sk_queue);
> +
> +	switch (fd_stat.st_mode & S_IFMT) {
> +	case S_IFCHR:
> +		if (major(fd_stat.st_rdev) != MEM_MAJOR) {
> +			if ((major(fd_stat.st_rdev) == TTY_MAJOR) ||
> +			    (major(fd_stat.st_rdev) == UNIX98_PTY_SLAVE_MAJOR)) {
> +				/* skip only standard destriptors */
> +				if (atoi(d_name) < 3) {
> +					err = 0;
> +					pr_info("... Skipping tty ... %d/%ld\n",
> +						pid_fd_dir, p.fd_name);
> +				}
> +			}
> +			break;
> +		}
> +		/*
> +		 * This is a TMPFS file.

No, this is not a TMPFS file.

> +		 * Proceed to dump_one_reg_file().
> +		 */


More information about the CRIU mailing list