History log of /freebsd-current/sys/sys/unistd.h
Revision Date Author Comments
# d8decc9a 19-Jan-2024 Konstantin Belousov <kib@FreeBSD.org>

Add kcmp(2) kernel bits

This is based purely on reading the Linux kcmp(2) man page.
In addition to the Linux set of comparators, I also added KCMP_FILEOBJ to
compare underlying file' objects.

Tested by: manu
Reviewed by: brooks, markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D43518


# 29363fb4 23-Nov-2023 Warner Losh <imp@FreeBSD.org>

sys: Remove ancient SCCS tags.

Remove ancient SCCS tags from the tree, automated scripting, with two
minor fixup to keep things compiling. All the common forms in the tree
were removed with a perl script.

Sponsored by: Netflix


# 2ff63af9 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

sys: Remove $FreeBSD$: one-line .h pattern

Remove /^\s*\*+\s*\$FreeBSD\$.*$\n/


# f3f3e3c4 03-Mar-2022 Mateusz Guzik <mjg@FreeBSD.org>

fd: add close_range(..., CLOSE_RANGE_CLOEXEC)

For compatibility with Linux.

MFC after: 3 days
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D34424


# 53465702 08-Dec-2021 Konstantin Belousov <kib@FreeBSD.org>

swapoff: add one more variant of the syscall

Requested and reviewed by: brooks
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D33343


# 0dc332bf 05-Aug-2021 Ka Ho Ng <khng@FreeBSD.org>

Add fspacectl(2), vn_deallocate(9) and VOP_DEALLOCATE(9).

fspacectl(2) is a system call to provide space management support to
userspace applications. VOP_DEALLOCATE(9) is a VOP call to perform the
deallocation. vn_deallocate(9) is a public KPI for kmods' use.

The purpose of proposing a new system call, a KPI and a VOP call is to
allow bhyve or other hypervisor monitors to emulate the behavior of SCSI
UNMAP/NVMe DEALLOCATE on a plain file.

fspacectl(2) comprises of cmd and flags parameters to specify the
space management operation to be performed. Currently cmd has to be
SPACECTL_DEALLOC, and flags has to be 0.

fo_fspacectl is added to fileops.
VOP_DEALLOCATE(9) is added as a new VOP call. A trivial implementation
of VOP_DEALLOCATE(9) is provided.

Sponsored by: The FreeBSD Foundation
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D28347


# 079c5b9e 25-Sep-2019 Kyle Evans <kevans@FreeBSD.org>

rfork(2): add RFSPAWN flag

When RFSPAWN is passed, rfork exhibits vfork(2) semantics but also resets
signal handlers in the child during creation to avoid a point of corruption
of parent state from the child.

This flag will be used by posix_spawn(3) to handle potential signal issues.

Reviewed by: jilles, kib
Differential Revision: https://reviews.freebsd.org/D19058


# 51369649 20-Nov-2017 Pedro F. Giffuni <pfg@FreeBSD.org>

sys: further adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 3-Clause license.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.


# fbbd9655 28-Feb-2017 Warner Losh <imp@FreeBSD.org>

Renumber copyright clause 4

Renumber cluase 4 to 3, per what everybody else did when BSD granted
them permission to remove clause 3. My insistance on keeping the same
numbering for legal reasons is too pedantic, so give up on that point.

Submitted by: Jan Schaumann <jschauma@stevens.edu>
Pull Request: https://github.com/freebsd/freebsd/pull/96


# c9eddd66 06-Jan-2017 Konstantin Belousov <kib@FreeBSD.org>

Define _POSIX_PRIORITY_SCHEDULING as 0.

sched_*(2) syscalls might be not available at runtime. Defining this
constant as zero directs POSIX-compliant code to call sysconf(3) to
detect the feature at runtime, and forces libc sysconf(3) to ask
kernel.

Noted by: ngie
Reviewed by: jilles, ngie
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D9055


