Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 2 Jul 2009 20:05:21 +0000 (UTC)
From:      Edward Tomasz Napierala <trasz@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r195296 - in head: sys/ufs/ufs tools/regression/acltools
Message-ID:  <200907022005.n62K5LXo053614@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: trasz
Date: Thu Jul  2 20:05:21 2009
New Revision: 195296
URL: http://svn.freebsd.org/changeset/base/195296

Log:
  Fix fpathconf(3) on fifos, in effect making ls(1) properly
  display '+' on them.  Taken from kern/125613, with cosmetic
  changes.
  
  PR:		kern/125613
  Submitted by:	Jaakko Heinonen <jh at saunalahti dot fi>
  Approved by:	re (kib)

Modified:
  head/sys/ufs/ufs/ufs_vnops.c
  head/tools/regression/acltools/tools-posix.test

Modified: head/sys/ufs/ufs/ufs_vnops.c
==============================================================================
--- head/sys/ufs/ufs/ufs_vnops.c	Thu Jul  2 18:24:37 2009	(r195295)
+++ head/sys/ufs/ufs/ufs_vnops.c	Thu Jul  2 20:05:21 2009	(r195296)
@@ -112,6 +112,7 @@ static vop_symlink_t	ufs_symlink;
 static vop_whiteout_t	ufs_whiteout;
 static vop_close_t	ufsfifo_close;
 static vop_kqfilter_t	ufsfifo_kqfilter;
+static vop_pathconf_t	ufsfifo_pathconf;
 
 /*
  * A virgin directory (no blushing please).
@@ -2101,6 +2102,29 @@ ufsfifo_kqfilter(ap)
 }
 
 /*
+ * Return POSIX pathconf information applicable to fifos.
+ */
+static int
+ufsfifo_pathconf(ap)
+	struct vop_pathconf_args /* {
+		struct vnode *a_vp;
+		int a_name;
+		int *a_retval;
+	} */ *ap;
+{
+
+	switch (ap->a_name) {
+	case _PC_ACL_EXTENDED:
+	case _PC_ACL_PATH_MAX:
+	case _PC_MAC_PRESENT:
+		return (ufs_pathconf(ap));
+	default:
+		return (fifo_specops.vop_pathconf(ap));
+	}
+	/* NOTREACHED */
+}
+
+/*
  * Return POSIX pathconf information applicable to ufs filesystems.
  */
 static int
@@ -2520,6 +2544,7 @@ struct vop_vector ufs_fifoops = {
 	.vop_inactive =		ufs_inactive,
 	.vop_kqfilter =		ufsfifo_kqfilter,
 	.vop_markatime =	ufs_markatime,
+	.vop_pathconf = 	ufsfifo_pathconf,
 	.vop_print =		ufs_print,
 	.vop_read =		VOP_PANIC,
 	.vop_reclaim =		ufs_reclaim,

Modified: head/tools/regression/acltools/tools-posix.test
==============================================================================
--- head/tools/regression/acltools/tools-posix.test	Thu Jul  2 18:24:37 2009	(r195295)
+++ head/tools/regression/acltools/tools-posix.test	Thu Jul  2 20:05:21 2009	(r195296)
@@ -353,3 +353,37 @@ $ rmdir ddd/ddd
 $ rm ddd/xxx
 $ rmdir ddd
 
+# Test if we deal properly with fifos.
+$ mkfifo fff
+$ ls -l fff | cut -d' ' -f1
+> prw-r--r--
+
+$ setfacl -m u:42:r,g:43:w fff
+$ getfacl fff
+> # file: fff
+> # owner: root
+> # group: wheel
+> user::rw-
+> user:42:r--
+> group::r--
+> group:43:-w-
+> mask::rw-
+> other::r--
+
+$ ls -l fff | cut -d' ' -f1
+> prw-rw-r--+
+
+$ setfacl -bn fff
+$ getfacl fff
+> # file: fff
+> # owner: root
+> # group: wheel
+> user::rw-
+> group::r--
+> other::r--
+
+$ ls -l fff | cut -d' ' -f1
+> prw-r--r--
+
+$ rm fff
+



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200907022005.n62K5LXo053614>