Commit graph

189 commits

Author SHA1 Message Date
Konstantin Belousov
8cc93cd668 fcntl.2: fix description of F_GETFD return value
Now we have three flags provided.

Sponsored by:	The FreeBSD Foundation
2025-07-09 00:48:58 +03:00
Ricardo Branco
efadb5c2a9 Add manpages for O_CLOFORK flag and others
Reviewed by:	kib
MFC after:	1 month
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1698
2025-07-06 23:08:41 +00:00
Rick Macklem
ac64cd191c pathconf.2: Document the _PC_HAS_HIDDENSYSTEM name
Commit afd5bc6309 added a new pathconf name
_PC_HAS_HIDDENSYSTEM.

This patch documents this new name.

This is a content change.

Reviewed by:	kib, ziaee (manpages)
Differential Revision:	https://reviews.freebsd.org/D51175
Fixes:	afd5bc6309 ("pathconf: Add a new variable for hidden/system")
2025-07-06 12:23:05 -07:00
Mark Johnston
5202cfcf93 inotify: Add man pages for the new syscalls and for VOP_INOTIFY
Reviewed by:	kib
MFC after:	3 months
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D50315
2025-07-04 14:42:33 +00:00
Mark Johnston
cf65b5e43d libsys: Add inotify support
Include the two new syscalls in the symbol map.

Reviewed by:	kib
MFC after:	3 months
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D50315
2025-07-04 14:42:33 +00:00
Mark Johnston
d4ead7edbb inotify: Regenerate syscall definitions
Sponsored by:	Klara, Inc.
2025-07-04 14:42:33 +00:00
Felix Johnson
bd173a540c
write.2: Add EINVAL to ERRORS
Since phk rewrote the block layer ~2 decades ago, write(2) can return
EINVAL when the target is a block device and nbytes, the write size, is
not a multiple of the sector's block size.

From the original PR:
When coming from Linux, people are surprised by the fact
that write(2) to a device must be aligned to block size.
Writing a non-aligned block onto a raw device is a case
where EINVAL is also returned but the manpage does not mention this.

MFC after:		3 days
PR:			227185
Reported by:		riggs
Reviewed by:		imp, Pau Amma <pauamma@gundo.com>
Differential Revision:	https://reviews.freebsd.org/D51138
2025-07-04 01:14:19 -04:00
Andrew Turner
fa1c23da01 libsys: Add AT_HWCAP3 and AT_HWCAP4
This is needed to read these values.

Reviewed by:	brooks, imp, kib
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D51006
2025-06-24 17:26:40 +01:00
Gleb Smirnoff
d17cbe4698 sendfile: retire SF_SYNC
The flag was added in b75a1171d8 for the sake of Varnish.  However, that
idea didn't work.  Quoting email from Poul-Henning:

"We had to give up sendfile(), the overhead of keeping track of everything
between the network stack and VM system made ate any gain we saw. ... I
dont think we ever shipped a version where sendfile was enabled by
default."

PR:	287348
2025-06-24 15:24:04 -07:00
Mark Johnston
f35525ff20 file: Add a fd flag with O_RESOLVE_BENEATH semantics
The O_RESOLVE_BENEATH openat(2) flag restricts name lookups such that
they remain under the directory referenced by the dirfd.  This commit
introduces an implicit version of the flag, FD_RESOLVE_BENEATH, stored
in the file descriptor entry.  When the flag is set, any lookup relative
to that fd automatically has O_RESOLVE_BENEATH semantics.  Furthermore,
the flag is sticky, meaning that it cannot be cleared, and it is copied
by dup() and openat().

File descriptors with FD_RESOLVE_BENEATH set may not be passed to
fchdir(2) or fchroot(2).  Various fd lookup routines are modified to
return fd flags to the caller.

This flag will be used to address a case where jails with different root
directories and the ability to pass SCM_RIGHTS messages across the jail
boundary can transfer directory fds in such as way as to allow a
filesystem escape.