# 399e8c17 09-Mar-2016 John Baldwin <jhb@FreeBSD.org>

Simplify AIO initialization now that it is standard.

- Mark AIO system calls as STD and remove the helpers to dynamically
register them.
- Use COMPAT6 for the old system calls with the older sigevent instead of
an 'o' prefix.
- Simplify the POSIX configuration to note that AIO is always available.
- Handle AIO in the default VOP_PATHCONF instead of special casing it in
the pathconf() system call. fpathconf() is still hackish.
- Remove freebsd32_aio_cancel() as it just called the native one directly.

Reviewed by: kib
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D5589


# d65f1abc 16-Aug-2012 David Xu <davidxu@FreeBSD.org>

Implement syscall clock_getcpuclockid2, so we can get a clock id
for process, thread or others we want to support.
Use the syscall to implement POSIX API clock_getcpuclock and
pthread_getcpuclockid.

PR: 168417


# 3e1ca43b 10-Mar-2012 Konstantin Belousov <kib@FreeBSD.org>

Add brackets around bare '-1' used as the macro body.

Noted by: bde
MFC after: 1 week


# 6d31bbad 08-Nov-2011 John Baldwin <jhb@FreeBSD.org>

Claim that _POSIX_ADVISORY_INFO is fully supported since posix_fadvise()
was added.

Submitted by: avilla
Discussed with: wollman


# cfb5f768 18-Aug-2011 Jonathan Anderson <jonathan@FreeBSD.org>

Add experimental support for process descriptors

A "process descriptor" file descriptor is used to manage processes
without using the PID namespace. This is required for Capsicum's
Capability Mode, where the PID namespace is unavailable.

New system calls pdfork(2) and pdkill(2) offer the functional equivalents
of fork(2) and kill(2). pdgetpid(2) allows querying the PID of the remote
process for debugging purposes. The currently-unimplemented pdwait(2) will,
in the future, allow querying rusage/exit status. In the interim, poll(2)
may be used to check (and wait for) process termination.

When a process is referenced by a process descriptor, it does not issue
SIGCHLD to the parent, making it suitable for use in libraries---a common
scenario when using library compartmentalisation from within large
applications (such as web browsers). Some observers may note a similarity
to Mach task ports; process descriptors provide a subset of this behaviour,
but in a UNIX style.

This feature is enabled by "options PROCDESC", but as with several other
Capsicum kernel features, is not enabled by default in GENERIC 9.0.

Reviewed by: jhb, kib
Approved by: re (kib), mentor (rwatson)
Sponsored by: Google Inc


# f49d8202 12-Jul-2011 Konstantin Belousov <kib@FreeBSD.org>

Implement an RFTSIGZMB flag to rfork(2) to specify a signal that is
delivered to parent when the child exists.

Submitted by: Petr Salinger <Petr.Salinger seznam cz> (Debian/kFreeBSD)
MFC after: 1 week
X-MFC-note: bump __FreeBSD_version


# a7d5f7eb 19-Oct-2010 Jamie Gritton <jamie@FreeBSD.org>

A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.


# 87694be1 18-Sep-2010 Tijl Coosemans <tijl@FreeBSD.org>

Indicate that POSIX semaphores are always supported.

Reported by: avilla
Reviewed by: davidxu
Approved by: kib (mentor)


# aa015c8e 24-Jun-2009 Edward Tomasz Napierala <trasz@FreeBSD.org>

Add NFSv4 ACL support to libc.

This adds the following functions to the acl(3) API: acl_add_flag_np,
acl_clear_flags_np, acl_create_entry_np, acl_delete_entry_np,
acl_delete_flag_np, acl_get_extended_np, acl_get_flag_np, acl_get_flagset_np,
acl_set_extended_np, acl_set_flagset_np, acl_to_text_np, acl_is_trivial_np,
acl_strip_np, acl_get_brand_np. Most of them are similar to what Darwin
does. There are no backward-incompatible changes.

