FreeBSD mknod refuses to create pipes and fifos

Joao Carlos Mendes Luis jonny at
Sun Nov 30 14:44:38 EST 2003

>Submitter-Id:	current-users
>Originator:	Joao Carlos Mendes Luis
>Confidential:	no 
>Synopsis:	FreeBSD mknod refuses to create pipes and fifos
>Severity:	non-critical
>Priority:	low
>Category:	kern
>Class:		change-request
>Release:	FreeBSD 4.9-RC i386
System: FreeBSD 4.9-RC FreeBSD 4.9-RC #3: Sat Oct 25 17:54:52 BRST 2003 Jonny at i386


	mknod(2) does not create fifos and sockets, as expected from rsync

	Probably this is supported in some other operating system


	Copy a fifo and a socket with rsync

	mkfifo /tmp/fifo
	rsync -avP /var/run/log /tmp/fifo /tmp/output/


Suggested patches to kernel:

--- sys/kern/vfs_syscalls.c.orig	Sun Nov 30 00:59:29 2003
+++ sys/kern/vfs_syscalls.c	Sun Nov 30 01:25:35 2003
@@ -1189,6 +1189,10 @@
 	case S_IFBLK:
 		error = suser(p);
+	case S_IFIFO:
+	case S_IFSOCK:
+		error = 0;
+		break;
 		error = suser_xxx(0, p, PRISON_ROOT);
@@ -1217,6 +1221,12 @@
 		case S_IFBLK:
 			vattr.va_type = VBLK;
+			break;
+		case S_IFSOCK:
+			vattr.va_type = VSOCK;
+			break;
+		case S_IFIFO:
+			vattr.va_type = VFIFO;
 		case S_IFWHT:
 			whiteout = 1;

1) I'm not sure if FIFO and/or SOCK creation with mknod should be allowed to
non-root users.  This patch allows non-root to create them, but it's easy to
change that.

2) Should we allow IFREG creation with mknod?  I did not find a reason to
disallow that, but since this does not bother me with rsync, I did not
touch that...

3) I did test it with ffs, but did not test with other media, like NFS
or EXT2FS.

Thanks a lot for your attention...

More information about the rsync mailing list