PR:		262180
Reviewed by:	kib
MFC after:	3 weeks
Differential Revision:	https://reviews.freebsd.org/D50371
2025-06-24 21:04:18 +00:00
Kyle Evans
ee9895e10d kern: send parent a SIGCHLD when the debugger has detached
The practical scenario that leads to this is porch(1) spawning some
utility and sending it a SIGSTOP as a debugging aide.  The user then
attaches a debugger and walks through how some specific input is
processed, then detaches to allow the script to continue.  When ptrace
is detached, the process resumes execution but the parent is never
notified and may be stuck in wait(2) for it to continue or terminate.

Other platforms seem to re-suspend the process after the debugger is
detached, but neither behavior seems unreasonable.  Just notifying the
parent that the child has resumed is a relatively low-risk departure
from our current behavior and had apparently been considered in the
past, based on pre-existing comments.

Move p_flag and p_xsig handling into childproc_continued(), as just
sending the SIGCHLD here isn't really useful without P_CONTINUED set
and the other caller already sets these up as well.

Reviewed by:	kib, markj
Differential Revision:	https://reviews.freebsd.org/D50917
2025-06-19 10:32:04 -05:00
Warner Losh
67c5db938c clock_gettime: Better markup
Markup CLOCK_REALTIME better.

Noticed by: kib
Fixes: 7b7ba7857c
Sponsored by:		Netflix
2025-06-13 12:29:38 -06:00
Warner Losh
bd8621c6cd kern_time: minor style nits
Typically we spell error values 'error' not 'err'. And fix EINVAL markup
nit.

Suggested by: kib
Fixes: 7b7ba7857c
Sponsored by:		Netflix
2025-06-13 08:34:21 -06:00
Nathan Whitehorn
7b7ba7857c Implement CLOCK_TAI
Provide a clock through clock_gettime() that returns the current TAI
time (UTC without leap seconds) as a complement to CLOCK_REALTIME. This
provides compatibility with Linux, which also provides a CLOCK_TAI since
kernel 2.6.26, and this seems to be becoming the standard way to acquire
TAI time. Unlike Linux, this code will return EINVAL if the TAI offset
(set by ntpd, ptpd, etc.) is not known since it seems pathological for
CLOCK_TAI to silently give the wrong (UTC) time if the offset is not
known as it does on Linux.

Reviewed by: imp
Differential Revision:	https://reviews.freebsd.org/D46268
2025-06-12 12:25:31 -06:00
Rick Macklem
6b6542ec84 open.2: Document the O_NAMEDATTR flag
Commit 2ec2ba7e23 added support for the O_NAMEDATTR flag to
the open(2) and openat(2) syscalls for main.

This patch updates the man page for this flag.

Another man page that explains named attributes will
be introduced in a future commit.

This is a content change.

Reviewed by:	emaste (earlier version), kib (earlier version)
Differential Revision:	https://reviews.freebsd.org/D49691
Fixes:	2ec2ba7e23 ("vfs: Add VFS/syscall support for Solaris style extended attributes")
2025-06-04 15:50:16 -07:00
Konstantin Belousov
bfe9e97a23 Regen 2025-05-31 22:52:42 +03:00
Konstantin Belousov
92b393c0d2 libsys: export exterrctl symbol
Reviewed by:	brooks
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D50483
2025-05-31 22:52:41 +03:00
Konstantin Belousov
6fd3288c39 thr_new.2: document THR_C_RUNTIME
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2025-05-31 17:55:24 +03:00
Konstantin Belousov
2e7cf772a4 amd64: add amd64_set_tlsbase(3)
Tested by:	pho
Reviewed by:	olce
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D50482
2025-05-28 14:11:23 +03:00
Robert Wing
3701f50099 write.2: sweep error code referencing disklabel(8)
The "-W" option for disklabel(8) was retired in:
    f080d33b66

The ioctl used by the "-W" option, DIOCWLABEL, was retired in:
    5777c5b989
