diff options
Diffstat (limited to 'lib/libsys')
| -rw-r--r-- | lib/libsys/Makefile.sys | 5 | ||||
| -rw-r--r-- | lib/libsys/_libsys.h | 3 | ||||
| -rw-r--r-- | lib/libsys/closefrom.2 | 7 | ||||
| -rw-r--r-- | lib/libsys/kexec_load.2 | 119 | ||||
| -rw-r--r-- | lib/libsys/pathconf.2 | 8 | ||||
| -rw-r--r-- | lib/libsys/posix_fallocate.2 | 26 | ||||
| -rw-r--r-- | lib/libsys/reboot.2 | 7 | ||||
| -rw-r--r-- | lib/libsys/revoke.2 | 4 | ||||
| -rw-r--r-- | lib/libsys/syscalls.map | 2 |
9 files changed, 170 insertions, 11 deletions
diff --git a/lib/libsys/Makefile.sys b/lib/libsys/Makefile.sys index bd65b58083c2..5f149170b974 100644 --- a/lib/libsys/Makefile.sys +++ b/lib/libsys/Makefile.sys @@ -243,6 +243,7 @@ MAN+= abort2.2 \ jail.2 \ kcmp.2 \ kenv.2 \ + kexec_load.2 \ kill.2 \ kldfind.2 \ kldfirstmod.2 \ @@ -470,7 +471,9 @@ MLINKS+=intro.2 errno.2 MLINKS+=jail.2 jail_attach.2 \ jail.2 jail_get.2 \ jail.2 jail_remove.2 \ - jail.2 jail_set.2 + jail.2 jail_set.2 \ + jail.2 jail_attach_jd.2 \ + jail.2 jail_remove_jd.2 MLINKS+=kldunload.2 kldunloadf.2 MLINKS+=kqueue.2 kevent.2 \ kqueue.2 kqueue1.2 \ diff --git a/lib/libsys/_libsys.h b/lib/libsys/_libsys.h index 6bd768708a78..12417b572a60 100644 --- a/lib/libsys/_libsys.h +++ b/lib/libsys/_libsys.h @@ -32,6 +32,7 @@ struct itimerspec; struct itimerval; struct jail; struct kevent; +struct kexec_segment; struct kld_file_stat; struct mac; struct module_stat; @@ -470,6 +471,7 @@ typedef int (__sys_getgroups_t)(int, gid_t *); typedef int (__sys_setgroups_t)(int, const gid_t *); typedef int (__sys_jail_attach_jd_t)(int); typedef int (__sys_jail_remove_jd_t)(int); +typedef int (__sys_kexec_load_t)(uint64_t, u_long, struct kexec_segment *, u_long); _Noreturn void __sys__exit(int rval); int __sys_fork(void); @@ -876,6 +878,7 @@ int __sys_getgroups(int gidsetsize, gid_t * gidset); int __sys_setgroups(int gidsetsize, const gid_t * gidset); int __sys_jail_attach_jd(int fd); int __sys_jail_remove_jd(int fd); +int __sys_kexec_load(uint64_t entry, u_long nseg, struct kexec_segment * segments, u_long flags); __END_DECLS #endif /* __LIBSYS_H_ */ diff --git a/lib/libsys/closefrom.2 b/lib/libsys/closefrom.2 index 1885a6fdeaa8..e6b4a5a3e9d7 100644 --- a/lib/libsys/closefrom.2 +++ b/lib/libsys/closefrom.2 @@ -23,7 +23,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd May 17, 2025 +.Dd October 27, 2025 .Dt CLOSEFROM 2 .Os .Sh NAME @@ -94,6 +94,11 @@ function first appeared in .Fx 8.0 . .Pp The +.Fn close_range +function first appeared in +.Fx 12.2 . +.Pp +The .Dv CLOSE_RANGE_CLOFORK flag appeared in .Fx 15.0 . diff --git a/lib/libsys/kexec_load.2 b/lib/libsys/kexec_load.2 new file mode 100644 index 000000000000..c3d458f34100 --- /dev/null +++ b/lib/libsys/kexec_load.2 @@ -0,0 +1,119 @@ +.\" +.\" SPDX-License-Identifier: BSD-3-Clause +.\" +.\" Copyright (c) 2025 Juniper Networks, Inc. +.\" +.Dd October 29, 2025 +.Dt KEXEC_LOAD 2 +.Os +.Sh NAME +.Nm kexec_load +.Nd prepare new kernel to reboot into +.Sh SYNOPSIS +.Lb libc +.In sys/kexec.h +.Ft int +.Fn kexec_load "uint64_t entry" "unsigned long count" \ + "struct kexec_segment *segments" "unsigned long flags" +.Sh DESCRIPTION +The +.Fn kexec_load +system call loads a new kernel that can be executed later by +.Xr reboot 2 . +Subsequent calls will replace previously loaded images. +.Pp +The +.Fa flags +argument is a bitmask of flags that control the operation of the call. +This argument is present for compatibility with Linux, although it is currently +unused and must be 0. +.Pp +The +.Fa entry +argument is the physical address of the entry point of the new kernel image. +.Pp +The +.Fa count +argument is the number of segments in the image, currently limited to 16. +A value of 0 will unload the currently staged image, if one exists, without +staging a new image. +.Pp +The +.Fa segments +argument is an array of +.Fa count +members of the following structure: +.Bd -literal -offset indent +struct kexec_segment { + void *buf; + size_t bufsz; + vm_paddr_t mem; + vm_size_t memsz; +}; +.Ed +.Pp +The +.Va buf +and +.Va bufsz +members specify a memory region in the caller's address space containing the +source of the segment. +The +.Va mem +and +.Va memsz +members specify the target physical region of the segment. +.Va bufsz +must be less than or equal to +.Va memsz , +and +.Va mem +and +.Va memsz +must be page aligned. +The region covered by +.Va mem +must be in the list covered by the +.Va vm.phys_segs +sysctl. +.Pp +The +.Fn kexec_load +system call stages the kernel image in safe memory along with all +machine-dependent image data until +.Xr reboot 2 +is called with the +.Va RB_KEXEC +flag to load the image and execute the new kernel. +.Sh RETURN VALUES +The +.Fn kexec_load +system call returns 0 on success. +On failure, -1 is returned, and +.Va errno +is set to indicate the error. +On success any previously loaded image is unloaded and replaced with the new +image. +On failure, the previously loaded image is unchanged. +.Sh ERRORS +The following errors may be returned: +.Bl -tag -width Er +.It Bq Er EINVAL +Too many segments in image. +.It Bq Er EINVAL +The value of +.Va bufsz +is larger than +.Va memsz +in one or more segments. +.It Bq Er EINVAL +Machine-dependent load error. +.It Bq Er EBUSY +Another +.Fn kexec_load +call is in progress. +.Sh HISTORY +The +.Nm +system call appeared in +.Fx 16.0 . diff --git a/lib/libsys/pathconf.2 b/lib/libsys/pathconf.2 index 5a983a3a13e2..5348128be706 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 August 6, 2025 +.Dd October 31, 2025 .Dt PATHCONF 2 .Os .Sh NAME @@ -180,7 +180,8 @@ Return 1 if named attributes are enabled for the file system, otherwise 0. .It Li _PC_HAS_NAMEDATTR Return 1 if one or more named attributes exist for the file, otherwise 0. .It Li _PC_HAS_HIDDENSYSTEM -Return 1 if both +Return 1 if all of the +.Dv UF_ARCHIVE , .Dv UF_HIDDEN and .Dv UF_SYSTEM @@ -192,6 +193,9 @@ 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. +.It Li _PC_CASE_INSENSITIVE +Return 1 if the file system performs case insensitive lookups, +otherwise 0. .El .Sh RETURN VALUES If the call to diff --git a/lib/libsys/posix_fallocate.2 b/lib/libsys/posix_fallocate.2 index 8be075b41331..94858c4a0f90 100644 --- a/lib/libsys/posix_fallocate.2 +++ b/lib/libsys/posix_fallocate.2 @@ -25,7 +25,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd March 30, 2020 +.Dd November 2, 2025 .Dt POSIX_FALLOCATE 2 .Os .Sh NAME @@ -105,8 +105,7 @@ The .Fa len argument was less than or equal to zero, the .Fa offset -argument was less than zero, -or the operation is not supported by the file system. +argument was less than zero. .It Bq Er EIO An I/O error occurred while reading from or writing to a file system. .It Bq Er EINTEGRITY @@ -123,6 +122,8 @@ media. The file descriptor .Fa fd has insufficient rights. +.It Bq Er EOPNOTSUPP +The operation is not supported by the file system. .It Bq Er ESPIPE The .Fa fd @@ -137,12 +138,29 @@ argument is associated with a pipe or FIFO. The .Fn posix_fallocate system call conforms to -.St -p1003.1-2004 . +.St -p1003.1-2024 . .Sh HISTORY The .Fn posix_fallocate function appeared in .Fx 9.0 . +.Pp +Previous versions of +.Nm +used +.Er EINVAL +to indicate that the operation is not supported by the file system, as specified +in +.St -p1003.1 +Base Specifications, Issue 7. +.St -p1003.1 +Base Specifications, Issue 8 switched to requiring +.Er EOPNOTSUPP +for this error case. +ZFS adopted the latter convention in +.Fx 15.0 , +and the remaining filesystems in base adopted it in +.Fx 15.1 . .Sh AUTHORS .Fn posix_fallocate and this manual page were initially written by diff --git a/lib/libsys/reboot.2 b/lib/libsys/reboot.2 index f6c7bf6c83cc..54fa8b599cd5 100644 --- a/lib/libsys/reboot.2 +++ b/lib/libsys/reboot.2 @@ -25,7 +25,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd July 10, 2018 +.Dd October 29, 2025 .Dt REBOOT 2 .Os .Sh NAME @@ -126,6 +126,10 @@ on the console. is actually interpreted by the .Xr init 8 program in the newly booted system. +.It Dv RB_KEXEC +Execute a new kernel loaded via +.Fn kexec_load 2 . +If no kernel was loaded, reboot as normal. .El .Pp When no options are given (i.e., @@ -149,6 +153,7 @@ variable The caller is not the super-user. .El .Sh SEE ALSO +.Xr kexec_load 2 , .Xr crash 8 , .Xr halt 8 , .Xr init 8 , diff --git a/lib/libsys/revoke.2 b/lib/libsys/revoke.2 index f5ae1e92c357..938d2f083e27 100644 --- a/lib/libsys/revoke.2 +++ b/lib/libsys/revoke.2 @@ -28,7 +28,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd January 25, 2016 +.Dd October 24, 2025 .Dt REVOKE 2 .Os .Sh NAME @@ -62,7 +62,7 @@ using a special close method which does not block. Access to a file may be revoked only by its owner or the super user. The .Fn revoke -system call is currently supported only for block and character special +system call is currently supported only for character special device files. It is normally used to prepare a terminal device for a new login session, preventing any access by a previous user of the terminal. diff --git a/lib/libsys/syscalls.map b/lib/libsys/syscalls.map index b5400b9849b3..d00c862eb462 100644 --- a/lib/libsys/syscalls.map +++ b/lib/libsys/syscalls.map @@ -817,4 +817,6 @@ FBSDprivate_1.0 { __sys_jail_attach_jd; _jail_remove_jd; __sys_jail_remove_jd; + _kexec_load; + __sys_kexec_load; }; |
