From 8b4a2d50de67b746bcc472bd46c55d83eff668fc Mon Sep 17 00:00:00 2001 From: dzwdz Date: Sun, 18 Aug 2024 23:06:26 +0200 Subject: kernel: basic _sys_setxattr implementation --- man/getxattr.2 | 3 ++- man/setxattr.2 | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 man/setxattr.2 (limited to 'man') diff --git a/man/getxattr.2 b/man/getxattr.2 index d7a287e..c64ba5d 100644 --- a/man/getxattr.2 +++ b/man/getxattr.2 @@ -56,7 +56,8 @@ The filesystem probably doesn't support xattrs, and it wasn't written very well. Sorry. .El -.\" .Sh SEE ALSO +.Sh SEE ALSO +.Xr getxattr 2 . .Sh NOTES The maximum size of the xattr value might become limited in the future, as in Linux. diff --git a/man/setxattr.2 b/man/setxattr.2 new file mode 100644 index 0000000..0690d35 --- /dev/null +++ b/man/setxattr.2 @@ -0,0 +1,59 @@ +.Dd August 18, 2024 +.Dt SETXATTR 2 +.Os Camellia +.Sh NAME +.Nm setxattr +.Nd set file attribute +.Sh SYNOPSIS +.In camellia/syscalls.h +.Ft ssize_t +.Fo _sys_setxattr +.Fa "hid_t h" +.Fa "const char *name" +.Fa "const void *buf" +.Fa "size_t len" +.Fa "int flags" +.Fc +.Sh DESCRIPTION +.Nm +sets the attribute of +.Fa h +named by +.Fa name +to the contents of +.Fa buf . +.Fa flags +is reserved for future use, for now it has to be 0. +.Pp +For more details see +.Xr getxattr 2 . +.Sh RETURN VALUES +.Nm +returns +.Fa len +or a negative value on failure. +The most common errors are: +.Bl -tag -width EGENERIC +.It Er ENOSYS +The filesystem doesn't support xattrs. +.It Er EGENERIC +The filesystem probably doesn't support xattrs, +and it wasn't written very well. +Sorry. +.It Er EACCES +You lack the permission to write this xattr. +.El +.Pp +In theory filesystems can return a nonnegative value different from +.Fa len , +but that shouldn't ever happen. +.Sh SEE ALSO +.Xr getxattr 2 +.Sh BUGS +There's no way to delete attributes right now. +This will probably be done with some sort of +.Dv XATTR_DELETE +flag. +.Sh RATIONALE +See +.Xr getxattr 2 . -- cgit v1.2.3