Approved by: rwatson@


# becc6306 31-Jan-2009 Tom Rhodes <trhodes@FreeBSD.org>

Fix a typo in a comment.


# d7f03759 19-Oct-2008 Ulf Lilleengen <lulf@FreeBSD.org>

- Import the HEAD csup code which is the basis for the cvsmode work.


# 2b6271b7 07-Apr-2007 Pawel Jakub Dawidek <pjd@FreeBSD.org>

Hide SEEK_DATA and SEEK_HOLE under __BSD_VISIBLE.

Suggested by: ache


# f3fdfb67 07-Apr-2007 Pawel Jakub Dawidek <pjd@FreeBSD.org>

- Remove SEEK_DATA and SEEK_HOLE from stdio.h, they don't belong here.
- Only define SEEK_DATA and SEEK_HOLE in sys/unistd.h when neither
_POSIX_SOURCE nor _XOPEN_SOURCE is defined.

Pointed out by: bde, ache


# f6521d1c 05-Apr-2007 Pawel Jakub Dawidek <pjd@FreeBSD.org>

Implement SEEK_DATA and SEEK_HOLE extensions to lseek(2) as found in
OpenSolaris. For more information please refer to:

http://blogs.sun.com/bonwick/entry/seek_hole_and_seek_data


# e94466c6 01-Dec-2005 David Xu <davidxu@FreeBSD.org>

messqge queue has been implemented, set _POSIX_MESSAGE_PASSING to 200112L.


# 78052302 01-Dec-2005 David Xu <davidxu@FreeBSD.org>

We've already implemented all TMO functions, set _POSIX_TIMEOUTS to 200112L.


# 9b795716 29-Oct-2005 David Xu <davidxu@FreeBSD.org>

Change POSIX_TIMERS to 200112L.


# 74f38f3b 25-Oct-2005 Garrett Wollman <wollman@FreeBSD.org>

We've supported the _POSIX_MONOTONIC_CLOCK option for a long time.
Advertise it.

MFC after: 1 week


# ce887d51 22-Oct-2005 David Xu <davidxu@FreeBSD.org>

Change _POSIX_REALTIME_SIGNALS to 200112L to indicates we support
realtime signals. Define missing _POSIX_TIMERS, it will be changed to
200112L once struct sigevent is fixed.


# 60727d8b 06-Jan-2005 Warner Losh <imp@FreeBSD.org>