2025-05-27 13:33:50 -08:00
Konstantin Belousov
fae33d1d12 open.2: add a note about conversion of a file descriptor into O_PATH
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Differential revision:	https://reviews.freebsd.org/D50511
2025-05-25 23:32:26 +03:00
Tom Hukins
5b9660caff Fix incorrect version introduced in manual pages
Several manual pages for releng/14.3 incorrectly claim that features
were first introduced in FreeBSD 15.0.

I discovered these by running:

  git checkout origin/releng/14.3
  git grep -F '.Fx 15.0'

MFC After: 3 days
Reviewed by: imp, ziaee
Pull Request: https://github.com/freebsd/freebsd-src/pull/1685
2025-05-04 22:44:43 -06:00
Rick Macklem
38eb41a389 pathconf.2: Document the _PC_HAS_NAMEDATTR name
Commit 0f12c3cd0d adds a new pathconf(2) name called
_PC_HAS_NAMEDATTR.

This patch documents it in the man page.

This is a content change.

Reviewed by:	ziaee (manpages)
Differential Revision:	https://reviews.freebsd.org/D50141
Fixes:	2ec2ba7e23 ("vfs: Add VFS/syscall support for Solaris style extended attributes")
2025-05-04 15:23:42 -07:00
Gleb Smirnoff
626ea75ed2 time: use precise callout for clock_nanosleep(2) and nanosleep(2)
Don't apply tc_precexp and TIMESEL() that uses sbt_timethreshold (both
derivatives of kern.timecounter.alloweddeviation) to sleep callout when
processing the default and precise clocks.  The default timer deviation of
5% is our internal optimization in the kernel, and we shouldn't leak that
into the POSIX APIs.  Note that application doesn't have any control to
cancel the deviation, only a superuser can change the global tunable [with
side effects].

Leave the deviation for CLOCK_*_FAST and CLOCK_SECOND that are documented
as imprecise.

Provide a sysctl kern.timecounter.nanosleep_precise that allows to restore
the previous behavior.

Improve documentation.

Reviewed by:		ziaee, vangyzen, imp, kib
Differential Revision:	https://reviews.freebsd.org/D50075
2025-04-30 09:47:57 -07:00
Vicki Pfau
d2ffe67fd5 procctl.2: Fix names of PROC_LOGSIGEXIT_CTL constants
The headers contain constants that start with PROC_LOGSIGEXIT_CTL_*, but the
man page elided the _CTL portion.

Fixes: dabf006 ("Add per-process flag to disable logsigexit")
Reviewed by: imp, jlduran
Pull Request: https://github.com/freebsd/freebsd-src/pull/1610
2025-04-21 16:01:53 -06:00
Rick Macklem
33e22c4f94 pathconf.2: Update man page for the _PC_NAMEDATTR_ENABLED flag
This patch updates the man page for the _PC_NAMEDATTR_ENABLED flag.

Another man page that explains named attributes will
be introduced in a future commit.

This is a content change.

Fixes:	2ec2ba7e23 ("vfs: Add VFS/syscall support for Solaris style extended attributes")
2025-04-16 15:37:14 -07:00
Michael Tuexen
dd9e59beeb symlink.2: document EOPNOTSUPP
When the file system does not support symbolic links (like in the case
of MSDOS), symlink() returns -1 and sets errno to EOPNOTSUPP.
Document this behavior.

Reviewed by:		glebius, markj
MFC after:		3 days
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D49803
2025-04-15 00:03:19 +02:00
Rick Macklem
964d0fd624 statfs.2: Update man page for the MNT_NAMEDATTR flag
This patch updates the man page for the MNT_NAMEDATTR flag.

Another man page that explains named attributes will
be introduced in a future commit.

This is a content change.

Reviewed by:	manpages (zaiee)
Fixes:	2ec2ba7e23 ("vfs: Add VFS/syscall support for Solaris style extended attributes")
Differential Revision:	https://reviews.freebsd.org/D49719
2025-04-10 18:00:49 -07:00
Rick Macklem
dedbb972d2 fhopen.2: Update man page for O_NAMEDATTR flag
This patch updates the man page for the O_NAMEDATTR flag.

