freebsd-dev/lib/libc/sys
Ed Schouten b114aa7959 Make shutdown() return ENOTCONN as required by POSIX, part deux.
Summary:
Back in 2005, maxim@ attempted to fix shutdown() to return ENOTCONN in case the socket was not connected (r150152). This had to be rolled back (r150155), as it broke some of the existing programs that depend on this behavior. I reapplied this change on my system and indeed, syslogd failed to start up. I fixed this back in February (279016) and MFC'ed it to the supported stable branches. Apart from that, things seem to work out all right.

Since at least Linux and Mac OS X do the right thing, I'd like to go ahead and give this another try. To keep old copies of syslogd working, only start returning ENOTCONN for recent binaries.

I took a look at the XNU sources and they seem to test against both SS_ISCONNECTED, SS_ISCONNECTING and SS_ISDISCONNECTING, instead of just SS_ISCONNECTED. That seams reasonable, so let's do the same.

Test Plan:
This issue was uncovered while writing tests for shutdown() in CloudABI:

https://github.com/NuxiNL/cloudlibc/blob/master/src/libc/sys/socket/shutdown_test.c#L26

Reviewers: glebius, rwatson, #manpages, gnn, #network

Reviewed By: gnn, #network

Subscribers: bms, mjg, imp

Differential Revision: https://reviews.freebsd.org/D3039
2015-07-27 13:17:57 +00:00
..
__error.c Avoid calling internal libc function through PLT or accessing data 2015-01-05 01:06:54 +00:00
__vdso_gettimeofday.c Rework the __vdso_* symbols attributes to only make the symbols weak, 2013-01-30 12:48:16 +00:00
_exit.2
abort2.2 use .Mt to mark up email addresses consistently (part4) 2014-06-23 08:25:03 +00:00
accept4.c Fix known issues which blow up the process after dlopen("libthr.so") 2015-01-03 18:38:46 +00:00
accept.2 accept(2) may and can return EAGAIN, document it. 2014-10-10 03:05:55 +00:00
accept.c Fix known issues which blow up the process after dlopen("libthr.so") 2015-01-03 18:38:46 +00:00
access.2 Various mdoc fixes and a few EOL whitespace removals. 2014-12-21 12:36:36 +00:00
acct.2
adjtime.2
aio_cancel.2 use .Mt to mark up email addresses consistently (part4) 2014-06-23 08:25:03 +00:00
aio_error.2 use .Mt to mark up email addresses consistently (part4) 2014-06-23 08:25:03 +00:00
aio_fsync.2 - Fix EBADF description, in following the future POSIX tc and what FreeBSD 2013-12-27 16:57:38 +00:00
aio_mlock.2 use .Mt to mark up email addresses consistently (part4) 2014-06-23 08:25:03 +00:00
aio_read.2 use .Mt to mark up email addresses consistently (part4) 2014-06-23 08:25:03 +00:00
aio_return.2 use .Mt to mark up email addresses consistently (part4) 2014-06-23 08:25:03 +00:00
aio_suspend.2 use .Mt to mark up email addresses consistently (part4) 2014-06-23 08:25:03 +00:00
aio_suspend.c Fix known issues which blow up the process after dlopen("libthr.so") 2015-01-03 18:38:46 +00:00
aio_waitcomplete.2 use .Mt to mark up email addresses consistently (part4) 2014-06-23 08:25:03 +00:00
aio_write.2 use .Mt to mark up email addresses consistently (part4) 2014-06-23 08:25:03 +00:00
bind.2 Document EINVAL as per POSIX. 2014-06-26 10:21:00 +00:00
bindat.2 use .Mt to mark up email addresses consistently (part4) 2014-06-23 08:25:03 +00:00
brk.2
cap_enter.2 Update system man pages for s/capability.h/capsicum.h/. 2014-03-27 21:43:00 +00:00
cap_fcntls_limit.2 use .Mt to mark up email addresses consistently (part4) 2014-06-23 08:25:03 +00:00
cap_ioctls_limit.2 forgot to bump date, and replace contraction (igor)... 2015-03-07 03:48:32 +00:00
cap_rights_limit.2 use .Mt to mark up email addresses consistently (part4) 2014-06-23 08:25:03 +00:00
chdir.2
chflags.2 Add some missing .Nm for newer syscalls in existing man pages. 2014-01-11 22:00:16 +00:00
chmod.2 chmod(2): Document S_ISVTX following SUSv3/SUSv4. 2013-12-01 12:24:57 +00:00
chown.2
chroot.2 - Use standard RETURN VALUES section. 2013-01-15 14:09:08 +00:00
clock_gettime.2 mdoc: drop redundant .Pp and .LP calls 2010-10-08 12:40:16 +00:00
clock_gettime.c Use struct vdso_timehands data to implement fast gettimeofday(2) and 2012-06-22 07:13:30 +00:00
close.2 Consistently reference file descriptors as "fd". 55 other manpages 2013-09-12 00:53:38 +00:00
close.c Fix known issues which blow up the process after dlopen("libthr.so") 2015-01-03 18:38:46 +00:00
closefrom.2 Reassign copyright statements on several files from Advanced 2015-04-23 14:22:20 +00:00
connect.2 Document [EPERM] for UNIX sockets. 2014-09-30 00:06:53 +00:00
connect.c Fix known issues which blow up the process after dlopen("libthr.so") 2015-01-03 18:38:46 +00:00
connectat.2 use .Mt to mark up email addresses consistently (part4) 2014-06-23 08:25:03 +00:00
cpuset_getaffinity.2 use .Mt to mark up email addresses consistently (part4) 2014-06-23 08:25:03 +00:00
cpuset.2 Document CPU_WHICH_DOMAIN and bump Dd for cpuset.1. 2015-01-08 18:53:11 +00:00
dup.2 Add man page dup3(3). 2013-08-16 13:16:27 +00:00
execve.2 Fix exec_imgact_shell()'s handling of two error cases: (1) Previously, if 2010-09-21 16:24:51 +00:00
extattr_get_file.2 Fix return type of extattr_set_* and fix rmextattr(8) utility. 2013-04-02 05:30:41 +00:00
fcntl.2 Make the F_READAHEAD option to fcntl(2) work as documented: a value of zero 2013-02-13 15:09:16 +00:00
fcntl.c The lseek(2), mmap(2), truncate(2), ftruncate(2), pread(2), and 2015-04-18 21:50:13 +00:00
ffclock.2 use .Mt to mark up email addresses consistently (part4) 2014-06-23 08:25:03 +00:00
fhopen.2
flock.2 Document that flock can return ENOLCK 2011-11-10 06:20:18 +00:00
fork.2 fork(2): Add a note to the effect that kqueue descriptors, unlike other 2015-05-02 00:29:27 +00:00
fork.c Fix known issues which blow up the process after dlopen("libthr.so") 2015-01-03 18:38:46 +00:00
fsync.2
fsync.c Fix known issues which blow up the process after dlopen("libthr.so") 2015-01-03 18:38:46 +00:00
futimens.c Add futimens and utimensat system calls. 2015-01-23 21:07:08 +00:00
getdirentries.2 Various mdoc fixes and a few EOL whitespace removals. 2014-12-21 12:36:36 +00:00
getdtablesize.2 getdtablesize(2): Describe what this function actually does. 2013-04-24 21:24:35 +00:00
getfh.2 getfh(2): Add xrefs for fhopen(2), open(2), stat(2). 2011-04-14 22:06:11 +00:00
getfsstat.2
getgid.2
getgroups.2 getgroups(2): Remove mention of <sys/param.h> and refer to sysconf(3). 2011-01-21 22:15:17 +00:00
getitimer.2 mdoc: remove literal tabs where they don't belong 2010-06-08 16:48:59 +00:00
getlogin.2
getloginclass.2 Add manual page for getloginclass(2) and setloginclass(2). 2011-03-06 08:35:50 +00:00
getpeername.2 Document that getpeername(2) and getsockname(2) can fail with EINVAL. 2012-11-23 10:14:54 +00:00
getpgrp.2
getpid.2
getpriority.2 mdoc: make pages render with mandoc 2010-10-21 12:27:13 +00:00
getrlimit.2 Various mdoc fixes and a few EOL whitespace removals. 2014-12-21 12:36:36 +00:00
getrusage.2 mdoc: remove literal tabs where they don't belong 2010-06-08 16:48:59 +00:00
getsid.2
getsockname.2 Document that getpeername(2) and getsockname(2) can fail with EINVAL. 2012-11-23 10:14:54 +00:00
getsockopt.2 Correct the returned message lengths for timeval and bintime control 2013-04-05 18:09:43 +00:00
gettimeofday.2 mdoc: drop redundant .Pp and .LP calls 2010-10-08 12:40:16 +00:00
gettimeofday.c Rework the __vdso_* symbols attributes to only make the symbols weak, 2013-01-30 12:48:16 +00:00
getuid.2
interposing_table.c The lseek(2), mmap(2), truncate(2), ftruncate(2), pread(2), and 2015-04-18 21:50:13 +00:00
intro.2 mdoc: remove superfluous paragraph macros. 2014-06-23 18:40:21 +00:00
ioctl.2 Consistently reference file descriptors as "fd". 55 other manpages 2013-09-12 00:53:38 +00:00
issetugid.2
jail.2 A new jail(8) with a configuration file, ultimately to replace the work 2012-04-26 17:36:05 +00:00
kenv.2 use .Mt to mark up email addresses consistently (part4) 2014-06-23 08:25:03 +00:00
kevent.c Make kevent(2) a cancellation point. 2015-03-29 19:14:41 +00:00
kill.2 Update the kill(2) and killpg(2) man pages to the modern permission 2012-10-22 03:37:00 +00:00
kldfind.2
kldfirstmod.2
kldload.2
kldnext.2
kldstat.2 Fix comment to specify correct struct name. 2012-03-28 23:51:06 +00:00
kldsym.2 mdoc: drop redundant .Pp and .LP calls 2010-10-08 12:40:16 +00:00
kldunload.2 Document that kldunloadf can return EINVAL. 2008-12-25 09:15:31 +00:00
kqueue.2 Make kevent(2) a cancellation point. 2015-03-29 19:14:41 +00:00
kse.2 use .Mt to mark up email addresses consistently (part4) 2014-06-23 08:25:03 +00:00
ktrace.2 General mdoc(7) and typo fixes. 2012-05-08 18:56:21 +00:00
link.2 Correct AT_SYMLINK_FOLLOW flag name in linkat(2) man page. 2009-07-19 16:48:25 +00:00
lio_listio.2
listen.2 Document that listen(2) can fail with EDESTADDRREQ. 2014-07-15 02:21:51 +00:00
lseek.2 Clarify the SEEK_HOLE description, it repositions the file pointer. 2012-05-26 05:25:55 +00:00
madvise.2 Correct the description of MADV_DONTNEED. Specifically, after using 2015-07-12 19:18:19 +00:00
Makefile.inc Add an initial NUMA affinity/policy configuration for threads and processes. 2015-07-11 15:21:37 +00:00
mincore.2
minherit.2
mkdir.2
mkfifo.2
mknod.2 mknod(2): The required include is <sys/stat.h>, not <unistd.h>. 2011-01-16 21:59:50 +00:00
mlock.2 Minor mdoc fix 2014-05-30 02:16:28 +00:00
mlockall.2 - Update manual pages accordingly to r244384 and r244385. 2012-12-25 13:43:01 +00:00
mmap.2 fix spelling, add comma and remove BUGS section.. it provided no useful 2015-02-19 01:51:17 +00:00
modfind.2
modnext.2
modstat.2 mdoc: drop redundant .Pp and .LP calls 2010-10-08 12:40:16 +00:00
mount.2 Remove obsolete bits about maximum number of file systems. 2015-04-12 21:14:58 +00:00
mprotect.2
mq_close.2 mdoc: remove literal tabs where they don't belong 2010-06-08 16:48:59 +00:00
mq_getattr.2 Match the correct variable to the variable description. 2014-02-21 13:53:41 +00:00
mq_notify.2 mdoc: remove literal tabs where they don't belong 2010-06-08 16:48:59 +00:00
mq_open.2 document mqueuefs is required for mq_open... 2014-09-15 22:32:35 +00:00
mq_receive.2 mdoc: remove literal tabs where they don't belong 2010-06-08 16:48:59 +00:00
mq_send.2 mdoc: remove literal tabs where they don't belong 2010-06-08 16:48:59 +00:00
mq_setattr.2 mq_setattr(2): Add missing const to man page. 2011-05-17 21:03:34 +00:00
msgctl.2 Move msg{snd,recv,get,ctl} manual pages from section 3 to 2. 2009-07-13 12:53:43 +00:00
msgget.2 Move msg{snd,recv,get,ctl} manual pages from section 3 to 2. 2009-07-13 12:53:43 +00:00
msgrcv.2 Move msg{snd,recv,get,ctl} manual pages from section 3 to 2. 2009-07-13 12:53:43 +00:00
msgsnd.2 General mdoc(7) and typo fixes. 2012-05-08 18:56:21 +00:00
msync.2 msync(2) must return ENOMEM and not EINVAL when the address is outside the 2014-05-07 08:38:02 +00:00
msync.c Fix known issues which blow up the process after dlopen("libthr.so") 2015-01-03 18:38:46 +00:00
munmap.2
nanosleep.2 In nanosleep(2), note that the calling thread is put to sleep, not the 2009-10-11 16:23:11 +00:00
nanosleep.c Fix known issues which blow up the process after dlopen("libthr.so") 2015-01-03 18:38:46 +00:00
nfssvc.2 Globally replace u_int*_t from (non-contributed) man pages. 2012-02-12 18:29:56 +00:00
ntp_adjtime.2 Fix typos, spelling, formatting and mdoc mistakes found by Nobuyuki while 2010-08-16 15:18:30 +00:00
numa_getaffinity.2 Add an initial NUMA affinity/policy configuration for threads and processes. 2015-07-11 15:21:37 +00:00
open.2 Fix markup. 2015-07-07 19:23:59 +00:00
open.c Reduce the size of the interposing table and amount of 2015-01-11 22:16:31 +00:00
openat.c Fix known issues which blow up the process after dlopen("libthr.so") 2015-01-03 18:38:46 +00:00
pathconf.2 General mdoc(7) and typo fixes. 2012-05-08 18:56:21 +00:00
pdfork.2 use .Mt to mark up email addresses consistently (part4) 2014-06-23 08:25:03 +00:00
pipe.2 Add some missing .Nm for newer syscalls in existing man pages. 2014-01-11 22:00:16 +00:00
poll.2 Various mdoc fixes and a few EOL whitespace removals. 2014-12-21 12:36:36 +00:00
poll.c Fix known issues which blow up the process after dlopen("libthr.so") 2015-01-03 18:38:46 +00:00
posix_fadvise.2 The posix_madvise(3) and posix_fadvise(2) should return error on 2014-01-30 18:04:39 +00:00
posix_fallocate.2 use .Mt to mark up email addresses consistently (part4) 2014-06-23 08:25:03 +00:00
posix_openpt.2 Escape "Ed" 2015-04-26 10:52:37 +00:00
ppoll.c Make wait6(2), waitid(3) and ppoll(2) cancellation points. The 2015-04-18 21:35:41 +00:00
procctl.2 Reassign copyright statements on several files from Advanced 2015-04-23 14:22:20 +00:00
profil.2
pselect.2 use .Mt to mark up email addresses consistently (part4) 2014-06-23 08:25:03 +00:00
pselect.c Fix known issues which blow up the process after dlopen("libthr.so") 2015-01-03 18:38:46 +00:00
ptrace.2 Grammar and language fixes. 2015-07-03 17:30:31 +00:00
quotactl.2 Remove trailing whitespace per mdoc lint warning 2012-03-29 05:02:12 +00:00
read.2 Consistently reference file descriptors as "fd". 55 other manpages 2013-09-12 00:53:38 +00:00
read.c Fix known issues which blow up the process after dlopen("libthr.so") 2015-01-03 18:38:46 +00:00
readlink.2
readv.c Fix known issues which blow up the process after dlopen("libthr.so") 2015-01-03 18:38:46 +00:00
reboot.2 Add missing capitalization. 2015-07-24 18:13:13 +00:00
recv.2 Slightly improve grammar in EAGAIN description. 2014-10-15 23:39:47 +00:00
recvfrom.c Fix known issues which blow up the process after dlopen("libthr.so") 2015-01-03 18:38:46 +00:00
recvmsg.c Fix known issues which blow up the process after dlopen("libthr.so") 2015-01-03 18:38:46 +00:00
rename.2
revoke.2 Various mdoc fixes and a few EOL whitespace removals. 2014-12-21 12:36:36 +00:00
rfork.2 Document RFTSIGZMB. Fix spelling of SIGCHLD. Note that signals are 2011-07-12 20:38:42 +00:00
rmdir.2
rtprio.2 use .Mt to mark up email addresses consistently (part4) 2014-06-23 08:25:03 +00:00
sched_get_priority_max.2
sched_setparam.2
sched_setscheduler.2 Various mdoc fixes and a few EOL whitespace removals. 2014-12-21 12:36:36 +00:00
sched_yield.2
sctp_generic_recvmsg.2 Remove the advertising clause from the Regents of the University of 2013-05-28 21:05:06 +00:00
sctp_generic_sendmsg.2 Remove the advertising clause from the Regents of the University of 2013-05-28 21:05:06 +00:00
sctp_peeloff.2 Remove the advertising clause from the Regents of the University of 2013-05-28 21:05:06 +00:00
select.2 Remove trailing whitespace per mdoc lint warning 2012-03-29 05:02:12 +00:00
select.c Fix known issues which blow up the process after dlopen("libthr.so") 2015-01-03 18:38:46 +00:00
semctl.2 Make the structure definitions in the man pages match the real code, and 2009-06-29 18:54:17 +00:00
semget.2
semop.2 Fix incorrect usage of 'assure' and 'insure'. 2010-08-28 16:32:01 +00:00
send.2 Standardize the various prison_foo_ip[46] functions and prison_if to 2009-02-05 14:06:09 +00:00
sendfile.2 use .Mt to mark up email addresses consistently (part4) 2014-06-23 08:25:03 +00:00
sendmsg.c Fix known issues which blow up the process after dlopen("libthr.so") 2015-01-03 18:38:46 +00:00
sendto.c Fix known issues which blow up the process after dlopen("libthr.so") 2015-01-03 18:38:46 +00:00
setcontext.c Fix known issues which blow up the process after dlopen("libthr.so") 2015-01-03 18:38:46 +00:00
setfib.2 Update the setfib man page to reflect recent changes. 2013-05-20 20:47:40 +00:00
setgroups.2 In preparation for raising NGROUPS and NGROUPS_MAX, change base 2009-06-19 15:58:24 +00:00
setpgid.2 Describe what setpgid(2) does when pgid=0. The text has been 2009-12-01 06:12:31 +00:00
setregid.2
setresuid.2 Remove useless comment. 2015-02-07 13:11:45 +00:00
setreuid.2
setsid.2
setuid.2 Make man page wording more clear: 2012-01-15 20:14:52 +00:00
shm_open.2 use .Mt to mark up email addresses consistently (part4) 2014-06-23 08:25:03 +00:00
shmat.2 Update shmget(2) with POSIX access permissions and remove non-standard SHM_R, 2010-12-17 21:10:08 +00:00
shmctl.2 Update shmget(2) with POSIX access permissions and remove non-standard SHM_R, 2010-12-17 21:10:08 +00:00
shmget.2 Sort cross references by section. 2010-12-18 10:09:07 +00:00
shutdown.2 Make shutdown() return ENOTCONN as required by POSIX, part deux. 2015-07-27 13:17:57 +00:00
sigaction.2 Update some signal man pages for multithreading. 2013-09-06 09:08:40 +00:00
sigaction.c Fix known issues which blow up the process after dlopen("libthr.so") 2015-01-03 18:38:46 +00:00
sigaltstack.2 Use NULL instead of 0 for pointer in example. 2010-08-29 16:38:08 +00:00
sigpending.2 Update some signal man pages for multithreading. 2013-09-06 09:08:40 +00:00
sigprocmask.2 sigprocmask(2): pthread_sigmask(3) must be used in threaded processes. 2010-05-07 20:46:22 +00:00
sigprocmask.c Fix known issues which blow up the process after dlopen("libthr.so") 2015-01-03 18:38:46 +00:00
sigqueue.2 sigqueue(2): Fix typo (EEPERM -> EPERM). 2013-02-10 13:20:23 +00:00
sigreturn.2 Update some signal man pages for multithreading. 2013-09-06 09:08:40 +00:00
sigstack.2
sigsuspend.2 sigsuspend(2): Add xrefs to pselect(2) and sigwait-alikes. 2013-08-15 22:33:27 +00:00
sigsuspend.c Fix known issues which blow up the process after dlopen("libthr.so") 2015-01-03 18:38:46 +00:00
sigtimedwait.c Fix known issues which blow up the process after dlopen("libthr.so") 2015-01-03 18:38:46 +00:00
sigwait.2 Update some signal man pages for multithreading. 2013-09-06 09:08:40 +00:00
sigwait.c Fix known issues which blow up the process after dlopen("libthr.so") 2015-01-03 18:38:46 +00:00
sigwaitinfo.2 Various mdoc fixes and a few EOL whitespace removals. 2014-12-21 12:36:36 +00:00
sigwaitinfo.c Fix known issues which blow up the process after dlopen("libthr.so") 2015-01-03 18:38:46 +00:00
socket.2 Catch up with many years of changes: 2014-06-24 20:23:18 +00:00
socketpair.2 Partially revert r255486, the first argument to socketpair() is a socket 2015-05-04 14:23:31 +00:00
stack_protector_compat.c Revert r274772: it is not valid on MIPS 2014-11-25 03:50:31 +00:00
stack_protector.c NetBSD commit log: 2015-06-14 07:47:18 +00:00
stat.2 Remove invalid remark about pipes. 2012-06-02 10:50:25 +00:00
statfs.2
swapcontext.c Fix known issues which blow up the process after dlopen("libthr.so") 2015-01-03 18:38:46 +00:00
swapon.2 The compile time constant limit on number of swap devices was removed in 5.2. 2013-12-25 16:01:29 +00:00
Symbol.map Add an initial NUMA affinity/policy configuration for threads and processes. 2015-07-11 15:21:37 +00:00
symlink.2
sync.2 syncer(4) is a kernel process, not a user process 2014-02-27 04:06:34 +00:00
sysarch.2
syscall.2
timer_create.2 General mdoc(7) and typo fixes. 2012-05-08 18:56:21 +00:00
timer_delete.2 General mdoc(7) and typo fixes. 2012-05-08 18:56:21 +00:00
timer_settime.2 General mdoc(7) and typo fixes. 2012-05-08 18:56:21 +00:00
trivial-vdso_tc.c libc: Eliminate duplicate copies of __vdso_gettc.c 2015-04-02 21:18:11 +00:00
truncate.2 Various updates to the ftruncate(2) documentation: 2015-05-04 14:47:00 +00:00
umask.2
undelete.2
unlink.2 General mdoc(7) and typo fixes. 2012-05-08 18:56:21 +00:00
utimensat.2 Add futimens and utimensat system calls. 2015-01-23 21:07:08 +00:00
utimensat.c Add futimens and utimensat system calls. 2015-01-23 21:07:08 +00:00
utimes.2 Note that most errors are possible for all syscalls from utimes(2) 2014-07-03 11:19:16 +00:00
utrace.2 <sys/param.h> is a superset of <sys/types.h> and must always come 2014-11-01 09:10:21 +00:00
uuidgen.2
vfork.2 vfork() first appeared in 3BSD which pre-dates 2.9BSD. Verified via the 2015-04-06 20:40:01 +00:00
wait4.c Fix known issues which blow up the process after dlopen("libthr.so") 2015-01-03 18:38:46 +00:00
wait6.c Make wait6(2), waitid(3) and ppoll(2) cancellation points. The 2015-04-18 21:35:41 +00:00
wait.2 The si_status field of the siginfo_t, provided by the waitid(2) and 2015-07-18 09:02:50 +00:00
write.2 Consistently reference file descriptors as "fd". 55 other manpages 2013-09-12 00:53:38 +00:00
write.c Fix known issues which blow up the process after dlopen("libthr.so") 2015-01-03 18:38:46 +00:00
writev.c Fix known issues which blow up the process after dlopen("libthr.so") 2015-01-03 18:38:46 +00:00