/* -> /*- for license, minor formatting changes


# 82c6e879 06-Apr-2004 Warner Losh <imp@FreeBSD.org>

Remove advertising clause from University of California Regent's license,
per letter dated July 22, 1999.

Approved by: core


# 188c541c 27-Oct-2002 Garrett Wollman <wollman@FreeBSD.org>

Update limits and configuration parameters for 1003.1/TC1/D6.
Implement new sysconf keys. Change the implenentation of
_SC_ASYNCHRONOUS_IO in preparation for the next set of changes.

Move some limits which had been in <sys/syslimits.h> to <limits.h> where
they belong. They had only ever been in syslimits.h to provide for the
kernel implementation of the CTL_USER MIB branch, which went away with
newsysctl years ago. (There is a #error in <sys/syslimits.h> which I
will downgrade in the next commit.)


# 0eb5dd8c 22-Oct-2002 Poul-Henning Kamp <phk@FreeBSD.org>

Only define SEEK_{SET,CUR,END} if not already defined (by <stdio.h>)


# be36629d 20-Oct-2002 Robert Watson <rwatson@FreeBSD.org>

Rename _POSIX_FOO_PRESENT and friends from POSIX.1e to _PC_FOO_PRESENT
and related friends. This would have been corrected had POSIX.1e
progressed to a standard.

Pointed out by: wollman


# e8e5bc4e 20-Oct-2002 Robert Watson <rwatson@FreeBSD.org>

Correct mis-spelling in pathconf constant _POSIX_ACL_CAP_PRESENT to
be the more correct _POSIX_CAP_PRESENT.


# d3d0ea18 13-Oct-2002 Mike Barcroft <mike@FreeBSD.org>

Move the _POSIX_VERSION constant from <unistd.h> to <sys/unistd.h>, so
that it can be used in-kernel for a sysctl.


# ad6c3481 21-Sep-2002 Bruce Evans <bde@FreeBSD.org>

Whitespace fixes (mainly for many more messes in the definitions of the
rfork() constants).


# a790f5b8 20-Sep-2002 Garrett Wollman <wollman@FreeBSD.org>

Claim to be 1003.1-2001. We're not quite, yet, but that's a more useful
target than any pre-C99 POSIX (which we could never have conformed to
under our ia32 ABI).

Document why HOST_NAME_MAX (and hopefully other similar constants in the
future) is not defined.

Define in <sys/unistd.h> all 1003.1-2001 option and option group constants
which did not meet the standard for inclusion in <unistd.h>. Delete from
<sys/unistd.h> all sysconf(3) constants and those option constants which
were moved to <unistd.h>. pathconf(3) keys remain here as pathconf() is
implemented directly as a system call. Add a comment noting brokenness
in some .1e additions here. Fix whitespace in definition of constants for
rfork().

(5 of 5)


# 5c153c5b 31-Jul-2002 Robert Watson <rwatson@FreeBSD.org>

Add pathconf/fpathconf entries from POSIX.1e indicating support for
ACLs, Capabilities, Information Labels, and MAC Labels on the
queried file system.


# 476d84ff 15-Jul-2002 Garrett Wollman <wollman@FreeBSD.org>

Move _CS_PATH from <sys/unistd.h> to <unistd.h> -- the kernel isn't involved
in confstr() processing.


# 6e6d4068 15-Jul-2002 Garrett Wollman <wollman@FreeBSD.org>

Define _POSIX_FSYNC unconditionally. (The standard has enough weasel-words
to allow us to claim compliance.) Define a few other nearby feature tests
in the way required by 1003.1-2001.


# a3ac2995 18-Dec-2001 John Baldwin <jhb@FreeBSD.org>

Make RFPPWAIT a kernel-only flag. Programs desiring this feature should
use vfork() rather than manually invoking rfork().


# 4d44f0b5 30-Nov-2001 Joseph Koshy <jkoshy@FreeBSD.org>

Add support for sysconf(_SC_NPROCESSORS_CONF) and sysconf(_SC_NPROCESSORS_ONLN).
This API is supported in SVR4.0MP, Solaris, Linux, AIX and Tru64 Unix.

PR: bin/27489
Submitted by: Arun Sharma <arun@sharma-home.net>
Reviewed by: bde (prior version)


# 37336173 18-Jun-2001 Garrett Wollman <wollman@FreeBSD.org>

After one too many PRs on the subject, bite the bullet and define IOV_MAX
and its associated constants. Implement _SC_IOV_MAX in the usual way.
Be a bit sloppy about the namespace question; this should get cleared up
in time for 5.0.

MFC after: 1 month


# df472ea4 12-Mar-2001 Dag-Erling Smørgrav <des@FreeBSD.org>

Don't allow userland to use the RFHIGHPID flag. Its only purpose is to
reserve low pids for system daemons during boot.


# 0384fff8 06-Sep-2000 Jason Evans <jasone@FreeBSD.org>

Major update to the way synchronization is done in the kernel. Highlights
include:

* Mutual exclusion is used instead of spl*(). See mutex(9). (Note: The
alpha port is still in transition and currently uses both.)

* Per-CPU idle processes.

* Interrupts are run in their own separate kernel threads and can be
preempted (i386 only).

Partially contributed by: BSDi (BSD/OS)
Submissions by (at least): cp, dfr, dillon, grog, jake, jhb, sheldonh


# aa543039 22-Apr-2000 Garrett Wollman <wollman@FreeBSD.org>

Implement POSIX.1b shared memory objects. In this implementation,
shared memory objects are regular files; the shm_open(3) routine
uses fcntl(2) to set a flag on the descriptor which tells mmap(2)
to automatically apply MAP_NOSYNC.

Not objected to by: bde, dillon, dufault, jasone


# 59685367 15-Mar-2000 Jason Evans <jasone@FreeBSD.org>

Add the _POSIX_SEMAPHORES feature flag.


# 346b6c5d 16-Dec-1999 Jason Evans <jasone@FreeBSD.org>

Move POSIX feature constants from pthread.h to unistd.h, as required by
1003.1c-1995.

Undefine _POSIX_THREAD_SAFE_FUNCTIONS, since we do not implement all of the
necessary interfaces. At least getgrgid_r(), getrnam_r(), getpwuid_r(),
getpwnam_r(), getc_unlocked(), getchar_unlocked(), putc_unlocked(),
and putchar_unlocked() are missing. Due to a likely typo in 1003.1c-1995,
we are not technically allowed to define _POSIX_THREADS without defining
_POSIX_THREAD_SAFE_FUNCTIONS, but either way we're non-compliant, so I'm
leaving _POSIX_THREADS defined.

PR: bin/8281


# c3aac50f 27-Aug-1999 Peter Wemm <peter@FreeBSD.org>

$Id$ -> $FreeBSD$


# dc9c271a 07-Jan-1999 Julian Elischer <julian@FreeBSD.org>

Changes to the LINUX_THREADS support to only allocate extra memory for
shared signal handling when there is shared signal handling being
used.

This removes the main objection to making the shared signal handling
a standard ability in rfork() and friends and 'unconditionalising'
this code. (i.e. the allocation of an extra 328 bytes per process).

Signal handling information remains in the U area until such a time as
it's reference count would be incremented to > 1. At that point a new
struct is malloc'd and maintained in KVM so that it can be shared between
the processes (threads) using it.

A function to check the reference count and move the struct back to the U
area when it drops back to 1 is also supplied. Signal information is
therefore now swapable for all processes that are not sharing that
information with other processes. THis should addres the concerns raised
by Garrett and others.

Submitted by: "Richard Seaman, Jr." <dick@tar.com>


# 6626c604 18-Dec-1998 Julian Elischer <julian@FreeBSD.org>

Reviewed by: Luoqi Chen, Jordan Hubbard
Submitted by: "Richard Seaman, Jr." <lists@tar.com>
Obtained from: linux :-)

Code to allow Linux Threads to run under FreeBSD.

By default not enabled
This code is dependent on the conditional
COMPAT_LINUX_THREADS (suggested by Garret)
This is not yet a 'real' option but will be within some number of hours.


# 8a6472b7 28-Mar-1998 Peter Dufault <dufault@FreeBSD.org>

Finish _POSIX_PRIORITY_SCHEDULING. Needs P1003_1B and
_KPOSIX_PRIORITY_SCHEDULING options to work. Changes:

Change all "posix4" to "p1003_1b". Misnamed files are left
as "posix4" until I'm told if I can simply delete them and add
new ones;

Add _POSIX_PRIORITY_SCHEDULING system calls for FreeBSD and Linux;

Add man pages for _POSIX_PRIORITY_SCHEDULING system calls;

Add options to LINT;

Minor fixes to P1003_1B code during testing.


# aac4ad2c 08-Mar-1998 Peter Dufault <dufault@FreeBSD.org>

Reviewed by: bde

Changes to support building with _POSIX_SOURCE set to 199309L:

1. Add sys/_posix.h to handle those preprocessor defs that POSIX
says have effects when defined before including any header files;

2. Change POSIX4_VISIBLE back to _POSIX4_VISIBLE

3. Add _POSIX4_VISIBLE_HISTORICALLY for pre-existing BSD features now
defined in POSIX. These show up when:

_POSIX_SOURCE and _POSIX_C_SOURCE are not set or
_POSIX_C_SOURCE is set >= 199309L

and vanish when:

_POSIX_SOURCE is set or _POSIX_C_SOURCE is < 199309L.

4. Explain these in man 9 posix4;

5. Include _posix.h and conditionalize on new feature test.


# 917e476d 04-Mar-1998 Peter Dufault <dufault@FreeBSD.org>

Reviewed by: msmith, bde long ago
POSIX.4 headers and sysctl variables. Nothing should change
unless POSIX4 is defined or _POSIX_VERSION is set to 199309.


# 2c1011f7 15-Jun-1997 John Dyson <dyson@FreeBSD.org>

Modifications to existing files to support the initial AIO/LIO and
kernel based threading support.


# 6875d254 22-Feb-1997 Peter Wemm <peter@FreeBSD.org>

Back out part 1 of the MCFH that changed $Id$ to $FreeBSD$. We are not
ready for it yet.


# 1130b656 14-Jan-1997 Jordan K. Hubbard <jkh@FreeBSD.org>

Make the long-awaited change from $Id$ to $FreeBSD$

This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore. This update would have been
insane otherwise.


# 729895d0 18-Dec-1996 Bruce Evans <bde@FreeBSD.org>

Restored comment about _POSIX_SAVED_IDS from rev.1.2.


# d9b9984e 06-Dec-1996 Andrey A. Chernov <ache@FreeBSD.org>

Turn off _POSIX_SAVED_IDS


# 3ac9e616 29-Nov-1996 Bruce Evans <bde@FreeBSD.org>

Changed _POSIX_VERSION from 198808L to 199009L. We're close to conforming
to the 1990 version according to NIST-PCTS. Many man pages still refer to
the 1988 version.


# b30b1174 03-Sep-1996 Bruce Evans <bde@FreeBSD.org>

Don't pollute the namespace with rfork flags if _POSIX_SOURCE is defined.


# 4c6acd9e 20-Aug-1996 Sujal Patel <smpatel@FreeBSD.org>

Sync rfork() flags up with OpenBSD.

Suggested by: Theo de Raadt <deraadt@theos.com>


# 0e3eb7ee 17-Apr-1996 Sujal Patel <smpatel@FreeBSD.org>

Implement the RFNOWAIT flag for rfork(). If set this flag will cause the
forked child to be dissociated from the parent).

Cleanup fork1(), implement vfork() and fork() in terms of rfork() flags.

Remove RFENVG, RFNOTEG, RFCNAMEG, RFCENVG which are Plan9 specific and cannot
possibly be implemented in FreeBSD.

Renumbered the flags to make up for the removal of the above flags.

Reviewed by: peter, smpatel
Submitted by: Mike Grupenhoff <kashmir@umiacs.umd.edu>


# dedb7b62 23-Feb-1996 Peter Wemm <peter@FreeBSD.org>

Garrett pointed out that the correct place for unix system call args
is <sys/unistd.h>, with the prototype in <unistd.h>. sys/unistd.h
is visible to the kernel compile, and is #included by unistd.h.

Also, I missed a reference to a static int in the midst of my other diffs.


# 0de89095 11-May-1995 Bruce Evans <bde@FreeBSD.org>

Define _POSIX_VDISABLE so that it can be used in #if expressions.


# 045d1485 29-Apr-1995 Andrey A. Chernov <ache@FreeBSD.org>

Enable _POSIX_SAVED_IDS and fix comment to describe current situation


# 3c4dd356 02-Aug-1994 David Greenman <dg@FreeBSD.org>

Added $Id$


# df8bae1d 24-May-1994 Rodney W. Grimes <rgrimes@FreeBSD.org>

BSD 4.4 Lite Kernel Sources