Another man page that explains named attributes will
be introduced in a future commit.

This is a content change.

Reviewed by:	manpages (zaiee)
Fixes:	2ec2ba7e ("Add support for Solaris style extended attr")
Differential Revision:	https://reviews.freebsd.org/D49718
2025-04-09 17:50:36 -07:00
Enji Cooper
1b37af0922 Bump .Dd for recently changed aio_*(2) manpages
The ones that were effectively unchanged from
d97e44784bb5a^..e24279e0f9e did not have `.Dd` bumped. Only
the ones that had a net content change between those
revisions.

MFC after:	2 weeks
MFC with:	d97e44784b e24279e0f9
2025-03-27 19:43:26 -07:00
Enji Cooper
e24279e0f9 Remove mentions of ENOSYS added in d97e44784b
aio(4) is a hard requirement in the kernel as of f3215338ef. The
scenario that the patch was submitted for is no longer possible.

This isn't a straight up revert since the previous change also addressed
some minor issues.

PR:		190942
Reported by:	asomers
MFC after:	2 weeks
MFC with:	d97e44784b
Fixes:		d97e44784b ("aio_*(2): mention ENOSYS under ERRORS")
Differential Revision: https://reviews.freebsd.org/D49541
2025-03-27 19:40:07 -07:00
Enji Cooper
d97e44784b aio_*(2): mention ENOSYS under ERRORS
ENOSYS can occur if aio(4) is not loaded in the kernel. Document this
behavior so consumers on FreeBSD can better understand that this is a
possible scenario.

Clean up the manpages slightly while here:
- Sort `ERRORS` by errno(3).
- Use `.Fx` instead of `FreeBSD`.

MFC after:	2 weeks
Reviewed by:	ziaee
PR:		190942
Differential Revision: https://reviews.freebsd.org/D49502
2025-03-25 21:49:33 -07:00
Konstantin Belousov
e2dd73cf45 open.2: minor editing
Remove unneeded braces.
Bump Dd.

Suggested and reviewed by:	maxim
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2025-03-01 02:12:07 +02:00
artembunichev
8cebb06300 open.2: add separate paragraph for O_CREAT
PR:	284353
MFC after:	1 week
2025-02-28 12:29:12 +02:00
Alexander Ziaee
7c3c8605d6
recv.2: Improve style in RETURN VALUES
Reported by:		des
MFC after:		3 days
Fixes:			571df2c64a (Explain how recv functions can)
Reviewed by:		mhorne, des
Approved by:		mhorne (mentor)
Differential Revision:	https://reviews.freebsd.org/D48995
2025-02-24 12:33:38 -05:00
Konstantin Belousov
e951247a98 statfs.2: document missing user-visible MNT flags
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2025-02-20 17:25:42 +02:00
Konstantin Belousov
0738cd9766 statfs.2: order MNT flags alphabetically
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2025-02-20 17:03:49 +02:00
Konstantin Belousov
13b92ae965 statfs.2: remove dead comment
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2025-02-20 16:58:17 +02:00
Konstantin Belousov
270542d95d statfs.2: uncomment and describe MNT_IGNORE
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2025-02-20 16:58:17 +02:00
Brooks Davis
cdb24fbb0a libsys: Don't create or expose __realpathat
Previously, __realpathat was in libc and libsys (as is currently
standard), but not exported from libc which meant the stub in libc was
not filtered and thus libc's copy of the syscall was used.  This broke
an upcoming change to CheriBSD limiting syscalls to libsys.

The realpath(3) implementation now uses __sys___realpathat so there are no
consumers of __realpathat.  Switch it to PSEUDO (only _foo and __sys_foo
symbols) and remove __realpathat from Symbol.map.

This is a corrected version of 58d43a3cd7.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D49049
2025-02-19 20:05:47 +00:00
Brooks Davis
58d43a3cd7 Revert "libsys: Don't create or expose __realpathat"
This change broke RTLD.  Revert while I test a fix.

