Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC)

- Fix for possible unset uid/gid in toproto
 - Fix for default mtree style
 - Update libelf
 - Importing libexecinfo
 - Resynchronize GCC, mpc, gmp, mpfr
 - build.sh: Replace params with show-params.
     This has been done as the make target has been renamed in the same
     way, while a new target named params has been added. This new
     target generates a file containing all the parameters, instead of
     printing it on the console.
 - Update test48 with new etc/services (Fix by Ben Gras <ben@minix3.org)
     get getservbyport() out of the inner loop

Change-Id: Ie6ad5226fa2621ff9f0dee8782ea48f9443d2091
This commit is contained in:
2013-12-06 12:04:52 +01:00
parent ff10274392
commit 84d9c625bf
4655 changed files with 379317 additions and 151059 deletions

View File

@@ -1,4 +1,4 @@
# $NetBSD: Makefile.inc,v 1.217 2012/10/02 01:46:40 christos Exp $
# $NetBSD: Makefile.inc,v 1.221 2013/11/09 13:05:59 njoly Exp $
# @(#)Makefile.inc 8.3 (Berkeley) 10/24/94
.if defined(__MINIX)
@@ -34,7 +34,7 @@ SRCS+= posix_fadvise.c posix_madvise.c sched.c sigqueue.c sigtimedwait.c \
# glue to provide compatibility between GCC 1.X and 2.X and for compat
# with old syscall interfaces.
GLUE+= ftruncate.c lseek.c mmap.c pread.c preadv.c pwrite.c \
pwritev.c truncate.c ntp_adjtime.c
pwritev.c truncate.c ntp_adjtime.c mknodat.c
GLUE50+= adjtime.c clock_settime.c settimeofday.c
@@ -106,12 +106,12 @@ ASM= access.S acct.S \
lchflags.S lchmod.S lchown.S lfs_bmapv.S lfs_markv.S lfs_segclean.S \
__lfs_segwait50.S link.S linkat.S listen.S __lstat50.S \
__lutimes50.S _lwp_create.S _lwp_exit.S _lwp_kill.S \
___lwp_park50.S _lwp_self.S _lwp_wait.S _lwp_unpark.S \
_lwp_self.S _lwp_wait.S _lwp_unpark.S \
_lwp_unpark_all.S _lwp_suspend.S _lwp_continue.S \
_lwp_wakeup.S _lwp_detach.S _lwp_setprivate.S \
_lwp_setname.S _lwp_getname.S _lwp_ctl.S \
madvise.S mincore.S minherit.S mkdir.S mkdirat.S mkfifo.S mkfifoat.S \
__mknod50.S mknodat.S mlock.S mlockall.S modctl.S __mount50.S \
__mknod50.S mlock.S mlockall.S modctl.S __mount50.S \
mprotect.S __msgctl50.S msgget.S munlock.S munlockall.S \
munmap.S \
nfssvc.S __ntp_gettime50.S \
@@ -221,14 +221,14 @@ LintSysPseudoNoerr.c: ${LIBCDIR}/sys/makelintstub \
.endif # !defined(__MINIX)
.if !defined(__MINIX)
MAN+= accept.2 access.2 acct.2 bind.2 brk.2 chdir.2 \
chflags.2 chmod.2 chown.2 chroot.2 clone.2 close.2 \
MAN+= accept.2 access.2 acct.2 adjtime.2 bind.2 brk.2 chdir.2 \
chflags.2 chmod.2 chown.2 chroot.2 clock_settime.2 clone.2 close.2 \
connect.2 dup.2 execve.2 _exit.2 extattr_get_file.2 \
fcntl.2 fdatasync.2 fhopen.2 \
flock.2 fork.2 fsync.2 getcontext.2 getdents.2 \
getfh.2 getgid.2 getgroups.2 \
getfh.2 getvfsstat.2 getgid.2 getgroups.2 \
getitimer.2 getlogin.2 getpeername.2 getpgrp.2 getpid.2 \
getpriority.2 getrlimit.2 getsid.2 getsockname.2 \
getpriority.2 getrlimit.2 getrusage.2 getsid.2 getsockname.2 \
getsockopt.2 gettimeofday.2 getuid.2 intro.2 ioctl.2 issetugid.2 \
kill.2 kqueue.2 ktrace.2 \
lfs_bmapv.2 lfs_markv.2 lfs_segclean.2 lfs_segwait.2 \
@@ -272,7 +272,6 @@ MLINKS+=chmod.2 fchmod.2 chmod.2 lchmod.2
MLINKS+=chown.2 fchown.2 chown.2 lchown.2
MLINKS+=chroot.2 fchroot.2
.else
MAN+= statvfs.2
MLINKS+=clock_settime.2 clock_gettime.2
MLINKS+=clock_settime.2 clock_getres.2
.endif # !defined(__MINIX)
@@ -288,7 +287,11 @@ MLINKS+=extattr_get_file.2 extattr_set_file.2 \
extattr_get_file.2 extattr_set_link.2 \
extattr_get_file.2 extattr_delete_link.2 \
extattr_get_file.2 extattr_list_link.2
MLINKS+=access.2 faccessat.2
MLINKS+=chmod.2 fchmodat.2
MLINKS+=chown.2 fchownat.2
MLINKS+=fhopen.2 fhstat.2 fhopen.2 fhstatvfs.2 fhopen.2 fhstatvfs1.2
MLINKS+=stat.2 fstatat.2
MLINKS+=fsync.2 fsync_range.2
MLINKS+=getcontext.2 setcontext.2
MLINKS+=getgid.2 getegid.2
@@ -312,18 +315,25 @@ MLINKS+=_lwp_getprivate.2 _lwp_setprivate.2
MLINKS+=madvise.2 posix_madvise.2
MLINKS+=mlock.2 munlock.2
MLINKS+=mlockall.2 munlockall.2
MLINKS+=mkdir.2 mkdirat.2
MLINKS+=mkfifo.2 mkfifoat.2
MLINKS+=mknod.2 mknodat.2
MLINKS+=mount.2 unmount.2
MLINKS+=open.2 openat.2
MLINKS+=ntp_adjtime.2 ntp_gettime.2
MLINKS+=pathconf.2 fpathconf.2
MLINKS+=pmc_control.2 pmc_get_info.2
MLINKS+=poll.2 pollts.2
MLINKS+=read.2 readv.2 read.2 pread.2 read.2 preadv.2
MLINKS+=readlink.2 readlinkat.2
MLINKS+=recv.2 recvfrom.2 recv.2 recvmsg.2 recv.2 recvmmsg.2
MLINKS+=rename.2 renameat.2
MLINKS+=select.2 pselect.2
MLINKS+=send.2 sendmsg.2 send.2 sendto.2 send.2 sendmmsg.2
MLINKS+=setpgid.2 setpgrp.2
MLINKS+=setuid.2 setegid.2 setuid.2 seteuid.2 setuid.2 setgid.2
MLINKS+=shmat.2 shmdt.2
MLINKS+=symlink.2 symlinkat.2
MLINKS+=timer_settime.2 timer_gettime.2 timer_settime.2 timer_getoverrun.2
MLINKS+=sigqueue.2 sigqueueinfo.2
MLINKS+=sigtimedwait.2 sigwaitinfo.2
@@ -334,12 +344,15 @@ MLINKS+=statvfs.2 statvfs1.2
MLINKS+=statvfs.2 fstatvfs1.2
MLINKS+=syscall.2 __syscall.2
MLINKS+=truncate.2 ftruncate.2
MLINKS+=unlink.2 unlinkat.2
MLINKS+=utimes.2 futimes.2 utimes.2 lutimes.2
MLINKS+=utimes.2 futimens.2 utimes.2 utimensat.2
MLINKS+=utimes.2 utimens.2 utimes.2 futimens.2 utimes.2 lutimens.2
MLINKS+=utimes.2 utimensat.2
MLINKS+=wait.2 wait3.2 wait.2 wait4.2 wait.2 waitpid.2
MLINKS+=write.2 writev.2 write.2 pwrite.2 write.2 pwritev.2
.else
MLINKS+=pipe.2 pipe2.2
MAN+= statvfs.2
MLINKS+=statvfs.2 fstatvfs.2
MLINKS+=statvfs.2 statvfs1.2
MLINKS+=statvfs.2 fstatvfs1.2

View File

@@ -1,4 +1,4 @@
.\" $NetBSD: _lwp_getprivate.2,v 1.4 2008/04/30 13:10:51 martin Exp $
.\" $NetBSD: _lwp_getprivate.2,v 1.6 2013/10/05 09:18:56 njoly Exp $
.\"
.\" Copyright (c) 2003 The NetBSD Foundation, Inc.
.\" All rights reserved.
@@ -27,7 +27,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd January 16, 2003
.Dd September 7, 2013
.Dt _LWP_GETPRIVATE 2
.Os
.Sh NAME
@@ -50,6 +50,27 @@ in a location private to the LWP.
.Pp
.Fn _lwp_getprivate
returns the pointer to private data for the LWP.
.Pp
Some platforms provide alternative ways quicker than
.Fn _lwp_getprivate
to use the pointer.
.Bl -tag -width amd64
.It alpha
The pointer can be retrieved by call_pal PAL_rdunique.
.It amd64
The base address of
.Dv %fs
register is set to the pointer so that the private data can be
accessed using the selector.
.It i386
The base address of
.Dv %gs
register is set to the pointer so that the private data can be
accessed using the selector.
.It sparc
.Dv %g7
register is set to the pointer.
.El
.Sh ERRORS
The
.Fn _lwp_getprivate

View File

@@ -1,4 +1,4 @@
.\" $NetBSD: accept.2,v 1.29 2012/03/19 09:34:36 plunky Exp $
.\" $NetBSD: accept.2,v 1.31 2013/08/02 20:13:09 wiz Exp $
.\"
.\" Copyright (c) 1983, 1990, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -142,11 +142,16 @@ function behaves exactly like
but it also allows to set the following
.Fa flags
on the returned file descriptor:
.Bl -column SOCK_NONBLOCK -offset indent
.Bl -tag -width SOCK_NOSIGPIPEXX -offset indent
.It Dv SOCK_CLOEXEC
Set the close on exec property.
.It Dv SOCK_NONBLOCK
Sets non-blocking I/O.
.It Dv SOCK_NOSIGPIPE
Return
.Er EPIPE
instead of raising
.Dv SIGPIPE .
.El
.Pp
It can also temporarily replace the signal mask of the calling thread if

View File

