[Midnightbsd-cvs] src [10509] U trunk/lib/libc/sys: sync

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Thu Jun 7 08:22:27 EDT 2018


Revision: 10509
          http://svnweb.midnightbsd.org/src/?rev=10509
Author:   laffer1
Date:     2018-06-07 08:22:26 -0400 (Thu, 07 Jun 2018)
Log Message:
-----------
sync

Modified Paths:
--------------
    trunk/lib/libc/sys/Makefile.inc
    trunk/lib/libc/sys/Symbol.map
    trunk/lib/libc/sys/__error.c
    trunk/lib/libc/sys/__vdso_gettimeofday.c
    trunk/lib/libc/sys/_exit.2
    trunk/lib/libc/sys/abort2.2
    trunk/lib/libc/sys/accept.2
    trunk/lib/libc/sys/access.2
    trunk/lib/libc/sys/acct.2
    trunk/lib/libc/sys/adjtime.2
    trunk/lib/libc/sys/aio_cancel.2
    trunk/lib/libc/sys/aio_error.2
    trunk/lib/libc/sys/aio_read.2
    trunk/lib/libc/sys/aio_return.2
    trunk/lib/libc/sys/aio_suspend.2
    trunk/lib/libc/sys/aio_waitcomplete.2
    trunk/lib/libc/sys/aio_write.2
    trunk/lib/libc/sys/bind.2
    trunk/lib/libc/sys/brk.2
    trunk/lib/libc/sys/cap_enter.2
    trunk/lib/libc/sys/chdir.2
    trunk/lib/libc/sys/chflags.2
    trunk/lib/libc/sys/chmod.2
    trunk/lib/libc/sys/chown.2
    trunk/lib/libc/sys/chroot.2
    trunk/lib/libc/sys/clock_gettime.2
    trunk/lib/libc/sys/clock_gettime.c
    trunk/lib/libc/sys/close.2
    trunk/lib/libc/sys/closefrom.2
    trunk/lib/libc/sys/connect.2
    trunk/lib/libc/sys/cpuset.2
    trunk/lib/libc/sys/cpuset_getaffinity.2
    trunk/lib/libc/sys/dup.2
    trunk/lib/libc/sys/execve.2
    trunk/lib/libc/sys/extattr_get_file.2
    trunk/lib/libc/sys/fcntl.2
    trunk/lib/libc/sys/fcntl.c
    trunk/lib/libc/sys/fhopen.2
    trunk/lib/libc/sys/flock.2
    trunk/lib/libc/sys/fork.2
    trunk/lib/libc/sys/fsync.2
    trunk/lib/libc/sys/ftruncate.c
    trunk/lib/libc/sys/getdirentries.2
    trunk/lib/libc/sys/getdtablesize.2
    trunk/lib/libc/sys/getfh.2
    trunk/lib/libc/sys/getfsstat.2
    trunk/lib/libc/sys/getgid.2
    trunk/lib/libc/sys/getgroups.2
    trunk/lib/libc/sys/getitimer.2
    trunk/lib/libc/sys/getlogin.2
    trunk/lib/libc/sys/getloginclass.2
    trunk/lib/libc/sys/getpeername.2
    trunk/lib/libc/sys/getpgrp.2
    trunk/lib/libc/sys/getpid.2
    trunk/lib/libc/sys/getpriority.2
    trunk/lib/libc/sys/getrlimit.2
    trunk/lib/libc/sys/getrusage.2
    trunk/lib/libc/sys/getsid.2
    trunk/lib/libc/sys/getsockname.2
    trunk/lib/libc/sys/getsockopt.2
    trunk/lib/libc/sys/gettimeofday.2
    trunk/lib/libc/sys/gettimeofday.c
    trunk/lib/libc/sys/getuid.2
    trunk/lib/libc/sys/intro.2
    trunk/lib/libc/sys/ioctl.2
    trunk/lib/libc/sys/issetugid.2
    trunk/lib/libc/sys/jail.2
    trunk/lib/libc/sys/kenv.2
    trunk/lib/libc/sys/kill.2
    trunk/lib/libc/sys/kldfind.2
    trunk/lib/libc/sys/kldfirstmod.2
    trunk/lib/libc/sys/kldload.2
    trunk/lib/libc/sys/kldnext.2
    trunk/lib/libc/sys/kldstat.2
    trunk/lib/libc/sys/kldsym.2
    trunk/lib/libc/sys/kldunload.2
    trunk/lib/libc/sys/kqueue.2
    trunk/lib/libc/sys/kse.2
    trunk/lib/libc/sys/ktrace.2
    trunk/lib/libc/sys/link.2
    trunk/lib/libc/sys/lio_listio.2
    trunk/lib/libc/sys/listen.2
    trunk/lib/libc/sys/lseek.2
    trunk/lib/libc/sys/lseek.c
    trunk/lib/libc/sys/madvise.2
    trunk/lib/libc/sys/mincore.2
    trunk/lib/libc/sys/minherit.2
    trunk/lib/libc/sys/mkdir.2
    trunk/lib/libc/sys/mkfifo.2
    trunk/lib/libc/sys/mknod.2
    trunk/lib/libc/sys/mlock.2
    trunk/lib/libc/sys/mlockall.2
    trunk/lib/libc/sys/mmap.2
    trunk/lib/libc/sys/mmap.c
    trunk/lib/libc/sys/modfind.2
    trunk/lib/libc/sys/modnext.2
    trunk/lib/libc/sys/modstat.2
    trunk/lib/libc/sys/mount.2
    trunk/lib/libc/sys/mprotect.2
    trunk/lib/libc/sys/mq_close.2
    trunk/lib/libc/sys/mq_getattr.2
    trunk/lib/libc/sys/mq_notify.2
    trunk/lib/libc/sys/mq_open.2
    trunk/lib/libc/sys/mq_receive.2
    trunk/lib/libc/sys/mq_send.2
    trunk/lib/libc/sys/mq_setattr.2
    trunk/lib/libc/sys/msgctl.2
    trunk/lib/libc/sys/msgget.2
    trunk/lib/libc/sys/msgrcv.2
    trunk/lib/libc/sys/msgsnd.2
    trunk/lib/libc/sys/msync.2
    trunk/lib/libc/sys/munmap.2
    trunk/lib/libc/sys/nanosleep.2
    trunk/lib/libc/sys/nfssvc.2
    trunk/lib/libc/sys/ntp_adjtime.2
    trunk/lib/libc/sys/open.2
    trunk/lib/libc/sys/pathconf.2
    trunk/lib/libc/sys/pdfork.2
    trunk/lib/libc/sys/pipe.2
    trunk/lib/libc/sys/poll.2
    trunk/lib/libc/sys/posix_fadvise.2
    trunk/lib/libc/sys/posix_fallocate.2
    trunk/lib/libc/sys/posix_openpt.2
    trunk/lib/libc/sys/pread.c
    trunk/lib/libc/sys/profil.2
    trunk/lib/libc/sys/pselect.2
    trunk/lib/libc/sys/ptrace.2
    trunk/lib/libc/sys/pwrite.c
    trunk/lib/libc/sys/quotactl.2
    trunk/lib/libc/sys/read.2
    trunk/lib/libc/sys/readlink.2
    trunk/lib/libc/sys/reboot.2
    trunk/lib/libc/sys/recv.2
    trunk/lib/libc/sys/rename.2
    trunk/lib/libc/sys/revoke.2
    trunk/lib/libc/sys/rfork.2
    trunk/lib/libc/sys/rmdir.2
    trunk/lib/libc/sys/rtprio.2
    trunk/lib/libc/sys/sched_get_priority_max.2
    trunk/lib/libc/sys/sched_setparam.2
    trunk/lib/libc/sys/sched_setscheduler.2
    trunk/lib/libc/sys/sched_yield.2
    trunk/lib/libc/sys/sctp_generic_recvmsg.2
    trunk/lib/libc/sys/sctp_generic_sendmsg.2
    trunk/lib/libc/sys/sctp_peeloff.2
    trunk/lib/libc/sys/select.2
    trunk/lib/libc/sys/semctl.2
    trunk/lib/libc/sys/semget.2
    trunk/lib/libc/sys/semop.2
    trunk/lib/libc/sys/send.2
    trunk/lib/libc/sys/sendfile.2
    trunk/lib/libc/sys/setfib.2
    trunk/lib/libc/sys/setgroups.2
    trunk/lib/libc/sys/setpgid.2
    trunk/lib/libc/sys/setregid.2
    trunk/lib/libc/sys/setresuid.2
    trunk/lib/libc/sys/setreuid.2
    trunk/lib/libc/sys/setsid.2
    trunk/lib/libc/sys/setuid.2
    trunk/lib/libc/sys/shm_open.2
    trunk/lib/libc/sys/shmat.2
    trunk/lib/libc/sys/shmctl.2
    trunk/lib/libc/sys/shmget.2
    trunk/lib/libc/sys/shutdown.2
    trunk/lib/libc/sys/sigaction.2
    trunk/lib/libc/sys/sigaltstack.2
    trunk/lib/libc/sys/sigpending.2
    trunk/lib/libc/sys/sigprocmask.2
    trunk/lib/libc/sys/sigqueue.2
    trunk/lib/libc/sys/sigreturn.2
    trunk/lib/libc/sys/sigstack.2
    trunk/lib/libc/sys/sigsuspend.2
    trunk/lib/libc/sys/sigwait.2
    trunk/lib/libc/sys/sigwait.c
    trunk/lib/libc/sys/sigwaitinfo.2
    trunk/lib/libc/sys/socket.2
    trunk/lib/libc/sys/socketpair.2
    trunk/lib/libc/sys/stack_protector.c
    trunk/lib/libc/sys/stack_protector_compat.c
    trunk/lib/libc/sys/stat.2
    trunk/lib/libc/sys/statfs.2
    trunk/lib/libc/sys/swapon.2
    trunk/lib/libc/sys/symlink.2
    trunk/lib/libc/sys/sync.2
    trunk/lib/libc/sys/sysarch.2
    trunk/lib/libc/sys/syscall.2
    trunk/lib/libc/sys/timer_create.2
    trunk/lib/libc/sys/timer_delete.2
    trunk/lib/libc/sys/timer_settime.2
    trunk/lib/libc/sys/truncate.2
    trunk/lib/libc/sys/truncate.c
    trunk/lib/libc/sys/umask.2
    trunk/lib/libc/sys/undelete.2
    trunk/lib/libc/sys/unlink.2
    trunk/lib/libc/sys/utimes.2
    trunk/lib/libc/sys/utrace.2
    trunk/lib/libc/sys/uuidgen.2
    trunk/lib/libc/sys/vfork.2

Added Paths:
-----------
    trunk/lib/libc/sys/accept.c
    trunk/lib/libc/sys/accept4.c
    trunk/lib/libc/sys/aio_fsync.2
    trunk/lib/libc/sys/aio_mlock.2
    trunk/lib/libc/sys/aio_suspend.c
    trunk/lib/libc/sys/bindat.2
    trunk/lib/libc/sys/cap_fcntls_limit.2
    trunk/lib/libc/sys/cap_ioctls_limit.2
    trunk/lib/libc/sys/cap_rights_limit.2
    trunk/lib/libc/sys/close.c
    trunk/lib/libc/sys/connect.c
    trunk/lib/libc/sys/connectat.2
    trunk/lib/libc/sys/ffclock.2
    trunk/lib/libc/sys/fork.c
    trunk/lib/libc/sys/fsync.c
    trunk/lib/libc/sys/futimens.c
    trunk/lib/libc/sys/interposing_table.c
    trunk/lib/libc/sys/kevent.c
    trunk/lib/libc/sys/msync.c
    trunk/lib/libc/sys/nanosleep.c
    trunk/lib/libc/sys/open.c
    trunk/lib/libc/sys/openat.c
    trunk/lib/libc/sys/poll.c
    trunk/lib/libc/sys/ppoll.c
    trunk/lib/libc/sys/procctl.2
    trunk/lib/libc/sys/pselect.c
    trunk/lib/libc/sys/ptrace.c
    trunk/lib/libc/sys/rctl_add_rule.2
    trunk/lib/libc/sys/read.c
    trunk/lib/libc/sys/readv.c
    trunk/lib/libc/sys/recvfrom.c
    trunk/lib/libc/sys/recvmsg.c
    trunk/lib/libc/sys/select.c
    trunk/lib/libc/sys/sendmsg.c
    trunk/lib/libc/sys/sendto.c
    trunk/lib/libc/sys/setcontext.c
    trunk/lib/libc/sys/sigaction.c
    trunk/lib/libc/sys/sigprocmask.c
    trunk/lib/libc/sys/sigsuspend.c
    trunk/lib/libc/sys/sigtimedwait.c
    trunk/lib/libc/sys/sigwaitinfo.c
    trunk/lib/libc/sys/swapcontext.c
    trunk/lib/libc/sys/thr_suspend.2
    trunk/lib/libc/sys/thr_wake.2
    trunk/lib/libc/sys/utimensat.2
    trunk/lib/libc/sys/utimensat.c

Property Changed:
----------------
    trunk/lib/libc/sys/Makefile.inc
    trunk/lib/libc/sys/Symbol.map
    trunk/lib/libc/sys/_exit.2
    trunk/lib/libc/sys/abort2.2
    trunk/lib/libc/sys/accept.2
    trunk/lib/libc/sys/access.2
    trunk/lib/libc/sys/acct.2
    trunk/lib/libc/sys/adjtime.2
    trunk/lib/libc/sys/aio_cancel.2
    trunk/lib/libc/sys/aio_error.2
    trunk/lib/libc/sys/aio_read.2
    trunk/lib/libc/sys/aio_return.2
    trunk/lib/libc/sys/aio_suspend.2
    trunk/lib/libc/sys/aio_waitcomplete.2
    trunk/lib/libc/sys/aio_write.2
    trunk/lib/libc/sys/bind.2
    trunk/lib/libc/sys/brk.2
    trunk/lib/libc/sys/cap_enter.2
    trunk/lib/libc/sys/cap_new.2
    trunk/lib/libc/sys/chdir.2
    trunk/lib/libc/sys/chflags.2
    trunk/lib/libc/sys/chmod.2
    trunk/lib/libc/sys/chown.2
    trunk/lib/libc/sys/chroot.2
    trunk/lib/libc/sys/clock_gettime.2
    trunk/lib/libc/sys/close.2
    trunk/lib/libc/sys/closefrom.2
    trunk/lib/libc/sys/connect.2
    trunk/lib/libc/sys/cpuset.2
    trunk/lib/libc/sys/cpuset_getaffinity.2
    trunk/lib/libc/sys/dup.2
    trunk/lib/libc/sys/execve.2
    trunk/lib/libc/sys/extattr_get_file.2
    trunk/lib/libc/sys/fcntl.2
    trunk/lib/libc/sys/fhopen.2
    trunk/lib/libc/sys/flock.2
    trunk/lib/libc/sys/fork.2
    trunk/lib/libc/sys/fsync.2
    trunk/lib/libc/sys/getdirentries.2
    trunk/lib/libc/sys/getdtablesize.2
    trunk/lib/libc/sys/getfh.2
    trunk/lib/libc/sys/getfsstat.2
    trunk/lib/libc/sys/getgid.2
    trunk/lib/libc/sys/getgroups.2
    trunk/lib/libc/sys/getitimer.2
    trunk/lib/libc/sys/getlogin.2
    trunk/lib/libc/sys/getloginclass.2
    trunk/lib/libc/sys/getpeername.2
    trunk/lib/libc/sys/getpgrp.2
    trunk/lib/libc/sys/getpid.2
    trunk/lib/libc/sys/getpriority.2
    trunk/lib/libc/sys/getrlimit.2
    trunk/lib/libc/sys/getrusage.2
    trunk/lib/libc/sys/getsid.2
    trunk/lib/libc/sys/getsockname.2
    trunk/lib/libc/sys/getsockopt.2
    trunk/lib/libc/sys/gettimeofday.2
    trunk/lib/libc/sys/getuid.2
    trunk/lib/libc/sys/intro.2
    trunk/lib/libc/sys/ioctl.2
    trunk/lib/libc/sys/issetugid.2
    trunk/lib/libc/sys/jail.2
    trunk/lib/libc/sys/kenv.2
    trunk/lib/libc/sys/kill.2
    trunk/lib/libc/sys/kldfind.2
    trunk/lib/libc/sys/kldfirstmod.2
    trunk/lib/libc/sys/kldload.2
    trunk/lib/libc/sys/kldnext.2
    trunk/lib/libc/sys/kldstat.2
    trunk/lib/libc/sys/kldsym.2
    trunk/lib/libc/sys/kldunload.2
    trunk/lib/libc/sys/kqueue.2
    trunk/lib/libc/sys/kse.2
    trunk/lib/libc/sys/ktrace.2
    trunk/lib/libc/sys/link.2
    trunk/lib/libc/sys/lio_listio.2
    trunk/lib/libc/sys/listen.2
    trunk/lib/libc/sys/lseek.2
    trunk/lib/libc/sys/madvise.2
    trunk/lib/libc/sys/mincore.2
    trunk/lib/libc/sys/minherit.2
    trunk/lib/libc/sys/mkdir.2
    trunk/lib/libc/sys/mkfifo.2
    trunk/lib/libc/sys/mknod.2
    trunk/lib/libc/sys/mlock.2
    trunk/lib/libc/sys/mlockall.2
    trunk/lib/libc/sys/mmap.2
    trunk/lib/libc/sys/modfind.2
    trunk/lib/libc/sys/modnext.2
    trunk/lib/libc/sys/modstat.2
    trunk/lib/libc/sys/mount.2
    trunk/lib/libc/sys/mprotect.2
    trunk/lib/libc/sys/mq_close.2
    trunk/lib/libc/sys/mq_getattr.2
    trunk/lib/libc/sys/mq_notify.2
    trunk/lib/libc/sys/mq_open.2
    trunk/lib/libc/sys/mq_receive.2
    trunk/lib/libc/sys/mq_send.2
    trunk/lib/libc/sys/mq_setattr.2
    trunk/lib/libc/sys/msgctl.2
    trunk/lib/libc/sys/msgget.2
    trunk/lib/libc/sys/msgrcv.2
    trunk/lib/libc/sys/msgsnd.2
    trunk/lib/libc/sys/msync.2
    trunk/lib/libc/sys/munmap.2
    trunk/lib/libc/sys/nanosleep.2
    trunk/lib/libc/sys/nfssvc.2
    trunk/lib/libc/sys/ntp_adjtime.2
    trunk/lib/libc/sys/open.2
    trunk/lib/libc/sys/pathconf.2
    trunk/lib/libc/sys/pdfork.2
    trunk/lib/libc/sys/pipe.2
    trunk/lib/libc/sys/poll.2
    trunk/lib/libc/sys/posix_fadvise.2
    trunk/lib/libc/sys/posix_fallocate.2
    trunk/lib/libc/sys/posix_openpt.2
    trunk/lib/libc/sys/profil.2
    trunk/lib/libc/sys/pselect.2
    trunk/lib/libc/sys/ptrace.2
    trunk/lib/libc/sys/quotactl.2
    trunk/lib/libc/sys/read.2
    trunk/lib/libc/sys/readlink.2
    trunk/lib/libc/sys/reboot.2
    trunk/lib/libc/sys/recv.2
    trunk/lib/libc/sys/rename.2
    trunk/lib/libc/sys/revoke.2
    trunk/lib/libc/sys/rfork.2
    trunk/lib/libc/sys/rmdir.2
    trunk/lib/libc/sys/rtprio.2
    trunk/lib/libc/sys/sched_get_priority_max.2
    trunk/lib/libc/sys/sched_setparam.2
    trunk/lib/libc/sys/sched_setscheduler.2
    trunk/lib/libc/sys/sched_yield.2
    trunk/lib/libc/sys/sctp_generic_recvmsg.2
    trunk/lib/libc/sys/sctp_generic_sendmsg.2
    trunk/lib/libc/sys/sctp_peeloff.2
    trunk/lib/libc/sys/select.2
    trunk/lib/libc/sys/semctl.2
    trunk/lib/libc/sys/semget.2
    trunk/lib/libc/sys/semop.2
    trunk/lib/libc/sys/send.2
    trunk/lib/libc/sys/sendfile.2
    trunk/lib/libc/sys/setfib.2
    trunk/lib/libc/sys/setgroups.2
    trunk/lib/libc/sys/setpgid.2
    trunk/lib/libc/sys/setregid.2
    trunk/lib/libc/sys/setresuid.2
    trunk/lib/libc/sys/setreuid.2
    trunk/lib/libc/sys/setsid.2
    trunk/lib/libc/sys/setuid.2
    trunk/lib/libc/sys/shm_open.2
    trunk/lib/libc/sys/shmat.2
    trunk/lib/libc/sys/shmctl.2
    trunk/lib/libc/sys/shmget.2
    trunk/lib/libc/sys/shutdown.2
    trunk/lib/libc/sys/sigaction.2
    trunk/lib/libc/sys/sigaltstack.2
    trunk/lib/libc/sys/sigpending.2
    trunk/lib/libc/sys/sigprocmask.2
    trunk/lib/libc/sys/sigqueue.2
    trunk/lib/libc/sys/sigreturn.2
    trunk/lib/libc/sys/sigstack.2
    trunk/lib/libc/sys/sigsuspend.2
    trunk/lib/libc/sys/sigwait.2
    trunk/lib/libc/sys/sigwaitinfo.2
    trunk/lib/libc/sys/socket.2
    trunk/lib/libc/sys/socketpair.2
    trunk/lib/libc/sys/stat.2
    trunk/lib/libc/sys/statfs.2
    trunk/lib/libc/sys/swapon.2
    trunk/lib/libc/sys/symlink.2
    trunk/lib/libc/sys/sync.2
    trunk/lib/libc/sys/sysarch.2
    trunk/lib/libc/sys/syscall.2
    trunk/lib/libc/sys/timer_create.2
    trunk/lib/libc/sys/timer_delete.2
    trunk/lib/libc/sys/timer_settime.2
    trunk/lib/libc/sys/truncate.2
    trunk/lib/libc/sys/umask.2
    trunk/lib/libc/sys/undelete.2
    trunk/lib/libc/sys/unlink.2
    trunk/lib/libc/sys/utimes.2
    trunk/lib/libc/sys/utrace.2
    trunk/lib/libc/sys/uuidgen.2
    trunk/lib/libc/sys/vfork.2

Modified: trunk/lib/libc/sys/Makefile.inc
===================================================================
--- trunk/lib/libc/sys/Makefile.inc	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/Makefile.inc	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,5 +1,6 @@
+# $MidnightBSD$
 #	@(#)Makefile.inc	8.3 (Berkeley) 10/24/94
-# $MidnightBSD$
+# $FreeBSD: stable/10/lib/libc/sys/Makefile.inc 320150 2017-06-20 15:55:15Z jhb $
 
 # sys sources
 .PATH: ${.CURDIR}/${LIBC_ARCH}/sys ${.CURDIR}/sys
@@ -20,18 +21,76 @@
 PSEUDO+= _clock_gettime.o _gettimeofday.o
 
 # Sources common to both syscall interfaces:
-SRCS+=	stack_protector.c stack_protector_compat.c __error.c
+SRCS+=	\
+	stack_protector.c \
+	stack_protector_compat.c \
+	__error.c \
+	interposing_table.c
+
 .if !defined(WITHOUT_SYSCALL_COMPAT)
-SYSCALL_COMPAT_SRCS=	fcntl.c ftruncate.c lseek.c mmap.c pread.c \
-	pwrite.c truncate.c
+SYSCALL_COMPAT_SRCS= \
+	ftruncate.c \
+	lseek.c \
+	mmap.c \
+	pread.c \
+	pwrite.c \
+	truncate.c
 SRCS+=	${SYSCALL_COMPAT_SRCS}
 NOASM+=	${SYSCALL_COMPAT_SRCS:S/.c/.o/}
-PSEUDO+= _fcntl.o
 .endif
-SRCS+= sigwait.c
-NOASM+= sigwait.o
-PSEUDO+= _sigwait.o
 
+SRCS+= futimens.c utimensat.c
+NOASM+= futimens.o utimensat.o
+PSEUDO+= _futimens.o _utimensat.o
+
+INTERPOSED = \
+	accept \
+	accept4 \
+	aio_suspend \
+	close \
+	connect \
+	fcntl \
+	fsync \
+	fork \
+	kevent \
+	msync \
+	nanosleep \
+	open \
+	openat \
+	poll \
+	ppoll \
+	pselect \
+	ptrace \
+	read \
+	readv \
+	recvfrom \
+	recvmsg \
+	select \
+	sendmsg \
+	sendto \
+	setcontext \
+	sigprocmask \
+	sigsuspend \
+	sigtimedwait \
+	sigwait \
+	sigwaitinfo \
+	swapcontext \
+	wait4 \
+	wait6 \
+	write \
+	writev
+
+.if ${MACHINE_CPUARCH} == "sparc64"
+SRCS+=	sigaction.c
+NOASM+=	sigaction.o
+.else
+INTERPOSED+= sigaction
+.endif
+
+SRCS+=	${INTERPOSED:S/$/.c/}
+NOASM+=	${INTERPOSED:S/$/.o/}
+PSEUDO+=	${INTERPOSED:C/^.*$/_&.o/}
+
 # Add machine dependent asm sources:
 SRCS+=${MDASM}
 
@@ -47,8 +106,6 @@
 .endif
 .endfor
 
-OBJS+=	${ASM} ${PSEUDO}
-
 SASM=	${ASM:S/.o/.S/}
 
 SPSEUDO= ${PSEUDO:S/.o/.S/}
@@ -78,59 +135,226 @@
 	    >> ${.TARGET}
 	printf ${NOTE_GNU_STACK} >>${.TARGET}
 
-MAN+=	abort2.2 accept.2 access.2 acct.2 adjtime.2 \
-	aio_cancel.2 aio_error.2 aio_read.2 aio_return.2 \
-	aio_suspend.2 aio_waitcomplete.2 aio_write.2 \
-	bind.2 brk.2 cap_enter.2 cap_new.2 chdir.2 chflags.2 \
-	chmod.2 chown.2 chroot.2 clock_gettime.2 close.2 closefrom.2 \
-	connect.2 cpuset.2 cpuset_getaffinity.2 dup.2 execve.2 _exit.2 \
-	extattr_get_file.2 fcntl.2 fhopen.2 flock.2 fork.2 fsync.2 \
-	getdirentries.2 getdtablesize.2 \
-	getfh.2 getfsstat.2 getgid.2 getgroups.2 getitimer.2 getlogin.2 \
-	getloginclass.2 getpeername.2 getpgrp.2 getpid.2 getpriority.2 \
-	getrlimit.2 getrusage.2 getsid.2 getsockname.2 \
-	getsockopt.2 gettimeofday.2 getuid.2 \
-	intro.2 ioctl.2 issetugid.2 jail.2 kenv.2 kill.2 \
-	kldfind.2 kldfirstmod.2 kldload.2 kldnext.2 kldstat.2 kldsym.2 \
-	kldunload.2 kqueue.2 ktrace.2 link.2 lio_listio.2 listen.2 \
+MAN+=	abort2.2 \
+	accept.2 \
+	access.2 \
+	acct.2 \
+	adjtime.2 \
+	aio_cancel.2 \
+	aio_error.2 \
+	aio_fsync.2 \
+	aio_mlock.2 \
+	aio_read.2 \
+	aio_return.2 \
+	aio_suspend.2 \
+	aio_waitcomplete.2 \
+	aio_write.2 \
+	bind.2 \
+	bindat.2 \
+	brk.2 \
+	cap_enter.2 \
+	cap_fcntls_limit.2 \
+	cap_ioctls_limit.2 \
+	cap_rights_limit.2 \
+	chdir.2 \
+	chflags.2 \
+	chmod.2 \
+	chown.2 \
+	chroot.2 \
+	clock_gettime.2 \
+	close.2 \
+	closefrom.2 \
+	connect.2 \
+	connectat.2 \
+	cpuset.2 \
+	cpuset_getaffinity.2 \
+	dup.2 \
+	execve.2 \
+	_exit.2 \
+	extattr_get_file.2 \
+	fcntl.2 \
+	ffclock.2 \
+	fhopen.2 \
+	flock.2 \
+	fork.2 \
+	fsync.2 \
+	getdirentries.2 \
+	getdtablesize.2 \
+	getfh.2 \
+	getfsstat.2 \
+	getgid.2 \
+	getgroups.2 \
+	getitimer.2 \
+	getlogin.2 \
+	getloginclass.2 \
+	getpeername.2 \
+	getpgrp.2 \
+	getpid.2 \
+	getpriority.2 \
+	getrlimit.2 \
+	getrusage.2 \
+	getsid.2 \
+	getsockname.2 \
+	getsockopt.2 \
+	gettimeofday.2 \
+	getuid.2 \
+	intro.2 \
+	ioctl.2 \
+	issetugid.2 \
+	jail.2 \
+	kenv.2 \
+	kill.2 \
+	kldfind.2 \
+	kldfirstmod.2 \
+	kldload.2 \
+	kldnext.2 \
+	kldstat.2 \
+	kldsym.2 \
+	kldunload.2 \
+	kqueue.2 \
+	ktrace.2 \
+	link.2 \
+	lio_listio.2 \
+	listen.2 \
 	lseek.2 \
-	madvise.2 mincore.2 minherit.2 mkdir.2 mkfifo.2 mknod.2 mlock.2 \
-	mlockall.2 mmap.2 modfind.2 modnext.2 modstat.2 mount.2 mprotect.2 \
-	mq_close.2 mq_getattr.2 mq_notify.2 mq_open.2 mq_receive.2 mq_send.2 \
+	madvise.2 \
+	mincore.2 \
+	minherit.2 \
+	mkdir.2 \
+	mkfifo.2 \
+	mknod.2 \
+	mlock.2 \
+	mlockall.2 \
+	mmap.2 \
+	modfind.2 \
+	modnext.2 \
+	modstat.2 \
+	mount.2 \
+	mprotect.2 \
+	mq_close.2 \
+	mq_getattr.2 \
+	mq_notify.2 \
+	mq_open.2 \
+	mq_receive.2 \
+	mq_send.2 \
 	mq_setattr.2 \
-	msgctl.2 msgget.2 msgrcv.2 msgsnd.2 \
-	msync.2 munmap.2 nanosleep.2 nfssvc.2 ntp_adjtime.2 open.2 \
-	pathconf.2 pdfork.2 pipe.2 poll.2 posix_fadvise.2 posix_fallocate.2 \
-	posix_openpt.2 profil.2 \
-	pselect.2 ptrace.2 quotactl.2 \
-	read.2 readlink.2 reboot.2 recv.2 rename.2 revoke.2 rfork.2 rmdir.2 \
+	msgctl.2 \
+	msgget.2 \
+	msgrcv.2 \
+	msgsnd.2 \
+	msync.2 \
+	munmap.2 \
+	nanosleep.2 \
+	nfssvc.2 \
+	ntp_adjtime.2 \
+	open.2 \
+	pathconf.2 \
+	pdfork.2 \
+	pipe.2 \
+	poll.2 \
+	posix_fadvise.2 \
+	posix_fallocate.2 \
+	posix_openpt.2 \
+	procctl.2 \
+	profil.2 \
+	pselect.2 \
+	ptrace.2 \
+	quotactl.2 \
+	rctl_add_rule.2 \
+	read.2 \
+	readlink.2 \
+	reboot.2 \
+	recv.2 \
+	rename.2 \
+	revoke.2 \
+	rfork.2 \
+	rmdir.2 \
 	rtprio.2
 .if !defined(NO_P1003_1B)
-MAN+=	sched_get_priority_max.2 sched_setparam.2 \
-	sched_setscheduler.2 sched_yield.2
+MAN+=	sched_get_priority_max.2 \
+	sched_setparam.2 \
+	sched_setscheduler.2 \
+	sched_yield.2
 .endif
-MAN+=	sctp_generic_recvmsg.2 sctp_generic_sendmsg.2 sctp_peeloff.2 \
-	select.2 semctl.2 semget.2 semop.2 send.2 setfib.2 sendfile.2 \
-	setgroups.2 setpgid.2 setregid.2 setresuid.2 setreuid.2 setsid.2 \
-	setuid.2 shmat.2 shmctl.2 shmget.2 shm_open.2 shutdown.2 \
-	sigaction.2 sigaltstack.2 sigpending.2 sigprocmask.2 sigqueue.2 \
-	sigreturn.2 sigstack.2 sigsuspend.2 sigwait.2 sigwaitinfo.2 \
-	socket.2 socketpair.2 stat.2 statfs.2 \
-	swapon.2 symlink.2 sync.2 sysarch.2 syscall.2 \
-	timer_create.2 timer_delete.2 timer_settime.2 \
-	truncate.2 umask.2 undelete.2 \
-	unlink.2 utimes.2 utrace.2 uuidgen.2 vfork.2 wait.2 write.2
+MAN+=	sctp_generic_recvmsg.2 \
+	sctp_generic_sendmsg.2 \
+	sctp_peeloff.2 \
+	select.2 \
+	semctl.2 \
+	semget.2 \
+	semop.2 \
+	send.2 \
+	setfib.2 \
+	sendfile.2 \
+	setgroups.2 \
+	setpgid.2 \
+	setregid.2 \
+	setresuid.2 \
+	setreuid.2 \
+	setsid.2 \
+	setuid.2 \
+	shmat.2 \
+	shmctl.2 \
+	shmget.2 \
+	shm_open.2 \
+	shutdown.2 \
+	sigaction.2 \
+	sigaltstack.2 \
+	sigpending.2 \
+	sigprocmask.2 \
+	sigqueue.2 \
+	sigreturn.2 \
+	sigstack.2 \
+	sigsuspend.2 \
+	sigwait.2 \
+	sigwaitinfo.2 \
+	socket.2 \
+	socketpair.2 \
+	stat.2 \
+	statfs.2 \
+	swapon.2 \
+	symlink.2 \
+	sync.2 \
+	sysarch.2 \
+	syscall.2 \
+	thr_suspend.2 \
+	thr_wake.2 \
+	timer_create.2 \
+	timer_delete.2 \
+	timer_settime.2 \
+	truncate.2 \
+	umask.2 \
+	undelete.2 \
+	unlink.2 \
+	utimensat.2 \
+	utimes.2 \
+	utrace.2 \
+	uuidgen.2 \
+	vfork.2 \
+	wait.2 \
+	write.2
 
-MLINKS+=access.2 eaccess.2 access.2 faccessat.2
+MLINKS+=accept.2 accept4.2
+MLINKS+=access.2 eaccess.2 \
+	access.2 faccessat.2
 MLINKS+=brk.2 sbrk.2
 MLINKS+=cap_enter.2 cap_getmode.2
-MLINKS+=cap_new.2 cap_getrights.2
+MLINKS+=cap_fcntls_limit.2 cap_fcntls_get.2
+MLINKS+=cap_ioctls_limit.2 cap_ioctls_get.2
 MLINKS+=chdir.2 fchdir.2
-MLINKS+=chflags.2 fchflags.2 chflags.2 lchflags.2
-MLINKS+=chmod.2 fchmod.2 chmod.2 fchmodat.2 chmod.2 lchmod.2
-MLINKS+=chown.2 fchown.2 chown.2 fchownat.2 chown.2 lchown.2
-MLINKS+=clock_gettime.2 clock_getres.2 clock_gettime.2 clock_settime.2
-MLINKS+=cpuset.2 cpuset_getid.2 cpuset.2 cpuset_setid.2
+MLINKS+=chflags.2 chflagsat.2 \
+	chflags.2 fchflags.2 \
+	chflags.2 lchflags.2
+MLINKS+=chmod.2 fchmod.2 \
+	chmod.2 fchmodat.2 \
+	chmod.2 lchmod.2
+MLINKS+=chown.2 fchown.2 \
+	chown.2 fchownat.2 \
+	chown.2 lchown.2
+MLINKS+=clock_gettime.2 clock_getres.2 \
+	clock_gettime.2 clock_settime.2
+MLINKS+=cpuset.2 cpuset_getid.2 \
+	cpuset.2 cpuset_setid.2
 MLINKS+=cpuset_getaffinity.2 cpuset_setaffinity.2
 MLINKS+=dup.2 dup2.2
 MLINKS+=execve.2 fexecve.2
@@ -137,9 +361,9 @@
 MLINKS+=extattr_get_file.2 extattr.2 \
 	extattr_get_file.2 extattr_delete_fd.2 \
 	extattr_get_file.2 extattr_delete_file.2 \
-	extattr_get_file.2 extattr_delete_list.2 \
+	extattr_get_file.2 extattr_delete_link.2 \
 	extattr_get_file.2 extattr_get_fd.2 \
-	extattr_get_file.2 extattr_get_list.2 \
+	extattr_get_file.2 extattr_get_link.2 \
 	extattr_get_file.2 extattr_list_fd.2 \
 	extattr_get_file.2 extattr_list_file.2 \
 	extattr_get_file.2 extattr_list_link.2 \
@@ -146,6 +370,9 @@
 	extattr_get_file.2 extattr_set_fd.2 \
 	extattr_get_file.2 extattr_set_file.2 \
 	extattr_get_file.2 extattr_set_link.2
+MLINKS+=ffclock.2 ffclock_getcounter.2 \
+	ffclock.2 ffclock_getestimate.2 \
+	ffclock.2 ffclock_setestimate.2
 MLINKS+=fhopen.2 fhstat.2 fhopen.2 fhstatfs.2
 MLINKS+=getdirentries.2 getdents.2
 MLINKS+=getfh.2 lgetfh.2
@@ -167,7 +394,8 @@
 	jail.2 jail_remove.2 \
 	jail.2 jail_set.2
 MLINKS+=kldunload.2 kldunloadf.2
-MLINKS+=kqueue.2 kevent.2
+MLINKS+=kqueue.2 kevent.2 \
+	kqueue.2 EV_SET.3
 MLINKS+=link.2 linkat.2
 MLINKS+=madvise.2 posix_madvise.2
 MLINKS+=mkdir.2 mkdirat.2
@@ -176,7 +404,8 @@
 MLINKS+=mlock.2 munlock.2
 MLINKS+=mlockall.2 munlockall.2
 MLINKS+=modnext.2 modfnext.2
-MLINKS+=mount.2 nmount.2 mount.2 unmount.2
+MLINKS+=mount.2 nmount.2 \
+	mount.2 unmount.2
 MLINKS+=mq_receive.2 mq_timedreceive.2
 MLINKS+=mq_send.2 mq_timedsend.2
 MLINKS+=ntp_adjtime.2 ntp_gettime.2
@@ -186,10 +415,20 @@
 MLINKS+=pdfork.2 pdgetpid.2\
 	pdfork.2 pdkill.2 \
 	pdfork.2 pdwait4.2
-MLINKS+=read.2 pread.2 read.2 preadv.2 read.2 readv.2
+MLINKS+=pipe.2 pipe2.2
+MLINKS+=poll.2 ppoll.2
+MLINKS+=rctl_add_rule.2 rctl_get_limits.2 \
+	rctl_add_rule.2 rctl_get_racct.2 \
+	rctl_add_rule.2 rctl_get_rules.2 \
+	rctl_add_rule.2 rctl_remove_rule.2
+MLINKS+=read.2 pread.2 \
+	read.2 preadv.2 \
+	read.2 readv.2
 MLINKS+=readlink.2 readlinkat.2
-MLINKS+=recv.2 recvfrom.2 recv.2 recvmsg.2
+MLINKS+=recv.2 recvfrom.2 \
+	recv.2 recvmsg.2
 MLINKS+=rename.2 renameat.2
+MLINKS+=rtprio.2 rtprio_thread.2
 .if !defined(NO_P1003_1B)
 MLINKS+=sched_get_priority_max.2 sched_get_priority_min.2 \
 	sched_get_priority_max.2 sched_rr_get_interval.2
@@ -196,24 +435,42 @@
 MLINKS+=sched_setparam.2 sched_getparam.2
 MLINKS+=sched_setscheduler.2 sched_getscheduler.2
 .endif
-MLINKS+=select.2 FD_CLR.3 select.2 FD_ISSET.3 select.2 FD_SET.3 \
+MLINKS+=select.2 FD_CLR.3 \
+	select.2 FD_ISSET.3 \
+	select.2 FD_SET.3 \
 	select.2 FD_ZERO.3
-MLINKS+=send.2 sendmsg.2 send.2 sendto.2
+MLINKS+=send.2 sendmsg.2 \
+	send.2 sendto.2
 MLINKS+=setpgid.2 setpgrp.2
-MLINKS+=setresuid.2 getresgid.2 setresuid.2 getresuid.2 setresuid.2 setresgid.2
-MLINKS+=setuid.2 setegid.2 setuid.2 seteuid.2 setuid.2 setgid.2
+MLINKS+=setresuid.2 getresgid.2 \
+	setresuid.2 getresuid.2 \
+	setresuid.2 setresgid.2
+MLINKS+=setuid.2 setegid.2 \
+	setuid.2 seteuid.2 \
+	setuid.2 setgid.2
 MLINKS+=shmat.2 shmdt.2
 MLINKS+=shm_open.2 shm_unlink.2
 MLINKS+=sigwaitinfo.2 sigtimedwait.2
-MLINKS+=stat.2 fstat.2 stat.2 fstatat.2 stat.2 lstat.2
+MLINKS+=stat.2 fstat.2 \
+	stat.2 fstatat.2 \
+	stat.2 lstat.2
 MLINKS+=statfs.2 fstatfs.2
 MLINKS+=swapon.2 swapoff.2
 MLINKS+=symlink.2 symlinkat.2
 MLINKS+=syscall.2 __syscall.2
-MLINKS+=timer_settime.2 timer_getoverrun.2 timer_settime.2 timer_gettime.2
+MLINKS+=timer_settime.2 timer_getoverrun.2 \
+	timer_settime.2 timer_gettime.2
 MLINKS+=truncate.2 ftruncate.2
 MLINKS+=unlink.2 unlinkat.2
-MLINKS+=utimes.2 futimes.2 utimes.2 futimesat.2 utimes.2 lutimes.2
-MLINKS+=wait.2 wait3.2 wait.2 wait4.2 wait.2 waitpid.2 \
-	wait.2 waitid.2 wait.2 wait6.2
-MLINKS+=write.2 pwrite.2 write.2 pwritev.2 write.2 writev.2
+MLINKS+=utimensat.2 futimens.2
+MLINKS+=utimes.2 futimes.2 \
+	utimes.2 futimesat.2 \
+	utimes.2 lutimes.2
+MLINKS+=wait.2 wait3.2 \
+	wait.2 wait4.2 \
+	wait.2 waitpid.2 \
+	wait.2 waitid.2 \
+	wait.2 wait6.2
+MLINKS+=write.2 pwrite.2 \
+	write.2 pwritev.2 \
+	write.2 writev.2


Property changes on: trunk/lib/libc/sys/Makefile.inc
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/Symbol.map
===================================================================
--- trunk/lib/libc/sys/Symbol.map	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/Symbol.map	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,5 +1,5 @@
-/*
- * $MidnightBSD$
+/* $MidnightBSD$
+ * $FreeBSD: stable/10/lib/libc/sys/Symbol.map 293474 2016-01-09 14:20:23Z dchagin $
  */
 
 /*
@@ -245,7 +245,6 @@
 	setaudit;
 	setaudit_addr;
 	setauid;
-	setcontext;
 	setegid;
 	seteuid;
 	setgid;
@@ -286,7 +285,6 @@
 	__stack_chk_guard;
 	stat;
 	statfs;
-	swapcontext;
 	swapoff;
 	swapon;
 	symlink;
@@ -351,7 +349,6 @@
 	mkfifoat;
 	mknodat;
 	msgctl;
-	openat;
 	readlinkat;
 	renameat;
 	setfib;
@@ -363,8 +360,6 @@
 FBSD_1.2 {
 	cap_enter;
 	cap_getmode;
-	cap_new;
-	cap_getrights;
 	getloginclass;
 	pdfork;
 	pdgetpid;
@@ -379,10 +374,34 @@
 };
 
 FBSD_1.3 {
+	accept4;
+	aio_mlock;
+	bindat;
+	cap_fcntls_get;
+	cap_fcntls_limit;
+	cap_ioctls_get;
+	cap_ioctls_limit;
+	__cap_rights_get;
+	cap_rights_limit;
+	cap_sandboxed;
+	chflagsat;
+	clock_getcpuclockid2;
+	connectat;
+	ffclock_getcounter;
+	ffclock_getestimate;
+	ffclock_setestimate;
+	pipe2;
 	posix_fadvise;
+	procctl;
 	wait6;
 };
 
+FBSD_1.4 {
+	futimens;
+	ppoll;
+	utimensat;
+};
+
 FBSDprivate_1.0 {
 	___acl_aclcheck_fd;
 	__sys___acl_aclcheck_fd;
@@ -448,6 +467,8 @@
 	__sys_abort2;
 	_accept;
 	__sys_accept;
+	_accept4;
+	__sys_accept4;
 	_access;
 	__sys_access;
 	_acct;
@@ -488,6 +509,8 @@
 	__sys_chown;
 	_chroot;
 	__sys_chroot;
+	_clock_getcpuclockid2;
+	__sys_clock_getcpuclockid2;
 	_clock_getres;
 	__sys_clock_getres;
 	_clock_gettime;
@@ -801,8 +824,12 @@
 	__sys_pipe;
 	_poll;
 	__sys_poll;
+	_ppoll;
+	__sys_ppoll;
 	_preadv;
 	__sys_preadv;
+	_procctl;
+	__sys_procctl;
 	_profil;
 	__sys_profil;
 	_pselect;
@@ -1020,7 +1047,9 @@
 	__sys_write;
 	_writev;
 	__sys_writev;
-	__error_unthreaded;
+	__set_error_selector;
 	nlm_syscall;
 	gssd_syscall;
+	__libc_interposing_slot;
+	__libc_sigwait;
 };


Property changes on: trunk/lib/libc/sys/Symbol.map
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/__error.c
===================================================================
--- trunk/lib/libc/sys/__error.c	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/__error.c	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * Copyright (c) 1997 John Birrell <jb at cimlogic.com.au>.
  * All rights reserved.
@@ -28,18 +29,29 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libc/sys/__error.c 277317 2015-01-18 11:54:20Z kib $");
 
 extern int errno;
 
-/*
- * Declare a weak reference in case the application is not linked
- * with libpthread.
- */
-__weak_reference(__error_unthreaded, __error);
+static int *
+__error_unthreaded(void)
+{
 
+	return (&errno);
+}
+
+static int *(*__error_selector)(void) = __error_unthreaded;
+
+void
+__set_error_selector(int *(*arg)(void))
+{
+
+	__error_selector = arg;
+}
+
 int *
-__error_unthreaded(void)
+__error(void)
 {
-	return(&errno);
+
+	return (__error_selector());
 }

Modified: trunk/lib/libc/sys/__vdso_gettimeofday.c
===================================================================
--- trunk/lib/libc/sys/__vdso_gettimeofday.c	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/__vdso_gettimeofday.c	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2012 Konstantin Belousov <kib at FreeBSD.org>
  *
@@ -24,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libc/sys/__vdso_gettimeofday.c 246117 2013-01-30 12:48:16Z kib $");
 
 #include <sys/elf.h>
 #include <sys/time.h>

Modified: trunk/lib/libc/sys/_exit.2
===================================================================
--- trunk/lib/libc/sys/_exit.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/_exit.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1980, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,9 +27,9 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)_exit.2	8.1 (Berkeley) 6/4/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/_exit.2 307155 2016-10-12 20:19:33Z jilles $
 .\"
-.Dd June 4, 1993
+.Dd September 8, 2016
 .Dt EXIT 2
 .Os
 .Sh NAME
@@ -64,9 +65,11 @@
 .Xr wait 2 .
 .It
 The parent process-ID of all of the calling process's existing child
-processes are set to 1; the initialization process
+processes are set to the process-ID of the calling process's reaper;
+the reaper (normally the initialization process)
 inherits each of these processes
 (see
+.Xr procctl 2 ,
 .Xr init 8
 and the
 .Sx DEFINITIONS


Property changes on: trunk/lib/libc/sys/_exit.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/abort2.2
===================================================================
--- trunk/lib/libc/sys/abort2.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/abort2.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 2005 Wojciech A. Koszek <dunstan at FreeBSD.czest.pl>
 .\" All rights reserved.
 .\"
@@ -22,7 +23,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/abort2.2 162840 2006-09-30 10:24:00Z ru $
 .\"
 .Dd September 30, 2006
 .Dt ABORT2 2


Property changes on: trunk/lib/libc/sys/abort2.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/accept.2
===================================================================
--- trunk/lib/libc/sys/accept.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/accept.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1983, 1990, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,13 +27,14 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)accept.2	8.2 (Berkeley) 12/11/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/accept.2 273340 2014-10-20 18:53:54Z delphij $
 .\"
-.Dd December 11, 1993
+.Dd October 9, 2014
 .Dt ACCEPT 2
 .Os
 .Sh NAME
-.Nm accept
+.Nm accept ,
+.Nm accept4
 .Nd accept a connection on a socket
 .Sh LIBRARY
 .Lb libc
@@ -41,6 +43,8 @@
 .In sys/socket.h
 .Ft int
 .Fn accept "int s" "struct sockaddr * restrict addr" "socklen_t * restrict addrlen"
+.Ft int
+.Fn accept4 "int s" "struct sockaddr * restrict addr" "socklen_t * restrict addrlen" "int flags"
 .Sh DESCRIPTION
 The argument
 .Fa s
@@ -57,9 +61,35 @@
 and allocates a new file descriptor for the socket which
 inherits the state of the
 .Dv O_NONBLOCK
-property from the original socket
+and
+.Dv O_ASYNC
+properties and the destination of
+.Dv SIGIO
+and
+.Dv SIGURG
+signals from the original socket
 .Fa s .
 .Pp
+The
+.Fn accept4
+system call is similar,
+but the
+.Dv O_NONBLOCK
+property of the new socket is instead determined by the
+.Dv SOCK_NONBLOCK
+flag in the
+.Fa flags
+argument,
+the
+.Dv O_ASYNC
+property is cleared,
+the signal destination is cleared
+and the close-on-exec flag on the new file descriptor can be set via the
+.Dv SOCK_CLOEXEC
+flag in the
+.Fa flags
+argument.
+.Pp
 If no pending connections are
 present on the queue, and the original socket
 is not marked as non-blocking,
@@ -127,17 +157,30 @@
 .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
-property being inherited.
+and
+.Dv O_ASYNC
+properties and the signal destination being inherited,
+but should set them explicitly using
+.Xr fcntl 2 ;
+.Fn accept4
+sets these properties consistently,
+but may not be fully portable across
+.Ux
+platforms.
 .Sh RETURN VALUES
-The call returns \-1 on error.
-If it succeeds, it returns a non-negative
+These calls return \-1 on error.
+If they succeed, they return a non-negative
 integer that is a descriptor for the accepted socket.
 .Sh ERRORS
 The
 .Fn accept
-system call will fail if:
+and
+.Fn accept4
+system calls will fail if:
 .Bl -tag -width Er
 .It Bq Er EBADF
 The descriptor is invalid.
@@ -154,16 +197,12 @@
 .It Bq Er EINVAL
 .Xr listen 2
 has not been called on the socket descriptor.
-.It Bq Er EINVAL
-The
-.Fa addrlen
-argument is negative.
 .It Bq Er EFAULT
 The
 .Fa addr
 argument is not in a writable part of the
 user address space.
-.It Bq Er EWOULDBLOCK
+.It Bo Er EWOULDBLOCK Bc or Bq Er EAGAIN
 The socket is marked non-blocking and no connections
 are present to be accepted.
 .It Bq Er ECONNABORTED
@@ -170,6 +209,16 @@
 A connection arrived, but it was closed while waiting
 on the listen queue.
 .El
+.Pp
+The
+.Fn accept4
+system call will also fail if:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+The
+.Fa flags
+argument is invalid.
+.El
 .Sh SEE ALSO
 .Xr bind 2 ,
 .Xr connect 2 ,
@@ -184,3 +233,8 @@
 .Fn accept
 system call appeared in
 .Bx 4.2 .
+.Pp
+The
+.Fn accept4
+system call appeared in
+.Fx 10.0 .


Property changes on: trunk/lib/libc/sys/accept.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: trunk/lib/libc/sys/accept.c
===================================================================
--- trunk/lib/libc/sys/accept.c	                        (rev 0)
+++ trunk/lib/libc/sys/accept.c	2018-06-07 12:22:26 UTC (rev 10509)
@@ -0,0 +1,51 @@
+/* $MidnightBSD$ */
+/*
+ * Copyright (c) 2014 The FreeBSD Foundation.
+ * All rights reserved.
+ *
+ * Portions of this software were developed by Konstantin Belousov
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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(s), this list of conditions and the following disclaimer as
+ *    the first lines of this file unmodified other than the possible
+ *    addition of one or more copyright notices.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice(s), 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 COPYRIGHT HOLDER(S) ``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 COPYRIGHT HOLDER(S) 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/cdefs.h>
+__FBSDID("$FreeBSD: stable/10/lib/libc/sys/accept.c 277317 2015-01-18 11:54:20Z kib $");
+
+#include <sys/types.h>
+#include <sys/syscall.h>
+#include <sys/socket.h>
+#include "libc_private.h"
+
+__weak_reference(__sys_accept, __accept);
+
+#pragma weak accept
+int
+accept(int s, struct sockaddr *addr, socklen_t *addrlen)
+{
+
+	return (((int (*)(int, struct sockaddr *, socklen_t *))
+	    __libc_interposing[INTERPOS_accept])(s, addr, addrlen));
+}


Property changes on: trunk/lib/libc/sys/accept.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/lib/libc/sys/accept4.c
===================================================================
--- trunk/lib/libc/sys/accept4.c	                        (rev 0)
+++ trunk/lib/libc/sys/accept4.c	2018-06-07 12:22:26 UTC (rev 10509)
@@ -0,0 +1,51 @@
+/* $MidnightBSD$ */
+/*
+ * Copyright (c) 2014 The FreeBSD Foundation.
+ * All rights reserved.
+ *
+ * Portions of this software were developed by Konstantin Belousov
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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(s), this list of conditions and the following disclaimer as
+ *    the first lines of this file unmodified other than the possible
+ *    addition of one or more copyright notices.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice(s), 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 COPYRIGHT HOLDER(S) ``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 COPYRIGHT HOLDER(S) 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/cdefs.h>
+__FBSDID("$FreeBSD: stable/10/lib/libc/sys/accept4.c 277317 2015-01-18 11:54:20Z kib $");
+
+#include <sys/types.h>
+#include <sys/syscall.h>
+#include <sys/socket.h>
+#include "libc_private.h"
+
+__weak_reference(__sys_accept4, __accept4);
+
+#pragma weak accept4
+int
+accept4(int s, struct sockaddr *addr, socklen_t *addrlen, int flags)
+{
+
+	return (((int (*)(int, struct sockaddr *, socklen_t *, int))
+	    __libc_interposing[INTERPOS_accept4])(s, addr, addrlen, flags));
+}


Property changes on: trunk/lib/libc/sys/accept4.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: trunk/lib/libc/sys/access.2
===================================================================
--- trunk/lib/libc/sys/access.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/access.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1980, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,7 +27,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)access.2	8.2 (Berkeley) 4/1/94
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/access.2 208027 2010-05-13 12:07:55Z uqs $
 .\"
 .Dd April 10, 2008
 .Dt ACCESS 2


Property changes on: trunk/lib/libc/sys/access.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/acct.2
===================================================================
--- trunk/lib/libc/sys/acct.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/acct.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1980, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,7 +27,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)acct.2	8.1 (Berkeley) 6/4/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/acct.2 165903 2007-01-09 00:28:16Z imp $
 .\"
 .Dd April 17, 2004
 .Dt ACCT 2


Property changes on: trunk/lib/libc/sys/acct.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/adjtime.2
===================================================================
--- trunk/lib/libc/sys/adjtime.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/adjtime.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1980, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,7 +27,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)adjtime.2	8.1 (Berkeley) 6/4/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/adjtime.2 165903 2007-01-09 00:28:16Z imp $
 .\"
 .Dd June 4, 1993
 .Dt ADJTIME 2


Property changes on: trunk/lib/libc/sys/adjtime.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/aio_cancel.2
===================================================================
--- trunk/lib/libc/sys/aio_cancel.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/aio_cancel.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1999 Softweyr LLC.
 .\" All rights reserved.
 .\"
@@ -22,7 +23,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/aio_cancel.2 177870 2008-04-03 02:41:54Z kevlo $
 .\"
 .Dd January 19, 2000
 .Dt AIO_CANCEL 2


Property changes on: trunk/lib/libc/sys/aio_cancel.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/aio_error.2
===================================================================
--- trunk/lib/libc/sys/aio_error.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/aio_error.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1999 Softweyr LLC.
 .\" All rights reserved.
 .\"
@@ -22,7 +23,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/aio_error.2 162657 2006-09-26 09:47:46Z vd $
 .\"
 .Dd June 2, 1999
 .Dt AIO_ERROR 2


Property changes on: trunk/lib/libc/sys/aio_error.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: trunk/lib/libc/sys/aio_fsync.2
===================================================================
--- trunk/lib/libc/sys/aio_fsync.2	                        (rev 0)
+++ trunk/lib/libc/sys/aio_fsync.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -0,0 +1,179 @@
+.\" $MidnightBSD$
+.\" Copyright (c) 2013 Sergey Kandaurov
+.\" 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: stable/10/lib/libc/sys/aio_fsync.2 304617 2016-08-22 17:52:10Z jhb $
+.\"
+.Dd August 19, 2016
+.Dt AIO_FSYNC 2
+.Os
+.Sh NAME
+.Nm aio_fsync
+.Nd asynchronous file synchronization (REALTIME)
+.Sh LIBRARY
+.Lb libc
+.Sh SYNOPSIS
+.In aio.h
+.Ft int
+.Fn aio_fsync "int op" "struct aiocb *iocb"
+.Sh DESCRIPTION
+The
+.Fn aio_fsync
+system call allows the calling process to move all modified data
+associated with the descriptor
+.Fa iocb->aio_fildes
+to a permanent storage device.
+The call returns immediately after the synchronization request has been
+enqueued to the descriptor; the synchronization may or may not have
+completed at the time the call returns.
+.Pp
+The
+.Fa op
+argument can only be set to
+.Dv O_SYNC
+to cause all currently queued I/O operations to be completed
+as if by a call to
+.Xr fsync 2 .
+.Pp
+If _POSIX_PRIORITIZED_IO is defined, and the descriptor supports it,
+then the enqueued operation is submitted at a priority equal to that
+of the calling process minus
+.Fa iocb->aio_reqprio .
+.Pp
+The
+.Fa iocb
+pointer may be subsequently used as an argument to
+.Fn aio_return
+and
+.Fn aio_error
+in order to determine return or error status for the enqueued operation
+while it is in progress.
+.Pp
+If the request could not be enqueued (generally due to invalid arguments),
+the call returns without having enqueued the request.
+.Pp
+The
+.Fa iocb->aio_sigevent
+structure can be used to request notification of the operation's
+completion as described in
+.Xr aio 4 .
+.Sh RESTRICTIONS
+The Asynchronous I/O Control Block structure pointed to by
+.Fa iocb
+must remain valid until the
+operation has completed.
+.Pp
+The asynchronous I/O control buffer
+.Fa iocb
+should be zeroed before the
+.Fn aio_fsync
+call to avoid passing bogus context information to the kernel.
+.Pp
+Modification of the Asynchronous I/O Control Block structure is not allowed
+while the request is queued.
+.Sh RETURN VALUES
+.Rv -std aio_fsync
+.Sh ERRORS
+The
+.Fn aio_fsync
+system call will fail if:
+.Bl -tag -width Er
+.It Bq Er EAGAIN
+The request was not queued because of system resource limitations.
+.It Bq Er EINVAL
+The asynchronous notification method in
+.Fa iocb->aio_sigevent.sigev_notify
+is invalid or not supported.
+.It Bq Er ENOSYS
+The
+.Fn aio_fsync
+system call is not supported.
+.It Bq Er EINVAL
+A value of the
+.Fa op
+argument is not set to
+.Dv O_SYNC .
+.El
+.Pp
+The following conditions may be synchronously detected when the
+.Fn aio_fsync
+system call is made, or asynchronously, at any time thereafter.
+If they are detected at call time,
+.Fn aio_fsync
+returns -1 and sets
+.Va errno
+appropriately; otherwise the
+.Fn aio_return
+system call must be called, and will return -1, and
+.Fn aio_error
+must be called to determine the actual value that would have been
+returned in
+.Va errno .
+.Bl -tag -width Er
+.It Bq Er EBADF
+The
+.Fa iocb->aio_fildes
+argument
+is not a valid descriptor.
+.It Bq Er EINVAL
+This implementation does not support synchronized I/O for this file.
+.El
+.Pp
+If the request is successfully enqueued, but subsequently cancelled
+or an error occurs, the value returned by the
+.Fn aio_return
+system call is per the
+.Xr read 2
+and
+.Xr write 2
+system calls, and the value returned by the
+.Fn aio_error
+system call is one of the error returns from the
+.Xr read 2
+or
+.Xr write 2
+system calls.
+.Sh SEE ALSO
+.Xr aio_cancel 2 ,
+.Xr aio_error 2 ,
+.Xr aio_read 2 ,
+.Xr aio_return 2 ,
+.Xr aio_suspend 2 ,
+.Xr aio_waitcomplete 2 ,
+.Xr aio_write 2 ,
+.Xr fsync 2 ,
+.Xr sigevent 3 ,
+.Xr siginfo 3 ,
+.Xr aio 4
+.Sh STANDARDS
+The
+.Fn aio_fsync
+system call is expected to conform to the
+.St -p1003.1
+standard.
+.Sh HISTORY
+The
+.Fn aio_fsync
+system call first appeared in
+.Fx 7.0 .


Property changes on: trunk/lib/libc/sys/aio_fsync.2
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/lib/libc/sys/aio_mlock.2
===================================================================
--- trunk/lib/libc/sys/aio_mlock.2	                        (rev 0)
+++ trunk/lib/libc/sys/aio_mlock.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -0,0 +1,143 @@
+.\" $MidnightBSD$
+.\" Copyright (c) 2013 Gleb Smirnoff <glebius at 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: stable/10/lib/libc/sys/aio_mlock.2 304617 2016-08-22 17:52:10Z jhb $
+.\"
+.Dd August 19, 2016
+.Dt AIO_MLOCK 2
+.Os
+.Sh NAME
+.Nm aio_mlock
+.Nd asynchronous
+.Xr mlock 2
+operation
+.Sh LIBRARY
+.Lb libc
+.Sh SYNOPSIS
+.In aio.h
+.Ft int
+.Fn aio_mlock "struct aiocb *iocb"
+.Sh DESCRIPTION
+The
+.Fn aio_mlock
+system call allows the calling process to lock into memory the
+physical pages associated with the virtual address range starting at
+.Fa iocb->aio_buf
+for
+.Fa iocb->aio_nbytes
+bytes.
+The call returns immediately after the locking request has
+been enqueued; the operation may or may not have completed at the time
+the call returns.
+.Pp
+The
+.Fa iocb
+pointer may be subsequently used as an argument to
+.Fn aio_return
+and
+.Fn aio_error
+in order to determine return or error status for the enqueued operation
+while it is in progress.
+.Pp
+If the request could not be enqueued (generally due to
+.Xr aio 4
+limits),
+then the call returns without having enqueued the request.
+.Pp
+The
+.Fa iocb->aio_sigevent
+structure can be used to request notification of the operation's
+completion as described in
+.Xr aio 4 .
+.Sh RESTRICTIONS
+The Asynchronous I/O Control Block structure pointed to by
+.Fa iocb
+and the buffer that the
+.Fa iocb->aio_buf
+member of that structure references must remain valid until the
+operation has completed.
+.Pp
+The asynchronous I/O control buffer
+.Fa iocb
+should be zeroed before the
+.Fn aio_mlock
+call to avoid passing bogus context information to the kernel.
+.Pp
+Modifications of the Asynchronous I/O Control Block structure or the
+memory mapping described by the virtual address range are not allowed
+while the request is queued.
+.Sh RETURN VALUES
+.Rv -std aio_mlock
+.Sh ERRORS
+The
+.Fn aio_mlock
+system call will fail if:
+.Bl -tag -width Er
+.It Bq Er EAGAIN
+The request was not queued because of system resource limitations.
+.It Bq Er EINVAL
+The asynchronous notification method in
+.Fa iocb->aio_sigevent.sigev_notify
+is invalid or not supported.
+.It Bq Er ENOSYS
+The
+.Fn aio_mlock
+system call is not supported.
+.El
+.Pp
+If the request is successfully enqueued, but subsequently cancelled
+or an error occurs, the value returned by the
+.Fn aio_return
+system call is per the
+.Xr mlock 2
+system call, and the value returned by the
+.Fn aio_error
+system call is one of the error returns from the
+.Xr mlock 2
+system call, or
+.Er ECANCELED
+if the request was explicitly cancelled via a call to
+.Fn aio_cancel .
+.Sh SEE ALSO
+.Xr aio_cancel 2 ,
+.Xr aio_error 2 ,
+.Xr aio_return 2 ,
+.Xr mlock 2 ,
+.Xr sigevent 3 ,
+.Xr aio 4
+.Sh PORTABILITY
+The
+.Fn aio_mlock
+system call is a
+.Fx
+extension, and should not be used in portable code.
+.Sh HISTORY
+The
+.Fn aio_mlock
+system call first appeared in
+.Fx 10.0 .
+.Sh AUTHORS
+The system call was introduced by
+.An Gleb Smirnoff Aq glebius at FreeBSD.org .


Property changes on: trunk/lib/libc/sys/aio_mlock.2
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: trunk/lib/libc/sys/aio_read.2
===================================================================
--- trunk/lib/libc/sys/aio_read.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/aio_read.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1998 Terry Lambert
 .\" All rights reserved.
 .\"
@@ -22,9 +23,9 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/aio_read.2 304617 2016-08-22 17:52:10Z jhb $
 .\"
-.Dd November 17, 1998
+.Dd August 19, 2016
 .Dt AIO_READ 2
 .Os
 .Sh NAME
@@ -79,6 +80,12 @@
 .Fa iocb->aio_offset
 can be modified during the request as context, so this value must
 not be referenced after the request is enqueued.
+.Pp
+The
+.Fa iocb->aio_sigevent
+structure can be used to request notification of the operation's
+completion as described in
+.Xr aio 4 .
 .Sh RESTRICTIONS
 The Asynchronous I/O Control Block structure pointed to by
 .Fa iocb
@@ -86,8 +93,6 @@
 .Fa iocb->aio_buf
 member of that structure references must remain valid until the
 operation has completed.
-For this reason, use of auto (stack) variables
-for these objects is discouraged.
 .Pp
 The asynchronous I/O control buffer
 .Fa iocb
@@ -96,8 +101,7 @@
 call to avoid passing bogus context information to the kernel.
 .Pp
 Modifications of the Asynchronous I/O Control Block structure or the
-buffer contents after the request has been enqueued, but before the
-request has completed, are not allowed.
+buffer contents are not allowed while the request is queued.
 .Pp
 If the file offset in
 .Fa iocb->aio_offset
@@ -115,6 +119,10 @@
 .Bl -tag -width Er
 .It Bq Er EAGAIN
 The request was not queued because of system resource limitations.
+.It Bq Er EINVAL
+The asynchronous notification method in
+.Fa iocb->aio_sigevent.sigev_notify
+is invalid or not supported.
 .It Bq Er ENOSYS
 The
 .Fn aio_read
@@ -191,6 +199,7 @@
 .Xr aio_suspend 2 ,
 .Xr aio_waitcomplete 2 ,
 .Xr aio_write 2 ,
+.Xr sigevent 3 ,
 .Xr siginfo 3 ,
 .Xr aio 4
 .Sh STANDARDS


Property changes on: trunk/lib/libc/sys/aio_read.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/aio_return.2
===================================================================
--- trunk/lib/libc/sys/aio_return.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/aio_return.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1999 Softweyr LLC.
 .\" All rights reserved.
 .\"
@@ -22,7 +23,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/aio_return.2 163073 2006-10-07 10:49:20Z trhodes $
 .\"
 .Dd October 7, 2006
 .Dt AIO_RETURN 2


Property changes on: trunk/lib/libc/sys/aio_return.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/aio_suspend.2
===================================================================
--- trunk/lib/libc/sys/aio_suspend.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/aio_suspend.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1999 Softweyr LLC.
 .\" All rights reserved.
 .\"
@@ -22,7 +23,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/aio_suspend.2 177870 2008-04-03 02:41:54Z kevlo $
 .\"
 .Dd June 2, 1999
 .Dt AIO_SUSPEND 2


Property changes on: trunk/lib/libc/sys/aio_suspend.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: trunk/lib/libc/sys/aio_suspend.c
===================================================================
--- trunk/lib/libc/sys/aio_suspend.c	                        (rev 0)
+++ trunk/lib/libc/sys/aio_suspend.c	2018-06-07 12:22:26 UTC (rev 10509)
@@ -0,0 +1,52 @@
+/* $MidnightBSD$ */
+/*
+ * Copyright (c) 2014 The FreeBSD Foundation.
+ * All rights reserved.
+ *
+ * Portions of this software were developed by Konstantin Belousov
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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(s), this list of conditions and the following disclaimer as
+ *    the first lines of this file unmodified other than the possible
+ *    addition of one or more copyright notices.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice(s), 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 COPYRIGHT HOLDER(S) ``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 COPYRIGHT HOLDER(S) 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/cdefs.h>
+__FBSDID("$FreeBSD: stable/10/lib/libc/sys/aio_suspend.c 277317 2015-01-18 11:54:20Z kib $");
+
+#include <sys/types.h>
+#include <sys/aio.h>
+#include "libc_private.h"
+
+__weak_reference(__sys_aio_suspend, __aio_suspend);
+
+#pragma weak aio_suspend
+int
+aio_suspend(const struct aiocb * const iocbs[], int niocb,
+    const struct timespec *timeout)
+{
+
+	return (((int (*)(const struct aiocb * const[], int,
+	    const struct timespec *))
+	    __libc_interposing[INTERPOS_aio_suspend])(iocbs, niocb, timeout));
+}


Property changes on: trunk/lib/libc/sys/aio_suspend.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: trunk/lib/libc/sys/aio_waitcomplete.2
===================================================================
--- trunk/lib/libc/sys/aio_waitcomplete.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/aio_waitcomplete.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1999 Christopher M Sedore.
 .\" All rights reserved.
 .\"
@@ -22,7 +23,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/aio_waitcomplete.2 108028 2002-12-18 09:22:32Z ru $
 .\"
 .Dd January 19, 2000
 .Dt AIO_WAITCOMPLETE 2


Property changes on: trunk/lib/libc/sys/aio_waitcomplete.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/aio_write.2
===================================================================
--- trunk/lib/libc/sys/aio_write.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/aio_write.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1999 Softweyr LLC.
 .\" All rights reserved.
 .\"
@@ -22,9 +23,9 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/aio_write.2 304617 2016-08-22 17:52:10Z jhb $
 .\"
-.Dd June 2, 1999
+.Dd August 19, 2016
 .Dt AIO_WRITE 2
 .Os
 .Sh NAME
@@ -85,6 +86,12 @@
 .Fa iocb->aio_offset
 can be modified during the request as context, so this value must not
 be referenced after the request is enqueued.
+.Pp
+The
+.Fa iocb->aio_sigevent
+structure can be used to request notification of the operation's
+completion as described in
+.Xr aio 4 .
 .Sh RESTRICTIONS
 The Asynchronous I/O Control Block structure pointed to by
 .Fa iocb
@@ -92,8 +99,6 @@
 .Fa iocb->aio_buf
 member of that structure references must remain valid until the
 operation has completed.
-For this reason, use of auto (stack) variables
-for these objects is discouraged.
 .Pp
 The asynchronous I/O control buffer
 .Fa iocb
@@ -102,8 +107,7 @@
 system call to avoid passing bogus context information to the kernel.
 .Pp
 Modifications of the Asynchronous I/O Control Block structure or the
-buffer contents after the request has been enqueued, but before the
-request has completed, are not allowed.
+buffer contents are not allowed while the request is queued.
 .Pp
 If the file offset in
 .Fa iocb->aio_offset
@@ -119,6 +123,10 @@
 .Bl -tag -width Er
 .It Bq Er EAGAIN
 The request was not queued because of system resource limitations.
+.It Bq Er EINVAL
+The asynchronous notification method in
+.Fa iocb->aio_sigevent.sigev_notify
+is invalid or not supported.
 .It Bq Er ENOSYS
 The
 .Fn aio_write
@@ -186,6 +194,7 @@
 .Xr aio_return 2 ,
 .Xr aio_suspend 2 ,
 .Xr aio_waitcomplete 2 ,
+.Xr sigevent 3 ,
 .Xr siginfo 3 ,
 .Xr aio 4
 .Sh STANDARDS


Property changes on: trunk/lib/libc/sys/aio_write.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/bind.2
===================================================================
--- trunk/lib/libc/sys/bind.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/bind.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1983, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,9 +27,9 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)bind.2	8.1 (Berkeley) 6/4/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/bind.2 268223 2014-07-03 17:35:01Z pluknet $
 .\"
-.Dd June 4, 1993
+.Dd June 26, 2014
 .Dt BIND 2
 .Os
 .Sh NAME
@@ -85,6 +86,10 @@
 .It Bq Er EINVAL
 The socket is already bound to an address, and the protocol does not support
 binding to a new address; or the socket has been shut down.
+.It Bq Er EINVAL
+The
+.Fa addrlen
+argument is not a valid length for the address family.
 .It Bq Er ENOTSOCK
 The
 .Fa s
@@ -94,6 +99,8 @@
 The specified address is not available from the local machine.
 .It Bq Er EADDRINUSE
 The specified address is already in use.
+.It Bq Er EAFNOSUPPORT
+Addresses in the specified address family cannot be used with this socket.
 .It Bq Er EACCES
 The requested address is protected, and the current user
 has inadequate permission to access it.


Property changes on: trunk/lib/libc/sys/bind.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: trunk/lib/libc/sys/bindat.2
===================================================================
--- trunk/lib/libc/sys/bindat.2	                        (rev 0)
+++ trunk/lib/libc/sys/bindat.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -0,0 +1,110 @@
+.\" $MidnightBSD$
+.\" Copyright (c) 2013 The FreeBSD Foundation
+.\" All rights reserved.
+.\"
+.\" This documentation was written by Pawel Jakub Dawidek under sponsorship from
+.\" the FreeBSD Foundation.
+.\"
+.\" 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 AUTHORS 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 AUTHORS 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: stable/10/lib/libc/sys/bindat.2 247667 2013-03-02 21:11:30Z pjd $
+.\"
+.Dd February 13, 2013
+.Dt BINDAT 2
+.Os
+.Sh NAME
+.Nm bindat
+.Nd assign a local protocol address to a socket
+.Sh LIBRARY
+.Lb libc
+.Sh SYNOPSIS
+.In sys/types.h
+.In sys/socket.h
+.Pp
+.In fcntl.h
+.Ft int
+.Fn bindat "int fd" "int s" "const struct sockaddr *addr" "socklen_t addrlen"
+.Sh DESCRIPTION
+The
+.Fn bindat
+system call assigns the local protocol address to a socket.
+It works just like the
+.Xr bind 2
+system call with two exceptions:
+.Pp
+.Bl -enum -offset indent -compact
+.It
+It is limited to sockets in the PF_LOCAL domain.
+.Pp
+.It
+If the file path stored in the
+.Fa sun_path
+field of the sockaddr_un structure is a relative path, it is located relative
+to the directory associated with the file descriptor
+.Fa fd .
+If
+.Fn bindat
+is passed the special value
+.Dv AT_FDCWD
+in the
+.Fa fd
+parameter, the current working directory is used and the behavior is identical
+to a call to
+.Xr bind 2 .
+.El
+.Sh RETURN VALUES
+.Rv -std bindat
+.Sh ERRORS
+The
+.Fn bindat
+system call may fail with the same errors as the
+.Xr bind 2
+system call for a UNIX domain socket or with the following errors:
+.Bl -tag -width Er
+.It Bq Er EBADF
+The
+.Fa sun_path
+field does not specify an absolute path and the
+.Fa fd
+argument is neither
+.Dv AT_FDCWD
+nor a valid file descriptor.
+.It Bq Er ENOTDIR
+The
+.Fa sun_path
+field is not an absolute path and
+.Fa fd
+is neither
+.Dv AT_FDCWD
+nor a file descriptor associated with a directory.
+.El
+.Sh SEE ALSO
+.Xr bind 2 ,
+.Xr connectat 2 ,
+.Xr socket 2 ,
+.Xr unix 4
+.Sh AUTHORS
+The
+.Nm
+was developed by
+.An Pawel Jakub Dawidek Aq pawel at dawidek.net
+under sponsorship from the FreeBSD Foundation.


Property changes on: trunk/lib/libc/sys/bindat.2
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: trunk/lib/libc/sys/brk.2
===================================================================
--- trunk/lib/libc/sys/brk.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/brk.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1980, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,7 +27,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)brk.2	8.4 (Berkeley) 5/1/95
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/brk.2 165903 2007-01-09 00:28:16Z imp $
 .\"
 .Dd July 12, 1999
 .Dt BRK 2


Property changes on: trunk/lib/libc/sys/brk.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/cap_enter.2
===================================================================
--- trunk/lib/libc/sys/cap_enter.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/cap_enter.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\"
 .\" Copyright (c) 2008-2009 Robert N. M. Watson
 .\" All rights reserved.
@@ -26,9 +27,9 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/cap_enter.2 280247 2015-03-19 11:24:07Z rwatson $
 .\"
-.Dd February 25, 2012
+.Dd March 27, 2014
 .Dt CAP_ENTER 2
 .Os
 .Sh NAME
@@ -38,7 +39,7 @@
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
-.In sys/capability.h
+.In sys/capsicum.h
 .Ft int
 .Fn cap_enter "void"
 .Ft int
@@ -52,14 +53,16 @@
 prevented.
 If the process is already in a capability mode sandbox, the system call is a
 no-op.
-Future process descendants create with
+Future process descendants created with
 .Xr fork 2
 or
 .Xr pdfork 2
 will be placed in capability mode from inception.
 .Pp
-When combined with capabilities created with
-.Xr cap_new 2 ,
+When combined with
+.Xr cap_rights_limit 2 ,
+.Xr cap_ioctls_limit 2 ,
+.Xr cap_fcntls_limit 2 ,
 .Fn cap_enter
 may be used to create kernel-enforced sandboxes in which
 appropriately-crafted applications or application components may be run.
@@ -71,11 +74,6 @@
 Creating effective process sandboxes is a tricky process that involves
 identifying the least possible rights required by the process and then
 passing those rights into the process in a safe manner.
-See the CAVEAT
-section of
-.Xr cap_new 2
-for why this is particularly tricky with UNIX file descriptors as the
-canonical representation of a right.
 Consumers of
 .Fn cap_enter
 should also be aware of other inherited rights, such as access to VM
@@ -87,9 +85,35 @@
 acquired rights as possible.
 .Sh RETURN VALUES
 .Rv -std cap_enter cap_getmode
+.Sh ERRORS
+The
+.Fn cap_enter
+and
+.Fn cap_getmode
+system calls
+will fail if:
+.Bl -tag -width Er
+.It Bq Er ENOSYS
+The kernel is compiled without:
+.Pp
+.Cd "options CAPABILITY_MODE"
+.El
+.Pp
+The
+.Fn cap_getmode
+system call may also return the following error:
+.Bl -tag -width Er
+.It Bq Er EFAULT
+Pointer
+.Fa modep
+points outside the process's allocated address space.
+.El
 .Sh SEE ALSO
-.Xr cap_new 2 ,
+.Xr cap_fcntls_limit 2 ,
+.Xr cap_ioctls_limit 2 ,
+.Xr cap_rights_limit 2 ,
 .Xr fexecve 2 ,
+.Xr cap_sandboxed 3 ,
 .Xr capsicum 4
 .Sh HISTORY
 Support for capabilities and capabilities mode was developed as part of the


Property changes on: trunk/lib/libc/sys/cap_enter.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: trunk/lib/libc/sys/cap_fcntls_limit.2
===================================================================
--- trunk/lib/libc/sys/cap_fcntls_limit.2	                        (rev 0)
+++ trunk/lib/libc/sys/cap_fcntls_limit.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -0,0 +1,127 @@
+.\" $MidnightBSD$
+.\"
+.\" Copyright (c) 2012 The FreeBSD Foundation
+.\" All rights reserved.
+.\"
+.\" This documentation was written by Pawel Jakub Dawidek under sponsorship
+.\" the FreeBSD Foundation.
+.\"
+.\" 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: stable/10/lib/libc/sys/cap_fcntls_limit.2 280247 2015-03-19 11:24:07Z rwatson $
+.\"
+.Dd March 27, 2014
+.Dt CAP_FCNTLS_LIMIT 2
+.Os
+.Sh NAME
+.Nm cap_fcntls_limit ,
+.Nm cap_fcntls_get
+.Nd manage allowed fcntl commands
+.Sh LIBRARY
+.Lb libc
+.Sh SYNOPSIS
+.In sys/capsicum.h
+.Ft int
+.Fn cap_fcntls_limit "int fd" "uint32_t fcntlrights"
+.Ft int
+.Fn cap_fcntls_get "int fd" "uint32_t *fcntlrightsp"
+.Sh DESCRIPTION
+If a file descriptor is granted the
+.Dv CAP_FCNTL
+capability right, the list of allowed
+.Xr fcntl 2
+commands can be selectively reduced (but never expanded) with the
+.Fn cap_fcntls_limit
+system call.
+.Pp
+A bitmask of allowed fcntls commands for a given file descriptor can be obtained
+with the
+.Fn cap_fcntls_get
+system call.
+.Sh FLAGS
+The following flags may be specified in the
+.Fa fcntlrights
+argument or returned in the
+.Fa fcntlrightsp
+argument:
+.Bl -tag -width CAP_FCNTL_GETOWN
+.It Dv CAP_FCNTL_GETFL
+Permit
+.Dv F_GETFL
+command.
+.It Dv CAP_FCNTL_SETFL
+Permit
+.Dv F_SETFL
+command.
+.It Dv CAP_FCNTL_GETOWN
+Permit
+.Dv F_GETOWN
+command.
+.It Dv CAP_FCNTL_SETOWN
+Permit
+.Dv F_SETOWN
+command.
+.El
+.Sh RETURN VALUES
+.Rv -std
+.Sh ERRORS
+.Fn cap_fcntls_limit
+succeeds unless:
+.Bl -tag -width Er
+.It Bq Er EBADF
+The
+.Fa fd
+argument is not a valid descriptor.
+.It Bq Er EINVAL
+An invalid flag has been passed in
+.Fa fcntlrights .
+.It Bq Er ENOTCAPABLE
+.Fa fcntlrights
+would expand the list of allowed
+.Xr fcntl 2
+commands.
+.El
+.Pp
+.Fn cap_fcntls_get
+succeeds unless:
+.Bl -tag -width Er
+.It Bq Er EBADF
+The
+.Fa fd
+argument is not a valid descriptor.
+.It Bq Er EFAULT
+The
+.Fa fcntlrightsp
+argument points at an invalid address.
+.El
+.Sh SEE ALSO
+.Xr cap_ioctls_limit 2 ,
+.Xr cap_rights_limit 2 ,
+.Xr fcntl 2
+.Sh HISTORY
+Support for capabilities and capabilities mode was developed as part of the
+.Tn TrustedBSD
+Project.
+.Sh AUTHORS
+This function was created by
+.An Pawel Jakub Dawidek Aq pawel at dawidek.net
+under sponsorship of the FreeBSD Foundation.


Property changes on: trunk/lib/libc/sys/cap_fcntls_limit.2
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/lib/libc/sys/cap_ioctls_limit.2
===================================================================
--- trunk/lib/libc/sys/cap_ioctls_limit.2	                        (rev 0)
+++ trunk/lib/libc/sys/cap_ioctls_limit.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -0,0 +1,158 @@
+.\" $MidnightBSD$
+.\"
+.\" Copyright (c) 2012 The FreeBSD Foundation
+.\" All rights reserved.
+.\"
+.\" This documentation was written by Pawel Jakub Dawidek under sponsorship
+.\" the FreeBSD Foundation.
+.\"
+.\" 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: stable/10/lib/libc/sys/cap_ioctls_limit.2 280247 2015-03-19 11:24:07Z rwatson $
+.\"
+.Dd March 27, 2014
+.Dt CAP_IOCTLS_LIMIT 2
+.Os
+.Sh NAME
+.Nm cap_ioctls_limit ,
+.Nm cap_ioctls_get
+.Nd manage allowed ioctl commands
+.Sh LIBRARY
+.Lb libc
+.Sh SYNOPSIS
+.In sys/capsicum.h
+.Ft int
+.Fn cap_ioctls_limit "int fd" "const unsigned long *cmds" "size_t ncmds"
+.Ft ssize_t
+.Fn cap_ioctls_get "int fd" "unsigned long *cmds" "size_t maxcmds"
+.Sh DESCRIPTION
+If a file descriptor is granted the
+.Dv CAP_IOCTL
+capability right, the list of allowed
+.Xr ioctl 2
+commands can be selectively reduced (but never expanded) with the
+.Fn cap_ioctls_limit
+system call.
+The
+.Fa cmds
+argument is an array of
+.Xr ioctl 2
+commands and the
+.Fa ncmds
+argument specifies the number of elements in the array.
+There can be up to
+.Va 256
+elements in the array.
+.Pp
+The list of allowed ioctl commands for a given file descriptor can be obtained
+with the
+.Fn cap_ioctls_get
+system call.
+The
+.Fa cmds
+argument points at memory that can hold up to
+.Fa maxcmds
+values.
+The function populates the provided buffer with up to
+.Fa maxcmds
+elements, but always returns the total number of ioctl commands allowed for the
+given file descriptor.
+The total number of ioctls commands for the given file descriptor can be
+obtained by passing
+.Dv NULL as the
+.Fa cmds
+argument and
+.Va 0
+as the
+.Fa maxcmds
+argument.
+If all ioctl commands are allowed
+.Dv ( CAP_IOCTL
+capability right is assigned to the file descriptor and the
+.Fn cap_ioctls_limit
+system call was never called for this file descriptor), the
+.Fn cap_ioctls_get
+system call will return
+.Dv CAP_IOCTLS_ALL
+and won't modify the buffer pointed to by the
+.Fa cmds
+argument.
+.Sh RETURN VALUES
+.Rv -std cap_ioctls_limit
+.Pp
+The
+.Fn cap_ioctls_get
+function, if successful, returns the total number of allowed ioctl commands or
+the value
+.Dv CAP_IOCTLS_ALL
+if all ioctls commands are allowed.
+On failure the value
+.Va -1
+is returned and the global variable errno is set to indicate the error.
+.Sh ERRORS
+.Fn cap_ioctls_limit
+succeeds unless:
+.Bl -tag -width Er
+.It Bq Er EBADF
+The
+.Fa fd
+argument is not a valid descriptor.
+.It Bq Er EFAULT
+The
+.Fa cmds
+argument points at an invalid address.
+.It Bq Er EINVAL
+The
+.Fa ncmds
+argument is greater than
+.Va 256 .
+.It Bq Er ENOTCAPABLE
+.Fa cmds
+would expand the list of allowed
+.Xr ioctl 2
+commands.
+.El
+.Pp
+.Fn cap_ioctls_get
+succeeds unless:
+.Bl -tag -width Er
+.It Bq Er EBADF
+The
+.Fa fd
+argument is not a valid descriptor.
+.It Bq Er EFAULT
+The
+.Fa cmds
+argument points at invalid address.
+.El
+.Sh SEE ALSO
+.Xr cap_fcntls_limit 2 ,
+.Xr cap_rights_limit 2 ,
+.Xr ioctl 2
+.Sh HISTORY
+Support for capabilities and capabilities mode was developed as part of the
+.Tn TrustedBSD
+Project.
+.Sh AUTHORS
+This function was created by
+.An Pawel Jakub Dawidek Aq pawel at dawidek.net
+under sponsorship of the FreeBSD Foundation.


Property changes on: trunk/lib/libc/sys/cap_ioctls_limit.2
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: trunk/lib/libc/sys/cap_new.2
===================================================================
--- trunk/lib/libc/sys/cap_new.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/cap_new.2	2018-06-07 12:22:26 UTC (rev 10509)

Property changes on: trunk/lib/libc/sys/cap_new.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: trunk/lib/libc/sys/cap_rights_limit.2
===================================================================
--- trunk/lib/libc/sys/cap_rights_limit.2	                        (rev 0)
+++ trunk/lib/libc/sys/cap_rights_limit.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -0,0 +1,158 @@
+.\" $MidnightBSD$
+.\"
+.\" Copyright (c) 2008-2010 Robert N. M. Watson
+.\" Copyright (c) 2012-2013 The FreeBSD Foundation
+.\" All rights reserved.
+.\"
+.\" This software was developed at the University of Cambridge Computer
+.\" Laboratory with support from a grant from Google, Inc.
+.\"
+.\" Portions of this documentation were written by Pawel Jakub Dawidek
+.\" under sponsorship from the FreeBSD Foundation.
+.\"
+.\" 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: stable/10/lib/libc/sys/cap_rights_limit.2 280247 2015-03-19 11:24:07Z rwatson $
+.\"
+.Dd March 27, 2014
+.Dt CAP_RIGHTS_LIMIT 2
+.Os
+.Sh NAME
+.Nm cap_rights_limit
+.Nd limit capability rights
+.Sh LIBRARY
+.Lb libc
+.Sh SYNOPSIS
+.In sys/capsicum.h
+.Ft int
+.Fn cap_rights_limit "int fd" "const cap_rights_t *rights"
+.Sh DESCRIPTION
+When a file descriptor is created by a function such as
+.Xr accept 2 ,
+.Xr accept4 2 ,
+.Xr fhopen 2 ,
+.Xr kqueue 2 ,
+.Xr mq_open 2 ,
+.Xr open 2 ,
+.Xr openat 2 ,
+.Xr pdfork 2 ,
+.Xr pipe 2 ,
+.Xr shm_open 2 ,
+.Xr socket 2
+or
+.Xr socketpair 2 ,
+it is assigned all capability rights.
+Those rights can be reduced (but never expanded) by using the
+.Fn cap_rights_limit
+system call.
+Once capability rights are reduced, operations on the file descriptor will be
+limited to those permitted by
+.Fa rights .
+.Pp
+The
+.Fa rights
+argument should be prepared using
+.Xr cap_rights_init 3
+family of functions.
+.Pp
+Capability rights assigned to a file descriptor can be obtained with the
+.Xr cap_rights_get 3
+function.
+.Pp
+The complete list of the capability rights can be found in the
+.Xr rights 4
+manual page.
+.Sh RETURN VALUES
+.Rv -std
+.Sh EXAMPLES
+The following example demonstrates how to limit file descriptor capability
+rights to allow reading only.
+.Bd -literal
+cap_rights_t setrights;
+char buf[1];
+int fd;
+
+fd = open("/tmp/foo", O_RDWR);
+if (fd < 0)
+	err(1, "open() failed");
+
+if (cap_enter() < 0)
+	err(1, "cap_enter() failed");
+
+cap_rights_init(&setrights, CAP_READ);
+if (cap_rights_limit(fd, &setrights) < 0)
+	err(1, "cap_rights_limit() failed");
+
+buf[0] = 'X';
+
+if (write(fd, buf, sizeof(buf)) > 0)
+	errx(1, "write() succeeded!");
+
+if (read(fd, buf, sizeof(buf)) < 0)
+	err(1, "read() failed");
+.Ed
+.Sh ERRORS
+.Fn cap_rights_limit
+succeeds unless:
+.Bl -tag -width Er
+.It Bq Er EBADF
+The
+.Fa fd
+argument is not a valid active descriptor.
+.It Bq Er EINVAL
+An invalid right has been requested in
+.Fa rights .
+.It Bq Er ENOTCAPABLE
+The
+.Fa rights
+argument contains capability rights not present for the given file descriptor.
+Capability rights list can only be reduced, never expanded.
+.El
+.Sh SEE ALSO
+.Xr accept 2 ,
+.Xr accept4 2 ,
+.Xr cap_enter 2 ,
+.Xr fhopen 2 ,
+.Xr kqueue 2 ,
+.Xr mq_open 2 ,
+.Xr open 2 ,
+.Xr openat 2 ,
+.Xr pdfork 2 ,
+.Xr pipe 2 ,
+.Xr read 2 ,
+.Xr shm_open 2 ,
+.Xr socket 2 ,
+.Xr socketpair 2 ,
+.Xr write 2 ,
+.Xr cap_rights_get 3 ,
+.Xr cap_rights_init 3 ,
+.Xr err 3 ,
+.Xr capsicum 4 ,
+.Xr rights 4
+.Sh HISTORY
+Support for capabilities and capabilities mode was developed as part of the
+.Tn TrustedBSD
+Project.
+.Sh AUTHORS
+This function was created by
+.An Pawel Jakub Dawidek Aq pawel at dawidek.net
+under sponsorship of the FreeBSD Foundation.


Property changes on: trunk/lib/libc/sys/cap_rights_limit.2
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: trunk/lib/libc/sys/chdir.2
===================================================================
--- trunk/lib/libc/sys/chdir.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/chdir.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1980, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,7 +27,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)chdir.2	8.2 (Berkeley) 12/11/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/chdir.2 165903 2007-01-09 00:28:16Z imp $
 .\"
 .Dd December 11, 1993
 .Dt CHDIR 2


Property changes on: trunk/lib/libc/sys/chdir.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/chflags.2
===================================================================
--- trunk/lib/libc/sys/chflags.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/chflags.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1989, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,15 +27,16 @@
 .\" SUCH DAMAGE.
 .\"
 .\"	@(#)chflags.2	8.3 (Berkeley) 5/2/95
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/chflags.2 260867 2014-01-18 22:47:25Z jilles $
 .\"
-.Dd Oct 29, 2010
+.Dd March 22, 2013
 .Dt CHFLAGS 2
 .Os
 .Sh NAME
 .Nm chflags ,
 .Nm lchflags ,
-.Nm fchflags
+.Nm fchflags ,
+.Nm chflagsat
 .Nd set file flags
 .Sh LIBRARY
 .Lb libc
@@ -42,11 +44,13 @@
 .In sys/stat.h
 .In unistd.h
 .Ft int
-.Fn chflags "const char *path" "u_long flags"
+.Fn chflags "const char *path" "unsigned long flags"
 .Ft int
-.Fn lchflags "const char *path" "int flags"
+.Fn lchflags "const char *path" "unsigned long flags"
 .Ft int
-.Fn fchflags "int fd" "u_long flags"
+.Fn fchflags "int fd" "unsigned long flags"
+.Ft int
+.Fn chflagsat "int fd" "const char *path" "unsigned long flags" "int atflag"
 .Sh DESCRIPTION
 The file whose name
 is given by
@@ -66,31 +70,105 @@
 will change the flags of the link itself,
 rather than the file it points to.
 .Pp
+The
+.Fn chflagsat
+is equivalent to either
+.Fn chflags
+or
+.Fn lchflags
+depending on the
+.Fa atflag
+except in the case where
+.Fa path
+specifies a relative path.
+In this case the file to be changed is determined relative to the directory
+associated with the file descriptor
+.Fa fd
+instead of the current working directory.
+The values for the
+.Fa atflag
+are constructed by a bitwise-inclusive OR of flags from the following list,
+defined in
+.In fcntl.h :
+.Bl -tag -width indent
+.It Dv AT_SYMLINK_NOFOLLOW
+If
+.Fa path
+names a symbolic link, then the flags of the symbolic link are changed.
+.El
+.Pp
+If
+.Fn chflagsat
+is passed the special value
+.Dv AT_FDCWD
+in the
+.Fa fd
+parameter, the current working directory is used.
+If also
+.Fa atflag
+is zero, the behavior is identical to a call to
+.Fn chflags .
+.Pp
 The flags specified are formed by
 .Em or Ns 'ing
 the following values
 .Pp
 .Bl -tag -width ".Dv SF_IMMUTABLE" -compact -offset indent
-.It Dv UF_NODUMP
-Do not dump the file.
-.It Dv UF_IMMUTABLE
-The file may not be changed.
-.It Dv UF_APPEND
+.It Dv SF_APPEND
 The file may only be appended to.
-.It Dv UF_NOUNLINK
-The file may not be renamed or deleted.
-.It Dv UF_OPAQUE
-The directory is opaque when viewed through a union stack.
 .It Dv SF_ARCHIVED
-The file may be archived.
+The file has been archived.
+This flag means the opposite of the DOS, Windows and CIFS
+FILE_ATTRIBUTE_ARCHIVE attribute.
+This flag has been deprecated, and may be removed in a future release.
 .It Dv SF_IMMUTABLE
 The file may not be changed.
-.It Dv SF_APPEND
-The file may only be appended to.
 .It Dv SF_NOUNLINK
 The file may not be renamed or deleted.
 .It Dv SF_SNAPSHOT
 The file is a snapshot file.
+.It Dv UF_APPEND
+The file may only be appended to.
+.It Dv UF_ARCHIVE
+The file needs to be archived.
+This flag has the same meaning as the DOS, Windows and CIFS
+FILE_ATTRIBUTE_ARCHIVE attribute.
+Filesystems in FreeBSD may or may not have special handling for this flag.
+For instance, ZFS tracks changes to files and will set this bit when a
+file is updated.
+UFS only stores the flag, and relies on the application to change it when
+needed.
+.It Dv UF_HIDDEN
+The file may be hidden from directory listings at the application's
+discretion.
+The file has the DOS, Windows and CIFS FILE_ATTRIBUTE_HIDDEN attribute.
+.It Dv UF_IMMUTABLE
+The file may not be changed.
+.It Dv UF_NODUMP
+Do not dump the file.
+.It Dv UF_NOUNLINK
+The file may not be renamed or deleted.
+.It Dv UF_OFFLINE
+The file is offline, or has the Windows and CIFS FILE_ATTRIBUTE_OFFLINE
+attribute.
+Filesystems in FreeBSD store and display this flag, but do not provide any
+special handling when it is set.
+.It Dv UF_OPAQUE
+The directory is opaque when viewed through a union stack.
+.It Dv UF_READONLY
+The file is read only, and may not be written or appended.
+Filesystems may use this flag to maintain compatibility with the DOS, Windows
+and CIFS FILE_ATTRIBUTE_READONLY attribute.
+.It Dv UF_REPARSE
+The file contains a Windows reparse point and has the Windows and CIFS
+FILE_ATTRIBUTE_REPARSE_POINT attribute.
+.It Dv UF_SPARSE
+The file has the Windows FILE_ATTRIBUTE_SPARSE_FILE attribute.
+This may also be used by a filesystem to indicate a sparse file.
+.It Dv UF_SYSTEM
+The file has the DOS, Windows and CIFS FILE_ATTRIBUTE_SYSTEM attribute.
+Filesystems in FreeBSD may store and display this flag, but do not provide
+any special handling when it is set.
 .El
 .Pp
 If one of
@@ -98,7 +176,7 @@
 or
 .Dv SF_NOUNLINK
 is set a non-super-user cannot change any flags and even the super-user
-can change flags only if securelevel is greater than 0.
+can change flags only if securelevel is 0.
 (See
 .Xr init 8
 for details.)
@@ -114,8 +192,7 @@
 and
 .Dv SF_ARCHIVED
 flags may only be set or unset by the super-user.
-Attempts to set these flags by non-super-users are rejected, attempts by
-non-superusers to clear flags that are already unset are silently ignored.
+Attempts to toggle these flags by non-super-users are rejected.
 These flags may be set at any time, but normally may only be unset when
 the system is in single-user mode.
 (See
@@ -122,9 +199,16 @@
 .Xr init 8
 for details.)
 .Pp
+The implementation of all flags is filesystem-dependent.
+See the description of the
+.Dv UF_ARCHIVE
+flag above for one example of the differences in behavior.
+Care should be exercised when writing applications to account for
+support or lack of support of these flags in various filesystems.
+.Pp
 The
 .Dv SF_SNAPSHOT
-flag is maintained by the system and cannot be changed by any user.
+flag is maintained by the system and cannot be toggled.
 .Sh RETURN VALUES
 .Rv -std
 .Sh ERRORS
@@ -154,12 +238,12 @@
 is set and the user is either not the super-user or
 securelevel is greater than 0.
 .It Bq Er EPERM
-A non-super-user tries to set one of
+A non-super-user attempted to toggle one of
 .Dv SF_ARCHIVED , SF_IMMUTABLE , SF_APPEND ,
 or
 .Dv SF_NOUNLINK .
 .It Bq Er EPERM
-User tries to set or remove the
+An attempt was made to toggle the
 .Dv SF_SNAPSHOT
 flag.
 .It Bq Er EROFS
@@ -174,7 +258,9 @@
 .Tn I/O
 error occurred while reading from or writing to the file system.
 .It Bq Er EOPNOTSUPP
-The underlying file system does not support file flags.
+The underlying file system does not support file flags, or
+does not support all of the flags set in
+.Fa flags .
 .El
 .Pp
 The
@@ -199,12 +285,12 @@
 is set and the user is either not the super-user or
 securelevel is greater than 0.
 .It Bq Er EPERM
-A non-super-user tries to set one of
+A non-super-user attempted to toggle one of
 .Dv SF_ARCHIVED , SF_IMMUTABLE , SF_APPEND ,
 or
 .Dv SF_NOUNLINK .
 .It Bq Er EPERM
-User tries to set or remove the
+An attempt was made to toggle the
 .Dv SF_SNAPSHOT
 flag.
 .It Bq Er EROFS
@@ -214,7 +300,9 @@
 .Tn I/O
 error occurred while reading from or writing to the file system.
 .It Bq Er EOPNOTSUPP
-The underlying file system does not support file flags.
+The underlying file system does not support file flags, or
+does not support all of the flags set in
+.Fa flags .
 .El
 .Sh SEE ALSO
 .Xr chflags 1 ,
@@ -229,3 +317,11 @@
 .Fn fchflags
 system calls first appeared in
 .Bx 4.4 .
+The
+.Fn lchflags
+system call first appeared in
+.Fx 5.0 .
+The
+.Fn chflagsat
+system call first appeared in
+.Fx 10.0 .


Property changes on: trunk/lib/libc/sys/chflags.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/chmod.2
===================================================================
--- trunk/lib/libc/sys/chmod.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/chmod.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1980, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,9 +27,9 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)chmod.2	8.1 (Berkeley) 6/4/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/chmod.2 264171 2014-04-05 20:11:40Z jilles $
 .\"
-.Dd April 10, 2008
+.Dd December 1, 2013
 .Dt CHMOD 2
 .Os
 .Sh NAME
@@ -139,21 +140,24 @@
 
 #define S_ISUID 0004000    /* set user id on execution */
 #define S_ISGID 0002000    /* set group id on execution */
-#ifndef __BSD_VISIBLE
-#define S_ISTXT 0001000    /* sticky bit */
-#endif
+#define S_ISVTX 0001000    /* sticky bit */
 .Ed
 .Pp
+The non-standard
+.Dv S_ISTXT
+is a synonym for
+.Dv S_ISVTX .
+.Pp
 The
 .Fx
 VM system totally ignores the sticky bit
-.Pq Dv ISTXT
+.Pq Dv S_ISVTX
 for executables.
 On UFS-based file systems (FFS, LFS) the sticky
 bit may only be set upon directories.
 .Pp
 If mode
-.Dv ISTXT
+.Dv S_ISVTX
 (the `sticky bit') is set on a directory,
 an unprivileged user may not delete or rename
 files of other users in that directory.
@@ -296,12 +300,15 @@
 system call is expected to conform to
 .St -p1003.1-90 ,
 except for the return of
-.Er EFTYPE
-and the use of
-.Dv S_ISTXT .
+.Er EFTYPE .
 The
+.Dv S_ISVTX
+bit on directories is expected to conform to
+.St -susv3 .
+The
 .Fn fchmodat
-system call follows The Open Group Extended API Set 2 specification.
+system call is expected to conform to
+.St -p1003.1-2008 .
 .Sh HISTORY
 The
 .Fn chmod


Property changes on: trunk/lib/libc/sys/chmod.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/chown.2
===================================================================
--- trunk/lib/libc/sys/chown.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/chown.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1980, 1991, 1993, 1994
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,7 +27,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)chown.2	8.4 (Berkeley) 4/19/94
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/chown.2 178245 2008-04-16 13:03:12Z kib $
 .\"
 .Dd April 10, 2008
 .Dt CHOWN 2


Property changes on: trunk/lib/libc/sys/chown.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/chroot.2
===================================================================
--- trunk/lib/libc/sys/chroot.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/chroot.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1983, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,9 +27,9 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)chroot.2	8.1 (Berkeley) 6/4/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/chroot.2 245458 2013-01-15 14:09:08Z zont $
 .\"
-.Dd June 4, 1993
+.Dd January 3, 2012
 .Dt CHROOT 2
 .Os
 .Sh NAME
@@ -130,6 +131,11 @@
 .Fn chroot
 system call appeared in
 .Bx 4.2 .
+It was marked as
+.Dq legacy
+in
+.St -susv2 ,
+and was removed in subsequent standards.
 .Sh BUGS
 If the process is able to change its working directory to the target
 directory, but another access control check fails (such as a check for
@@ -136,3 +142,16 @@
 open directories, or a MAC check), it is possible that this system
 call may return an error, with the working directory of the process
 left changed.
+.Sh SECURITY CONSIDERATIONS
+The system have many hardcoded paths to files where it may load after
+the process starts.
+It is generally recommended to drop privileges immediately after a
+successful
+.Nm
+call,
+and restrict write access to a limited subtree of the
+.Nm
+root,
+for instance,
+setup the sandbox so that the sandboxed user will have no write
+access to any well-known system directories.


Property changes on: trunk/lib/libc/sys/chroot.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/clock_gettime.2
===================================================================
--- trunk/lib/libc/sys/clock_gettime.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/clock_gettime.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\"	$OpenBSD: clock_gettime.2,v 1.4 1997/05/08 20:21:16 kstailey Exp $
 .\"
 .\" Copyright (c) 1980, 1991, 1993
@@ -27,9 +28,9 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/clock_gettime.2 292776 2015-12-27 15:30:13Z jilles $
 .\"
-.Dd December 29, 2009
+.Dd December 20, 2015
 .Dt CLOCK_GETTIME 2
 .Os
 .Sh NAME
@@ -136,10 +137,6 @@
 .Fa clock_id
 argument
 was not a valid value.
-.It Bq Er EFAULT
-The
-.Fa *tp
-argument address referenced invalid memory.
 .It Bq Er EPERM
 A user other than the super-user attempted to set the time.
 .El


Property changes on: trunk/lib/libc/sys/clock_gettime.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/clock_gettime.c
===================================================================
--- trunk/lib/libc/sys/clock_gettime.c	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/clock_gettime.c	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2012 Konstantin Belousov <kib at FreeBSD.org>
  *
@@ -24,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libc/sys/clock_gettime.c 237434 2012-06-22 07:13:30Z kib $");
 
 #include <sys/syscall.h>
 #include <sys/time.h>

Modified: trunk/lib/libc/sys/close.2
===================================================================
--- trunk/lib/libc/sys/close.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/close.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1980, 1991, 1993, 1994
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,9 +27,9 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)close.2	8.2 (Berkeley) 4/19/94
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/close.2 255486 2013-09-12 00:53:38Z bdrewery $
 .\"
-.Dd January 22, 2012
+.Dd September 11, 2013
 .Dt CLOSE 2
 .Os
 .Sh NAME
@@ -39,7 +40,7 @@
 .Sh SYNOPSIS
 .In unistd.h
 .Ft int
-.Fn close "int d"
+.Fn close "int fd"
 .Sh DESCRIPTION
 The
 .Fn close
@@ -107,7 +108,7 @@
 .Bl -tag -width Er
 .It Bq Er EBADF
 The
-.Fa d
+.Fa fd
 argument
 is not an active descriptor.
 .It Bq Er EINTR


Property changes on: trunk/lib/libc/sys/close.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: trunk/lib/libc/sys/close.c
===================================================================
--- trunk/lib/libc/sys/close.c	                        (rev 0)
+++ trunk/lib/libc/sys/close.c	2018-06-07 12:22:26 UTC (rev 10509)
@@ -0,0 +1,49 @@
+/* $MidnightBSD$ */
+/*
+ * Copyright (c) 2014 The FreeBSD Foundation.
+ * All rights reserved.
+ *
+ * Portions of this software were developed by Konstantin Belousov
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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(s), this list of conditions and the following disclaimer as
+ *    the first lines of this file unmodified other than the possible
+ *    addition of one or more copyright notices.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice(s), 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 COPYRIGHT HOLDER(S) ``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 COPYRIGHT HOLDER(S) 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/cdefs.h>
+__FBSDID("$FreeBSD: stable/10/lib/libc/sys/close.c 277317 2015-01-18 11:54:20Z kib $");
+
+#include <sys/types.h>
+#include <sys/fcntl.h>
+#include "libc_private.h"
+
+__weak_reference(__sys_close, __close);
+
+#pragma weak close
+int
+close(int fd)
+{
+
+	return (((int (*)(int))__libc_interposing[INTERPOS_close])(fd));
+}


Property changes on: trunk/lib/libc/sys/close.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: trunk/lib/libc/sys/closefrom.2
===================================================================
--- trunk/lib/libc/sys/closefrom.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/closefrom.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,4 +1,5 @@
-.\" Copyright (c) 2009 Advanced Computing Technologies LLC
+.\" $MidnightBSD$
+.\" Copyright (c) 2009 Hudson River Trading LLC
 .\" Written by: John H. Baldwin <jhb at FreeBSD.org>
 .\" All rights reserved.
 .\"
@@ -23,7 +24,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/closefrom.2 283927 2015-06-02 19:20:39Z jhb $
 .\"
 .Dd June 12, 2009
 .Dt CLOSEFROM 2


Property changes on: trunk/lib/libc/sys/closefrom.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/connect.2
===================================================================
--- trunk/lib/libc/sys/connect.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/connect.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1983, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,9 +27,9 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)connect.2	8.1 (Berkeley) 6/4/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/connect.2 281030 2015-04-03 17:12:24Z bdrewery $
 .\"
-.Dd September 5, 2010
+.Dd September 29, 2014
 .Dt CONNECT 2
 .Os
 .Sh NAME
@@ -80,6 +81,10 @@
 .Fa s
 argument
 is not a valid descriptor.
+.It Bq Er EINVAL
+The
+.Fa namelen
+argument is not a valid length for the address family.
 .It Bq Er ENOTSOCK
 The
 .Fa s
@@ -156,6 +161,8 @@
 Write access to the named socket is denied.
 .It Bq Er ELOOP
 Too many symbolic links were encountered in translating the pathname.
+.It Bq Er EPERM
+Write access to the named socket is denied.
 .El
 .Sh SEE ALSO
 .Xr accept 2 ,


Property changes on: trunk/lib/libc/sys/connect.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: trunk/lib/libc/sys/connect.c
===================================================================
--- trunk/lib/libc/sys/connect.c	                        (rev 0)
+++ trunk/lib/libc/sys/connect.c	2018-06-07 12:22:26 UTC (rev 10509)
@@ -0,0 +1,51 @@
+/* $MidnightBSD$ */
+/*
+ * Copyright (c) 2014 The FreeBSD Foundation.
+ * All rights reserved.
+ *
+ * Portions of this software were developed by Konstantin Belousov
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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(s), this list of conditions and the following disclaimer as
+ *    the first lines of this file unmodified other than the possible
+ *    addition of one or more copyright notices.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice(s), 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 COPYRIGHT HOLDER(S) ``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 COPYRIGHT HOLDER(S) 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/cdefs.h>
+__FBSDID("$FreeBSD: stable/10/lib/libc/sys/connect.c 277317 2015-01-18 11:54:20Z kib $");
+
+#include <sys/types.h>
+#include <sys/syscall.h>
+#include <sys/socket.h>
+#include "libc_private.h"
+
+__weak_reference(__sys_connect, __connect);
+
+#pragma weak connect
+int
+connect(int s, const struct sockaddr *addr, socklen_t addrlen)
+{
+
+	return (((int (*)(int, const struct sockaddr *, socklen_t))
+	    __libc_interposing[INTERPOS_connect])(s, addr, addrlen));
+}


Property changes on: trunk/lib/libc/sys/connect.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/lib/libc/sys/connectat.2
===================================================================
--- trunk/lib/libc/sys/connectat.2	                        (rev 0)
+++ trunk/lib/libc/sys/connectat.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -0,0 +1,110 @@
+.\" $MidnightBSD$
+.\" Copyright (c) 2013 The FreeBSD Foundation
+.\" All rights reserved.
+.\"
+.\" This documentation was written by Pawel Jakub Dawidek under sponsorship from
+.\" the FreeBSD Foundation.
+.\"
+.\" 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 AUTHORS 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 AUTHORS 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: stable/10/lib/libc/sys/connectat.2 247667 2013-03-02 21:11:30Z pjd $
+.\"
+.Dd February 13, 2013
+.Dt CONNECTAT 2
+.Os
+.Sh NAME
+.Nm connectat
+.Nd initiate a connection on a socket
+.Sh LIBRARY
+.Lb libc
+.Sh SYNOPSIS
+.In sys/types.h
+.In sys/socket.h
+.Pp
+.In fcntl.h
+.Ft int
+.Fn connectat "int fd" "int s" "const struct sockaddr *name" "socklen_t namelen"
+.Sh DESCRIPTION
+The
+.Fn connectat
+system call initiates a connection on a socket.
+It works just like the
+.Xr connect 2
+system call with two exceptions:
+.Pp
+.Bl -enum -offset indent -compact
+.It
+It is limited to sockets in the PF_LOCAL domain.
+.Pp
+.It
+If the file path stored in the
+.Fa sun_path
+field of the sockaddr_un structure is a relative path, it is located relative
+to the directory associated with the file descriptor
+.Fa fd .
+If
+.Fn connectat
+is passed the special value
+.Dv AT_FDCWD
+in the
+.Fa fd
+parameter, the current working directory is used and the behavior is identical
+to a call to
+.Xr connect 2 .
+.El
+.Sh RETURN VALUES
+.Rv -std connectat
+.Sh ERRORS
+The
+.Fn connectat
+system call may fail with the same errors as the
+.Xr connect 2
+system call for a UNIX domain socket or with the following errors:
+.Bl -tag -width Er
+.It Bq Er EBADF
+The
+.Fa sun_path
+field does not specify an absolute path and the
+.Fa fd
+argument is neither
+.Dv AT_FDCWD
+nor a valid file descriptor.
+.It Bq Er ENOTDIR
+The
+.Fa sun_path
+field is not an absolute path and
+.Fa fd
+is neither
+.Dv AT_FDCWD
+nor a file descriptor associated with a directory.
+.El
+.Sh SEE ALSO
+.Xr bindat 2 ,
+.Xr connect 2 ,
+.Xr socket 2 ,
+.Xr unix 4
+.Sh AUTHORS
+The
+.Nm
+was developed by
+.An Pawel Jakub Dawidek Aq pawel at dawidek.net
+under sponsorship from the FreeBSD Foundation.


Property changes on: trunk/lib/libc/sys/connectat.2
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: trunk/lib/libc/sys/cpuset.2
===================================================================
--- trunk/lib/libc/sys/cpuset.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/cpuset.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 2008 Christian Brueffer
 .\" Copyright (c) 2008 Jeffrey Roberson
 .\" All rights reserved.
@@ -23,7 +24,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/cpuset.2 249716 2013-04-21 06:46:41Z joel $
 .\"
 .Dd January 8, 2010
 .Dt CPUSET 2
@@ -216,7 +217,6 @@
 .Xr cpuset 1 ,
 .Xr cpuset_getaffinity 2 ,
 .Xr cpuset_setaffinity 2 ,
-.Xr CPU_SET 3 ,
 .Xr pthread_affinity_np 3 ,
 .Xr pthread_attr_affinity_np 3
 .Sh HISTORY


Property changes on: trunk/lib/libc/sys/cpuset.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/cpuset_getaffinity.2
===================================================================
--- trunk/lib/libc/sys/cpuset_getaffinity.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/cpuset_getaffinity.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 2008 Christian Brueffer
 .\" Copyright (c) 2008 Jeffrey Roberson
 .\" All rights reserved.
@@ -23,10 +24,10 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/cpuset_getaffinity.2 249716 2013-04-21 06:46:41Z joel $
 .\"
 .Dd September 10, 2010
-.Dt CPUSET 2
+.Dt CPUSET_GETAFFINITY 2
 .Os
 .Sh NAME
 .Nm cpuset_getaffinity ,
@@ -69,7 +70,7 @@
 Masks of type
 .Ft cpuset_t
 are composed using the
-.Xr CPU_SET 2
+.Dv CPU_SET
 macros.
 The kernel tolerates large sets as long as all CPUs specified
 in the set exist.
@@ -108,7 +109,6 @@
 .Fa id
 to the value in
 .Fa mask .
-.Pp
 .Sh RETURN VALUES
 .Rv -std
 .Sh ERRORS
@@ -153,7 +153,6 @@
 .Xr cpuset 2 ,
 .Xr cpuset_getid 2 ,
 .Xr cpuset_setid 2 ,
-.Xr CPU_SET 3 ,
 .Xr pthread_affinity_np 3 ,
 .Xr pthread_attr_affinity_np 3
 .Sh HISTORY


Property changes on: trunk/lib/libc/sys/cpuset_getaffinity.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/dup.2
===================================================================
--- trunk/lib/libc/sys/dup.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/dup.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1980, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,9 +27,9 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)dup.2	8.1 (Berkeley) 6/4/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/dup.2 254410 2013-08-16 13:16:27Z jilles $
 .\"
-.Dd April 21, 2013
+.Dd June 1, 2013
 .Dt DUP 2
 .Os
 .Sh NAME
@@ -112,16 +113,12 @@
 is a valid descriptor, then
 .Fn dup2
 is successful, and does nothing.
-.Pp
-The related
-.Xr cap_new 2
-system call allows file descriptors to be duplicated with restrictions on
-their use.
 .Sh RETURN VALUES
-The value -1 is returned if an error occurs in either call.
-The external variable
+These calls return the new file descriptor if successful;
+otherwise the value -1 is returned and
+the external variable
 .Va errno
-indicates the cause of the error.
+is set to indicate the cause of the error.
 .Sh ERRORS
 The
 .Fn dup
@@ -135,6 +132,7 @@
 .It Bq Er EMFILE
 Too many descriptors are active.
 .El
+.Pp
 The
 .Fn dup2
 system call fails if:
@@ -148,7 +146,6 @@
 .El
 .Sh SEE ALSO
 .Xr accept 2 ,
-.Xr cap_new 2 ,
 .Xr close 2 ,
 .Xr fcntl 2 ,
 .Xr getdtablesize 2 ,
@@ -155,7 +152,8 @@
 .Xr open 2 ,
 .Xr pipe 2 ,
 .Xr socket 2 ,
-.Xr socketpair 2
+.Xr socketpair 2 ,
+.Xr dup3 3
 .Sh STANDARDS
 The
 .Fn dup


Property changes on: trunk/lib/libc/sys/dup.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/execve.2
===================================================================
--- trunk/lib/libc/sys/execve.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/execve.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1980, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,7 +27,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)execve.2	8.5 (Berkeley) 6/1/94
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/execve.2 212965 2010-09-21 16:24:51Z alc $
 .\"
 .Dd September 21, 2010
 .Dt EXECVE 2


Property changes on: trunk/lib/libc/sys/execve.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/extattr_get_file.2
===================================================================
--- trunk/lib/libc/sys/extattr_get_file.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/extattr_get_file.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\"
 .\" Copyright (c) 2001 Dima Dorfman <dima at unixfreak.org>
 .\" Copyright (c) 2003 Robert Watson <rwatson at FreeBSD.org>
@@ -24,7 +25,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/extattr_get_file.2 248995 2013-04-02 05:30:41Z mdf $
 .\"
 .Dd January 29, 2008
 .Dt EXTATTR 2
@@ -50,7 +51,7 @@
 .In sys/extattr.h
 .Ft ssize_t
 .Fn extattr_get_fd "int fd" "int attrnamespace" "const char *attrname" "void *data" "size_t nbytes"
-.Ft int
+.Ft ssize_t
 .Fn extattr_set_fd "int fd" "int attrnamespace" "const char *attrname" "const void *data" "size_t nbytes"
 .Ft int
 .Fn extattr_delete_fd "int fd" "int attrnamespace" "const char *attrname"
@@ -58,7 +59,7 @@
 .Fn extattr_list_fd "int fd" "int attrnamespace" "void *data" "size_t nbytes"
 .Ft ssize_t
 .Fn extattr_get_file "const char *path" "int attrnamespace" "const char *attrname" "void *data" "size_t nbytes"
-.Ft int
+.Ft ssize_t
 .Fn extattr_set_file "const char *path" "int attrnamespace" "const char *attrname" "const void *data" "size_t nbytes"
 .Ft int
 .Fn extattr_delete_file "const char *path" "int attrnamespace" "const char *attrname"
@@ -66,7 +67,7 @@
 .Fn extattr_list_file "const char *path" "int attrnamespace" "void *data" "size_t nbytes"
 .Ft ssize_t
 .Fn extattr_get_link "const char *path" "int attrnamespace" "const char *attrname" "void *data" "size_t nbytes"
-.Ft int
+.Ft ssize_t
 .Fn extattr_set_link "const char *path" "int attrnamespace" "const char *attrname" "const void *data" "size_t nbytes"
 .Ft int
 .Fn extattr_delete_link "const char *path" "int attrnamespace" "const char *attrname"


Property changes on: trunk/lib/libc/sys/extattr_get_file.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/fcntl.2
===================================================================
--- trunk/lib/libc/sys/fcntl.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/fcntl.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1983, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,9 +27,9 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)fcntl.2	8.2 (Berkeley) 1/12/94
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/fcntl.2 246763 2013-02-13 15:09:16Z ian $
 .\"
-.Dd July 27, 2012
+.Dd February 8, 2013
 .Dt FCNTL 2
 .Os
 .Sh NAME
@@ -164,6 +165,22 @@
 as negative, otherwise
 .Fa arg
 is interpreted as a process ID.
+.It Dv F_READAHEAD
+Set or clear the read ahead amount for sequential access to the third
+argument,
+.Fa arg ,
+which is rounded up to the nearest block size.
+A zero value in
+.Fa arg
+turns off read ahead, a negative value restores the system default.
+.It Dv F_RDAHEAD
+Equivalent to Darwin counterpart which sets read ahead amount of 128KB
+when the third argument,
+.Fa arg
+is non-zero.
+A zero value in
+.Fa arg
+turns off read ahead.
 .El
 .Pp
 The flags for the
@@ -262,22 +279,6 @@
 .Dv SA_RESTART
 (see
 .Xr sigaction 2 ) .
-.It Dv F_READAHEAD
-Set or clear the read ahead amount for sequential access to the third
-argument,
-.Fa arg ,
-which is rounded up to the nearest block size.
-A zero value in
-.Fa arg
-turns off read ahead.
-.It Dv F_RDAHEAD
-Equivalent to Darwin counterpart which sets read ahead amount of 128KB
-when the third argument,
-.Fa arg
-is non-zero.
-A zero value in
-.Fa arg
-turns off read ahead.
 .El
 .Pp
 When a shared lock has been set on a segment of a file,


Property changes on: trunk/lib/libc/sys/fcntl.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/fcntl.c
===================================================================
--- trunk/lib/libc/sys/fcntl.c	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/fcntl.c	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2008 Isilon Inc http://www.isilon.com/
  * Authors: Doug Rabson <dfr at rabson.org>
@@ -26,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libc/sys/fcntl.c 281256 2015-04-08 02:21:44Z kib $");
 
 #include <fcntl.h>
 #include <stdarg.h>
@@ -34,8 +35,24 @@
 #include <sys/syscall.h>
 #include "libc_private.h"
 
-__weak_reference(__fcntl_compat, fcntl);
+#pragma weak fcntl
+int
+fcntl(int fd, int cmd, ...)
+{
+	va_list args;
+	long arg;
 
+	va_start(args, cmd);
+	arg = va_arg(args, long);
+	va_end(args);
+
+	return (((int (*)(int, int, ...))
+	    __libc_interposing[INTERPOS_fcntl])(fd, cmd, arg));
+}
+
+#ifdef SYSCALL_COMPAT
+__weak_reference(__fcntl_compat, __fcntl);
+
 int
 __fcntl_compat(int fd, int cmd, ...)
 {
@@ -87,3 +104,4 @@
 		return (__sys_fcntl(fd, cmd, arg));
 	}
 }
+#endif

Added: trunk/lib/libc/sys/ffclock.2
===================================================================
--- trunk/lib/libc/sys/ffclock.2	                        (rev 0)
+++ trunk/lib/libc/sys/ffclock.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -0,0 +1,178 @@
+.\" $MidnightBSD$
+.\" Copyright (c) 2011 The University of Melbourne
+.\" All rights reserved.
+.\"
+.\" This documentation was written by Julien Ridoux at the University of
+.\" Melbourne under sponsorship from the FreeBSD Foundation.
+.\"
+.\" 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: stable/10/lib/libc/sys/ffclock.2 235140 2012-05-08 18:56:21Z gjb $
+.\"
+.Dd November 21, 2011
+.Dt FFCLOCK 2
+.Os
+.Sh NAME
+.Nm ffclock_getcounter ,
+.Nm ffclock_getestimate ,
+.Nm ffclock_setestimate
+.Nd Retrieve feed-forward counter, get and set feed-forward clock estimates
+.Sh LIBRARY
+.Lb libc
+.Sh SYNOPSIS
+.In sys/timeffc.h
+.Ft int
+.Fn ffclock_getcounter "ffcounter *ffcount"
+.Ft int
+.Fn ffclock_getestimate "struct ffclock_estimate *cest"
+.Ft int
+.Fn ffclock_setestimate "struct ffclock_estimate *cest"
+.Sh DESCRIPTION
+The ffclock is an alternative method to synchronise the system clock.
+The ffclock implements a feed-forward paradigm and decouples the timestamping
+and timekeeping kernel functions.
+This ensures that past clock errors do not affect current timekeeping, an
+approach radically different from the feedback alternative implemented by the
+ntpd daemon when adjusting the system clock.
+The feed-forward approach has demonstrated better performance and higher
+robustness than a feedback approach when synchronising over the network.
+.Pp
+In the feed-forward context, a
+.Em timestamp
+is a cumulative value of the ticks of the timecounter, which can be converted
+into seconds by using the feed-forward
+.Em clock estimates .
+.Pp
+The
+.Fn ffclock_getcounter
+system call allows the calling process to retrieve the current value of the
+feed-forward counter maintained by the kernel.
+.Pp
+The
+.Fn ffclock_getestimate
+and
+.Fn ffclock_setestimate
+system calls allow the caller to get and set the kernel's feed-forward clock
+parameter estimates respectively.
+The
+.Fn ffclock_setestimate
+system call should be invoked by a single instance of a feed-forward
+synchronisation daemon.
+The
+.Fn ffclock_getestimate
+system call can be called by any process to retrieve the feed-forward clock
+estimates.
+.Pp
+The feed-forward approach does not require that the clock estimates be retrieved
+every time a timestamp is to be converted into seconds.
+The number of system calls can therefore be greatly reduced if the calling
+process retrieves the clock estimates from the clock synchronisation daemon
+instead.
+The
+.Fn ffclock_getestimate
+must be used when the feed-forward synchronisation daemon is not running
+.Po see
+.Sx USAGE
+below
+.Pc .
+.Pp
+The clock parameter estimates structure pointed to by
+.Fa cest
+is defined in
+.In sys/timeffc.h
+as:
+.Bd -literal
+struct ffclock_estimate {
+	struct bintime update_time;    /* Time of last estimates update. */
+	ffcounter      update_ffcount; /* Counter value at last update. */
+	ffcounter      leapsec_next;   /* Counter value of next leap second. */
+	uint64_t       period;         /* Estimate of counter period. */
+	uint32_t       errb_abs;       /* Bound on absolute clock error [ns]. */
+	uint32_t       errb_rate;      /* Bound on counter rate error [ps/s]. */
+	uint32_t       status;         /* Clock status. */
+	int16_t        leapsec_total;  /* All leap seconds seen so far. */
+	int8_t         leapsec;        /* Next leap second (in {-1,0,1}). */
+};
+.Ed
+.Pp
+Only the super-user may set the feed-forward clock estimates.
+.Sh RETURN VALUES
+.Rv -std
+.Sh ERRORS
+The following error codes may be set in
+.Va errno :
+.Bl -tag -width Er
+.It Bq Er EFAULT
+The
+.Fa ffcount
+or
+.Fa cest
+pointer referenced invalid memory.
+.It Bq Er EPERM
+A user other than the super-user attempted to set the feed-forward clock
+parameter estimates.
+.El
+.Sh USAGE
+The feed-forward paradigm enables the definition of specialised clock functions.
+.Pp
+In its simplest form,
+.Fn ffclock_getcounter
+can be used to establish strict order between events or to measure small time
+intervals very accurately with a minimum performance cost.
+.Pp
+Different methods exist to access absolute time
+.Po or
+.Qq wall-clock time
+.Pc tracked by the ffclock.
+The simplest method uses the ffclock sysctl interface
+.Va kern.ffclock
+to make the system clock return the ffclock time.
+The
+.Xr clock_gettime 2
+system call can then be used to retrieve the current time seen by the
+feed-forward clock.
+Note that this setting affects the entire system and that a feed-forward
+synchronisation daemon should be running.
+.Pp
+A less automated method consists of retrieving the feed-forward counter
+timestamp from the kernel and using the feed-forward clock parameter estimates
+to convert the timestamp into seconds.
+The feed-forward clock parameter estimates can be retrieved from the kernel or
+from the synchronisation daemon directly (preferred).
+This method allows converting timestamps using different clock models as needed
+by the application, while collecting meaningful upper bounds on current clock
+error.
+.Sh SEE ALSO
+.Xr date 1 ,
+.Xr adjtime 2 ,
+.Xr clock_gettime 2 ,
+.Xr ctime 3
+.Sh HISTORY
+Feed-forward clock support first appeared in
+.Fx 10.0 .
+.Sh AUTHORS
+.An -nosplit
+The feed-forward clock support was written by
+.An Julien Ridoux Aq jridoux at unimelb.edu.au
+in collaboration with
+.An Darryl Veitch Aq dveitch at unimelb.edu.au
+at the University of Melbourne under sponsorship from the FreeBSD Foundation.


Property changes on: trunk/lib/libc/sys/ffclock.2
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: trunk/lib/libc/sys/fhopen.2
===================================================================
--- trunk/lib/libc/sys/fhopen.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/fhopen.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\"	$NetBSD: fhopen.2,v 1.1 1999/06/30 01:32:15 wrstuden Exp $
 .\"
 .\" Copyright (c) 1999 National Aeronautics & Space Administration
@@ -31,7 +32,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/fhopen.2 147700 2005-06-30 13:18:15Z hmp $
 .\"
 .Dd June 29, 1999
 .Dt FHOPEN 2


Property changes on: trunk/lib/libc/sys/fhopen.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/flock.2
===================================================================
--- trunk/lib/libc/sys/flock.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/flock.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1983, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,7 +27,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)flock.2	8.2 (Berkeley) 12/11/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/flock.2 227416 2011-11-10 06:20:18Z dougb $
 .\"
 .Dd November 9, 2011
 .Dt FLOCK 2


Property changes on: trunk/lib/libc/sys/flock.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/fork.2
===================================================================
--- trunk/lib/libc/sys/fork.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/fork.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1980, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,9 +27,9 @@
 .\" SUCH DAMAGE.
 .\"
 .\"	@(#)fork.2	8.1 (Berkeley) 6/4/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/fork.2 251194 2013-05-31 20:46:08Z jilles $
 .\"
-.Dd June 4, 1993
+.Dd May 31, 2013
 .Dt FORK 2
 .Os
 .Sh NAME
@@ -37,7 +38,6 @@
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
-.In sys/types.h
 .In unistd.h
 .Ft pid_t
 .Fn fork void
@@ -74,6 +74,17 @@
 .It
 All interval timers are cleared; see
 .Xr setitimer 2 .
+.It
+The child process has only one thread,
+corresponding to the calling thread in the parent process.
+If the process has more than one thread,
+locks and other resources held by the other threads are not released
+and therefore only async-signal-safe functions
+(see
+.Xr sigaction 2 )
+are guaranteed to work in the child process until a call to
+.Xr execve 2
+or a similar function.
 .El
 .Sh RETURN VALUES
 Upon successful completion,
@@ -125,6 +136,7 @@
 .Xr rfork 2 ,
 .Xr setitimer 2 ,
 .Xr setrlimit 2 ,
+.Xr sigaction 2 ,
 .Xr vfork 2 ,
 .Xr wait 2
 .Sh HISTORY


Property changes on: trunk/lib/libc/sys/fork.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: trunk/lib/libc/sys/fork.c
===================================================================
--- trunk/lib/libc/sys/fork.c	                        (rev 0)
+++ trunk/lib/libc/sys/fork.c	2018-06-07 12:22:26 UTC (rev 10509)
@@ -0,0 +1,49 @@
+/* $MidnightBSD$ */
+/*
+ * Copyright (c) 2014 The FreeBSD Foundation.
+ * All rights reserved.
+ *
+ * Portions of this software were developed by Konstantin Belousov
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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(s), this list of conditions and the following disclaimer as
+ *    the first lines of this file unmodified other than the possible
+ *    addition of one or more copyright notices.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice(s), 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 COPYRIGHT HOLDER(S) ``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 COPYRIGHT HOLDER(S) 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/cdefs.h>
+__FBSDID("$FreeBSD: stable/10/lib/libc/sys/fork.c 277317 2015-01-18 11:54:20Z kib $");
+
+#include <sys/types.h>
+#include <unistd.h>
+#include "libc_private.h"
+
+__weak_reference(__sys_fork, __fork);
+
+#pragma weak fork
+pid_t
+fork(void)
+{
+
+	return (((pid_t (*)(void))__libc_interposing[INTERPOS_fork])());
+}


Property changes on: trunk/lib/libc/sys/fork.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: trunk/lib/libc/sys/fsync.2
===================================================================
--- trunk/lib/libc/sys/fsync.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/fsync.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1983, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,7 +27,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)fsync.2	8.1 (Berkeley) 6/4/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/fsync.2 165903 2007-01-09 00:28:16Z imp $
 .\"
 .Dd June 4, 1993
 .Dt FSYNC 2


Property changes on: trunk/lib/libc/sys/fsync.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: trunk/lib/libc/sys/fsync.c
===================================================================
--- trunk/lib/libc/sys/fsync.c	                        (rev 0)
+++ trunk/lib/libc/sys/fsync.c	2018-06-07 12:22:26 UTC (rev 10509)
@@ -0,0 +1,48 @@
+/* $MidnightBSD$ */
+/*
+ * Copyright (c) 2014 The FreeBSD Foundation.
+ * All rights reserved.
+ *
+ * Portions of this software were developed by Konstantin Belousov
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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(s), this list of conditions and the following disclaimer as
+ *    the first lines of this file unmodified other than the possible
+ *    addition of one or more copyright notices.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice(s), 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 COPYRIGHT HOLDER(S) ``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 COPYRIGHT HOLDER(S) 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/cdefs.h>
+__FBSDID("$FreeBSD: stable/10/lib/libc/sys/fsync.c 277317 2015-01-18 11:54:20Z kib $");
+
+#include <sys/types.h>
+#include <sys/fcntl.h>
+#include "libc_private.h"
+
+__weak_reference(__sys_fsync, __fsync);
+
+int
+fsync(int fd)
+{
+
+	return (((int (*)(int))__libc_interposing[INTERPOS_fsync])(fd));
+}


Property changes on: trunk/lib/libc/sys/fsync.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: trunk/lib/libc/sys/ftruncate.c
===================================================================
--- trunk/lib/libc/sys/ftruncate.c	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/ftruncate.c	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * Copyright (c) 1992, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -31,7 +32,7 @@
 static char sccsid[] = "@(#)ftruncate.c	8.1 (Berkeley) 6/17/93";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__MBSDID("$FreeBSD: src/lib/libc/sys/ftruncate.c,v 1.7 2007/07/04 23:27:38 peter Exp $");
+__FBSDID("$FreeBSD: stable/10/lib/libc/sys/ftruncate.c 171219 2007-07-04 23:27:38Z peter $");
 
 #include <sys/types.h>
 #include <sys/syscall.h>
@@ -48,7 +49,7 @@
 	off_t	length;
 {
 
-	if (__getosreldate() >= 4013)
+	if (__getosreldate() >= 700051)
 		return(__sys_ftruncate(fd, length));
 	else
 		return(__sys_freebsd6_ftruncate(fd, 0, length));

Added: trunk/lib/libc/sys/futimens.c
===================================================================
--- trunk/lib/libc/sys/futimens.c	                        (rev 0)
+++ trunk/lib/libc/sys/futimens.c	2018-06-07 12:22:26 UTC (rev 10509)
@@ -0,0 +1,101 @@
+/* $MidnightBSD$ */
+/*-
+ * Copyright (c) 2015 Jilles Tjoelker
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD: stable/10/lib/libc/sys/futimens.c 294099 2016-01-15 20:55:44Z jilles $");
+
+#include "namespace.h"
+#include <sys/stat.h>
+
+#include <errno.h>
+#include <fcntl.h>
+#include <time.h>
+#include "un-namespace.h"
+
+#include "libc_private.h"
+
+int
+futimens(int fd, const struct timespec times[2])
+{
+	struct timeval now, tv[2], *tvp;
+	struct stat sb;
+	int osreldate;
+
+	osreldate = __getosreldate();
+	if (osreldate >= 1100056 ||
+	    (osreldate >= 1002506 && osreldate < 1100000))
+		return (__sys_futimens(fd, times));
+
+	if (times == NULL || (times[0].tv_nsec == UTIME_NOW &&
+	    times[1].tv_nsec == UTIME_NOW))
+		tvp = NULL;
+	else if (times[0].tv_nsec == UTIME_OMIT &&
+	    times[1].tv_nsec == UTIME_OMIT)
+		return (0);
+	else {
+		if ((times[0].tv_nsec < 0 || times[0].tv_nsec > 999999999) &&
+		    times[0].tv_nsec != UTIME_NOW &&
+		    times[0].tv_nsec != UTIME_OMIT) {
+			errno = EINVAL;
+			return (-1);
+		}
+		if ((times[1].tv_nsec < 0 || times[1].tv_nsec > 999999999) &&
+		    times[1].tv_nsec != UTIME_NOW &&
+		    times[1].tv_nsec != UTIME_OMIT) {
+			errno = EINVAL;
+			return (-1);
+		}
+		tv[0].tv_sec = times[0].tv_sec;
+		tv[0].tv_usec = times[0].tv_nsec / 1000;
+		tv[1].tv_sec = times[1].tv_sec;
+		tv[1].tv_usec = times[1].tv_nsec / 1000;
+		tvp = tv;
+		if (times[0].tv_nsec == UTIME_OMIT ||
+		    times[1].tv_nsec == UTIME_OMIT) {
+			if (_fstat(fd, &sb) == -1)
+				return (-1);
+			if (times[0].tv_nsec == UTIME_OMIT) {
+				tv[0].tv_sec = sb.st_atim.tv_sec;
+				tv[0].tv_usec = sb.st_atim.tv_nsec / 1000;
+			}
+			if (times[1].tv_nsec == UTIME_OMIT) {
+				tv[1].tv_sec = sb.st_mtim.tv_sec;
+				tv[1].tv_usec = sb.st_mtim.tv_nsec / 1000;
+			}
+		}
+		if (times[0].tv_nsec == UTIME_NOW ||
+		    times[1].tv_nsec == UTIME_NOW) {
+			if (gettimeofday(&now, NULL) == -1)
+				return (-1);
+			if (times[0].tv_nsec == UTIME_NOW)
+				tv[0] = now;
+			if (times[1].tv_nsec == UTIME_NOW)
+				tv[1] = now;
+		}
+	}
+	return (futimes(fd, tvp));
+}


Property changes on: trunk/lib/libc/sys/futimens.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: trunk/lib/libc/sys/getdirentries.2
===================================================================
--- trunk/lib/libc/sys/getdirentries.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/getdirentries.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1989, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,7 +27,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"	@(#)getdirentries.2	8.2 (Berkeley) 5/3/95
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/getdirentries.2 319311 2017-05-31 09:25:47Z kib $
 .\"
 .Dd May 3, 1995
 .Dt GETDIRENTRIES 2
@@ -71,10 +72,10 @@
 .Vt dirent
 structures each containing the following entries:
 .Bd -literal -offset indent
-u_int32_t d_fileno;
-u_int16_t d_reclen;
-u_int8_t  d_type;
-u_int8_t  d_namlen;
+uint32_t d_fileno;
+uint16_t d_reclen;
+uint8_t  d_type;
+uint8_t  d_namlen;
 char	d_name[MAXNAMELEN + 1];	/* see below */
 .Ed
 .Pp
@@ -124,7 +125,10 @@
 A value of zero is returned when
 the end of the directory has been reached.
 .Pp
-The
+If the
+.Fa basep
+pointer value is non-NULL ,
+the
 .Fn getdirentries
 system call writes the position of the block read into the location pointed to by
 .Fa basep .
@@ -156,7 +160,7 @@
 .It Bq Er EFAULT
 Either
 .Fa buf
-or
+or non-NULL
 .Fa basep
 point outside the allocated address space.
 .It Bq Er EINVAL


Property changes on: trunk/lib/libc/sys/getdirentries.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/getdtablesize.2
===================================================================
--- trunk/lib/libc/sys/getdtablesize.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/getdtablesize.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1983, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,7 +27,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)getdtablesize.2	8.1 (Berkeley) 6/4/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/getdtablesize.2 249859 2013-04-24 21:24:35Z jilles $
 .\"
 .Dd April 24, 2013
 .Dt GETDTABLESIZE 2


Property changes on: trunk/lib/libc/sys/getdtablesize.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/getfh.2
===================================================================
--- trunk/lib/libc/sys/getfh.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/getfh.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1989, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,7 +27,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"	@(#)getfh.2	8.1 (Berkeley) 6/9/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/getfh.2 220646 2011-04-14 22:06:11Z jilles $
 .\"
 .Dd April 14, 2011
 .Dt GETFH 2


Property changes on: trunk/lib/libc/sys/getfh.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/getfsstat.2
===================================================================
--- trunk/lib/libc/sys/getfsstat.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/getfsstat.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1989, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,7 +27,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"	@(#)getfsstat.2	8.3 (Berkeley) 5/25/95
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/getfsstat.2 165903 2007-01-09 00:28:16Z imp $
 .\"
 .Dd November 20, 2003
 .Dt GETFSSTAT 2


Property changes on: trunk/lib/libc/sys/getfsstat.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/getgid.2
===================================================================
--- trunk/lib/libc/sys/getgid.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/getgid.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1983, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,7 +27,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)getgid.2	8.1 (Berkeley) 6/4/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/getgid.2 165903 2007-01-09 00:28:16Z imp $
 .\"
 .Dd June 4, 1993
 .Dt GETGID 2


Property changes on: trunk/lib/libc/sys/getgid.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/getgroups.2
===================================================================
--- trunk/lib/libc/sys/getgroups.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/getgroups.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1983, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,7 +27,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)getgroups.2	8.2 (Berkeley) 4/16/94
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/getgroups.2 217704 2011-01-21 22:15:17Z jilles $
 .\"
 .Dd January 21, 2011
 .Dt GETGROUPS 2


Property changes on: trunk/lib/libc/sys/getgroups.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/getitimer.2
===================================================================
--- trunk/lib/libc/sys/getitimer.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/getitimer.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1983, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,7 +27,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)getitimer.2	8.3 (Berkeley) 5/16/95
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/getitimer.2 208914 2010-06-08 16:48:59Z uqs $
 .\"
 .Dd May 16, 1995
 .Dt GETITIMER 2


Property changes on: trunk/lib/libc/sys/getitimer.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/getlogin.2
===================================================================
--- trunk/lib/libc/sys/getlogin.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/getlogin.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1989, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,7 +27,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"	@(#)getlogin.2	8.1 (Berkeley) 6/9/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/getlogin.2 165903 2007-01-09 00:28:16Z imp $
 .\"
 .Dd June 9, 1993
 .Dt GETLOGIN 2


Property changes on: trunk/lib/libc/sys/getlogin.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/getloginclass.2
===================================================================
--- trunk/lib/libc/sys/getloginclass.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/getloginclass.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\"-
 .\" Copyright (c) 2011 Edward Tomasz Napierala
 .\" All rights reserved.
@@ -23,7 +24,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/getloginclass.2 219322 2011-03-06 08:35:50Z trasz $
 .\"
 .Dd March 6, 2011
 .Dt GETLOGINCLASS 2


Property changes on: trunk/lib/libc/sys/getloginclass.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/getpeername.2
===================================================================
--- trunk/lib/libc/sys/getpeername.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/getpeername.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1983, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,7 +27,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)getpeername.2	8.1 (Berkeley) 6/4/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/getpeername.2 243439 2012-11-23 10:14:54Z kevlo $
 .\"
 .Dd June 4, 1993
 .Dt GETPEERNAME 2
@@ -67,6 +68,10 @@
 is not a valid descriptor.
 .It Bq Er ECONNRESET
 The connection has been reset by the peer.
+.It Bq Er EINVAL
+The value of the
+.Fa namelen
+argument is not valid.
 .It Bq Er ENOTSOCK
 The argument
 .Fa s


Property changes on: trunk/lib/libc/sys/getpeername.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/getpgrp.2
===================================================================
--- trunk/lib/libc/sys/getpgrp.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/getpgrp.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1983, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,7 +27,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)getpgrp.2	8.1 (Berkeley) 6/4/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/getpgrp.2 165903 2007-01-09 00:28:16Z imp $
 .\"
 .Dd June 4, 1993
 .Dt GETPGRP 2


Property changes on: trunk/lib/libc/sys/getpgrp.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/getpid.2
===================================================================
--- trunk/lib/libc/sys/getpid.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/getpid.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1980, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,7 +27,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)getpid.2	8.1 (Berkeley) 6/4/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/getpid.2 165903 2007-01-09 00:28:16Z imp $
 .\"
 .Dd November 2, 2006
 .Dt GETPID 2


Property changes on: trunk/lib/libc/sys/getpid.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/getpriority.2
===================================================================
--- trunk/lib/libc/sys/getpriority.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/getpriority.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1980, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,7 +27,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)getpriority.2	8.1 (Berkeley) 6/4/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/getpriority.2 214132 2010-10-21 12:27:13Z uqs $
 .\"
 .Dd June 4, 1993
 .Dt GETPRIORITY 2


Property changes on: trunk/lib/libc/sys/getpriority.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/getrlimit.2
===================================================================
--- trunk/lib/libc/sys/getrlimit.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/getrlimit.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1980, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,7 +27,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)getrlimit.2	8.1 (Berkeley) 6/4/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/getrlimit.2 207735 2010-05-06 22:49:54Z jilles $
 .\"
 .Dd August 20, 2008
 .Dt GETRLIMIT 2
@@ -108,8 +109,6 @@
 for a complete description of this sysctl.
 .It Dv RLIMIT_NPTS
 The maximum number of pseudo-terminals created by this user id.
-.It Dv RLIMIT_KQUEUES
-The maximum number of kqueues created by this user id.
 .El
 .Pp
 A resource limit is specified as a soft limit and a hard limit.


Property changes on: trunk/lib/libc/sys/getrlimit.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/getrusage.2
===================================================================
--- trunk/lib/libc/sys/getrusage.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/getrusage.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1985, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,7 +27,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)getrusage.2	8.1 (Berkeley) 6/4/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/getrusage.2 208914 2010-06-08 16:48:59Z uqs $
 .\"
 .Dd May 1, 2010
 .Dt GETRUSAGE 2


Property changes on: trunk/lib/libc/sys/getrusage.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/getsid.2
===================================================================
--- trunk/lib/libc/sys/getsid.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/getsid.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1997 Peter Wemm <peter at FreeBSD.org>
 .\"
 .\" Redistribution and use in source and binary forms, with or without
@@ -21,7 +22,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/getsid.2 108028 2002-12-18 09:22:32Z ru $
 .\"
 .Dd August 19, 1997
 .Dt GETSID 2


Property changes on: trunk/lib/libc/sys/getsid.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/getsockname.2
===================================================================
--- trunk/lib/libc/sys/getsockname.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/getsockname.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1983, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,7 +27,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)getsockname.2	8.1 (Berkeley) 6/4/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/getsockname.2 243439 2012-11-23 10:14:54Z kevlo $
 .\"
 .Dd June 4, 1993
 .Dt GETSOCKNAME 2
@@ -66,6 +67,10 @@
 is not a valid descriptor.
 .It Bq Er ECONNRESET
 The connection has been reset by the peer.
+.It Bq Er EINVAL
+The value of the
+.Fa namelen
+argument is not valid.
 .It Bq Er ENOTSOCK
 The argument
 .Fa s


Property changes on: trunk/lib/libc/sys/getsockname.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/getsockopt.2
===================================================================
--- trunk/lib/libc/sys/getsockopt.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/getsockopt.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1983, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,9 +27,9 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)getsockopt.2	8.4 (Berkeley) 5/2/95
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/getsockopt.2 249166 2013-04-05 18:09:43Z gnn $
 .\"
-.Dd February 26, 2012
+.Dd April 5, 2013
 .Dt GETSOCKOPT 2
 .Os
 .Sh NAME
@@ -437,7 +438,7 @@
 .Vt cmsghdr
 fields have the following values for TIMESTAMP:
 .Bd -literal
-     cmsg_len = sizeof(struct timeval);
+     cmsg_len = CMSG_LEN(sizeof(struct timeval));
      cmsg_level = SOL_SOCKET;
      cmsg_type = SCM_TIMESTAMP;
 .Ed
@@ -445,7 +446,7 @@
 and for
 .Dv SO_BINTIME :
 .Bd -literal
-     cmsg_len = sizeof(struct bintime);
+     cmsg_len = CMSG_LEN(sizeof(struct bintime));
      cmsg_level = SOL_SOCKET;
      cmsg_type = SCM_BINTIME;
 .Ed


Property changes on: trunk/lib/libc/sys/getsockopt.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/gettimeofday.2
===================================================================
--- trunk/lib/libc/sys/gettimeofday.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/gettimeofday.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1980, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,9 +27,9 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)gettimeofday.2	8.2 (Berkeley) 5/26/95
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/gettimeofday.2 292776 2015-12-27 15:30:13Z jilles $
 .\"
-.Dd May 26, 1995
+.Dd December 20, 2015
 .Dt GETTIMEOFDAY 2
 .Os
 .Sh NAME
@@ -110,8 +111,6 @@
 The following error codes may be set in
 .Va errno :
 .Bl -tag -width Er
-.It Bq Er EFAULT
-An argument address referenced invalid memory.
 .It Bq Er EPERM
 A user other than the super-user attempted to set the time.
 .El


Property changes on: trunk/lib/libc/sys/gettimeofday.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/gettimeofday.c
===================================================================
--- trunk/lib/libc/sys/gettimeofday.c	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/gettimeofday.c	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2012 Konstantin Belousov <kib at FreeBSD.org>
  *
@@ -24,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libc/sys/gettimeofday.c 246117 2013-01-30 12:48:16Z kib $");
 
 #include <sys/syscall.h>
 #include <sys/time.h>

Modified: trunk/lib/libc/sys/getuid.2
===================================================================
--- trunk/lib/libc/sys/getuid.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/getuid.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1980, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,7 +27,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)getuid.2	8.1 (Berkeley) 6/4/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/getuid.2 165903 2007-01-09 00:28:16Z imp $
 .\"
 .Dd June 4, 1993
 .Dt GETUID 2


Property changes on: trunk/lib/libc/sys/getuid.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: trunk/lib/libc/sys/interposing_table.c
===================================================================
--- trunk/lib/libc/sys/interposing_table.c	                        (rev 0)
+++ trunk/lib/libc/sys/interposing_table.c	2018-06-07 12:22:26 UTC (rev 10509)
@@ -0,0 +1,91 @@
+/* $MidnightBSD$ */
+/*
+ * Copyright (c) 2014 The FreeBSD Foundation.
+ * All rights reserved.
+ *
+ * Portions of this software were developed by Konstantin Belousov
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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(s), this list of conditions and the following disclaimer as
+ *    the first lines of this file unmodified other than the possible
+ *    addition of one or more copyright notices.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice(s), 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 COPYRIGHT HOLDER(S) ``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 COPYRIGHT HOLDER(S) 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/cdefs.h>
+__FBSDID("$FreeBSD: stable/10/lib/libc/sys/interposing_table.c 296732 2016-03-12 17:33:40Z kib $");
+
+#include <sys/types.h>
+#include "libc_private.h"
+
+#define	SLOT(a, b) \
+	[INTERPOS_##a] = (interpos_func_t)b
+interpos_func_t __libc_interposing[INTERPOS_MAX] = {
+	SLOT(accept, __sys_accept),
+	SLOT(accept4, __sys_accept4),
+	SLOT(aio_suspend, __sys_aio_suspend),
+	SLOT(close, __sys_close),
+	SLOT(connect, __sys_connect),
+	SLOT(fcntl, __fcntl_compat),
+	SLOT(fsync, __sys_fsync),
+	SLOT(fork, __sys_fork),
+	SLOT(msync, __sys_msync),
+	SLOT(nanosleep, __sys_nanosleep),
+	SLOT(openat, __sys_openat),
+	SLOT(poll, __sys_poll),
+	SLOT(pselect, __sys_pselect),
+	SLOT(read, __sys_read),
+	SLOT(readv, __sys_readv),
+	SLOT(recvfrom, __sys_recvfrom),
+	SLOT(recvmsg, __sys_recvmsg),
+	SLOT(select, __sys_select),
+	SLOT(sendmsg, __sys_sendmsg),
+	SLOT(sendto, __sys_sendto),
+	SLOT(setcontext, __sys_setcontext),
+	SLOT(sigaction, __sys_sigaction),
+	SLOT(sigprocmask, __sys_sigprocmask),
+	SLOT(sigsuspend, __sys_sigsuspend),
+	SLOT(sigwait, __libc_sigwait),
+	SLOT(sigtimedwait, __sys_sigtimedwait),
+	SLOT(sigwaitinfo, __sys_sigwaitinfo),
+	SLOT(swapcontext, __sys_swapcontext),
+	SLOT(system, __libc_system),
+	SLOT(tcdrain, __libc_tcdrain),
+	SLOT(wait4, __sys_wait4),
+	SLOT(write, __sys_write),
+	SLOT(writev, __sys_writev),
+	SLOT(_pthread_mutex_init_calloc_cb, _pthread_mutex_init_calloc_cb_stub),
+	SLOT(spinlock, __libc_spinlock_stub),
+	SLOT(spinunlock, __libc_spinunlock_stub),
+	SLOT(kevent, __sys_kevent),
+	SLOT(wait6, __sys_wait6),
+	SLOT(ppoll, __sys_ppoll),
+	SLOT(map_stacks_exec, __libc_map_stacks_exec),
+};
+#undef SLOT
+
+interpos_func_t *
+__libc_interposing_slot(int interposno)
+{
+
+	return (&__libc_interposing[interposno]);
+}


Property changes on: trunk/lib/libc/sys/interposing_table.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: trunk/lib/libc/sys/intro.2
===================================================================
--- trunk/lib/libc/sys/intro.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/intro.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1980, 1983, 1986, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,9 +27,9 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)intro.2	8.5 (Berkeley) 2/27/95
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/intro.2 307155 2016-10-12 20:19:33Z jilles $
 .\"
-.Dd April 27, 2013
+.Dd September 8, 2016
 .Dt INTRO 2
 .Os
 .Sh NAME
@@ -470,6 +471,10 @@
 the capability allows.
 .It Er 94 ECAPMODE Em "Not permitted in capability mode" .
 The system call or operation is not permitted for capability mode processes.
+.It Er 95 ENOTRECOVERABLE Em "State not recoverable" .
+The state protected by a robust mutex is not recoverable.
+.It Er 96 EOWNERDEAD Em "Previous owner died" .
+The owner of a robust mutex terminated while holding the mutex lock.
 .El
 .Sh DEFINITIONS
 .Bl -tag -width Ds
@@ -482,7 +487,10 @@
 .Xr fork 2 ) .
 The parent process ID of a process is initially the process ID of its creator.
 If the creating process exits,
-the parent process ID of each child is set to the ID of a system process,
+the parent process ID of each child is set to the ID of the calling process's
+reaper (see
+.Xr procctl 2 ) ,
+normally
 .Xr init 8 .
 .It Process Group
 Each active process is a member of a process group that is identified by
@@ -531,7 +539,7 @@
 as the group,
 but is in a different process group.
 Note that when a process exits, the parent process for its children
-is changed to be
+is normally changed to be
 .Xr init 8 ,
 which is in a separate session.
 Not all members of an orphaned process group are necessarily orphaned


Property changes on: trunk/lib/libc/sys/intro.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/ioctl.2
===================================================================
--- trunk/lib/libc/sys/ioctl.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/ioctl.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1980, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -27,9 +28,9 @@
 .\"
 .\"     @(#)ioctl.2	8.2 (Berkeley) 12/11/93
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/ioctl.2 255486 2013-09-12 00:53:38Z bdrewery $
 .\"
-.Dd May 11, 2010
+.Dd September 11, 2013
 .Dt IOCTL 2
 .Os
 .Sh NAME
@@ -40,7 +41,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 +52,7 @@
 .Fn ioctl
 requests.
 The argument
-.Fa d
+.Fa fd
 must be an open file descriptor.
 .Pp
 The third argument to
@@ -116,12 +117,12 @@
 .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.
@@ -128,7 +129,7 @@
 .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


Property changes on: trunk/lib/libc/sys/ioctl.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/issetugid.2
===================================================================
--- trunk/lib/libc/sys/issetugid.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/issetugid.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\"	$OpenBSD: issetugid.2,v 1.7 1997/02/18 00:16:09 deraadt Exp $
 .\"
 .\" Copyright (c) 1980, 1991, 1993
@@ -27,7 +28,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/issetugid.2 165903 2007-01-09 00:28:16Z imp $
 .\"
 .Dd August 25, 1996
 .Dt ISSETUGID 2


Property changes on: trunk/lib/libc/sys/issetugid.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/jail.2
===================================================================
--- trunk/lib/libc/sys/jail.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/jail.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1999 Poul-Henning Kamp.
 .\" Copyright (c) 2009 James Gritton.
 .\" All rights reserved.
@@ -23,7 +24,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/jail.2 301905 2016-06-15 01:49:01Z jamie $
 .\"
 .Dd February 8, 2012
 .Dt JAIL 2
@@ -106,7 +107,7 @@
 the prison, or NULL if none.
 IPv4 addresses must be in network byte order.
 .Pp
-This is equivalent to the
+This is equivalent to, and deprecated in favor of, the
 .Fn jail_set
 system call (see below), with the parameters
 .Va path ,


Property changes on: trunk/lib/libc/sys/jail.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/kenv.2
===================================================================
--- trunk/lib/libc/sys/kenv.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/kenv.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\"
 .\" Copyright (C) 2002 Chad David <davidc at FreeBSD.org>. All rights reserved.
 .\"
@@ -24,9 +25,9 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
 .\" DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/kenv.2 315024 2017-03-10 20:07:38Z vangyzen $
 .\"
-.Dd April 17, 2002
+.Dd February 20, 2017
 .Dt KENV 2
 .Os
 .Sh NAME
@@ -51,30 +52,49 @@
 argument can be one of the following:
 .Bl -tag -width ".Dv KENV_UNSET"
 .It Dv KENV_GET
-Returns the value associated with the named kernel environment variable.
-If the variable is not found, \-1 is returned and
-the global variable
-.Va errno
-is set to
-.Er ENOENT .
-Only the number of bytes available in
+Get the
 .Fa value
-are copied out.
+of the variable with the given
+.Fa name .
+The size of the
+.Fa value
+buffer is given by
+.Fa len ,
+which should be at least
+.Dv KENV_MVALLEN
++ 1 bytes to avoid truncation and to ensure NUL termination.
 .It Dv KENV_SET
-Sets or adds a new kernel environment variable.
+Set or add a variable.
+The
+.Fa name
+and
+.Fa value
+are limited to
+.Dv KENV_MNAMELEN
+and
+.Dv KENV_MVALLEN
+characters, respectively
+.Pq not including the NUL terminator.
+The
+.Fa len
+argument indicates the length of the
+.Fa value
+and must include the NUL terminator.
 This option is only available to the superuser.
 .It Dv KENV_UNSET
-Unsets the kernel environment variable
+Unset the variable with the given
 .Fa name .
-If the variable does not exist, \-1 is returned and
-the global variable
-.Va errno
-is set to
-.Er EINVAL .
+The
+.Fa value
+and
+.Fa len
+arguments are ignored.
 This option is only available to the superuser.
 .It Dv KENV_DUMP
-Dumps as much of the kernel environment as will fit in
-.Fa value .
+Dump as much of the kernel environment as will fit in
+.Fa value ,
+whose size is given in
+.Fa len .
 If
 .Fa value
 is
@@ -81,41 +101,10 @@
 .Dv NULL ,
 .Fn kenv
 will return the number of bytes required to copy out the entire environment.
-.El
-.Pp
 The
 .Fa name
-argument is the name of the environment variable to be affected.
-In the case of
-.Dv KENV_DUMP
-it is ignored.
-.Pp
-The
-.Fa value
-argument contains either the value to set the environment variable
-.Fa name
-to in the case of
-.Dv KENV_SET ,
-or it points to the location where
-.Fn kenv
-should copy return data to in the case of
-.Dv KENV_DUMP
-and
-.Dv KENV_GET .
-If
-.Fa value
-is
-.Dv NULL
-in the case of
-.Dv KENV_DUMP ,
-.Fn kenv
-will return the number of bytes required to copy out the entire environment.
-.Pp
-The
-.Fa len
-argument indicates how many bytes of storage
-.Fa value
-points to.
+is ignored.
+.El
 .Sh RETURN VALUES
 The
 .Fn kenv
@@ -148,23 +137,31 @@
 is less than 1 for a
 .Dv KENV_SET .
 .It Bq Er ENOENT
-no value could be found for
+No value could be found for
 .Fa name
 for a
-.Dv KENV_SET
+.Dv KENV_GET
 or
 .Dv KENV_UNSET .
 .It Bq Er EPERM
-a user other than the superuser attempted to set or unset a kernel
+A user other than the superuser attempted to set or unset a kernel
 environment variable.
 .It Bq Er EFAULT
-bad address was encountered while attempting to copy in user arguments,
+A bad address was encountered while attempting to copy in user arguments
 or copy out value(s).
 .It Bq Er ENAMETOOLONG
-the name of a variable supplied by the user is longer than
+The
+.Fa name
+or the
+.Fa value
+is longer than
 .Dv KENV_MNAMELEN
-or the value of a variable is longer than
-.Dv KENV_MVALLEN .
+or
+.Dv KENV_MVALLEN
+characters, respectively, or
+.Fa len
+did not include the NUL terminator for a
+.Dv KENV_SET .
 .El
 .Sh SEE ALSO
 .Xr kenv 1


Property changes on: trunk/lib/libc/sys/kenv.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: trunk/lib/libc/sys/kevent.c
===================================================================
--- trunk/lib/libc/sys/kevent.c	                        (rev 0)
+++ trunk/lib/libc/sys/kevent.c	2018-06-07 12:22:26 UTC (rev 10509)
@@ -0,0 +1,54 @@
+/* $MidnightBSD$ */
+/*
+ * Copyright (c) 2015 The FreeBSD Foundation.
+ * All rights reserved.
+ *
+ * Portions of this software were developed by Konstantin Belousov
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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(s), this list of conditions and the following disclaimer as
+ *    the first lines of this file unmodified other than the possible
+ *    addition of one or more copyright notices.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice(s), 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 COPYRIGHT HOLDER(S) ``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 COPYRIGHT HOLDER(S) 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/cdefs.h>
+__FBSDID("$FreeBSD: stable/10/lib/libc/sys/kevent.c 281454 2015-04-12 06:52:43Z kib $");
+
+#include <sys/types.h>
+#include <sys/event.h>
+#include <sys/time.h>
+#include "libc_private.h"
+
+__weak_reference(__sys_kevent, __kevent);
+
+#pragma weak kevent
+int
+kevent(int kq, const struct kevent *changelist, int nchanges,
+    struct kevent *eventlist, int nevents, const struct timespec *timeout)
+{
+
+	return (((int (*)(int, const struct kevent *, int,
+	    struct kevent *, int, const struct timespec *))
+	    __libc_interposing[INTERPOS_kevent])(kq, changelist, nchanges,
+	   eventlist, nevents, timeout));
+}


Property changes on: trunk/lib/libc/sys/kevent.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: trunk/lib/libc/sys/kill.2
===================================================================
--- trunk/lib/libc/sys/kill.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/kill.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1980, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,7 +27,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)kill.2	8.3 (Berkeley) 4/19/94
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/kill.2 321146 2017-07-18 18:15:45Z ngie $
 .\"
 .Dd March 15, 2012
 .Dt KILL 2
@@ -71,7 +72,7 @@
 to any process with the same session ID as the sender.
 In addition, if the
 .Va security.bsd.conservative_signals
-.Xr sysctl
+.Xr sysctl 9
 is set to 1, the user is not a super-user, and
 the receiver is set-uid, then
 only job control and terminal control signals may
@@ -141,6 +142,7 @@
 .Xr getpid 2 ,
 .Xr killpg 2 ,
 .Xr sigaction 2 ,
+.Xr sigqueue 2 ,
 .Xr raise 3 ,
 .Xr init 8
 .Sh STANDARDS


Property changes on: trunk/lib/libc/sys/kill.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/kldfind.2
===================================================================
--- trunk/lib/libc/sys/kldfind.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/kldfind.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\"
 .\" Copyright (c) 1999 Chris Costello
 .\" All rights reserved.
@@ -23,7 +24,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/kldfind.2 108028 2002-12-18 09:22:32Z ru $
 .\"
 .Dd March 3, 1999
 .Dt KLDFIND 2


Property changes on: trunk/lib/libc/sys/kldfind.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/kldfirstmod.2
===================================================================
--- trunk/lib/libc/sys/kldfirstmod.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/kldfirstmod.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\"
 .\" Copyright (c) 1999 Chris Costello
 .\" All rights reserved.
@@ -23,7 +24,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/kldfirstmod.2 108028 2002-12-18 09:22:32Z ru $
 .\"
 .Dd March 3, 1999
 .Dt KLDFIRSTMOD 2


Property changes on: trunk/lib/libc/sys/kldfirstmod.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/kldload.2
===================================================================
--- trunk/lib/libc/sys/kldload.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/kldload.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\"
 .\" Copyright (c) 1999 Chris Costello
 .\" All rights reserved.
@@ -23,7 +24,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/kldload.2 115771 2003-06-03 12:29:34Z hmp $
 .\"
 .Dd March 3, 1999
 .Dt KLDLOAD 2


Property changes on: trunk/lib/libc/sys/kldload.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/kldnext.2
===================================================================
--- trunk/lib/libc/sys/kldnext.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/kldnext.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\"
 .\" Copyright (c) 1999 Chris Costello
 .\" All rights reserved.
@@ -23,7 +24,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/kldnext.2 162385 2006-09-17 21:27:35Z ru $
 .\"
 .Dd February 22, 2006
 .Dt KLDNEXT 2


Property changes on: trunk/lib/libc/sys/kldnext.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/kldstat.2
===================================================================
--- trunk/lib/libc/sys/kldstat.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/kldstat.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\"
 .\" Copyright (c) 1999 Chris Costello
 .\" All rights reserved.
@@ -23,9 +24,9 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/kldstat.2 233631 2012-03-28 23:51:06Z jimharris $
 .\"
-.Dd April 23, 2011
+.Dd March 28, 2012
 .Dt KLDSTAT 2
 .Os
 .Sh NAME
@@ -47,7 +48,7 @@
 .Fa stat .
 .Bd -literal
 struct kld_file_stat {
-	int         version;        /* set to sizeof(linker_file_stat) */
+	int         version;    /* set to sizeof(struct kld_file_stat) */
 	char        name[MAXPATHLEN];
 	int         refs;
 	int         id;


Property changes on: trunk/lib/libc/sys/kldstat.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/kldsym.2
===================================================================
--- trunk/lib/libc/sys/kldsym.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/kldsym.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 2001 Chris Costello <chris at FreeBSD.org>
 .\" All rights reserved.
 .\"
@@ -22,7 +23,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/kldsym.2 213573 2010-10-08 12:40:16Z uqs $
 .\"
 .Dd July 26, 2001
 .Dt KLDSYM 2


Property changes on: trunk/lib/libc/sys/kldsym.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/kldunload.2
===================================================================
--- trunk/lib/libc/sys/kldunload.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/kldunload.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\"
 .\" Copyright (c) 1999 Chris Costello
 .\" All rights reserved.
@@ -23,7 +24,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/kldunload.2 186489 2008-12-25 09:15:31Z trhodes $
 .\"
 .Dd December 25, 2008
 .Dt KLDUNLOAD 2


Property changes on: trunk/lib/libc/sys/kldunload.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/kqueue.2
===================================================================
--- trunk/lib/libc/sys/kqueue.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/kqueue.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 2000 Jonathan Lemon
 .\" All rights reserved.
 .\"
@@ -22,9 +23,9 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/kqueue.2 321829 2017-07-31 22:36:03Z asomers $
 .\"
-.Dd February 15, 2012
+.Dd June 22, 2017
 .Dt KQUEUE 2
 .Os
 .Sh NAME
@@ -41,7 +42,7 @@
 .Fn kqueue "void"
 .Ft int
 .Fn kevent "int kq" "const struct kevent *changelist" "int nchanges" "struct kevent *eventlist" "int nevents" "const struct timespec *timeout"
-.Fn EV_SET "&kev" ident filter flags fflags data udata
+.Fn EV_SET "kev" ident filter flags fflags data udata
 .Sh DESCRIPTION
 The
 .Fn kqueue
@@ -162,22 +163,22 @@
 The fields of
 .Fa struct kevent
 are:
-.Bl -tag -width XXXfilter
-.It ident
+.Bl -tag -width "Fa filter"
+.It Fa ident
 Value used to identify this event.
 The exact interpretation is determined by the attached filter,
 but often is a file descriptor.
-.It filter
+.It Fa filter
 Identifies the kernel filter used to process this event.
 The pre-defined
 system filters are described below.
-.It flags
+.It Fa flags
 Actions to perform on the event.
-.It fflags
+.It Fa fflags
 Filter-specific flags.
-.It data
+.It Fa data
 Filter-specific data value.
-.It udata
+.It Fa udata
 Opaque user-defined value passed through the kernel unchanged.
 .El
 .Pp
@@ -184,8 +185,8 @@
 The
 .Va flags
 field can contain the following values:
-.Bl -tag -width XXXEV_ONESHOT
-.It EV_ADD
+.Bl -tag -width EV_DISPATCH
+.It Dv EV_ADD
 Adds the event to the kqueue.
 Re-adding an existing event
 will modify the parameters of the original event, and not result
@@ -192,26 +193,26 @@
 in a duplicate entry.
 Adding an event automatically enables it,
 unless overridden by the EV_DISABLE flag.
-.It EV_ENABLE
+.It Dv EV_ENABLE
 Permit
 .Fn kevent
 to return the event if it is triggered.
-.It EV_DISABLE
+.It Dv EV_DISABLE
 Disable the event so
 .Fn kevent
 will not return it.
 The filter itself is not disabled.
-.It EV_DISPATCH
+.It Dv EV_DISPATCH
 Disable the event source immediately after delivery of an event.
 See
 .Dv EV_DISABLE
 above.
-.It EV_DELETE
+.It Dv EV_DELETE
 Removes the event from the kqueue.
 Events which are attached to
 file descriptors are automatically deleted on the last close of
 the descriptor.
-.It EV_RECEIPT
+.It Dv EV_RECEIPT
 This flag is useful for making bulk changes to a kqueue without draining
 any pending events.
 When passed as input, it forces
@@ -220,20 +221,20 @@
 When a filter is successfully added the
 .Va data
 field will be zero.
-.It EV_ONESHOT
+.It Dv EV_ONESHOT
 Causes the event to return only the first occurrence of the filter
 being triggered.
 After the user retrieves the event from the kqueue,
 it is deleted.
-.It EV_CLEAR
+.It Dv EV_CLEAR
 After the event is retrieved by the user, its state is reset.
 This is useful for filters which report state transitions
 instead of the current state.
 Note that some filters may automatically
 set this flag internally.
-.It EV_EOF
+.It Dv EV_EOF
 Filters may set this flag to indicate filter-specific EOF condition.
-.It EV_ERROR
+.It Dv EV_ERROR
 See
 .Sx RETURN VALUES
 below.
@@ -245,8 +246,8 @@
 and
 .Va data
 fields in the kevent structure.
-.Bl -tag -width EVFILT_SIGNAL
-.It EVFILT_READ
+.Bl -tag -width "Dv EVFILT_PROCDESC"
+.It Dv EVFILT_READ
 Takes a descriptor as the identifier, and returns whenever
 there is data available to read.
 The behavior of the filter is slightly different depending
@@ -265,7 +266,7 @@
 value of the socket buffer.
 This may be overridden with a per-filter low water mark at the
 time the filter is added by setting the
-NOTE_LOWAT
+.Dv NOTE_LOWAT
 flag in
 .Va fflags ,
 and specifying the new low water mark in
@@ -275,7 +276,9 @@
 contains the number of bytes of protocol data available to read.
 .Pp
 If the read direction of the socket has shutdown, then the filter
-also sets EV_EOF in
+also sets
+.Dv EV_EOF
+in
 .Va flags ,
 and returns the socket error (if any) in
 .Va fflags .
@@ -291,9 +294,13 @@
 .Va data
 contains the number of bytes available.
 .Pp
-When the last writer disconnects, the filter will set EV_EOF in
+When the last writer disconnects, the filter will set
+.Dv EV_EOF
+in
 .Va flags .
-This may be cleared by passing in EV_CLEAR, at which point the
+This may be cleared by passing in
+.Dv EV_CLEAR ,
+at which point the
 filter will resume waiting for data to become available before
 returning.
 .It "BPF devices"
@@ -304,7 +311,7 @@
 .Va data
 contains the number of bytes available.
 .El
-.It EVFILT_WRITE
+.It Dv EVFILT_WRITE
 Takes a descriptor as the identifier, and returns whenever
 it is possible to write to the descriptor.
 For sockets, pipes
@@ -312,65 +319,86 @@
 .Va data
 will contain the amount of space remaining in the write buffer.
 The filter will set EV_EOF when the reader disconnects, and for
-the fifo case, this may be cleared by use of EV_CLEAR.
+the fifo case, this may be cleared by use of
+.Dv EV_CLEAR .
 Note that this filter is not supported for vnodes or BPF devices.
 .Pp
 For sockets, the low water mark and socket error handling is
-identical to the EVFILT_READ case.
-.It EVFILT_AIO
-The sigevent portion of the AIO request is filled in, with
-.Va sigev_notify_kqueue
-containing the descriptor of the kqueue that the event should
-be attached to,
-.Va sigev_notify_kevent_flags
-containing the kevent flags which should be EV_ONESHOT, EV_CLEAR or
-EV_DISPATCH,
-.Va sigev_value
-containing the udata value, and
-.Va sigev_notify
-set to SIGEV_KEVENT.
-When the
-.Fn aio_*
-system call is made, the event will be registered
-with the specified kqueue, and the
-.Va ident
-argument set to the
-.Fa struct aiocb
-returned by the
-.Fn aio_*
-system call.
-The filter returns under the same conditions as aio_error.
-.It EVFILT_VNODE
+identical to the
+.Dv EVFILT_READ
+case.
+.It Dv EVFILT_AIO
+Events for this filter are not registered with
+.Fn kevent
+directly but are registered via the
+.Va aio_sigevent
+member of an asychronous I/O request when it is scheduled via an asychronous I/O
+system call such as
+.Fn aio_read .
+The filter returns under the same conditions as
+.Fn aio_error .
+For more details on this filter see
+.Xr sigevent 3 and
+.Xr aio 4 .
+.It Dv EVFILT_VNODE
 Takes a file descriptor as the identifier and the events to watch for in
 .Va fflags ,
 and returns when one or more of the requested events occurs on the descriptor.
 The events to monitor are:
-.Bl -tag -width XXNOTE_RENAME
-.It NOTE_DELETE
+.Bl -tag -width "Dv NOTE_CLOSE_WRITE"
+.It Dv NOTE_ATTRIB
+The file referenced by the descriptor had its attributes changed.
+.It Dv NOTE_CLOSE
+A file descriptor referencing the monitored file, was closed.
+The closed file descriptor did not have write access.
+.It Dv NOTE_CLOSE_WRITE
+A file descriptor referencing the monitored file, was closed.
+The closed file descriptor had write access.
+.Pp
+This note, as well as
+.Dv NOTE_CLOSE ,
+are not activated when files are closed forcibly by
+.Xr unmount 2 or
+.Xr revoke 2 .
+Instead,
+.Dv NOTE_REVOKE
+is sent for such events.
+.It Dv NOTE_DELETE
 The
 .Fn unlink
-system call
-was called on the file referenced by the descriptor.
-.It NOTE_WRITE
-A write occurred on the file referenced by the descriptor.
-.It NOTE_EXTEND
-The file referenced by the descriptor was extended.
-.It NOTE_ATTRIB
-The file referenced by the descriptor had its attributes changed.
-.It NOTE_LINK
+system call was called on the file referenced by the descriptor.
+.It Dv NOTE_EXTEND
+For regular file, the file referenced by the descriptor was extended.
+.Pp
+For directory, reports that a directory entry was added or removed,
+as the result of rename operation.
+The
+.Dv NOTE_EXTEND
+event is not reported when a name is changed inside the directory.
+.It Dv NOTE_LINK
 The link count on the file changed.
-.It NOTE_RENAME
+In particular, the
+.Dv NOTE_LINK
+event is reported if a subdirectory was created or deleted inside
+the directory referenced by the descriptor.
+.It Dv NOTE_OPEN
+The file referenced by the descriptor was opened.
+.It Dv NOTE_READ
+A read occurred on the file referenced by the descriptor.
+.It Dv NOTE_RENAME
 The file referenced by the descriptor was renamed.
-.It NOTE_REVOKE
+.It Dv NOTE_REVOKE
 Access to the file was revoked via
 .Xr revoke 2
 or the underlying file system was unmounted.
+.It Dv NOTE_WRITE
+A write occurred on the file referenced by the descriptor.
 .El
 .Pp
 On return,
 .Va fflags
 contains the events which triggered the filter.
-.It EVFILT_PROC
+.It Dv EVFILT_PROC
 Takes the process ID to monitor as the identifier and the events to watch for
 in
 .Va fflags ,
@@ -377,37 +405,48 @@
 and returns when the process performs one or more of the requested events.
 If a process can normally see another process, it can attach an event to it.
 The events to monitor are:
-.Bl -tag -width XXNOTE_TRACKERR
-.It NOTE_EXIT
+.Bl -tag -width "Dv NOTE_TRACKERR"
+.It Dv NOTE_EXIT
 The process has exited.
 The exit status will be stored in
 .Va data .
-.It NOTE_FORK
+.It Dv NOTE_FORK
 The process has called
 .Fn fork .
-.It NOTE_EXEC
+.It Dv NOTE_EXEC
 The process has executed a new process via
 .Xr execve 2
-or similar call.
-.It NOTE_TRACK
+or a similar call.
+.It Dv NOTE_TRACK
 Follow a process across
 .Fn fork
 calls.
-The parent process will return with NOTE_TRACK set in the
+The parent process registers a new kevent to monitor the child process
+using the same
 .Va fflags
-field, while the child process will return with NOTE_CHILD set in
+as the original event.
+The child process will signal an event with
+.Dv NOTE_CHILD
+set in
 .Va fflags
 and the parent PID in
 .Va data .
-.It NOTE_TRACKERR
-This flag is returned if the system was unable to attach an event to
-the child process, usually due to resource limitations.
+.Pp
+If the parent process fails to register a new kevent
+.Pq usually due to resource limitations ,
+it will signal an event with
+.Dv NOTE_TRACKERR
+set in
+.Va fflags ,
+and the child process will not signal a
+.Dv NOTE_CHILD
+event.
 .El
 .Pp
 On return,
 .Va fflags
 contains the events which triggered the filter.
-.It EVFILT_SIGNAL
+.It Dv EVFILT_SIGNAL
 Takes the signal number to monitor as the identifier and returns
 when the given signal is delivered to the process.
 This coexists with the
@@ -417,20 +456,28 @@
 facilities, and has a lower precedence.
 The filter will record
 all attempts to deliver a signal to a process, even if the signal has
-been marked as SIG_IGN.
+been marked as
+.Dv SIG_IGN ,
+except for the
+.Dv SIGCHLD
+signal, which, if ignored, won't be recorded by the filter.
 Event notification happens after normal
 signal delivery processing.
 .Va data
 returns the number of times the signal has occurred since the last call to
 .Fn kevent .
-This filter automatically sets the EV_CLEAR flag internally.
-.It EVFILT_TIMER
+This filter automatically sets the
+.Dv EV_CLEAR
+flag internally.
+.It Dv EVFILT_TIMER
 Establishes an arbitrary timer identified by
 .Va ident .
 When adding a timer,
 .Va data
-specifies the timeout period in milliseconds.
-The timer will be periodic unless EV_ONESHOT is specified.
+specifies the timeout period.
+The timer will be periodic unless
+.Dv EV_ONESHOT
+is specified.
 On return,
 .Va data
 contains the number of times the timeout has expired since the last call to
@@ -440,9 +487,25 @@
 which is controlled by the
 .Va kern.kq_calloutmax
 sysctl.
+.Bl -tag -width "Dv NOTE_USECONDS"
+.It Dv NOTE_SECONDS
+.Va data
+is in seconds.
+.It Dv NOTE_MSECONDS
+.Va data
+is in milliseconds.
+.It Dv NOTE_USECONDS
+.Va data
+is in microseconds.
+.It Dv NOTE_NSECONDS
+.Va data
+is in nanoseconds.
+.El
 .Pp
-On return,
+If
 .Va fflags
+is not set, the default is milliseconds. On return,
+.Va fflags
 contains the events which triggered the filter.
 .It Dv EVFILT_USER
 Establishes a user event identified by
@@ -452,7 +515,7 @@
 The lower 24 bits of the
 .Va fflags
 may be used for user defined flags and manipulated using the following:
-.Bl -tag -width XXNOTE_FFLAGSMASK
+.Bl -tag -width "Dv NOTE_FFLAGSMASK"
 .It Dv NOTE_FFNOP
 Ignore the input
 .Va fflags .
@@ -462,7 +525,7 @@
 .It Dv NOTE_FFOR
 Bitwise OR
 .Va fflags .
-.It Dv NOTE_COPY
+.It Dv NOTE_FFCOPY
 Copy
 .Va fflags .
 .It Dv NOTE_FFCTRLMASK
@@ -474,7 +537,7 @@
 .El
 .Pp
 A user event is triggered for output with the following:
-.Bl -tag -width XXNOTE_FFLAGSMASK
+.Bl -tag -width "Dv NOTE_FFLAGSMASK"
 .It Dv NOTE_TRIGGER
 Cause the event to be triggered.
 .El
@@ -483,6 +546,16 @@
 .Va fflags
 contains the users defined flags in the lower 24 bits.
 .El
+.Sh CANCELLATION BEHAVIOUR
+If
+.Fa nevents
+is non-zero, i.e. the function is potentially blocking, the call
+is a cancellation point.
+Otherwise, i.e. if
+.Fa nevents
+is zero, the call is not cancellable.
+Cancellation can only occur before any changes are made to the kqueue,
+or when the call was blocked and no changes to the queue were requested.
 .Sh RETURN VALUES
 The
 .Fn kqueue
@@ -518,6 +591,57 @@
 If the time limit expires, then
 .Fn kevent
 returns 0.
+.Sh EXAMPLES
+.Bd -literal -compact
+#include <sys/types.h>
+#include <sys/event.h>
+#include <sys/time.h>
+#include <err.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+int
+main(int argc, char **argv)
+{
+    struct kevent event;    /* Event we want to monitor */
+    struct kevent tevent;   /* Event triggered */
+    int kq, fd, ret;
+
+    if (argc != 2)
+	err(EXIT_FAILURE, "Usage: %s path\en", argv[0]);
+    fd = open(argv[1], O_RDONLY);
+    if (fd == -1)
+	err(EXIT_FAILURE, "Failed to open '%s'", argv[1]);
+
+    /* Create kqueue. */
+    kq = kqueue();
+    if (kq == -1)
+	err(EXIT_FAILURE, "kqueue() failed");
+
+    /* Initialize kevent structure. */
+    EV_SET(&event, fd, EVFILT_VNODE, EV_ADD | EV_CLEAR, NOTE_WRITE,
+	0, NULL);
+    /* Attach event to the kqueue. */
+    ret = kevent(kq, &event, 1, NULL, 0, NULL);
+    if (ret == -1)
+	err(EXIT_FAILURE, "kevent register");
+    if (event.flags & EV_ERROR)
+	errx(EXIT_FAILURE, "Event error: %s", strerror(event.data));
+
+    for (;;) {
+	/* Sleep until something happens. */
+	ret = kevent(kq, NULL, 0, &tevent, 1, NULL);
+	if (ret == -1) {
+	    err(EXIT_FAILURE, "kevent wait");
+	} else if (ret > 0) {
+	    printf("Something was written in '%s'\en", argv[1]);
+	}
+    }
+}
+.Ed
 .Sh ERRORS
 The
 .Fn kqueue
@@ -546,6 +670,8 @@
 .It Bq Er EINTR
 A signal was delivered before the timeout expired and before any
 events were placed on the kqueue for return.
+.It Bq Er EINTR
+A cancellation request was delivered to the thread, but not yet handled.
 .It Bq Er EINVAL
 The specified time limit or filter is invalid.
 .It Bq Er ENOENT
@@ -560,6 +686,14 @@
 .It Bq Er ESRCH
 The specified process to attach to does not exist.
 .El
+.Pp
+When
+.Fn kevent
+call fails with
+.Er EINTR
+error, all changes in the
+.Fa changelist
+have been applied.
 .Sh SEE ALSO
 .Xr aio_error 2 ,
 .Xr aio_read 2 ,
@@ -569,6 +703,7 @@
 .Xr select 2 ,
 .Xr sigaction 2 ,
 .Xr write 2 ,
+.Xr pthread_setcancelstate 3 ,
 .Xr signal 3
 .Sh HISTORY
 The


Property changes on: trunk/lib/libc/sys/kqueue.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/kse.2
===================================================================
--- trunk/lib/libc/sys/kse.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/kse.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 2002 Packet Design, LLC.
 .\" All rights reserved.
 .\"
@@ -33,7 +34,7 @@
 .\" THE USE OF THIS SOFTWARE, EVEN IF PACKET DESIGN IS ADVISED OF
 .\" THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/kse.2 233669 2012-03-29 16:20:20Z joel $
 .\"
 .Dd February 13, 2007
 .Dt KSE 2
@@ -676,4 +677,4 @@
 .An "Archie Cobbs" Aq archie at FreeBSD.org .
 .Sh BUGS
 The KSE code is
-.Ud .
+.Ud


Property changes on: trunk/lib/libc/sys/kse.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/ktrace.2
===================================================================
--- trunk/lib/libc/sys/ktrace.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/ktrace.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,9 +27,9 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)ktrace.2	8.1 (Berkeley) 6/4/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/ktrace.2 297929 2016-04-13 16:45:17Z brooks $
 .\"
-.Dd October 9, 2011
+.Dd March 31, 2016
 .Dt KTRACE 2
 .Os
 .Sh NAME
@@ -67,12 +68,12 @@
 argument specifies the requested ktrace operation.
 The defined operations are:
 .Bl -column KTRFLAG_DESCENDXXX -offset indent
-.It "KTROP_SET	Enable trace points specified in"
+.It KTROP_SET Ta "Enable trace points specified in"
 .Fa trpoints .
-.It "KTROP_CLEAR	Disable trace points specified in
+.It KTROP_CLEAR Ta "Disable trace points specified in"
 .Fa trpoints .
-.It "KTROP_CLEARFILE	Stop all tracing."
-.It "KTRFLAG_DESCEND	The tracing change should apply to the"
+.It KTROP_CLEARFILE Ta "Stop all tracing."
+.It KTRFLAG_DESCEND Ta "The tracing change should apply to the"
 specified process and all its current children.
 .El
 .Pp
@@ -81,19 +82,22 @@
 argument specifies the trace points of interest.
 The defined trace points are:
 .Bl -column KTRFAC_PROCCTORXXX -offset indent
-.It "KTRFAC_SYSCALL	Trace system calls."
-.It "KTRFAC_SYSRET	Trace return values from system calls."
-.It "KTRFAC_NAMEI	Trace name lookup operations."
-.It "KTRFAC_GENIO	Trace all I/O (note that this option can"
+.It KTRFAC_SYSCALL Ta "Trace system calls."
+.It KTRFAC_SYSRET Ta "Trace return values from system calls."
+.It KTRFAC_NAMEI Ta "Trace name lookup operations."
+.It KTRFAC_GENIO Ta "Trace all I/O (note that this option can"
 generate much output).
-.It "KTRFAC_PSIG	Trace posted signals."
-.It "KTRFAC_CSW	Trace context switch points."
-.It "KTRFAC_USER	Trace application-specific events."
-.It "KTRFAC_STRUCT	Trace certain data structures."
-.It "KTRFAC_SYSCTL	Trace sysctls."
-.It "KTRFAC_PROCCTOR	Trace process construction."
-.It "KTRFAC_PROCDTOR	Trace process destruction."
-.It "KTRFAC_INHERIT	Inherit tracing to future children."
+.It KTRFAC_PSIG Ta "Trace posted signals."
+.It KTRFAC_CSW Ta "Trace context switch points."
+.It KTRFAC_USER Ta "Trace application-specific events."
+.It KTRFAC_STRUCT Ta "Trace certain data structures."
+.It KTRFAC_SYSCTL Ta "Trace sysctls."
+.It KTRFAC_PROCCTOR Ta "Trace process construction."
+.It KTRFAC_PROCDTOR Ta "Trace process destruction."
+.It KTRFAC_CAPFAIL Ta "Trace capability failures."
+.It KTRFAC_FAULT Ta "Trace page faults."
+.It KTRFAC_FAULTEND Ta "Trace the end of page faults."
+.It KTRFAC_INHERIT Ta "Inherit tracing to future children."
 .El
 .Pp
 Each tracing event outputs a record composed of a generic header
@@ -101,12 +105,12 @@
 The generic header is:
 .Bd -literal
 struct ktr_header {
-	int	ktr_len;		/* length of buf */
-	short	ktr_type;		/* trace record type */
-	pid_t	ktr_pid;		/* process id */
-	char	ktr_comm[MAXCOMLEN+1];	/* command name */
-	struct	timeval ktr_time;	/* timestamp */
-	intptr_t	ktr_tid;	/* was ktr_buffer */
+	int		ktr_len;		/* length of buf */
+	short		ktr_type;		/* trace record type */
+	pid_t		ktr_pid;		/* process id */
+	char		ktr_comm[MAXCOMLEN+1];	/* command name */
+	struct timeval	ktr_time;		/* timestamp */
+	intptr_t	ktr_tid;		/* was ktr_buffer */
 };
 .Ed
 .Pp


Property changes on: trunk/lib/libc/sys/ktrace.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/link.2
===================================================================
--- trunk/lib/libc/sys/link.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/link.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1980, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,7 +27,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)link.2	8.3 (Berkeley) 1/12/94
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/link.2 195763 2009-07-19 16:48:25Z jilles $
 .\"
 .Dd April 10, 2008
 .Dt LINK 2


Property changes on: trunk/lib/libc/sys/link.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/lio_listio.2
===================================================================
--- trunk/lib/libc/sys/lio_listio.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/lio_listio.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 2003 Tim J. Robbins
 .\" All rights reserved.
 .\"
@@ -22,9 +23,9 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/lio_listio.2 303325 2016-07-25 23:38:14Z jhb $
 .\"
-.Dd January 12, 2003
+.Dd July 15, 2016
 .Dt LIO_LISTIO 2
 .Os
 .Sh NAME
@@ -83,15 +84,53 @@
 .Fa mode
 is
 .Dv LIO_NOWAIT ,
-the requests are processed asynchronously, and the signal specified by
 .Fa sig
-is sent when all operations have completed.
+can be used to request asynchronous notification when all operations have
+completed.
 If
 .Fa sig
 is
 .Dv NULL ,
-the calling process is not notified of I/O completion.
+no notification is sent.
 .Pp
+For
+.Dv SIGEV_KEVENT
+notifications,
+the posted kevent will contain:
+.Bl -column ".Va filter"
+.It Sy Member Ta Sy Value
+.It Va ident Ta Fa list
+.It Va filter Ta Dv EVFILT_LIO
+.It Va udata Ta
+value stored in
+.Fa sig->sigev_value
+.El
+.Pp
+For
+.Dv SIGEV_SIGNO
+and
+.Dv SIGEV_THREAD_ID
+notifications,
+the information for the queued signal will include
+.Dv SI_ASYNCIO
+in the
+.Va si_code
+field and the value stored in
+.Fa sig->sigev_value
+in the
+.Va si_value
+field.
+.Pp
+For
+.Dv SIGEV_THREAD
+notifications,
+the value stored in
+.Fa sig->sigev_value
+is passed to the
+.Fa sig->sigev_notify_function
+as described in
+.Xr sigevent 3 .
+.Pp
 The order in which the requests are carried out is not specified;
 in particular, there is no guarantee that they will be executed in
 the order 0, 1, ...,
@@ -136,6 +175,10 @@
 .Fa nent
 is greater than
 .Dv AIO_LISTIO_MAX .
+.It Bq Er EINVAL
+The asynchronous notification method in
+.Fa sig->sigev_notify
+is invalid or not supported.
 .It Bq Er EINTR
 A signal interrupted the system call before it could be completed.
 .It Bq Er EIO
@@ -166,6 +209,7 @@
 .Xr aio_write 2 ,
 .Xr read 2 ,
 .Xr write 2 ,
+.Xr sigevent 3 ,
 .Xr siginfo 3 ,
 .Xr aio 4
 .Sh STANDARDS


Property changes on: trunk/lib/libc/sys/lio_listio.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/listen.2
===================================================================
--- trunk/lib/libc/sys/listen.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/listen.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1983, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,9 +27,9 @@
 .\" SUCH DAMAGE.
 .\"
 .\"	From: @(#)listen.2	8.2 (Berkeley) 12/11/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/listen.2 269045 2014-07-24 05:59:32Z kevlo $
 .\"
-.Dd August 29, 2005
+.Dd July 15, 2014
 .Dt LISTEN 2
 .Os
 .Sh NAME
@@ -102,15 +103,15 @@
 The
 .Xr sysctl 3
 MIB variable
-.Va kern.ipc.somaxconn
+.Va kern.ipc.soacceptqueue
 specifies a hard limit on
 .Fa backlog ;
 if a value greater than
-.Va kern.ipc.somaxconn
+.Va kern.ipc.soacceptqueue
 or less than zero is specified,
 .Fa backlog
 is silently forced to
-.Va kern.ipc.somaxconn .
+.Va kern.ipc.soacceptqueue .
 .Sh INTERACTION WITH ACCEPT FILTERS
 When accept filtering is used on a socket, a second queue will
 be used to hold sockets that have connected, but have not yet
@@ -139,6 +140,9 @@
 The argument
 .Fa s
 is not a valid descriptor.
+.It Bq Er EDESTADDRREQ
+The socket is not bound to a local address, and the protocol does not
+support listening on an unbound socket.
 .It Bq Er EINVAL
 The socket is already connected, or in the process of being connected.
 .It Bq Er ENOTSOCK
@@ -168,3 +172,17 @@
 .Fa backlog
 to request the maximum allowable value, was introduced in
 .Fx 2.2 .
+The
+.Va kern.ipc.somaxconn
+.Xr sysctl 3
+has been replaced with
+.Va kern.ipc.soacceptqueue
+in
+.Fx 10.0
+to prevent confusion about its actual functionality.
+The original
+.Xr sysctl 3
+.Va kern.ipc.somaxconn
+is still available but hidden from a
+.Xr sysctl 3
+-a output so that existing applications and scripts continue to work.


Property changes on: trunk/lib/libc/sys/listen.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/lseek.2
===================================================================
--- trunk/lib/libc/sys/lseek.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/lseek.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1980, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,7 +27,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)lseek.2	8.3 (Berkeley) 4/19/94
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/lseek.2 236042 2012-05-26 05:25:55Z kib $
 .\"
 .Dd May 26, 2012
 .Dt LSEEK 2


Property changes on: trunk/lib/libc/sys/lseek.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/lseek.c
===================================================================
--- trunk/lib/libc/sys/lseek.c	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/lseek.c	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * Copyright (c) 1992, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -31,7 +32,7 @@
 static char sccsid[] = "@(#)lseek.c	8.1 (Berkeley) 6/17/93";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__MBSDID("$FreeBSD: src/lib/libc/sys/lseek.c,v 1.7 2007/07/04 23:27:38 peter Exp $");
+__FBSDID("$FreeBSD: stable/10/lib/libc/sys/lseek.c 171219 2007-07-04 23:27:38Z peter $");
 
 #include <sys/types.h>
 #include <sys/syscall.h>
@@ -49,7 +50,7 @@
 	int	whence;
 {
 
-	if (__getosreldate() >= 4013)
+	if (__getosreldate() >= 700051)
 		return(__sys_lseek(fd, offset, whence));
 	else
 		return(__sys_freebsd6_lseek(fd, 0, offset, whence));

Modified: trunk/lib/libc/sys/madvise.2
===================================================================
--- trunk/lib/libc/sys/madvise.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/madvise.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,9 +27,9 @@
 .\" SUCH DAMAGE.
 .\"
 .\"	@(#)madvise.2	8.1 (Berkeley) 6/9/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/madvise.2 288292 2015-09-27 04:17:08Z alc $
 .\"
-.Dd July 19, 1996
+.Dd July 12, 2015
 .Dt MADVISE 2
 .Os
 .Sh NAME
@@ -50,7 +51,10 @@
 to describe it to the system.
 The
 .Fn posix_madvise
-interface is identical and is provided for standards conformance.
+interface is identical, except it returns an error number on error and does
+not modify
+.Va errno ,
+and is provided for standards conformance.
 .Pp
 The known behaviors are:
 .Bl -tag -width MADV_SEQUENTIAL
@@ -76,9 +80,9 @@
 into the calling process.
 .It Dv MADV_DONTNEED
 Allows the VM system to decrease the in-memory priority
-of pages in the specified range.
-Additionally future references to
-this address range will incur a page fault.
+of pages in the specified address range.
+Consequently, future references to this address range are more likely
+to incur a page fault.
 .It Dv MADV_FREE
 Gives the VM system the freedom to free pages,
 and tells the system that information in the specified page range


Property changes on: trunk/lib/libc/sys/madvise.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/mincore.2
===================================================================
--- trunk/lib/libc/sys/mincore.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/mincore.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,7 +27,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"	@(#)mincore.2	8.1 (Berkeley) 6/9/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/mincore.2 177680 2008-03-28 04:29:27Z ps $
 .\"
 .Dd January 17, 2003
 .Dt MINCORE 2


Property changes on: trunk/lib/libc/sys/mincore.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/minherit.2
===================================================================
--- trunk/lib/libc/sys/minherit.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/minherit.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,4 +1,5 @@
 .\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/minherit.2 319278 2017-05-31 05:11:28Z delphij $
 .\"
 .\" Copyright (c) 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +30,7 @@
 .\"
 .\"	@(#)minherit.2	8.1 (Berkeley) 6/9/93
 .\"
-.Dd October 30, 2007
+.Dd March 15, 2017
 .Dt MINHERIT 2
 .Os
 .Sh NAME
@@ -91,6 +92,11 @@
 after the parent forks and there is no way to get the previous
 shared-backing-store mapping without unmapping and remapping the address
 space in the parent.
+.It Dv INHERIT_ZERO
+This option causes the address space in question to be mapped as new
+anonymous pages,
+which would be initialized to all zero bytes,
+in the child process.
 .El
 .Sh RETURN VALUES
 .Rv -std minherit
@@ -130,6 +136,13 @@
 .Ox
 and then in
 .Fx 2.2 .
+.Pp
+The
+.Dv INHERIT_ZERO
+support first appeared in
+.Ox 5.6
+and then in
+.Fx 12.0 .
 .Sh BUGS
 Once you set inheritance to
 .Dv MAP_PRIVATE


Property changes on: trunk/lib/libc/sys/minherit.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/mkdir.2
===================================================================
--- trunk/lib/libc/sys/mkdir.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/mkdir.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1983, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,7 +27,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)mkdir.2	8.2 (Berkeley) 12/11/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/mkdir.2 180113 2008-06-30 08:46:09Z danger $
 .\"
 .Dd June 26, 2008
 .Dt MKDIR 2


Property changes on: trunk/lib/libc/sys/mkdir.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/mkfifo.2
===================================================================
--- trunk/lib/libc/sys/mkfifo.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/mkfifo.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1990, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,7 +27,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"	@(#)mkfifo.2	8.1 (Berkeley) 6/4/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/mkfifo.2 178245 2008-04-16 13:03:12Z kib $
 .\"
 .Dd April 10, 2008
 .Dt MKFIFO 2


Property changes on: trunk/lib/libc/sys/mkfifo.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/mknod.2
===================================================================
--- trunk/lib/libc/sys/mknod.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/mknod.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1980, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,7 +27,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)mknod.2	8.1 (Berkeley) 6/4/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/mknod.2 217484 2011-01-16 21:59:50Z jilles $
 .\"
 .Dd January 16, 2011
 .Dt MKNOD 2


Property changes on: trunk/lib/libc/sys/mknod.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/mlock.2
===================================================================
--- trunk/lib/libc/sys/mlock.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/mlock.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,9 +27,9 @@
 .\" SUCH DAMAGE.
 .\"
 .\"	@(#)mlock.2	8.2 (Berkeley) 12/11/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/mlock.2 266952 2014-06-01 18:41:33Z bjk $
 .\"
-.Dd December 25, 2012
+.Dd May 17, 2014
 .Dt MLOCK 2
 .Os
 .Sh NAME
@@ -91,14 +92,21 @@
 .Pp
 Since physical memory is a potentially scarce resource, processes are
 limited in how much they can lock down.
-A single process can
+The amount of memory that a single process can
 .Fn mlock
-the minimum of
-a system-wide ``wired pages'' limit
+is limited by both the per-process
+.Dv RLIMIT_MEMLOCK
+resource limit and the
+system-wide
+.Dq wired pages
+limit
+.Va vm.max_wired .
 .Va vm.max_wired
-and the per-process
-.Li RLIMIT_MEMLOCK
-resource limit.
+applies to the system as a whole, so the amount available to a single
+process at any given time is the difference between
+.Va vm.max_wired
+and
+.Va vm.stats.vm.v_wire_count .
 .Pp
 If
 .Va security.bsd.unprivileged_mlock
@@ -138,7 +146,12 @@
 .It Bq Er EINVAL
 The address given is not page aligned or the length is negative.
 .It Bq Er ENOMEM
-Some portion of the indicated address range is not allocated.
+Some or all of the address range specified by the addr and len
+arguments does not correspond to valid mapped pages in the address space
+of the process.
+.It Bq Er ENOMEM
+Locking the pages mapped by the specified range would exceed a limit on
+the amount of memory that the process may lock.
 .El
 .Sh "SEE ALSO"
 .Xr fork 2 ,


Property changes on: trunk/lib/libc/sys/mlock.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/mlockall.2
===================================================================
--- trunk/lib/libc/sys/mlockall.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/mlockall.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\"	$NetBSD: mlockall.2,v 1.11 2003/04/16 13:34:54 wiz Exp $
 .\"
 .\" Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -28,7 +29,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/mlockall.2 244679 2012-12-25 13:43:01Z zont $
 .\"
 .Dd December 25, 2012
 .Dt MLOCKALL 2


Property changes on: trunk/lib/libc/sys/mlockall.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/mmap.2
===================================================================
--- trunk/lib/libc/sys/mmap.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/mmap.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,9 +27,9 @@
 .\" SUCH DAMAGE.
 .\"
 .\"	@(#)mmap.2	8.4 (Berkeley) 5/11/95
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/mmap.2 321717 2017-07-30 10:36:20Z kib $
 .\"
-.Dd March 18, 2012
+.Dd June 22, 2017
 .Dt MMAP 2
 .Os
 .Sh NAME
@@ -97,7 +98,36 @@
 argument by
 .Em or Ns 'ing
 the following values:
-.Bl -tag -width MAP_HASSEMAPHORE
+.Bl -tag -width MAP_PREFAULT_READ
+.It Dv MAP_32BIT
+Request a region in the first 2GB of the current process's address space.
+If a suitable region cannot be found,
+.Fn mmap
+will fail.
+This flag is only available on 64-bit platforms.
+.It Dv MAP_ALIGNED Ns Pq Fa n
+Align the region on a requested boundary.
+If a suitable region cannot be found,
+.Fn mmap
+will fail.
+The
+.Fa n
+argument specifies the binary logarithm of the desired alignment.
+.It Dv MAP_ALIGNED_SUPER
+Align the region to maximize the potential use of large
+.Pq Dq super
+pages.
+If a suitable region cannot be found,
+.Fn mmap
+will fail.
+The system will choose a suitable page size based on the size of
+mapping.
+The page size used as well as the alignment of the region may both be
+affected by properties of the file being mapped.
+In particular,
+the physical address of existing pages of a file may require a specific
+alignment.
+The region is not guaranteed to be aligned on any specific boundary.
 .It Dv MAP_ANON
 Map anonymous memory not associated with any specific file.
 The file descriptor used for creating
@@ -112,6 +142,12 @@
 This flag is identical to
 .Dv MAP_ANON
 and is provided for compatibility.
+.It Dv MAP_EXCL
+This flag can only be used in combination with
+.Dv MAP_FIXED .
+Please see the definition of
+.Dv MAP_FIXED
+for the description of its effect.
 .It Dv MAP_FIXED
 Do not permit the system to select a different address than the one
 specified.
@@ -123,25 +159,36 @@
 is specified,
 .Fa addr
 must be a multiple of the pagesize.
-If a
+If
+.Dv MAP_EXCL
+is not specified, a successfull
 .Dv MAP_FIXED
-request is successful, the mapping established by
-.Fn mmap
-replaces any previous mappings for the process' pages in the range from
+request replaces any previous mappings for the process'
+pages in the range from
 .Fa addr
 to
 .Fa addr
 +
 .Fa len .
-Use of this option is discouraged.
-.It Dv MAP_HASSEMAPHORE
-Notify the kernel that the region may contain semaphores and that special
-handling may be necessary.
-.It Dv MAP_INHERIT
-This flag never operated as advertised and is no longer supported.
-Please refer to
-.Xr minherit 2
-for further information.
+In contrast, if
+.Dv MAP_EXCL
+is specified, the request will fail if a mapping
+already exists within the range.
+.It Dv MAP_GUARD
+Instead of a mapping, create a guard of the specified size.
+Guards allow a process to create reservations in its address space,
+which can later be replaced by actual mappings.
+.Pp
+.Fa mmap
+will not create mappings in the address range of a guard unless
+the request specifies
+.Dv MAP_FIXED .
+Guards can be destroyed with
+.Xr munmap 2 .
+Any memory access by a thread to the guarded range results
+in the delivery of a
+.Dv SIGSEGV
+signal to that thread.
 .It Dv MAP_NOCORE
 Region is not included in a core file.
 .It Dv MAP_NOSYNC
@@ -244,6 +291,7 @@
 .Dv PROT_READ
 and
 .Dv PROT_WRITE .
+.Pp
 This option creates
 a memory region that grows to at most
 .Fa len
@@ -254,6 +302,12 @@
 bytes.
 The bottom of the stack at maximum growth is the starting
 address returned by the call.
+.Pp
+Stacks created with
+.Dv MAP_STACK
+automatically grow.
+Guards prevent inadvertent use of the regions into which those
+stacks can grow without requiring mapping the whole stack in advance.
 .El
 .Pp
 The
@@ -261,19 +315,30 @@
 system call does not unmap pages, see
 .Xr munmap 2
 for further information.
-.Pp
-The current design does not allow a process to specify the location of
-swap space.
-In the future we may define an additional mapping type,
-.Dv MAP_SWAP ,
-in which
-the file descriptor argument specifies a file or device to which swapping
-should be done.
 .Sh NOTES
 Although this implementation does not impose any alignment restrictions on
 the
 .Fa offset
 argument, a portable program must only use page-aligned values.
+.Pp
+Large page mappings require that the pages backing an object be
+aligned in matching blocks in both the virtual address space and RAM.
+The system will automatically attempt to use large page mappings when
+mapping an object that is already backed by large pages in RAM by
+aligning the mapping request in the virtual address space to match the
+alignment of the large physical pages.
+The system may also use large page mappings when mapping portions of an
+object that are not yet backed by pages in RAM.
+The
+.Dv MAP_ALIGNED_SUPER
+flag is an optimization that will align the mapping request to the
+size of a large page similar to
+.Dv MAP_ALIGNED ,
+except that the system will override this alignment if an object already
+uses large pages so that the mapping will be consistent with the existing
+large pages.
+This flag is mostly useful for maximizing the use of large pages on the
+first mapping of objects that do not yet have pages present in RAM.
 .Sh RETURN VALUES
 Upon successful completion,
 .Fn mmap
@@ -314,6 +379,30 @@
 argument
 is not a valid open file descriptor.
 .It Bq Er EINVAL
+An invalid value was passed in the
+.Fa prot
+argument.
+.It Bq Er EINVAL
+An undefined option was set in the
+.Fa flags
+argument.
+.It Bq Er EINVAL
+Both
+.Dv MAP_PRIVATE
+and
+.Dv MAP_SHARED
+were specified.
+.It Bq Er EINVAL
+None of
+.Dv MAP_ANON ,
+.Dv MAP_GUARD ,
+.Dv MAP_PRIVATE ,
+.Dv MAP_SHARED ,
+or
+.Dv MAP_STACK
+was specified.
+At least one of these flags must be included.
+.It Bq Er EINVAL
 .Dv MAP_FIXED
 was specified and the
 .Fa addr
@@ -320,11 +409,22 @@
 argument was not page aligned, or part of the desired address space
 resides out of the valid address space for a user process.
 .It Bq Er EINVAL
+Both
+.Dv MAP_FIXED
+and
+.Dv MAP_32BIT
+were specified and part of the desired address space resides outside
+of the first 2GB of user address space.
+.It Bq Er EINVAL
 The
 .Fa len
 argument
 was equal to zero.
 .It Bq Er EINVAL
+.Dv MAP_ALIGNED
+was specified and the desired alignment was either larger than the
+virtual address size of the machine or smaller than a page.
+.It Bq Er EINVAL
 .Dv MAP_ANON
 was specified and the
 .Fa fd
@@ -334,6 +434,36 @@
 was specified and the
 .Fa offset
 argument was not 0.
+.It Bq Er EINVAL
+Both
+.Dv MAP_FIXED
+and
+.Dv MAP_EXCL
+were specified, but the requested region is already used by a mapping.
+.It Bq Er EINVAL
+.Dv MAP_EXCL
+was specified, but
+.Dv MAP_FIXED
+was not.
+.It Bq Er EINVAL
+.Dv MAP_GUARD
+was specified, but the
+.Fa offset
+argument was not zero, the
+.Fa fd
+argument was not -1, or the
+.Fa prot
+argument was not
+.Dv PROT_NONE .
+.It Bq Er EINVAL
+.Dv MAP_GUARD
+was specified together with one of the flags
+.Dv MAP_ANON ,
+.Dv MAP_PREFAULT ,
+.Dv MAP_PREFAULT_READ ,
+.Dv MAP_PRIVATE ,
+.Dv MAP_SHARED ,
+.Dv MAP_STACK .
 .It Bq Er ENODEV
 .Dv MAP_ANON
 has not been specified and
@@ -356,7 +486,8 @@
 .Xr msync 2 ,
 .Xr munlock 2 ,
 .Xr munmap 2 ,
-.Xr getpagesize 3
+.Xr getpagesize 3 ,
+.Xr getpagesizes 3
 .Sh BUGS
 The
 .Fa len


Property changes on: trunk/lib/libc/sys/mmap.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/mmap.c
===================================================================
--- trunk/lib/libc/sys/mmap.c	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/mmap.c	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * Copyright (c) 1992, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -31,7 +32,7 @@
 static char sccsid[] = "@(#)mmap.c	8.1 (Berkeley) 6/17/93";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__MBSDID("$FreeBSD: src/lib/libc/sys/mmap.c,v 1.7 2007/07/04 23:27:38 peter Exp $");
+__FBSDID("$FreeBSD: stable/10/lib/libc/sys/mmap.c 267900 2014-06-26 08:27:01Z kib $");
 
 #include <sys/types.h>
 #include <sys/mman.h>
@@ -44,18 +45,13 @@
  * is not supplied by GCC 1.X but is supplied by GCC 2.X.
  */
 void *
-mmap(addr, len, prot, flags, fd, offset)
-	void *	addr;
-	size_t	len;
-	int	prot;
-	int	flags;
-	int	fd;
-	off_t	offset;
+mmap(void *addr, size_t len, int prot, int flags, int fd, off_t offset)
 {
 
-	if (__getosreldate() >= 4013) 
+	if (__getosreldate() >= 700051) {
 		return (__sys_mmap(addr, len, prot, flags, fd, offset));
-	else
-
-		return (__sys_freebsd6_mmap(addr, len, prot, flags, fd, 0, offset));
+	} else {
+		return (__sys_freebsd6_mmap(addr, len, prot, flags, fd, 0,
+		    offset));
+	}
 }

Modified: trunk/lib/libc/sys/modfind.2
===================================================================
--- trunk/lib/libc/sys/modfind.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/modfind.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\"
 .\" Copyright (c) 1999 Chris Costello
 .\" All rights reserved.
@@ -23,7 +24,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/modfind.2 108028 2002-12-18 09:22:32Z ru $
 .\"
 .Dd September 28, 2000
 .Dt MODFIND 2


Property changes on: trunk/lib/libc/sys/modfind.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/modnext.2
===================================================================
--- trunk/lib/libc/sys/modnext.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/modnext.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\"
 .\" Copyright (c) 1999 Chris Costello
 .\" All rights reserved.
@@ -23,7 +24,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/modnext.2 141846 2005-02-13 22:25:33Z ru $
 .\"
 .Dd September 28, 2000
 .Dt MODNEXT 2


Property changes on: trunk/lib/libc/sys/modnext.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/modstat.2
===================================================================
--- trunk/lib/libc/sys/modstat.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/modstat.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\"
 .\" Copyright (c) 1999 Chris Costello
 .\" All rights reserved.
@@ -23,7 +24,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/modstat.2 213573 2010-10-08 12:40:16Z uqs $
 .\"
 .Dd July 15, 2008
 .Dt MODSTAT 2


Property changes on: trunk/lib/libc/sys/modstat.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/mount.2
===================================================================
--- trunk/lib/libc/sys/mount.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/mount.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1980, 1989, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,9 +27,9 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)mount.2	8.3 (Berkeley) 5/24/95
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/mount.2 281729 2015-04-19 07:46:32Z pluknet $
 .\"
-.Dd January 26, 2010
+.Dd April 13, 2015
 .Dt MOUNT 2
 .Os
 .Sh NAME
@@ -86,7 +87,7 @@
 .Fa niov
 elements.
 The following options are required by all file systems:
-.Bl -item -offset indent -compact
+.Bl -column fstype -offset indent
 .It
 .Li fstype Ta file system type name (e.g., Dq Li procfs )
 .It
@@ -351,11 +352,6 @@
 argument
 points outside the process's allocated address space.
 .El
-.Pp
-A
-.Em ufs
-mount can also fail if the maximum number of file systems are currently
-mounted.
 .Sh SEE ALSO
 .Xr lsvfs 1 ,
 .Xr mksnap_ffs 8 ,


Property changes on: trunk/lib/libc/sys/mount.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/mprotect.2
===================================================================
--- trunk/lib/libc/sys/mprotect.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/mprotect.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,7 +27,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"	@(#)mprotect.2	8.1 (Berkeley) 6/9/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/mprotect.2 165903 2007-01-09 00:28:16Z imp $
 .\"
 .Dd June 9, 1993
 .Dt MPROTECT 2


Property changes on: trunk/lib/libc/sys/mprotect.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/mq_close.2
===================================================================
--- trunk/lib/libc/sys/mq_close.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/mq_close.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 2005 David Xu <davidxu at FreeBSD.org>
 .\" All rights reserved.
 .\"
@@ -35,7 +36,7 @@
 .\" the referee document.  The original Standard can be obtained online at
 .\"	http://www.opengroup.org/unix/online.html.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/mq_close.2 208914 2010-06-08 16:48:59Z uqs $
 .\"
 .Dd November 29, 2005
 .Dt MQ_CLOSE 2


Property changes on: trunk/lib/libc/sys/mq_close.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/mq_getattr.2
===================================================================
--- trunk/lib/libc/sys/mq_getattr.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/mq_getattr.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 2005 David Xu <davidxu at FreeBSD.org>
 .\" All rights reserved.
 .\"
@@ -35,9 +36,9 @@
 .\" the referee document.  The original Standard can be obtained online at
 .\"	http://www.opengroup.org/unix/online.html.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/mq_getattr.2 262588 2014-02-28 00:43:27Z brueffer $
 .\"
-.Dd November 29, 2005
+.Dd February 21, 2014
 .Dt MQ_GETATTR 2
 .Os
 .Sh NAME
@@ -83,8 +84,8 @@
 .Fa mqstat
 argument will be set to the current state
 of the message queue:
-.Bl -tag -width ".Va mq_flags"
-.It Va mq_flags
+.Bl -tag -width ".Va mq_curmsgs"
+.It Va mq_curmsgs
 The number of messages currently on the queue.
 .El
 .Sh RETURN VALUES


Property changes on: trunk/lib/libc/sys/mq_getattr.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/mq_notify.2
===================================================================
--- trunk/lib/libc/sys/mq_notify.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/mq_notify.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 2005 David Xu <davidxu at FreeBSD.org>
 .\" All rights reserved.
 .\"
@@ -35,9 +36,9 @@
 .\" the referee document.  The original Standard can be obtained online at
 .\"	http://www.opengroup.org/unix/online.html.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/mq_notify.2 303325 2016-07-25 23:38:14Z jhb $
 .\"
-.Dd November 29, 2005
+.Dd July 15, 2016
 .Dt MQ_NOTIFY 2
 .Os
 .Sh NAME
@@ -77,18 +78,27 @@
 .Dv SIGEV_NONE ,
 then no signal will be posted, but the error status and the return status
 for the operation will be set appropriately.
-If
-.Fa notification->sigev_notify
-is
-.Dv SIGEV_SIGNAL ,
-then the signal specified in
+For
+.Dv SIGEV_SIGNO
+and
+.Dv SIGEV_THREAD_ID
+notifications,
+the signal specified in
 .Fa notification->sigev_signo
-will be sent to the process.
-The signal will be queued to the process and the value specified in
+will be sent to the calling process
+.Pq Dv SIGEV_SIGNO
+or to the thread whose LWP ID is
+.Fa notification->sigev_notify_thread_id
+.Pq Dv SIGEV_THREAD_ID .
+The information for the queued signal will include:
+.Bl -column ".Va si_value"
+.It Sy Member Ta Sy Value
+.It Va si_code Ta Dv SI_MESGQ
+.It Va si_value Ta
+the value stored in
 .Fa notification->sigev_value
-will be the
-.Va si_value
-component of the generated signal.
+.It Va si_mqd Ta Fa mqdes
+.El
 .Pp
 If
 .Fa notification
@@ -123,11 +133,16 @@
 argument is not a valid message queue descriptor.
 .It Bq Er EBUSY
 Process is already registered for notification by the message queue.
+.It Bq Er EINVAL
+The asynchronous notification method in
+.Fa notification->sigev_notify
+is invalid or not supported.
 .El
 .Sh SEE ALSO
 .Xr mq_open 2 ,
 .Xr mq_send 2 ,
 .Xr mq_timedsend 2 ,
+.Xr sigevent 3 ,
 .Xr siginfo 3
 .Sh STANDARDS
 The


Property changes on: trunk/lib/libc/sys/mq_notify.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/mq_open.2
===================================================================
--- trunk/lib/libc/sys/mq_open.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/mq_open.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 2005 David Xu <davidxu at FreeBSD.org>
 .\" All rights reserved.
 .\"
@@ -35,7 +36,7 @@
 .\" the referee document.  The original Standard can be obtained online at
 .\"	http://www.opengroup.org/unix/online.html.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/mq_open.2 208914 2010-06-08 16:48:59Z uqs $
 .\"
 .Dd November 29, 2005
 .Dt MQ_OPEN 2


Property changes on: trunk/lib/libc/sys/mq_open.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/mq_receive.2
===================================================================
--- trunk/lib/libc/sys/mq_receive.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/mq_receive.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 2005 David Xu <davidxu at FreeBSD.org>
 .\" All rights reserved.
 .\"
@@ -35,7 +36,7 @@
 .\" the referee document.  The original Standard can be obtained online at
 .\"	http://www.opengroup.org/unix/online.html.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/mq_receive.2 208914 2010-06-08 16:48:59Z uqs $
 .\"
 .Dd November 29, 2005
 .Dt MQ_RECEIVE 2


Property changes on: trunk/lib/libc/sys/mq_receive.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/mq_send.2
===================================================================
--- trunk/lib/libc/sys/mq_send.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/mq_send.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 2005 David Xu <davidxu at FreeBSD.org>
 .\" All rights reserved.
 .\"
@@ -35,7 +36,7 @@
 .\" the referee document.  The original Standard can be obtained online at
 .\"	http://www.opengroup.org/unix/online.html.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/mq_send.2 208914 2010-06-08 16:48:59Z uqs $
 .\"
 .Dd November 29, 2005
 .Dt MQ_SEND 2


Property changes on: trunk/lib/libc/sys/mq_send.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/mq_setattr.2
===================================================================
--- trunk/lib/libc/sys/mq_setattr.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/mq_setattr.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 2005 David Xu <davidxu at FreeBSD.org>
 .\" All rights reserved.
 .\"
@@ -35,7 +36,7 @@
 .\" the referee document.  The original Standard can be obtained online at
 .\"	http://www.opengroup.org/unix/online.html.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/mq_setattr.2 222037 2011-05-17 21:03:34Z jilles $
 .\"
 .Dd May 17, 2011
 .Dt MQ_SETATTR 2


Property changes on: trunk/lib/libc/sys/mq_setattr.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/msgctl.2
===================================================================
--- trunk/lib/libc/sys/msgctl.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/msgctl.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\"	$NetBSD: msgctl.2,v 1.1 1995/10/16 23:49:15 jtc Exp $
 .\"
 .\" Copyright (c) 1995 Frank van der Linden
@@ -29,7 +30,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.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/msgctl.2 195656 2009-07-13 12:53:43Z trasz $
 .\"/
 .Dd July 9, 2009
 .Dt MSGCTL 2


Property changes on: trunk/lib/libc/sys/msgctl.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/msgget.2
===================================================================
--- trunk/lib/libc/sys/msgget.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/msgget.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\"	$NetBSD: msgget.2,v 1.1 1995/10/16 23:49:19 jtc Exp $
 .\"
 .\" Copyright (c) 1995 Frank van der Linden
@@ -28,10 +29,10 @@
 .\" 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.
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/msgget.2 330801 2018-03-12 16:04:10Z brooks $
 .\"
 .\"/
-.Dd July 9, 2009
+.Dd March 4, 2018
 .Dt MSGGET 2
 .Os
 .Sh NAME
@@ -40,8 +41,6 @@
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
-.In sys/types.h
-.In sys/ipc.h
 .In sys/msg.h
 .Ft int
 .Fn msgget "key_t key" "int msgflg"
@@ -83,7 +82,22 @@
 .It
 .Va msg_perm.mode
 is set to the lower 9 bits of
-.Fa msgflg .
+.Fa msgflg
+which are set by ORing these constants:
+.Bl -tag -width 0000
+.It Dv 0400
+Read access for user.
+.It Dv 0200
+Write access for user.
+.It Dv 0040
+Read access for group.
+.It Dv 0020
+Write access for group.
+.It Dv 0004
+Read access for other.
+.It Dv 0002
+Write access for other.
+.El
 .It
 .Va msg_cbytes ,
 .Va msg_qnum ,


Property changes on: trunk/lib/libc/sys/msgget.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/msgrcv.2
===================================================================
--- trunk/lib/libc/sys/msgrcv.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/msgrcv.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\"	$NetBSD: msgrcv.2,v 1.1 1995/10/16 23:49:20 jtc Exp $
 .\"
 .\" Copyright (c) 1995 Frank van der Linden
@@ -28,7 +29,7 @@
 .\" 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.
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/msgrcv.2 195656 2009-07-13 12:53:43Z trasz $
 .\"
 .\"/
 .Dd July 9, 2009


Property changes on: trunk/lib/libc/sys/msgrcv.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/msgsnd.2
===================================================================
--- trunk/lib/libc/sys/msgsnd.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/msgsnd.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\"	$NetBSD: msgsnd.2,v 1.1 1995/10/16 23:49:24 jtc Exp $
 .\"
 .\" Copyright (c) 1995 Frank van der Linden
@@ -29,7 +30,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.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/msgsnd.2 235140 2012-05-08 18:56:21Z gjb $
 .\"
 .Dd July 9, 2009
 .Dt MSGSND 2


Property changes on: trunk/lib/libc/sys/msgsnd.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/msync.2
===================================================================
--- trunk/lib/libc/sys/msync.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/msync.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,7 +27,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"	@(#)msync.2	8.2 (Berkeley) 6/21/94
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/msync.2 266492 2014-05-21 09:19:05Z pho $
 .\"
 .Dd March 18, 2012
 .Dt MSYNC 2
@@ -87,11 +88,13 @@
 .Fa addr
 argument
 is not a multiple of the hardware page size.
-.It Bq Er EINVAL
-The
+.It Bq Er ENOMEM
+The addresses in the range starting at
+.Fa addr
+and continuing for
 .Fa len
-argument
-is too large or negative.
+bytes are outside the range allowed for the address space of a
+process or specify one or more pages that are not mapped.
 .It Bq Er EINVAL
 The
 .Fa flags
@@ -99,7 +102,7 @@
 was both MS_ASYNC and MS_INVALIDATE.
 Only one of these flags is allowed.
 .It Bq Er EIO
- An error occurred while writing at least one of the pages in
+An error occurred while writing at least one of the pages in
 the specified region.
 .El
 .Sh SEE ALSO


Property changes on: trunk/lib/libc/sys/msync.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: trunk/lib/libc/sys/msync.c
===================================================================
--- trunk/lib/libc/sys/msync.c	                        (rev 0)
+++ trunk/lib/libc/sys/msync.c	2018-06-07 12:22:26 UTC (rev 10509)
@@ -0,0 +1,50 @@
+/* $MidnightBSD$ */
+/*
+ * Copyright (c) 2014 The FreeBSD Foundation.
+ * All rights reserved.
+ *
+ * Portions of this software were developed by Konstantin Belousov
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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(s), this list of conditions and the following disclaimer as
+ *    the first lines of this file unmodified other than the possible
+ *    addition of one or more copyright notices.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice(s), 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 COPYRIGHT HOLDER(S) ``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 COPYRIGHT HOLDER(S) 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/cdefs.h>
+__FBSDID("$FreeBSD: stable/10/lib/libc/sys/msync.c 277317 2015-01-18 11:54:20Z kib $");
+
+#include <sys/types.h>
+#include <sys/fcntl.h>
+#include "libc_private.h"
+
+__weak_reference(__sys_msync, __msync);
+
+#pragma weak msync
+int
+msync(void *addr, size_t len, int flags)
+{
+
+	return (((int (*)(void *, size_t, int))
+	    __libc_interposing[INTERPOS_msync])(addr, len, flags));
+}


Property changes on: trunk/lib/libc/sys/msync.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: trunk/lib/libc/sys/munmap.2
===================================================================
--- trunk/lib/libc/sys/munmap.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/munmap.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,9 +27,9 @@
 .\" SUCH DAMAGE.
 .\"
 .\"	@(#)munmap.2	8.3 (Berkeley) 5/27/94
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/munmap.2 321717 2017-07-30 10:36:20Z kib $
 .\"
-.Dd May 27, 1994
+.Dd June 22, 2017
 .Dt MUNMAP 2
 .Os
 .Sh NAME
@@ -44,7 +45,7 @@
 The
 .Fn munmap
 system call
-deletes the mappings for the specified address range,
+deletes the mappings and guards for the specified address range,
 and causes further references to addresses within the range
 to generate invalid memory references.
 .Sh RETURN VALUES


Property changes on: trunk/lib/libc/sys/munmap.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/nanosleep.2
===================================================================
--- trunk/lib/libc/sys/nanosleep.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/nanosleep.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\"	$OpenBSD: nanosleep.2,v 1.1 1997/04/20 20:56:20 tholo Exp $
 .\"	$NetBSD: nanosleep.2,v 1.1 1997/04/17 18:12:02 jtc Exp $
 .\"
@@ -29,7 +30,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)sleep.3	8.1 (Berkeley) 6/4/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/nanosleep.2 197958 2009-10-11 16:23:11Z kib $
 .\"
 .Dd April 17, 1997
 .Dt NANOSLEEP 2


Property changes on: trunk/lib/libc/sys/nanosleep.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: trunk/lib/libc/sys/nanosleep.c
===================================================================
--- trunk/lib/libc/sys/nanosleep.c	                        (rev 0)
+++ trunk/lib/libc/sys/nanosleep.c	2018-06-07 12:22:26 UTC (rev 10509)
@@ -0,0 +1,50 @@
+/* $MidnightBSD$ */
+/*
+ * Copyright (c) 2014 The FreeBSD Foundation.
+ * All rights reserved.
+ *
+ * Portions of this software were developed by Konstantin Belousov
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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(s), this list of conditions and the following disclaimer as
+ *    the first lines of this file unmodified other than the possible
+ *    addition of one or more copyright notices.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice(s), 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 COPYRIGHT HOLDER(S) ``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 COPYRIGHT HOLDER(S) 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/cdefs.h>
+__FBSDID("$FreeBSD: stable/10/lib/libc/sys/nanosleep.c 277317 2015-01-18 11:54:20Z kib $");
+
+#include <sys/types.h>
+#include <time.h>
+#include "libc_private.h"
+
+__weak_reference(__sys_nanosleep, __nanosleep);
+
+#pragma weak nanosleep
+int
+nanosleep(const struct timespec *rqtp, struct timespec *rmtp)
+{
+
+	return (((int (*)(const struct timespec *, struct timespec *))
+	    __libc_interposing[INTERPOS_nanosleep])(rqtp, rmtp));
+}


Property changes on: trunk/lib/libc/sys/nanosleep.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: trunk/lib/libc/sys/nfssvc.2
===================================================================
--- trunk/lib/libc/sys/nfssvc.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/nfssvc.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1989, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,7 +27,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"	@(#)nfssvc.2	8.1 (Berkeley) 6/9/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/nfssvc.2 231564 2012-02-12 18:29:56Z ed $
 .\"
 .Dd June 9, 1993
 .Dt NFSSVC 2
@@ -143,7 +144,7 @@
 struct nfsd_srvargs {
 	struct nfsd	*nsd_nfsd;	/* Pointer to in kernel nfsd struct */
 	uid_t		nsd_uid;	/* Effective uid mapped to cred */
-	u_int32_t	nsd_haddr;	/* Ip address of client */
+	uint32_t	nsd_haddr;	/* Ip address of client */
 	struct ucred	nsd_cr;		/* Cred. uid maps to */
 	int		nsd_authlen;	/* Length of auth string (ret) */
 	u_char		*nsd_authstr;	/* Auth string (ret) */
@@ -150,7 +151,7 @@
 	int		nsd_verflen;	/* and the verifier */
 	u_char		*nsd_verfstr;
 	struct timeval	nsd_timestamp;	/* timestamp from verifier */
-	u_int32_t	nsd_ttl;	/* credential ttl (sec) */
+	uint32_t	nsd_ttl;	/* credential ttl (sec) */
 	NFSKERBKEY_T	nsd_key;	/* Session key */
 };
 .Ed


Property changes on: trunk/lib/libc/sys/nfssvc.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/ntp_adjtime.2
===================================================================
--- trunk/lib/libc/sys/ntp_adjtime.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/ntp_adjtime.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\"	$NetBSD: ntp_adjtime.2,v 1.6 2003/04/16 13:34:55 wiz Exp $
 .\"
 .\" Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -27,7 +28,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/ntp_adjtime.2 211397 2010-08-16 15:18:30Z joel $
 .\"
 .Dd July 13, 2005
 .Dt NTP_ADJTIME 2


Property changes on: trunk/lib/libc/sys/ntp_adjtime.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/open.2
===================================================================
--- trunk/lib/libc/sys/open.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/open.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1980, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,9 +27,9 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)open.2	8.2 (Berkeley) 11/16/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/open.2 321146 2017-07-18 18:15:45Z ngie $
 .\"
-.Dd February 7, 2013
+.Dd November 22, 2016
 .Dt OPEN 2
 .Os
 .Sh NAME
@@ -115,8 +116,8 @@
 O_FSYNC		synchronous writes
 O_SYNC		synchronous writes
 O_NOFOLLOW	do not follow symlinks
-O_NOCTTY	don't assign controlling terminal
-O_TTY_INIT	restore default terminal attributes
+O_NOCTTY	ignored
+O_TTY_INIT	ignored
 O_DIRECTORY	error if file is not a directory
 O_CLOEXEC	set FD_CLOEXEC upon open
 .Ed
@@ -427,7 +428,7 @@
 .Dv O_RDWR
 and
 .Dv O_EXEC .
-.It Bq Eq EBADF
+.It Bq Er EBADF
 The
 .Fa path
 argument does not specify an absolute path and the
@@ -436,7 +437,7 @@
 neither
 .Dv AT_FDCWD
 nor a valid file descriptor open for searching.
-.It Bq Eq ENOTDIR
+.It Bq Er ENOTDIR
 The
 .Fa path
 argument is not an absolute path and
@@ -444,7 +445,7 @@
 is neither
 .Dv AT_FDCWD
 nor a file descriptor associated with a directory.
-.It Bq Eq ENOTDIR
+.It Bq Er ENOTDIR
 .Dv O_DIRECTORY
 is specified and the file is not a directory.
 .El
@@ -461,7 +462,24 @@
 .Xr read 2 ,
 .Xr umask 2 ,
 .Xr write 2 ,
-.Xr fopen 3
+.Xr fopen 3 ,
+.Xr capsicum 4
+.Sh STANDARDS
+These functions are specified by
+.St -p1003.1-2008 .
+.Fx
+sets
+.Va errno
+to
+.Er EMLINK instead of
+.Er ELOOP
+as specified by
+.Tn POSIX
+when
+.Dv O_NOFOLLOW
+is set in flags and the final component of pathname is a symbolic link
+to distinguish it from the case of too many symbolic link traversals
+in one of its non-final components.
 .Sh HISTORY
 The
 .Fn open


Property changes on: trunk/lib/libc/sys/open.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: trunk/lib/libc/sys/open.c
===================================================================
--- trunk/lib/libc/sys/open.c	                        (rev 0)
+++ trunk/lib/libc/sys/open.c	2018-06-07 12:22:26 UTC (rev 10509)
@@ -0,0 +1,60 @@
+/* $MidnightBSD$ */
+/*
+ * Copyright (c) 2014 The FreeBSD Foundation.
+ * All rights reserved.
+ *
+ * Portions of this software were developed by Konstantin Belousov
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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(s), this list of conditions and the following disclaimer as
+ *    the first lines of this file unmodified other than the possible
+ *    addition of one or more copyright notices.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice(s), 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 COPYRIGHT HOLDER(S) ``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 COPYRIGHT HOLDER(S) 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/cdefs.h>
+__FBSDID("$FreeBSD: stable/10/lib/libc/sys/open.c 277317 2015-01-18 11:54:20Z kib $");
+
+#include <sys/types.h>
+#include <sys/fcntl.h>
+#include <stdarg.h>
+#include "libc_private.h"
+
+__weak_reference(__sys_open, __open);
+
+#pragma weak open
+int
+open(const char *path, int flags, ...)
+{
+	va_list ap;
+	int mode;
+
+	if ((flags & O_CREAT) != 0) {
+		va_start(ap, flags);
+		mode = va_arg(ap, int);
+		va_end(ap);
+	} else {
+		mode = 0;
+	}
+	return (((int (*)(int, const char *, int, ...))
+	    __libc_interposing[INTERPOS_openat])(AT_FDCWD, path, flags, mode));
+}


Property changes on: trunk/lib/libc/sys/open.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/lib/libc/sys/openat.c
===================================================================
--- trunk/lib/libc/sys/openat.c	                        (rev 0)
+++ trunk/lib/libc/sys/openat.c	2018-06-07 12:22:26 UTC (rev 10509)
@@ -0,0 +1,63 @@
+/* $MidnightBSD$ */
+/*
+ * Copyright (c) 2014 The FreeBSD Foundation.
+ * All rights reserved.
+ *
+ * Portions of this software were developed by Konstantin Belousov
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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(s), this list of conditions and the following disclaimer as
+ *    the first lines of this file unmodified other than the possible
+ *    addition of one or more copyright notices.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice(s), 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 COPYRIGHT HOLDER(S) ``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 COPYRIGHT HOLDER(S) 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/cdefs.h>
+__FBSDID("$FreeBSD: stable/10/lib/libc/sys/openat.c 277317 2015-01-18 11:54:20Z kib $");
+
+#include <sys/types.h>
+#include <sys/fcntl.h>
+#include <stdarg.h>
+#include "libc_private.h"
+
+__weak_reference(__sys_openat, __openat);
+__sym_compat(openat, __impl_openat, FBSD_1.1);
+__weak_reference(openat, __impl_openat);
+__sym_default(openat, openat, FBSD_1.2);
+
+#pragma weak openat
+int
+openat(int fd, const char *path, int flags, ...)
+{
+	va_list ap;
+	int mode;
+
+	if ((flags & O_CREAT) != 0) {
+		va_start(ap, flags);
+		mode = va_arg(ap, int);
+		va_end(ap);
+	} else {
+		mode = 0;
+	}
+	return (((int (*)(int, const char *, int, ...))
+	    __libc_interposing[INTERPOS_openat])(fd, path, flags, mode));
+}


Property changes on: trunk/lib/libc/sys/openat.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: trunk/lib/libc/sys/pathconf.2
===================================================================
--- trunk/lib/libc/sys/pathconf.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/pathconf.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,7 +27,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"	@(#)pathconf.2	8.1 (Berkeley) 6/4/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/pathconf.2 235140 2012-05-08 18:56:21Z gjb $
 .\"
 .Dd July 7, 2009
 .Dt PATHCONF 2
@@ -87,7 +88,6 @@
 returns information about the file the link references.
 .Pp
 The available values are as follows:
-.Pp
 .Bl -tag -width 6n
 .It Li _PC_LINK_MAX
 The maximum file link count.


Property changes on: trunk/lib/libc/sys/pathconf.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/pdfork.2
===================================================================
--- trunk/lib/libc/sys/pdfork.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/pdfork.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,10 +1,15 @@
+.\" $MidnightBSD$
 .\"
-.\" Copyright (c) 2009-2010 Robert N. M. Watson
+.\" Copyright (c) 2009-2010, 2012-2013 Robert N. M. Watson
 .\" All rights reserved.
 .\"
 .\" This software was developed at the University of Cambridge Computer
 .\" Laboratory with support from a grant from Google, Inc.
 .\"
+.\" This software was developed by SRI International and the University of
+.\" Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237)
+.\" ("CTSRD"), as part of the DARPA CRASH research programme.
+.\"
 .\" Redistribution and use in source and binary forms, with or without
 .\" modification, are permitted provided that the following conditions
 .\" are met:
@@ -26,9 +31,9 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/pdfork.2 255002 2013-08-28 20:00:25Z rwatson $
 .\"
-.Dd February 25, 2012
+.Dd August 28, 2013
 .Dt PDFORK 2
 .Os
 .Sh NAME
@@ -57,7 +62,7 @@
 .Xr fork 2 ,
 which, if successful, returns a process descriptor in the integer pointed to
 by
-.Fa pidp .
+.Fa fdp .
 Processes created via
 .Fn pdfork
 will not cause
@@ -71,12 +76,14 @@
 live until it is explicitly killed with
 .Xr kill 2 .
 .Pp
-This option is not permitted in Capsicum capability mode (see
+This option is not permitted in
+.Xr capsicum 4
+capability mode (see
 .Xr cap_enter 2 ) .
 .El
 .Pp
 .Fn pdgetpid
-queries the process ID (PID) if the process descriptor
+queries the process ID (PID) in the process descriptor
 .Fa fd .
 .Pp
 .Fn pdkill
@@ -119,6 +126,12 @@
 the last reference to the process descriptor, the process will be terminated
 with the signal
 .Dv SIGKILL .
+.Pp
+.Nm
+and associated functions depend on
+.Cd "options PROCDESC"
+described in
+.Xr procdesc 4 .
 .Sh RETURN VALUES
 .Fn pdfork
 returns a PID, 0 or -1, as
@@ -156,7 +169,9 @@
 .Xr fstat 2 ,
 .Xr kill 2 ,
 .Xr poll 2 ,
-.Xr wait4 2
+.Xr wait4 2 ,
+.Xr capsicum 4 ,
+.Xr procdesc 4
 .Sh HISTORY
 The
 .Fn pdfork ,


Property changes on: trunk/lib/libc/sys/pdfork.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/pipe.2
===================================================================
--- trunk/lib/libc/sys/pipe.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/pipe.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1980, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,13 +27,14 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)pipe.2	8.1 (Berkeley) 6/4/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/pipe.2 260867 2014-01-18 22:47:25Z jilles $
 .\"
-.Dd January 30, 2006
+.Dd May 1, 2013
 .Dt PIPE 2
 .Os
 .Sh NAME
-.Nm pipe
+.Nm pipe ,
+.Nm pipe2
 .Nd create descriptor pair for interprocess communication
 .Sh LIBRARY
 .Lb libc
@@ -40,6 +42,8 @@
 .In unistd.h
 .Ft int
 .Fn pipe "int fildes[2]"
+.Ft int
+.Fn pipe2 "int fildes[2]" "int flags"
 .Sh DESCRIPTION
 The
 .Fn pipe
@@ -50,6 +54,29 @@
 bidirectional data flow,
 and allocates a pair of file descriptors.
 .Pp
+The
+.Fn pipe2
+system call allows control over the attributes of the file descriptors
+via the
+.Fa flags
+argument.
+Values for
+.Fa flags
+are constructed by a bitwise-inclusive OR of flags from the following
+list, defined in
+.In fcntl.h :
+.Bl -tag -width ".Dv O_NONBLOCK"
+.It Dv O_CLOEXEC
+Set the close-on-exec flag for the new file descriptors.
+.It Dv O_NONBLOCK
+Set the non-blocking flag for the ends of the pipe.
+.El
+.Pp
+If the
+.Fa flags
+argument is 0, the behavior is identical to a call to
+.Fn pipe .
+.Pp
 By convention, the first descriptor is normally used as the
 .Em read end
 of the pipe,
@@ -88,7 +115,9 @@
 .Sh ERRORS
 The
 .Fn pipe
-system call will fail if:
+and
+.Fn pipe2
+system calls will fail if:
 .Bl -tag -width Er
 .It Bq Er EMFILE
 Too many descriptors are active.
@@ -97,6 +126,16 @@
 .It Bq Er ENOMEM
 Not enough kernel memory to establish a pipe.
 .El
+.Pp
+The
+.Fn pipe2
+system call will also fail if:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+The
+.Fa flags
+argument is invalid.
+.El
 .Sh SEE ALSO
 .Xr sh 1 ,
 .Xr fork 2 ,
@@ -111,3 +150,8 @@
 .Pp
 Bidirectional pipes were first used on
 .At V.4 .
+.Pp
+The
+.Fn pipe2
+function appeared in
+.Fx 10.0 .


Property changes on: trunk/lib/libc/sys/pipe.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/poll.2
===================================================================
--- trunk/lib/libc/sys/poll.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/poll.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,5 +1,6 @@
+.\" $MidnightBSD$
 .\"	$NetBSD: poll.2,v 1.3 1996/09/07 21:53:08 mycroft Exp $
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/poll.2 306378 2016-09-27 19:00:22Z pluknet $
 .\"
 .\" Copyright (c) 1996 Charles M. Hannum.  All rights reserved.
 .\"
@@ -28,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 July 8, 2002
+.Dd November 13, 2014
 .Dt POLL 2
 .Os
 .Sh NAME
@@ -40,6 +41,13 @@
 .In poll.h
 .Ft int
 .Fn poll "struct pollfd fds[]" "nfds_t nfds" "int timeout"
+.Ft int
+.Fo ppoll
+.Fa "struct pollfd fds[]"
+.Fa "nfds_t nfds"
+.Fa "const struct timespec * restrict timeout"
+.Fa "const sigset_t * restrict newsigmask"
+.Fc
 .Sh DESCRIPTION
 The
 .Fn poll
@@ -139,6 +147,46 @@
 is zero, then
 .Fn poll
 will return without blocking.
+.Pp
+The
+.Fn ppoll 
+system call, unlike 
+.Fn poll ,
+is used to safely wait until either a set of file descriptors becomes
+ready or until a signal is caught.
+The
+.Fa fds
+and
+.Fa nfds
+arguments are identical to the analogous arguments of
+.Fn poll .
+The
+.Fa timeout
+argument in
+.Fn ppoll
+points to a
+.Vt "const struct timespec"
+which is defined in
+.In sys/timespec.h
+(shown below) rather than the
+.Vt "int timeout"
+used by
+.Fn poll .
+A null pointer may be passed to indicate that
+.Fn ppoll
+should wait indefinitely.
+Finally, 
+.Fa newsigmask
+specifies a signal mask which is set while waiting for input.
+When 
+.Fn ppoll
+returns, the original signal mask is restored.
+.Bd -literal
+struct timespec {
+	time_t  tv_sec;         /* seconds */
+	long    tv_nsec;        /* and nanoseconds */
+};
+.Ed
 .Sh RETURN VALUES
 The
 .Fn poll
@@ -185,17 +233,26 @@
 A signal was delivered before the time limit expired and
 before any of the selected events occurred.
 .It Bq Er EINVAL
-The specified time limit is negative.
+The specified time limit is invalid. One of its components is negative or too large.
 .El
 .Sh SEE ALSO
 .Xr accept 2 ,
 .Xr connect 2 ,
 .Xr kqueue 2 ,
+.Xr pselect 2 ,
 .Xr read 2 ,
 .Xr recv 2 ,
 .Xr select 2 ,
 .Xr send 2 ,
 .Xr write 2
+.Sh STANDARDS
+The
+.Fn poll 
+function conforms to
+.St -p1003.1-2001 .
+The
+.Fn ppoll 
+is not specified by POSIX.
 .Sh HISTORY
 The
 .Fn poll
@@ -203,6 +260,10 @@
 .At V .
 This manual page and the core of the implementation was taken from
 .Nx .
+The
+.Fn ppoll
+function first appeared in 
+.Fx 11.0 
 .Sh BUGS
 The distinction between some of the fields in the
 .Fa events


Property changes on: trunk/lib/libc/sys/poll.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: trunk/lib/libc/sys/poll.c
===================================================================
--- trunk/lib/libc/sys/poll.c	                        (rev 0)
+++ trunk/lib/libc/sys/poll.c	2018-06-07 12:22:26 UTC (rev 10509)
@@ -0,0 +1,50 @@
+/* $MidnightBSD$ */
+/*
+ * Copyright (c) 2014 The FreeBSD Foundation.
+ * All rights reserved.
+ *
+ * Portions of this software were developed by Konstantin Belousov
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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(s), this list of conditions and the following disclaimer as
+ *    the first lines of this file unmodified other than the possible
+ *    addition of one or more copyright notices.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice(s), 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 COPYRIGHT HOLDER(S) ``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 COPYRIGHT HOLDER(S) 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/cdefs.h>
+__FBSDID("$FreeBSD: stable/10/lib/libc/sys/poll.c 277317 2015-01-18 11:54:20Z kib $");
+
+#include <sys/types.h>
+#include <sys/poll.h>
+#include "libc_private.h"
+
+__weak_reference(__sys_poll, __poll);
+
+#pragma weak poll
+int
+poll(struct pollfd pfd[], nfds_t nfds, int timeout)
+{
+
+	return (((int (*)(struct pollfd *, nfds_t, int))
+	    __libc_interposing[INTERPOS_poll])(pfd, nfds, timeout));
+}


Property changes on: trunk/lib/libc/sys/poll.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: trunk/lib/libc/sys/posix_fadvise.2
===================================================================
--- trunk/lib/libc/sys/posix_fadvise.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/posix_fadvise.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,9 +27,9 @@
 .\" SUCH DAMAGE.
 .\"
 .\"	@(#)madvise.2	8.1 (Berkeley) 6/9/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/posix_fadvise.2 261560 2014-02-06 19:47:17Z kib $
 .\"
-.Dd June 19, 2012
+.Dd January 30, 2014
 .Dt POSIX_FADVISE 2
 .Os
 .Sh NAME
@@ -88,13 +89,12 @@
 read or written.
 Future access to this data may require a read operation.
 .El
-.Pp
 .Sh RETURN VALUES
 .Rv -std posix_fadvise
 .Sh ERRORS
 The
 .Fn posix_fadvise
-system call will fail if:
+system call returns zero on success, and an error on failure:
 .Bl -tag -width Er
 .It Bq Er EBADF
 The


Property changes on: trunk/lib/libc/sys/posix_fadvise.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/posix_fallocate.2
===================================================================
--- trunk/lib/libc/sys/posix_fallocate.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/posix_fallocate.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1980, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,9 +27,9 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)open.2	8.2 (Berkeley) 11/16/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/posix_fallocate.2 261560 2014-02-06 19:47:17Z kib $
 .\"
-.Dd February 25, 2012
+.Dd January 23, 2014
 .Dt POSIX_FALLOCATE 2
 .Os
 .Sh NAME
@@ -79,14 +80,12 @@
 that reduces the file size to a size smaller than
 .Fa offset +
 .Fa len .
-.Pp
 .Sh RETURN VALUES
 If successful,
 .Fn posix_fallocate
 returns zero.
-It returns -1 on failure, and sets
-.Va errno
-to indicate the error.
+It returns an error on failure, without setting
+.Va errno .
 .Sh ERRORS
 Possible failure conditions:
 .Bl -tag -width Er
@@ -108,7 +107,7 @@
 .It Bq Er EINVAL
 The
 .Fa len
-argument was zero or the
+argument was less than or equal to zero or the
 .Fa offset
 argument was less than zero.
 .It Bq Er EIO


Property changes on: trunk/lib/libc/sys/posix_fallocate.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/posix_openpt.2
===================================================================
--- trunk/lib/libc/sys/posix_openpt.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/posix_openpt.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 2008 Ed Schouten <ed at FreeBSD.org>
 .\" All rights reserved.
 .\"
@@ -35,7 +36,7 @@
 .\" the referee document.  The original Standard can be obtained online at
 .\"	http://www.opengroup.org/unix/online.html.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/posix_openpt.2 248593 2013-03-21 21:39:15Z jilles $
 .\"
 .Dd March 21, 2013
 .Dt POSIX_OPENPT 2


Property changes on: trunk/lib/libc/sys/posix_openpt.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: trunk/lib/libc/sys/ppoll.c
===================================================================
--- trunk/lib/libc/sys/ppoll.c	                        (rev 0)
+++ trunk/lib/libc/sys/ppoll.c	2018-06-07 12:22:26 UTC (rev 10509)
@@ -0,0 +1,52 @@
+/* $MidnightBSD$ */
+/*
+ * Copyright (c) 2015 The FreeBSD Foundation.
+ * All rights reserved.
+ *
+ * Portions of this software were developed by Konstantin Belousov
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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(s), this list of conditions and the following disclaimer as
+ *    the first lines of this file unmodified other than the possible
+ *    addition of one or more copyright notices.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice(s), 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 COPYRIGHT HOLDER(S) ``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 COPYRIGHT HOLDER(S) 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/cdefs.h>
+__FBSDID("$FreeBSD: stable/10/lib/libc/sys/ppoll.c 281981 2015-04-25 08:14:08Z kib $");
+
+#include <sys/types.h>
+#include <sys/poll.h>
+#include "libc_private.h"
+
+__weak_reference(__sys_ppoll, __ppoll);
+
+#pragma weak ppoll
+int
+ppoll(struct pollfd pfd[], nfds_t nfds, const struct timespec *__restrict
+    timeout, const sigset_t *__restrict newsigmask)
+{
+
+	return (((int (*)(struct pollfd *, nfds_t, const struct timespec *,
+	    const sigset_t *)) __libc_interposing[INTERPOS_ppoll])(pfd, nfds,
+	    timeout, newsigmask));
+}


Property changes on: trunk/lib/libc/sys/ppoll.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: trunk/lib/libc/sys/pread.c
===================================================================
--- trunk/lib/libc/sys/pread.c	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/pread.c	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * Copyright (c) 1992, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -31,7 +32,7 @@
 static char sccsid[] = "@(#)mmap.c	8.1 (Berkeley) 6/17/93";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__MBSDID("$FreeBSD: src/lib/libc/sys/pread.c,v 1.4 2007/07/04 23:27:38 peter Exp $");
+__FBSDID("$FreeBSD: stable/10/lib/libc/sys/pread.c 171219 2007-07-04 23:27:38Z peter $");
 
 #include <sys/types.h>
 #include <sys/syscall.h>
@@ -50,7 +51,7 @@
 	off_t	offset;
 {
 
-	if (__getosreldate() >= 4013)
+	if (__getosreldate() >= 700051)
 		return (__sys_pread(fd, buf, nbyte, offset));
 	else
 		return (__sys_freebsd6_pread(fd, buf, nbyte, 0, offset));

Added: trunk/lib/libc/sys/procctl.2
===================================================================
--- trunk/lib/libc/sys/procctl.2	                        (rev 0)
+++ trunk/lib/libc/sys/procctl.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -0,0 +1,444 @@
+.\" $MidnightBSD$
+.\" Copyright (c) 2013 Hudson River Trading LLC
+.\" Written by: John H. Baldwin <jhb at FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Copyright (c) 2014 The FreeBSD Foundation
+.\" Portions of this documentation were written by Konstantin Belousov
+.\" under sponsorship from the FreeBSD Foundation.
+.\"
+.\" 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: stable/10/lib/libc/sys/procctl.2 326397 2017-11-30 14:38:07Z kib $
+.\"
+.Dd November 21, 2017
+.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 processes 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_REAP_GETPIDS"
+.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
+.It Dv PROC_REAP_ACQUIRE
+Acquires the reaper status for the current process.
+The status means that children orphaned by the reaper's descendants
+that were forked after the acquisition of the status are reparented to the
+reaper.
+After the system initialization,
+.Xr init 8
+is the default reaper.
+.Pp
+.It Dv PROC_REAP_RELEASE
+Releases the reaper state for the current process.
+The reaper of the current process becomes the new reaper of the
+current process's descendants.
+.It Dv PROC_REAP_STATUS
+Provides the information about the reaper of the specified process,
+or the process itself when it is a reaper.
+The
+.Fa data
+argument must point to a
+.Vt procctl_reaper_status
+structure which is filled in by the syscall on successful return.
+.Bd -literal
+struct procctl_reaper_status {
+	u_int	rs_flags;
+	u_int	rs_children;
+	u_int	rs_descendants;
+	pid_t	rs_reaper;
+	pid_t	rs_pid;
+};
+.Ed
+The
+.Fa rs_flags
+may have the following flags returned:
+.Bl -tag -width "Dv REAPER_STATUS_REALINIT"
+.It Dv REAPER_STATUS_OWNED
+The specified process has acquired the reaper status and has not
+released it.
+When the flag is returned, the specified process
+.Fa id ,
+pid, identifies the reaper, otherwise the
+.Fa rs_reaper
+field of the structure is set to the pid of the reaper
+for the specified process id.
+.It Dv REAPER_STATUS_REALINIT
+The specified process is the root of the reaper tree, i.e.
+.Xr init 8 .
+.El
+The
+.Fa rs_children
+field returns the number of children of the reaper among the descendands.
+It is possible to have a child which reaper is not the specified process,
+since the reaper for the existing children is not reset on the
+.Dv PROC_REAP_ACQUIRE
+operation.
+The
+.Fa rs_descendants
+field returns the total number of descendants of the reaper(s),
+not counting descendants of the reaper in the subtree.
+The
+.Fa rs_reaper
+field returns the reaper pid.
+The
+.Fa rs_pid
+returns the pid of one reaper child if there are any descendants.
+.It Dv PROC_REAP_GETPIDS
+Queries the list of descendants of the reaper of the specified process.
+The request takes a pointer to a
+.Vt procctl_reaper_pids
+structure in the
+.Fa data
+parameter.
+.Bd -literal
+struct procctl_reaper_pids {
+	u_int	rp_count;
+	struct procctl_reaper_pidinfo *rp_pids;
+};
+.Ed
+When called, the
+.Fa rp_pids
+field must point to an array of
+.Vt procctl_reaper_pidinfo
+structures, to be filled in on return,
+and the
+.Fa rp_count
+field must specify the size of the array,
+into which no more than
+.Fa rp_count
+elements will be filled in by the kernel.
+.Pp
+The
+.Vt "struct procctl_reaper_pidinfo"
+structure provides some information about one of the reaper's descendants.
+Note that for a descendant that is not a child, it may be incorrectly
+identified because of a race in which the original child process exited
+and the exited process's pid was reused for an unrelated process.
+.Bd -literal
+struct procctl_reaper_pidinfo {
+	pid_t	pi_pid;
+	pid_t	pi_subtree;
+	u_int	pi_flags;
+};
+.Ed
+The
+.Fa pi_pid
+field is the process id of the descendant.
+The
+.Fa pi_subtree
+field provides the pid of the child of the reaper, which is the (grand-)parent
+of the process.
+The
+.Fa pi_flags
+field returns the following flags, further describing the descendant:
+.Bl -tag -width "Dv REAPER_PIDINFO_REAPER"
+.It Dv REAPER_PIDINFO_VALID
+Set to indicate that the
+.Vt procctl_reaper_pidinfo
+structure was filled in by the kernel.
+Zero-filling the
+.Fa rp_pids
+array and testing the
+.Dv REAPER_PIDINFO_VALID
+flag allows the caller to detect the end
+of the returned array.
+.It Dv REAPER_PIDINFO_CHILD
+The
+.Fa pi_pid
+field identifies the direct child of the reaper.
+.It Dv REAPER_PIDINFO_REAPER
+The reported process is itself a reaper.
+The descendants of the subordinate reaper are not reported.
+.El
+.It Dv PROC_REAP_KILL
+Request to deliver a signal to some subset of the descendants of the reaper.
+The
+.Fa data
+parameter must point to a
+.Vt procctl_reaper_kill
+structure, which is used both for parameters and status return.
+.Bd -literal
+struct procctl_reaper_kill {
+	int	rk_sig;
+	u_int	rk_flags;
+	pid_t	rk_subtree;
+	u_int	rk_killed;
+	pid_t	rk_fpid;
+};
+.Ed
+The
+.Fa rk_sig
+field specifies the signal to be delivered.
+Zero is not a valid signal number, unlike
+.Xr kill 2 .
+The
+.Fa rk_flags
+field further directs the operation.
+It is or-ed from the following flags:
+.Bl -tag -width "Dv REAPER_KILL_CHILDREN"
+.It Dv REAPER_KILL_CHILDREN
+Deliver the specified signal only to direct children of the reaper.
+.It Dv REAPER_KILL_SUBTREE
+Deliver the specified signal only to descendants that were forked by
+the direct child with pid specified in the
+.Fa rk_subtree
+field.
+.El
+If neither the
+.Dv REAPER_KILL_CHILDREN
+nor the
+.Dv REAPER_KILL_SUBTREE
+flags are specified, all current descendants of the reaper are signalled.
+.Pp
+If a signal was delivered to any process, the return value from the request
+is zero.
+In this case, the
+.Fa rk_killed
+field identifies the number of processes signalled.
+The
+.Fa rk_fpid
+field is set to the pid of the first process for which signal
+delivery failed, e.g. due to the permission problems.
+If no such process exist, the
+.Fa rk_fpid
+field is set to -1.
+.It Dv PROC_TRACE_CTL
+Enable or disable tracing of the specified process(es), according to the
+value of the integer argument.
+Tracing includes attachment to the process using
+.Xr ptrace 2
+and
+.Xr ktrace 2 ,
+debugging sysctls,
+.Xr hwpmc 4 ,
+.Xr dtrace 1
+and core dumping.
+Possible values for the
+.Fa data
+argument are:
+.Bl -tag -width "Dv PROC_TRACE_CTL_DISABLE_EXEC"
+.It Dv PROC_TRACE_CTL_ENABLE
+Enable tracing, after it was disabled by
+.Dv PROC_TRACE_CTL_DISABLE .
+Only allowed for self.
+.It Dv PROC_TRACE_CTL_DISABLE
+Disable tracing for the specified process.
+Tracing is re-enabled when the process changes the executing
+program with
+.Xr execve 2
+syscall.
+A child inherits the trace settings from the parent on
+.Xr fork 2 .
+.It Dv PROC_TRACE_CTL_DISABLE_EXEC
+Same as
+.Dv PROC_TRACE_CTL_DISABLE ,
+but the setting persist for the process even after
+.Xr execve 2 .
+.El
+.It Dv PROC_TRACE_STATUS
+Returns the current tracing status for the specified process in
+the integer variable pointed to by
+.Fa data .
+If tracing is disabled,
+.Fa data
+is set to -1.
+If tracing is enabled, but no debugger is attached by
+.Xr ptrace 2
+syscall,
+.Fa data
+is set to 0.
+If a debugger is attached,
+.Fa data
+is set to the pid of the debugger process.
+.El
+.Sh NOTES
+Disabling tracing on a process should not be considered a security
+feature, as it is bypassable both by the kernel and privileged processes,
+and via other system mechanisms.
+As such, it should not be relied on to reliably protect cryptographic
+keying material or other confidential data.
+.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
+parameter 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.
+.It Bq Er EPERM
+The
+.Fa idtype
+argument is not equal to
+.Dv P_PID ,
+or
+.Fa id
+is not equal to the pid of the calling process, for
+.Dv PROC_REAP_ACQUIRE
+or
+.Dv PROC_REAP_RELEASE
+requests.
+.It Bq Er EINVAL
+Invalid or undefined flags were passed to a
+.Dv PROC_REAP_KILL
+request.
+.It Bq Er EINVAL
+An invalid or zero signal number was requested for a
+.Dv PROC_REAP_KILL
+request.
+.It Bq Er EINVAL
+The
+.Dv PROC_REAP_RELEASE
+request was issued by the
+.Xr init 8
+process.
+.It Bq Er EBUSY
+The
+.Dv PROC_REAP_ACQUIRE
+request was issued by a process that had already acquired reaper status
+and has not yet released it.
+.It Bq Er EBUSY
+The
+.Dv PROC_TRACE_CTL
+request was issued for a process already being traced.
+.It Bq Er EPERM
+The
+.Dv PROC_TRACE_CTL
+request to re-enable tracing of the process (
+.Dv PROC_TRACE_CTL_ENABLE ) ,
+or to disable persistence of the
+.Dv PROC_TRACE_CTL_DISABLE
+on
+.Xr execve 2
+was issued for a non-current process.
+.It Bq Er EINVAL
+The value of the integer
+.Fa data
+parameter for the
+.Dv PROC_TRACE_CTL
+request is invalid.
+.El
+.Sh SEE ALSO
+.Xr dtrace 1 ,
+.Xr kill 2 ,
+.Xr ktrace 2 ,
+.Xr ptrace 2 ,
+.Xr wait 2 ,
+.Xr hwpmc 4 ,
+.Xr init 8
+.Sh HISTORY
+The
+.Fn procctl
+function appeared in
+.Fx 10.0 .
+The reaper facility is based on a similar feature of Linux and
+DragonflyBSD, and first appeared in
+.Fx 10.2 .


Property changes on: trunk/lib/libc/sys/procctl.2
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: trunk/lib/libc/sys/profil.2
===================================================================
--- trunk/lib/libc/sys/profil.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/profil.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -29,7 +30,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"	@(#)profil.2	8.1 (Berkeley) 6/4/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/profil.2 165903 2007-01-09 00:28:16Z imp $
 .\"
 .Dd June 4, 1993
 .Dt PROFIL 2


Property changes on: trunk/lib/libc/sys/profil.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/pselect.2
===================================================================
--- trunk/lib/libc/sys/pselect.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/pselect.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\"
 .\" Copyright 2002 Massachusetts Institute of Technology
 .\"
@@ -26,9 +27,9 @@
 .\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/pselect.2 254414 2013-08-16 14:06:29Z jilles $
 .\"
-.Dd October 27, 2009
+.Dd August 16, 2013
 .Dt PSELECT 2
 .Os
 .Sh NAME
@@ -104,7 +105,8 @@
 .Xr kqueue 2 ,
 .Xr poll 2 ,
 .Xr select 2 ,
-.Xr sigprocmask 2
+.Xr sigprocmask 2 ,
+.Xr sigsuspend 2
 .Sh STANDARDS
 The
 .Fn pselect


Property changes on: trunk/lib/libc/sys/pselect.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: trunk/lib/libc/sys/pselect.c
===================================================================
--- trunk/lib/libc/sys/pselect.c	                        (rev 0)
+++ trunk/lib/libc/sys/pselect.c	2018-06-07 12:22:26 UTC (rev 10509)
@@ -0,0 +1,52 @@
+/* $MidnightBSD$ */
+/*
+ * Copyright (c) 2014 The FreeBSD Foundation.
+ * All rights reserved.
+ *
+ * Portions of this software were developed by Konstantin Belousov
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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(s), this list of conditions and the following disclaimer as
+ *    the first lines of this file unmodified other than the possible
+ *    addition of one or more copyright notices.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice(s), 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 COPYRIGHT HOLDER(S) ``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 COPYRIGHT HOLDER(S) 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/cdefs.h>
+__FBSDID("$FreeBSD: stable/10/lib/libc/sys/pselect.c 277317 2015-01-18 11:54:20Z kib $");
+
+#include <sys/types.h>
+#include <sys/select.h>
+#include "libc_private.h"
+
+__weak_reference(__sys_pselect, __pselect);
+
+#pragma weak pselect
+int
+pselect(int n, fd_set *rs, fd_set *ws, fd_set *es, const struct timespec *t,
+    const sigset_t *s)
+{
+
+	return (((int (*)(int, fd_set *, fd_set *, fd_set *,
+	    const struct timespec *, const sigset_t *))
+	    __libc_interposing[INTERPOS_pselect])(n, rs, ws, es, t, s));
+}


Property changes on: trunk/lib/libc/sys/pselect.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: trunk/lib/libc/sys/ptrace.2
===================================================================
--- trunk/lib/libc/sys/ptrace.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/ptrace.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,8 +1,9 @@
 .\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/ptrace.2 321146 2017-07-18 18:15:45Z ngie $
 .\"	$NetBSD: ptrace.2,v 1.2 1995/02/27 12:35:37 cgd Exp $
 .\"
 .\" This file is in the public domain.
-.Dd February 7, 2013
+.Dd August 28, 2016
 .Dt PTRACE 2
 .Os
 .Sh NAME
@@ -58,8 +59,9 @@
 traced process behavior, or use of the
 .Xr kill 2
 system call; alternatively, it may be generated by the tracing facility
-as a result of attaching, system calls, or stepping by the tracing
-process.
+as a result of attaching, stepping by the tracing
+process,
+or an event in the traced process.
 The tracing process may choose to intercept the signal, using it to
 observe process behavior (such as
 .Dv SIGTRAP ) ,
@@ -69,7 +71,154 @@
 system call
 is the mechanism by which all this happens.
 .Pp
+A traced process may report additional signal stops corresponding to
+events in the traced process.
+These additional signal stops are reported as
+.Dv SIGTRAP
+or
+.Dv SIGSTOP
+signals.
+The tracing process can use the
+.Dv PT_LWPINFO
+request to determine which events are associated with a
+.Dv SIGTRAP
+or
+.Dv SIGSTOP
+signal.
+Note that multiple events may be associated with a single signal.
+For example, events indicated by the
+.Dv PL_FLAG_BORN ,
+.Dv PL_FLAG_FORKED ,
+and
+.Dv PL_FLAG_EXEC
+flags are also reported as a system call exit event
+.Pq Dv PL_FLAG_SCX .
+The signal stop for a new child process enabled via
+.Dv PTRACE_FORK
+will report a
+.Dv SIGSTOP
+signal.
+All other additional signal stops use
+.Dv SIGTRAP .
+.Pp
+Each traced process has a tracing event mask.
+An event in the traced process only reports a
+signal stop if the corresponding flag is set in the tracing event mask.
+The current set of tracing event flags include:
+.Bl -tag -width "Dv PTRACE_SYSCALL"
+.It Dv PTRACE_EXEC
+Report a stop for a successful invocation of
+.Xr execve 2 .
+This event is indicated by the
+.Dv PL_FLAG_EXEC
+flag in the
+.Va pl_flags
+member of
+.Vt "struct ptrace_lwpinfo" .
+.It Dv PTRACE_SCE
+Report a stop on each system call entry.
+This event is indicated by the
+.Dv PL_FLAG_SCE
+flag in the
+.Va pl_flags
+member of
+.Vt "struct ptrace_lwpinfo" .
+.It Dv PTRACE_SCX
+Report a stop on each system call exit.
+This event is indicated by the
+.Dv PL_FLAG_SCX
+flag in the
+.Va pl_flags
+member of
+.Vt "struct ptrace_lwpinfo" .
+.It Dv PTRACE_SYSCALL
+Report stops for both system call entry and exit.
+.It Dv PTRACE_FORK
+This event flag controls tracing for new child processes of a traced process.
+.Pp
+When this event flag is enabled,
+new child processes will enable tracing and stop before executing their
+first instruction.
+The new child process will include the
+.Dv PL_FLAG_CHILD
+flag in the
+.Va pl_flags
+member of
+.Vt "struct ptrace_lwpinfo" .
+The traced process will report a stop that includes the
+.Dv PL_FLAG_FORKED
+flag.
+The process ID of the new child process will also be present in the
+.Va pl_child_pid
+member of
+.Vt "struct ptrace_lwpinfo" .
+If the new child process was created via
+.Xr vfork 2 ,
+the traced process's stop will also include the
+.Dv PL_FLAG_VFORKED
+flag.
+Note that new child processes will be attached with the default
+tracing event mask;
+they do not inherit the event mask of the traced process.
+.Pp
+When this event flag is not enabled,
+new child processes will execute without tracing enabled.
+.It Dv PTRACE_LWP
+This event flag controls tracing of LWP
+.Pq kernel thread
+creation and destruction.
+When this event is enabled,
+new LWPs will stop and report an event with
+.Dv PL_FLAG_BORN
+set before executing their first instruction,
+and exiting LWPs will stop and report an event with
+.Dv PL_FLAG_EXITED
+set before completing their termination.
+.Pp
+Note that new processes do not report an event for the creation of their
+initial thread,
+and exiting processes do not report an event for the termination of the
+last thread.
+.It Dv PTRACE_VFORK
+Report a stop event when a parent process resumes after a
+.Xr vfork 2 .
+.Pp
+When a thread in the traced process creates a new child process via
+.Xr vfork 2 ,
+the stop that reports
+.Dv PL_FLAG_FORKED
+and
+.Dv PL_FLAG_SCX
+occurs just after the child process is created,
+but before the thread waits for the child process to stop sharing process
+memory.
+If a debugger is not tracing the new child process,
+it must ensure that no breakpoints are enabled in the shared process
+memory before detaching from the new child process.
+This means that no breakpoints are enabled in the parent process either.
+.Pp
 The
+.Dv PTRACE_VFORK
+flag enables a new stop that indicates when the new child process stops
+sharing the process memory of the parent process.
+A debugger can reinsert breakpoints in the parent process and resume it
+in response to this event.
+This event is indicated by setting the
+.Dv PL_FLAG_VFORK_DONE
+flag.
+.El
+.Pp
+The default tracing event mask when attaching to a process via
+.Dv PT_ATTACH ,
+.Dv PT_TRACE_ME ,
+or
+.Dv PTRACE_FORK
+includes only
+.Dv PTRACE_EXEC
+events.
+All other event flags are disabled.
+.Pp
+The
 .Fa request
 argument specifies what operation is being performed; the meaning of
 the rest of the arguments depends on the operation, but except for one
@@ -83,7 +232,7 @@
 .Fa request
 argument
 can be:
-.Bl -tag -width 12n
+.Bl -tag -width "Dv PT_GET_EVENT_MASK"
 .It Dv PT_TRACE_ME
 This request is the only one used by the traced process; it declares
 that the process expects to be traced by its parent.
@@ -306,7 +455,9 @@
 	sigset_t pl_siglist;
 	siginfo_t pl_siginfo;
 	char	pl_tdname[MAXCOMLEN + 1];
-	int	pl_child_pid;
+	pid_t	pl_child_pid;
+	u_int	pl_syscall_code;
+	u_int	pl_syscall_narg;
 };
 .Ed
 .Pp
@@ -319,31 +470,31 @@
 .Vt "struct ptrace_lwpinfo"
 have the following meaning:
 .Bl -tag -width indent -compact
-.It pl_lwpid
+.It Va pl_lwpid
 LWP id of the thread
-.It pl_event
+.It Va pl_event
 Event that caused the stop.
-Currently defined events are
-.Bl -tag -width indent -compact
-.It PL_EVENT_NONE
+Currently defined events are:
+.Bl -tag -width "Dv PL_EVENT_SIGNAL" -compact
+.It Dv PL_EVENT_NONE
 No reason given
-.It PL_EVENT_SIGNAL
+.It Dv PL_EVENT_SIGNAL
 Thread stopped due to the pending signal
 .El
-.It pl_flags
+.It Va pl_flags
 Flags that specify additional details about observed stop.
 Currently defined flags are:
 .Bl -tag -width indent -compact
-.It PL_FLAG_SCE
+.It Dv PL_FLAG_SCE
 The thread stopped due to system call entry, right after the kernel is entered.
 The debugger may examine syscall arguments that are stored in memory and
 registers according to the ABI of the current process, and modify them,
 if needed.
-.It PL_FLAG_SCX
+.It Dv PL_FLAG_SCX
 The thread is stopped immediately before syscall is returning to the usermode.
 The debugger may examine system call return values in the ABI-defined registers
 and/or memory.
-.It PL_FLAG_EXEC
+.It Dv PL_FLAG_EXEC
 When
 .Dv PL_FLAG_SCX
 is set, this flag may be additionally specified to inform that the
@@ -351,13 +502,13 @@
 execution of a system call from the
 .Fn execve 2
 family.
-.It PL_FLAG_SI
+.It Dv PL_FLAG_SI
 Indicates that
 .Va pl_siginfo
 member of
 .Vt "struct ptrace_lwpinfo"
 contains valid information.
-.It PL_FLAG_FORKED
+.It Dv PL_FLAG_FORKED
 Indicates that the process is returning from a call to
 .Fn fork 2
 that created a new child process.
@@ -365,19 +516,42 @@
 .Va pl_child_pid
 member of
 .Vt "struct ptrace_lwpinfo" .
-.It PL_FLAG_CHILD
-The flag is set for first event reported from a new child, which is
-automatically attached due to
-.Dv PT_FOLLOW_FORK
-enabled.
+.It Dv PL_FLAG_CHILD
+The flag is set for first event reported from a new child which is
+automatically attached when
+.Dv PTRACE_FORK
+is enabled.
+.It Dv PL_FLAG_BORN
+This flag is set for the first event reported from a new LWP when
+.Dv PTRACE_LWP
+is enabled.
+It is reported along with
+.Dv PL_FLAG_SCX .
+.It Dv PL_FLAG_EXITED
+This flag is set for the last event reported by an exiting LWP when
+.Dv PTRACE_LWP
+is enabled.
+Note that this event is not reported when the last LWP in a process exits.
+The termination of the last thread is reported via a normal process exit
+event.
+.It Dv PL_FLAG_VFORKED
+Indicates that the thread is returning from a call to
+.Xr vfork 2
+that created a new child process.
+This flag is set in addition to
+.Dv PL_FLAG_FORKED .
+.It Dv PL_FLAG_VFORK_DONE
+Indicates that the thread has resumed after a child process created via
+.Xr vfork 2
+has stopped sharing its address space with the traced process.
 .El
-.It pl_sigmask
+.It Va pl_sigmask
 The current signal mask of the LWP
-.It pl_siglist
+.It Va pl_siglist
 The current pending set of signals for the LWP.
 Note that signals that are delivered to the process would not appear
 on an LWP siglist until the thread is selected for delivery.
-.It pl_siginfo
+.It Va pl_siginfo
 The siginfo that accompanies the signal pending.
 Only valid for
 .Dv PL_EVENT_SIGNAL
@@ -385,9 +559,9 @@
 .Dv PL_FLAG_SI
 is set in
 .Va pl_flags .
-.It pl_tdname
+.It Va pl_tdname
 The name of the thread.
-.It pl_child_pid
+.It Va pl_child_pid
 The process identifier of the new child process.
 Only valid for a
 .Dv PL_EVENT_SIGNAL
@@ -395,11 +569,32 @@
 .Dv PL_FLAG_FORKED
 is set in
 .Va pl_flags .
+.It Va pl_syscall_code
+The ABI-specific identifier of the current system call.
+Note that for indirect system calls this field reports the indirected
+system call.
+Only valid when
+.Dv PL_FLAG_SCE
+or
+.Dv PL_FLAG_SCX
+is set in
+.Va pl_flags.
+.It Va pl_syscall_narg
+The number of arguments passed to the current system call not counting
+the system call identifier.
+Note that for indirect system calls this field reports the arguments
+passed to the indirected system call.
+Only valid when
+.Dv PL_FLAG_SCE
+or
+.Dv PL_FLAG_SCX
+is set in
+.Va pl_flags.
 .El
-.It PT_GETNUMLWPS
+.It Dv PT_GETNUMLWPS
 This request returns the number of kernel threads associated with the
 traced process.
-.It PT_GETLWPLIST
+.It Dv PT_GETLWPLIST
 This request can be used to get the current thread list.
 A pointer to an array of type
 .Vt lwpid_t
@@ -410,43 +605,88 @@
 The return value from
 .Fn ptrace
 is the count of array entries filled in.
-.It PT_SETSTEP
+.It Dv PT_SETSTEP
 This request will turn on single stepping of the specified process.
-.It PT_CLEARSTEP
+.It Dv PT_CLEARSTEP
 This request will turn off single stepping of the specified process.
-.It PT_SUSPEND
+.It Dv PT_SUSPEND
 This request will suspend the specified thread.
-.It PT_RESUME
+.It Dv PT_RESUME
 This request will resume the specified thread.
-.It PT_TO_SCE
-This request will trace the specified process on each system call entry.
-.It PT_TO_SCX
-This request will trace the specified process on each system call exit.
-.It PT_SYSCALL
-This request will trace the specified process
-on each system call entry and exit.
-.It PT_FOLLOW_FORK
+.It Dv PT_TO_SCE
+This request will set the
+.Dv PTRACE_SCE
+event flag to trace all future system call entries and continue the process.
+The
+.Fa addr
+and
+.Fa data
+arguments are used the same as for
+.Dv PT_CONTINUE.
+.It Dv PT_TO_SCX
+This request will set the
+.Dv PTRACE_SCX
+event flag to trace all future system call exits and continue the process.
+The
+.Fa addr
+and
+.Fa data
+arguments are used the same as for
+.Dv PT_CONTINUE.
+.It Dv PT_SYSCALL
+This request will set the
+.Dv PTRACE_SYSCALL
+event flag to trace all future system call entries and exits and continue
+the process.
+The
+.Fa addr
+and
+.Fa data
+arguments are used the same as for
+.Dv PT_CONTINUE.
+.It Dv PT_FOLLOW_FORK
 This request controls tracing for new child processes of a traced process.
 If
 .Fa data
 is non-zero,
-then new child processes will enable tracing and stop before executing their
-first instruction.
+.Dv PTRACE_FORK
+is set in the traced process's event tracing mask.
 If
 .Fa data
-is zero, then new child processes will execute without tracing enabled.
-By default, tracing is not enabled for new child processes.
-Child processes do not inherit this property.
-The traced process will set the
-.Dv PL_FLAG_FORKED
-flag upon exit from a system call that creates a new process.
-.It PT_VM_TIMESTAMP
+is zero,
+.Dv PTRACE_FORK
+is cleared from the traced process's event tracing mask.
+.It Dv PT_LWP_EVENTS
+This request controls tracing of LWP creation and destruction.
+If
+.Fa data
+is non-zero,
+.Dv PTRACE_LWP
+is set in the traced process's event tracing mask.
+If
+.Fa data
+is zero,
+.Dv PTRACE_LWP
+is cleared from the traced process's event tracing mask.
+.It Dv PT_GET_EVENT_MASK
+This request reads the traced process's event tracing mask into the
+integer pointed to by
+.Fa addr .
+The size of the integer must be passed in
+.Fa data .
+.It Dv PT_SET_EVENT_MASK
+This request sets the traced process's event tracing mask from the
+integer pointed to by
+.Fa addr .
+The size of the integer must be passed in
+.Fa data .
+.It Dv PT_VM_TIMESTAMP
 This request returns the generation number or timestamp of the memory map of
 the traced process as the return value from
 .Fn ptrace .
 This provides a low-cost way for the tracing process to determine if the
 VM map changed since the last time this request was made.
-.It PT_VM_ENTRY
+.It Dv PT_VM_ENTRY
 This request is used to iterate over the entries of the VM map of the traced
 process.
 The
@@ -503,8 +743,163 @@
 .Fa data
 argument is ignored.
 .El
+.Sh x86 MACHINE-SPECIFIC REQUESTS
+.Bl -tag -width "Dv PT_GETXSTATE_INFO"
+.It Dv PT_GETXMMREGS
+Copy the XMM FPU state into the buffer pointed to by the
+argument
+.Fa addr .
+The buffer has the same layout as the 32-bit save buffer for the
+machine instruction
+.Dv FXSAVE .
 .Pp
-Additionally, machine-specific requests can exist.
+This request is only valid for i386 programs, both on native 32-bit
+systems and on amd64 kernels.
+For 64-bit amd64 programs, the XMM state is reported as part of
+the FPU state returned by the
+.Dv PT_GETFPREGS
+request.
+.Pp
+The
+.Fa data
+argument is ignored.
+.It Dv PT_SETXMMREGS
+Load the XMM FPU state for the thread from the buffer pointed to
+by the argument
+.Fa addr .
+The buffer has the same layout as the 32-bit load buffer for the
+machine instruction
+.Dv FXRSTOR .
+.Pp
+As with
+.Dv PT_GETXMMREGS,
+this request is only valid for i386 programs.
+.Pp
+The
+.Fa data
+argument is ignored.
+.It Dv PT_GETXSTATE_INFO
+Report which XSAVE FPU extensions are supported by the CPU
+and allowed in userspace programs.
+The
+.Fa addr
+argument must point to a variable of type
+.Vt struct ptrace_xstate_info ,
+which contains the information on the request return.
+.Vt struct ptrace_xstate_info
+is defined as follows:
+.Bd -literal
+struct ptrace_xstate_info {
+	uint64_t	xsave_mask;
+	uint32_t	xsave_len;
+};
+.Ed
+The
+.Dv xsave_mask
+field is a bitmask of the currently enabled extensions.
+The meaning of the bits is defined in the Intel and AMD
+processor documentation.
+The
+.Dv xsave_len
+field reports the length of the XSAVE area for storing the hardware
+state for currently enabled extensions in the format defined by the x86
+.Dv XSAVE
+machine instruction.
+.Pp
+The
+.Fa data
+argument value must be equal to the size of the
+.Vt struct ptrace_xstate_info .
+.It Dv PT_GETXSTATE
+Return the content of the XSAVE area for the thread.
+The
+.Fa addr
+argument points to the buffer where the content is copied, and the
+.Fa data
+argument specifies the size of the buffer.
+The kernel copies out as much content as allowed by the buffer size.
+The buffer layout is specified by the layout of the save area for the
+.Dv XSAVE
+machine instruction.
+.It Dv PT_SETXSTATE
+Load the XSAVE state for the thread from the buffer specified by the
+.Fa addr
+pointer.
+The buffer size is passed in the
+.Fa data
+argument.
+The buffer must be at least as large as the
+.Vt struct savefpu
+(defined in
+.Pa x86/fpu.h )
+to allow the complete x87 FPU and XMM state load.
+It must not be larger than the XSAVE state length, as reported by the
+.Dv xsave_len
+field from the
+.Vt struct ptrace_xstate_info
+of the
+.Dv PT_GETXSTATE_INFO
+request.
+Layout of the buffer is identical to the layout of the load area for the
+.Dv XRSTOR
+machine instruction.
+.It Dv PT_GETFSBASE
+Return the value of the base used when doing segmented
+memory addressing using the %fs segment register.
+The
+.Fa addr
+argument points to an
+.Vt unsigned long
+variable where the base value is stored.
+.Pp
+The
+.Fa data
+argument is ignored.
+.It Dv PT_GETGSBASE
+Like the
+.Dv PT_GETFSBASE
+request, but returns the base for the %gs segment register.
+.It Dv PT_SETFSBASE
+Set the base for the %fs segment register to the value pointed to
+by the
+.Fa addr
+argument.
+.Fa addr
+must point to the
+.Vt unsigned long
+variable containing the new base.
+.Pp
+The
+.Fa data
+argument is ignored.
+.It Dv PT_SETGSBASE
+Like the
+.Dv PT_SETFSBASE
+request, but sets the base for the %gs segment register.
+.El
+.Sh PowerPC MACHINE-SPECIFIC REQUESTS
+.Bl -tag -width "Dv PT_SETVRREGS"
+.It Dv PT_GETVRREGS
+Return the thread's
+.Dv ALTIVEC
+machine state in the buffer pointed to by
+.Fa addr .
+.Pp
+The
+.Fa data
+argument is ignored.
+.It Dv PT_SETVRREGS
+Set the thread's
+.Dv ALTIVEC
+machine state from the buffer pointed to by
+.Fa addr .
+.Pp
+The
+.Fa data
+argument is ignored.
+.El
+.Pp
+Additionally, other machine-specific requests can exist.
 .Sh RETURN VALUES
 Some requests can cause
 .Fn ptrace
@@ -512,7 +907,13 @@
 \-1
 as a non-error value; to disambiguate,
 .Va errno
-can be set to 0 before the call and checked afterwards.
+is set to 0 in the libc wrapper for the
+.Fn ptrace
+system call and
+.Fn ptrace
+callers can reliably check
+.Va errno
+for non-zero value afterwards.
 .Sh ERRORS
 The
 .Fn ptrace
@@ -556,6 +957,46 @@
 was given an invalid value for
 .Fa pve_entry .
 This can also be caused by changes to the VM map of the process.
+.It
+The size (in
+.Fa data )
+provided to
+.Dv PT_LWPINFO
+was less than or equal to zero, or larger than the
+.Vt ptrace_lwpinfo
+structure known to the kernel.
+.It
+The size (in
+.Fa data )
+provided to the x86-specific
+.Dv PT_GETXSTATE_INFO
+request was not equal to the size of the
+.Vt struct ptrace_xstate_info .
+.It
+The size (in
+.Fa data )
+provided to the x86-specific
+.Dv PT_SETXSTATE
+request was less than the size of the x87 plus the XMM save area.
+.It
+The size (in
+.Fa data )
+provided to the x86-specific
+.Dv PT_SETXSTATE
+request was larger than returned in the
+.Dv xsave_len
+member of the
+.Vt struct ptrace_xstate_info
+from the
+.Dv PT_GETXSTATE_INFO
+request.
+.It
+The base value, provided to the amd64-specific requests
+.Dv PT_SETFSBASE
+or
+.Dv PT_SETGSBASE ,
+pointed outside of the valid user address space.
+This error will not occur in 32-bit programs.
 .El
 .It Bq Er EBUSY
 .Bl -bullet -compact


Property changes on: trunk/lib/libc/sys/ptrace.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: trunk/lib/libc/sys/ptrace.c
===================================================================
--- trunk/lib/libc/sys/ptrace.c	                        (rev 0)
+++ trunk/lib/libc/sys/ptrace.c	2018-06-07 12:22:26 UTC (rev 10509)
@@ -0,0 +1,50 @@
+/* $MidnightBSD$ */
+/*
+ * Copyright (c) 2016 The FreeBSD Foundation.
+ * All rights reserved.
+ *
+ * Portions of this software were developed by Konstantin Belousov
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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(s), this list of conditions and the following disclaimer as
+ *    the first lines of this file unmodified other than the possible
+ *    addition of one or more copyright notices.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice(s), 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 COPYRIGHT HOLDER(S) ``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 COPYRIGHT HOLDER(S) 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/cdefs.h>
+__FBSDID("$FreeBSD: stable/10/lib/libc/sys/ptrace.c 305341 2016-09-03 11:09:47Z kib $");
+
+#include <sys/types.h>
+#include <sys/ptrace.h>
+#include <errno.h>
+#include "libc_private.h"
+
+__weak_reference(_ptrace, ptrace);
+
+int
+_ptrace(int request, pid_t pid, caddr_t addr, int data)
+{
+
+	errno = 0;
+	return (__sys_ptrace(request, pid, addr, data));
+}


Property changes on: trunk/lib/libc/sys/ptrace.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: trunk/lib/libc/sys/pwrite.c
===================================================================
--- trunk/lib/libc/sys/pwrite.c	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/pwrite.c	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * Copyright (c) 1992, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -31,7 +32,7 @@
 static char sccsid[] = "@(#)mmap.c	8.1 (Berkeley) 6/17/93";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__MBSDID("$FreeBSD: src/lib/libc/sys/pwrite.c,v 1.4 2007/07/04 23:27:38 peter Exp $");
+__FBSDID("$FreeBSD: stable/10/lib/libc/sys/pwrite.c 171219 2007-07-04 23:27:38Z peter $");
 
 #include <sys/types.h>
 #include <sys/syscall.h>
@@ -49,7 +50,7 @@
 	size_t	nbyte;
 	off_t	offset;
 {
-	if (__getosreldate() >= 4013)
+	if (__getosreldate() >= 700051)
 		return (__sys_pwrite(fd, buf, nbyte, offset));
 	else
 		return (__sys_freebsd6_pwrite(fd, buf, nbyte, 0, offset));

Modified: trunk/lib/libc/sys/quotactl.2
===================================================================
--- trunk/lib/libc/sys/quotactl.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/quotactl.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1983, 1990, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -29,7 +30,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"	@(#)quotactl.2	8.2 (Berkeley) 3/10/95
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/quotactl.2 233648 2012-03-29 05:02:12Z eadler $
 .\"
 .Dd March 5, 1999
 .Dt QUOTACTL 2


Property changes on: trunk/lib/libc/sys/quotactl.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: trunk/lib/libc/sys/rctl_add_rule.2
===================================================================
--- trunk/lib/libc/sys/rctl_add_rule.2	                        (rev 0)
+++ trunk/lib/libc/sys/rctl_add_rule.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -0,0 +1,221 @@
+.\" $MidnightBSD$
+.\" Copyright (c) 2016 Eric Badger
+.\" 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: stable/10/lib/libc/sys/rctl_add_rule.2 321146 2017-07-18 18:15:45Z ngie $
+.\"
+.Dd September 14, 2016
+.Dt RCTL_ADD_RULE 2
+.Os
+.Sh NAME
+.Nm rctl_add_rule ,
+.Nm rctl_get_limits ,
+.Nm rctl_get_racct ,
+.Nm rctl_get_rules ,
+.Nm rctl_remove_rule
+.Nd manipulate and query the resource limits database
+.Sh LIBRARY
+.Lb libc
+.Sh SYNOPSIS
+.In sys/rctl.h
+.Ft int
+.Fo rctl_add_rule
+.Fa "const char *inbufp" "size_t inbuflen" "char *outbufp" "size_t outbuflen"
+.Fc
+.Ft int
+.Fo rctl_get_limits
+.Fa "const char *inbufp" "size_t inbuflen" "char *outbufp" "size_t outbuflen"
+.Fc
+.Ft int
+.Fo rctl_get_racct
+.Fa "const char *inbufp" "size_t inbuflen" "char *outbufp" "size_t outbuflen"
+.Fc
+.Ft int
+.Fo rctl_get_rules
+.Fa "const char *inbufp" "size_t inbuflen" "char *outbufp" "size_t outbuflen"
+.Fc
+.Ft int
+.Fo rctl_remove_rule
+.Fa "const char *inbufp" "size_t inbuflen" "char *outbufp" "size_t outbuflen"
+.Fc
+.Sh DESCRIPTION
+These system calls are used to manipulate and query the resource limits
+database.
+For all functions,
+.Fa inbuflen
+refers to the length of the buffer pointed to by
+.Fa inbufp
+and
+.Fa outbuflen
+refers to the length of the buffer pointed to by
+.Fa outbufp .
+.Pp
+The
+.Fn rctl_add_rule
+function adds the rule pointed to by
+.Fa inbufp
+to the resource limits database.
+The
+.Fa outbufp
+and
+.Fa outbuflen
+arguments are unused.
+Rule format is as described in
+.Xr rctl 8 ,
+with exceptions noted in the
+.Sx RULES AND FILTERS
+section.
+.Pp
+The
+.Fn rctl_get_limits
+function returns in
+.Fa outbufp
+a comma-separated list of rules that apply to the process that
+matches the filter specified in
+.Fa inbufp .
+This includes rules with a subject of the process itself as well as rules
+with a different subject (such as user or loginclass) that apply to the
+process.
+.Pp
+The
+.Fn rctl_get_racct
+function returns resource usage information for a given subject.
+The subject is specified by passing a filter in
+.Fa inbufp .
+Filter syntax is as described in
+.Xr rctl 8 ,
+with exceptions noted in the
+.Sx RULES AND FILTERS
+section.
+A comma-separated list of resources and the amount used of each by the
+specified subject is returned in
+.Fa outbufp .
+The resource and amount is formatted as
+.Qq resource=amount .
+.Pp
+The
+.Fn rctl_get_rules
+function returns in
+.Fa outbufp
+a comma-separated list of rules from the resource limits database that
+match the filter passed in
+.Fa inbufp .
+Filter syntax is as described in
+.Xr rctl 8 ,
+with exceptions noted in the
+.Sx RULES AND FILTERS
+section.
+A filter of
+.Va ::
+may be passed to return all rules.
+.Pp
+The
+.Fn rctl_remove_rule
+function removes all rules matching the filter passed in
+.Fa inbufp
+from the resource limits database.
+Filter syntax is as described in
+.Xr rctl 8 ,
+with exceptions noted in the
+.Sx RULES AND FILTERS
+section.
+.Fa outbufp
+and
+.Fa outbuflen
+are unused.
+.Sh RULES AND FILTERS
+This section explains how the rule and filter format described in
+.Xr rctl 8
+differs from the format passed to the system calls themselves.
+The rctl tool provides several conveniences that the system calls do not.
+When using the system call:
+.Bl -dash -offset indent
+.It
+The subject must be fully specified.
+For example, abbreviating
+.Ql user
+to
+.Ql u
+is not acceptable.
+.It
+User and group IDs must be numeric.
+For example,
+.Ql root
+must be expressed as
+.Ql 0 .
+.It
+Units are not permitted on resource amounts.
+For example, a quantity of 1024 bytes must be expressed as
+.Ql 1024
+and not
+.Ql 1k .
+.El
+.Sh RETURN VALUES
+.Rv -std
+.Sh ERRORS
+The rctl system calls may fail if:
+.Bl -tag -width Er
+.It Bq Er ENOSYS
+RACCT/RCTL support is not present in the kernel or the
+.Va kern.racct.enable
+sysctl is 0.
+.It Bq Er EINVAL
+The rule or filter passed in
+.Fa inbufp
+is invalid.
+.It Bq Er EPERM
+User has insufficient privileges to carry out the requested operation.
+.It Bq Er E2BIG
+.Fa inbufp
+or
+.Fa outbufp
+are too large.
+.It Bq Er ESRCH
+No process matched the provided rule or filter.
+.It Bq Er ENAMETOOLONG
+The loginclass or jail name specified is too long.
+.It Bq Er ERANGE
+The rule amount is outside of the allowable range or
+.Fa outbufp
+is too small.
+.It Bq Er EOPNOTSUPP
+The requested operation is not supported for the given rule or filter.
+.It Bq Er EFAULT
+.Fa inbufp
+or
+.Fa outbufp
+refer to invalid addresses.
+.El
+.Sh SEE ALSO
+.Xr rctl 8
+.Sh HISTORY
+The rctl family of system calls appeared in
+.Fx 9.0 .
+.Sh AUTHORS
+.An -nosplit
+The rctl system calls were developed by
+.An Edward Tomasz Napierala Aq Mt trasz at FreeBSD.org
+under sponsorship from the FreeBSD Foundation.
+This manual page was written by
+.An Eric Badger Aq Mt badger at FreeBSD.org .


Property changes on: trunk/lib/libc/sys/rctl_add_rule.2
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: trunk/lib/libc/sys/read.2
===================================================================
--- trunk/lib/libc/sys/read.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/read.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1980, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,9 +27,9 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)read.2	8.4 (Berkeley) 2/26/94
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/read.2 255486 2013-09-12 00:53:38Z bdrewery $
 .\"
-.Dd October 11, 2006
+.Dd September 11, 2013
 .Dt READ 2
 .Os
 .Sh NAME
@@ -41,16 +42,16 @@
 .Lb libc
 .Sh SYNOPSIS
 .In sys/types.h
-.In sys/uio.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 +59,7 @@
 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 +108,7 @@
 .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 +150,12 @@
 .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 +174,7 @@
 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,


Property changes on: trunk/lib/libc/sys/read.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: trunk/lib/libc/sys/read.c
===================================================================
--- trunk/lib/libc/sys/read.c	                        (rev 0)
+++ trunk/lib/libc/sys/read.c	2018-06-07 12:22:26 UTC (rev 10509)
@@ -0,0 +1,51 @@
+/* $MidnightBSD$ */
+/*
+ * Copyright (c) 2014 The FreeBSD Foundation.
+ * All rights reserved.
+ *
+ * Portions of this software were developed by Konstantin Belousov
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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(s), this list of conditions and the following disclaimer as
+ *    the first lines of this file unmodified other than the possible
+ *    addition of one or more copyright notices.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice(s), 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 COPYRIGHT HOLDER(S) ``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 COPYRIGHT HOLDER(S) 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/cdefs.h>
+__FBSDID("$FreeBSD: stable/10/lib/libc/sys/read.c 277317 2015-01-18 11:54:20Z kib $");
+
+#include <sys/types.h>
+#include <sys/syscall.h>
+#include <unistd.h>
+#include "libc_private.h"
+
+__weak_reference(__sys_read, __read);
+
+#pragma weak read
+ssize_t
+read(int fd, void *buf, size_t nbytes)
+{
+
+	return (((ssize_t (*)(int, void *, size_t))
+	    __libc_interposing[INTERPOS_read])(fd, buf, nbytes));
+}


Property changes on: trunk/lib/libc/sys/read.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: trunk/lib/libc/sys/readlink.2
===================================================================
--- trunk/lib/libc/sys/readlink.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/readlink.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1983, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,7 +27,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)readlink.2	8.1 (Berkeley) 6/4/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/readlink.2 178245 2008-04-16 13:03:12Z kib $
 .\"
 .Dd April 10, 2008
 .Dt READLINK 2


Property changes on: trunk/lib/libc/sys/readlink.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: trunk/lib/libc/sys/readv.c
===================================================================
--- trunk/lib/libc/sys/readv.c	                        (rev 0)
+++ trunk/lib/libc/sys/readv.c	2018-06-07 12:22:26 UTC (rev 10509)
@@ -0,0 +1,51 @@
+/* $MidnightBSD$ */
+/*
+ * Copyright (c) 2014 The FreeBSD Foundation.
+ * All rights reserved.
+ *
+ * Portions of this software were developed by Konstantin Belousov
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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(s), this list of conditions and the following disclaimer as
+ *    the first lines of this file unmodified other than the possible
+ *    addition of one or more copyright notices.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice(s), 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 COPYRIGHT HOLDER(S) ``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 COPYRIGHT HOLDER(S) 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/cdefs.h>
+__FBSDID("$FreeBSD: stable/10/lib/libc/sys/readv.c 277317 2015-01-18 11:54:20Z kib $");
+
+#include <sys/types.h>
+#include <sys/syscall.h>
+#include <unistd.h>
+#include "libc_private.h"
+
+__weak_reference(__sys_readv, __readv);
+
+#pragma weak readv
+ssize_t
+readv(int fd, const struct iovec *iov, int iovcnt)
+{
+
+	return (((ssize_t (*)(int, const struct iovec *, int))
+	    __libc_interposing[INTERPOS_readv])(fd, iov, iovcnt));
+}


Property changes on: trunk/lib/libc/sys/readv.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: trunk/lib/libc/sys/reboot.2
===================================================================
--- trunk/lib/libc/sys/reboot.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/reboot.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1980, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,7 +27,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)reboot.2	8.1 (Berkeley) 6/4/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/reboot.2 293743 2016-01-12 10:11:29Z trasz $
 .\"
 .Dd June 4, 1993
 .Dt REBOOT 2
@@ -113,6 +114,13 @@
 before the processor is halted or rebooted.
 This option may be useful if file system changes have been made manually
 or if the processor is on fire.
+.It Dv RB_REROOT
+Instead of rebooting, unmount all filesystems except the one containing
+currently-running executable, and mount root filesystem using the same
+mechanism which is used during normal boot, based on
+vfs.root.mountfrom
+.Xr kenv 8
+variable.
 .It Dv RB_RDONLY
 Initially mount the root file system read-only.
 This is currently the default, and this option has been deprecated.


Property changes on: trunk/lib/libc/sys/reboot.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/recv.2
===================================================================
--- trunk/lib/libc/sys/recv.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/recv.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1983, 1990, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,9 +27,9 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)recv.2	8.3 (Berkeley) 2/21/94
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/recv.2 313685 2017-02-12 18:52:01Z jilles $
 .\"
-.Dd September 12, 2012
+.Dd February 3, 2017
 .Dt RECV 2
 .Os
 .Sh NAME
@@ -44,7 +45,7 @@
 .Ft ssize_t
 .Fn recv "int s" "void *buf" "size_t len" "int flags"
 .Ft ssize_t
-.Fn recvfrom "int s" "void * restrict buf" "size_t len" "int flags" "struct sockaddr * restrict from" "socklen_t * restrict fromlen"
+.Fn recvfrom "int s" "void *buf" "size_t len" "int flags" "struct sockaddr * restrict from" "socklen_t * restrict fromlen"
 .Ft ssize_t
 .Fn recvmsg "int s" "struct msghdr *msg" "int flags"
 .Sh DESCRIPTION
@@ -121,11 +122,12 @@
 function is formed by
 .Em or Ap ing
 one or more of the values:
-.Bl -column ".Dv MSG_DONTWAIT" -offset indent
+.Bl -column ".Dv MSG_CMSG_CLOEXEC" -offset indent
 .It Dv MSG_OOB Ta process out-of-band data
 .It Dv MSG_PEEK Ta peek at incoming message
 .It Dv MSG_WAITALL Ta wait for full request or error
 .It Dv MSG_DONTWAIT Ta do not block
+.It Dv MSG_CMSG_CLOEXEC Ta set received fds close-on-exec
 .El
 .Pp
 The
@@ -217,53 +219,10 @@
 .Fn accept
 system call.
 .Pp
-Open file descriptors are now passed as ancillary data for
+With
 .Dv AF_UNIX
-domain sockets, with
-.Fa cmsg_level
-set to
-.Dv SOL_SOCKET
-and
-.Fa cmsg_type
-set to
-.Dv SCM_RIGHTS .
-.Pp
-Process credentials can also be passed as ancillary data for
-.Dv AF_UNIX
-domain sockets using a
-.Fa cmsg_type
-of
-.Dv SCM_CREDS .
-In this case,
-.Fa cmsg_data
-should be a structure of type
-.Fa cmsgcred ,
-which is defined in
-.In sys/socket.h
-as follows:
-.Bd -literal
-struct cmsgcred {
-	pid_t	cmcred_pid;		/* PID of sending process */
-	uid_t	cmcred_uid;		/* real UID of sending process */
-	uid_t	cmcred_euid;		/* effective UID of sending process */
-	gid_t	cmcred_gid;		/* real GID of sending process */
-	short	cmcred_ngroups;		/* number or groups */
-	gid_t	cmcred_groups[CMGROUP_MAX];	/* groups */
-};
-.Ed
-.Pp
-If a sender supplies ancillary data with enough space for the above struct
-tagged as
-.Dv SCM_CREDS
-control message type to the
-.Fn sendmsg
-system call, then kernel will fill in the credential information of the
-sending process and deliver it to the receiver.
-Since receiver usually has no control over a sender, this method of retrieving
-credential information isn't reliable.
-For reliable retrieval of remote side credentials it is advised to use the
-.Dv LOCAL_CREDS
-socket option on the receiving socket.
+domain sockets, ancillary data can be used to pass file descriptors and
+process credentials.
 See
 .Xr unix 4
 for details.


Property changes on: trunk/lib/libc/sys/recv.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: trunk/lib/libc/sys/recvfrom.c
===================================================================
--- trunk/lib/libc/sys/recvfrom.c	                        (rev 0)
+++ trunk/lib/libc/sys/recvfrom.c	2018-06-07 12:22:26 UTC (rev 10509)
@@ -0,0 +1,54 @@
+/* $MidnightBSD$ */
+/*
+ * Copyright (c) 2014 The FreeBSD Foundation.
+ * All rights reserved.
+ *
+ * Portions of this software were developed by Konstantin Belousov
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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(s), this list of conditions and the following disclaimer as
+ *    the first lines of this file unmodified other than the possible
+ *    addition of one or more copyright notices.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice(s), 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 COPYRIGHT HOLDER(S) ``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 COPYRIGHT HOLDER(S) 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/cdefs.h>
+__FBSDID("$FreeBSD: stable/10/lib/libc/sys/recvfrom.c 277317 2015-01-18 11:54:20Z kib $");
+
+#include <sys/types.h>
+#include <sys/syscall.h>
+#include <sys/socket.h>
+#include "libc_private.h"
+
+__weak_reference(__sys_recvfrom, __recvfrom);
+
+#pragma weak recvfrom
+ssize_t
+recvfrom(int s, void *buf, size_t len, int flags,
+    struct sockaddr * __restrict from, socklen_t * __restrict fromlen)
+{
+
+	return (((ssize_t (*)(int, void *, size_t, int,
+	    struct sockaddr *, socklen_t *))
+	    __libc_interposing[INTERPOS_recvfrom])(s, buf, len, flags,
+	   from, fromlen));
+}


Property changes on: trunk/lib/libc/sys/recvfrom.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/lib/libc/sys/recvmsg.c
===================================================================
--- trunk/lib/libc/sys/recvmsg.c	                        (rev 0)
+++ trunk/lib/libc/sys/recvmsg.c	2018-06-07 12:22:26 UTC (rev 10509)
@@ -0,0 +1,51 @@
+/* $MidnightBSD$ */
+/*
+ * Copyright (c) 2014 The FreeBSD Foundation.
+ * All rights reserved.
+ *
+ * Portions of this software were developed by Konstantin Belousov
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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(s), this list of conditions and the following disclaimer as
+ *    the first lines of this file unmodified other than the possible
+ *    addition of one or more copyright notices.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice(s), 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 COPYRIGHT HOLDER(S) ``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 COPYRIGHT HOLDER(S) 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/cdefs.h>
+__FBSDID("$FreeBSD: stable/10/lib/libc/sys/recvmsg.c 277317 2015-01-18 11:54:20Z kib $");
+
+#include <sys/types.h>
+#include <sys/syscall.h>
+#include <sys/socket.h>
+#include "libc_private.h"
+
+__weak_reference(__sys_recvmsg, __recvmsg);
+
+#pragma weak recvmsg
+ssize_t
+recvmsg(int s, struct msghdr *msg, int flags)
+{
+
+	return (((int (*)(int, struct msghdr *, int))
+	    __libc_interposing[INTERPOS_recvmsg])(s, msg, flags));
+}


Property changes on: trunk/lib/libc/sys/recvmsg.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: trunk/lib/libc/sys/rename.2
===================================================================
--- trunk/lib/libc/sys/rename.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/rename.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1983, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,7 +27,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)rename.2	8.1 (Berkeley) 6/4/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/rename.2 184750 2008-11-07 15:01:40Z trasz $
 .\"
 .Dd April 10, 2008
 .Dt RENAME 2


Property changes on: trunk/lib/libc/sys/rename.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/revoke.2
===================================================================
--- trunk/lib/libc/sys/revoke.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/revoke.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -29,7 +30,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)revoke.2	8.1 (Berkeley) 6/4/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/revoke.2 194267 2009-06-15 21:52:27Z ed $
 .\"
 .Dd June 4, 1993
 .Dt REVOKE 2


Property changes on: trunk/lib/libc/sys/revoke.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/rfork.2
===================================================================
--- trunk/lib/libc/sys/rfork.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/rfork.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,9 +1,10 @@
+.\" $MidnightBSD$
 .\"
 .\" This manual page is taken directly from Plan9, and modified to
 .\" describe the actual BSD implementation. Permission for
 .\" use of this page comes from Rob Pike <rob at plan9.att.com>.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/rfork.2 223967 2011-07-12 20:38:42Z kib $
 .\"
 .Dd July 12, 2011
 .Dt RFORK 2


Property changes on: trunk/lib/libc/sys/rfork.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/rmdir.2
===================================================================
--- trunk/lib/libc/sys/rmdir.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/rmdir.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1983, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,7 +27,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)rmdir.2	8.1 (Berkeley) 6/4/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/rmdir.2 165903 2007-01-09 00:28:16Z imp $
 .\"
 .Dd December 9, 2006
 .Dt RMDIR 2


Property changes on: trunk/lib/libc/sys/rmdir.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/rtprio.2
===================================================================
--- trunk/lib/libc/sys/rtprio.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/rtprio.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,5 @@
+.\" $MidnightBSD$
+.\"-
 .\" Copyright (c) 1994, Henrik Vestergaard Draboel
 .\" All rights reserved.
 .\"
@@ -26,15 +28,40 @@
 .\" 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.
+.\"-
+.\" Copyright (c) 2011 Xin LI <delphij at FreeBSD.org>
+.\" All rights reserved.
 .\"
-.\" $MidnightBSD$
+.\" 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.
 .\"
-.Dd July 23, 1994
+.\" 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: stable/10/lib/libc/sys/rtprio.2 243144 2012-11-16 09:56:25Z kevlo $
+.\"
+.Dd December 27, 2011
 .Dt RTPRIO 2
 .Os
 .Sh NAME
-.Nm rtprio
-.Nd examine or modify a process realtime or idle priority
+.Nm rtprio ,
+.Nm rtprio_thread
+.Nd examine or modify realtime or idle priority
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
@@ -42,11 +69,18 @@
 .In sys/rtprio.h
 .Ft int
 .Fn rtprio "int function" "pid_t pid" "struct rtprio *rtp"
+.Ft int
+.Fn rtprio_thread "int function" "lwpid_t lwpid" "struct rtprio *rtp"
 .Sh DESCRIPTION
 The
 .Fn rtprio
 system call
-is used to lookup or change the realtime or idle priority of a process.
+is used to lookup or change the realtime or idle priority of a process,
+or the calling thread.
+The
+.Fn rtprio_thread
+system call
+is used to lookup or change the realtime or idle priority of a thread.
 .Pp
 The
 .Fa function
@@ -54,11 +88,32 @@
 specifies the operation to be performed.
 RTP_LOOKUP to lookup the current priority,
 and RTP_SET to set the priority.
-The
+.Pp
+For the
+.Fn rtprio
+system call,
+the
 .Fa pid
 argument
-specifies the process to be used, 0 for the current process.
+specifies the process to operate on,
+0 for the calling thread.
+When
+.Fa pid
+is non-zero,
+the system call reports the highest priority in the process,
+or sets all threads' priority in the process,
+depending on value of the
+.Fa function
+argument.
 .Pp
+For the
+.Fn rtprio_thread
+system call,
+the
+.Fa lwpid
+specifies the thread to operate on,
+0 for the calling thread.
+.Pp
 The
 .Fa *rtp
 argument
@@ -84,31 +139,44 @@
 .Pp
 Realtime and idle priority is inherited through fork() and exec().
 .Pp
-A realtime process can only be preempted by a process of equal or
-higher priority, or by an interrupt; idle priority processes will run only
-when no other real/normal priority process is runnable.
-Higher real/idle priority processes
-preempt lower real/idle priority processes.
-Processes of equal real/idle priority are run round-robin.
+A realtime thread can only be preempted by a thread of equal or
+higher priority, or by an interrupt; idle priority threads will run only
+when no other real/normal priority thread is runnable.
+Higher real/idle priority threads
+preempt lower real/idle priority threads.
+Threads of equal real/idle priority are run round-robin.
 .Sh RETURN VALUES
-.Rv -std rtprio
+.Rv -std rtprio rtprio_thread
 .Sh ERRORS
 The
 .Fn rtprio
-system call
+and
+.Fn rtprio_thread
+system calls
 will fail if:
 .Bl -tag -width Er
+.It Bq Er EFAULT
+The rtp pointer passed to
+.Fn rtprio
+or
+.Fn rtprio_thread
+was invalid.
 .It Bq Er EINVAL
 The specified
 .Fa prio
 was out of range.
 .It Bq Er EPERM
-The calling process is not allowed to set the realtime priority.
+The calling thread is not allowed to set the realtime priority.
 Only
-root is allowed to change the realtime priority of any process, and non-root
-may only change the idle priority of the current process.
+root is allowed to change the realtime priority of any thread, and non-root
+may only change the idle priority of threads the user owns,
+when the
+.Xr sysctl 8
+variable
+.Va security.bsd.unprivileged_idprio
+is set to non-zero.
 .It Bq Er ESRCH
-The specified process was not found.
+The specified process or thread was not found or visible.
 .El
 .Sh SEE ALSO
 .Xr nice 1 ,
@@ -116,7 +184,8 @@
 .Xr rtprio 1 ,
 .Xr setpriority 2 ,
 .Xr nice 3 ,
-.Xr renice 8
+.Xr renice 8 ,
+.Xr p_cansee 9
 .Sh AUTHORS
 .An -nosplit
 The original author was
@@ -125,3 +194,7 @@
 .Fx
 was substantially rewritten by
 .An David Greenman .
+The
+.Fn rtprio_thread
+system call was implemented by
+.An David Xu .


Property changes on: trunk/lib/libc/sys/rtprio.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/sched_get_priority_max.2
===================================================================
--- trunk/lib/libc/sys/sched_get_priority_max.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/sched_get_priority_max.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1998 HD Associates, Inc.
 .\" All rights reserved.
 .\"
@@ -22,7 +23,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/sched_get_priority_max.2 131504 2004-07-02 23:52:20Z ru $
 .\"
 .Dd March 12, 1998
 .Dt SCHED_GET_PRIORITY_MAX 2


Property changes on: trunk/lib/libc/sys/sched_get_priority_max.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/sched_setparam.2
===================================================================
--- trunk/lib/libc/sys/sched_setparam.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/sched_setparam.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,4 +1,5 @@
 .\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/sched_setparam.2 131594 2004-07-04 20:55:50Z ru $
 .\" Copyright (c) 1998 HD Associates, Inc.
 .\" All rights reserved.
 .\"


Property changes on: trunk/lib/libc/sys/sched_setparam.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/sched_setscheduler.2
===================================================================
--- trunk/lib/libc/sys/sched_setscheduler.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/sched_setscheduler.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,4 +1,5 @@
 .\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/sched_setscheduler.2 213573 2010-10-08 12:40:16Z uqs $
 .\" Copyright (c) 1998 HD Associates, Inc.
 .\" All rights reserved.
 .\"


Property changes on: trunk/lib/libc/sys/sched_setscheduler.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/sched_yield.2
===================================================================
--- trunk/lib/libc/sys/sched_yield.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/sched_yield.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,4 +1,5 @@
 .\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/sched_yield.2 131504 2004-07-02 23:52:20Z ru $
 .\" Copyright (c) 1998 HD Associates, Inc.
 .\" All rights reserved.
 .\"


Property changes on: trunk/lib/libc/sys/sched_yield.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/sctp_generic_recvmsg.2
===================================================================
--- trunk/lib/libc/sys/sctp_generic_recvmsg.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/sctp_generic_recvmsg.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1983, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -9,11 +10,7 @@
 .\" 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.
-.\" 3. All advertising materials mentioning features or use of this software
-.\"    must display the following acknowledgement:
-.\"	This product includes software developed by the University of
-.\"	California, Berkeley and its contributors.
-.\" 4. Neither the name of the University nor the names of its contributors
+.\" 3. Neither the name of the University nor the names of its contributors
 .\"    may be used to endorse or promote products derived from this software
 .\"    without specific prior written permission.
 .\"
@@ -29,7 +26,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/sctp_generic_recvmsg.2 251071 2013-05-28 21:05:06Z emaste $
 .\"
 .Dd October 30, 2007
 .Dt SCTP_GENERIC_RECVMSG 2


Property changes on: trunk/lib/libc/sys/sctp_generic_recvmsg.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/sctp_generic_sendmsg.2
===================================================================
--- trunk/lib/libc/sys/sctp_generic_sendmsg.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/sctp_generic_sendmsg.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1983, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -9,11 +10,7 @@
 .\" 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.
-.\" 3. All advertising materials mentioning features or use of this software
-.\"    must display the following acknowledgement:
-.\"	This product includes software developed by the University of
-.\"	California, Berkeley and its contributors.
-.\" 4. Neither the name of the University nor the names of its contributors
+.\" 3. Neither the name of the University nor the names of its contributors
 .\"    may be used to endorse or promote products derived from this software
 .\"    without specific prior written permission.
 .\"
@@ -29,7 +26,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/sctp_generic_sendmsg.2 251071 2013-05-28 21:05:06Z emaste $
 .\"
 .Dd October 30, 2007
 .Dt SCTP_GENERIC_SENDMSG 2


Property changes on: trunk/lib/libc/sys/sctp_generic_sendmsg.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/sctp_peeloff.2
===================================================================
--- trunk/lib/libc/sys/sctp_peeloff.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/sctp_peeloff.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1983, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -9,11 +10,7 @@
 .\" 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.
-.\" 3. All advertising materials mentioning features or use of this software
-.\"    must display the following acknowledgement:
-.\"	This product includes software developed by the University of
-.\"	California, Berkeley and its contributors.
-.\" 4. Neither the name of the University nor the names of its contributors
+.\" 3. Neither the name of the University nor the names of its contributors
 .\"    may be used to endorse or promote products derived from this software
 .\"    without specific prior written permission.
 .\"
@@ -29,7 +26,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/sctp_peeloff.2 251071 2013-05-28 21:05:06Z emaste $
 .\"
 .Dd October 30, 2007
 .Dt SCTP_PEELOFF 2
@@ -51,7 +48,6 @@
 system call attempts detach the association specified by
 .Fa id
 into its own separate socket.
-.Pp
 .Sh RETURN VALUES
 The call returns -1 on failure and the new socket descriptor
 upon success.


Property changes on: trunk/lib/libc/sys/sctp_peeloff.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/select.2
===================================================================
--- trunk/lib/libc/sys/select.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/select.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1983, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,7 +27,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)select.2	8.2 (Berkeley) 3/25/94
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/select.2 233648 2012-03-29 05:02:12Z eadler $
 .\"
 .Dd November 17, 2002
 .Dt SELECT 2


Property changes on: trunk/lib/libc/sys/select.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: trunk/lib/libc/sys/select.c
===================================================================
--- trunk/lib/libc/sys/select.c	                        (rev 0)
+++ trunk/lib/libc/sys/select.c	2018-06-07 12:22:26 UTC (rev 10509)
@@ -0,0 +1,50 @@
+/* $MidnightBSD$ */
+/*
+ * Copyright (c) 2014 The FreeBSD Foundation.
+ * All rights reserved.
+ *
+ * Portions of this software were developed by Konstantin Belousov
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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(s), this list of conditions and the following disclaimer as
+ *    the first lines of this file unmodified other than the possible
+ *    addition of one or more copyright notices.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice(s), 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 COPYRIGHT HOLDER(S) ``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 COPYRIGHT HOLDER(S) 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/cdefs.h>
+__FBSDID("$FreeBSD: stable/10/lib/libc/sys/select.c 277317 2015-01-18 11:54:20Z kib $");
+
+#include <sys/types.h>
+#include <sys/select.h>
+#include "libc_private.h"
+
+__weak_reference(__sys_select, __select);
+
+#pragma weak select
+int
+select(int n, fd_set *rs, fd_set *ws, fd_set *es, struct timeval *t)
+{
+
+	return (((int (*)(int, fd_set *, fd_set *, fd_set *, struct timeval *))
+	    __libc_interposing[INTERPOS_select])(n, rs, ws, es, t));
+}


Property changes on: trunk/lib/libc/sys/select.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: trunk/lib/libc/sys/semctl.2
===================================================================
--- trunk/lib/libc/sys/semctl.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/semctl.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\"
 .\" Copyright (c) 1995 David Hovemeyer <daveho at infocom.com>
 .\"
@@ -23,7 +24,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.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/semctl.2 195172 2009-06-29 18:54:17Z kib $
 .\"
 .Dd September 12, 1995
 .Dt SEMCTL 2


Property changes on: trunk/lib/libc/sys/semctl.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/semget.2
===================================================================
--- trunk/lib/libc/sys/semget.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/semget.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\"
 .\" Copyright (c) 1995 David Hovemeyer <daveho at infocom.com>
 .\"
@@ -23,9 +24,9 @@
 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/semget.2 330801 2018-03-12 16:04:10Z brooks $
 .\"
-.Dd September 12, 1995
+.Dd March 4, 2018
 .Dt SEMGET 2
 .Os
 .Sh NAME
@@ -34,8 +35,6 @@
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
-.In sys/types.h
-.In sys/ipc.h
 .In sys/sem.h
 .Ft int
 .Fn semget "key_t key" "int nsems" "int flag"
@@ -77,23 +76,22 @@
 .\" Likewise for this section, except SHM_* becomes SEM_*.
 .\"
 .Pp
-The mode of a newly created IPC object is determined by
-.Em OR Ns 'ing
-the following constants into the
+The mode of a newly created IPC object is determined by ORing these constants
+into the
 .Fa flag
 argument:
-.Bl -tag -width XSEM_WXX6XXX
-.It Dv SEM_R
+.Bl -tag -width 0000
+.It Dv 0400
 Read access for user.
-.It Dv SEM_A
+.It Dv 0200
 Alter access for user.
-.It Dv ( SEM_R>>3 )
+.It Dv 0040
 Read access for group.
-.It Dv ( SEM_A>>3 )
+.It Dv 0020
 Alter access for group.
-.It Dv ( SEM_R>>6 )
+.It Dv 0004
 Read access for other.
-.It Dv ( SEM_A>>6 )
+.It Dv 0002
 Alter access for other.
 .El
 .Pp
@@ -132,6 +130,17 @@
 .It Bq Er EINVAL
 The number of semaphores requested exceeds the system imposed maximum
 per set.
+.It Bq Er EINVAL
+A semaphore set corresponding to
+.Fa key
+already exists and contains fewer semaphores than
+.Fa nsems .
+.It Bq Er EINVAL
+A semaphore set corresponding to
+.Fa key
+does not exist and
+.Fa nsems
+is 0 or negative.
 .It Bq Er ENOSPC
 Insufficiently many semaphores are available.
 .It Bq Er ENOSPC


Property changes on: trunk/lib/libc/sys/semget.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/semop.2
===================================================================
--- trunk/lib/libc/sys/semop.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/semop.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\"
 .\" Copyright (c) 1995 David Hovemeyer <daveho at infocom.com>
 .\"
@@ -23,7 +24,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.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/semop.2 211936 2010-08-28 16:32:01Z brucec $
 .\"
 .Dd September 22, 1995
 .Dt SEMOP 2


Property changes on: trunk/lib/libc/sys/semop.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/send.2
===================================================================
--- trunk/lib/libc/sys/send.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/send.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1983, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,7 +27,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     From: @(#)send.2	8.2 (Berkeley) 2/21/94
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/send.2 188144 2009-02-05 14:06:09Z jamie $
 .\"
 .Dd February 5, 2009
 .Dt SEND 2


Property changes on: trunk/lib/libc/sys/send.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/sendfile.2
===================================================================
--- trunk/lib/libc/sys/sendfile.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/sendfile.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 2003, David G. Lawrence
 .\" All rights reserved.
 .\"
@@ -23,7 +24,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/sendfile.2 243015 2012-11-14 01:45:10Z kevlo $
 .\"
 .Dd January 7, 2010
 .Dt SENDFILE 2
@@ -265,6 +266,8 @@
 .It Bq Er EIO
 An error occurred while reading from
 .Fa fd .
+.It Bq Er ENOBUFS
+The system was unable to allocate an internal buffer.
 .It Bq Er ENOTCONN
 The
 .Fa s


Property changes on: trunk/lib/libc/sys/sendfile.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: trunk/lib/libc/sys/sendmsg.c
===================================================================
--- trunk/lib/libc/sys/sendmsg.c	                        (rev 0)
+++ trunk/lib/libc/sys/sendmsg.c	2018-06-07 12:22:26 UTC (rev 10509)
@@ -0,0 +1,51 @@
+/* $MidnightBSD$ */
+/*
+ * Copyright (c) 2014 The FreeBSD Foundation.
+ * All rights reserved.
+ *
+ * Portions of this software were developed by Konstantin Belousov
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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(s), this list of conditions and the following disclaimer as
+ *    the first lines of this file unmodified other than the possible
+ *    addition of one or more copyright notices.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice(s), 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 COPYRIGHT HOLDER(S) ``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 COPYRIGHT HOLDER(S) 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/cdefs.h>
+__FBSDID("$FreeBSD: stable/10/lib/libc/sys/sendmsg.c 277317 2015-01-18 11:54:20Z kib $");
+
+#include <sys/types.h>
+#include <sys/syscall.h>
+#include <sys/socket.h>
+#include "libc_private.h"
+
+__weak_reference(__sys_sendmsg, __sendmsg);
+
+#pragma weak sendmsg
+ssize_t
+sendmsg(int s, const struct msghdr *msg, int flags)
+{
+
+	return (((int (*)(int, const struct msghdr *, int))
+	    __libc_interposing[INTERPOS_sendmsg])(s, msg, flags));
+}


Property changes on: trunk/lib/libc/sys/sendmsg.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/lib/libc/sys/sendto.c
===================================================================
--- trunk/lib/libc/sys/sendto.c	                        (rev 0)
+++ trunk/lib/libc/sys/sendto.c	2018-06-07 12:22:26 UTC (rev 10509)
@@ -0,0 +1,54 @@
+/* $MidnightBSD$ */
+/*
+ * Copyright (c) 2014 The FreeBSD Foundation.
+ * All rights reserved.
+ *
+ * Portions of this software were developed by Konstantin Belousov
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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(s), this list of conditions and the following disclaimer as
+ *    the first lines of this file unmodified other than the possible
+ *    addition of one or more copyright notices.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice(s), 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 COPYRIGHT HOLDER(S) ``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 COPYRIGHT HOLDER(S) 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/cdefs.h>
+__FBSDID("$FreeBSD: stable/10/lib/libc/sys/sendto.c 277317 2015-01-18 11:54:20Z kib $");
+
+#include <sys/types.h>
+#include <sys/syscall.h>
+#include <sys/socket.h>
+#include "libc_private.h"
+
+__weak_reference(__sys_sendto, __sendto);
+
+#pragma weak sendto
+ssize_t
+sendto(int s, const void *msg, size_t len, int flags,
+    const struct sockaddr *to, socklen_t tolen)
+{
+
+	return (((ssize_t (*)(int, const void *, size_t, int,
+	    const struct sockaddr *, socklen_t))
+	    __libc_interposing[INTERPOS_sendto])(s, msg, len, flags,
+	    to, tolen));
+}


Property changes on: trunk/lib/libc/sys/sendto.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/lib/libc/sys/setcontext.c
===================================================================
--- trunk/lib/libc/sys/setcontext.c	                        (rev 0)
+++ trunk/lib/libc/sys/setcontext.c	2018-06-07 12:22:26 UTC (rev 10509)
@@ -0,0 +1,53 @@
+/* $MidnightBSD$ */
+/*
+ * Copyright (c) 2014 The FreeBSD Foundation.
+ * All rights reserved.
+ *
+ * Portions of this software were developed by Konstantin Belousov
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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(s), this list of conditions and the following disclaimer as
+ *    the first lines of this file unmodified other than the possible
+ *    addition of one or more copyright notices.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice(s), 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 COPYRIGHT HOLDER(S) ``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 COPYRIGHT HOLDER(S) 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/cdefs.h>
+__FBSDID("$FreeBSD: stable/10/lib/libc/sys/setcontext.c 277317 2015-01-18 11:54:20Z kib $");
+
+#include <sys/types.h>
+#include <ucontext.h>
+#include "libc_private.h"
+
+__weak_reference(__sys_setcontext, __setcontext);
+__sym_compat(setcontext, __impl_setcontext, FBSD_1.0);
+__weak_reference(setcontext, __impl_setcontext);
+__sym_default(setcontext, setcontext, FBSD_1.2);
+
+#pragma weak setcontext
+int
+setcontext(const ucontext_t *uc)
+{
+
+	return (((int (*)(const ucontext_t *))
+	    __libc_interposing[INTERPOS_setcontext])(uc));
+}


Property changes on: trunk/lib/libc/sys/setcontext.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: trunk/lib/libc/sys/setfib.2
===================================================================
--- trunk/lib/libc/sys/setfib.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/setfib.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 2008 Cisco Systems.  All rights reserved.
 .\"    Author: Julian Elischer
 .\"
@@ -22,7 +23,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/setfib.2 250831 2013-05-20 20:47:40Z julian $
 .\"
 .Dd March 19, 2012
 .Dt SETFIB 2
@@ -47,13 +48,14 @@
 argument
 must be greater than or equal to 0
 and less than the current system maximum which
-may be retrieved by the 
+may be retrieved by the
 .Va net.fibs
 sysctl.
 The system maximum is set in the kernel configuration file with
+.Bd -ragged -offset indent
+.Cd "options ROUTETABLES=" Ns Em N
+.Ed
 .Pp
-.Dl options	ROUTETABLES= Ns Em N
-.Pp
 or in
 .Pa /boot/loader.conf
 with
@@ -63,11 +65,14 @@
 where
 .Em N
 is an integer.
-However, this maximum is capped at 16 due to the implementation storing
-the fib number in a 4-bit field in
+This maximum is capped at 65536 due to the implementation storing
+the fib number in a 16-bit field in the
 .Xr mbuf 9
-flags.
-The default fib of the process will be applied to all protocol families 
+packet header, however it is not suggested that one use such a large number
+as memory is allocated for every FIB regardless of whether it is used, and
+there are places where all FIBs are iterated over.
+.Pp
+The default fib of the process will be applied to all protocol families
 that support multiple fibs, and ignored by those that do not.
 The default fib for a process may be overridden for a socket with the use
 of the


Property changes on: trunk/lib/libc/sys/setfib.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/setgroups.2
===================================================================
--- trunk/lib/libc/sys/setgroups.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/setgroups.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1983, 1991, 1993, 1994
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,9 +27,9 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)setgroups.2	8.2 (Berkeley) 4/16/94
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/setgroups.2 328943 2018-02-06 19:09:49Z mckusick $
 .\"
-.Dd April 16, 1994
+.Dd January 19, 2018
 .Dt SETGROUPS 2
 .Os
 .Sh NAME
@@ -56,6 +57,23 @@
 .Dv {NGROUPS_MAX}+1 .
 .Pp
 Only the super-user may set a new group list.
+.Pp
+The first entry of the group array
+.Pq Va gidset[0]
+is used as the effective group-ID for the process.
+This entry is over-written when a setgid program is run.
+To avoid losing access to the privileges of the
+.Va gidset[0]
+entry, it should be duplicated later in the group array.
+By convention,
+this happens because the group value indicated
+in the password file also appears in
+.Pa /etc/group .
+The group value in the password file is placed in
+.Va gidset[0]
+and that value then gets added a second time when the
+.Pa /etc/group
+file is scanned to create the group set.
 .Sh RETURN VALUES
 .Rv -std setgroups
 .Sh ERRORS


Property changes on: trunk/lib/libc/sys/setgroups.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/setpgid.2
===================================================================
--- trunk/lib/libc/sys/setpgid.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/setpgid.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1980, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,7 +27,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)setpgid.2	8.1 (Berkeley) 6/4/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/setpgid.2 199985 2009-12-01 06:12:31Z keramida $
 .\"
 .Dd February 8, 2004
 .Dt SETPGID 2


Property changes on: trunk/lib/libc/sys/setpgid.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/setregid.2
===================================================================
--- trunk/lib/libc/sys/setregid.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/setregid.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1980, 1991, 1993, 1994
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,7 +27,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)setregid.2	8.2 (Berkeley) 4/16/94
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/setregid.2 165903 2007-01-09 00:28:16Z imp $
 .\"
 .Dd April 16, 1994
 .Dt SETREGID 2


Property changes on: trunk/lib/libc/sys/setregid.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/setresuid.2
===================================================================
--- trunk/lib/libc/sys/setresuid.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/setresuid.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 2000
 .\"      Sheldon Hearn.  All rights reserved.
 .\"
@@ -17,9 +18,9 @@
 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 .\" DAMAGES
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/setresuid.2 282957 2015-05-15 10:54:40Z trasz $
 .\"
-.Dd April 13, 2001
+.Dd February 7, 2015
 .Dt SETRESUID 2
 .Os
 .Sh NAME
@@ -90,10 +91,5 @@
 .Xr setregid 2 ,
 .Xr setreuid 2 ,
 .Xr setuid 2
-.Sh STANDARDS
-These system calls are not available on many platforms.
-They exist in
-.Fx
-to support Linux binaries linked against GNU libc2.
 .Sh HISTORY
 These functions first appeared in HP-UX.


Property changes on: trunk/lib/libc/sys/setresuid.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/setreuid.2
===================================================================
--- trunk/lib/libc/sys/setreuid.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/setreuid.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1980, 1991, 1993, 1994
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,7 +27,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)setreuid.2	8.2 (Berkeley) 4/16/94
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/setreuid.2 165903 2007-01-09 00:28:16Z imp $
 .\"
 .Dd February 8, 2001
 .Dt SETREUID 2


Property changes on: trunk/lib/libc/sys/setreuid.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/setsid.2
===================================================================
--- trunk/lib/libc/sys/setsid.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/setsid.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,7 +27,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"	@(#)setsid.2	8.1 (Berkeley) 6/4/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/setsid.2 165903 2007-01-09 00:28:16Z imp $
 .\"
 .Dd June 4, 1993
 .Dt SETSID 2


Property changes on: trunk/lib/libc/sys/setsid.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/setuid.2
===================================================================
--- trunk/lib/libc/sys/setuid.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/setuid.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1983, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,9 +27,9 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)setuid.2	8.1 (Berkeley) 6/4/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/setuid.2 297759 2016-04-09 19:29:39Z jilles $
 .\"
-.Dd June 4, 1993
+.Dd September 13, 2015
 .Dt SETUID 2
 .Os
 .Sh NAME
@@ -178,15 +179,10 @@
 	int fd;
 	/* ... */
 
-	fd = open("/path/to/sensitive/data", O_RDWR);
+	fd = open("/path/to/sensitive/data", O_RDWR | O_CLOEXEC);
 	if (fd == -1)
 		err(1, "open");
 
-	/*
-	 * Set close-on-exec flag; see fcntl(2) for more information.
-	 */
-	if (fcntl(fd, F_SETFD, FD_CLOEXEC) == -1)
-		err(1, "fcntl(F_SETFD)");
 	/* ... */
 	execve(path, argv, environ);
 }


Property changes on: trunk/lib/libc/sys/setuid.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/shm_open.2
===================================================================
--- trunk/lib/libc/sys/shm_open.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/shm_open.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\"
 .\" Copyright 2000 Massachusetts Institute of Technology
 .\"
@@ -26,7 +27,7 @@
 .\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/shm_open.2 235140 2012-05-08 18:56:21Z gjb $
 .\"
 .Dd March 20, 2007
 .Dt SHM_OPEN 2
@@ -139,7 +140,6 @@
 .Fn shm_unlink
 system call removes a shared memory object named
 .Fa path .
-.Pp
 .Sh RETURN VALUES
 If successful,
 .Fn shm_open


Property changes on: trunk/lib/libc/sys/shm_open.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/shmat.2
===================================================================
--- trunk/lib/libc/sys/shmat.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/shmat.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\"
 .\" Copyright (c) 1995 David Hovemeyer <daveho at infocom.com>
 .\"
@@ -23,7 +24,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.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/shmat.2 216508 2010-12-17 21:10:08Z brucec $
 .\"
 .Dd August 2, 1995
 .Dt SHMAT 2


Property changes on: trunk/lib/libc/sys/shmat.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/shmctl.2
===================================================================
--- trunk/lib/libc/sys/shmctl.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/shmctl.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\"
 .\" Copyright (c) 1995 David Hovemeyer <daveho at infocom.com>
 .\"
@@ -23,7 +24,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.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/shmctl.2 216508 2010-12-17 21:10:08Z brucec $
 .\"
 .Dd July 17, 1995
 .Dt SHMCTL 2


Property changes on: trunk/lib/libc/sys/shmctl.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/shmget.2
===================================================================
--- trunk/lib/libc/sys/shmget.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/shmget.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\"
 .\" Copyright (c) 1995 David Hovemeyer <daveho at infocom.com>
 .\"
@@ -23,9 +24,9 @@
 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/shmget.2 330801 2018-03-12 16:04:10Z brooks $
 .\"
-.Dd December 17, 2010
+.Dd March 4, 2018
 .Dt SHMGET 2
 .Os
 .Sh NAME
@@ -34,8 +35,6 @@
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
-.In sys/types.h
-.In sys/ipc.h
 .In sys/shm.h
 .Ft int
 .Fn shmget "key_t key" "size_t size" "int flag"
@@ -74,22 +73,21 @@
 .El
 .Pp
 The mode of a newly created IPC object is determined by
-.Em OR Ns 'ing
-the following constants into the
+which are set by ORing these constants into the
 .Fa flag
 argument:
-.Bl -tag -width XSHM_WXX6XXX
-.It Dv S_IRUSR
+.Bl -tag -width 0000
+.It Dv 0400
 Read access for owner.
-.It Dv S_IWUSR
+.It Dv 0200
 Write access for owner.
-.It Dv S_IRGRP
+.It Dv 0040
 Read access for group.
-.It Dv S_IWGRP
+.It Dv 0020
 Write access for group.
-.It Dv S_IROTH
+.It Dv 0004
 Read access for other.
-.It Dv S_IWOTH
+.It Dv 0002
 Write access for other.
 .El
 .\"
@@ -142,5 +140,4 @@
 .Xr shmat 2 ,
 .Xr shmctl 2 ,
 .Xr shmdt 2 ,
-.Xr stat 2 ,
 .Xr ftok 3


Property changes on: trunk/lib/libc/sys/shmget.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/shutdown.2
===================================================================
--- trunk/lib/libc/sys/shutdown.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/shutdown.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 2007 Bruce M. Simpson.
 .\" Copyright (c) 1983, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -27,7 +28,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)shutdown.2	8.1 (Berkeley) 6/4/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/shutdown.2 167292 2007-03-07 13:38:11Z bms $
 .\"
 .Dd March 5, 2007
 .Dt SHUTDOWN 2


Property changes on: trunk/lib/libc/sys/shutdown.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/sigaction.2
===================================================================
--- trunk/lib/libc/sys/sigaction.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/sigaction.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1980, 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,9 +27,9 @@
 .\" SUCH DAMAGE.
 .\"
 .\"	From: @(#)sigaction.2	8.2 (Berkeley) 4/3/94
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/sigaction.2 255296 2013-09-06 09:08:40Z jilles $
 .\"
-.Dd September 27, 2012
+.Dd September 6, 2013
 .Dt SIGACTION 2
 .Os
 .Sh NAME
@@ -55,7 +56,7 @@
 .Sh DESCRIPTION
 The system defines a set of signals that may be delivered to a process.
 Signal delivery resembles the occurrence of a hardware interrupt:
-the signal is normally blocked from further occurrence, the current process
+the signal is normally blocked from further occurrence, the current thread
 context is saved, and a new one is built.
 A process may specify a
 .Em handler
@@ -64,13 +65,14 @@
 A process may also specify that a default action is to be taken
 by the system when a signal occurs.
 A signal may also be
-.Em blocked ,
-in which case its delivery is postponed until it is
+.Em blocked
+for a thread,
+in which case it will not be delivered to that thread until it is
 .Em unblocked .
 The action to be taken on delivery is determined at the time
 of delivery.
 Normally, signal handlers execute on the current stack
-of the process.
+of the thread.
 This may be changed, on a per-handler basis,
 so that signals are taken on a special
 .Em "signal stack" .
@@ -82,20 +84,30 @@
 A global
 .Em "signal mask"
 defines the set of signals currently blocked from delivery
-to a process.
-The signal mask for a process is initialized
+to a thread.
+The signal mask for a thread is initialized
 from that of its parent (normally empty).
 It may be changed with a
 .Xr sigprocmask 2
-call, or when a signal is delivered to the process.
+or
+.Xr pthread_sigmask 3
+call, or when a signal is delivered to the thread.
 .Pp
 When a signal
-condition arises for a process, the signal is added to a set of
-signals pending for the process.
-If the signal is not currently
+condition arises for a process or thread, the signal is added to a set of
+signals pending for the process or thread.
+Whether the signal is directed at the process in general or at a specific
+thread depends on how it is generated.
+For signals directed at a specific thread,
+if the signal is not currently
 .Em blocked
-by the process then it is delivered to the process.
-Signals may be delivered any time a process enters the operating system
+by the thread then it is delivered to the thread.
+For signals directed at the process,
+if the signal is not currently
+.Em blocked
+by all threads then it is delivered to one thread that does not have it blocked
+(the selection of which is unspecified).
+Signals may be delivered any time a thread enters the operating system
 (e.g., during a system call, page fault or trap, or clock interrupt).
 If multiple signals are ready to be delivered at the same time,
 any signals that could be caused by traps are delivered first.
@@ -106,17 +118,17 @@
 .Xr sigpending 2
 system call.
 When a caught signal
-is delivered, the current state of the process is saved,
+is delivered, the current state of the thread is saved,
 a new signal mask is calculated (as described below),
 and the signal handler is invoked.
 The call to the handler
 is arranged so that if the signal handling routine returns
-normally the process will resume execution in the context
+normally the thread will resume execution in the context
 from before the signal's delivery.
-If the process wishes to resume in a different context, then it
+If the thread wishes to resume in a different context, then it
 must arrange to restore the previous context itself.
 .Pp
-When a signal is delivered to a process a new signal mask is
+When a signal is delivered to a thread a new signal mask is
 installed for the duration of the process' signal handler
 (or until a
 .Xr sigprocmask 2
@@ -218,7 +230,7 @@
 If this bit is set, the system will deliver the signal to the process
 on a
 .Em "signal stack" ,
-specified with
+specified by each thread with
 .Xr sigaltstack 2 .
 .It Dv SA_NODEFER
 If this bit is set, further occurrences of the delivered signal are
@@ -272,6 +284,11 @@
 but instead return a partial success (for example, a short read count).
 .Pp
 After a
+.Xr pthread_create 3
+the signal mask is inherited by the new thread and
+the set of pending signals and the signal stack for the new thread are empty.
+.Pp
+After a
 .Xr fork 2
 or
 .Xr vfork 2
@@ -346,13 +363,19 @@
 The following functions are either reentrant or not interruptible
 by signals and are async-signal safe.
 Therefore applications may
-invoke them, without restriction, from signal-catching functions:
+invoke them, without restriction, from signal-catching functions
+or from a child process after calling
+.Xr fork 2
+in a multi-threaded process:
 .Pp
 Base Interfaces:
 .Pp
+.Fn _Exit ,
 .Fn _exit ,
+.Fn accept ,
 .Fn access ,
 .Fn alarm ,
+.Fn bind ,
 .Fn cfgetispeed ,
 .Fn cfgetospeed ,
 .Fn cfsetispeed ,
@@ -361,41 +384,76 @@
 .Fn chmod ,
 .Fn chown ,
 .Fn close ,
+.Fn connect ,
 .Fn creat ,
 .Fn dup ,
 .Fn dup2 ,
+.Fn execl ,
 .Fn execle ,
+.Fn execv ,
 .Fn execve ,
+.Fn faccessat ,
+.Fn fchdir ,
+.Fn fchmod ,
+.Fn fchmodat ,
+.Fn fchown ,
+.Fn fchownat ,
 .Fn fcntl ,
 .Fn fork ,
-.Fn fpathconf ,
 .Fn fstat ,
+.Fn fstatat ,
 .Fn fsync ,
+.Fn ftruncate ,
 .Fn getegid ,
 .Fn geteuid ,
 .Fn getgid ,
 .Fn getgroups ,
+.Fn getpeername ,
 .Fn getpgrp ,
 .Fn getpid ,
 .Fn getppid ,
+.Fn getsockname ,
+.Fn getsockopt ,
 .Fn getuid ,
 .Fn kill ,
 .Fn link ,
+.Fn linkat ,
+.Fn listen ,
 .Fn lseek ,
+.Fn lstat ,
 .Fn mkdir ,
+.Fn mkdirat ,
 .Fn mkfifo ,
+.Fn mkfifoat ,
+.Fn mknod ,
+.Fn mknodat ,
 .Fn open ,
-.Fn pathconf ,
+.Fn openat ,
 .Fn pause ,
 .Fn pipe ,
+.Fn poll ,
+.Fn pselect ,
+.Fn pthread_sigmask ,
 .Fn raise ,
 .Fn read ,
+.Fn readlink ,
+.Fn readlinkat ,
+.Fn recv ,
+.Fn recvfrom ,
+.Fn recvmsg ,
 .Fn rename ,
+.Fn renameat ,
 .Fn rmdir ,
+.Fn select ,
+.Fn send ,
+.Fn sendmsg ,
+.Fn sendto ,
 .Fn setgid ,
 .Fn setpgid ,
 .Fn setsid ,
+.Fn setsockopt ,
 .Fn setuid ,
+.Fn shutdown ,
 .Fn sigaction ,
 .Fn sigaddset ,
 .Fn sigdelset ,
@@ -407,8 +465,12 @@
 .Fn sigprocmask ,
 .Fn sigsuspend ,
 .Fn sleep ,
+.Fn sockatmark ,
+.Fn socket ,
+.Fn socketpair ,
 .Fn stat ,
-.Fn sysconf ,
+.Fn symlink ,
+.Fn symlinkat ,
 .Fn tcdrain ,
 .Fn tcflow ,
 .Fn tcflush ,
@@ -422,16 +484,22 @@
 .Fn umask ,
 .Fn uname ,
 .Fn unlink ,
+.Fn unlinkat ,
 .Fn utime ,
 .Fn wait ,
 .Fn waitpid ,
 .Fn write .
 .Pp
+X/Open Systems Interfaces:
+.Pp
+.Fn sigpause ,
+.Fn sigset ,
+.Fn utimes .
+.Pp
 Realtime Interfaces:
 .Pp
 .Fn aio_error ,
 .Fn clock_gettime ,
-.Fn sigpause ,
 .Fn timer_getoverrun ,
 .Fn aio_return ,
 .Fn fdatasync ,
@@ -439,27 +507,98 @@
 .Fn timer_gettime ,
 .Fn aio_suspend ,
 .Fn sem_post ,
-.Fn sigset ,
 .Fn timer_settime .
 .Pp
-.Tn ANSI C
-Interfaces:
+Base Interfaces not specified as async-signal safe by
+.Tn POSIX :
 .Pp
+.Fn fpathconf ,
+.Fn pathconf ,
+.Fn sysconf .
+.Pp
+Base Interfaces not specified as async-signal safe by
+.Tn POSIX ,
+but planned to be:
+.Pp
+.Fn ffs ,
+.Fn htonl ,
+.Fn htons ,
+.Fn memccpy ,
+.Fn memchr ,
+.Fn memcmp ,
+.Fn memcpy ,
+.Fn memmove ,
+.Fn memset ,
+.Fn ntohl ,
+.Fn ntohs ,
+.Fn stpcpy ,
+.Fn stpncpy ,
+.Fn strcat ,
+.Fn strchr ,
+.Fn strcmp ,
 .Fn strcpy ,
-.Fn strcat ,
+.Fn strcspn ,
+.Fn strlen ,
+.Fn strncat ,
+.Fn strncmp ,
 .Fn strncpy ,
-.Fn strncat ,
-and perhaps some others.
+.Fn strnlen ,
+.Fn strpbrk ,
+.Fn strrchr ,
+.Fn strspn ,
+.Fn strstr ,
+.Fn strtok_r ,
+.Fn wcpcpy ,
+.Fn wcpncpy ,
+.Fn wcscat ,
+.Fn wcschr ,
+.Fn wcscmp ,
+.Fn wcscpy ,
+.Fn wcscspn ,
+.Fn wcslen ,
+.Fn wcsncat ,
+.Fn wcsncmp ,
+.Fn wcsncpy ,
+.Fn wcsnlen ,
+.Fn wcspbrk ,
+.Fn wcsrchr ,
+.Fn wcsspn ,
+.Fn wcsstr ,
+.Fn wcstok ,
+.Fn wmemchr ,
+.Fn wmemcmp ,
+.Fn wmemcpy ,
+.Fn wmemmove ,
+.Fn wmemset .
 .Pp
 Extension Interfaces:
 .Pp
+.Fn accept4 ,
+.Fn bindat ,
+.Fn closefrom ,
+.Fn connectat ,
+.Fn eaccess ,
+.Fn ffsl ,
+.Fn ffsll ,
+.Fn flock ,
+.Fn fls ,
+.Fn flsl ,
+.Fn flsll ,
+.Fn futimesat ,
+.Fn pipe2 ,
+.Fn strlcat .
 .Fn strlcpy ,
-.Fn strlcat .
+.Fn strsep .
 .Pp
+In addition, reading or writing
+.Va errno
+is async-signal safe.
+.Pp
 All functions not in the above lists are considered to be unsafe
 with respect to signals.
 That is to say, the behaviour of such
-functions when called from a signal handler is undefined.
+functions is undefined when they are called from a signal handler
+that interrupted an unsafe function.
 In general though, signal handlers should do little more than set a
 flag; most other actions are not safe.
 .Pp


Property changes on: trunk/lib/libc/sys/sigaction.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: trunk/lib/libc/sys/sigaction.c
===================================================================
--- trunk/lib/libc/sys/sigaction.c	                        (rev 0)
+++ trunk/lib/libc/sys/sigaction.c	2018-06-07 12:22:26 UTC (rev 10509)
@@ -0,0 +1,51 @@
+/* $MidnightBSD$ */
+/*
+ * Copyright (c) 2014 The FreeBSD Foundation.
+ * All rights reserved.
+ *
+ * Portions of this software were developed by Konstantin Belousov
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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(s), this list of conditions and the following disclaimer as
+ *    the first lines of this file unmodified other than the possible
+ *    addition of one or more copyright notices.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice(s), 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 COPYRIGHT HOLDER(S) ``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 COPYRIGHT HOLDER(S) 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/cdefs.h>
+__FBSDID("$FreeBSD: stable/10/lib/libc/sys/sigaction.c 287480 2015-09-05 08:55:51Z kib $");
+
+#include <sys/types.h>
+#include <signal.h>
+#include "libc_private.h"
+
+__weak_reference(__sys_sigaction, __sigaction);
+__weak_reference(sigaction, __libc_sigaction);
+
+#pragma weak sigaction
+int
+sigaction(int sig, const struct sigaction *act, struct sigaction *oact)
+{
+
+	return (((int (*)(int, const struct sigaction *, struct sigaction *))
+	    __libc_interposing[INTERPOS_sigaction])(sig, act, oact));
+}


Property changes on: trunk/lib/libc/sys/sigaction.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: trunk/lib/libc/sys/sigaltstack.2
===================================================================
--- trunk/lib/libc/sys/sigaltstack.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/sigaltstack.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1983, 1991, 1992, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,7 +27,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)sigaltstack.2	8.2 (Berkeley) 5/1/95
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/sigaltstack.2 211966 2010-08-29 16:38:08Z kib $
 .\"
 .Dd May 6, 2010
 .Dt SIGALTSTACK 2


Property changes on: trunk/lib/libc/sys/sigaltstack.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/sigpending.2
===================================================================
--- trunk/lib/libc/sys/sigpending.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/sigpending.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -29,9 +30,9 @@
 .\" SUCH DAMAGE.
 .\"
 .\"	@(#)sigpending.2	8.3 (Berkeley) 1/12/94
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/sigpending.2 255296 2013-09-06 09:08:40Z jilles $
 .\"
-.Dd January 12, 1994
+.Dd September 6, 2013
 .Dt SIGPENDING 2
 .Os
 .Sh NAME
@@ -47,7 +48,7 @@
 The
 .Fn sigpending
 system call returns a mask of the signals pending for delivery
-to the calling process in the location indicated by
+to the calling thread or the calling process in the location indicated by
 .Fa set .
 Signals may be pending because they are currently masked,
 or transiently before delivery (although the latter case is not


Property changes on: trunk/lib/libc/sys/sigpending.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/sigprocmask.2
===================================================================
--- trunk/lib/libc/sys/sigprocmask.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/sigprocmask.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1983, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,7 +27,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"	@(#)sigprocmask.2	8.1 (Berkeley) 6/4/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/sigprocmask.2 207757 2010-05-07 20:46:22Z jilles $
 .\"
 .Dd May 7, 2010
 .Dt SIGPROCMASK 2


Property changes on: trunk/lib/libc/sys/sigprocmask.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: trunk/lib/libc/sys/sigprocmask.c
===================================================================
--- trunk/lib/libc/sys/sigprocmask.c	                        (rev 0)
+++ trunk/lib/libc/sys/sigprocmask.c	2018-06-07 12:22:26 UTC (rev 10509)
@@ -0,0 +1,51 @@
+/* $MidnightBSD$ */
+/*
+ * Copyright (c) 2014 The FreeBSD Foundation.
+ * All rights reserved.
+ *
+ * Portions of this software were developed by Konstantin Belousov
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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(s), this list of conditions and the following disclaimer as
+ *    the first lines of this file unmodified other than the possible
+ *    addition of one or more copyright notices.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice(s), 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 COPYRIGHT HOLDER(S) ``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 COPYRIGHT HOLDER(S) 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/cdefs.h>
+__FBSDID("$FreeBSD: stable/10/lib/libc/sys/sigprocmask.c 287480 2015-09-05 08:55:51Z kib $");
+
+#include <sys/types.h>
+#include <signal.h>
+#include "libc_private.h"
+
+__weak_reference(__sys_sigprocmask, __sigprocmask);
+__weak_reference(sigprocmask, __libc_sigprocmask);
+
+#pragma weak sigprocmask
+int
+sigprocmask(int how, const sigset_t *set, sigset_t *oset)
+{
+
+	return (((int (*)(int, const sigset_t *, sigset_t *))
+	    __libc_interposing[INTERPOS_sigprocmask])(how, set, oset));
+}


Property changes on: trunk/lib/libc/sys/sigprocmask.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: trunk/lib/libc/sys/sigqueue.2
===================================================================
--- trunk/lib/libc/sys/sigqueue.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/sigqueue.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 2005 David Xu <davidxu at FreeBSD.org>
 .\" All rights reserved.
 .\"
@@ -25,9 +26,9 @@
 .\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 .\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/sigqueue.2 318323 2017-05-15 22:50:54Z brooks $
 .\"
-.Dd November 11, 2005
+.Dd May 5, 2017
 .Dt SIGQUEUE 2
 .Os
 .Sh NAME
@@ -126,9 +127,9 @@
 does not exist.
 .El
 .Sh SEE ALSO
+.Xr kill 2 ,
 .Xr sigaction 2 ,
 .Xr sigpending 2 ,
-.Xr sigqueue 2 ,
 .Xr sigsuspend 2 ,
 .Xr sigtimedwait 2 ,
 .Xr sigwait 2 ,
@@ -146,3 +147,18 @@
 .Tn POSIX
 realtime signal queue first appeared in
 .Fx 7.0 .
+.Sh CAVEATS
+When using
+.Nm
+to send signals to a process which might have a different ABI
+(for instance, one is 32-bit and the other 64-bit),
+the
+.Va sival_int
+member of
+.Fa value
+can be delivered reliably, but the
+.Va sival_ptr
+may be truncated in endian dependent ways and must not be relied on.
+Further, many pointer integrity schemes disallow sending pointers to other
+processes, and this technique should not be used in programs intended to
+be portable.


Property changes on: trunk/lib/libc/sys/sigqueue.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/sigreturn.2
===================================================================
--- trunk/lib/libc/sys/sigreturn.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/sigreturn.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1985, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,9 +27,9 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)sigreturn.2	8.1 (Berkeley) 6/4/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/sigreturn.2 255296 2013-09-06 09:08:40Z jilles $
 .\"
-.Dd June 4, 1993
+.Dd September 6, 2013
 .Dt SIGRETURN 2
 .Os
 .Sh NAME
@@ -46,7 +47,7 @@
 system call
 allows users to atomically unmask, switch stacks,
 and return from a signal context.
-The processes signal mask and stack status are
+The thread's signal mask and stack status are
 restored from the context structure pointed to by
 .Fa scp .
 The system call does not return;
@@ -56,10 +57,6 @@
 This system call is used by the trampoline code and
 .Xr longjmp 3
 when returning from a signal to the previously executing program.
-.Sh NOTES
-This system call is not available in
-.Bx 4.2
-hence it should not be used if backward compatibility is needed.
 .Sh RETURN VALUES
 If successful, the system call does not return.
 Otherwise, a value of -1 is returned and
@@ -69,7 +66,7 @@
 The
 .Fn sigreturn
 system call
-will fail and the process context will remain unchanged
+will fail and the thread context will remain unchanged
 if one of the following occurs.
 .Bl -tag -width Er
 .It Bq Er EFAULT


Property changes on: trunk/lib/libc/sys/sigreturn.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/sigstack.2
===================================================================
--- trunk/lib/libc/sys/sigstack.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/sigstack.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1983, 1992, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,7 +27,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)sigstack.2	8.1 (Berkeley) 6/4/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/sigstack.2 165903 2007-01-09 00:28:16Z imp $
 .\"
 .Dd June 4, 1993
 .Dt SIGSTACK 2


Property changes on: trunk/lib/libc/sys/sigstack.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/sigsuspend.2
===================================================================
--- trunk/lib/libc/sys/sigsuspend.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/sigsuspend.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1983, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,9 +27,9 @@
 .\" SUCH DAMAGE.
 .\"
 .\"	@(#)sigsuspend.2	8.2 (Berkeley) 5/16/95
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/sigsuspend.2 254388 2013-08-15 22:33:27Z jilles $
 .\"
-.Dd May 16, 1995
+.Dd August 16, 2013
 .Dt SIGSUSPEND 2
 .Os
 .Sh NAME
@@ -70,9 +71,13 @@
 set to
 .Er EINTR .
 .Sh SEE ALSO
+.Xr pselect 2 ,
 .Xr sigaction 2 ,
 .Xr sigpending 2 ,
 .Xr sigprocmask 2 ,
+.Xr sigtimedwait 2 ,
+.Xr sigwait 2 ,
+.Xr sigwaitinfo 2 ,
 .Xr sigsetops 3
 .Sh STANDARDS
 The


Property changes on: trunk/lib/libc/sys/sigsuspend.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: trunk/lib/libc/sys/sigsuspend.c
===================================================================
--- trunk/lib/libc/sys/sigsuspend.c	                        (rev 0)
+++ trunk/lib/libc/sys/sigsuspend.c	2018-06-07 12:22:26 UTC (rev 10509)
@@ -0,0 +1,51 @@
+/* $MidnightBSD$ */
+/*
+ * Copyright (c) 2014 The FreeBSD Foundation.
+ * All rights reserved.
+ *
+ * Portions of this software were developed by Konstantin Belousov
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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(s), this list of conditions and the following disclaimer as
+ *    the first lines of this file unmodified other than the possible
+ *    addition of one or more copyright notices.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice(s), 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 COPYRIGHT HOLDER(S) ``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 COPYRIGHT HOLDER(S) 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/cdefs.h>
+__FBSDID("$FreeBSD: stable/10/lib/libc/sys/sigsuspend.c 287480 2015-09-05 08:55:51Z kib $");
+
+#include <sys/types.h>
+#include <signal.h>
+#include "libc_private.h"
+
+__weak_reference(__sys_sigsuspend, __sigsuspend);
+__weak_reference(sigsuspend, __libc_sigsuspend);
+
+#pragma weak sigsuspend
+int
+sigsuspend(const sigset_t *set)
+{
+
+	return (((int (*)(const sigset_t *))
+	    __libc_interposing[INTERPOS_sigsuspend])(set));
+}


Property changes on: trunk/lib/libc/sys/sigsuspend.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/lib/libc/sys/sigtimedwait.c
===================================================================
--- trunk/lib/libc/sys/sigtimedwait.c	                        (rev 0)
+++ trunk/lib/libc/sys/sigtimedwait.c	2018-06-07 12:22:26 UTC (rev 10509)
@@ -0,0 +1,52 @@
+/* $MidnightBSD$ */
+/*
+ * Copyright (c) 2014 The FreeBSD Foundation.
+ * All rights reserved.
+ *
+ * Portions of this software were developed by Konstantin Belousov
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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(s), this list of conditions and the following disclaimer as
+ *    the first lines of this file unmodified other than the possible
+ *    addition of one or more copyright notices.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice(s), 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 COPYRIGHT HOLDER(S) ``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 COPYRIGHT HOLDER(S) 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/cdefs.h>
+__FBSDID("$FreeBSD: stable/10/lib/libc/sys/sigtimedwait.c 277317 2015-01-18 11:54:20Z kib $");
+
+#include <sys/types.h>
+#include <signal.h>
+#include "libc_private.h"
+
+__weak_reference(__sys_sigtimedwait, __sigtimedwait);
+
+#pragma weak sigtimedwait
+int
+sigtimedwait(const sigset_t * __restrict set, siginfo_t * __restrict info,
+    const struct timespec * __restrict t)
+{
+
+	return (((int (*)(const sigset_t *, siginfo_t *,
+	    const struct timespec *))
+	    __libc_interposing[INTERPOS_sigtimedwait])(set, info, t));
+}


Property changes on: trunk/lib/libc/sys/sigtimedwait.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: trunk/lib/libc/sys/sigwait.2
===================================================================
--- trunk/lib/libc/sys/sigwait.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/sigwait.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (C) 2000 Jason Evans <jasone at FreeBSD.org>.
 .\" All rights reserved.
 .\"
@@ -25,9 +26,9 @@
 .\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 .\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/sigwait.2 255296 2013-09-06 09:08:40Z jilles $
 .\"
-.Dd September 27, 2012
+.Dd September 6, 2013
 .Dt SIGWAIT 2
 .Os
 .Sh NAME
@@ -50,7 +51,7 @@
 Then
 .Fn sigwait
 atomically clears one of the selected signals from the set of pending signals
-for the process and sets the location pointed to by
+(for the process or for the current thread) and sets the location pointed to by
 .Fa sig
 to the signal number that was cleared.
 .Pp


Property changes on: trunk/lib/libc/sys/sigwait.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/sigwait.c
===================================================================
--- trunk/lib/libc/sys/sigwait.c	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/sigwait.c	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2010 davidxu at freebsd.org
  *
@@ -24,17 +25,25 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libc/sys/sigwait.c 277317 2015-01-18 11:54:20Z kib $");
 
 #include <errno.h>
 #include <signal.h>
+#include "libc_private.h"
 
-int __sys_sigwait(const sigset_t * restrict, int * restrict);
+__weak_reference(__libc_sigwait, __sigwait);
 
-__weak_reference(__sigwait, sigwait);
+#pragma weak sigwait
+int
+sigwait(const sigset_t *set, int *sig)
+{
 
+	return (((int (*)(const sigset_t *, int *))
+	    __libc_interposing[INTERPOS_sigwait])(set, sig));
+}
+
 int
-__sigwait(const sigset_t * restrict set, int * restrict sig)
+__libc_sigwait(const sigset_t *set, int *sig)
 {
 	int ret;
 

Modified: trunk/lib/libc/sys/sigwaitinfo.2
===================================================================
--- trunk/lib/libc/sys/sigwaitinfo.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/sigwaitinfo.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 2005 David Xu <davidxu at FreeBSD.org>
 .\" All rights reserved.
 .\"
@@ -25,7 +26,7 @@
 .\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 .\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/sigwaitinfo.2 241001 2012-09-27 17:48:04Z jilles $
 .\"
 .Dd September 27, 2012
 .Dt SIGTIMEDWAIT 2


Property changes on: trunk/lib/libc/sys/sigwaitinfo.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: trunk/lib/libc/sys/sigwaitinfo.c
===================================================================
--- trunk/lib/libc/sys/sigwaitinfo.c	                        (rev 0)
+++ trunk/lib/libc/sys/sigwaitinfo.c	2018-06-07 12:22:26 UTC (rev 10509)
@@ -0,0 +1,50 @@
+/* $MidnightBSD$ */
+/*
+ * Copyright (c) 2014 The FreeBSD Foundation.
+ * All rights reserved.
+ *
+ * Portions of this software were developed by Konstantin Belousov
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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(s), this list of conditions and the following disclaimer as
+ *    the first lines of this file unmodified other than the possible
+ *    addition of one or more copyright notices.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice(s), 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 COPYRIGHT HOLDER(S) ``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 COPYRIGHT HOLDER(S) 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/cdefs.h>
+__FBSDID("$FreeBSD: stable/10/lib/libc/sys/sigwaitinfo.c 277317 2015-01-18 11:54:20Z kib $");
+
+#include <sys/types.h>
+#include <signal.h>
+#include "libc_private.h"
+
+__weak_reference(__sys_sigwaitinfo, __sigwaitinfo);
+
+#pragma weak sigwaitinfo
+int
+sigwaitinfo(const sigset_t * __restrict set, siginfo_t * __restrict info)
+{
+
+	return (((int (*)(const sigset_t *, siginfo_t *))
+	    __libc_interposing[INTERPOS_sigwaitinfo])(set, info));
+}


Property changes on: trunk/lib/libc/sys/sigwaitinfo.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: trunk/lib/libc/sys/socket.2
===================================================================
--- trunk/lib/libc/sys/socket.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/socket.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1983, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,9 +27,9 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     From: @(#)socket.2	8.1 (Berkeley) 6/4/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/socket.2 248534 2013-03-19 20:58:17Z jilles $
 .\"
-.Dd January 5, 2009
+.Dd March 19, 2013
 .Dt SOCKET 2
 .Os
 .Sh NAME
@@ -115,6 +116,15 @@
 which is planned,
 but not yet implemented, are not described here.
 .Pp
+Additionally, the following flags are allowed in the
+.Fa type
+argument:
+.Pp
+.Bd -literal -offset indent -compact
+SOCK_CLOEXEC	Set close-on-exec on the new descriptor,
+SOCK_NONBLOCK	Set non-blocking mode on the new socket
+.Ed
+.Pp
 The
 .Fa protocol
 argument
@@ -248,21 +258,26 @@
 .Fn socket
 system call fails if:
 .Bl -tag -width Er
-.It Bq Er EPROTONOSUPPORT
-The protocol type or the specified protocol is not supported
-within this domain.
+.It Bq Er EACCES
+Permission to create a socket of the specified type and/or protocol
+is denied.
+.It Bq Er EAFNOSUPPORT
+The address family (domain) is not supported or the
+specified domain is not supported by this protocol family.
 .It Bq Er EMFILE
 The per-process descriptor table is full.
 .It Bq Er ENFILE
 The system file table is full.
-.It Bq Er EACCES
-Permission to create a socket of the specified type and/or protocol
-is denied.
 .It Bq Er ENOBUFS
 Insufficient buffer space is available.
 The socket cannot be created until sufficient resources are freed.
 .It Bq Er EPERM
 User has insufficient privileges to carry out the requested operation.
+.It Bq Er EPROTONOSUPPORT
+The protocol type or the specified protocol is not supported
+within this domain.
+.It Bq Er EPROTOTYPE
+The socket type is not supported by the protocol.
 .El
 .Sh SEE ALSO
 .Xr accept 2 ,


Property changes on: trunk/lib/libc/sys/socket.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/socketpair.2
===================================================================
--- trunk/lib/libc/sys/socketpair.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/socketpair.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1983, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,9 +27,9 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)socketpair.2	8.1 (Berkeley) 6/4/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/socketpair.2 283915 2015-06-02 15:09:33Z jhb $
 .\"
-.Dd June 4, 1993
+.Dd May 4, 2015
 .Dt SOCKETPAIR 2
 .Os
 .Sh NAME
@@ -40,13 +41,13 @@
 .In sys/types.h
 .In sys/socket.h
 .Ft int
-.Fn socketpair "int d" "int type" "int protocol" "int *sv"
+.Fn socketpair "int domain" "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 ,
+the specified communications
+.Fa domain ,
 of the specified
 .Fa type ,
 and using the optionally specified
@@ -57,6 +58,14 @@
 and
 .Fa sv Ns [1] .
 The two sockets are indistinguishable.
+.Pp
+The
+.Dv SOCK_CLOEXEC
+and
+.Dv SOCK_NONBLOCK
+flags in the
+.Fa type
+argument apply to both descriptors.
 .Sh RETURN VALUES
 .Rv -std socketpair
 .Sh ERRORS
@@ -79,6 +88,7 @@
 .Sh SEE ALSO
 .Xr pipe 2 ,
 .Xr read 2 ,
+.Xr socket 2 ,
 .Xr write 2
 .Sh HISTORY
 The


Property changes on: trunk/lib/libc/sys/socketpair.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/stack_protector.c
===================================================================
--- trunk/lib/libc/sys/stack_protector.c	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/stack_protector.c	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /* $NetBSD: stack_protector.c,v 1.4 2006/11/22 17:23:25 christos Exp $	*/
 /* $OpenBSD: stack_protector.c,v 1.10 2006/03/31 05:34:44 deraadt Exp $	*/
 /*
@@ -28,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libc/sys/stack_protector.c 288105 2015-09-22 10:48:28Z jlh $");
 
 #include <sys/param.h>
 #include <sys/sysctl.h>
@@ -41,8 +42,8 @@
 #include <unistd.h>
 #include "libc_private.h"
 
-extern int __sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp,
-    void *newp, size_t newlen);
+extern int __sysctl(const int *name, u_int namelen, void *oldp,
+    size_t *oldlenp, void *newp, size_t newlen);
 
 long __stack_chk_guard[8] = {0, 0, 0, 0, 0, 0, 0, 0};
 static void __guard_setup(void) __attribute__((__constructor__, __used__));
@@ -54,7 +55,7 @@
 static void
 __guard_setup(void)
 {
-	int mib[2];
+	static const int mib[2] = { CTL_KERN, KERN_ARND };
 	size_t len;
 	int error;
 
@@ -65,12 +66,9 @@
 	if (error == 0 && __stack_chk_guard[0] != 0)
 		return;
 
-	mib[0] = CTL_KERN;
-	mib[1] = KERN_ARND;
-
 	len = sizeof(__stack_chk_guard);
-	if (__sysctl(mib, 2, __stack_chk_guard, &len, NULL, 0) == -1 ||
-	    len != sizeof(__stack_chk_guard)) {
+	if (__sysctl(mib, nitems(mib), __stack_chk_guard, &len, NULL, 0) ==
+	    -1 || len != sizeof(__stack_chk_guard)) {
 		/* If sysctl was unsuccessful, use the "terminator canary". */
 		((unsigned char *)(void *)__stack_chk_guard)[0] = 0;
 		((unsigned char *)(void *)__stack_chk_guard)[1] = 0;

Modified: trunk/lib/libc/sys/stack_protector_compat.c
===================================================================
--- trunk/lib/libc/sys/stack_protector_compat.c	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/stack_protector_compat.c	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * Written by Alexander Kabaev <kan at FreeBSD.org>
  * The file is in public domain.
@@ -4,7 +5,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libc/sys/stack_protector_compat.c 211748 2010-08-24 12:58:54Z kib $");
 
 void __stack_chk_fail(void);
 

Modified: trunk/lib/libc/sys/stat.2
===================================================================
--- trunk/lib/libc/sys/stat.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/stat.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1980, 1991, 1993, 1994
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,9 +27,9 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)stat.2	8.4 (Berkeley) 5/1/95
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/stat.2 236441 2012-06-02 10:50:25Z ed $
 .\"
-.Dd November 17, 2011
+.Dd June 2, 2012
 .Dt STAT 2
 .Os
 .Sh NAME
@@ -431,7 +432,7 @@
 .Sh BUGS
 Applying
 .Fn fstat
-to a socket (and thus to a pipe)
+to a socket
 returns a zeroed buffer,
 except for the blocksize field,
 and a unique device and inode number.


Property changes on: trunk/lib/libc/sys/stat.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/statfs.2
===================================================================
--- trunk/lib/libc/sys/statfs.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/statfs.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1989, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,7 +27,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"	@(#)statfs.2	8.5 (Berkeley) 5/24/95
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/statfs.2 165903 2007-01-09 00:28:16Z imp $
 .\"
 .Dd November 1, 2006
 .Dt STATFS 2


Property changes on: trunk/lib/libc/sys/statfs.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: trunk/lib/libc/sys/swapcontext.c
===================================================================
--- trunk/lib/libc/sys/swapcontext.c	                        (rev 0)
+++ trunk/lib/libc/sys/swapcontext.c	2018-06-07 12:22:26 UTC (rev 10509)
@@ -0,0 +1,54 @@
+/* $MidnightBSD$ */
+/*
+ * Copyright (c) 2001 Daniel M. Eischen <deischen at freebsd.org>
+ * Copyright (c) 2014 The FreeBSD Foundation.
+ * All rights reserved.
+ *
+ * Portions of this software were developed by Konstantin Belousov
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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. Neither the name of the author nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD: stable/10/lib/libc/sys/swapcontext.c 277317 2015-01-18 11:54:20Z kib $");
+
+#include <sys/param.h>
+#include <sys/signal.h>
+#include <sys/ucontext.h>
+#include <errno.h>
+#include <stddef.h>
+#include "libc_private.h"
+
+__weak_reference(__sys_swapcontext, __swapcontext);
+__sym_compat(swapcontext, __impl_swapcontext, FBSD_1.0);
+__weak_reference(swapcontext, __impl_swapcontext);
+__sym_default(swapcontext, swapcontext, FBSD_1.2);
+
+#pragma weak swapcontext
+int
+swapcontext(ucontext_t *oucp, const ucontext_t *ucp)
+{
+
+	return (((int (*)(ucontext_t *, const ucontext_t *))
+	    __libc_interposing[INTERPOS_swapcontext])(oucp, ucp));
+}


Property changes on: trunk/lib/libc/sys/swapcontext.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: trunk/lib/libc/sys/swapon.2
===================================================================
--- trunk/lib/libc/sys/swapon.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/swapon.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1980, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,9 +27,9 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)swapon.2	8.1 (Berkeley) 6/4/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/swapon.2 260198 2014-01-02 16:37:23Z pluknet $
 .\"
-.Dd June 4, 1993
+.Dd October 4, 2013
 .Dt SWAPON 2
 .Os
 .Sh NAME
@@ -98,10 +99,6 @@
 .Fn swapon
 can fail for the following reasons:
 .Bl -tag -width Er
-.It Bq Er EINVAL
-The system has reached the boot-time limit on the number of
-swap devices,
-.Va vm.nswapdev .
 .It Bq Er ENOTBLK
 The
 .Fa special


Property changes on: trunk/lib/libc/sys/swapon.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/symlink.2
===================================================================
--- trunk/lib/libc/sys/symlink.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/symlink.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1983, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,7 +27,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)symlink.2	8.1 (Berkeley) 6/4/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/symlink.2 178245 2008-04-16 13:03:12Z kib $
 .\"
 .Dd April 10, 2008
 .Dt SYMLINK 2


Property changes on: trunk/lib/libc/sys/symlink.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/sync.2
===================================================================
--- trunk/lib/libc/sys/sync.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/sync.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1980, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,7 +27,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)sync.2	8.1 (Berkeley) 6/4/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/sync.2 165903 2007-01-09 00:28:16Z imp $
 .\"
 .Dd June 4, 1993
 .Dt SYNC 2


Property changes on: trunk/lib/libc/sys/sync.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/sysarch.2
===================================================================
--- trunk/lib/libc/sys/sysarch.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/sysarch.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,5 +1,6 @@
+.\" $MidnightBSD$
 .\"	$NetBSD: sysarch.2,v 1.6 1998/02/25 21:24:57 perry Exp $
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/sysarch.2 165903 2007-01-09 00:28:16Z imp $
 .\"
 .\" Copyright (c) 1980, 1991 Regents of the University of California.
 .\" All rights reserved.


Property changes on: trunk/lib/libc/sys/sysarch.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/syscall.2
===================================================================
--- trunk/lib/libc/sys/syscall.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/syscall.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1980, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,7 +27,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)syscall.2	8.1 (Berkeley) 6/16/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/syscall.2 165903 2007-01-09 00:28:16Z imp $
 .\"
 .Dd June 16, 1993
 .Dt SYSCALL 2


Property changes on: trunk/lib/libc/sys/syscall.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: trunk/lib/libc/sys/thr_suspend.2
===================================================================
--- trunk/lib/libc/sys/thr_suspend.2	                        (rev 0)
+++ trunk/lib/libc/sys/thr_suspend.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -0,0 +1,131 @@
+.\" $MidnightBSD$
+.\" Copyright (c) 2016 The FreeBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This documentation was written by
+.\" Konstantin Belousov <kib at FreeBSD.org> under sponsorship
+.\" from the FreeBSD Foundation.
+.\"
+.\" 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 AUTHORS 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 AUTHORS 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: stable/10/lib/libc/sys/thr_suspend.2 306626 2016-10-03 09:32:19Z kib $
+.\"
+.Dd September 23, 2016
+.Dt THR_SUSPEND 2
+.Os
+.Sh NAME
+.Nm thr_suspend
+.Nd suspend the calling thread
+.Sh LIBRARY
+.Lb libc
+.Sh SYNOPSIS
+.In sys/thr.h
+.Ft int
+.Fn thr_suspend "struct timespec *timeout"
+.Sh DESCRIPTION
+.Bf -symbolic
+This function is intended for implementing threading.
+Normal applications should use
+.Xr pthread_cond_timedwait 3
+together with
+.Xr pthread_cond_broadcast 3
+for typical safe suspension with cooperation of the thread
+being suspended, or
+.Xr pthread_suspend_np 3
+and
+.Xr pthread_resume_np 3
+in some specific situations, instead.
+.Ef
+.Pp
+The
+.Fn thr_suspend
+system call puts the calling thread in a suspended state, where it is
+not eligible for CPU time.
+This state is exited by another thread calling
+.Xr thr_wake 2 ,
+when the time interval specified by
+.Fa timeout
+has elapsed,
+or by the delivery of a signal to the suspended thread.
+.Pp
+If the
+.Fa timeout
+argument is
+.Dv NULL ,
+the suspended state can be only terminated by explicit
+.Fn thr_wake
+or signal.
+.Pp
+If a wake from
+.Xr thr_wake 2
+was delivered before the
+.Nm
+call, the thread is not put into a suspended state.
+Instead, the call
+returns immediately without an error.
+.Pp
+If a thread previously called
+.Xr thr_wake 2
+with its own thread identifier, which resulted in setting the internal kernel
+flag to immediately abort interruptible sleeps with an
+.Er EINTR
+error
+.Po
+see
+.Xr thr_wake 2
+.Pc ,
+the flag is cleared.
+As with
+.Xr thr_wake 2
+called from another thread, the next
+.Nm
+call does not result in suspension.
+.Pp
+.Sh RETURN VALUES
+.Rv -std thr_suspend
+.Sh ERRORS
+The
+.Fn thr_suspend
+operation returns the following errors:
+.Bl -tag -width Er
+.It Bq Er EFAULT
+The memory pointed to by the
+.Fa timeout
+argument is not valid.
+.It Bq Er ETIMEDOUT
+The specified timeout expired.
+.It Bq Er ETIMEDOUT
+The
+.Fa timeout
+argument specified a zero time interval.
+.It Bq Er EINTR
+The sleep was interrupted by a signal.
+.El
+.Sh SEE ALSO
+.Xr ps 1 ,
+.Xr thr_wake 2 ,
+.Xr pthread_resume_np 3 ,
+.Xr pthread_suspend_np 3
+.Sh STANDARDS
+The
+.Fn thr_suspend
+system call is non-standard.


Property changes on: trunk/lib/libc/sys/thr_suspend.2
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/lib/libc/sys/thr_wake.2
===================================================================
--- trunk/lib/libc/sys/thr_wake.2	                        (rev 0)
+++ trunk/lib/libc/sys/thr_wake.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -0,0 +1,113 @@
+.\" $MidnightBSD$
+.\" Copyright (c) 2016 The FreeBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This documentation was written by
+.\" Konstantin Belousov <kib at FreeBSD.org> under sponsorship
+.\" from the FreeBSD Foundation.
+.\"
+.\" 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 AUTHORS 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 AUTHORS 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: stable/10/lib/libc/sys/thr_wake.2 306626 2016-10-03 09:32:19Z kib $
+.\"
+.Dd September 23, 2016
+.Dt THR_WAKE 2
+.Os
+.Sh NAME
+.Nm thr_wake
+.Nd wake up the suspended thread
+.Sh LIBRARY
+.Lb libc
+.Sh SYNOPSIS
+.In sys/thr.h
+.Ft int
+.Fn thr_wake "long id"
+.Sh DESCRIPTION
+.Bf -symbolic
+This function is intended for implementing threading.
+Normal applications should use
+.Xr pthread_cond_timedwait 3
+together with
+.Xr pthread_cond_broadcast 3
+for typical safe suspension with cooperation of the thread
+being suspended, or
+.Xr pthread_suspend_np 3
+and
+.Xr pthread_resume_np 3
+in some specific situations, instead.
+.Ef
+.Pp
+Passing the thread identifier of the calling thread
+.Po
+see
+.Xr thr_self 2
+.Pc
+to
+.Fn thr_wake
+sets a thread's flag to cause the next signal-interruptible sleep
+of that thread in the kernel to fail immediately with the
+.Er EINTR
+error.
+The flag is cleared by an interruptible sleep attempt or by a call to
+.Xr thr_suspend 2.
+This is used by the system threading library to implement cancellation.
+.Pp
+If
+.Fa id
+is not equal to the current thread identifier, the specified thread is
+woken up if suspended by the
+.Xr thr_suspend
+system call.
+If the thread is not suspended at the time of the
+.Nm
+call, the wake is remembered and the next attempt of the thread to
+suspend itself with the
+.Xr thr_suspend 2
+results in immediate return with success.
+Only one wake is remembered.
+.Sh RETURN VALUES
+.Rv -std thr_wake
+.Sh ERRORS
+The
+.Fn thr_wake
+operation returns these errors:
+.Bl -tag -width Er
+.It Bq Er ESRCH
+The specified thread was not found or does not belong to the process
+of the calling thread.
+.El
+.Sh SEE ALSO
+.Xr ps 1 ,
+.Xr thr_self 2
+.Xr thr_suspend 2 ,
+.Xr pthread_cancel 3 ,
+.Xr pthread_resume_np 3 ,
+.Xr pthread_suspend_np 3
+.Sh STANDARDS
+The
+.Fn thr_suspend
+system call is non-standard and is used by
+.Lb libthr
+to implement
+.St -p1003.1-2001
+.Xr pthread 3
+functionality.


Property changes on: trunk/lib/libc/sys/thr_wake.2
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: trunk/lib/libc/sys/timer_create.2
===================================================================
--- trunk/lib/libc/sys/timer_create.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/timer_create.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 2005 David Xu <davidxu at FreeBSD.org>
 .\" All rights reserved.
 .\"
@@ -25,9 +26,9 @@
 .\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 .\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/timer_create.2 303325 2016-07-25 23:38:14Z jhb $
 .\"
-.Dd January 12, 2009
+.Dd July 15, 2016
 .Dt TIMER_CREATE 2
 .Os
 .Sh NAME
@@ -74,6 +75,36 @@
 This structure,
 allocated by the application, defines the asynchronous notification to occur
 when the timer expires.
+.Pp
+If
+.Fa evp->sigev_notify
+is
+.Dv SIGEV_SIGNO
+or
+.Dv SIGEV_THREAD_ID ,
+the signal specified in
+.Fa evp->sigev_signo
+will be sent to the calling process
+.Pq Dv SIGEV_SIGNO
+or to the thread whose LWP ID is
+.Fa evp->sigev_notify_thread_id
+.Pq Dv SIGEV_THREAD_ID .
+The information for the queued signal will include:
+.Bl -column ".Va si_value"
+.It Sy Member Ta Sy Value
+.It Va si_code Ta Dv SI_TIMER
+.It Va si_value Ta
+the value stored in
+.Fa evp->sigev_value
+.It Va si_timerid Ta timer ID
+.It Va si_overrun Ta timer overrun count
+.It Va si_errno Ta
+If timer overrun is
+.Brq Dv DELAYTIMER_MAX ,
+an error code defined in
+.In errno.h
+.El
+.Pp
 If the
 .Fa evp
 argument is
@@ -88,12 +119,14 @@
 .Dv SIGEV_SIGNAL ,
 the
 .Va sigev_signo
-having a default signal number, and the
+having a default signal number
+.Pq Dv SIGALRM ,
+and the
 .Va sigev_value
 member having
 the value of the timer ID.
 .Pp
-The implementations supports a
+This implementation supports a
 .Fa clock_id
 of
 .Dv CLOCK_REALTIME
@@ -144,6 +177,8 @@
 this implementation.
 .It Bq Er EINVAL
 The specified clock ID is not supported.
+.It Bq Er EINVAL
+The specified asynchronous notification method is not supported.
 .It Bq Er EFAULT
 Any arguments point outside the allocated address space or there is a
 memory protection fault.
@@ -152,6 +187,7 @@
 .Xr clock_getres 2 ,
 .Xr timer_delete 2 ,
 .Xr timer_getoverrun 2 ,
+.Xr sigevent 3 ,
 .Xr siginfo 3
 .Sh STANDARDS
 The


Property changes on: trunk/lib/libc/sys/timer_create.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/timer_delete.2
===================================================================
--- trunk/lib/libc/sys/timer_delete.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/timer_delete.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 2005 David Xu <davidxu at FreeBSD.org>
 .\" All rights reserved.
 .\"
@@ -25,7 +26,7 @@
 .\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 .\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/timer_delete.2 235140 2012-05-08 18:56:21Z gjb $
 .\"
 .Dd September 11, 2000
 .Dt TIMER_DELETE 2


Property changes on: trunk/lib/libc/sys/timer_delete.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/timer_settime.2
===================================================================
--- trunk/lib/libc/sys/timer_settime.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/timer_settime.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 2005 David Xu <davidxu at FreeBSD.org>
 .\" All rights reserved.
 .\"
@@ -25,7 +26,7 @@
 .\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 .\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/timer_settime.2 235140 2012-05-08 18:56:21Z gjb $
 .\"
 .Dd September 11, 2000
 .Dt TIMER_SETTIME 2


Property changes on: trunk/lib/libc/sys/timer_settime.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/truncate.2
===================================================================
--- trunk/lib/libc/sys/truncate.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/truncate.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1983, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,9 +27,9 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)truncate.2	8.1 (Berkeley) 6/4/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/truncate.2 283916 2015-06-02 15:12:33Z jhb $
 .\"
-.Dd December 13, 2006
+.Dd May 4, 2015
 .Dt TRUNCATE 2
 .Os
 .Sh NAME
@@ -60,9 +61,18 @@
 If the file was smaller than this size,
 it will be extended as if by writing bytes
 with the value zero.
-With
-.Fn ftruncate ,
-the file must be open for writing.
+.Pp
+The
+.Fn ftruncate
+system call causes the file or shared memory object backing the file descriptor
+.Fa fd
+to be truncated or extended to
+.Fa length
+bytes in size.
+The file descriptor must be a valid file descriptor open for writing.
+The file position pointer associated with the file descriptor
+.Fa fd
+will not be modified.
 .Sh RETURN VALUES
 .Rv -std
 If the file to be modified is not a directory or
@@ -129,7 +139,7 @@
 The
 .Fa fd
 argument
-references a socket, not a file.
+references a file descriptor that is not a regular file or shared memory object.
 .It Bq Er EINVAL
 The
 .Fa fd
@@ -138,11 +148,14 @@
 .El
 .Sh SEE ALSO
 .Xr chflags 2 ,
-.Xr open 2
+.Xr open 2 ,
+.Xr shm_open 2
 .Sh HISTORY
 The
 .Fn truncate
-system call appeared in
+and
+.Fn ftruncate
+system calls appeared in
 .Bx 4.2 .
 .Sh BUGS
 These calls should be generalized to allow ranges


Property changes on: trunk/lib/libc/sys/truncate.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/truncate.c
===================================================================
--- trunk/lib/libc/sys/truncate.c	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/truncate.c	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * Copyright (c) 1992, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -31,7 +32,7 @@
 static char sccsid[] = "@(#)truncate.c	8.1 (Berkeley) 6/17/93";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libc/sys/truncate.c 171219 2007-07-04 23:27:38Z peter $");
 
 #include <sys/types.h>
 #include <sys/syscall.h>
@@ -48,7 +49,7 @@
 	off_t	length;
 {
 
-	if (__getosreldate() >= 4013)
+	if (__getosreldate() >= 700051)
 		return(__sys_truncate(path, length));
 	else
 		return(__sys_freebsd6_truncate(path, 0, length));

Modified: trunk/lib/libc/sys/umask.2
===================================================================
--- trunk/lib/libc/sys/umask.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/umask.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1980, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,7 +27,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)umask.2	8.1 (Berkeley) 6/4/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/umask.2 165903 2007-01-09 00:28:16Z imp $
 .\"
 .Dd June 4, 1993
 .Dt UMASK 2


Property changes on: trunk/lib/libc/sys/umask.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/undelete.2
===================================================================
--- trunk/lib/libc/sys/undelete.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/undelete.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1994
 .\"	Jan-Simon Pendry
 .\"	The Regents of the University of California.  All rights reserved.
@@ -27,7 +28,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)undelete.2	8.4 (Berkeley) 10/18/94
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/undelete.2 165903 2007-01-09 00:28:16Z imp $
 .\"
 .Dd January 22, 2006
 .Dt UNDELETE 2


Property changes on: trunk/lib/libc/sys/undelete.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/unlink.2
===================================================================
--- trunk/lib/libc/sys/unlink.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/unlink.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1980, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,7 +27,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)unlink.2	8.1 (Berkeley) 6/4/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/unlink.2 235140 2012-05-08 18:56:21Z gjb $
 .\"
 .Dd April 25, 2010
 .Dt UNLINK 2


Property changes on: trunk/lib/libc/sys/unlink.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: trunk/lib/libc/sys/utimensat.2
===================================================================
--- trunk/lib/libc/sys/utimensat.2	                        (rev 0)
+++ trunk/lib/libc/sys/utimensat.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -0,0 +1,296 @@
+.\" $MidnightBSD$
+.\"	$NetBSD: utimes.2,v 1.13 1999/03/22 19:45:11 garbled Exp $
+.\"
+.\" Copyright (c) 1990, 1993
+.\"	The Regents of the University of California.  All rights reserved.
+.\" Copyright (c) 2012, Jilles Tjoelker
+.\"
+.\" 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.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\"    may be used to endorse or promote products derived from this software
+.\"    without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
+.\"
+.\"     @(#)utimes.2	8.1 (Berkeley) 6/4/93
+.\" $FreeBSD: stable/10/lib/libc/sys/utimensat.2 294532 2016-01-21 21:16:57Z jilles $
+.\"
+.Dd January 17, 2016
+.Dt UTIMENSAT 2
+.Os
+.Sh NAME
+.Nm futimens ,
+.Nm utimensat
+.Nd set file access and modification times
+.Sh LIBRARY
+.Lb libc
+.Sh SYNOPSIS
+.In sys/stat.h
+.Ft int
+.Fn futimens "int fd" "const struct timespec times[2]"
+.Ft int
+.Fo utimensat
+.Fa "int fd"
+.Fa "const char *path"
+.Fa "const struct timespec times[2]"
+.Fa "int flag"
+.Fc
+.Sh DESCRIPTION
+The access and modification times of the file named by
+.Fa path
+or referenced by
+.Fa fd
+are changed as specified by the argument
+.Fa times .
+The inode-change-time of the file is set to the current time.
+.Pp
+If
+.Fa path
+specifies a relative path,
+it is relative to the current working directory if
+.Fa fd
+is
+.Dv AT_FDCWD
+and otherwise relative to the directory associated with the file descriptor
+.Fa fd .
+.Pp
+The
+.Va tv_nsec
+field of a
+.Vt timespec
+structure
+can be set to the special value
+.Dv UTIME_NOW
+to set the current time, or to
+.Dv UTIME_OMIT
+to leave the time unchanged.
+In either case, the
+.Va tv_sec
+field is ignored.
+.Pp
+If
+.Fa times
+is
+.No non- Ns Dv NULL ,
+it is assumed to point to an array of two timespec structures.
+The access time is set to the value of the first element, and the
+modification time is set to the value of the second element.
+For file systems that support file birth (creation) times (such as
+.Dv UFS2 ) ,
+the birth time will be set to the value of the second element
+if the second element is older than the currently set birth time.
+To set both a birth time and a modification time,
+two calls are required; the first to set the birth time
+and the second to set the (presumably newer) modification time.
+Ideally a new system call will be added that allows the setting
+of all three times at once.
+If
+.Fa times
+is
+.Dv NULL ,
+this is equivalent to passing
+a pointer to an array of two timespec structures
+with both
+.Va tv_nsec
+fields set to
+.Dv UTIME_NOW .
+.Pp
+If both
+.Va tv_nsec
+fields are
+.Dv UTIME_OMIT ,
+the timestamps remain unchanged and
+no permissions are needed for the file itself,
+although search permissions may be required for the path prefix.
+The call may or may not succeed if the named file does not exist.
+.Pp
+If both
+.Va tv_nsec
+fields are
+.Dv UTIME_NOW ,
+the caller must be the owner of the file, have permission to
+write the file, or be the super-user.
+.Pp
+For all other values of the timestamps,
+the caller must be the owner of the file or be the super-user.
+.Pp
+The values for the
+.Fa flag
+argument of the
+.Fn utimensat
+system call
+are constructed by a bitwise-inclusive OR of flags from the following list,
+defined in
+.In fcntl.h :
+.Bl -tag -width indent
+.It Dv AT_SYMLINK_NOFOLLOW
+If
+.Fa path
+names a symbolic link, the symbolic link's times are changed.
+By default,
+.Fn utimensat
+changes the times of the file referenced by the symbolic link.
+.El
+.Sh RETURN VALUES
+.Rv -std
+.Sh COMPATIBILITY
+If the running kernel does not support this system call,
+a wrapper emulates it using
+.Xr fstatat 2 ,
+.Xr futimesat 2
+and
+.Xr lutimes 2 .
+As a result, timestamps will be rounded down to the nearest microsecond,
+.Dv UTIME_OMIT
+is not atomic and
+.Dv AT_SYMLINK_NOFOLLOW
+is not available with a path relative to a file descriptor.
+.Sh ERRORS
+These system calls will fail if:
+.Bl -tag -width Er
+.It Bq Er EACCES
+The
+.Fa times
+argument is
+.Dv NULL ,
+or both
+.Va tv_nsec
+values are
+.Dv UTIME_NOW ,
+and the effective user ID of the process does not
+match the owner of the file, and is not the super-user, and write
+access is denied.
+.It Bq Er EFAULT
+The
+.Fa times
+argument
+points outside the process's allocated address space.
+.It Bq Er EINVAL
+The
+.Va tv_nsec
+component of at least one of the values specified by the
+.Fa times
+argument has a value less than 0 or greater than 999999999 and is not equal to
+.Dv UTIME_NOW
+or
+.Dv UTIME_OMIT .
+.It Bq Er EIO
+An I/O error occurred while reading or writing the affected inode.
+.It Bq Er EPERM
+The
+.Fa times
+argument is not
+.Dv NULL
+nor are both
+.Va tv_nsec
+values
+.Dv UTIME_NOW ,
+nor are both
+.Va tv_nsec
+values
+.Dv UTIME_OMIT
+and the calling process's effective user ID
+does not match the owner of the file and is not the super-user.
+.It Bq Er EPERM
+The named file has its immutable or append-only flag set, see the
+.Xr chflags 2
+manual page for more information.
+.It Bq Er EROFS
+The file system containing the file is mounted read-only.
+.El
+.Pp
+The
+.Fn futimens
+system call
+will fail if:
+.Bl -tag -width Er
+.It Bq Er EBADF
+The
+.Fa fd
+argument
+does not refer to a valid descriptor.
+.El
+.Pp
+The
+.Fn utimensat
+system call
+will fail if:
+.Bl -tag -width Er
+.It Bq Er EACCES
+Search permission is denied for a component of the path prefix.
+.It Bq Er EBADF
+The
+.Fa path
+argument does not specify an absolute path and the
+.Fa fd
+argument is neither
+.Dv AT_FDCWD
+nor a valid file descriptor.
+.It Bq Er EFAULT
+The
+.Fa path
+argument
+points outside the process's allocated address space.
+.It Bq Er ELOOP
+Too many symbolic links were encountered in translating the pathname.
+.It Bq Er ENAMETOOLONG
+A component of a pathname exceeded
+.Dv NAME_MAX
+characters, or an entire path name exceeded
+.Dv PATH_MAX
+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.
+.It Bq Er ENOTDIR
+The
+.Fa path
+argument is not an absolute path and
+.Fa fd
+is neither
+.Dv AT_FDCWD
+nor a file descriptor associated with a directory.
+.It Bq Er ENOTSUP
+The running kernel does not support this system call and
+.Dv AT_SYMLINK_NOFOLLOW
+is used with a path relative to a file descriptor.
+.El
+.Sh SEE ALSO
+.Xr chflags 2 ,
+.Xr stat 2 ,
+.Xr symlink 2 ,
+.Xr utimes 2 ,
+.Xr utime 3 ,
+.Xr symlink 7
+.Sh STANDARDS
+The
+.Fn futimens
+and
+.Fn utimensat
+system calls are expected to conform to
+.St -p1003.1-2008 .
+.Sh HISTORY
+The
+.Fn futimens
+and
+.Fn utimensat
+system calls appeared in
+.Fx 10.3 .


Property changes on: trunk/lib/libc/sys/utimensat.2
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/lib/libc/sys/utimensat.c
===================================================================
--- trunk/lib/libc/sys/utimensat.c	                        (rev 0)
+++ trunk/lib/libc/sys/utimensat.c	2018-06-07 12:22:26 UTC (rev 10509)
@@ -0,0 +1,113 @@
+/* $MidnightBSD$ */
+/*-
+ * Copyright (c) 2015 Jilles Tjoelker
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD: stable/10/lib/libc/sys/utimensat.c 294099 2016-01-15 20:55:44Z jilles $");
+
+#include "namespace.h"
+#include <sys/stat.h>
+
+#include <errno.h>
+#include <fcntl.h>
+#include <time.h>
+#include "un-namespace.h"
+
+#include "libc_private.h"
+
+int
+utimensat(int fd, const char *path, const struct timespec times[2], int flag)
+{
+	struct timeval now, tv[2], *tvp;
+	struct stat sb;
+	int osreldate;
+
+	osreldate = __getosreldate();
+	if (osreldate >= 1100056 ||
+	    (osreldate >= 1002506 && osreldate < 1100000))
+		return (__sys_utimensat(fd, path, times, flag));
+
+	if ((flag & ~AT_SYMLINK_NOFOLLOW) != 0) {
+		errno = EINVAL;
+		return (-1);
+	}
+	if (times == NULL || (times[0].tv_nsec == UTIME_NOW &&
+	    times[1].tv_nsec == UTIME_NOW))
+		tvp = NULL;
+	else if (times[0].tv_nsec == UTIME_OMIT &&
+	    times[1].tv_nsec == UTIME_OMIT)
+		return (0);
+	else {
+		if ((times[0].tv_nsec < 0 || times[0].tv_nsec > 999999999) &&
+		    times[0].tv_nsec != UTIME_NOW &&
+		    times[0].tv_nsec != UTIME_OMIT) {
+			errno = EINVAL;
+			return (-1);
+		}
+		if ((times[1].tv_nsec < 0 || times[1].tv_nsec > 999999999) &&
+		    times[1].tv_nsec != UTIME_NOW &&
+		    times[1].tv_nsec != UTIME_OMIT) {
+			errno = EINVAL;
+			return (-1);
+		}
+		tv[0].tv_sec = times[0].tv_sec;
+		tv[0].tv_usec = times[0].tv_nsec / 1000;
+		tv[1].tv_sec = times[1].tv_sec;
+		tv[1].tv_usec = times[1].tv_nsec / 1000;
+		tvp = tv;
+		if (times[0].tv_nsec == UTIME_OMIT ||
+		    times[1].tv_nsec == UTIME_OMIT) {
+			if (fstatat(fd, path, &sb, flag) == -1)
+				return (-1);
+			if (times[0].tv_nsec == UTIME_OMIT) {
+				tv[0].tv_sec = sb.st_atim.tv_sec;
+				tv[0].tv_usec = sb.st_atim.tv_nsec / 1000;
+			}
+			if (times[1].tv_nsec == UTIME_OMIT) {
+				tv[1].tv_sec = sb.st_mtim.tv_sec;
+				tv[1].tv_usec = sb.st_mtim.tv_nsec / 1000;
+			}
+		}
+		if (times[0].tv_nsec == UTIME_NOW ||
+		    times[1].tv_nsec == UTIME_NOW) {
+			if (gettimeofday(&now, NULL) == -1)
+				return (-1);
+			if (times[0].tv_nsec == UTIME_NOW)
+				tv[0] = now;
+			if (times[1].tv_nsec == UTIME_NOW)
+				tv[1] = now;
+		}
+	}
+	if ((flag & AT_SYMLINK_NOFOLLOW) == 0)
+		return (futimesat(fd, path, tvp));
+	else if ((flag & AT_SYMLINK_NOFOLLOW) != 0 &&
+	    (fd == AT_FDCWD || path[0] == '/'))
+		return (lutimes(path, tvp));
+	else {
+		errno = ENOTSUP;
+		return (-1);
+	}
+}


Property changes on: trunk/lib/libc/sys/utimensat.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: trunk/lib/libc/sys/utimes.2
===================================================================
--- trunk/lib/libc/sys/utimes.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/utimes.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\"	$NetBSD: utimes.2,v 1.13 1999/03/22 19:45:11 garbled Exp $
 .\"
 .\" Copyright (c) 1990, 1993
@@ -28,9 +29,9 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)utimes.2	8.1 (Berkeley) 6/4/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/utimes.2 268484 2014-07-10 09:09:37Z kib $
 .\"
-.Dd April 10, 2008
+.Dd July 3, 2014
 .Dt UTIMES 2
 .Os
 .Sh NAME
@@ -119,22 +120,18 @@
 .Dv AT_FDCWD
 in the
 .Fa fd
-parameter, the current working directory is used and the behavior is identical to
-a call to
+parameter, the current working directory is used and the behavior
+is identical to a call to
 .Fn utimes .
 .Sh RETURN VALUES
 .Rv -std
 .Sh ERRORS
-The
-.Fn utimes
-and
-.Fn lutimes
-system calls
-will fail if:
+All of the system call will fail if:
 .Bl -tag -width Er
 .It Bq Er EACCES
-Search permission is denied for a component of the path prefix;
-or the
+Search permission is denied for a component of the path prefix.
+.It Bq Er EACCES
+The
 .Fa times
 argument is
 .Dv NULL
@@ -148,6 +145,17 @@
 .Fa times
 argument
 points outside the process's allocated address space.
+.It Bq Er EFAULT
+The
+.Fa times
+argument
+points outside the process's allocated address space.
+.It Bq Er EINVAL
+The
+.Va tv_usec
+component of at least one of the values specified by the
+.Fa times
+argument has a value less than 0 or greater than 999999.
 .It Bq Er EIO
 An I/O error occurred while reading or writing the affected inode.
 .It Bq Er ELOOP
@@ -170,7 +178,8 @@
 and the calling process's effective user ID
 does not match the owner of the file and is not the super-user.
 .It Bq Er EPERM
-The named file has its immutable or append-only flag set, see the
+The named file has its immutable or append-only flags set.
+See the
 .Xr chflags 2
 manual page for more information.
 .It Bq Er EROFS
@@ -189,40 +198,6 @@
 does not refer to a valid descriptor.
 .El
 .Pp
-All of the system calls will fail if:
-.Bl -tag -width Er
-.It Bq Er EACCES
-The
-.Fa times
-argument is
-.Dv NULL
-and the effective user ID of the process does not
-match the owner of the file, and is not the super-user, and write
-access is denied.
-.It Bq Er EFAULT
-The
-.Fa times
-argument
-points outside the process's allocated address space.
-.It Bq Er EINVAL
-The
-.Va tv_usec
-component of at least one of the values specified by the
-.Fa times
-argument has a value less than 0 or greater than 999999.
-.It Bq Er EIO
-An I/O error occurred while reading or writing the affected inode.
-.It Bq Er EPERM
-The
-.Fa times
-argument is not
-.Dv NULL
-and the calling process's effective user ID
-does not match the owner of the file and is not the super-user.
-.It Bq Er EROFS
-The file system containing the file is mounted read-only.
-.El
-.Pp
 In addition to the errors returned by the
 .Fn utimes ,
 the


Property changes on: trunk/lib/libc/sys/utimes.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/utrace.2
===================================================================
--- trunk/lib/libc/sys/utrace.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/utrace.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\"	$NetBSD: utrace.2,v 1.11 2003/04/24 12:17:49 wiz Exp $
 .\"
 .\" Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -26,7 +27,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.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/utrace.2 204588 2010-03-02 17:20:04Z joel $
 .\"
 .Dd December 28, 2000
 .Dt UTRACE 2


Property changes on: trunk/lib/libc/sys/utrace.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/uuidgen.2
===================================================================
--- trunk/lib/libc/sys/uuidgen.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/uuidgen.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 2002 Marcel Moolenaar
 .\" All rights reserved.
 .\"
@@ -22,7 +23,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.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libc/sys/uuidgen.2 148580 2005-07-31 03:30:48Z keramida $
 .\"
 .Dd May 26, 2002
 .Dt UUIDGEN 2


Property changes on: trunk/lib/libc/sys/uuidgen.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libc/sys/vfork.2
===================================================================
--- trunk/lib/libc/sys/vfork.2	2018-06-07 02:10:46 UTC (rev 10508)
+++ trunk/lib/libc/sys/vfork.2	2018-06-07 12:22:26 UTC (rev 10509)
@@ -26,9 +26,10 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)vfork.2	8.1 (Berkeley) 6/4/93
+.\" $FreeBSD: stable/10/lib/libc/sys/vfork.2 300954 2016-05-29 12:16:58Z jilles $
 .\" $MidnightBSD$
 .\"
-.Dd November 13, 2009
+.Dd May 22, 2016
 .Dt VFORK 2
 .Os
 .Sh NAME
@@ -41,11 +42,20 @@
 .Ft pid_t
 .Fn vfork void
 .Sh DESCRIPTION
+.Bf -symbolic
+Since this function is hard to use correctly from application software,
+it is recommended to use
+.Xr posix_spawn 3
+or
+.Xr fork 2
+instead.
+.Ef
+.Pp
 The
 .Fn vfork
 system call
 can be used to create new processes without fully copying the address
-space of the old process, which is horrendously inefficient in a paged
+space of the old process, which is inefficient in a paged
 environment.
 It is useful when the purpose of
 .Xr fork 2
@@ -56,13 +66,15 @@
 system call
 differs from
 .Xr fork 2
-in that the child borrows the parent's memory and thread of
-control until a call to
+in that the child borrows the parent process's address space and the
+calling thread's stack
+until a call to
 .Xr execve 2
 or an exit (either by a call to
 .Xr _exit 2
 or abnormally).
-The parent process is suspended while the child is using its resources.
+The calling thread is suspended while the child is using its resources.
+Other threads continue to run.
 .Pp
 The
 .Fn vfork
@@ -70,17 +82,21 @@
 returns 0 in the child's context and (later) the pid of the child in
 the parent's context.
 .Pp
-The
-.Fn vfork
-system call
-can normally be used just like
-.Xr fork 2 .
-It does not work, however, to return while running in the child's context
+Many problems can occur when replacing
+.Xr fork 2
+with
+.Fn vfork .
+For example, it does not work to return while running in the child's context
 from the procedure that called
 .Fn vfork
 since the eventual return from
 .Fn vfork
 would then return to a no longer existent stack frame.
+Also, changing process state which is partially implemented in user space
+such as signal handlers with
+.Xr libthr 3
+will corrupt the parent's state.
+.Pp
 Be careful, also, to call
 .Xr _exit 2
 rather than
@@ -106,12 +122,13 @@
 .Xr rfork 2 ,
 .Xr sigaction 2 ,
 .Xr wait 2 ,
-.Xr exit 3
+.Xr exit 3 ,
+.Xr posix_spawn 3
 .Sh HISTORY
 The
 .Fn vfork
 system call appeared in
-.Bx 2.9 .
+.Bx 3 .
 .Sh BUGS
 To avoid a possible deadlock situation,
 processes that are children in the middle


Property changes on: trunk/lib/libc/sys/vfork.2
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property


More information about the Midnightbsd-cvs mailing list