This reverts commit fdccf03361.
2025-02-19 19:07:34 +00:00
Brooks Davis
fdccf03361 libsys: Don't create or expose __realpathat
Previously, __realpathat was in libc and libsys (as is currently
standard), but not exported from libc which meant the stub in libc was
not filtered and thus libc's copy of the syscall was used.  This broke
an upcoming change to CheriBSD limiting syscalls to libsys.

The realpath(3) implementation now uses __sys___realpathat so there are no
consumers of __realpathat.  Switch it to PSEUDO (only _foo and __sys_foo
symbols) and remove __realpathat from Symbol.map.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D49049
2025-02-19 16:55:05 +00:00
Felix Johnson
571df2c64a
recv.2: Explain how recv functions can return 0
Clarify the RETURN VALUES section with improved structure,
the condition of the return value 0, and the setting of errno.

PR:			174581
Reviewed by:		jhb, ziaee
Approved by:		mhorne (mentor)
Differential Revision:	https://reviews.freebsd.org/D48955
2025-02-12 22:54:14 -05:00
Mark Johnston
ee951eb59f socket: Add an option to retrieve a socket's FIB number
The SO_SETFIB option can be used to set a socket's FIB number, but there
is no way to retrieve it.  Rename SO_SETFIB to SO_FIB and implement a
handler for it for getsockopt(2).

Reviewed by:	glebius
MFC after:	2 weeks
Sponsored by:	Klara, Inc.
Sponsored by:	Stormshield
Differential Revision:	https://reviews.freebsd.org/D48834
2025-02-06 14:17:19 +00:00
Gleb Smirnoff
99e5a70046 sysent: regen for deletion of gssd_syscall and new ABI for rpctls_syscall 2025-02-01 01:00:28 -08:00
Gleb Smirnoff
030c028255 kgssapi: remove the gssd_syscall
Reviewed by:		brooks
Differential Revision:	https://reviews.freebsd.org/D48554
2025-02-01 01:00:26 -08:00
CismonX
c814172896 open.2: update description for O_PATH
- Add fstatfs(), fchdir(), fchroot(), extattr_*_fd(), cap_*_get(),
  cap_*_limit() to the list of syscalls that can take an O_PATH fd.
- Remove readlinkat() from the list, since it is already discussed
  in the first few lines of the paragraph.  It was originally added
  to the list when readlinkat() adds support for non-dir fd with
  an empty relative path (as if with AT_EMPTY_PATH), however,
  such use case is also discussed in the next paragraph.
- Add funlinkat() to the list, since it accepts an extra fd
  (of the file to be unlinked), which is worth extra mentioning.
- Fix a syntax issue which causes a bogus space to be rendered
  before a closing parentheses.

Signed-off-by: CismonX <admin@cismon.net>

Reviewed by:	markj, jhb
MFC after:	2 weeks
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1564
2025-01-24 20:15:09 +00:00
Mark Johnston
010ee8215f setfib.2: Note that the number of FIBs can be adjusted after boot
Reviewed by:	zlei, imp
MFC after:	2 weeks
Sponsored by:	Klara, Inc.
Sponsored by:	Stormshield
Differential Revision:	https://reviews.freebsd.org/D48545
2025-01-21 15:39:50 +00:00
Ed Maste
724e383bd4 munmap.2: Add STANDARDS and note about portability
POSIX used to specify that munmap shall fail with EINVAL if the addr
argument is not a multiple of the page size, but that was changed to
may fail.  Note that we conform to contemporary POSIX and include a
brief note for portable programs.

Reviewed by:	brooks
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48481
2025-01-16 12:50:47 -05:00
Ed Maste
fab411c4fd munmap.2: Remove EINVAL for negative len
len is unsigned (it is size_t), so cannot be negative.

Sponsored by:	The FreeBSD Foundation
2025-01-15 16:49:21 -05:00