aboutsummaryrefslogtreecommitdiff
path: root/lib/libsys
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libsys')
-rw-r--r--lib/libsys/Makefile.sys1
-rw-r--r--lib/libsys/Symbol.sys.map4
-rw-r--r--lib/libsys/_libsys.h12
-rw-r--r--lib/libsys/amd64/amd64_get_fsbase.c7
-rw-r--r--lib/libsys/amd64/amd64_get_gsbase.c7
-rw-r--r--lib/libsys/amd64/amd64_set_fsbase.c7
-rw-r--r--lib/libsys/amd64/amd64_set_gsbase.c7
-rw-r--r--lib/libsys/copy_file_range.235
-rw-r--r--lib/libsys/getgroups.215
-rw-r--r--lib/libsys/pathconf.28
-rw-r--r--lib/libsys/setgroups.236
-rw-r--r--lib/libsys/shm_open.25
-rw-r--r--lib/libsys/stat.25
-rw-r--r--lib/libsys/syscalls.map10
14 files changed, 88 insertions, 71 deletions
diff --git a/lib/libsys/Makefile.sys b/lib/libsys/Makefile.sys
index 7871731dcdcd..bd65b58083c2 100644
--- a/lib/libsys/Makefile.sys
+++ b/lib/libsys/Makefile.sys
@@ -52,7 +52,6 @@ STATICOBJS+= interposing_table.o
PSEUDO= \
__realpathat \
clock_gettime \
- exit \
getlogin \
gettimeofday \
sched_getcpu
diff --git a/lib/libsys/Symbol.sys.map b/lib/libsys/Symbol.sys.map
index 45e0160100af..1a297f9df581 100644
--- a/lib/libsys/Symbol.sys.map
+++ b/lib/libsys/Symbol.sys.map
@@ -89,7 +89,6 @@ FBSD_1.0 {
geteuid;
getfh;
getgid;
- getgroups;
getitimer;
getpagesize;
getpeername;
@@ -204,7 +203,6 @@ FBSD_1.0 {
setegid;
seteuid;
setgid;
- setgroups;
setitimer;
setlogin;
setpgid;
@@ -380,11 +378,13 @@ FBSD_1.7 {
FBSD_1.8 {
exterrctl;
fchroot;
+ getgroups;
getrlimitusage;
inotify_add_watch_at;
inotify_rm_watch;
kcmp;
setcred;
+ setgroups;
};
FBSDprivate_1.0 {
diff --git a/lib/libsys/_libsys.h b/lib/libsys/_libsys.h
index 7a1685cca2d1..34eebc1aa67a 100644
--- a/lib/libsys/_libsys.h
+++ b/lib/libsys/_libsys.h
@@ -65,7 +65,7 @@ struct uuid;
union semun;
__BEGIN_DECLS
-typedef void (__sys_exit_t)(int);
+typedef void (__sys__exit_t)(int);
typedef int (__sys_fork_t)(void);
typedef ssize_t (__sys_read_t)(int, void *, size_t);
typedef ssize_t (__sys_write_t)(int, const void *, size_t);
@@ -121,8 +121,6 @@ typedef int (__sys_munmap_t)(void *, size_t);
typedef int (__sys_mprotect_t)(void *, size_t, int);
typedef int (__sys_madvise_t)(void *, size_t, int);
typedef int (__sys_mincore_t)(const void *, size_t, char *);
-typedef int (__sys_getgroups_t)(int, gid_t *);
-typedef int (__sys_setgroups_t)(int, const gid_t *);
typedef int (__sys_getpgrp_t)(void);
typedef int (__sys_setpgid_t)(int, int);
typedef int (__sys_setitimer_t)(int, const struct itimerval *, struct itimerval *);
@@ -468,8 +466,10 @@ typedef int (__sys_setcred_t)(u_int, const struct setcred *, size_t);
typedef int (__sys_exterrctl_t)(u_int, u_int, void *);
typedef int (__sys_inotify_add_watch_at_t)(int, int, const char *, uint32_t);
typedef int (__sys_inotify_rm_watch_t)(int, int);
+typedef int (__sys_getgroups_t)(int, gid_t *);
+typedef int (__sys_setgroups_t)(int, const gid_t *);
-void __sys_exit(int rval);
+_Noreturn void __sys__exit(int rval);
int __sys_fork(void);
ssize_t __sys_read(int fd, void * buf, size_t nbyte);
ssize_t __sys_write(int fd, const void * buf, size_t nbyte);
@@ -525,8 +525,6 @@ int __sys_munmap(void * addr, size_t len);
int __sys_mprotect(void * addr, size_t len, int prot);
int __sys_madvise(void * addr, size_t len, int behav);
int __sys_mincore(const void * addr, size_t len, char * vec);
-int __sys_getgroups(int gidsetsize, gid_t * gidset);
-int __sys_setgroups(int gidsetsize, const gid_t * gidset);
int __sys_getpgrp(void);
int __sys_setpgid(int pid, int pgid);
int __sys_setitimer(int which, const struct itimerval * itv, struct itimerval * oitv);
@@ -872,6 +870,8 @@ int __sys_setcred(u_int flags, const struct setcred * wcred, size_t size);
int __sys_exterrctl(u_int op, u_int flags, void * ptr);
int __sys_inotify_add_watch_at(int fd, int dfd, const char * path, uint32_t mask);
int __sys_inotify_rm_watch(int fd, int wd);
+int __sys_getgroups(int gidsetsize, gid_t * gidset);
+int __sys_setgroups(int gidsetsize, const gid_t * gidset);
__END_DECLS
#endif /* __LIBSYS_H_ */
diff --git a/lib/libsys/amd64/amd64_get_fsbase.c b/lib/libsys/amd64/amd64_get_fsbase.c
index 00f16a5e404f..b5e87f8a3ce5 100644
--- a/lib/libsys/amd64/amd64_get_fsbase.c
+++ b/lib/libsys/amd64/amd64_get_fsbase.c
@@ -30,7 +30,6 @@
* SUCH DAMAGE.
*/
-#define _WANT_P_OSREL
#include <sys/param.h>
#include <machine/cpufunc.h>
#include <machine/specialreg.h>
@@ -41,7 +40,6 @@
static int
amd64_get_fsbase_cpu(void **addr)
{
-
*addr = (void *)rdfsbase();
return (0);
}
@@ -49,15 +47,12 @@ amd64_get_fsbase_cpu(void **addr)
static int
amd64_get_fsbase_syscall(void **addr)
{
-
return (sysarch(AMD64_GET_FSBASE, addr));
}
DEFINE_UIFUNC(, int, amd64_get_fsbase, (void **))
{
-
- if (__getosreldate() >= P_OSREL_WRFSBASE &&
- (cpu_stdext_feature & CPUID_STDEXT_FSGSBASE) != 0)
+ if ((cpu_stdext_feature & CPUID_STDEXT_FSGSBASE) != 0)
return (amd64_get_fsbase_cpu);
return (amd64_get_fsbase_syscall);
}
diff --git a/lib/libsys/amd64/amd64_get_gsbase.c b/lib/libsys/amd64/amd64_get_gsbase.c
index ef135b1eed7f..51be412ddd7a 100644
--- a/lib/libsys/amd64/amd64_get_gsbase.c
+++ b/lib/libsys/amd64/amd64_get_gsbase.c
@@ -30,7 +30,6 @@
* SUCH DAMAGE.
*/
-#define _WANT_P_OSREL
#include <sys/param.h>
#include <machine/cpufunc.h>
#include <machine/specialreg.h>
@@ -41,7 +40,6 @@
static int
amd64_get_gsbase_cpu(void **addr)
{
-
*addr = (void *)rdgsbase();
return (0);
}
@@ -49,15 +47,12 @@ amd64_get_gsbase_cpu(void **addr)
static int
amd64_get_gsbase_syscall(void **addr)
{
-
return (sysarch(AMD64_GET_GSBASE, addr));
}
DEFINE_UIFUNC(, int, amd64_get_gsbase, (void **))
{
-
- if (__getosreldate() >= P_OSREL_WRFSBASE &&
- (cpu_stdext_feature & CPUID_STDEXT_FSGSBASE) != 0)
+ if ((cpu_stdext_feature & CPUID_STDEXT_FSGSBASE) != 0)
return (amd64_get_gsbase_cpu);
return (amd64_get_gsbase_syscall);
}
diff --git a/lib/libsys/amd64/amd64_set_fsbase.c b/lib/libsys/amd64/amd64_set_fsbase.c
index f1690fde6e17..5265bd712f17 100644
--- a/lib/libsys/amd64/amd64_set_fsbase.c
+++ b/lib/libsys/amd64/amd64_set_fsbase.c
@@ -30,7 +30,6 @@
* SUCH DAMAGE.
*/
-#define _WANT_P_OSREL
#include <sys/param.h>
#include <machine/cpufunc.h>
#include <machine/specialreg.h>
@@ -41,7 +40,6 @@
static int
amd64_set_fsbase_cpu(void *addr)
{
-
wrfsbase((uintptr_t)addr);
return (0);
}
@@ -49,15 +47,12 @@ amd64_set_fsbase_cpu(void *addr)
static int
amd64_set_fsbase_syscall(void *addr)
{
-
return (sysarch(AMD64_SET_FSBASE, &addr));
}
DEFINE_UIFUNC(, int, amd64_set_fsbase, (void *))
{
-
- if (__getosreldate() >= P_OSREL_WRFSBASE &&
- (cpu_stdext_feature & CPUID_STDEXT_FSGSBASE) != 0)
+ if ((cpu_stdext_feature & CPUID_STDEXT_FSGSBASE) != 0)
return (amd64_set_fsbase_cpu);
return (amd64_set_fsbase_syscall);
}
diff --git a/lib/libsys/amd64/amd64_set_gsbase.c b/lib/libsys/amd64/amd64_set_gsbase.c
index 756bbae18844..94f5736ed1ab 100644
--- a/lib/libsys/amd64/amd64_set_gsbase.c
+++ b/lib/libsys/amd64/amd64_set_gsbase.c
@@ -30,7 +30,6 @@
* SUCH DAMAGE.
*/
-#define _WANT_P_OSREL
#include <sys/param.h>
#include <machine/cpufunc.h>
#include <machine/specialreg.h>
@@ -41,7 +40,6 @@
static int
amd64_set_gsbase_cpu(void *addr)
{
-
wrgsbase((uintptr_t)addr);
return (0);
}
@@ -49,15 +47,12 @@ amd64_set_gsbase_cpu(void *addr)
static int
amd64_set_gsbase_syscall(void *addr)
{
-
return (sysarch(AMD64_SET_GSBASE, &addr));
}
DEFINE_UIFUNC(, int, amd64_set_gsbase, (void *))
{
-
- if (__getosreldate() >= P_OSREL_WRFSBASE &&
- (cpu_stdext_feature & CPUID_STDEXT_FSGSBASE) != 0)
+ if ((cpu_stdext_feature & CPUID_STDEXT_FSGSBASE) != 0)
return (amd64_set_gsbase_cpu);
return (amd64_set_gsbase_syscall);
}
diff --git a/lib/libsys/copy_file_range.2 b/lib/libsys/copy_file_range.2
index bcd9170842d5..829a5a5d3c13 100644
--- a/lib/libsys/copy_file_range.2
+++ b/lib/libsys/copy_file_range.2
@@ -23,7 +23,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd December 28, 2023
+.Dd August 16, 2025
.Dt COPY_FILE_RANGE 2
.Os
.Sh NAME
@@ -74,6 +74,7 @@ argument must be opened for reading and the
.Fa outfd
argument must be opened for writing, but not
.Dv O_APPEND .
+.Pp
If
.Fa inoffp
or
@@ -101,9 +102,29 @@ respectively will be used/updated and the file offset for
or
.Fa outfd
respectively will not be affected.
-The
+.Pp
+The only
+.Fa flags
+argument currently defined is
+.Dv COPY_FILE_RANGE_CLONE .
+When this flag is set,
+.Fn copy_file_range
+will return
+.Er EOPNOTSUPP
+if the copy cannot be done via
+block cloning.
+When
.Fa flags
-argument must be 0.
+is 0, a file system may do the copy via block cloning
+or by data copying.
+Block cloning is only possible when the offsets (plus
+.Fa len
+if not to EOF on the input file) are block
+aligned.
+The correct block alignment can normally be acquired via the
+.Dv _PC_CLONE_BLKSIZE
+query for
+.Xr pathconf 2 .
.Pp
This system call attempts to maintain holes in the output file for
the byte range being copied.
@@ -203,9 +224,15 @@ refers to a directory.
File system that stores
.Fa outfd
is full.
+.It Bq Er EOPNOTSUPP
+Cannot do the copy via block cloning and the
+.Dv COPY_FILE_RANGE_CLONE
+.Fa flags
+argument is specified.
.El
.Sh SEE ALSO
-.Xr lseek 2
+.Xr lseek 2 ,
+.Xr pathconf 2
.Sh STANDARDS
The
.Fn copy_file_range
diff --git a/lib/libsys/getgroups.2 b/lib/libsys/getgroups.2
index 91cca2748ec2..37c8fbad7215 100644
--- a/lib/libsys/getgroups.2
+++ b/lib/libsys/getgroups.2
@@ -25,7 +25,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd January 21, 2011
+.Dd August 1, 2025
.Dt GETGROUPS 2
.Os
.Sh NAME
@@ -41,8 +41,8 @@
The
.Fn getgroups
system call
-gets the current group access list of the user process
-and stores it in the array
+gets the current supplementary groups of the user process and stores it in the
+array
.Fa gidset .
The
.Fa gidsetlen
@@ -54,7 +54,7 @@ The
system call
returns the actual number of groups returned in
.Fa gidset .
-At least one and as many as {NGROUPS_MAX}+1 values may be returned.
+As many as {NGROUPS_MAX} values may be returned.
If
.Fa gidsetlen
is zero,
@@ -102,3 +102,10 @@ The
.Fn getgroups
system call appeared in
.Bx 4.2 .
+.Pp
+Before
+.Fx 15.0 ,
+the
+.Fn getgroups
+system call always returned the effective group ID for the process as the first
+element of the array, before the supplementary groups.
diff --git a/lib/libsys/pathconf.2 b/lib/libsys/pathconf.2
index 79ac8310000d..5a983a3a13e2 100644
--- a/lib/libsys/pathconf.2
+++ b/lib/libsys/pathconf.2
@@ -25,7 +25,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd July 5, 2025
+.Dd August 6, 2025
.Dt PATHCONF 2
.Os
.Sh NAME
@@ -187,6 +187,11 @@ and
flags can be set by
.Xr chflags 2 ,
otherwise 0.
+.It Li _PC_CLONE_BLKSIZE
+Returns the block size required for block cloning via
+.Xr copy_file_range 2
+for a file system if block cloning is supported,
+otherwise 0.
.El
.Sh RETURN VALUES
If the call to
@@ -264,6 +269,7 @@ Corrupted data was detected while reading from the file system.
.El
.Sh SEE ALSO
.Xr chflags 2 ,
+.Xr copy_file_range 2 ,
.Xr lseek 2 ,
.Xr sysctl 3
.Sh HISTORY
diff --git a/lib/libsys/setgroups.2 b/lib/libsys/setgroups.2
index a226aeafea96..451f63ba1266 100644
--- a/lib/libsys/setgroups.2
+++ b/lib/libsys/setgroups.2
@@ -25,7 +25,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd January 19, 2018
+.Dd August 1, 2025
.Dt SETGROUPS 2
.Os
.Sh NAME
@@ -42,7 +42,7 @@
The
.Fn setgroups
system call
-sets the group access list of the current user process
+sets the supplementary group list of the current user process
according to the array
.Fa gidset .
The
@@ -50,26 +50,12 @@ The
argument
indicates the number of entries in the array and must be no
more than
-.Dv {NGROUPS_MAX}+1 .
-.Pp
-Only the super-user may set a new group list.
+.Dv {NGROUPS_MAX} .
+The
+.Fa ngroups
+argument may be set to 0 to clear the supplementary group list.
.Pp
-The first entry of the group array
-.Pq Va gidset[0]
-is used as the effective group-ID for the process.
-This entry is over-written when a setgid program is run.
-To avoid losing access to the privileges of the
-.Va gidset[0]
-entry, it should be duplicated later in the group array.
-By convention,
-this happens because the group value indicated
-in the password file also appears in
-.Pa /etc/group .
-The group value in the password file is placed in
-.Va gidset[0]
-and that value then gets added a second time when the
-.Pa /etc/group
-file is scanned to create the group set.
+Only the super-user may set a new supplementary group list.
.Sh RETURN VALUES
.Rv -std setgroups
.Sh ERRORS
@@ -99,3 +85,11 @@ The
.Fn setgroups
system call appeared in
.Bx 4.2 .
+.Pp
+Before
+.Fx 15.0 ,
+the
+.Fn setgroups
+system call would set the effective group ID for the process to the first
+element of
+.Fa gidset .
diff --git a/lib/libsys/shm_open.2 b/lib/libsys/shm_open.2
index 8bea939690ba..c3196d966e6b 100644
--- a/lib/libsys/shm_open.2
+++ b/lib/libsys/shm_open.2
@@ -26,7 +26,7 @@
.\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd January 30, 2023
+.Dd August 4, 2025
.Dt SHM_OPEN 2
.Os
.Sh NAME
@@ -74,8 +74,9 @@ must be included in
The optional flags
.Dv O_CREAT ,
.Dv O_EXCL ,
+.Dv O_TRUNC ,
and
-.Dv O_TRUNC
+.Dv O_CLOFORK
may also be specified.
.Pp
If
diff --git a/lib/libsys/stat.2 b/lib/libsys/stat.2
index bd9005710147..8107740bd901 100644
--- a/lib/libsys/stat.2
+++ b/lib/libsys/stat.2
@@ -25,7 +25,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd March 30, 2021
+.Dd August 17, 2025
.Dt STAT 2
.Os
.Sh NAME
@@ -169,6 +169,9 @@ Flags enabled for the file.
See
.Xr chflags 2
for the list of flags and their description.
+.It Va st_rdev
+Numeric ID of the device referenced by the file, if the file is a
+character or block special; otherwise unspecified.
.El
.Pp
The
diff --git a/lib/libsys/syscalls.map b/lib/libsys/syscalls.map
index 69fce2ea7c63..4cf80a2ffc69 100644
--- a/lib/libsys/syscalls.map
+++ b/lib/libsys/syscalls.map
@@ -7,7 +7,7 @@
FBSDprivate_1.0 {
_syscall;
__sys_syscall;
- __sys_exit;
+ __sys__exit;
_fork;
__sys_fork;
_read;
@@ -117,10 +117,6 @@ FBSDprivate_1.0 {
__sys_madvise;
_mincore;
__sys_mincore;
- _getgroups;
- __sys_getgroups;
- _setgroups;
- __sys_setgroups;
_getpgrp;
__sys_getpgrp;
_setpgid;
@@ -813,4 +809,8 @@ FBSDprivate_1.0 {
__sys_inotify_add_watch_at;
_inotify_rm_watch;
__sys_inotify_rm_watch;
+ _getgroups;
+ __sys_getgroups;
+ _setgroups;
+ __sys_setgroups;
};