aboutsummaryrefslogtreecommitdiff
path: root/lib/libc/sys
Commit message (Collapse)AuthorAgeFilesLines
* aio_fsync(2): Support O_DSYNC.Thomas Munro2021-01-081-4/+14
| | | | | | | aio_fsync(O_DSYNC, ...) is the asynchronous version of fdatasync(2). Reviewed by: kib, asomers, jhb Differential Review: https://reviews.freebsd.org/D25071
* open(2): Add O_DSYNC flag.Thomas Munro2021-01-082-9/+30
| | | | | | | | | | | | | | | POSIX O_DSYNC means that writes include an implicit fdatasync(2), just as O_SYNC implies fsync(2). VOP_WRITE() functions that understand the new IO_DATASYNC flag can act accordingly, but we'll still pass down IO_SYNC so that file systems that don't understand it will continue to provide the stronger O_SYNC behaviour. Flag also applies to fcntl(2). Reviewed by: kib, delphij Differential Revision: https://reviews.freebsd.org/D25090
* Add aio_writev and aio_readvAlan Somers2021-01-036-24/+116
| | | | | | | | | | | | | | POSIX AIO is great, but it lacks vectored I/O functions. This commit fixes that shortcoming by adding aio_writev and aio_readv. They aren't part of the standard, but they're an obvious extension. They work just like their synchronous equivalents pwritev and preadv. It isn't yet possible to use vectored aiocbs with lio_listio, but that could be added in the future. Reviewed by: jhb, kib, bcr Relnotes: yes Differential Revision: https://reviews.freebsd.org/D27743
* copy_file_range(2): add recommendation to use large "len"Rick Macklem2021-01-031-1/+10
| | | | | | | | | | | | | PR#252358 reported a serious performance problem w.r.t. cp(1) when copying large non-sparse files. This problem appears to have been caused by cp(1) calling copy_file_range(2) with a small "len" argument. This patch adds a recommendation to use a large "len" value where possible, for performance reasons. Reviewed by: asomers Differential Revision: https://reviews.freebsd.org/D27935
* eventfd.2: Add the mail address of the submitter into copyright.Konstantin Belousov2020-12-281-1/+1
| | | | | Requested by: rgrimes MFC after: 13 days
* Document eventfd().Konstantin Belousov2020-12-272-1/+219
| | | | | | | Submitted by: greg@unrelenting.technology Reviewed by: bcr, markj (previous version) MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D26668
* kqueue(2): Use .Fo instead .FtKonstantin Belousov2020-12-271-1/+8
| | | | | MFC after: 3 days Sponsored by: The FreeBSD Foundation
* Add eventfd(3) wrappers to libc.Konstantin Belousov2020-12-271-0/+3
| | | | | | | | | eventfd_read/write one-liners are from musl libc. Submitted by: greg@unrelenting.technology Reviewed by: markj (previous version) MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D26668
* mmap(2): Update .Dd missed in the last commitGuangyuan Yang2020-12-241-1/+1
| | | | | PR: 252097 MFC after: 1 week
* mmap(2): Fix a typoGuangyuan Yang2020-12-241-1/+1
| | | | | | PR: 252097 MFC after: 1 week Reported by: Nick Frampton <nick.frampton@akips.com>
* libc: Fix most issues reported by mandocGordon Bergling2020-12-1916-34/+30
| | | | | | | | | | | | | | - varios "new sentence, new line" warnings - varios "sections out of conventional order" warnings - varios "unusual Xr order" warnings - varios "missing section argument" warnings - varios "no blank before trailing delimiter" warnings - varios "normalizing date format" warnings MFC after: 1 month Notes: svn path=/head/; revision=368817
* cpuset{,_getaffinity,_getdomain}.2: fix SEE ALSOEnji Cooper2020-12-113-7/+7
| | | | | | | | | | | | Sort by manpage section, then sort entries alphabetically. This makes the manpages `make manlint` clean. MFC after: 1 week Sponsored by: DellEMC Isilon Notes: svn path=/head/; revision=368546
* aio_suspend.2: properly canonicalize .DdEnji Cooper2020-12-111-1/+1
| | | | | | | | | | | | Months should be fully spelled as their local-specific equivalents: in this case `Oct` should have been spelled like `October`. Reported by: make manlint MFC after: 1 week Sponsored by: DellEMC Isilon Notes: svn path=/head/; revision=368537
* cap_enter(2): fix CAVEATS sectionEnji Cooper2020-12-111-13/+13
| | | | | | | | | | | | | | | | The CAVEATS section was misspelled as "CAVEAT" before this change. Fix the spelling to identify issues related to the section. Furthermore, given that the section order was incorrect, move the CAVEATS section down to the bottom of the manpage, per the conventional section order. MFC after: 1 week Reported by: make manlint Sponsored by: DellEMC Isilon Notes: svn path=/head/; revision=368536
* _umtx_op(2): document recent addition of 32bit compat flagsKyle Evans2020-12-091-1/+74
| | | | | | | | | This was part of D27325. Reviewed by: kib Notes: svn path=/head/; revision=368479
* extattr_get_file(20: bump .DdEnji Cooper2020-12-081-1/+1
| | | | | | | | | | | | | This is being done for the formatting and context changes. While the net content hasn't been changed, the content/context changes were sufficient to warrant the date bump. MFC after: 1 week MFC with: r368431, r368433, r368434, r368435 Sponsored by: DellEMC Isilon Notes: svn path=/head/; revision=368436
* extattr_get_file(2): clarify RETURN VALUESEnji Cooper2020-12-081-4/+15
| | | | | | | | | | | | | | | | | | | While some of the syscalls' behavior were documented and implied in the RETURN VALUES section by earlier, e.g., the DESCRIPTION sections, as having behavior of the other calls (`*_fd` vs `*_file` vs `*_link`), there was a lot of implied return value behavior in the section prior to this change. Explicitly document the syscall behavior per the current implementation in sys/kern/vfs_extattr.c so others can better develop based on its explicit documented behavior instead of having to digest the context of the manpage to understand the appropriate behavior. MFC after: 1 week MFC with: r368431, r368433, r368434 Sponsored by: DellEMC Isilon Notes: svn path=/head/; revision=368435
* extattr_get_file(2): fix more formattingEnji Cooper2020-12-081-3/+3
| | | | | | | | | | | - Remove an unnecessary trailing comma separating a two-item clause. - Sort more function calls alphabetically (in the same vein as r368433). MFC after: 1 week Sponsored by: DellEMC Isilon Notes: svn path=/head/; revision=368434
* extattr_get_file(2): sort syscalls alphabeticallyEnji Cooper2020-12-081-22/+22
| | | | | | | | | | | | | | | Although some sections of the manpage sort the syscalls alphabetically, many core areas of the manpage do not. Sort the syscalls so it is easier to pick out functional changes and to improve manpage readability. This formatting change is also being done to make future functional changes easier to spot. MFC after: 1 week Sponsored by: DellEMC Isilon Notes: svn path=/head/; revision=368433
* lio_listio(2): fix manlint errorEnji Cooper2020-12-081-1/+1
| | | | | | | | | | | The date with .Dd prior to this change isn't canonically spelled out: it should have been "December", not "Dec". MFC after: 1 week Sponsored by: DellEMC Isilon Notes: svn path=/head/; revision=368432
* extattr_get_fd(2): fix manlint errorsEnji Cooper2020-12-081-4/+4
| | | | | | | | | | | | | - The CAVEATS section was misspelled as "CAVEAT". - The CAVEATS section should come before the "BUGS" section and after other existing sections by convention. MFC after: 1 week Reported by: make manlint Sponsored by: DellEMC Isilon Notes: svn path=/head/; revision=368431
* _umtx_op: document UMTX_OP_SEM2_WAIT copyout behaviorKyle Evans2020-11-171-1/+22
| | | | | | | | | | | This clever technique to get a time remaining back was added to support sem_clockwait_np. Reviewed by: kib, vangyzen MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D27160 Notes: svn path=/head/; revision=367742
* Drop "All rights reserved" from all my stuff. This includesEdward Tomasz Napierala2020-10-281-1/+0
| | | | | | | | | | | | Foundation copyrights, approved by emaste@. It does not include files which carry other people's copyrights; if you're one of those people, feel free to make similar change. Reviewed by: emaste, imp, gbe (manpages) Differential Revision: https://reviews.freebsd.org/D26980 Notes: svn path=/head/; revision=367105
* Revise the description of MAP_STACK. In particular, describe the guardAlan Cox2020-10-271-19/+23
| | | | | | | | | | | in more detail. Reviewed by: bcr, kib, markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D26908 Notes: svn path=/head/; revision=367087
* update write(2)'s iovec limit w/ info about the iosize_max_clamp sysctl...John-Mark Gurney2020-10-261-4/+8
| | | | Notes: svn path=/head/; revision=367048
* mmap(2): Document guard size for MAP_STACK and related EINVAL.Konstantin Belousov2020-10-211-1/+8
| | | | | | | | | | | Based on submission by: emaste Reviewed by: emaste, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D26894 Notes: svn path=/head/; revision=366918
* Fix a few mandoc issuesGordon Bergling2020-10-095-7/+9
| | | | | | | | | | - skipping paragraph macro: Pp after Sh - sections out of conventional order: Sh EXAMPLES - whitespace at end of input line - normalizing date format Notes: svn path=/head/; revision=366583
* Updates to chroot(2) docsWarner Losh2020-09-291-2/+9
| | | | | | | | 1. Note what settings give historic behavior 2. Recommend jail under security considerations. Notes: svn path=/head/; revision=366266
* Document {O,AT}_RESOLVE_BENEATH and new O_BENEATH behavior for relative paths.Konstantin Belousov2020-09-2211-15/+113
| | | | | | | | | | | | PR: 248335 Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D25886 Notes: svn path=/head/; revision=366023
* Fix error checking in shm_create_largepage().Mark Johnston2020-09-181-1/+1
| | | | | | | | | | Reviewed by: alc, kib Reported by: Coverity MFC with: r365524 Differential Revision: https://reviews.freebsd.org/D26464 Notes: svn path=/head/; revision=365877
* memfd_create: simplify HUGETLB support a little bitKyle Evans2020-09-111-45/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | This also fixes a minor issue that was missed in the initial review; the layout of the MFD_HUGE_* flags is actually not 1:1 bit:flag -- it instead borrowed the Linux convention of how this is laid out since it was originally implemented on Linux, the top 6 bits represent the shift required for the requested page size. This allows us to remove the flag <-> pgsize mapping table and simplify the logic just prior to validation of the requested page size. While we're here, fix two small nits: - HUGETLB memfd shouldn't exhibit the SHM_GROW_ON_WRITE behavior. We can only grow largepage shm by appropriately aligned (i.e. requested pagesize) sizes, so it can't work in the typical/sane fashion. Furthermore, Linux does the same, so let's be compatible. - We don't allow MFD_HUGETLB without specifying a pagesize, so no need to check for that later. Reviewed by: kib (slightly earlier version) Notes: svn path=/head/; revision=365624
* memfd_create: fix return valuesKyle Evans2020-09-101-8/+16
| | | | | | | | | | Literally returning EINVAL from a function designed to return an fd makes for interesting scenarios. I cannot assign enough pointy hats to cover this one. Notes: svn path=/head/; revision=365615
* Fix memfd_create tests after r365524Kyle Evans2020-09-101-1/+1
| | | | | | | | | | | | r365524 did accidentally invert this check that sets SHM_LARGEPAGE, leading non-hugetlb memfd as unconfigured largepage shm and thus test failures when we try to ftruncate or write to them. PR: 249236 Discussed with: kib Notes: svn path=/head/; revision=365593
* Add shm_create_largepage(3) helper for creation and configuration ofKonstantin Belousov2020-09-092-8/+109
| | | | | | | | | | | | | | | | largepage shm objects. And since we can, add memfd_create(MFD_HUGETLB) support, hopefully close enough to the Linux feature. Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D24652 Notes: svn path=/head/; revision=365524
* getlogin_r: fix the type of lenKyle Evans2020-09-091-2/+2
| | | | | | | | | | | | | | | | | | | | | | getlogin_r is specified by POSIX to to take a size_t len, not int. Fix our version to do the same, bump the symbol version due to ABI change and provide compat. This was reported to break compilation of Ruby 2.8. Some discussion about the necessity of the ABI compat did take place in the review. While many 64-bit platforms would likely be passing it in a 64-bit register and zero-extended and thus, not notice ABI breakage, some do sign-extend (e.g. mips). PR: 247102 Submitted by: Bertram Scharpf <software@bertram-scharpf.de> (original) Submitted by: cem (ABI compat) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D26335 Notes: svn path=/head/; revision=365506
* Include the psind in data returned by mincore(2).Mark Johnston2020-09-021-3/+25
| | | | | | | | | | | | | | | | | | | | | | | | Currently we use a single bit to indicate whether the virtual page is part of a superpage. To support a forthcoming implementation of non-transparent 1GB superpages, it is useful to provide more detailed information about large page sizes. The change converts MINCORE_SUPER into a mask for MINCORE_PSIND(psind) values, indicating a mapping of size psind, where psind is an index into the pagesizes array returned by getpagesizes(3), which in turn comes from the hw.pagesizes sysctl. MINCORE_PSIND(1) is equal to the old value of MINCORE_SUPER. For now, two bits are used to record the page size, permitting values of MAXPAGESIZES up to 4. Reviewed by: alc, kib Sponsored by: Juniper Networks, Inc. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D26238 Notes: svn path=/head/; revision=365267
* [skip ci] document close_range(2) as async-signal-safeAlan Somers2020-07-211-1/+2
| | | | | | | | | | Reviewed by: bcr (manpages) MFC after: 2 weeks Sponsored by: Axcient Differential Revision: https://reviews.freebsd.org/D25513 Notes: svn path=/head/; revision=363398
* lseek(2): Document the seek behavior better and update the POSIX complianceGordon Bergling2020-07-131-6/+35
| | | | | | | | | | | | | | | | | | | | In certain situations lseek(2) will return successful although if no seek was performed. This can happen when operating on devices that don't support seeking (older tape drives) or when operating on changeable media devices (such as DVD or Blu-ray devices) without a medium inserted. Document this within the man page and update the POSIX compliance while here. PR: 162765 Submitted by: arundel@ Reported by: arundel@ Reviewed by: bcr (mentor) Approved by: bcr (mentor) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D25646 Notes: svn path=/head/; revision=363156
* procctl(2): consistently refer to the last agrument as 'data'Allan Jude2020-07-111-5/+6
| | | | | | | | | | | | | | Some older references called it 'arg' Also fix a syntax error that was underlining an entire sentence. PR: 247386 Reported by: Paul Floyd <paulf@free.fr>, PauAmma (research) MFC after: 2 weeks Sponsored by: Klara Inc. Notes: svn path=/head/; revision=363104
* memfd_create: turn on SHM_GROW_ON_WRITEKyle Evans2020-07-101-1/+1
| | | | | | | | | | | memfd_create fds will no longer require an ftruncate(2) to set the size; they'll grow (to the extent that it's possible) upon write(2)-like syscalls. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D25502 Notes: svn path=/head/; revision=363066
* Apply the logic from r363051 to semctl(2) and __sem_base field.Mark Johnston2020-07-091-2/+1
| | | | | | | | | | Reported by: Jeffball <jeffball@grimm-co.com> MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D25600 Notes: svn path=/head/; revision=363055
* Avoid copying out kernel pointers from msgctl(IPC_STAT).Mark Johnston2020-07-091-3/+1
| | | | | | | | | | | | | | | | | While this behaviour is harmless, it is really just an artifact of the fact that the msgctl(2) implementation uses a user-visible structure as part of the internal implementation, so it is not deliberate and these pointers are not useful to userspace. Thus, NULL them out before copying out, and remove references to them from the manual page. Reported by: Jeffball <jeffball@grimm-co.com> Reviewed by: emaste, kib MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D25600 Notes: svn path=/head/; revision=363051
* Chroot actually appeared in 7th Edition Unix.Warner Losh2020-06-261-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | Chroot appeared during the development of 7th edition Unix. The FreeBSD jail documents, incorrectly, that Bill Joy added this to 4.2BSD on 18 March 1982. That was when Bill Joy converted from a statically coded system call glue to dynamically generated assembler. Chroot was present in 32V, 3BSD, 4.0BSD, 4.1BSD and 4.1cBSD well in advance of this. Kirk McKusick agrees with this analysis. See also: V7: https://minnie.tuhs.org/cgi-bin/utree.pl?file=V7/usr/src/libc/sys/chroot.s 32V: https://minnie.tuhs.org/cgi-bin/utree.pl?file=32V/usr/src/libc/sys/chroot.s 3BSD: https://minnie.tuhs.org/cgi-bin/utree.pl?file=3BSD/usr/src/libc/sys/chroot.s 4BSD: https://minnie.tuhs.org/cgi-bin/utree.pl?file=4BSD/usr/src/libc/sys/chroot.s 4.1cBSD: https://minnie.tuhs.org/cgi-bin/utree.pl?file=4.1cBSD/usr/src/libc/sys/chroot.s The 6th and earlier editions do not have this system call, nor do they have anything named chroot in the trees available from TUHS. Reviewed by: allanjude@ Differential Revision: https://reviews.freebsd.org/D25475 Notes: svn path=/head/; revision=362664
* man page of select(2) should mention pselect(2)Pawel Biernacki2020-06-251-1/+2
| | | | | | | | | | | Reviewed by: bcr (manpages), kib, trasz Approved by: kib (mentor) MFC after: 7 days Sponsored by: Mysterious Code Ltd. Differential Revision: https://reviews.freebsd.org/D25169 Notes: svn path=/head/; revision=362611
* Fix a typo in cpuset_getdomain.2Mateusz Piotrowski2020-06-181-2/+2
| | | | | | | | | PR: 247385 Reported by: Paul Floyd <paulf free.fr> MFC after: 1 week Notes: svn path=/head/; revision=362336
* libcasper(3): Document HISTORY within the manpagesGordon Bergling2020-06-164-4/+24
| | | | | | | | | | Reviewed by: bcr (mentor) Approved by: bcr (mentor) MFC after: 7 days Differential Revision: https://reviews.freebsd.org/D24695 Notes: svn path=/head/; revision=362230
* libc manpages: various improvements from NetBSDGordon Bergling2020-06-143-3/+31
| | | | | | | | | | | | | | - Add STANDARDS and HISTORY sections within the appropriate manpages - Mention two USENIX papers within kqueue(2) and strlcpy(3) Reviewed by: bcr (mentor) Approved by: bcr (mentor) Obtained from: NetBSD MFC after: 7 days Differential Revision: https://reviews.freebsd.org/D24650 Notes: svn path=/head/; revision=362171
* procctl(2): document PROC_KPTIKonstantin Belousov2020-06-131-1/+42
| | | | | | | | | | Reviewed by: bcr Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D25258 Notes: svn path=/head/; revision=362151
* procctl(2): consistently refer to the data pointer as 'data'.Konstantin Belousov2020-06-131-6/+6
| | | | | | | | | | Reviewed by: bcr Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D25258 Notes: svn path=/head/; revision=362150
* vfs: add restrictions to read(2) of a directory [2/2]Kyle Evans2020-06-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | This commit adds the priv(9) that waters down the sysctl to make it only allow read(2) of a dirfd by the system root. Jailed root is not allowed, but jail policy and superuser policy will abstain from allowing/denying it so that a MAC module can fully control the policy. Such a MAC module has been written, and can be found at: https://people.freebsd.org/~kevans/mac_read_dir-0.1.0.tar.gz It is expected that the MAC module won't be needed by many, as most only need to do such diagnostics that require this behavior as system root anyways. Interested parties are welcome to grab the MAC module above and create a port or locally integrate it, and with enough support it could see introduction to base. As noted in mac_read_dir.c, it is released under the BSD 2 clause license and allows the restrictions to be lifted for only jailed root or for all unprivileged users. PR: 246412 Reviewed by: mckusick, kib, emaste, jilles, cy, phk, imp (all previous) Reviewed by: rgrimes (latest version) Differential Revision: https://reviews.freebsd.org/D24596 Notes: svn path=/head/; revision=361799