@@ -1,4 +1,4 @@
.\" $NetBSD: access.2,v 1.26 2010/05/03 05:53:56 jruoho Exp $
.\" $NetBSD: access.2,v 1.32 2013/01/13 08:15:02 dholland Exp $
.\"
.\" Copyright (c) 1980, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -29,11 +29,12 @@
.\"
.\" @(#)access.2 8.2 (Berkeley) 4/1/94
.\"
.Dd May 3, 2010
.Dd January 12, 2013
.Dt ACCESS 2
.Os
.Sh NAME
.Nm access
.Nm access ,
.Nm faccessat
.Nd check access permissions of a file or pathname
.Sh LIBRARY
.Lb libc
@@ -41,59 +42,58 @@
.In unistd.h
.Ft int
.Fn access "const char *path" "int mode"
.In fcntl.h
.Ft int
.Fn faccessat "int fd" "const char *path" "int mode" "int flags"
.Sh DESCRIPTION
The
.Fn access
function checks the accessibility of the
file named by
.Fa path .
The
.Fn faccessat
function checks the accessibility of the file named by
.Fa path
for the access permissions indicated by
.Fa mode .
The value of
.Fa mode
is the bitwise inclusive OR of the access permissions to be
checked
.Pf ( Dv R_OK
for read permission,
.Dv W_OK
for write permission and
.Dv X_OK
for execute/search permission) or the existence test,
.Dv F_OK .
using
.Fa fd
as the starting point for relative pathnames.
If
.Fa fd
is
.Dv AT_FDCWD
the current directory is used.
Calling
.Fn access
is equivalent to calling
.Fn faccessat
with
.Fa fd
set to
.Dv AT_FDCWD
and
.Fa flags
set to 0.
.Pp
The form of access to check is specified by the bitwise or of the
following values for
.Fa mode :
.Bl -tag -width W_OK
.It Dv R_OK
Check for read permission.
.It Dv W_OK
Check for write permission.
.It Dv X_OK
Check for execute/search permission.
.It Dv F_OK
Check only for existence.
.El
.Pp
All components of the pathname
.Fa path
are checked for access permissions (including
.Dv F_OK ) .
are checked for access permissions as well.
.Pp
The real user ID is used in place of the effective user ID
and the real group access list
(including the real group ID) are
used in place of the effective ID for verifying permission.
.Pp
If a process has super-user privileges and indicates success for
.Dv R_OK
or
.Dv W_OK ,
the file may not actually have read or write permission bits set.
If a process has super-user privileges and indicates success for
.Dv X_OK ,
at least one of the user, group, or other execute bits is set.
(However, the file may still not be executable.
See
.Xr execve 2 . )
.Sh RETURN VALUES
If
.Fa path
cannot be found or if any of the desired access modes would
not be granted, then a \-1 value is returned; otherwise
a 0 value is returned.
.Sh ERRORS
Access to the file is denied if:
.Bl -tag -width Er
.It Bq Er EACCES
Permission bits of the file mode do not permit the requested
access, or search permission is denied on a component of the
path prefix.
.\" Maybe this paragraph should be removed...
The owner of a file has permission checked with respect to the
.Dq owner
read, write, and execute mode bits, members of the file's group
@@ -103,9 +103,115 @@ mode bits, and all others have permissions checked with respect to
the
.Dq other
mode bits.
.Pp
The file descriptor
.Fa fd
must name a directory.
Search permission is required on this directory.
.\" (These alternatives await a decision about the semantics of O_SEARCH)
.\" Search permission is required on this directory, except if
.\" .Fa fd
.\" was opened with the
.\" .Dv O_SEARCH
.\" flag.
.\" - or -
.\" The directory referred to by
.\" .Fa fd
.\" must have been opened with the
.\" .Dv O_SEARCH
.\" flag.
.\" - or -
.\" The directory referred to by
.\" .Fa fd
.\" must have been opened with the
.\" .Dv O_SEARCH
.\" flag or must be searchable by the current process at the time the
.\" call is made.
.Pp
The
.Fa flags
argument to
.Fn faccessat
can specify the following optional behavior:
.Bl -tag -width AT_SYMLINK_NOFOLLOW
.It AT_EACCESS
Use the effective user and group IDs instead of the real user and
group IDs for checking permission.
See discussion below.
.It AT_SYMLINK_NOFOLLOW
Do not follow a symbolic link encountered as the last component in
.Fa path .
.El
.Pp
For
.Fn access ,
and
.Fn faccessat
when the
.Dv AT_EACCESS
flag is not passed, the real user ID and the real group ID are used
for checking permission in place of the effective user ID and
effective group ID.
This affects only set-user-ID and set-group-ID programs, which should
not use these functions.
(For other programs, the real and effective IDs are the same.)
.Pp
For processes running with super-user privileges, these functions may
return success for read and write checks regardless of whether read
and write permission bits are actually set.
This reflects the fact that the super-user may read and write all
files regardless of permission settings.
However, even for the super-user, an execute check using
.Dv X_OK
will succeed only if the target object has at least one of its
execute permission bits set.
.\" XXX: Is this true of search permission and directories? (I believe so.)
(This does not guarantee that the target object can necessarily be
successfully executed.
See
.Xr execve 2 . )
.Sh RETURN VALUES
The
.Fn access
and
.Fn faccessat
functions succeed and return 0 if, at some point in the recent past,
the target object named by
.Fa path
existed and its permission settings allowed the requested access as
described above.
If the requested access would not have been granted, the object did
not exist, or the path lookup failed, the value \-1 is returned
and the value of
.Va errno
is set to reflect what went wrong.
.Sh ERRORS
These functions fail if:
.Bl -tag -width Er
.It Bq Er EACCES
Search permission is denied for
.Fa fd ,
or for the current directory, or for a directory in the prefix of
.Fa path ;
or the permission bits on the target file system object do not permit
the requested access.
.It Bq Er EBADF
The file descriptor
.Fa fd
is not open and is not
.Dv AT_FDCWD .
.\" (possibly -- future)
.\" or was not opened for searching with
.\" .Dv O_SEARCH .
.It Bq Er EFAULT
.Fa path
points outside the process's allocated address space.
.It Bq Er EINVAL
The
.Fa mode
or
.Fa flags
argument contained an invalid value.
.It Bq Er EIO
An I/O error occurred while reading from or writing to the file system.
.It Bq Er ELOOP
@@ -119,7 +225,10 @@ characters.
.It Bq Er ENOENT
The named file does not exist.
.It Bq Er ENOTDIR
A component of the path prefix is not a directory.
The file descriptor
.Fa fd
does not name a directory, or a component of the path prefix is not a
directory.
.It Bq Er EROFS
Write access is requested for a file on a read-only file system.
.It Bq Er ETXTBSY
@@ -136,19 +245,47 @@ The
.Fn access
function conforms to
.St -p1003.1-90 .
.Sh SECURITY CONSIDERATIONS
The
.Fn access
system call is a potential security hole due to race conditions.
It should never be used.
Set-user-ID and set-group-ID applications should restore the
effective user or group ID, and perform actions directly rather than use
.Fn access
to simulate access checks for the real user or group ID.
.Fn faccessat
function conforms to
.St -p1003.1-2008 .
.\" This paragraph could be moved to the end of DESCRIPTION if people
.\" don't like having it here.
.Pp
The
Note that
.Fn faccessat
violates the historic convention that system calls whose names begin
with `f' operate on file handles rather than paths.
There is no equivalent to
.Fn access
system call may however have some value in providing clues to users as to
whether certain operations make sense for a particular filesystem object.
Arguably it also allows a cheaper file existence test than
.Xr stat 2 .
for checking access properties of an already-opened file.
.Sh SECURITY CONSIDERATIONS
Because the results of these calls reflect the state of the file
system at the time they ran, and the file system can potentially be
modified between that time and the time the caller attempts to act on
the results, they should
.Em never
be used for security enforcement.
.Pp
Privileged programs that need to restrict their actions to files or
directories properly accessible to unprivileged users
.Em must
do this by assuming or restoring an unprivileged state (see
.Xr seteuid 2 )
when performing the pertinent actions.
Checking in advance (with
.Fn access
or any other method) and performing such actions while privileged
introduces a race condition that in most cases is easily exploitable
by even a naive adversary.
.Pp
Even for non-privileged programs, the opportunity for the world to
change after the call runs makes
.Fn access
and
.Fn faccessat
not very useful.
In general only
.Dv F_OK
should be used, and that sparingly.
The other checks may occasionally be useful for user interface or
diagnostic purposes.

View File

@@ -1,4 +1,4 @@
.\" $NetBSD: chdir.2,v 1.21 2010/05/31 12:16:20 njoly Exp $
.\" $NetBSD: chdir.2,v 1.22 2013/02/05 13:36:59 wiz Exp $
.\"
.\" Copyright (c) 1980, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -29,7 +29,7 @@
.\"
.\" @(#)chdir.2 8.2 (Berkeley) 12/11/93
.\"
.Dd December 11, 1993
.Dd February 5, 2013
.Dt CHDIR 2
.Os
.Sh NAME
@@ -80,18 +80,6 @@ the error.
will fail and the current working directory will be unchanged if
one or more of the following are true:
.Bl -tag -width Er
.It Bq Er ENOTDIR
A component of the path prefix is not a directory.
.It Bq Er ENAMETOOLONG
A component of a pathname exceeded
.Brq Dv NAME_MAX
characters, or an entire path name exceeded
.Brq Dv PATH_MAX
characters.
.It Bq Er ENOENT
The named directory does not exist.
.It Bq Er ELOOP
Too many symbolic links were encountered in translating the pathname.
.It Bq Er EACCES
Search permission is denied for any component of
the path name.
@@ -100,6 +88,18 @@ the path name.
points outside the process's allocated address space.
.It Bq Er EIO
An I/O error occurred while reading from or writing to the file system.
.It Bq Er ELOOP
Too many symbolic links were encountered in translating the pathname.
.It Bq Er ENAMETOOLONG
A component of a pathname exceeded
.Brq Dv NAME_MAX
characters, or an entire path name exceeded
.Brq Dv PATH_MAX
characters.
.It Bq Er ENOENT
The named directory does not exist.
.It Bq Er ENOTDIR
A component of the path prefix is not a directory.
.El
.Pp
.Fn fchdir
@@ -109,12 +109,12 @@ one or more of the following are true:
.It Bq Er EACCES
Search permission is denied for the directory referenced by the
file descriptor.
.It Bq Er ENOTDIR
The file descriptor does not reference a directory.
.It Bq Er EBADF
The argument
.Fa fd
is not a valid file descriptor.
.It Bq Er ENOTDIR
The file descriptor does not reference a directory.
.It Bq Er EPERM
The argument
.Fa fd
@@ -122,7 +122,8 @@ references a directory which is not at or below the current process's
root directory.
.El
.Sh SEE ALSO
.Xr chroot 2
.Xr chroot 2 ,
.Xr getcwd 3
.Sh STANDARDS
The
.Fn chdir

View File

@@ -1,4 +1,4 @@
.\" $NetBSD: chflags.2,v 1.27 2011/08/06 11:28:24 jruoho Exp $
.\" $NetBSD: chflags.2,v 1.28 2013/06/08 06:05:03 kardel Exp $
.\"
.\" Copyright (c) 1989, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -98,8 +98,6 @@ The
and
.Dv SF_APPEND
flags may only be set or unset by the super-user.
Attempts by the non-super-user to set the super-user only flags
are silently ignored.
These flags may be set at any time, but normally may only be unset when
the system is in single-user mode.
(See

View File

@@ -1,4 +1,4 @@
.\" $NetBSD: chmod.2,v 1.40 2012/03/04 11:58:31 wiz Exp $
.\" $NetBSD: chmod.2,v 1.47 2013/10/15 11:43:21 njoly Exp $
.\"
.\" Copyright (c) 1980, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -29,13 +29,14 @@
.\"
.\" @(#)chmod.2 8.1 (Berkeley) 6/4/93
.\"
.Dd March 3, 2012
.Dd July 29, 2013
.Dt CHMOD 2
.Os
.Sh NAME
.Nm chmod ,
.Nm lchmod ,
.Nm fchmod
.Nm fchmod ,
.Nm fchmodat
.Nd change mode of file
.Sh LIBRARY
.Lb libc
@@ -47,6 +48,10 @@
.Fn lchmod "const char *path" "mode_t mode"
.Ft int
.Fn fchmod "int fd" "mode_t mode"
.In sys/stat.h
.In fcntl.h
.Ft int
.Fn fchmodat "int fd" "const char *path" "mode_t mode" "int flag"
.Sh DESCRIPTION
The function
.Fn chmod
@@ -70,6 +75,43 @@ sets the permission bits of the link,
while
.Fn chmod
sets the bits of the file the link references.
.Pp
.Fn fchmodat
works the same way as
.Fn chmod
(or
.Fn lchmod
if
.Dv AT_SYMLINK_NOFOLLOW
is set in
.Fa flag )
except if
.Fa path
is relative.
In that case, it is looked up from a directory whose file
descriptor was passed as
.Fa fd .
Search permission is required on this directory.
.\" (These alternatives await a decision about the semantics of O_SEARCH)
.\" Search permission is required on this directory
.\" except if
.\" .Fa fd
.\" was opened with the
.\" .Dv O_SEARCH
.\" flag.
.\" - or -
.\" This file descriptor must have been opened with the
.\" .Dv O_SEARCH
.\" flag.
.Fa fd
except if that file descriptor was opened with the
.Dv O_SEARCH
flag.
.Fa fd
can be set to
.Dv AT_FDCWD
in order to specify the current directory.
.Pp
.Fn chmod
verifies that the process owner (user) either owns
the file specified by
@@ -134,14 +176,12 @@ by protecting set-user-id (set-group-id) files
from remaining set-user-id (set-group-id) if they are modified,
at the expense of a degree of compatibility.
.Sh RETURN VALUES
Upon successful completion, a value of 0 is returned.
Otherwise, a value of \-1 is returned and
.Va errno
is set to indicate the error.
.Rv -std chmod lchmod fchmod fchmodat
.Sh ERRORS
.Fn chmod
and
.Fn chmod ,
.Fn lchmod
and
.Fn fchmodat
will fail and the file mode will be unchanged if:
.Bl -tag -width Er
.It Bq Er EACCES
@@ -182,6 +222,24 @@ group access list.
The named file resides on a read-only file system.
.El
.Pp
In addition,
.Fn fchmodat
will fail if:
.Bl -tag -width Er
.It Bq Er EBADF
.Fa path
does not specify an absolute path and
.Fa fd
is neither
.Dv AT_FDCWD
nor a valid file descriptor open for reading or searching.
.It Bq Er ENOTDIR
.Fa path
is not an absolute path and
.Fa fd
is a file descriptor associated with a non-directory file.
.El
.Pp
.Fn fchmod
will fail if:
.Bl -tag -width Er
@@ -225,6 +283,9 @@ The
.Fn chmod
function conforms to
.St -p1003.1-90 .
.Fn fchmodat
function conforms to
.St -p1003.1-2008 .
.Sh HISTORY
The
.Fn fchmod

View File

@@ -1,4 +1,4 @@
.\" $NetBSD: chown.2,v 1.31 2010/05/31 12:16:20 njoly Exp $
.\" $NetBSD: chown.2,v 1.36 2013/07/30 12:38:16 njoly Exp $
.\"
.\" Copyright (c) 1980, 1991, 1993, 1994
.\" The Regents of the University of California. All rights reserved.
@@ -29,13 +29,14 @@
.\"
.\" @(#)chown.2 8.4 (Berkeley) 4/19/94
.\"
.Dd April 19, 1994
.Dd July 30, 2013
.Dt CHOWN 2
.Os
.Sh NAME
.Nm chown ,
.Nm lchown ,
.Nm fchown
.Nm fchown ,
.Nm fchownat
.Nd change owner and group of a file
.Sh LIBRARY
.Lb libc
@@ -47,6 +48,9 @@
.Fn lchown "const char *path" "uid_t owner" "gid_t group"
.Ft int
.Fn fchown "int fd" "uid_t owner" "gid_t group"
.In fcntl.h
.Ft int
.Fn fchownat "int fd" "const char *path" "uid_t owner" "gid_t group" "int flag"
.Sh DESCRIPTION
The owner ID and group ID of the file
named by
@@ -100,21 +104,58 @@ is particularly useful when used in conjunction
with the file locking primitives (see
.Xr flock 2 ) .
.Pp
.Fn fchownat
works the same way as
.Fn chown
(or
.Fn lchown
if
.Dv AT_SYMLINK_NOFOLLOW
is set in
.Fa flag )
except if
.Fa path
is relative.
In that case, it is looked up from a directory whose file
descriptor was passed as
.Fa fd .
Search permission is required on this directory.
.\" (These alternatives await a decision about the semantics of O_SEARCH)
.\" Search permission is required on this directory
.\" except if
.\" .Fa fd
.\" was opened with the
.\" .Dv O_SEARCH
.\" flag.
.\" - or -
.\" This file descriptor must have been opened with the
.\" .Dv O_SEARCH
.\" flag.
.Fa fd
can be set to
.Dv AT_FDCWD
in order to specify the current directory.
.Pp
One of the owner or group id's
may be left unchanged by specifying it as (uid_t)\-1 or (gid_t)\-1 respectively.
.Sh RETURN VALUES
Zero is returned if the operation was successful;
\-1 is returned if an error occurs, with a more specific
error code being placed in the global variable
.Va errno .
.Rv -std chown lchown fchown fchownat
.Sh ERRORS
.Fn chown
and
.Fn chown ,
.Fn lchown
and
.Fn fchownat
will fail and the file will be unchanged if:
.Bl -tag -width Er
.It Bq Er ENOTDIR
A component of the path prefix is not a directory.
.It Bq Er EACCES
Search permission is denied for a component of the path prefix.
.It Bq Er EFAULT
.Fa path
points outside the process's allocated address space.
.It Bq Er EIO
An I/O error occurred while reading from or writing to the file system.
.It Bq Er ELOOP
Too many symbolic links were encountered in translating the pathname.
.It Bq Er ENAMETOOLONG
A component of a pathname exceeded
.Brq Dv NAME_MAX
@@ -123,19 +164,30 @@ characters, or an entire path name exceeded
characters.
.It Bq Er ENOENT
The named file does not exist.
.It Bq Er EACCES
Search permission is denied for a component of the path prefix.
.It Bq Er ELOOP
Too many symbolic links were encountered in translating the pathname.
.It Bq Er ENOTDIR
A component of the path prefix is not a directory.
.It Bq Er EPERM
The effective user ID is not the super-user.
.It Bq Er EROFS
The named file resides on a read-only file system.
.It Bq Er EFAULT
.El
.Pp
In addition,
.Fn fchownat
will fail if:
.Bl -tag -width Er
.It Bq Er EBADF
.Fa path
points outside the process's allocated address space.
.It Bq Er EIO
An I/O error occurred while reading from or writing to the file system.
does not specify an absolute path and
.Fa fd
is neither
.Dv AT_FDCWD
nor a valid file descriptor open for reading or searching.
.It Bq Er ENOTDIR
.Fa path
is not an absolute path and
.Fa fd
is a file descriptor associated with a non-directory file.
.El
.Pp
.Fn fchown
@@ -147,12 +199,12 @@ does not refer to a valid descriptor.
.It Bq Er EINVAL
.Fa fd
refers to a socket, not a file.
.It Bq Er EIO
An I/O error occurred while reading from or writing to the file system.
.It Bq Er EPERM
The effective user ID is not the super-user.
.It Bq Er EROFS
The named file resides on a read-only file system.
.It Bq Er EIO
An I/O error occurred while reading from or writing to the file system.
.El
.Sh SEE ALSO
.Xr chgrp 1 ,
@@ -175,6 +227,9 @@ and
functions, as defined by
.St -xpg4.2 ,
provide the same semantics.
.Fn fchownat
conforms to
.St -p1003.1-2008 .
.Pp
To retain conformance to these standards, compatibility interfaces
are provided by the

View File

@@ -1,4 +1,4 @@
.\" $NetBSD: fsync.2,v 1.17 2010/05/17 12:38:04 jruoho Exp $
.\" $NetBSD: fsync.2,v 1.18 2013/09/22 10:02:05 apb Exp $
.\"
.\" Copyright (c) 1983, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -29,7 +29,7 @@
.\"
.\" @(#)fsync.2 8.1 (Berkeley) 6/4/93
.\"
.Dd May 17, 2010
.Dd September 22, 2013
.Dt FSYNC 2
.Os
.Sh NAME
@@ -48,15 +48,36 @@
.Fn fsync
causes all modified data and attributes of
.Fa fd
to be moved to a permanent storage device.
to be written to a permanent storage device.
This normally results in all in-core modified copies
of buffers for the associated file to be written to a disk.
.Pp
.Fn fsync
should be used by programs that require a file to be
.Fn fsync_range
is similar, but provides control over the region of the file
to be synchronized, and the method of synchronization.
.Pp
These functions should be used by programs that require a file to be
in a known state, for example, in building a simple transaction
facility.
.Pp
Note that writing the data to a permanent storage device
does not necessarily write the data to permanent storage media
within that device;
for example, after writing data to a disk device, the data might
reside in a cache within the device, but not yet on
more permanent storage within the device.
Neither
.Fn fsync
nor the default behavior of
.Fn fsync_range
(without the
.Dv FDISKSYNC
flag)
will flush disk caches,
because they assume that storage devices are able to ensure that
completed writes are transferred to media some time between the
write and a power failure or system crash.
.Pp
.Fn fsync_range
causes all modified data starting at
.Fa start
@@ -64,38 +85,52 @@ for length
.Fa length
of
.Fa fd
to be written to permanent storage.
Note that
.Fn fsync_range
requires that the file
.Fa fd
must be open for writing.
.Pp
.Fn fsync_range
may flush the file data in one of two manners:
.Bl -tag -width FDATASYNC -offset indent
.It Dv FDATASYNC
Synchronize the file data and sufficient meta-data to retrieve the
data for the specified range.
.It Dv FFILESYNC
Synchronize all modified file data and meta-data for the specified range.
.El
.Pp
By default,
.Fn fsync_range
does not flush disk caches, assuming that storage media are able to ensure
completed writes are transfered to media.
The
.Dv FDISKSYNC
flag may be included in the
.Fa how
parameter to trigger flushing of all disk caches for the file.
.Pp
to be written to a permanent storage device.
If the
.Fa length
parameter is zero,
.Fn fsync_range
will synchronize all of the file data.
.Pp
.Fn fsync_range
takes a
.Fa how
parameter which contains one or more of the following flags:
.Bl -tag -width FDATASYNC -offset indent
.It Dv FDATASYNC
Synchronize the file data and sufficient meta-data to retrieve the
data for the specified range.
This is equivalent to
.Xr fdatasync 2
on the specified range.
.It Dv FFILESYNC
Synchronize all modified file data and meta-data for the specified range.
This is equivalent to
.Xr fsync 2
on the specified range.
.It Dv FDISKSYNC
Request the destination device to ensure that the relevant data
and meta-data is flushed from any cache to permanent storage media.
In the present implementation, the entire cache on the affected device will
be flushed, and this may have a significant impact on performance.
.El
.Pp
The
.Dv FDATASYNC
and
.Dv FFILESYNC
flags are mutually exclusive.
Either of those flags may be combined with the
.Dv FDISKSYNC
flag.
.Pp
Note that
.Fn fsync_range
requires that the file
.Fa fd
must be open for writing, whereas
.Fn fsync
does not.
.Sh RETURN VALUES
A 0 value is returned on success.
A \-1 value indicates an error.
@@ -140,6 +175,7 @@ not support partial synchronization, the entire file will be synchronized
and the call will be the equivalent of calling
.Fn fsync .
.Sh SEE ALSO
.Xr fdatasync 2 ,
.Xr sync 2 ,
.Xr sync 8
.Sh HISTORY

View File

@@ -1,4 +1,4 @@
.\" $NetBSD: getgroups.2,v 1.22 2006/10/13 20:51:28 wiz Exp $
.\" $NetBSD: getgroups.2,v 1.23 2013/07/14 14:29:09 njoly Exp $
.\"
.\" Copyright (c) 1983, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -54,7 +54,7 @@ indicates the number of entries that may be placed in
returns the actual number of groups returned in
.Fa gidset .
No more than
.Dv {NGROUPS_MAX}
.Brq Dv NGROUPS_MAX
will ever
be returned.
If

View File

@@ -1,4 +1,4 @@
.\" $NetBSD: kqueue.2,v 1.32 2012/01/25 00:28:35 christos Exp $
.\" $NetBSD: kqueue.2,v 1.33 2012/11/24 15:16:52 christos Exp $
.\"
.\" Copyright (c) 2000 Jonathan Lemon
.\" All rights reserved.
@@ -32,7 +32,7 @@
.\"
.\" $FreeBSD: src/lib/libc/sys/kqueue.2,v 1.22 2001/06/27 19:55:57 dd Exp $
.\"
.Dd January 23, 2012
.Dd November 24, 2012
.Dt KQUEUE 2
.Os
.Sh NAME
@@ -604,6 +604,10 @@ The specified time limit or filter is invalid.
The event could not be found to be modified or deleted.
.It Bq Er ENOMEM
No memory was available to register the event.
.It Bq Er EOPNOTSUPP
This type of file descriptor is not supported for
.Fn kevent
operations.
.It Bq Er ESRCH
The specified process to attach to does not exist.
.El

View File

@@ -1,4 +1,4 @@
.\" $NetBSD: link.2,v 1.26 2011/08/08 19:50:17 wiz Exp $
.\" $NetBSD: link.2,v 1.32 2013/07/28 18:40:40 njoly Exp $
.\"
.\" Copyright (c) 1980, 1991, 1993, 2011
.\" The Regents of the University of California. All rights reserved.
@@ -29,7 +29,7 @@
.\"
.\" @(#)link.2 8.3 (Berkeley) 1/12/94
.\"
.Dd January 12, 1994
.Dd July 28, 2013
.Dt LINK 2
.Os
.Sh NAME
@@ -41,6 +41,7 @@
.In unistd.h
.Ft int
.Fn link "const char *name1" "const char *name2"
.In fcntl.h
.Ft int
.Fn linkat "int fd1" "const char *name1" "int fd2" "const char *name2" "int flags"
.Sh DESCRIPTION
@@ -80,6 +81,46 @@ must be in the same file system.
may not be a directory unless the caller is the super-user
and the file system containing it supports linking to directories.
.Pp
.Fn linkat
works the same way as
.Fn link
except if
.Fa name1
(resp.
.Fa name2 )
is relative.
In that case, it is looked up from a directory whose file
descriptor was passed as
.Fa fd1
(resp.
.Fa fd2 ) .
Search permission is required on the directories named by
.Fa fd1
and
.Fa fd2 .
.\" (These alternatives await a decision about the semantics of O_SEARCH)
.\" Search permission is required on the directories named by
.\" .Fa fd1
.\" and
.\" .Fa fd2
.\" unless they were opened with the
.\" .Dv O_SEARCH
.\" flag.
.\" - or -
.\" The directories named by
.\" .Fa fd1
.\" and
.\" .Fa fd2
.\" must have been opened with the
.\" .Dv O_SEARCH
.\" flag.
.Fa fd1
or
.Fa fd2
can be set to
.Dv AT_FDCWD
in order to specify the current directory.
.Pp
When operating on a symlink,
.Fn link
resolves the symlink and creates a hard link on the target.
@@ -89,25 +130,12 @@ will do the same if
is set in
.Fa flags ,
but it will link on the symlink itself if the flag is clear.
.Pp
At the moment,
.Fn linkat
is partially implemented.
It will return
.Er ENOSYS
for
.Fa fd1
and
.Fa fd2
values different than
.Dv AT_FDCWD .
.Sh RETURN VALUES
Upon successful completion, a value of 0 is returned.
Otherwise, a value of \-1 is returned and
.Va errno
is set to indicate the error.
.Rv -std link linkat
.Sh ERRORS
.Fn link
and
.Fn linkat
will fail and no link will be created if:
.Bl -tag -width Er
.It Bq Er EACCES
@@ -135,7 +163,7 @@ Too many symbolic links were encountered in translating one of the pathnames.
The link count of the file named by
.Fa name1
would exceed
.Dv {LINK_MAX} .
.Brq Dv LINK_MAX .
.It Bq Er ENAMETOOLONG
A component of a pathname exceeded
.Brq Dv NAME_MAX
@@ -175,6 +203,32 @@ and the file named by
.Fa name1
are on different file systems.
.El
.Pp
In addition,
.Fn linkat
will fail if:
.Bl -tag -width Er
.It Bq Er EBADF
.Fa name1
or
.Fa name2
does not specify an absolute path and
.Fa fd1
or
.Fa fd2 ,
respectively, is neither
.Dv AT_FDCWD
nor a valid file descriptor open for reading or searching.
.It Bq Er ENOTDIR
.Fa name1
or
.Fa name2
is not an absolute path and
.Fa fd1
or
.Fa fd2 ,
respectively, is a file descriptor associated with a non-directory file.
.El
.Sh SEE ALSO
.Xr symlink 2 ,
.Xr unlink 2
@@ -183,6 +237,6 @@ The
.Fn link
function conforms to
.St -p1003.1-90 .
.Sh BUGS
.Fn linkat
is partially implemented.
conforms to
.St -p1003.1-2008 .

View File

@@ -1,4 +1,4 @@
.\" $NetBSD: mkdir.2,v 1.24 2010/05/31 12:16:20 njoly Exp $
.\" $NetBSD: mkdir.2,v 1.29 2013/10/15 11:43:21 njoly Exp $
.\"
.\" Copyright (c) 1983, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -29,11 +29,12 @@
.\"
.\" @(#)mkdir.2 8.2 (Berkeley) 12/11/93
.\"
.Dd December 27, 2005
.Dd July 28, 2013
.Dt MKDIR 2
.Os
.Sh NAME
.Nm mkdir
.Nm mkdir ,
.Nm mkdirat
.Nd make a directory file
.Sh LIBRARY
.Lb libc
@@ -41,6 +42,10 @@
.In sys/stat.h
.Ft int
.Fn mkdir "const char *path" "mode_t mode"
.In sys/stat.h
.In fcntl.h
.Ft int
.Fn mkdirat "int fd" "const char *path" "mode_t mode"
.Sh DESCRIPTION
The directory
.Fa path
@@ -50,19 +55,62 @@ and restricted by the
.Xr umask 2
of the calling process.
.Pp
.Fn mkdirat
works the same way as
.Fn mkdir
except if
.Fa path
is relative.
In that case, it is looked up from a directory whose file
descriptor was passed as
.Fa fd .
Search permission is required this directory.
.\" (These alternatives await a decision about the semantics of O_SEARCH)
.\" Search permission is required on this directory
.\" except if
.\" .Fa fd
.\" was opened with the
.\" .Dv O_SEARCH
.\" flag.
.\" - or -
.\" This file descriptor must have been opened with the
.\" .Dv O_SEARCH
.\" flag.
.Fa fd
can be set to
.Dv AT_FDCWD
in order to specify the current directory.
.Pp
The directory's owner ID is set to the process's effective user ID.
The directory's group ID is set to that of the parent directory in
which it is created.
.Sh RETURN VALUES
A 0 return value indicates success.
A \-1 return value indicates an error, and an error code is stored in
.Va errno .
.Rv -std mkdir mkdirat
.Sh ERRORS
Both
.Fn mkdir
and
.Fn mkdirat
will fail and no directory will be created if:
.Bl -tag -width Er
.It Bq Er ENOTDIR
A component of the path prefix is not a directory.
.It Bq Er EACCES
Search permission is denied for a component of the path prefix.
.It Bq Er EDQUOT
The new directory cannot be created because the user's
quota of disk blocks on the file system that will
contain the directory has been exhausted.
Or, the user's quota of inodes on the file system on
which the directory is being created has been exhausted.
.It Bq Er EEXIST
The named file exists.
.It Bq Er EFAULT
.Fa path
points outside the process's allocated address space.
.It Bq Er EIO
An I/O error occurred while making the directory entry or allocating the inode;
or an I/O error occurred while reading from or writing to the file system.
.It Bq Er ELOOP
Too many symbolic links were encountered in translating the pathname.
.It Bq Er ENAMETOOLONG
A component of a pathname exceeded
.Brq Dv NAME_MAX
@@ -71,34 +119,33 @@ characters, or an entire path name exceeded
characters.
.It Bq Er ENOENT
A component of the path prefix does not exist.
.It Bq Er EACCES
Search permission is denied for a component of the path prefix.
.It Bq Er ELOOP
Too many symbolic links were encountered in translating the pathname.
.It Bq Er EROFS
The named file resides on a read-only file system.
.It Bq Er EEXIST
The named file exists.
.It Bq Er ENOSPC
The new directory cannot be created because there is no space left
on the file system that will contain the directory.
.It Bq Er ENOSPC
There are no free inodes on the file system on which the
Or, there are no free inodes on the file system on which the
directory is being created.
.It Bq Er EDQUOT
The new directory cannot be created because the user's
quota of disk blocks on the file system that will
contain the directory has been exhausted.
.It Bq Er EDQUOT
The user's quota of inodes on the file system on
which the directory is being created has been exhausted.
.It Bq Er EIO
An I/O error occurred while making the directory entry or allocating the inode.
.It Bq Er EIO
An I/O error occurred while reading from or writing to the file system.
.It Bq Er EFAULT
.It Bq Er ENOTDIR
A component of the path prefix is not a directory.
.It Bq Er EROFS
The named file resides on a read-only file system.
.El
.Pp
In addition,
.Fn mkdirat
will fail if:
.Bl -tag -width Er
.It Bq Er EBADF
.Fa path
points outside the process's allocated address space.
does not specify an absolute path and
.Fa fd
is neither
.Dv AT_FDCWD
nor a valid file descriptor open for reading or searching.
.It Bq Er ENOTDIR
.Fa path
is not an absolute path and
.Fa fd
is a file descriptor associated with a non-directory file.
.El
.Sh SEE ALSO
.Xr chmod 2 ,
@@ -109,3 +156,6 @@ The
.Fn mkdir
function conforms to
.St -p1003.1-90 .
.Fn mkdirat
conforms to
.St -p1003.1-2008 .

View File

@@ -1,4 +1,4 @@
.\" $NetBSD: mkfifo.2,v 1.20 2010/05/31 12:16:20 njoly Exp $
.\" $NetBSD: mkfifo.2,v 1.27 2013/10/15 11:43:21 njoly Exp $
.\"
.\" Copyright (c) 1990, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -29,11 +29,12 @@
.\"
.\" @(#)mkfifo.2 8.1 (Berkeley) 6/4/93
.\"
.Dd June 4, 1993
.Dd July 29, 2013
.Dt MKFIFO 2
.Os
.Sh NAME
.Nm mkfifo
.Nm mkfifo ,
.Nm mkfifoat
.Nd make a fifo file
.Sh LIBRARY
.Lb libc
@@ -41,6 +42,10 @@
.In sys/stat.h
.Ft int
.Fn mkfifo "const char *path" "mode_t mode"
.In sys/stat.h
.In fcntl.h
.Ft int
.Fn mkfifoat "int fd" "const char *path" "mode_t mode"
.Sh DESCRIPTION
.Fn mkfifo
creates a new fifo file with name
@@ -52,21 +57,66 @@ and restricted by the
.Xr umask 2
of the calling process.
.Pp
.Fn mkfifoat
works the same way as
.Fn mkfifo
except if
.Fa path
is relative.
In that case, it is looked up from a directory whose file
descriptor was passed as
.Fa fd .
Search permission is required on this directory.
.\" (These alternatives await a decision about the semantics of O_SEARCH)
.\" Search permission is required on this directory
.\" except if
.\" .Fa fd
.\" was opened with the
.\" .Dv O_SEARCH
.\" flag.
.\" - or -
.\" This file descriptor must have been opened with the
.\" .Dv O_SEARCH
.\" flag.
.Fa fd
can be set to
.Dv AT_FDCWD
in order to specify the current directory.
.Pp
The fifo's owner ID is set to the process's effective user ID.
The fifo's group ID is set to that of the parent directory in
which it is created.
.Sh RETURN VALUES
A 0 return value indicates success.
A \-1 return value indicates an error, and an error code is stored in
.Va errno .
.Rv -std mkfifo mkfifoat
.Sh ERRORS
.Fn mkfifo
and
.Fn mkfifoat
will fail and no fifo will be created if:
.Bl -tag -width Er
.It Bq Er EOPNOTSUPP
The kernel has not been configured to support fifo's.
.It Bq Er ENOTDIR
A component of the path prefix is not a directory.
.It Bq Er EACCES
Search permission is denied for a component of the path prefix.
.It Bq Er EDQUOT
The directory in which the entry for the new fifo
is being placed cannot be extended because the
user's quota of disk blocks on the file system
containing the directory has been exhausted.
Or, the user's quota of inodes on the file system on
which the fifo is being created has been exhausted.
.It Bq Er EEXIST
The named file exists.
.It Bq Er EFAULT
.Fa path
points outside the process's allocated address space.
.It Bq Er EIO
An
.Tn I/O
error occurred while making the directory entry or allocating the inode.
Or, an
.Tn I/O
error occurred while reading from or writing to the file system.
.It Bq Er ELOOP
Too many symbolic links were encountered in translating the pathname.
.It Bq Er ENAMETOOLONG
A component of a pathname exceeded
.Brq Dv NAME_MAX
@@ -75,40 +125,36 @@ characters, or an entire path name exceeded
characters.
.It Bq Er ENOENT
A component of the path prefix does not exist.
.It Bq Er EACCES
Search permission is denied for a component of the path prefix.
.It Bq Er ELOOP
Too many symbolic links were encountered in translating the pathname.
.It Bq Er EROFS
The named file resides on a read-only file system.
.It Bq Er EEXIST
The named file exists.
.It Bq Er ENOSPC
The directory in which the entry for the new fifo is being placed
cannot be extended because there is no space left on the file
system containing the directory.
.It Bq Er ENOSPC
There are no free inodes on the file system on which the
Or, there are no free inodes on the file system on which the
fifo is being created.
.It Bq Er EDQUOT
The directory in which the entry for the new fifo
is being placed cannot be extended because the
user's quota of disk blocks on the file system
containing the directory has been exhausted.
.It Bq Er EDQUOT
The user's quota of inodes on the file system on
which the fifo is being created has been exhausted.
.It Bq Er EIO
An
.Tn I/O
error occurred while making the directory entry or allocating the inode.
.It Bq Er EIO
An
.Tn I/O
error occurred while reading from or writing to the file system.
.It Bq Er EFAULT
.It Bq Er ENOTDIR
A component of the path prefix is not a directory.
.It Bq Er EOPNOTSUPP
The kernel has not been configured to support fifo's.
.It Bq Er EROFS
The named file resides on a read-only file system.
.El
.Pp
In addition,
.Fn mkfifoat
will fail if:
.Bl -tag -width Er
.It Bq Er EBADF
.Fa path
points outside the process's allocated address space.
does not specify an absolute path and
.Fa fd
is neither
.Dv AT_FDCWD
nor a valid file descriptor open for reading or searching.
.It Bq Er ENOTDIR
.Fa path
is not an absolute path and
.Fa fd
is a file descriptor associated with a non-directory file.
.El
.Sh SEE ALSO
.Xr chmod 2 ,
@@ -119,3 +165,6 @@ The
.Nm mkfifo
function call conforms to
.St -p1003.1-90 .
.Fn mkfifoat
conforms to
.St -p1003.1-2008 .

View File

@@ -1,4 +1,4 @@
.\" $NetBSD: mknod.2,v 1.22 2011/07/08 19:25:51 wiz Exp $
.\" $NetBSD: mknod.2,v 1.28 2013/10/15 11:43:21 njoly Exp $
.\"
.\" Copyright (c) 1980, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -29,11 +29,12 @@
.\"
.\" @(#)mknod.2 8.1 (Berkeley) 6/4/93
.\"
.Dd July 3, 2011
.Dd July 29, 2013
.Dt MKNOD 2
.Os
.Sh NAME
.Nm mknod
.Nm mknod ,
.Nm mknodat
.Nd make a special file node
.Sh LIBRARY
.Lb libc
@@ -41,6 +42,10 @@
.In sys/stat.h
.Ft int
.Fn mknod "const char *path" "mode_t mode" "dev_t dev"
.In sys/stat.h
.In fcntl.h
.Ft int
.Fn mknodat "int fd" "const char *path" "mode_t mode" "dev_t dev"
.Sh DESCRIPTION
The device special file
.Fa path
@@ -55,15 +60,40 @@ modified by the
.Xr umask 2
of the parent process.
.Pp
.Fn mknodat
works the same way as
.Fn mknod
except if
.Fa path
is relative.
In that case, it is looked up from a directory whose file
descriptor was passed as
.Fa fd .
Search permission is required on this directory.
.\" (These alternatives await a decision about the semantics of O_SEARCH)
.\" Search permission is required on this directory
.\" except if
.\" .Fa fd
.\" was opened with the
.\" .Dv O_SEARCH
.\" flag.
.\" - or -
.\" This file descriptor must have been opened with the
.\" .Dv O_SEARCH
.\" flag.
.Fa fd
can be set to
.Dv AT_FDCWD
in order to specify the current directory.
.Pp
.Fn mknod
requires super-user privileges.
.Sh RETURN VALUES
Upon successful completion a value of 0 is returned.
Otherwise, a value of \-1 is returned and
.Va errno
is set to indicate the error.
.Rv -std mknod mknodat
.Sh ERRORS
.Fn mknod
and
.Fn mknodat
will fail and the file will be not created if:
.Bl -tag -width Er
.It Bq Er EACCES
@@ -111,11 +141,37 @@ The process's effective user ID is not super-user.
.It Bq Er EROFS
The named file resides on a read-only file system.
.El
.Pp
In addition,
.Fn mknodat
will fail if:
.Bl -tag -width Er
.It Bq Er EBADF
.Fa path
does not specify an absolute path and
.Fa fd
is neither
.Dv AT_FDCWD
nor a valid file descriptor open for reading or searching.
.It Bq Er ENOTDIR
.Fa path
is not an absolute path and
.Fa fd
is a file descriptor associated with a non-directory file.
.El
.Sh SEE ALSO
.Xr chmod 2 ,
.Xr mkfifo 2 ,
.Xr stat 2 ,
.Xr umask 2
.Sh STANDARDS
The
.Fn mknod
function conforms to
.St -p1003.1-90 .
.Fn mknodat
conforms to
.St -p1003.1-2008 .
.Sh HISTORY
A
.Fn mknod

41
lib/libc/sys/mknodat.c Normal file
View File

@@ -0,0 +1,41 @@
/* $NetBSD: mknodat.c,v 1.1 2013/10/17 18:01:11 njoly Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Nicolas Joly <njoly@NetBSD.org>.
*
* 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
*/
#include <sys/syscall.h>
#include <sys/stat.h>
int __mknodat(int, const char *, mode_t, int, dev_t);
int
mknodat(int fd, const char *path, mode_t mode, dev_t dev)
{
return __mknodat(fd, path, mode, 0, dev);
}

View File

@@ -1,4 +1,4 @@
.\" $NetBSD: msgrcv.2,v 1.20 2012/05/15 11:37:01 reinoud Exp $
.\" $NetBSD: msgrcv.2,v 1.22 2013/07/24 11:54:04 skrll Exp $
.\"
.\" Copyright (c) 1995 Frank van der Linden
.\" All rights reserved.
@@ -29,7 +29,7 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd January 26, 2009
.Dd July 24, 2013
.Dt MSGRCV 2
.Os
.Sh NAME
@@ -90,8 +90,10 @@ less than or equal to the absolute value of
will be received.
.El
.Pp
The argument
.Fa msgsz
specifies the maximum length of the requested message.
specifies the size in bytes of
.Va mtext .
If the received message has a length greater than
.Fa msgsz
it will be silently truncated if the

View File

@@ -1,4 +1,4 @@
.\" $NetBSD: msgsnd.2,v 1.18 2010/04/30 04:06:20 jruoho Exp $
.\" $NetBSD: msgsnd.2,v 1.20 2013/07/24 11:54:04 skrll Exp $
.\"
.\" Copyright (c) 1995 Frank van der Linden
.\" All rights reserved.
@@ -29,7 +29,7 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd April 30, 2010
.Dd July 24, 2013
.Dt MSGSND 2
.Os
.Sh NAME
@@ -69,7 +69,9 @@ be used for selecting messages (see
.Xr msgrcv 2 ) .
The
.Va mtext
field is an array of bytes, with size up to the system limit
field is an array of bytes of length
.Fa msgsz ,
with size up to the system limit
.Dv MSGMAX .
.Pp
If the number of bytes already on the message queue plus

View File

@@ -1,4 +1,4 @@
.\" $NetBSD: open.2,v 1.51 2012/01/25 00:28:35 christos Exp $
.\" $NetBSD: open.2,v 1.56 2013/07/29 18:37:16 njoly Exp $
.\"
.\" Copyright (c) 1980, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -29,11 +29,12 @@
.\"
.\" @(#)open.2 8.2 (Berkeley) 11/16/93
.\"
.Dd January 23, 2012
.Dd July 29, 2013
.Dt OPEN 2
.Os
.Sh NAME
.Nm open
.Nm open ,
.Nm openat
.Nd open or create a file for reading or writing
.Sh LIBRARY
.Lb libc
@@ -41,6 +42,8 @@
.In fcntl.h
.Ft int
.Fn open "const char *path" "int flags" "..."
.Ft int
.Fn openat "int fd" "const char *path" "int flags" "..."
.Sh DESCRIPTION
The file name specified by
.Fa path
@@ -49,6 +52,33 @@ for reading and/or writing as specified by the
argument
.Fa flags
and the file descriptor returned to the calling process.
.Pp
.Fn openat
works the same way as
.Fn open
except if
.Fa path
is relative.
In that case, it is looked up from a directory whose file
descriptor was passed as
.Fa fd .
Search permission is required on this directory.
.\" (These alternatives await a decision about the semantics of O_SEARCH)
.\" Search permission is required on this directory
.\" except if
.\" .Fa fd
.\" was opened with the
.\" .Dv O_SEARCH
.\" flag.
.\" - or -
.\" This file descriptor must have been opened with the
.\" .Dv O_SEARCH
.\" flag.
.Fa fd
can be set to
.Dv AT_FDCWD
in order to specify the current directory.
.Pp
The
.Fa flags
are specified by
@@ -164,6 +194,24 @@ Enable the
signal to be sent to the process group
when I/O is possible, e.g.,
upon availability of data to be read.
.\" (This block awaits a decision about the semantics of O_SEARCH)
.\" .It Dv O_SEARCH
.\" If opening a directory, search permission checks will not be performed on
.\" subsequent usage of the file descriptor for looking up relative paths by
.\" .Xr faccessat 2 ,
.\" .Xr fchmodat 2 ,
.\" .Xr fchownat 2 ,
.\" .Xr fstatat 2 ,
.\" .Xr linkat 2 ,
.\" .Xr mkdirat 2 ,
.\" .Xr mkfifoat 2 ,
.\" .Xr mknodat 2 ,
.\" .Xr openat 2 ,
.\" .Xr readlinkat 2 ,
.\" .Xr symlinkat 2 ,
.\" .Xr unlinkat 2 ,
.\" and
.\" .Xr utimensat 2 .
.El
.Pp
Opening a file with
@@ -240,6 +288,8 @@ returns the current system limit.
.Sh RETURN VALUES
If successful,
.Fn open
and
.Fn openat
returns a non-negative integer, termed a file descriptor.
Otherwise, a value of \-1 is returned and
.Va errno
@@ -357,13 +407,43 @@ executed and the
.Fn open
call requests write access.
.El
.Pp
In addition,
.Fn openat
will fail if:
.Bl -tag -width Er
.It Bq Er EBADF
.Fa path
does not specify an absolute path and
.Fa fd
is neither
.Dv AT_FDCWD
nor a valid file descriptor open for reading or searching.
.It Bq Er ENOTDIR
.Fa path
is not an absolute path and
.Fa fd
is a file descriptor associated with a non-directory file.
.El
.Sh SEE ALSO
.Xr chmod 2 ,
.Xr close 2 ,
.Xr dup 2 ,
.Xr faccessat 2 ,
.Xr fchmodat 2 ,
.Xr fchownat 2 ,
.Xr fstatat 2 ,
.Xr linkat 2 ,
.Xr lseek 2 ,
.Xr mkdirat 2 ,
.Xr mkfifoat 2 ,
.Xr mknodat 2 ,
.Xr read 2 ,
.Xr readlinkat 2 ,
.Xr symlinkat 2 ,
.Xr umask 2 ,
.Xr unlinkat 2 ,
.Xr utimensat 2 ,
.Xr write 2 ,
.Xr getdtablesize 3
.Sh STANDARDS
@@ -371,6 +451,10 @@ The
.Fn open
function conforms to
.St -p1003.1-90 .
.Fn openat
conforms to
.St -p1003.1-2008 .
.Pp
The
.Fa flags
values
@@ -380,6 +464,10 @@ and
.Dv O_RSYNC
are extensions defined in
.St -p1003.1b-93 .
.\" (This block awaits a decision about the semantics of O_SEARCH)
.\" .Dv O_SEARCH
.\" is defined in
.\" .St -p1003.1-2008 .
.Pp
The
.Dv O_SHLOCK

View File

@@ -1,4 +1,4 @@
.\" $NetBSD: pipe.2,v 1.28 2012/01/25 00:28:35 christos Exp $
.\" $NetBSD: pipe.2,v 1.29 2013/04/23 23:39:13 elric Exp $
.\"
.\" Copyright (c) 1980, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -135,7 +135,8 @@ will also fail if:
.It Bq Er EINVAL
.Fa flags
is other than
.Dv O_NONBLOCK
.Dv O_NONBLOCK ,
.Dv O_NOSIGPIPE
or
.Dv O_CLOEXEC .
.El

View File

@@ -1,4 +1,4 @@
.\" $NetBSD: posix_fadvise.2,v 1.3 2009/06/09 11:21:33 yamt Exp $
.\" $NetBSD: posix_fadvise.2,v 1.5 2013/02/04 20:03:11 wiz Exp $
.\"
.\" Copyright (c)2006,2009 YAMAMOTO Takashi,
.\" All rights reserved.
@@ -25,7 +25,7 @@
.\" SUCH DAMAGE.
.\"
.\" ------------------------------------------------------------
.Dd June 9, 2009
.Dd February 4, 2013
.Dt POSIX_FADVISE 2
.Os
.Sh NAME
@@ -36,7 +36,7 @@
.Lb libc
.\" ------------------------------------------------------------
.Sh SYNOPSIS
.In sys/fcntl.h
.In fcntl.h
.Ft int
.Fn posix_fadvise "int fd" "off_t offset" "off_t size" "int hint"
.\" ------------------------------------------------------------

View File

@@ -1,4 +1,4 @@
.\" $NetBSD: read.2,v 1.34 2011/12/12 19:11:21 njoly Exp $
.\" $NetBSD: read.2,v 1.35 2013/07/14 14:29:09 njoly Exp $
.\"
.\" Copyright (c) 1980, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -186,7 +186,7 @@ points outside the process's allocated address space.
.It Bq Er EINVAL
.Fa iovcnt
was less than or equal to 0, or greater than
.Dv {IOV_MAX} ;
.Brq Dv IOV_MAX ;
or one of the
.Fa iov_len
values in the

View File

@@ -1,4 +1,4 @@
.\" $NetBSD: readlink.2,v 1.26 2010/05/31 12:16:20 njoly Exp $
.\" $NetBSD: readlink.2,v 1.32 2013/07/29 11:49:31 wiz Exp $
.\"
.\" Copyright (c) 1983, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -29,11 +29,12 @@
.\"
.\" @(#)readlink.2 8.1 (Berkeley) 6/4/93
.\"
.Dd May 11, 2004
.Dd July 28, 2013
.Dt READLINK 2
.Os
.Sh NAME
.Nm readlink
.Nm readlink ,
.Nm readlinkat
.Nd read value of a symbolic link
.Sh LIBRARY
.Lb libc
@@ -41,6 +42,9 @@
.In unistd.h
.Ft ssize_t
.Fn readlink "const char * restrict path" "char * restrict buf" "size_t bufsiz"
.Ft ssize_t
.Fn readlinkat "int fd" "const char * restrict path" "char * restrict buf"\
"size_t bufsiz"
.Sh DESCRIPTION
.Fn readlink
places the contents of the symbolic link
@@ -54,6 +58,32 @@ does not append a
.Dv NUL
character to
.Fa buf .
.Pp
.Fn readlinkat
works the same way as
.Fn readlink
except if
.Fa path
is relative.
In that case, it is looked up from a directory whose file
descriptor was passed as
.Fa fd .
Search permission is required on this directory.
.\" (These alternatives await a decision about the semantics of O_SEARCH)
.\" Search permission is required on this directory
.\" except if
.\" .Fa fd
.\" was opened with the
.\" .Dv O_SEARCH
.\" flag.
.\" - or -
.\" This file descriptor must have been opened with the
.\" .Dv O_SEARCH
.\" flag.
.Fa fd
can be set to
.Dv AT_FDCWD
in order to specify the current directory.
.Sh RETURN VALUES
The call returns the count of characters placed in the buffer
if it succeeds, or a \-1 if an error occurs, placing the error
@@ -77,10 +107,21 @@ buf[len] = '\e0';
.Ed
.Sh ERRORS
.Fn readlink
and
.Fn readlinkat
will fail if:
.Bl -tag -width Er
.It Bq Er ENOTDIR
A component of the path prefix is not a directory.
.It Bq Er EACCES
Search permission is denied for a component of the path prefix.
.It Bq Er EFAULT
.Fa buf
extends outside the process's allocated address space.
.It Bq Er EINVAL
The named file is not a symbolic link.
.It Bq Er EIO
An I/O error occurred while reading from the file system.
.It Bq Er ELOOP
Too many symbolic links were encountered in translating the pathname.
.It Bq Er ENAMETOOLONG
A component of a pathname exceeded
.Brq Dv NAME_MAX
@@ -89,17 +130,26 @@ characters, or an entire path name exceeded
characters.
.It Bq Er ENOENT
The named file does not exist.
.It Bq Er EACCES
Search permission is denied for a component of the path prefix.
.It Bq Er ELOOP
Too many symbolic links were encountered in translating the pathname.
.It Bq Er EINVAL
The named file is not a symbolic link.
.It Bq Er EIO
An I/O error occurred while reading from the file system.
.It Bq Er EFAULT
.Fa buf
extends outside the process's allocated address space.
.It Bq Er ENOTDIR
A component of the path prefix is not a directory.
.El
.Pp
In addition,
.Fn readlinkat
will fail if:
.Bl -tag -width Er
.It Bq Er EBADF
.Fa path
does not specify an absolute path and
.Fa fd
is neither
.Dv AT_FDCWD
nor a valid file descriptor open for reading or searching.
.It Bq Er ENOTDIR
.Fa path
is not an absolute path and
.Fa fd
is a file descriptor associated with a non-directory file.
.El
.Sh SEE ALSO
.Xr lstat 2 ,
@@ -111,6 +161,9 @@ The
.Fn readlink
function conforms to
.St -p1003.1-2001 .
.Fn readlinkat
conforms to
.St -p1003.1-2008 .
.Sh HISTORY
The
.Fn readlink

View File

@@ -1,4 +1,4 @@
.\" $NetBSD: recv.2,v 1.35 2012/06/23 05:47:50 dholland Exp $
.\" $NetBSD: recv.2,v 1.36 2013/07/14 14:29:09 njoly Exp $
.\"
.\" Copyright (c) 1983, 1990, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -343,7 +343,7 @@ member of the
.Fa msg
structure is less than or equal to 0
or is greater than
.Dv {IOV_MAX} .
.Brq Dv IOV_MAX .
.El
.Sh SEE ALSO
.Xr fcntl 2 ,

View File

@@ -1,4 +1,4 @@
.\" $NetBSD: rename.2,v 1.23 2010/05/31 12:16:20 njoly Exp $
.\" $NetBSD: rename.2,v 1.32 2013/07/28 10:24:59 njoly Exp $
.\"
.\" Copyright (c) 1983, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -29,11 +29,12 @@
.\"
.\" @(#)rename.2 8.1 (Berkeley) 6/4/93
.\"
.Dd December 27, 2005
.Dd July 28, 2013
.Dt RENAME 2
.Os
.Sh NAME
.Nm rename
.Nm rename ,
.Nm renameat ,
.Nd change the name of a file
.Sh LIBRARY
.Lb libc
@@ -41,6 +42,9 @@
.In stdio.h
.Ft int
.Fn rename "const char *from" "const char *to"
.In unistd.h
.Ft int
.Fn renameat "int fromfd" "const char *from" "int tofd" "const char *to"
.Sh DESCRIPTION
.Fn rename
causes the link named
@@ -76,17 +80,91 @@ and
are pathnames of the same existing file in the file system's name space,
.Fn rename
returns successfully and performs no other action.
.Sh RETURN VALUES
A 0 value is returned if the operation succeeds, otherwise
.Pp
.Fn renameat
works the same way as
.Fn rename
returns \-1 and the global variable
.Va errno
indicates the reason for the failure.
except if
.Fa from
(resp.
.Fa to )
is relative.
In that case, it is looked up from a directory whose file
descriptor was passed as
.Fa fromfd
(resp.
.Fa tofd ) .
Search permission is required on the directories named by
.Fa fromfd
and
.Fa tofd .
.\" (These alternatives await a decision about the semantics of O_SEARCH)
.\" Search permission is required on the directories named by
.\" .Fa fromfd
.\" and
.\" .Fa tofd
.\" unless they were opened with the
.\" .Dv O_SEARCH
.\" flag.
.\" - or -
.\" The directories named by
.\" .Fa fromfd
.\" and
.\" .Fa tofd
.\" must have been opened with the
.\" .Dv O_SEARCH
.\" flag.
.Fa fromfd
or
.Fa tofd
can be set to
.Dv AT_FDCWD
in order to specify the current directory.
.Sh RETURN VALUES
.Rv -std rename renameat
.Sh ERRORS
.Fn rename
and
.Fn renameat
will fail and neither of the argument files will be
affected if:
.Bl -tag -width Er
.It Bq Er EACCES
A component of either path prefix denies search permission, or
the requested link requires writing in a directory with a mode
that denies write permission.
.It Bq Er EBUSY
.Fa from
or
.Fa to
is the mount point for a mounted file system.
.It Bq Er EDQUOT
The directory in which the entry for the new name
is being placed cannot be extended because the
user's quota of disk blocks on the file system
containing the directory has been exhausted.
.It Bq Er EFAULT
.Fa from
or
.Fa to
points outside the process's allocated address space.
.It Bq Er EINVAL
.Fa from
is a parent directory of
.Fa to ,
or an attempt is made to rename
.Ql \&.
or
.Ql \&.. .
.It Bq Er EIO
An I/O error occurred while making or updating a directory entry.
.It Bq Er EISDIR
.Fa to
is a directory, but
.Fa from
is not a directory.
.It Bq Er ELOOP
Too many symbolic links were encountered in translating either pathname.
.It Bq Er ENAMETOOLONG
A component of a pathname exceeded
.Brq Dv NAME_MAX
@@ -100,10 +178,19 @@ path does not exist,
or a path prefix of
.Fa to
does not exist.
.It Bq Er EACCES
A component of either path prefix denies search permission, or
the requested link requires writing in a directory with a mode
that denies write permission.
.It Bq Er ENOSPC
The directory in which the entry for the new name is being placed
cannot be extended because there is no space left on the file
system containing the directory.
.It Bq Er ENOTDIR
A component of either path prefix is not a directory, or
.Fa from
is a directory, but
.Fa to
is not a directory.
.It Bq Er ENOTEMPTY
.Fa to
is a directory and is not empty.
.It Bq Er EPERM
The directory containing
.Fa from
@@ -120,19 +207,9 @@ is marked sticky,
and neither the containing directory nor
.Fa to
are owned by the effective user ID.
.It Bq Er ELOOP
Too many symbolic links were encountered in translating either pathname.
.It Bq Er ENOTDIR
A component of either path prefix is not a directory, or
.Fa from
is a directory, but
.Fa to
is not a directory.
.It Bq Er EISDIR
.Fa to
is a directory, but
.Fa from
is not a directory.
.It Bq Er EROFS
The requested link requires writing in a directory on a read-only file
system.
.It Bq Er EXDEV
The link named by
.Fa to
@@ -141,39 +218,32 @@ and the file named by
are on different logical devices (file systems).
Note that this error code will not be returned if the implementation
permits cross-device links.
.It Bq Er ENOSPC
The directory in which the entry for the new name is being placed
cannot be extended because there is no space left on the file
system containing the directory.
.It Bq Er EDQUOT
The directory in which the entry for the new name
is being placed cannot be extended because the
user's quota of disk blocks on the file system
containing the directory has been exhausted.
.It Bq Er EIO
An I/O error occurred while making or updating a directory entry.
.It Bq Er EROFS
The requested link requires writing in a directory on a read-only file
system.
.It Bq Er EFAULT
.Em Path
points outside the process's allocated address space.
.It Bq Er EINVAL
.Fa from
is a parent directory of
.Fa to ,
or an attempt is made to rename
.Ql \&.
or
.Ql \&.. .
.It Bq Er ENOTEMPTY
.Fa to
is a directory and is not empty.
.It Bq Er EBUSY
.El
.Pp
In addition,
.Fn renameat
will fail if:
.Bl -tag -width Er
.It Bq Er EBADF
.Fa from
or
.Fa to
is the mount point for a mounted file system.
does not specify an absolute path and
.Fa fromfd
or
.Fa tofd ,
respectively, is neither
.Dv AT_FDCWD
nor a valid file descriptor open for reading or searching.
.It Bq Er ENOTDIR
.Fa from
or
.Fa to
is not an absolute path and
.Fa fromfd
or
.Fa tofd ,
respectively, is a file descriptor associated with a non-directory file.
.El
.Sh SEE ALSO
.Xr open 2 ,
@@ -213,6 +283,9 @@ function conforms to
.St -p1003.1-90
and
.St -xpg4.2 .
.Fn renameat
conforms to
.St -p1003.1-2008 .
.Sh BUGS
The system can deadlock if a loop in the file system graph is present.
This loop takes the form of an entry in directory

View File

@@ -1,4 +1,4 @@
.\" $NetBSD: select.2,v 1.38 2010/04/05 21:25:56 joerg Exp $
.\" $NetBSD: select.2,v 1.41 2013/11/28 03:45:31 khorben Exp $
.\"
.\" Copyright (c) 1983, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -29,7 +29,7 @@
.\"
.\" @(#)select.2 8.2 (Berkeley) 3/25/94
.\"
.Dd October 18, 2008
.Dd November 28, 2013
.Dt SELECT 2
.Os
.Sh NAME
@@ -192,7 +192,7 @@ main(int argc, char **argv)
FD_SET(fd, \*[Am]read_set);
/*
* Check if data is ready to be readen on
* Check if data is ready to be read on
* file descriptor 1, give up after 10 seconds.
*/
ret = select(fd + 1, \*[Am]read_set, NULL, NULL, \*[Am]timeout);
@@ -211,7 +211,7 @@ main(int argc, char **argv)
break;
default:
printf("Data received on %d file desciptor(s)\en", ret);
printf("Data received on %d file descriptor(s)\en", ret);
/*
* select(2) hands back a file descriptor set where

View File

@@ -1,4 +1,4 @@
.\" $NetBSD: send.2,v 1.30 2012/06/22 22:54:26 wiz Exp $
.\" $NetBSD: send.2,v 1.31 2013/07/14 14:29:09 njoly Exp $
.\"
.\" Copyright (c) 1983, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -255,7 +255,7 @@ member of the
.Fa msg
structure is less than or equal to 0
or is greater than
.Dv {IOV_MAX} .
.Brq Dv IOV_MAX .
.El
.Sh SEE ALSO
.Xr fcntl 2 ,

View File

@@ -1,4 +1,4 @@
.\" $NetBSD: setgroups.2,v 1.18 2006/10/13 20:53:21 wiz Exp $
.\" $NetBSD: setgroups.2,v 1.19 2013/07/14 14:29:09 njoly Exp $
.\"
.\" Copyright (c) 1983, 1991, 1993, 1994
.\" The Regents of the University of California. All rights reserved.
@@ -51,7 +51,7 @@ The parameter
.Fa ngroups
indicates the number of entries in the array and must be no
more than
.Dv {NGROUPS_MAX} .
.Brq Dv NGROUPS_MAX .
.Pp
Only the super-user may set new groups.
.Pp
@@ -69,7 +69,7 @@ call will fail if:
The value of
.Fa ngroups
is greater than
.Dv {NGROUPS_MAX} .
.Brq Dv NGROUPS_MAX .
.It Bq Er EPERM
The caller is not the super-user.
.It Bq Er EFAULT

View File

@@ -1,4 +1,4 @@
.\" $NetBSD: sigqueue.2,v 1.2 2011/01/10 06:26:30 wiz Exp $
.\" $NetBSD: sigqueue.2,v 1.3 2013/02/14 09:31:48 wiz Exp $
.\" Copyright (c) 2005 David Xu <davidxu@FreeBSD.org>
.\" All rights reserved.
.\"
@@ -123,13 +123,13 @@ The process has already queued
.Brq Dv SIGQUEUE_MAX
signals that are still pending at the receiver(s),
or a system-wide resource limit has been exceeded.
.It Bq Er EEPERM
The process does not have the appropriate privilege to send the signal
to the receiving process.
.It Bq Er EINVAL
The value of the
.Fa signo
argument is an invalid or unsupported signal number.
.It Bq Er EPERM
The process does not have the appropriate privilege to send the signal
to the receiving process.
.It Bq Er ESRCH
The process
.Fa pid

View File

@@ -1,4 +1,4 @@
.\" $NetBSD: socket.2,v 1.39 2012/01/25 09:18:52 wiz Exp $
.\" $NetBSD: socket.2,v 1.41 2013/03/01 18:25:16 joerg Exp $
.\"
.\" Copyright (c) 1983, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -29,7 +29,7 @@
.\"
.\" @(#)socket.2 8.1 (Berkeley) 6/4/93
.\"
.Dd January 23, 2012
.Dd February 5, 2013
.Dt SOCKET 2
.Os
.Sh NAME
@@ -58,9 +58,7 @@ The currently understood formats are:
PF_LOCAL local (previously UNIX) domain protocols
PF_INET ARPA Internet protocols
PF_INET6 IPv6 (Internet Protocol version 6) protocols
PF_ISO ISO protocols
PF_NS Xerox Network Systems protocols
PF_IMPLINK IMP \*(lqhost at IMP\*(rq link layer
PF_APPLETALK AppleTalk protocols
PF_BLUETOOTH Bluetooth protocols
.Ed

View File

@@ -1,4 +1,4 @@
.\" $NetBSD: stat.2,v 1.50 2012/01/04 10:53:39 wiz Exp $
.\" $NetBSD: stat.2,v 1.56 2013/10/15 11:43:21 njoly Exp $
.\"
.\" Copyright (c) 1980, 1991, 1993, 1994
.\" The Regents of the University of California. All rights reserved.
@@ -29,13 +29,14 @@
.\"
.\" @(#)stat.2 8.4 (Berkeley) 5/1/95
.\"
.Dd September 14, 2011
.Dd July 28, 2013
.Dt STAT 2
.Os
.Sh NAME
.Nm stat ,
.Nm lstat ,
.Nm fstat
.Nm fstat ,
.Nm fstatat ,
.Nd get file status
.Sh LIBRARY
.Lb libc
@@ -47,6 +48,10 @@
.Fn lstat "const char *path" "struct stat *sb"
.Ft int
.Fn fstat "int fd" "struct stat *sb"
.In sys/stat.h
.In fcntl.h
.Ft int
.Fn fstatat "int fd" "const char *path" "struct stat *sb" "int flag"
.Sh DESCRIPTION
The
.Fn stat
@@ -73,6 +78,38 @@ function obtains the same information about an open file
known by the file descriptor
.Fa fd .
.Pp
.Fn fstatat
works the same way as
.Fn stat
(or
.Fn lstat
if
.Dv AT_SYMLINK_NOFOLLOW
is set in
.Fa flag )
except if
.Fa path
is relative.
In that case, it is looked up from a directory whose file
descriptor was passed as
.Fa fd .
Search permission is required on this directory.
.\" (These alternatives await a decision about the semantics of O_SEARCH)
.\" Search permission is required on this directory
.\" except if
.\" .Fa fd
.\" was opened with the
.\" .Dv O_SEARCH
.\" flag.
.\" - or -
.\" This file descriptor must have been opened with the
.\" .Dv O_SEARCH
.\" flag.
.Fa fd
can be set to
.Dv AT_FDCWD
in order to specify the current directory.
.Pp
The
.Fa sb
argument is a pointer to a
@@ -268,10 +305,7 @@ has the following bits:
For a description of the flags, see
.Xr chflags 2 .
.Sh RETURN VALUES
Upon successful completion a value of 0 is returned.
Otherwise, a value of \-1 is returned and
.Va errno
is set to indicate the error.
.Rv -std stat lstat fstat fstatat
.Sh COMPATIBILITY
Previous versions of the system used different types for the
.Li st_dev ,
@@ -284,9 +318,10 @@ and
.Li st_blocks
fields.
.Sh ERRORS
.Fn stat
and
.Fn stat ,
.Fn lstat
and
.Fn fstatat
will fail if:
.Bl -tag -width Er
.It Bq Er EACCES
@@ -297,7 +332,7 @@ This can happen if a file system information node is incorrect.
.It Bq Er EFAULT
.Fa sb
or
.Em name
.Fa path
points to an invalid address.
.It Bq Er EIO
An I/O error occurred while reading from or writing to the file system.
@@ -319,6 +354,24 @@ special file, and the device associated with this special file
does not exist.
.El
.Pp
In addition,
.Fn fstatat
will fail if:
.Bl -tag -width Er
.It Bq Er EBADF
.Fa path
does not specify an absolute path and
.Fa fd
is neither
.Dv AT_FDCWD
nor a valid file descriptor open for reading or searching.
.It Bq Er ENOTDIR
.Fa path
is not an absolute path and
.Fa fd
is a file descriptor associated with a non-directory file.
.El
.Pp
.Fn fstat
will fail if:
.Bl -tag -width Er
@@ -340,8 +393,15 @@ An I/O error occurred while reading from or writing to the file system.
.Xr types 3 ,
.Xr symlink 7
.Sh STANDARDS
The described functions conform to
.Fn stat ,
.Fn lstat ,
and
.Fn fstat
conform to
.St -p1003.1-2004 .
.Fn fstatat
conforms to
.St -p1003.1-2008 .
.Sh HISTORY
A
.Fn stat

View File

@@ -1,4 +1,4 @@
.\" $NetBSD: symlink.2,v 1.20 2010/05/31 12:16:20 njoly Exp $
.\" $NetBSD: symlink.2,v 1.26 2013/07/29 11:40:04 njoly Exp $
.\"
.\" Copyright (c) 1983, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -29,11 +29,12 @@
.\"
.\" @(#)symlink.2 8.1 (Berkeley) 6/4/93
.\"
.Dd June 4, 1993
.Dd July 29, 2013
.Dt SYMLINK 2
.Os
.Sh NAME
.Nm symlink
.Nm symlink ,
.Nm symlinkat
.Nd make symbolic link to a file
.Sh LIBRARY
.Lb libc
@@ -41,6 +42,8 @@
.In unistd.h
.Ft int
.Fn symlink "const char *name1" "const char *name2"
.Ft int
.Fn symlinkat "const char *name1" "int fd" "const char *name2"
.Sh DESCRIPTION
A symbolic link
.Fa name2
@@ -54,18 +57,72 @@ is the string
used in creating the symbolic link).
Either name may be an arbitrary path name; the files need neither
to be on the same file system nor to exist.
.Pp
.Fn symlinkat
works the same way as
.Fn symlink
except if
.Fa path2
is relative.
In that case, it is looked up from a directory whose file
descriptor was passed as
.Fa fd .
Search permission is required on this directory.
.\" (These alternatives await a decision about the semantics of O_SEARCH)
.\" Search permission is required on this directory
.\" except if
.\" .Fa fd
.\" was opened with the
.\" .Dv O_SEARCH
.\" flag.
.\" - or -
.\" This file descriptor must have been opened with the
.\" .Dv O_SEARCH
.\" flag.
.Fa fd
can be set to
.Dv AT_FDCWD
in order to specify the current directory.
.Sh RETURN VALUES
Upon successful completion, a zero value is returned.
If an error occurs, the error code is stored in
.Va errno
and a \-1 value is returned.
.Rv -std symlink symlinkat
.Sh ERRORS
The symbolic link succeeds unless:
.Fn symlink
and
.Fn symlinkat
will fail and no link will be created if:
.Bl -tag -width Er
.It Bq Er ENOTDIR
.It Bq Er EACCES
A component of the
.Fa name2
prefix is not a directory.
path prefix denies search permission.
.It Bq Er EDQUOT
The directory in which the entry for the new symbolic link
is being placed cannot be extended because the
user's quota of disk blocks on the file system
containing the directory has been exhausted.
Or, the new symbolic link cannot be created because the user's
quota of disk blocks on the file system that will
contain the symbolic link has been exhausted.
Or, the user's quota of inodes on the file system on
which the symbolic link is being created has been exhausted.
.It Bq Er EEXIST
.Fa name2
already exists.
.It Bq Er EFAULT
.Fa name1
or
.Fa name2
points outside the process's allocated address space.
.It Bq Er EIO
An I/O error occurred while making the directory entry for
.Fa name2 ,
or allocating the inode for
.Fa name2 ,
or writing out the link contents of
.Fa name2 .
Or, an I/O error occurred while making the directory entry or allocating the inode.
.It Bq Er ELOOP
Too many symbolic links were encountered in translating the pathname.
.It Bq Er ENAMETOOLONG
A component of a pathname exceeded
.Brq Dv NAME_MAX
@@ -76,56 +133,41 @@ characters.
A component of the
.Fa name2
path does not exist.
.It Bq Er EACCES
A component of the
.Fa name2
path prefix denies search permission.
.It Bq Er ELOOP
Too many symbolic links were encountered in translating the pathname.
.It Bq Er EEXIST
.Fa name2
already exists.
.It Bq Er EIO
An I/O error occurred while making the directory entry for
.Fa name2 ,
or allocating the inode for
.Fa name2 ,
or writing out the link contents of
.Fa name2 .
.It Bq Er EROFS
The file
.Fa name2
would reside on a read-only file system.
.It Bq Er ENOSPC
The directory in which the entry for the new symbolic link is being placed
cannot be extended because there is no space left on the file
system containing the directory.
.It Bq Er ENOSPC
The new symbolic link cannot be created because there
Or, the new symbolic link cannot be created because there
there is no space left on the file
system that will contain the symbolic link.
.It Bq Er ENOSPC
There are no free inodes on the file system on which the
Or, there are no free inodes on the file system on which the
symbolic link is being created.
.It Bq Er EDQUOT
The directory in which the entry for the new symbolic link
is being placed cannot be extended because the
user's quota of disk blocks on the file system
containing the directory has been exhausted.
.It Bq Er EDQUOT
The new symbolic link cannot be created because the user's
quota of disk blocks on the file system that will
contain the symbolic link has been exhausted.
.It Bq Er EDQUOT
The user's quota of inodes on the file system on
which the symbolic link is being created has been exhausted.
.It Bq Er EIO
An I/O error occurred while making the directory entry or allocating the inode.
.It Bq Er EFAULT
.Fa name1
or
.It Bq Er ENOTDIR
A component of the
.Fa name2
points outside the process's allocated address space.
prefix is not a directory.
.It Bq Er EROFS
The file
.Fa name2
would reside on a read-only file system.
.El
.Pp
In addition,
.Fn symlinkat
will fail if:
.Bl -tag -width Er
.It Bq Er EBADF
.Fa name2
does not specify an absolute path and
.Fa fd
is neither
.Dv AT_FDCWD
nor a valid file descriptor open for reading or searching.
.It Bq Er ENOTDIR
.Fa name2
is not an absolute path and
.Fa fd
is a file descriptor associated with a non-directory file.
.El
.Sh SEE ALSO
.Xr ln 1 ,
@@ -133,6 +175,14 @@ points outside the process's allocated address space.
.Xr readlink 2 ,
.Xr unlink 2 ,
.Xr symlink 7
.Sh STANDARDS
The
.Fn symlink
function conforms to
.St -p1003.1-90 .
.Fn symlinkat
conforms to
.St -p1003.1-2008 .
.Sh HISTORY
The
.Fn symlink

View File

@@ -1,4 +1,4 @@
.\" $NetBSD: timer_create.2,v 1.11 2010/05/19 06:44:51 jruoho Exp $
.\" $NetBSD: timer_create.2,v 1.12 2012/11/06 21:16:21 uwe Exp $
.\"
.\" Copyright (c) 2003 The NetBSD Foundation, Inc.
.\" All rights reserved.
@@ -113,7 +113,8 @@ is not a valid clock id.
.Xr timer_delete 2 ,
.Xr timer_getoverrun 2 ,
.Xr timer_gettime 2 ,
.Xr timer_settime 2
.Xr timer_settime 2 ,
.Xr sigevent 3
.Sh STANDARDS
.St -p1003.1b-93 ,
.St -p1003.1i-95

View File

@@ -1,4 +1,4 @@
.\" $NetBSD: timer_settime.2,v 1.6 2010/05/17 07:22:03 jruoho Exp $
.\" $NetBSD: timer_settime.2,v 1.9 2012/11/06 23:25:44 wiz Exp $
.\"
.\" Copyright (c) 2003 The NetBSD Foundation, Inc.
.\" All rights reserved.
@@ -62,7 +62,7 @@ If the argument
.Ar otim
is not
.Dv NULL
the old timer settingas are returned.
the old timer settings are returned.
.Pp
If the
.Ar flags
@@ -121,7 +121,7 @@ argument of
.Fn timer_settime
or in the
.Ar tim
argment of
argument of
.Fn timer_gettime
are subject to the above rounding effect and might not exactly match the
requested values by the user.
@@ -169,3 +169,4 @@ structure specified a value less than zero or greater than or equal to 10e9.
.Sh STANDARDS
.St -p1003.1b-93 ,
.St -p1003.1i-95
.\" LocalWords: gettime settime

View File

@@ -1,4 +1,4 @@
.\" $NetBSD: unlink.2,v 1.23 2010/05/31 12:16:20 njoly Exp $
.\" $NetBSD: unlink.2,v 1.28 2013/07/28 13:53:04 njoly Exp $
.\"
.\" Copyright (c) 1980, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -29,11 +29,12 @@
.\"
.\" @(#)unlink.2 8.1 (Berkeley) 6/4/93
.\"
.Dd April 3, 2010
.Dd July 28, 2013
.Dt UNLINK 2
.Os
.Sh NAME
.Nm unlink
.Nm unlink ,
.Nm unlinkat ,
.Nd remove directory entry
.Sh LIBRARY
.Lb libc
@@ -41,6 +42,9 @@
.In unistd.h
.Ft int
.Fn unlink "const char *path"
.In fcntl.h
.Ft int
.Fn unlinkat "int fd" "const char *path" "int flag"
.Sh DESCRIPTION
The
.Fn unlink
@@ -56,14 +60,47 @@ all resources associated with the file are reclaimed.
If one or more process have the file open when the last link is removed,
the link is removed, but the removal of the file is delayed until
all references to it have been closed.
.Pp
.Fn unlinkat
works the same way as
.Fn unlink
except if
.Fa path
is relative.
In that case, it is looked up from a directory whose file
descriptor was passed as
.Fa fd .
Search permission is required on this directory.
.\" (These alternatives await a decision about the semantics of O_SEARCH)
.\" Search permission is required on this directory
.\" except if
.\" .Fa fd
.\" was opened with the
.\" .Dv O_SEARCH
.\" flag.
.\" - or -
.\" This file descriptor must have been opened with the
.\" .Dv O_SEARCH
.\" flag.
.Fa fd
can be set to
.Dv AT_FDCWD
in order to specify the current directory.
.Pp
.Fn unlinkat
will remove directories just like
.Fn rmdir
provided
.Dv AT_REMOVEDIR
is set in
.Fa flag .
.Sh RETURN VALUES
Upon successful completion, a value of 0 is returned.
Otherwise, a value of \-1 is returned and
.Va errno
is set to indicate the error.
.Rv -std unlink unlinkat
.Sh ERRORS
The
.Fn unlink
and
.Fn unlinkat
succeeds unless:
.Bl -tag -width Er
.It Bq Er EACCES
@@ -103,6 +140,37 @@ are owned by the effective user ID.
.It Bq Er EROFS
The named file resides on a read-only file system.
.El
.Pp
In addition,
.Fn unlinkat
will fail if:
.Bl -tag -width Er
.It Bq Er EBADF
.Fa path
does not specify an absolute path and
.Fa fd
is neither
.Dv AT_FDCWD
nor a valid file descriptor open for reading or searching.
.It Bq Er ENOTDIR
.Fa path
is not an absolute path and
.Fa fd
is a file descriptor associated with a non-directory file; or
.Fa flag
has
.Dv AT_REMOVEDIR
set and
.Fa path
does not name a directory.
.It Bq Er ENOTEMPTY
.Fa flag
has
.Dv AT_REMOVEDIR
set and
.Fa path
is a directory that is not empty.
.El
.Sh SEE ALSO
.Xr close 2 ,
.Xr link 2 ,
@@ -113,6 +181,9 @@ The
.Fn unlink
function conforms to
.St -p1003.1-90 .
.Fn unlinkat
conforms to
.St -p1003.1-2008 .
.Sh HISTORY
An
.Fn unlink

View File

@@ -1,4 +1,4 @@
.\" $NetBSD: utimes.2,v 1.30 2011/10/25 09:26:53 wiz Exp $
.\" $NetBSD: utimes.2,v 1.40 2013/10/05 21:24:36 ast Exp $
.\"
.\" Copyright (c) 1990, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -29,13 +29,15 @@
.\"
.\" @(#)utimes.2 8.1 (Berkeley) 6/4/93
.\"
.Dd August 17, 2011
.Dd September 14, 2013
.Dt UTIMES 2
.Os
.Sh NAME
.Nm utimes ,
.Nm lutimes ,
.Nm futimes ,
.Nm utimens ,
.Nm lutimens ,
.Nm futimens ,
.Nm utimensat
.Nd set file access and modification times
@@ -49,10 +51,18 @@
.Fn lutimes "const char *path" "const struct timeval times[2]"
.Ft int
.Fn futimes "int fd" "const struct timeval times[2]"
.In sys/stat.h
.Ft int
.Fn utimens "const char *path" "const struct timespec times[2]"
.Ft int
.Fn lutimens "const char *path" "const struct timespec times[2]"
.Ft int
.Fn futimens "int fd" "const struct timespec times[2]"
.In sys/stat.h
.In fcntl.h
.Ft int
.Fn utimensat "int fd" "const char *path" "const struct timespec times[2]" "int flag"
.Fn utimensat "int fd" "const char *path" "const struct timespec times[2]" \
"int flag"
.Sh DESCRIPTION
The access and modification times of the file named by
.Fa path
@@ -100,24 +110,56 @@ while
.Fn utimes
changes the times of the file the link references.
.Pp
.Fn utimens ,
.Fn lutimens ,
and
.Fn futimens
is like
are like
.Fn utimes ,
.Fn lutimes ,
and
.Fn futimes
except that time is specified with nanosecond instead of microseconds.
respectively except that time is specified with nanosecond instead of
microsecond precision.
.Pp
.Fn utimensat
also allows time to be specifed with nanoseconds.
When it operates on a symbolic link, it will change the target's time if
.Ar follow
is unset.
If
.Ar follow
is set to
.Dv AT_SYMLINK_NOFOLLOW ,
the symbolic link's dates are changed.
works the same way as
.Fn utimens
except if
.Fa path
is relative.
In that case, it is looked up from a directory whose file
descriptor was passed as
.Fa fd .
Search permission is required on this directory.
.\" (These alternatives await a decision about the semantics of O_SEARCH)
.\" Search permission is required on this directory
.\" except if
.\" .Fa fd
.\" was opened with the
.\" .Dv O_SEARCH
.\" flag.
.\" - or -
.\" This file descriptor must have been opened with the
.\" .Dv O_SEARCH
.\" flag.
.Fa fd
can be set to
.Dv AT_FDCWD
in order to specify the current directory.
.Pp
When it operates on a symbolic link,
.Fn utimensat
will change the target's time unless
.Dv AT_SYMLINK_NOFOLLOW
is set in
.Fa flag .
In that later case, the symbolic link's dates are changed.
.Pp
The nanosecond fields for
.Fn futimens
.Fn utimens ,
.Fn lutimens ,
.Fn futimens ,
and
.Fn utimensat
can be set to the special value
@@ -126,23 +168,13 @@ to set the current time, or to
.Dv UTIME_OMIT
to let the time unchanged (this allows changing access time but not
modification time, and vice-versa).
.Pp
.Fn utimensat
is partially implemented.
It will return
.Er ENOSYS
for
.Fa fd
values different than
.Dv AT_FDCWD .
.Sh RETURN VALUES
Upon successful completion, a value of 0 is returned.
Otherwise, a value of \-1 is returned and
.Va errno
is set to indicate the error.
.Rv -std utimes lutimes futimes utimens lutimens futimens utimensat
.Sh ERRORS
.Fn utimes ,
.Fn lutimes ,
.Fn utimens ,
.Fn lutimens ,
and
.Fn utimensat
will fail if:
@@ -186,6 +218,24 @@ does not match the owner of the file and is not the super-user.
The file system containing the file is mounted read-only.
.El
.Pp
In addition,
.Fn utimensat
will fail if:
.Bl -tag -width Er
.It Bq Er EBADF
.Fa path
does not specify an absolute path and
.Fa fd
is neither
.Dv AT_FDCWD
nor a valid file descriptor open for reading or searching.
.It Bq Er ENOTDIR
.Fa path
is not an absolute path and
.Fa fd
is a file descriptor associated with a non-directory file.
.El
.Pp
.Fn futimes
and
.Fn futimens
@@ -252,8 +302,5 @@ Birthtime setting support was added in
.Fn futimens
and
.Fn utimensat
functions calls appreared in
functions calls appeared in
.Nx 6.0 .
.Sh BUGS
.Fn utimensat
is partially implemented.

View File

@@ -1,4 +1,4 @@
.\" $NetBSD: write.2,v 1.32 2010/04/05 07:53:47 wiz Exp $
.\" $NetBSD: write.2,v 1.33 2013/07/14 14:29:09 njoly Exp $
.\"
.\" Copyright (c) 1980, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -202,7 +202,7 @@ may return one of the following errors:
.It Bq Er EINVAL
.Fa iovcnt
was less than or equal to 0, or greater than
.Dv {IOV_MAX} ;
.Brq Dv IOV_MAX ;
or one of the
.Fa iov_len
values in the