aboutsummaryrefslogtreecommitdiff
path: root/lib/libc/sys
diff options
context:
space:
mode:
authorSimon J. Gerraty <sjg@FreeBSD.org>2013-10-13 02:35:19 +0000
committerSimon J. Gerraty <sjg@FreeBSD.org>2013-10-13 02:35:19 +0000
commit3caf0790a80c2e10c82a3a07719cddb2065c65d1 (patch)
tree2c6f4d1ca5d1c643faea64e1f4c90105a1ab406a /lib/libc/sys
parentaab5fee0721846740415f201b41c920033a49303 (diff)
parent006a42a9cb173cefe32d169c46748d6f00c41315 (diff)
downloadsrc-3caf0790a80c2e10c82a3a07719cddb2065c65d1.tar.gz
src-3caf0790a80c2e10c82a3a07719cddb2065c65d1.zip
Merge head@256284
Notes
Notes: svn path=/projects/bmake/; revision=256424
Diffstat (limited to 'lib/libc/sys')
-rw-r--r--lib/libc/sys/Makefile.inc1
-rw-r--r--lib/libc/sys/Symbol.map3
-rw-r--r--lib/libc/sys/accept.213
-rw-r--r--lib/libc/sys/close.26
-rw-r--r--lib/libc/sys/ioctl.212
-rw-r--r--lib/libc/sys/procctl.2142
-rw-r--r--lib/libc/sys/read.220
-rw-r--r--lib/libc/sys/socketpair.26
-rw-r--r--lib/libc/sys/write.218
9 files changed, 187 insertions, 34 deletions
diff --git a/lib/libc/sys/Makefile.inc b/lib/libc/sys/Makefile.inc
index 4cc87ae27860..ac5907b82540 100644
--- a/lib/libc/sys/Makefile.inc
+++ b/lib/libc/sys/Makefile.inc
@@ -197,6 +197,7 @@ MAN+= abort2.2 \
posix_fadvise.2 \
posix_fallocate.2 \
posix_openpt.2 \
+ procctl.2 \
profil.2 \
pselect.2 \
ptrace.2 \
diff --git a/lib/libc/sys/Symbol.map b/lib/libc/sys/Symbol.map
index 222f5f0811f5..fe887c3ddd57 100644
--- a/lib/libc/sys/Symbol.map
+++ b/lib/libc/sys/Symbol.map
@@ -395,6 +395,7 @@ FBSD_1.3 {
ffclock_setestimate;
pipe2;
posix_fadvise;
+ procctl;
wait6;
};
@@ -822,6 +823,8 @@ FBSDprivate_1.0 {
__sys_poll;
_preadv;
__sys_preadv;
+ _procctl;
+ __sys_procctl;
_profil;
__sys_profil;
_pselect;
diff --git a/lib/libc/sys/accept.2 b/lib/libc/sys/accept.2
index 76fb463a1ef2..7b8422a05527 100644
--- a/lib/libc/sys/accept.2
+++ b/lib/libc/sys/accept.2
@@ -28,7 +28,7 @@
.\" @(#)accept.2 8.2 (Berkeley) 12/11/93
.\" $FreeBSD$
.\"
-.Dd May 1, 2013
+.Dd October 1, 2013
.Dt ACCEPT 2
.Os
.Sh NAME
@@ -155,13 +155,20 @@ For some applications, performance may be enhanced by using an
.Xr accept_filter 9
to pre-process incoming connections.
.Pp
-Portable programs should not rely on the
+When using
+.Fn accept ,
+portable programs should not rely on the
.Dv O_NONBLOCK
and
.Dv O_ASYNC
properties and the signal destination being inherited,
but should set them explicitly using
-.Xr fcntl 2 .
+.Xr fcntl 2 ;
+.Fn accept4
+sets these properties consistently,
+but may not be fully portable across
+.Ux
+platforms.
.Sh RETURN VALUES
These calls return \-1 on error.
If they succeed, they return a non-negative
diff --git a/lib/libc/sys/close.2 b/lib/libc/sys/close.2
index c3a09725e34c..6df4500643be 100644
--- a/lib/libc/sys/close.2
+++ b/lib/libc/sys/close.2
@@ -28,7 +28,7 @@
.\" @(#)close.2 8.2 (Berkeley) 4/19/94
.\" $FreeBSD$
.\"
-.Dd January 22, 2012
+.Dd September 11, 2013
.Dt CLOSE 2
.Os
.Sh NAME
@@ -39,7 +39,7 @@
.Sh SYNOPSIS
.In unistd.h
.Ft int
-.Fn close "int d"
+.Fn close "int fd"
.Sh DESCRIPTION
The
.Fn close
@@ -107,7 +107,7 @@ system call will fail if:
.Bl -tag -width Er
.It Bq Er EBADF
The
-.Fa d
+.Fa fd
argument
is not an active descriptor.
.It Bq Er EINTR
diff --git a/lib/libc/sys/ioctl.2 b/lib/libc/sys/ioctl.2
index bab7b4794b78..81500a938ac9 100644
--- a/lib/libc/sys/ioctl.2
+++ b/lib/libc/sys/ioctl.2
@@ -29,7 +29,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd May 11, 2010
+.Dd September 11, 2013
.Dt IOCTL 2
.Os
.Sh NAME
@@ -40,7 +40,7 @@
.Sh SYNOPSIS
.In sys/ioctl.h
.Ft int
-.Fn ioctl "int d" "unsigned long request" ...
+.Fn ioctl "int fd" "unsigned long request" ...
.Sh DESCRIPTION
The
.Fn ioctl
@@ -51,7 +51,7 @@ may be controlled with
.Fn ioctl
requests.
The argument
-.Fa d
+.Fa fd
must be an open file descriptor.
.Pp
The third argument to
@@ -116,19 +116,19 @@ will fail if:
.Bl -tag -width Er
.It Bq Er EBADF
The
-.Fa d
+.Fa fd
argument
is not a valid descriptor.
.It Bq Er ENOTTY
The
-.Fa d
+.Fa fd
argument
is not associated with a character
special device.
.It Bq Er ENOTTY
The specified request does not apply to the kind
of object that the descriptor
-.Fa d
+.Fa fd
references.
.It Bq Er EINVAL
The
diff --git a/lib/libc/sys/procctl.2 b/lib/libc/sys/procctl.2
new file mode 100644
index 000000000000..32bf34d6a1dd
--- /dev/null
+++ b/lib/libc/sys/procctl.2
@@ -0,0 +1,142 @@
+.\" Copyright (c) 2013 Advanced Computing Technologies LLC
+.\" Written by: John H. Baldwin <jhb@FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd September 19, 2013
+.Dt PROCCTL 2
+.Os
+.Sh NAME
+.Nm procctl
+.Nd control processes
+.Sh LIBRARY
+.Lb libc
+.Sh SYNOPSIS
+.In sys/procctl.h
+.Ft int
+.Fn procctl "idtype_t idtype" "id_t id" "int cmd" "void *arg"
+.Sh DESCRIPTION
+The
+.Fn procctl
+system call provides for control over processes.
+The
+.Fa idtype
+and
+.Fa id
+arguments specify the set of processes to control.
+If multiple processes match the identifier,
+.Nm
+will make a
+.Dq best effort
+to control as many of the selected possibles as possible.
+An error is only returned if no selected processes successfully complete
+the request.
+The following identifier types are supported:
+.Bl -tag -width "Dv P_PGID"
+.It Dv P_PID
+Control the process with the process ID
+.Fa id .
+.It Dv P_PGID
+Control processes belonging to the process group with the ID
+.Fa id .
+.El
+.Pp
+The control request to perform is specified by the
+.Fa cmd
+argument.
+The following commands are supported:
+.Bl -tag -width "Dv PROC_SPROTECT"
+.It Dv PROC_SPROTECT
+Set process protection state.
+This is used to mark a process as protected from being killed if the system
+exhausts available memory and swap.
+The
+.Fa arg
+parameter must point to an integer containing an operation and zero or more
+optional flags.
+The following operations are supported:
+.Bl -tag -width "Dv PPROT_CLEAR"
+.It Dv PPROT_SET
+Mark the selected processes as protected.
+.It Dv PPROT_CLEAR
+Clear the protected state of selected processes.
+.El
+.Pp
+The following optional flags are supported:
+.Bl -tag -width "Dv PPROT_DESCE"
+.It Dv PPROT_DESCEND
+Apply the requested operation to all child processes of each selected process
+in addition to each selected process.
+.It Dv PPROT_INHERIT
+When used with
+.Dv PPROT_SET ,
+mark all future child processes of each selected process as protected.
+Future child processes will also mark all of their future child processes.
+.El
+.El
+.Sh RETURN VALUES
+If an error occurs, a value of -1 is returned and
+.Va errno
+is set to indicate the error.
+.Sh ERRORS
+The
+.Fn procctl
+system call
+will fail if:
+.Bl -tag -width Er
+.It Bq Er EFAULT
+The
+.Fa arg
+points outside the process's allocated address space.
+.It Bq Er EINVAL
+The
+.Fa cmd
+argument specifies an unsupported command.
+.Pp
+The
+.Fa idtype
+argument specifies an unsupported identifier type.
+.It Bq Er EPERM
+The calling process does not have permission to perform the requested
+operation on any of the selected processes.
+.It Bq Er ESRCH
+No processes matched the requested
+.Fa idtype
+and
+.Fa id .
+.It Bq Er EINVAL
+An invalid operation or flag was passed in
+.Fa arg
+for a
+.Dv PROC_SPROTECT
+command.
+.El
+.Sh SEE ALSO
+.Xr ptrace 2
+.Sh HISTORY
+The
+.Fn procctl
+function appeared in
+.Fx 10 .
diff --git a/lib/libc/sys/read.2 b/lib/libc/sys/read.2
index 2127eda3990e..e99665fa6b2f 100644
--- a/lib/libc/sys/read.2
+++ b/lib/libc/sys/read.2
@@ -28,7 +28,7 @@
.\" @(#)read.2 8.4 (Berkeley) 2/26/94
.\" $FreeBSD$
.\"
-.Dd January 22, 2012
+.Dd September 11, 2013
.Dt READ 2
.Os
.Sh NAME
@@ -43,14 +43,14 @@
.In sys/types.h
.In unistd.h
.Ft ssize_t
-.Fn read "int d" "void *buf" "size_t nbytes"
+.Fn read "int fd" "void *buf" "size_t nbytes"
.Ft ssize_t
-.Fn pread "int d" "void *buf" "size_t nbytes" "off_t offset"
+.Fn pread "int fd" "void *buf" "size_t nbytes" "off_t offset"
.In sys/uio.h
.Ft ssize_t
-.Fn readv "int d" "const struct iovec *iov" "int iovcnt"
+.Fn readv "int fd" "const struct iovec *iov" "int iovcnt"
.Ft ssize_t
-.Fn preadv "int d" "const struct iovec *iov" "int iovcnt" "off_t offset"
+.Fn preadv "int fd" "const struct iovec *iov" "int iovcnt" "off_t offset"
.Sh DESCRIPTION
The
.Fn read
@@ -58,7 +58,7 @@ system call
attempts to read
.Fa nbytes
of data from the object referenced by the descriptor
-.Fa d
+.Fa fd
into the buffer pointed to by
.Fa buf .
The
@@ -107,7 +107,7 @@ On objects capable of seeking, the
.Fn read
starts at a position
given by the pointer associated with
-.Fa d
+.Fa fd
(see
.Xr lseek 2 ) .
Upon return from
@@ -149,12 +149,12 @@ will succeed unless:
.Bl -tag -width Er
.It Bq Er EBADF
The
-.Fa d
+.Fa fd
argument
is not a valid file or socket descriptor open for reading.
.It Bq Er ECONNRESET
The
-.Fa d
+.Fa fd
argument refers to a socket, and the remote socket end is
forcibly closed.
.It Bq Er EFAULT
@@ -173,7 +173,7 @@ was interrupted by the delivery of a signal
before any data arrived.
.It Bq Er EINVAL
The pointer associated with
-.Fa d
+.Fa fd
was negative.
.It Bq Er EAGAIN
The file was marked for non-blocking I/O,
diff --git a/lib/libc/sys/socketpair.2 b/lib/libc/sys/socketpair.2
index 08d00d3c0e5f..d3a47ebb2318 100644
--- a/lib/libc/sys/socketpair.2
+++ b/lib/libc/sys/socketpair.2
@@ -28,7 +28,7 @@
.\" @(#)socketpair.2 8.1 (Berkeley) 6/4/93
.\" $FreeBSD$
.\"
-.Dd March 19, 2013
+.Dd September 11, 2013
.Dt SOCKETPAIR 2
.Os
.Sh NAME
@@ -40,13 +40,13 @@
.In sys/types.h
.In sys/socket.h
.Ft int
-.Fn socketpair "int d" "int type" "int protocol" "int *sv"
+.Fn socketpair "int fd" "int type" "int protocol" "int *sv"
.Sh DESCRIPTION
The
.Fn socketpair
system call creates an unnamed pair of connected sockets in
the specified domain
-.Fa d ,
+.Fa fd ,
of the specified
.Fa type ,
and using the optionally specified
diff --git a/lib/libc/sys/write.2 b/lib/libc/sys/write.2
index d22b9854efe3..a06e7c9d89f6 100644
--- a/lib/libc/sys/write.2
+++ b/lib/libc/sys/write.2
@@ -28,7 +28,7 @@
.\" @(#)write.2 8.5 (Berkeley) 4/2/94
.\" $FreeBSD$
.\"
-.Dd January 22, 2012
+.Dd September 11, 2013
.Dt WRITE 2
.Os
.Sh NAME
@@ -43,14 +43,14 @@
.In sys/types.h
.In unistd.h
.Ft ssize_t
-.Fn write "int d" "const void *buf" "size_t nbytes"
+.Fn write "int fd" "const void *buf" "size_t nbytes"
.Ft ssize_t
-.Fn pwrite "int d" "const void *buf" "size_t nbytes" "off_t offset"
+.Fn pwrite "int fd" "const void *buf" "size_t nbytes" "off_t offset"
.In sys/uio.h
.Ft ssize_t
-.Fn writev "int d" "const struct iovec *iov" "int iovcnt"
+.Fn writev "int fd" "const struct iovec *iov" "int iovcnt"
.Ft ssize_t
-.Fn pwritev "int d" "const struct iovec *iov" "int iovcnt" "off_t offset"
+.Fn pwritev "int fd" "const struct iovec *iov" "int iovcnt" "off_t offset"
.Sh DESCRIPTION
The
.Fn write
@@ -58,7 +58,7 @@ system call
attempts to write
.Fa nbytes
of data to the object referenced by the descriptor
-.Fa d
+.Fa fd
from the buffer pointed to by
.Fa buf .
The
@@ -107,7 +107,7 @@ On objects capable of seeking, the
.Fn write
starts at a position
given by the pointer associated with
-.Fa d ,
+.Fa fd ,
see
.Xr lseek 2 .
Upon return from
@@ -154,7 +154,7 @@ will fail and the file pointer will remain unchanged if:
.Bl -tag -width Er
.It Bq Er EBADF
The
-.Fa d
+.Fa fd
argument
is not a valid descriptor open for writing.
.It Bq Er EPIPE
@@ -174,7 +174,7 @@ or data to be written to the file
points outside the process's allocated address space.
.It Bq Er EINVAL
The pointer associated with
-.Fa d
+.Fa fd
was negative.
.It Bq Er ENOSPC
There is no free space remaining on the file system