Page MenuHomeFreeBSD

D49691.id153821.diff
No OneTemporary

D49691.id153821.diff

diff --git a/lib/libsys/open.2.xattr b/lib/libsys/open.2
--- a/lib/libsys/open.2.xattr
+++ b/lib/libsys/open.2
@@ -25,7 +25,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd February 28, 2025
+.Dd April 3, 2025
.Dt OPEN 2
.Os
.Sh NAME
@@ -210,6 +210,8 @@
open file referenced by
.Fa fd
if path is empty
+.It Dv O_NAMEDATTR
+open a named attribute directory or named attribute
.El
.Pp
Exactly one of the flags
@@ -499,6 +501,42 @@
.Dv O_CLOEXEC
flag.
.Pp
+When the
+.Dv O_NAMEDATTR
+flag is specified for an
+.Fn open
+or
+.Fn openat
+of a file in the file system's namespace,
+a named attribute directory for the file object
+is opened and not the file object itself.
+If the
+.Dv O_CREAT
+flag has been specified as well, the named attribute directory will be
+created if it does not exist.
+This directory provides a list of the named attributes associated with
+the file object.
+The file descriptor returned by this
+.Fn open
+can then be used as the
+.Fa fd
+argument of an
+.Fn openat
+to open a named attribute that is associated with the file object.
+The
+.Fa path
+argument for this
+.Fn openat
+must be a single component name with no imbedded
+.Dq / .
+If the
+.Dv O_NAMEDATTR
+flag is specified for such an open of a named attribute,
+it ensures that a successful open is for a named attribute.
+(See
+.Xr named_attribute 7
+for more information.)
+.Pp
The system imposes a limit on the number of file descriptors
open simultaneously by one process.
The
@@ -730,6 +768,10 @@
.Dv vfs.lookup_cap_dotdot
.Xr sysctl 3
is set, and the process is in capability mode.
+.It Bq Er ENOATTR
+.Dv O_NAMEDATTR
+has been specified and the file object is not a named attribute
+directory or named attribute.
.El
.Sh SEE ALSO
.Xr chmod 2 ,
@@ -745,7 +787,8 @@
.Xr umask 2 ,
.Xr write 2 ,
.Xr fopen 3 ,
-.Xr capsicum 4
+.Xr capsicum 4 ,
+.Xr named_attribute 7
.Sh STANDARDS
These functions are specified by
.St -p1003.1-2008 .
@@ -794,6 +837,8 @@
.Fx 8.0 .
.Dv O_DSYNC
appeared in 13.0.
+.Dv O_NAMEDATTR
+appeared in 15.0.
.Sh BUGS
The
.Fa mode

File Metadata

Mime Type
text/plain
Expires
Sat, Dec 20, 2:46 AM (3 h, 40 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
27091008
Default Alt Text
D49691.id153821.diff (2 KB)

Event Timeline