mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-15 10:17:20 +00:00
Remove the internal implementation details of wrapping syscalls,
which do not match the reality anyway. Approved by: deischen, bde
This commit is contained in:
parent
5b9df042e6
commit
db8caf03e5
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=85555
@ -132,30 +132,6 @@ by issuing a
|
||||
call providing only the control information,
|
||||
or by calling
|
||||
.Xr setsockopt 2 .
|
||||
.Sh IMPLEMENTATION NOTES
|
||||
In the non-threaded library
|
||||
.Fn accept
|
||||
is implemented as the
|
||||
.Va accept
|
||||
syscall.
|
||||
.Pp
|
||||
In the threaded library, the
|
||||
.Va accept
|
||||
syscall is assembled to
|
||||
.Fn _thread_sys_accept
|
||||
and
|
||||
.Fn accept
|
||||
is implemented as a function which locks
|
||||
.Fa s
|
||||
for read and write, then calls
|
||||
.Fn _thread_sys_accept .
|
||||
If the call to
|
||||
.Fn _thread_sys_accept
|
||||
would block, a context switch is performed.
|
||||
Before returning,
|
||||
.Fn accept
|
||||
unlocks
|
||||
.Fa s .
|
||||
.Sh RETURN VALUES
|
||||
The call returns \-1 on error. If it succeeds, it returns a non-negative
|
||||
integer that is a descriptor for the accepted socket.
|
||||
|
@ -68,27 +68,6 @@ Consult the manual entries in section 4 for detailed information.
|
||||
For maximum portability, you should always zero-out the socket structure
|
||||
before populating it, before passing it to
|
||||
.Fn bind .
|
||||
.Sh IMPLEMENTATION NOTES
|
||||
In the non-threaded library
|
||||
.Fn bind
|
||||
is implemented as the
|
||||
.Va bind
|
||||
syscall.
|
||||
.Pp
|
||||
In the threaded library, the
|
||||
.Va bind
|
||||
syscall is assembled to
|
||||
.Fn _thread_sys_bind
|
||||
and
|
||||
.Fn bind
|
||||
is implemented as a function which locks
|
||||
.Fa s
|
||||
for read and write, then calls
|
||||
.Fn _thread_sys_bind .
|
||||
Before returning,
|
||||
.Fn bind
|
||||
unlocks
|
||||
.Fa s .
|
||||
.Sh RETURN VALUES
|
||||
.Rv -std bind
|
||||
.Sh ERRORS
|
||||
|
@ -101,27 +101,6 @@ execve; the call
|
||||
.Dq Li fcntl(d, F_SETFD, 0)
|
||||
restores the default,
|
||||
which is to not close the descriptor.
|
||||
.Sh IMPLEMENTATION NOTES
|
||||
In the non-threaded library
|
||||
.Fn close
|
||||
is implemented as the
|
||||
.Va close
|
||||
syscall.
|
||||
.Pp
|
||||
In the threaded library, the
|
||||
.Va close
|
||||
syscall is assembled to
|
||||
.Fn _thread_sys_close
|
||||
and
|
||||
.Fn close
|
||||
is implemented as a function which locks
|
||||
.Fa d
|
||||
for read and write, then calls
|
||||
.Fn _thread_sys_close .
|
||||
Before returning,
|
||||
.Fn close
|
||||
unlocks
|
||||
.Fa d .
|
||||
.Sh RETURN VALUES
|
||||
.Rv -std close
|
||||
.Sh ERRORS
|
||||
|
@ -71,30 +71,6 @@ only once; datagram sockets may use
|
||||
multiple times to change their association.
|
||||
Datagram sockets may dissolve the association
|
||||
by connecting to an invalid address, such as a null address.
|
||||
.Sh IMPLEMENTATION NOTES
|
||||
In the non-threaded library
|
||||
.Fn connect
|
||||
is implemented as the
|
||||
.Va connect
|
||||
syscall.
|
||||
.Pp
|
||||
In the threaded library, the
|
||||
.Va connect
|
||||
syscall is assembled to
|
||||
.Fn _thread_sys_connect
|
||||
and
|
||||
.Fn connect
|
||||
is implemented as a function which locks
|
||||
.Va s
|
||||
for read and write, then calls
|
||||
.Fn _thread_sys_connect .
|
||||
If the call to
|
||||
.Fn _thread_sys_connect
|
||||
would block, a context switch is performed.
|
||||
Before returning,
|
||||
.Fn connect
|
||||
unlocks
|
||||
.Va s .
|
||||
.Sh RETURN VALUES
|
||||
.Rv -std connect
|
||||
.Sh ERRORS
|
||||
|
@ -115,52 +115,6 @@ and
|
||||
is a valid descriptor, then
|
||||
.Fn dup2
|
||||
is successful, and does nothing.
|
||||
.Sh IMPLEMENTATION NOTES
|
||||
In the non-threaded library
|
||||
.Fn dup
|
||||
is implemented as the
|
||||
.Va dup
|
||||
syscall.
|
||||
.Pp
|
||||
In the threaded library, the
|
||||
.Va dup
|
||||
syscall is assembled to
|
||||
.Fn _thread_sys_dup
|
||||
and
|
||||
.Fn dup
|
||||
is implemented as a function which locks
|
||||
.Fa oldd
|
||||
for read and write, then calls
|
||||
.Fn _thread_sys_dup .
|
||||
Before returning,
|
||||
.Fn dup
|
||||
unlocks
|
||||
.Fa oldd .
|
||||
.Pp
|
||||
In the non-threaded library
|
||||
.Fn dup2
|
||||
is implemented as the
|
||||
.Va dup2
|
||||
syscall.
|
||||
.Pp
|
||||
In the threaded library, the
|
||||
.Va dup2
|
||||
syscall is assembled to
|
||||
.Fn _thread_sys_dup2
|
||||
and
|
||||
.Fn dup2
|
||||
is implemented as a function which locks both
|
||||
.Fa oldd
|
||||
and
|
||||
.Fa newd
|
||||
for read and write, then calls
|
||||
.Fn _thread_sys_dup2 .
|
||||
Before returning,
|
||||
.Fn dup2
|
||||
unlocks
|
||||
.Fa oldd .
|
||||
and
|
||||
.Fa newd .
|
||||
.Sh RETURN VALUES
|
||||
The value -1 is returned if an error occurs in either call.
|
||||
The external variable
|
||||
|
@ -189,22 +189,6 @@ and
|
||||
.Fa argv
|
||||
points to the array of character pointers
|
||||
to the arguments themselves.
|
||||
.Sh IMPLEMENTATION NOTES
|
||||
In the non-threaded library
|
||||
.Fn execve
|
||||
is implemented as the
|
||||
.Va execve
|
||||
syscall.
|
||||
.Pp
|
||||
In the threaded library, the
|
||||
.Va execve
|
||||
syscall is assembled to
|
||||
.Fn _thread_sys_execve
|
||||
and
|
||||
.Fn execve
|
||||
is implemented as a function which performs user-thread
|
||||
library re-initialization and then calls
|
||||
.Fn _thread_sys_execve .
|
||||
.Sh RETURN VALUES
|
||||
As the
|
||||
.Fn execve
|
||||
|
@ -352,28 +352,6 @@ This implementation detects that sleeping until a locked region is unlocked
|
||||
would cause a deadlock and fails with an
|
||||
.Er EDEADLK
|
||||
error.
|
||||
.Sh IMPLEMENTATION NOTES
|
||||
In the non-threaded library
|
||||
.Fn fcntl
|
||||
is implemented as the
|
||||
.Va fcntl
|
||||
syscall.
|
||||
.Pp
|
||||
In the threaded library, the
|
||||
.Va fcntl
|
||||
syscall is assembled to
|
||||
.Fn _thread_sys_fcntl
|
||||
and
|
||||
.Fn fcntl
|
||||
is implemented as a function which disables thread rescheduling, locks
|
||||
.Fa fd
|
||||
for read and write, then calls
|
||||
.Fn _thread_sys_fcntl .
|
||||
Before returning,
|
||||
.Fn fcntl
|
||||
unlocks
|
||||
.Fa fd
|
||||
and enables thread rescheduling.
|
||||
.Sh RETURN VALUES
|
||||
Upon successful completion, the value returned depends on
|
||||
.Fa cmd
|
||||
|
@ -112,27 +112,6 @@ forks and the child explicitly unlocks the file, the parent will
|
||||
lose its lock.
|
||||
.Pp
|
||||
Processes blocked awaiting a lock may be awakened by signals.
|
||||
.Sh IMPLEMENTATION NOTES
|
||||
In the non-threaded library
|
||||
.Fn flock
|
||||
is implemented as the
|
||||
.Va flock
|
||||
syscall.
|
||||
.Pp
|
||||
In the threaded library, the
|
||||
.Va flock
|
||||
syscall is assembled to
|
||||
.Fn _thread_sys_flock
|
||||
and
|
||||
.Fn flock
|
||||
is implemented as a function which locks
|
||||
.Fa fd
|
||||
for read and write, then calls
|
||||
.Fn _thread_sys_flock .
|
||||
Before returning,
|
||||
.Fn flock
|
||||
unlocks
|
||||
.Fa fd .
|
||||
.Sh RETURN VALUES
|
||||
.Rv -std flock
|
||||
.Sh ERRORS
|
||||
|
@ -56,27 +56,6 @@ of buffers for the associated file to be written to a disk.
|
||||
should be used by programs that require a file to be
|
||||
in a known state, for example, in building a simple transaction
|
||||
facility.
|
||||
.Sh IMPLEMENTATION NOTES
|
||||
In the non-threaded library
|
||||
.Fn fsync
|
||||
is implemented as the
|
||||
.Va fsync
|
||||
syscall.
|
||||
.Pp
|
||||
In the threaded library, the
|
||||
.Va fsync
|
||||
syscall is assembled to
|
||||
.Fn _thread_sys_fsync
|
||||
and
|
||||
.Fn fsync
|
||||
is implemented as a function which locks
|
||||
.Fa fd
|
||||
for read and write, then calls
|
||||
.Fn _thread_sys_fsync .
|
||||
Before returning,
|
||||
.Fn fsync
|
||||
unlocks
|
||||
.Fa fd .
|
||||
.Sh RETURN VALUES
|
||||
.Rv -std fsync
|
||||
.Sh ERRORS
|
||||
|
@ -141,27 +141,6 @@ a value returned in the location pointed to by
|
||||
.Pf ( Fn getdirentries
|
||||
only)
|
||||
or zero.
|
||||
.Sh IMPLEMENTATION NOTES
|
||||
In the non-threaded library
|
||||
.Fn getdirentries
|
||||
is implemented as the
|
||||
.Va getdirentries
|
||||
syscall.
|
||||
.Pp
|
||||
In the threaded library, the
|
||||
.Va getdirentries
|
||||
syscall is assembled to
|
||||
.Fn _thread_sys_getdirentries
|
||||
and
|
||||
.Fn getdirentries
|
||||
is implemented as a function which locks
|
||||
.Fa fd
|
||||
for read and write, then calls
|
||||
.Fn _thread_sys_getdirentries .
|
||||
Before returning,
|
||||
.Fn getdirentries
|
||||
unlocks
|
||||
.Fa fd .
|
||||
.Sh RETURN VALUES
|
||||
If successful, the number of bytes actually transferred is returned.
|
||||
Otherwise, -1 is returned and the global variable
|
||||
|
@ -58,27 +58,6 @@ the amount of space pointed to by
|
||||
On return it contains the actual size of the name
|
||||
returned (in bytes).
|
||||
The name is truncated if the buffer provided is too small.
|
||||
.Sh IMPLEMENTATION NOTES
|
||||
In the non-threaded library
|
||||
.Fn getpeername
|
||||
is implemented as the
|
||||
.Va getpeername
|
||||
syscall.
|
||||
.Pp
|
||||
In the threaded library, the
|
||||
.Va getpeername
|
||||
syscall is assembled to
|
||||
.Fn _thread_sys_getpeername
|
||||
and
|
||||
.Fn getpeername
|
||||
is implemented as a function which locks
|
||||
.Fa s
|
||||
for read and write, then calls
|
||||
.Fn _thread_sys_getpeername .
|
||||
Before returning,
|
||||
.Fn getpeername
|
||||
unlocks
|
||||
.Fa s .
|
||||
.Sh RETURN VALUES
|
||||
.Rv -std getpeername
|
||||
.Sh ERRORS
|
||||
|
@ -56,27 +56,6 @@ the amount of space pointed to by
|
||||
.Fa name .
|
||||
On return it contains the actual size of the name
|
||||
returned (in bytes).
|
||||
.Sh IMPLEMENTATION NOTES
|
||||
In the non-threaded library
|
||||
.Fn getsockname
|
||||
is implemented as the
|
||||
.Va getsockname
|
||||
syscall.
|
||||
.Pp
|
||||
In the threaded library, the
|
||||
.Va getsockname
|
||||
syscall is assembled to
|
||||
.Fn _thread_sys_getsockname
|
||||
and
|
||||
.Fn getsockname
|
||||
is implemented as a function which locks
|
||||
.Fa fd
|
||||
for read and write, then calls
|
||||
.Fn _thread_sys_getsockname .
|
||||
Before returning,
|
||||
.Fn getsockname
|
||||
unlocks
|
||||
.Fa fd .
|
||||
.Sh RETURN VALUES
|
||||
.Rv -std getsockname
|
||||
.Sh ERRORS
|
||||
|
@ -348,48 +348,6 @@ returns any pending error on the socket and clears
|
||||
the error status.
|
||||
It may be used to check for asynchronous errors on connected
|
||||
datagram sockets or for other asynchronous errors.
|
||||
.Sh IMPLEMENTATION NOTES
|
||||
In the non-threaded library
|
||||
.Fn getsockopt
|
||||
is implemented as the
|
||||
.Va getsockopt
|
||||
syscall.
|
||||
.Pp
|
||||
In the threaded library, the
|
||||
.Va getsockopt
|
||||
syscall is assembled to
|
||||
.Fn _thread_sys_getsockopt
|
||||
and
|
||||
.Fn getsockopt
|
||||
is implemented as a function which locks
|
||||
.Fa s
|
||||
for read and write, then calls
|
||||
.Fn _thread_sys_getsockopt .
|
||||
Before returning,
|
||||
.Fn getsockopt
|
||||
unlocks
|
||||
.Fa s .
|
||||
.Pp
|
||||
In the non-threaded library
|
||||
.Fn setsockopt
|
||||
is implemented as the
|
||||
.Va setsockopt
|
||||
syscall.
|
||||
.Pp
|
||||
In the threaded library, the
|
||||
.Va setsockopt
|
||||
syscall is assembled to
|
||||
.Fn _thread_sys_setsockopt
|
||||
and
|
||||
.Fn setsockopt
|
||||
is implemented as a function which locks
|
||||
.Fa s
|
||||
for read and write, then calls
|
||||
.Fn _thread_sys_setsockopt .
|
||||
Before returning,
|
||||
.Fn setsockopt
|
||||
unlocks
|
||||
.Fa s .
|
||||
.Sh RETURN VALUES
|
||||
.Rv -std
|
||||
.Sh ERRORS
|
||||
|
@ -85,27 +85,6 @@ Macros and defines used in specifying an ioctl
|
||||
.Fa request
|
||||
are located in the file
|
||||
.Ao Pa sys/ioctl.h Ac .
|
||||
.Sh IMPLEMENTATION NOTES
|
||||
In the non-threaded library
|
||||
.Fn ioctl
|
||||
is implemented as the
|
||||
.Va ioctl
|
||||
syscall.
|
||||
.Pp
|
||||
In the threaded library, the
|
||||
.Va ioctl
|
||||
syscall is assembled to
|
||||
.Fn _thread_sys_ioctl
|
||||
and
|
||||
.Fn ioctl
|
||||
is implemented as a function which locks
|
||||
.Va d
|
||||
for read and write, then calls
|
||||
.Fn _thread_sys_ioctl .
|
||||
Before returning,
|
||||
.Fn ioctl
|
||||
unlocks
|
||||
.Va d .
|
||||
.Sh RETURN VALUES
|
||||
If an error has occurred, a value of -1 is returned and
|
||||
.Va errno
|
||||
|
@ -85,27 +85,6 @@ or less than zero is specified,
|
||||
.Fa backlog
|
||||
is silently forced to
|
||||
.Va kern.ipc.somaxconn .
|
||||
.Sh IMPLEMENTATION NOTES
|
||||
In the non-threaded library
|
||||
.Fn listen
|
||||
is implemented as the
|
||||
.Va listen
|
||||
syscall.
|
||||
.Pp
|
||||
In the threaded library, the
|
||||
.Va listen
|
||||
syscall is assembled to
|
||||
.Fn _thread_sys_listen
|
||||
and
|
||||
.Fn listen
|
||||
is implemented as a function which locks
|
||||
.Fa s
|
||||
for read and write, then calls
|
||||
.Fn _thread_sys_listen .
|
||||
Before returning,
|
||||
.Fn listen
|
||||
unlocks
|
||||
.Fa s .
|
||||
.Sh RETURN VALUES
|
||||
.Rv -std listen
|
||||
.Sh ERRORS
|
||||
|
@ -182,25 +182,6 @@ The system imposes a limit on the number of file descriptors
|
||||
open simultaneously by one process.
|
||||
.Xr Getdtablesize 2
|
||||
returns the current system limit.
|
||||
.Sh IMPLEMENTATION NOTES
|
||||
In the non-threaded library
|
||||
.Fn open
|
||||
is implemented as the
|
||||
.Va open
|
||||
syscall.
|
||||
.Pp
|
||||
In the threaded library, the
|
||||
.Va open
|
||||
syscall is assembled to
|
||||
.Fn _thread_sys_open
|
||||
and
|
||||
.Fn open
|
||||
is implemented as a function which disables thread rescheduling
|
||||
and calls
|
||||
.Fn _thread_sys_open .
|
||||
Before returning,
|
||||
.Fn open
|
||||
enables thread rescheduling.
|
||||
.Sh RETURN VALUES
|
||||
If successful,
|
||||
.Fn open
|
||||
|
@ -116,54 +116,6 @@ return the number of bytes actually read and placed in the buffer.
|
||||
The system guarantees to read the number of bytes requested if
|
||||
the descriptor references a normal file that has that many bytes left
|
||||
before the end-of-file, but in no other case.
|
||||
.Sh IMPLEMENTATION NOTES
|
||||
In the non-threaded library
|
||||
.Fn read
|
||||
is implemented as the
|
||||
.Va read
|
||||
syscall.
|
||||
.Pp
|
||||
In the threaded library, the
|
||||
.Va read
|
||||
syscall is assembled to
|
||||
.Fn _thread_sys_read
|
||||
and
|
||||
.Fn read
|
||||
is implemented as a function which locks
|
||||
.Fa d
|
||||
for read, then calls
|
||||
.Fn _thread_sys_read .
|
||||
If the call to
|
||||
.Fn _thread_sys_read
|
||||
would block, a context switch is performed.
|
||||
Before returning,
|
||||
.Fn read
|
||||
unlocks
|
||||
.Fa d .
|
||||
.Pp
|
||||
In the non-threaded library
|
||||
.Fn readv
|
||||
is implemented as the
|
||||
.Va readv
|
||||
syscall.
|
||||
.Pp
|
||||
In the threaded library, the
|
||||
.Va readv
|
||||
syscall is assembled to
|
||||
.Fn _thread_sys_readv
|
||||
and
|
||||
.Fn readv
|
||||
is implemented as a function which locks
|
||||
.Fa d
|
||||
for read, then calls
|
||||
.Fn _thread_sys_readv .
|
||||
If the call to
|
||||
.Fn _thread_sys_readv
|
||||
would block, a context switch is performed.
|
||||
Before returning,
|
||||
.Fn readv
|
||||
unlocks
|
||||
.Fa d .
|
||||
.Sh RETURN VALUES
|
||||
If successful, the
|
||||
number of bytes actually read is returned.
|
||||
|
@ -104,33 +104,6 @@ The
|
||||
implementation of
|
||||
.Fn sendfile
|
||||
is "zero-copy", meaning that it has been optimized so that copying of the file data is avoided.
|
||||
.Pp
|
||||
In the non-threaded library
|
||||
.Fn sendfile
|
||||
is implemented as the
|
||||
.Va sendfile
|
||||
syscall.
|
||||
.Pp
|
||||
In the threaded library, the
|
||||
.Va sendfile
|
||||
syscall is assembled to
|
||||
.Fn _thread_sys_sendfile
|
||||
and
|
||||
.Fn sendfile
|
||||
is implemented as a function which locks
|
||||
.Fa fd
|
||||
for reading and
|
||||
.Fa s
|
||||
for writing, then calls
|
||||
.Fn _thread_sys_sendfile .
|
||||
If the call to
|
||||
.Fn _thread_sys_sendfile
|
||||
would block, a context switch is performed. Before returning,
|
||||
.Fn sendfile
|
||||
unlocks
|
||||
.Fa fd
|
||||
and
|
||||
.Fa s .
|
||||
.Sh RETURN VALUES
|
||||
.Rv -std sendfile
|
||||
.Sh ERRORS
|
||||
|
@ -124,54 +124,6 @@ and
|
||||
may write fewer bytes than requested;
|
||||
the return value must be noted,
|
||||
and the remainder of the operation should be retried when possible.
|
||||
.Sh IMPLEMENTATION NOTES
|
||||
In the non-threaded library
|
||||
.Fn write
|
||||
is implemented as the
|
||||
.Va write
|
||||
syscall.
|
||||
.Pp
|
||||
In the threaded library, the
|
||||
.Va write
|
||||
syscall is assembled to
|
||||
.Fn _thread_sys_write
|
||||
and
|
||||
.Fn write
|
||||
is implemented as a function which locks
|
||||
.Fa d
|
||||
for read and write, then calls
|
||||
.Fn _thread_sys_write .
|
||||
If the call to
|
||||
.Fn _thread_sys_write
|
||||
would block, a context switch is performed.
|
||||
Before returning,
|
||||
.Fn write
|
||||
unlocks
|
||||
.Fa d .
|
||||
.Pp
|
||||
In the non-threaded library
|
||||
.Fn writev
|
||||
is implemented as the
|
||||
.Va writev
|
||||
syscall.
|
||||
.Pp
|
||||
In the threaded library, the
|
||||
.Va writev
|
||||
syscall is assembled to
|
||||
.Fn _thread_sys_writev
|
||||
and
|
||||
.Fn writev
|
||||
is implemented as a function which locks
|
||||
.Fa d
|
||||
for read and write, then calls
|
||||
.Fn _thread_sys_writev .
|
||||
If the call to
|
||||
.Fn _thread_sys_writev
|
||||
would block, a context switch is performed.
|
||||
Before returning,
|
||||
.Fn writev
|
||||
unlocks
|
||||
.Fa d .
|
||||
.Sh RETURN VALUES
|
||||
Upon successful completion the number of bytes which were written
|
||||
is returned. Otherwise a -1 is returned and the global variable
|
||||
|
Loading…
Reference in New Issue
Block a user