2016-01-06 22:57:32 +00:00
|
|
|
.\" This man page is Copyright (C) 1999 Andi Kleen <ak@muc.de>,
|
|
|
|
.\" Copyright (C) 2008-2014, Michael Kerrisk <mtk.manpages@gmail.com>,
|
|
|
|
.\" and Copyright (C) 2016, Heinrich Schuchardt <xypron.glpk@gmx.de>
|
ldd.1, capget.2, clone.2, create_module.2, fallocate.2, futex.2, get_kernel_syms.2, get_thread_area.2, getcpu.2, getitimer.2, getpid.2, io_cancel.2, io_destroy.2, io_getevents.2, io_setup.2, io_submit.2, ioctl_list.2, mkdir.2, mknod.2, pciconfig_read.2, pivot_root.2, posix_fadvise.2, query_module.2, sendfile.2, set_thread_area.2, setns.2, unshare.2, __setfpucw.3, a64l.3, addseverity.3, argz_add.3, bindresvport.3, cabs.3, cacos.3, cacosh.3, canonicalize_file_name.3, carg.3, casin.3, casinh.3, catan.3, catanh.3, ccos.3, ccosh.3, cerf.3, cexp.3, cexp2.3, cimag.3, clog.3, clog10.3, clog2.3, cmsg.3, conj.3, cpow.3, cproj.3, creal.3, csin.3, csinh.3, csqrt.3, ctan.3, ctanh.3, des_crypt.3, envz_add.3, fdim.3, fma.3, fmax.3, fmemopen.3, fmin.3, fmtmsg.3, fpclassify.3, gamma.3, getpt.3, getrpcent.3, getrpcport.3, getttyent.3, isgreater.3, key_setsecret.3, lgamma.3, malloc_hook.3, mempcpy.3, nan.3, netlink.3, nextafter.3, putgrent.3, remove.3, remquo.3, rpc.3, rtime.3, rtnetlink.3, setaliasent.3, setnetgrent.3, signbit.3, significand.3, sincos.3, stdin.3, tgamma.3, xcrypt.3, xdr.3, cciss.4, hpsa.4, mouse.4, pts.4, sk98lin.4, tty_ioctl.4, wavelan.4, hosts.equiv.5, rpc.5, tzfile.5, boot.7, complex.7, ddp.7, fifo.7, futex.7, icmp.7, ip.7, ipv6.7, netdevice.7, netlink.7, packet.7, raw.7, rtnetlink.7, socket.7, tcp.7, udp.7, unix.7, x25.7, sync.8: Global fix: Put copyright info at top of page, followed by blank line and LICENSE
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2013-03-10 09:29:51 +00:00
|
|
|
.\"
|
getcpu.2, sendfile.2, cmsg.3, rtnetlink.3, arp.7, ddp.7, fifo.7, icmp.7, ip.7, ipv6.7, netdevice.7, packet.7, raw.7, rtnetlink.7, socket.7, tcp.7, udp.7, unix.7, x25.7: LICENSE_START(VERBATIM_ONE_PARA)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2013-03-10 09:29:00 +00:00
|
|
|
.\" %%%LICENSE_START(VERBATIM_ONE_PARA)
|
2008-08-08 16:41:48 +00:00
|
|
|
.\" Permission is granted to distribute possibly modified copies
|
|
|
|
.\" of this page provided the header is included verbatim,
|
|
|
|
.\" and in case of nontrivial modification author and date
|
|
|
|
.\" of the modification is added to the header.
|
epoll_create.2, epoll_ctl.2, epoll_wait.2, eventfd.2, fallocate.2, futex.2, getcpu.2, getitimer.2, ioctl_list.2, ioprio_set.2, migrate_pages.2, move_pages.2, pciconfig_read.2, sendfile.2, setns.2, signalfd.2, spu_create.2, spu_run.2, sysinfo.2, timerfd_create.2, backtrace.3, cmsg.3, error.3, getpt.3, getrpcent.3, getrpcport.3, getsubopt.3, offsetof.3, program_invocation_name.3, rpc.3, rpmatch.3, rtnetlink.3, xdr.3, cciss.4, hpsa.4, pts.4, charmap.5, dir_colors.5, elf.5, gai.conf.5, locale.5, nscd.conf.5, nss.5, resolv.conf.5, rpc.5, arp.7, cpuset.7, ddp.7, epoll.7, fifo.7, futex.7, icmp.7, ip.7, ipv6.7, mailaddr.7, netdevice.7, packet.7, raw.7, regex.7, rtnetlink.7, socket.7, spufs.7, tcp.7, udp.7, unix.7, x25.7, ldconfig.8, nscd.8: Global fix: s/END_LICENSE/LICENSE_END/
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2013-03-12 09:26:07 +00:00
|
|
|
.\" %%%LICENSE_END
|
2008-08-08 16:41:48 +00:00
|
|
|
.\"
|
|
|
|
.\" Modified, 2003-12-02, Michael Kerrisk, <mtk.manpages@gmail.com>
|
|
|
|
.\" Modified, 2003-09-23, Adam Langley
|
|
|
|
.\" Modified, 2004-05-27, Michael Kerrisk, <mtk.manpages@gmail.com>
|
|
|
|
.\" Added SOCK_SEQPACKET
|
|
|
|
.\" 2008-05-27, mtk, Provide a clear description of the three types of
|
|
|
|
.\" address that can appear in the sockaddr_un structure: pathname,
|
|
|
|
.\" unnamed, and abstract.
|
|
|
|
.\"
|
add_key.2, chown.2, epoll_ctl.2, epoll_wait.2, execve.2, fcntl.2, get_mempolicy.2, getxattr.2, ioctl.2, keyctl.2, listxattr.2, mkdir.2, mknod.2, mmap.2, msync.2, nfsservctl.2, open.2, prctl.2, removexattr.2, request_key.2, sendfile.2, set_mempolicy.2, setxattr.2, shmget.2, shutdown.2, sigaction.2, syslog.2, truncate.2, umask.2, CPU_SET.3, atexit.3, bsearch.3, cmsg.3, err.3, gethostid.3, getmntent.3, getopt.3, iconv_close.3, inet_ntop.3, longjmp.3, lsearch.3, mcheck.3, on_exit.3, putpwent.3, regex.3, resolver.3, setbuf.3, setjmp.3, setlocale.3, setlogmask.3, sleep.3, strsignal.3, sysconf.3, undocumented.3, tty_ioctl.4, proc.5, resolv.conf.5, tzfile.5, aio.7, bootparam.7, capabilities.7, fanotify.7, inotify.7, ip.7, packet.7, pthreads.7, raw.7, signal.7, socket.7, unix.7, ld.so.8, nscd.8: tstamp
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-05-07 06:26:32 +00:00
|
|
|
.TH UNIX 7 2015-05-07 "Linux" "Linux Programmer's Manual"
|
2008-08-08 16:41:48 +00:00
|
|
|
.SH NAME
|
intro.1, add_key.2, get_mempolicy.2, get_thread_area.2, intro.2, keyctl.2, mbind.2, request_key.2, set_thread_area.2, clock.3, cmsg.3, getcwd.3, getpw.3, intro.3, malloc.3, posix_memalign.3, shm_open.3, sleep.3, sysconf.3, intro.4, sd.4, intro.5, locale.5, slabinfo.5, intro.6, boot.7, bootparam.7, futex.7, glob.7, hier.7, intro.7, libc.7, locale.7, mq_overview.7, netlink.7, sem_overview.7, shm_overview.7, unix.7, intro.8: Global fix: Use consistent capitalization in NAME section
The line(s) in the NAME section should only use capitals
where English usage dictates that. Otherwise, use
lowercase throughout.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2012-10-21 06:29:13 +00:00
|
|
|
unix \- sockets for local interprocess communication
|
2008-08-08 16:41:48 +00:00
|
|
|
.SH SYNOPSIS
|
|
|
|
.B #include <sys/socket.h>
|
|
|
|
.br
|
|
|
|
.B #include <sys/un.h>
|
|
|
|
|
2008-08-08 16:47:53 +00:00
|
|
|
.IB unix_socket " = socket(AF_UNIX, type, 0);"
|
2008-08-08 16:41:48 +00:00
|
|
|
.br
|
2008-08-08 16:47:53 +00:00
|
|
|
.IB error " = socketpair(AF_UNIX, type, 0, int *" sv ");"
|
2008-08-08 16:41:48 +00:00
|
|
|
.SH DESCRIPTION
|
|
|
|
The
|
2008-08-08 16:47:53 +00:00
|
|
|
.B AF_UNIX
|
2008-08-08 16:41:48 +00:00
|
|
|
(also known as
|
2008-08-08 16:47:53 +00:00
|
|
|
.BR AF_LOCAL )
|
2008-08-08 16:41:48 +00:00
|
|
|
socket family is used to communicate between processes on the same machine
|
|
|
|
efficiently.
|
2010-10-12 04:48:33 +00:00
|
|
|
Traditionally, UNIX domain sockets can be either unnamed,
|
intro.1, time.1, access.2, acct.2, alloc_hugepages.2, bind.2, chdir.2, chmod.2, chown.2, chroot.2, clone.2, close.2, execve.2, fallocate.2, fcntl.2, getdents.2, getrusage.2, getxattr.2, init_module.2, inotify_add_watch.2, ioprio_set.2, kcmp.2, link.2, listxattr.2, lseek.2, madvise.2, mkdir.2, mknod.2, mmap.2, mount.2, move_pages.2, msgctl.2, nfsservctl.2, open.2, pivot_root.2, quotactl.2, read.2, readlink.2, removexattr.2, rename.2, rmdir.2, semctl.2, setfsgid.2, setfsuid.2, setresuid.2, setuid.2, setup.2, setxattr.2, shmctl.2, splice.2, spu_create.2, stat.2, statfs.2, swapon.2, symlink.2, sync.2, sync_file_range.2, sysfs.2, truncate.2, umount.2, unlink.2, unshare.2, ustat.2, utime.2, utimensat.2, write.2, btree.3, errno.3, fexecve.3, ftw.3, futimes.3, get_nprocs_conf.3, getcwd.3, getdirentries.3, getmntent.3, glob.3, mkfifo.3, mq_open.3, readdir.3, realpath.3, recno.3, remove.3, sem_open.3, shm_open.3, statvfs.3, sysconf.3, telldir.3, tmpfile.3, cciss.4, initrd.4, pts.4, sk98lin.4, vcs.4, core.5, filesystems.5, proc.5, boot.7, bootparam.7, capabilities.7, cpuset.7, credentials.7, feature_test_macros.7, fifo.7, hier.7, inotify.7, intro.7, mq_overview.7, path_resolution.7, pipe.7, sem_overview.7, shm_overview.7, spufs.7, symlink.7, unix.7, uri.7, sync.8: Global fix: s/file system/filesystem/
Notwithstanding 24d01c530c5a3f75217543d02bf6712395e5f90c,
"filesystem" is the form used by the great majority of man pages
outside the man-pages project and in a number of other sources,
so let's go with that.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2013-08-08 08:07:57 +00:00
|
|
|
or bound to a filesystem pathname (marked as being of type socket).
|
2008-08-08 16:41:48 +00:00
|
|
|
Linux also supports an abstract namespace which is independent of the
|
intro.1, time.1, access.2, acct.2, alloc_hugepages.2, bind.2, chdir.2, chmod.2, chown.2, chroot.2, clone.2, close.2, execve.2, fallocate.2, fcntl.2, getdents.2, getrusage.2, getxattr.2, init_module.2, inotify_add_watch.2, ioprio_set.2, kcmp.2, link.2, listxattr.2, lseek.2, madvise.2, mkdir.2, mknod.2, mmap.2, mount.2, move_pages.2, msgctl.2, nfsservctl.2, open.2, pivot_root.2, quotactl.2, read.2, readlink.2, removexattr.2, rename.2, rmdir.2, semctl.2, setfsgid.2, setfsuid.2, setresuid.2, setuid.2, setup.2, setxattr.2, shmctl.2, splice.2, spu_create.2, stat.2, statfs.2, swapon.2, symlink.2, sync.2, sync_file_range.2, sysfs.2, truncate.2, umount.2, unlink.2, unshare.2, ustat.2, utime.2, utimensat.2, write.2, btree.3, errno.3, fexecve.3, ftw.3, futimes.3, get_nprocs_conf.3, getcwd.3, getdirentries.3, getmntent.3, glob.3, mkfifo.3, mq_open.3, readdir.3, realpath.3, recno.3, remove.3, sem_open.3, shm_open.3, statvfs.3, sysconf.3, telldir.3, tmpfile.3, cciss.4, initrd.4, pts.4, sk98lin.4, vcs.4, core.5, filesystems.5, proc.5, boot.7, bootparam.7, capabilities.7, cpuset.7, credentials.7, feature_test_macros.7, fifo.7, hier.7, inotify.7, intro.7, mq_overview.7, path_resolution.7, pipe.7, sem_overview.7, shm_overview.7, spufs.7, symlink.7, unix.7, uri.7, sync.8: Global fix: s/file system/filesystem/
Notwithstanding 24d01c530c5a3f75217543d02bf6712395e5f90c,
"filesystem" is the form used by the great majority of man pages
outside the man-pages project and in a number of other sources,
so let's go with that.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2013-08-08 08:07:57 +00:00
|
|
|
filesystem.
|
2008-08-08 16:41:48 +00:00
|
|
|
|
2012-04-17 10:56:21 +00:00
|
|
|
Valid socket types in the UNIX domain are:
|
2008-08-08 16:41:48 +00:00
|
|
|
.BR SOCK_STREAM ,
|
2012-04-17 10:56:21 +00:00
|
|
|
for a stream-oriented socket;
|
2008-08-08 16:41:48 +00:00
|
|
|
.BR SOCK_DGRAM ,
|
|
|
|
for a datagram-oriented socket that preserves message boundaries
|
intro.1, time.1, accept.2, bind.2, connect.2, execve.2, flock.2, getdents.2, getpriority.2, getuid.2, intro.2, ioctl.2, mincore.2, mknod.2, personality.2, ptrace.2, read.2, recv.2, select_tut.2, send.2, sendfile.2, shmctl.2, sigaction.2, signal.2, stat.2, times.2, truncate.2, umask.2, wait.2, MB_CUR_MAX.3, MB_LEN_MAX.3, argz_add.3, btowc.3, clearenv.3, clock.3, cmsg.3, end.3, endian.3, errno.3, exit.3, fgetwc.3, fgetws.3, fopen.3, fputwc.3, fputws.3, fseek.3, fwide.3, getfsent.3, getgrnam.3, gethostid.3, getipnodebyname.3, getmntent.3, getpwnam.3, getwchar.3, grantpt.3, iconv.3, iconv_close.3, iconv_open.3, insque.3, intro.3, iswalnum.3, iswalpha.3, iswblank.3, iswcntrl.3, iswctype.3, iswdigit.3, iswgraph.3, iswlower.3, iswprint.3, iswpunct.3, iswspace.3, iswupper.3, iswxdigit.3, malloc.3, mblen.3, mbrlen.3, mbrtowc.3, mbsinit.3, mbsnrtowcs.3, mbsrtowcs.3, mbstowcs.3, mbtowc.3, mkstemp.3, mktemp.3, nl_langinfo.3, openpty.3, posix_openpt.3, printf.3, ptsname.3, putwchar.3, qecvt.3, rcmd.3, readdir.3, rexec.3, rpc.3, setnetgrent.3, shm_open.3, sigpause.3, stdin.3, stpcpy.3, strftime.3, strptime.3, syslog.3, towctrans.3, towlower.3, towupper.3, ttyslot.3, ungetwc.3, unlocked_stdio.3, wcpcpy.3, wcpncpy.3, wcrtomb.3, wcscasecmp.3, wcscat.3, wcschr.3, wcscmp.3, wcscpy.3, wcscspn.3, wcsdup.3, wcslen.3, wcsncasecmp.3, wcsncat.3, wcsncmp.3, wcsncpy.3, wcsnlen.3, wcsnrtombs.3, wcspbrk.3, wcsrchr.3, wcsrtombs.3, wcsspn.3, wcsstr.3, wcstok.3, wcstombs.3, wcswidth.3, wctob.3, wctomb.3, wctrans.3, wctype.3, wcwidth.3, wmemchr.3, wmemcmp.3, wmemcpy.3, wmemmove.3, wmemset.3, wprintf.3, console_ioctl.4, pts.4, elf.5, filesystems.5, hosts.5, proc.5, ttytype.5, boot.7, capabilities.7, credentials.7, epoll.7, glob.7, koi8-r.7, path_resolution.7, pty.7, signal.7, suffixes.7, time.7, unicode.7, unix.7, uri.7, utf-8.7: global fix: s/Unix/UNIX/
The man pages were rather inconsistent in the use of "Unix"
versus "UNIX". Let's go with the trademark usage.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2010-10-12 04:45:38 +00:00
|
|
|
(as on most UNIX implementations, UNIX domain datagram
|
2008-08-08 16:41:48 +00:00
|
|
|
sockets are always reliable and don't reorder datagrams);
|
|
|
|
and (since Linux 2.6.4)
|
|
|
|
.BR SOCK_SEQPACKET ,
|
2016-01-08 19:44:17 +00:00
|
|
|
for a sequenced-packet socket that is connection-oriented,
|
|
|
|
preserves message boundaries,
|
2008-08-08 16:41:48 +00:00
|
|
|
and delivers messages in the order that they were sent.
|
|
|
|
|
2010-10-12 04:48:33 +00:00
|
|
|
UNIX domain sockets support passing file descriptors or process credentials
|
2008-08-08 16:41:48 +00:00
|
|
|
to other processes using ancillary data.
|
intro.1, time.1, _syscall.2, accept.2, brk.2, capget.2, faccessat.2, futimesat.2, gethostname.2, intro.2, ioprio_set.2, kill.2, madvise.2, mlock.2, mount.2, msgget.2, perf_event_open.2, poll.2, readv.2, sched_rr_get_interval.2, sched_setscheduler.2, select.2, select_tut.2, shmget.2, stat.2, timer_create.2, ustat.2, vfork.2, wait.2, alloca.3, atexit.3, catopen.3, crypt.3, dbopen.3, fenv.3, fopen.3, getaddrinfo_a.3, gethostbyname.3, getutent.3, intro.3, login.3, mallopt.3, queue.3, regex.3, sigpause.3, sigsetops.3, stdio.3, strftime.3, strptime.3, sysconf.3, ttyslot.3, undocumented.3, cciss.4, console_codes.4, hpsa.4, initrd.4, intro.4, rtc.4, st.4, tty_ioctl.4, wavelan.4, acct.5, charmap.5, dir_colors.5, hosts.5, intro.5, termcap.5, utmp.5, intro.6, armscii-8.7, boot.7, bootparam.7, capabilities.7, cpuset.7, credentials.7, ddp.7, epoll.7, glob.7, intro.7, ip.7, ipv6.7, iso_8859-1.7, iso_8859-10.7, iso_8859-11.7, iso_8859-13.7, iso_8859-14.7, iso_8859-15.7, iso_8859-16.7, iso_8859-2.7, iso_8859-3.7, iso_8859-4.7, iso_8859-5.7, iso_8859-6.7, iso_8859-7.7, iso_8859-8.7, iso_8859-9.7, koi8-r.7, koi8-u.7, man-pages.7, man.7, math_error.7, netlink.7, numa.7, packet.7, path_resolution.7, pipe.7, pthreads.7, raw.7, rtnetlink.7, signal.7, socket.7, spufs.7, svipc.7, tcp.7, time.7, udp.7, udplite.7, unicode.7, unix.7, uri.7, utf-8.7, x25.7, intro.8: Global fix: use consistent capitalization in .SS headings
Capitalization in .SS sections across pages (and sometimes even
within a single page) is wildly inconsistent. Make it consistent.
Capitalize first word in heading, but otherwise use lower case,
except where English usage (e.g., proper nouns) or programming
language requirements (e.g., identifier names) dictate otherwise.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2013-02-24 14:08:38 +00:00
|
|
|
.SS Address format
|
intro.1, time.1, accept.2, bind.2, connect.2, execve.2, flock.2, getdents.2, getpriority.2, getuid.2, intro.2, ioctl.2, mincore.2, mknod.2, personality.2, ptrace.2, read.2, recv.2, select_tut.2, send.2, sendfile.2, shmctl.2, sigaction.2, signal.2, stat.2, times.2, truncate.2, umask.2, wait.2, MB_CUR_MAX.3, MB_LEN_MAX.3, argz_add.3, btowc.3, clearenv.3, clock.3, cmsg.3, end.3, endian.3, errno.3, exit.3, fgetwc.3, fgetws.3, fopen.3, fputwc.3, fputws.3, fseek.3, fwide.3, getfsent.3, getgrnam.3, gethostid.3, getipnodebyname.3, getmntent.3, getpwnam.3, getwchar.3, grantpt.3, iconv.3, iconv_close.3, iconv_open.3, insque.3, intro.3, iswalnum.3, iswalpha.3, iswblank.3, iswcntrl.3, iswctype.3, iswdigit.3, iswgraph.3, iswlower.3, iswprint.3, iswpunct.3, iswspace.3, iswupper.3, iswxdigit.3, malloc.3, mblen.3, mbrlen.3, mbrtowc.3, mbsinit.3, mbsnrtowcs.3, mbsrtowcs.3, mbstowcs.3, mbtowc.3, mkstemp.3, mktemp.3, nl_langinfo.3, openpty.3, posix_openpt.3, printf.3, ptsname.3, putwchar.3, qecvt.3, rcmd.3, readdir.3, rexec.3, rpc.3, setnetgrent.3, shm_open.3, sigpause.3, stdin.3, stpcpy.3, strftime.3, strptime.3, syslog.3, towctrans.3, towlower.3, towupper.3, ttyslot.3, ungetwc.3, unlocked_stdio.3, wcpcpy.3, wcpncpy.3, wcrtomb.3, wcscasecmp.3, wcscat.3, wcschr.3, wcscmp.3, wcscpy.3, wcscspn.3, wcsdup.3, wcslen.3, wcsncasecmp.3, wcsncat.3, wcsncmp.3, wcsncpy.3, wcsnlen.3, wcsnrtombs.3, wcspbrk.3, wcsrchr.3, wcsrtombs.3, wcsspn.3, wcsstr.3, wcstok.3, wcstombs.3, wcswidth.3, wctob.3, wctomb.3, wctrans.3, wctype.3, wcwidth.3, wmemchr.3, wmemcmp.3, wmemcpy.3, wmemmove.3, wmemset.3, wprintf.3, console_ioctl.4, pts.4, elf.5, filesystems.5, hosts.5, proc.5, ttytype.5, boot.7, capabilities.7, credentials.7, epoll.7, glob.7, koi8-r.7, path_resolution.7, pty.7, signal.7, suffixes.7, time.7, unicode.7, unix.7, uri.7, utf-8.7: global fix: s/Unix/UNIX/
The man pages were rather inconsistent in the use of "Unix"
versus "UNIX". Let's go with the trademark usage.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2010-10-12 04:45:38 +00:00
|
|
|
A UNIX domain socket address is represented in the following structure:
|
2008-08-08 16:41:48 +00:00
|
|
|
.in +4n
|
|
|
|
.nf
|
|
|
|
|
2015-05-06 08:22:38 +00:00
|
|
|
.\" #define UNIX_PATH_MAX 108
|
2015-05-07 06:30:26 +00:00
|
|
|
.\"
|
2008-08-08 16:41:48 +00:00
|
|
|
struct sockaddr_un {
|
|
|
|
sa_family_t sun_family; /* AF_UNIX */
|
2015-05-06 08:22:38 +00:00
|
|
|
char sun_path[108]; /* pathname */
|
2008-08-08 16:41:48 +00:00
|
|
|
};
|
|
|
|
.fi
|
|
|
|
.in
|
|
|
|
.PP
|
2012-04-17 10:56:21 +00:00
|
|
|
The
|
2008-08-08 16:41:48 +00:00
|
|
|
.I sun_family
|
2012-04-17 10:56:21 +00:00
|
|
|
field always contains
|
2008-08-08 16:41:48 +00:00
|
|
|
.BR AF_UNIX .
|
2015-05-06 08:24:56 +00:00
|
|
|
On Linux
|
|
|
|
.I sun_path
|
|
|
|
is 108 bytes in size; see also NOTES, below.
|
2008-08-08 16:41:48 +00:00
|
|
|
|
2012-04-17 10:56:21 +00:00
|
|
|
Various systems calls (for example,
|
|
|
|
.BR bind (2),
|
|
|
|
.BR connect (2),
|
|
|
|
and
|
|
|
|
.BR sendto (2))
|
|
|
|
take a
|
2014-10-15 09:17:46 +00:00
|
|
|
.I sockaddr_un
|
2012-04-17 10:56:21 +00:00
|
|
|
argument as input.
|
|
|
|
Some other system calls (for example,
|
|
|
|
.BR getsockname (2),
|
|
|
|
.BR getpeername (2),
|
|
|
|
.BR recvfrom (2),
|
|
|
|
and
|
|
|
|
.BR accept (2))
|
|
|
|
return an argument of this type.
|
|
|
|
|
|
|
|
Three types of address are distinguished in the
|
|
|
|
.I sockaddr_un
|
|
|
|
structure:
|
2008-08-08 16:41:48 +00:00
|
|
|
.IP * 3
|
|
|
|
.IR pathname :
|
2014-01-17 16:50:05 +00:00
|
|
|
a UNIX domain socket can be bound to a null-terminated
|
|
|
|
filesystem pathname using
|
2008-08-08 16:41:48 +00:00
|
|
|
.BR bind (2).
|
2012-04-17 10:56:21 +00:00
|
|
|
When the address of a pathname socket is returned
|
|
|
|
(by one of the system calls noted above),
|
2008-08-08 16:41:48 +00:00
|
|
|
its length is
|
2013-08-01 10:29:32 +00:00
|
|
|
|
|
|
|
offsetof(struct sockaddr_un, sun_path) + strlen(sun_path) + 1
|
|
|
|
|
2008-08-08 16:41:48 +00:00
|
|
|
and
|
|
|
|
.I sun_path
|
|
|
|
contains the null-terminated pathname.
|
2012-04-17 10:56:21 +00:00
|
|
|
(On Linux, the above
|
|
|
|
.BR offsetof ()
|
|
|
|
expression equates to the same value as
|
|
|
|
.IR sizeof(sa_family_t) ,
|
|
|
|
but some other implementations include other fields before
|
|
|
|
.IR sun_path ,
|
|
|
|
so the
|
|
|
|
.BR offsetof ()
|
|
|
|
expression more portably describes the size of the address structure.)
|
|
|
|
.IP
|
|
|
|
For further details of pathname sockets, see below.
|
2008-08-08 16:41:48 +00:00
|
|
|
.IP *
|
|
|
|
.IR unnamed :
|
|
|
|
A stream socket that has not been bound to a pathname using
|
|
|
|
.BR bind (2)
|
|
|
|
has no name.
|
|
|
|
Likewise, the two sockets created by
|
|
|
|
.BR socketpair (2)
|
|
|
|
are unnamed.
|
2012-04-17 10:56:21 +00:00
|
|
|
When the address of an unnamed socket is returned,
|
2008-08-08 16:41:48 +00:00
|
|
|
its length is
|
|
|
|
.IR "sizeof(sa_family_t)" ,
|
|
|
|
and
|
|
|
|
.I sun_path
|
|
|
|
should not be inspected.
|
|
|
|
.\" There is quite some variation across implementations: FreeBSD
|
|
|
|
.\" says the length is 16 bytes, HP-UX 11 says it's zero bytes.
|
|
|
|
.IP *
|
|
|
|
.IR abstract :
|
2012-04-17 10:56:21 +00:00
|
|
|
an abstract socket address is distinguished (from a pathname socket)
|
|
|
|
by the fact that
|
2008-08-08 16:41:48 +00:00
|
|
|
.IR sun_path[0]
|
2011-09-28 02:52:42 +00:00
|
|
|
is a null byte (\(aq\\0\(aq).
|
2010-10-10 04:59:41 +00:00
|
|
|
The socket's address in this namespace is given by the additional
|
|
|
|
bytes in
|
|
|
|
.IR sun_path
|
|
|
|
that are covered by the specified length of the address structure.
|
2008-08-08 16:41:48 +00:00
|
|
|
(Null bytes in the name have no special significance.)
|
intro.1, time.1, access.2, acct.2, alloc_hugepages.2, bind.2, chdir.2, chmod.2, chown.2, chroot.2, clone.2, close.2, execve.2, fallocate.2, fcntl.2, getdents.2, getrusage.2, getxattr.2, init_module.2, inotify_add_watch.2, ioprio_set.2, kcmp.2, link.2, listxattr.2, lseek.2, madvise.2, mkdir.2, mknod.2, mmap.2, mount.2, move_pages.2, msgctl.2, nfsservctl.2, open.2, pivot_root.2, quotactl.2, read.2, readlink.2, removexattr.2, rename.2, rmdir.2, semctl.2, setfsgid.2, setfsuid.2, setresuid.2, setuid.2, setup.2, setxattr.2, shmctl.2, splice.2, spu_create.2, stat.2, statfs.2, swapon.2, symlink.2, sync.2, sync_file_range.2, sysfs.2, truncate.2, umount.2, unlink.2, unshare.2, ustat.2, utime.2, utimensat.2, write.2, btree.3, errno.3, fexecve.3, ftw.3, futimes.3, get_nprocs_conf.3, getcwd.3, getdirentries.3, getmntent.3, glob.3, mkfifo.3, mq_open.3, readdir.3, realpath.3, recno.3, remove.3, sem_open.3, shm_open.3, statvfs.3, sysconf.3, telldir.3, tmpfile.3, cciss.4, initrd.4, pts.4, sk98lin.4, vcs.4, core.5, filesystems.5, proc.5, boot.7, bootparam.7, capabilities.7, cpuset.7, credentials.7, feature_test_macros.7, fifo.7, hier.7, inotify.7, intro.7, mq_overview.7, path_resolution.7, pipe.7, sem_overview.7, shm_overview.7, spufs.7, symlink.7, unix.7, uri.7, sync.8: Global fix: s/file system/filesystem/
Notwithstanding 24d01c530c5a3f75217543d02bf6712395e5f90c,
"filesystem" is the form used by the great majority of man pages
outside the man-pages project and in a number of other sources,
so let's go with that.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2013-08-08 08:07:57 +00:00
|
|
|
The name has no connection with filesystem pathnames.
|
2012-04-17 10:56:21 +00:00
|
|
|
When the address of an abstract socket is returned,
|
2010-10-10 04:59:41 +00:00
|
|
|
the returned
|
|
|
|
.I addrlen
|
|
|
|
is greater than
|
|
|
|
.IR "sizeof(sa_family_t)"
|
|
|
|
(i.e., greater than 2), and the name of the socket is contained in
|
|
|
|
the first
|
|
|
|
.IR "(addrlen \- sizeof(sa_family_t))"
|
|
|
|
bytes of
|
|
|
|
.IR sun_path .
|
execve.2, fallocate.2, futex.2, sched_rr_get_interval.2, select_tut.2, shmget.2, timer_getoverrun.2, times.2, pthread_attr_init.3, pthread_attr_setaffinity_np.3, pthread_cleanup_push_defer_np.3, pthread_getattr_np.3, pthread_self.3, pthread_setaffinity_np.3, pthread_tryjoin_np.3, sem_open.3, stdin.3, rtc.4, tty_ioctl.4, unix.7: Global fix: s/non-portable/nonportable/
The tendency in English, as prescribed in style guides like
Chicago MoS, is towards removing hyphens after prefixes
like "non-" etc.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2010-01-16 16:46:09 +00:00
|
|
|
The abstract socket namespace is a nonportable Linux extension.
|
2012-04-17 10:56:21 +00:00
|
|
|
.SS Pathname sockets
|
|
|
|
When binding a socket to a pathname, a few rules should be observed
|
|
|
|
for maximum portability and ease of coding:
|
|
|
|
.IP * 3
|
|
|
|
The pathname in
|
|
|
|
.I sun_path
|
|
|
|
should be null-terminated.
|
|
|
|
.IP *
|
|
|
|
The length of the pathname, including the terminating null byte,
|
|
|
|
should not exceed the size of
|
|
|
|
.IR sun_path .
|
|
|
|
.IP *
|
|
|
|
The
|
|
|
|
.I addrlen
|
|
|
|
argument that describes the enclosing
|
|
|
|
.I sockaddr_un
|
|
|
|
structure should have a value of at least:
|
|
|
|
|
|
|
|
.nf
|
|
|
|
offsetof(struct sockaddr_un, sun_path)+strlen(addr.sun_path)+1
|
|
|
|
.fi
|
|
|
|
.IP
|
2014-10-15 09:17:46 +00:00
|
|
|
or, more simply,
|
2012-04-17 10:56:21 +00:00
|
|
|
.I addrlen
|
|
|
|
can be specified as
|
|
|
|
.IR "sizeof(struct sockaddr_un)" .
|
|
|
|
.PP
|
|
|
|
There is some variation in how implementations handle UNIX domain
|
|
|
|
socket addresses that do not follow the above rules.
|
|
|
|
For example, some (but not all) implementations
|
|
|
|
.\" Linux does this, including for the case where the supplied path
|
|
|
|
.\" is 108 bytes
|
|
|
|
append a null terminator if none is present in the supplied
|
|
|
|
.IR sun_path .
|
|
|
|
|
|
|
|
When coding portable applications,
|
|
|
|
keep in mind that some implementations
|
|
|
|
.\" HP-UX
|
|
|
|
have
|
|
|
|
.I sun_path
|
|
|
|
as short as 92 bytes.
|
|
|
|
.\" Modern BSDs generally have 104, Tru64 and AIX have 104,
|
|
|
|
.\" Solaris and Irix have 108
|
|
|
|
|
|
|
|
Various system calls
|
|
|
|
.RB ( accept (2),
|
|
|
|
.BR recvfrom (2),
|
|
|
|
.BR getsockname (2),
|
|
|
|
.BR getpeername (2))
|
|
|
|
return socket address structures.
|
|
|
|
When applied to UNIX domain sockets, the value-result
|
|
|
|
.I addrlen
|
|
|
|
argument supplied to the call should be initialized as above.
|
|
|
|
Upon return, the argument is set to indicate the
|
|
|
|
.I actual
|
|
|
|
size of the address structure.
|
|
|
|
The caller should check the value returned in this argument:
|
|
|
|
if the output value exceeds the input value,
|
|
|
|
then there is no guarantee that a null terminator is present in
|
|
|
|
.IR sun_path .
|
|
|
|
(See BUGS.)
|
intro.1, time.1, _syscall.2, accept.2, brk.2, capget.2, faccessat.2, futimesat.2, gethostname.2, intro.2, ioprio_set.2, kill.2, madvise.2, mlock.2, mount.2, msgget.2, perf_event_open.2, poll.2, readv.2, sched_rr_get_interval.2, sched_setscheduler.2, select.2, select_tut.2, shmget.2, stat.2, timer_create.2, ustat.2, vfork.2, wait.2, alloca.3, atexit.3, catopen.3, crypt.3, dbopen.3, fenv.3, fopen.3, getaddrinfo_a.3, gethostbyname.3, getutent.3, intro.3, login.3, mallopt.3, queue.3, regex.3, sigpause.3, sigsetops.3, stdio.3, strftime.3, strptime.3, sysconf.3, ttyslot.3, undocumented.3, cciss.4, console_codes.4, hpsa.4, initrd.4, intro.4, rtc.4, st.4, tty_ioctl.4, wavelan.4, acct.5, charmap.5, dir_colors.5, hosts.5, intro.5, termcap.5, utmp.5, intro.6, armscii-8.7, boot.7, bootparam.7, capabilities.7, cpuset.7, credentials.7, ddp.7, epoll.7, glob.7, intro.7, ip.7, ipv6.7, iso_8859-1.7, iso_8859-10.7, iso_8859-11.7, iso_8859-13.7, iso_8859-14.7, iso_8859-15.7, iso_8859-16.7, iso_8859-2.7, iso_8859-3.7, iso_8859-4.7, iso_8859-5.7, iso_8859-6.7, iso_8859-7.7, iso_8859-8.7, iso_8859-9.7, koi8-r.7, koi8-u.7, man-pages.7, man.7, math_error.7, netlink.7, numa.7, packet.7, path_resolution.7, pipe.7, pthreads.7, raw.7, rtnetlink.7, signal.7, socket.7, spufs.7, svipc.7, tcp.7, time.7, udp.7, udplite.7, unicode.7, unix.7, uri.7, utf-8.7, x25.7, intro.8: Global fix: use consistent capitalization in .SS headings
Capitalization in .SS sections across pages (and sometimes even
within a single page) is wildly inconsistent. Make it consistent.
Capitalize first word in heading, but otherwise use lower case,
except where English usage (e.g., proper nouns) or programming
language requirements (e.g., identifier names) dictate otherwise.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2013-02-24 14:08:38 +00:00
|
|
|
.SS Socket options
|
2014-11-08 05:13:13 +00:00
|
|
|
For historical reasons, these socket options are specified with a
|
2008-08-08 16:41:48 +00:00
|
|
|
.B SOL_SOCKET
|
|
|
|
type even though they are
|
2008-08-08 16:47:53 +00:00
|
|
|
.B AF_UNIX
|
2008-08-08 16:41:48 +00:00
|
|
|
specific.
|
|
|
|
They can be set with
|
|
|
|
.BR setsockopt (2)
|
|
|
|
and read with
|
|
|
|
.BR getsockopt (2)
|
|
|
|
by specifying
|
|
|
|
.B SOL_SOCKET
|
|
|
|
as the socket family.
|
|
|
|
.TP
|
|
|
|
.B SO_PASSCRED
|
2010-10-10 04:13:59 +00:00
|
|
|
Enables the receiving of the credentials of the sending process in an
|
2008-08-08 16:41:48 +00:00
|
|
|
ancillary message.
|
|
|
|
When this option is set and the socket is not yet connected
|
|
|
|
a unique name in the abstract namespace will be generated automatically.
|
|
|
|
Expects an integer boolean flag.
|
intro.1, time.1, _syscall.2, accept.2, brk.2, capget.2, faccessat.2, futimesat.2, gethostname.2, intro.2, ioprio_set.2, kill.2, madvise.2, mlock.2, mount.2, msgget.2, perf_event_open.2, poll.2, readv.2, sched_rr_get_interval.2, sched_setscheduler.2, select.2, select_tut.2, shmget.2, stat.2, timer_create.2, ustat.2, vfork.2, wait.2, alloca.3, atexit.3, catopen.3, crypt.3, dbopen.3, fenv.3, fopen.3, getaddrinfo_a.3, gethostbyname.3, getutent.3, intro.3, login.3, mallopt.3, queue.3, regex.3, sigpause.3, sigsetops.3, stdio.3, strftime.3, strptime.3, sysconf.3, ttyslot.3, undocumented.3, cciss.4, console_codes.4, hpsa.4, initrd.4, intro.4, rtc.4, st.4, tty_ioctl.4, wavelan.4, acct.5, charmap.5, dir_colors.5, hosts.5, intro.5, termcap.5, utmp.5, intro.6, armscii-8.7, boot.7, bootparam.7, capabilities.7, cpuset.7, credentials.7, ddp.7, epoll.7, glob.7, intro.7, ip.7, ipv6.7, iso_8859-1.7, iso_8859-10.7, iso_8859-11.7, iso_8859-13.7, iso_8859-14.7, iso_8859-15.7, iso_8859-16.7, iso_8859-2.7, iso_8859-3.7, iso_8859-4.7, iso_8859-5.7, iso_8859-6.7, iso_8859-7.7, iso_8859-8.7, iso_8859-9.7, koi8-r.7, koi8-u.7, man-pages.7, man.7, math_error.7, netlink.7, numa.7, packet.7, path_resolution.7, pipe.7, pthreads.7, raw.7, rtnetlink.7, signal.7, socket.7, spufs.7, svipc.7, tcp.7, time.7, udp.7, udplite.7, unicode.7, unix.7, uri.7, utf-8.7, x25.7, intro.8: Global fix: use consistent capitalization in .SS headings
Capitalization in .SS sections across pages (and sometimes even
within a single page) is wildly inconsistent. Make it consistent.
Capitalize first word in heading, but otherwise use lower case,
except where English usage (e.g., proper nouns) or programming
language requirements (e.g., identifier names) dictate otherwise.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2013-02-24 14:08:38 +00:00
|
|
|
.SS Autobind feature
|
2010-10-10 05:47:14 +00:00
|
|
|
If a
|
Changes, clone.2, mount.2, nanosleep.2, sigaltstack.2, statfs.2, timer_settime.2, ctime.3, fmemopen.3, nl_langinfo.3, posix_memalign.3, pthread_attr_init.3, pthread_setaffinity_np.3, pthread_setschedprio.3, pthread_testcancel.3, setjmp.3, sigwait.3, tty_ioctl.4, epoll.7, posixoptions.7, unix.7: Add section number to references to functions documented in other pages
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2010-11-01 07:07:28 +00:00
|
|
|
.BR bind (2)
|
2010-10-10 05:47:14 +00:00
|
|
|
call specifies
|
|
|
|
.I addrlen
|
|
|
|
as
|
|
|
|
.IR sizeof(sa_family_t) ,
|
2014-01-01 03:17:09 +00:00
|
|
|
.\" i.e., sizeof(short)
|
2010-10-10 05:47:14 +00:00
|
|
|
or the
|
|
|
|
.BR SO_PASSCRED
|
|
|
|
socket option was specified for a socket that was
|
|
|
|
not explicitly bound to an address,
|
|
|
|
then the socket is autobound to an abstract address.
|
|
|
|
The address consists of a null byte
|
|
|
|
followed by 5 bytes in the character set
|
|
|
|
.IR [0-9a-f] .
|
2012-04-15 21:05:00 +00:00
|
|
|
Thus, there is a limit of 2^20 autobind addresses.
|
|
|
|
(From Linux 2.1.15, when the autobind feature was added,
|
|
|
|
8 bytes were used, and the limit was thus 2^32 autobind addresses.
|
|
|
|
The change to 5 bytes came in Linux 2.3.15.)
|
2008-12-01 15:18:35 +00:00
|
|
|
.SS Sockets API
|
2008-08-08 16:41:48 +00:00
|
|
|
The following paragraphs describe domain-specific details and
|
intro.1, time.1, accept.2, bind.2, connect.2, execve.2, flock.2, getdents.2, getpriority.2, getuid.2, intro.2, ioctl.2, mincore.2, mknod.2, personality.2, ptrace.2, read.2, recv.2, select_tut.2, send.2, sendfile.2, shmctl.2, sigaction.2, signal.2, stat.2, times.2, truncate.2, umask.2, wait.2, MB_CUR_MAX.3, MB_LEN_MAX.3, argz_add.3, btowc.3, clearenv.3, clock.3, cmsg.3, end.3, endian.3, errno.3, exit.3, fgetwc.3, fgetws.3, fopen.3, fputwc.3, fputws.3, fseek.3, fwide.3, getfsent.3, getgrnam.3, gethostid.3, getipnodebyname.3, getmntent.3, getpwnam.3, getwchar.3, grantpt.3, iconv.3, iconv_close.3, iconv_open.3, insque.3, intro.3, iswalnum.3, iswalpha.3, iswblank.3, iswcntrl.3, iswctype.3, iswdigit.3, iswgraph.3, iswlower.3, iswprint.3, iswpunct.3, iswspace.3, iswupper.3, iswxdigit.3, malloc.3, mblen.3, mbrlen.3, mbrtowc.3, mbsinit.3, mbsnrtowcs.3, mbsrtowcs.3, mbstowcs.3, mbtowc.3, mkstemp.3, mktemp.3, nl_langinfo.3, openpty.3, posix_openpt.3, printf.3, ptsname.3, putwchar.3, qecvt.3, rcmd.3, readdir.3, rexec.3, rpc.3, setnetgrent.3, shm_open.3, sigpause.3, stdin.3, stpcpy.3, strftime.3, strptime.3, syslog.3, towctrans.3, towlower.3, towupper.3, ttyslot.3, ungetwc.3, unlocked_stdio.3, wcpcpy.3, wcpncpy.3, wcrtomb.3, wcscasecmp.3, wcscat.3, wcschr.3, wcscmp.3, wcscpy.3, wcscspn.3, wcsdup.3, wcslen.3, wcsncasecmp.3, wcsncat.3, wcsncmp.3, wcsncpy.3, wcsnlen.3, wcsnrtombs.3, wcspbrk.3, wcsrchr.3, wcsrtombs.3, wcsspn.3, wcsstr.3, wcstok.3, wcstombs.3, wcswidth.3, wctob.3, wctomb.3, wctrans.3, wctype.3, wcwidth.3, wmemchr.3, wmemcmp.3, wmemcpy.3, wmemmove.3, wmemset.3, wprintf.3, console_ioctl.4, pts.4, elf.5, filesystems.5, hosts.5, proc.5, ttytype.5, boot.7, capabilities.7, credentials.7, epoll.7, glob.7, koi8-r.7, path_resolution.7, pty.7, signal.7, suffixes.7, time.7, unicode.7, unix.7, uri.7, utf-8.7: global fix: s/Unix/UNIX/
The man pages were rather inconsistent in the use of "Unix"
versus "UNIX". Let's go with the trademark usage.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2010-10-12 04:45:38 +00:00
|
|
|
unsupported features of the sockets API for UNIX domain sockets on Linux.
|
2008-08-08 16:41:48 +00:00
|
|
|
|
intro.1, time.1, accept.2, bind.2, connect.2, execve.2, flock.2, getdents.2, getpriority.2, getuid.2, intro.2, ioctl.2, mincore.2, mknod.2, personality.2, ptrace.2, read.2, recv.2, select_tut.2, send.2, sendfile.2, shmctl.2, sigaction.2, signal.2, stat.2, times.2, truncate.2, umask.2, wait.2, MB_CUR_MAX.3, MB_LEN_MAX.3, argz_add.3, btowc.3, clearenv.3, clock.3, cmsg.3, end.3, endian.3, errno.3, exit.3, fgetwc.3, fgetws.3, fopen.3, fputwc.3, fputws.3, fseek.3, fwide.3, getfsent.3, getgrnam.3, gethostid.3, getipnodebyname.3, getmntent.3, getpwnam.3, getwchar.3, grantpt.3, iconv.3, iconv_close.3, iconv_open.3, insque.3, intro.3, iswalnum.3, iswalpha.3, iswblank.3, iswcntrl.3, iswctype.3, iswdigit.3, iswgraph.3, iswlower.3, iswprint.3, iswpunct.3, iswspace.3, iswupper.3, iswxdigit.3, malloc.3, mblen.3, mbrlen.3, mbrtowc.3, mbsinit.3, mbsnrtowcs.3, mbsrtowcs.3, mbstowcs.3, mbtowc.3, mkstemp.3, mktemp.3, nl_langinfo.3, openpty.3, posix_openpt.3, printf.3, ptsname.3, putwchar.3, qecvt.3, rcmd.3, readdir.3, rexec.3, rpc.3, setnetgrent.3, shm_open.3, sigpause.3, stdin.3, stpcpy.3, strftime.3, strptime.3, syslog.3, towctrans.3, towlower.3, towupper.3, ttyslot.3, ungetwc.3, unlocked_stdio.3, wcpcpy.3, wcpncpy.3, wcrtomb.3, wcscasecmp.3, wcscat.3, wcschr.3, wcscmp.3, wcscpy.3, wcscspn.3, wcsdup.3, wcslen.3, wcsncasecmp.3, wcsncat.3, wcsncmp.3, wcsncpy.3, wcsnlen.3, wcsnrtombs.3, wcspbrk.3, wcsrchr.3, wcsrtombs.3, wcsspn.3, wcsstr.3, wcstok.3, wcstombs.3, wcswidth.3, wctob.3, wctomb.3, wctrans.3, wctype.3, wcwidth.3, wmemchr.3, wmemcmp.3, wmemcpy.3, wmemmove.3, wmemset.3, wprintf.3, console_ioctl.4, pts.4, elf.5, filesystems.5, hosts.5, proc.5, ttytype.5, boot.7, capabilities.7, credentials.7, epoll.7, glob.7, koi8-r.7, path_resolution.7, pty.7, signal.7, suffixes.7, time.7, unicode.7, unix.7, uri.7, utf-8.7: global fix: s/Unix/UNIX/
The man pages were rather inconsistent in the use of "Unix"
versus "UNIX". Let's go with the trademark usage.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2010-10-12 04:45:38 +00:00
|
|
|
UNIX domain sockets do not support the transmission of
|
2008-08-08 16:41:48 +00:00
|
|
|
out-of-band data (the
|
|
|
|
.B MSG_OOB
|
|
|
|
flag for
|
|
|
|
.BR send (2)
|
|
|
|
and
|
|
|
|
.BR recv (2)).
|
|
|
|
|
|
|
|
The
|
|
|
|
.BR send (2)
|
|
|
|
.B MSG_MORE
|
intro.1, time.1, accept.2, bind.2, connect.2, execve.2, flock.2, getdents.2, getpriority.2, getuid.2, intro.2, ioctl.2, mincore.2, mknod.2, personality.2, ptrace.2, read.2, recv.2, select_tut.2, send.2, sendfile.2, shmctl.2, sigaction.2, signal.2, stat.2, times.2, truncate.2, umask.2, wait.2, MB_CUR_MAX.3, MB_LEN_MAX.3, argz_add.3, btowc.3, clearenv.3, clock.3, cmsg.3, end.3, endian.3, errno.3, exit.3, fgetwc.3, fgetws.3, fopen.3, fputwc.3, fputws.3, fseek.3, fwide.3, getfsent.3, getgrnam.3, gethostid.3, getipnodebyname.3, getmntent.3, getpwnam.3, getwchar.3, grantpt.3, iconv.3, iconv_close.3, iconv_open.3, insque.3, intro.3, iswalnum.3, iswalpha.3, iswblank.3, iswcntrl.3, iswctype.3, iswdigit.3, iswgraph.3, iswlower.3, iswprint.3, iswpunct.3, iswspace.3, iswupper.3, iswxdigit.3, malloc.3, mblen.3, mbrlen.3, mbrtowc.3, mbsinit.3, mbsnrtowcs.3, mbsrtowcs.3, mbstowcs.3, mbtowc.3, mkstemp.3, mktemp.3, nl_langinfo.3, openpty.3, posix_openpt.3, printf.3, ptsname.3, putwchar.3, qecvt.3, rcmd.3, readdir.3, rexec.3, rpc.3, setnetgrent.3, shm_open.3, sigpause.3, stdin.3, stpcpy.3, strftime.3, strptime.3, syslog.3, towctrans.3, towlower.3, towupper.3, ttyslot.3, ungetwc.3, unlocked_stdio.3, wcpcpy.3, wcpncpy.3, wcrtomb.3, wcscasecmp.3, wcscat.3, wcschr.3, wcscmp.3, wcscpy.3, wcscspn.3, wcsdup.3, wcslen.3, wcsncasecmp.3, wcsncat.3, wcsncmp.3, wcsncpy.3, wcsnlen.3, wcsnrtombs.3, wcspbrk.3, wcsrchr.3, wcsrtombs.3, wcsspn.3, wcsstr.3, wcstok.3, wcstombs.3, wcswidth.3, wctob.3, wctomb.3, wctrans.3, wctype.3, wcwidth.3, wmemchr.3, wmemcmp.3, wmemcpy.3, wmemmove.3, wmemset.3, wprintf.3, console_ioctl.4, pts.4, elf.5, filesystems.5, hosts.5, proc.5, ttytype.5, boot.7, capabilities.7, credentials.7, epoll.7, glob.7, koi8-r.7, path_resolution.7, pty.7, signal.7, suffixes.7, time.7, unicode.7, unix.7, uri.7, utf-8.7: global fix: s/Unix/UNIX/
The man pages were rather inconsistent in the use of "Unix"
versus "UNIX". Let's go with the trademark usage.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2010-10-12 04:45:38 +00:00
|
|
|
flag is not supported by UNIX domain sockets.
|
2008-08-08 16:41:48 +00:00
|
|
|
|
2008-12-01 16:25:44 +00:00
|
|
|
The use of
|
|
|
|
.B MSG_TRUNC
|
|
|
|
in the
|
|
|
|
.I flags
|
|
|
|
argument of
|
|
|
|
.BR recv (2)
|
intro.1, time.1, accept.2, bind.2, connect.2, execve.2, flock.2, getdents.2, getpriority.2, getuid.2, intro.2, ioctl.2, mincore.2, mknod.2, personality.2, ptrace.2, read.2, recv.2, select_tut.2, send.2, sendfile.2, shmctl.2, sigaction.2, signal.2, stat.2, times.2, truncate.2, umask.2, wait.2, MB_CUR_MAX.3, MB_LEN_MAX.3, argz_add.3, btowc.3, clearenv.3, clock.3, cmsg.3, end.3, endian.3, errno.3, exit.3, fgetwc.3, fgetws.3, fopen.3, fputwc.3, fputws.3, fseek.3, fwide.3, getfsent.3, getgrnam.3, gethostid.3, getipnodebyname.3, getmntent.3, getpwnam.3, getwchar.3, grantpt.3, iconv.3, iconv_close.3, iconv_open.3, insque.3, intro.3, iswalnum.3, iswalpha.3, iswblank.3, iswcntrl.3, iswctype.3, iswdigit.3, iswgraph.3, iswlower.3, iswprint.3, iswpunct.3, iswspace.3, iswupper.3, iswxdigit.3, malloc.3, mblen.3, mbrlen.3, mbrtowc.3, mbsinit.3, mbsnrtowcs.3, mbsrtowcs.3, mbstowcs.3, mbtowc.3, mkstemp.3, mktemp.3, nl_langinfo.3, openpty.3, posix_openpt.3, printf.3, ptsname.3, putwchar.3, qecvt.3, rcmd.3, readdir.3, rexec.3, rpc.3, setnetgrent.3, shm_open.3, sigpause.3, stdin.3, stpcpy.3, strftime.3, strptime.3, syslog.3, towctrans.3, towlower.3, towupper.3, ttyslot.3, ungetwc.3, unlocked_stdio.3, wcpcpy.3, wcpncpy.3, wcrtomb.3, wcscasecmp.3, wcscat.3, wcschr.3, wcscmp.3, wcscpy.3, wcscspn.3, wcsdup.3, wcslen.3, wcsncasecmp.3, wcsncat.3, wcsncmp.3, wcsncpy.3, wcsnlen.3, wcsnrtombs.3, wcspbrk.3, wcsrchr.3, wcsrtombs.3, wcsspn.3, wcsstr.3, wcstok.3, wcstombs.3, wcswidth.3, wctob.3, wctomb.3, wctrans.3, wctype.3, wcwidth.3, wmemchr.3, wmemcmp.3, wmemcpy.3, wmemmove.3, wmemset.3, wprintf.3, console_ioctl.4, pts.4, elf.5, filesystems.5, hosts.5, proc.5, ttytype.5, boot.7, capabilities.7, credentials.7, epoll.7, glob.7, koi8-r.7, path_resolution.7, pty.7, signal.7, suffixes.7, time.7, unicode.7, unix.7, uri.7, utf-8.7: global fix: s/Unix/UNIX/
The man pages were rather inconsistent in the use of "Unix"
versus "UNIX". Let's go with the trademark usage.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2010-10-12 04:45:38 +00:00
|
|
|
is not supported by UNIX domain sockets.
|
2008-12-01 16:25:44 +00:00
|
|
|
|
2008-08-08 16:41:48 +00:00
|
|
|
The
|
|
|
|
.B SO_SNDBUF
|
intro.1, time.1, accept.2, bind.2, connect.2, execve.2, flock.2, getdents.2, getpriority.2, getuid.2, intro.2, ioctl.2, mincore.2, mknod.2, personality.2, ptrace.2, read.2, recv.2, select_tut.2, send.2, sendfile.2, shmctl.2, sigaction.2, signal.2, stat.2, times.2, truncate.2, umask.2, wait.2, MB_CUR_MAX.3, MB_LEN_MAX.3, argz_add.3, btowc.3, clearenv.3, clock.3, cmsg.3, end.3, endian.3, errno.3, exit.3, fgetwc.3, fgetws.3, fopen.3, fputwc.3, fputws.3, fseek.3, fwide.3, getfsent.3, getgrnam.3, gethostid.3, getipnodebyname.3, getmntent.3, getpwnam.3, getwchar.3, grantpt.3, iconv.3, iconv_close.3, iconv_open.3, insque.3, intro.3, iswalnum.3, iswalpha.3, iswblank.3, iswcntrl.3, iswctype.3, iswdigit.3, iswgraph.3, iswlower.3, iswprint.3, iswpunct.3, iswspace.3, iswupper.3, iswxdigit.3, malloc.3, mblen.3, mbrlen.3, mbrtowc.3, mbsinit.3, mbsnrtowcs.3, mbsrtowcs.3, mbstowcs.3, mbtowc.3, mkstemp.3, mktemp.3, nl_langinfo.3, openpty.3, posix_openpt.3, printf.3, ptsname.3, putwchar.3, qecvt.3, rcmd.3, readdir.3, rexec.3, rpc.3, setnetgrent.3, shm_open.3, sigpause.3, stdin.3, stpcpy.3, strftime.3, strptime.3, syslog.3, towctrans.3, towlower.3, towupper.3, ttyslot.3, ungetwc.3, unlocked_stdio.3, wcpcpy.3, wcpncpy.3, wcrtomb.3, wcscasecmp.3, wcscat.3, wcschr.3, wcscmp.3, wcscpy.3, wcscspn.3, wcsdup.3, wcslen.3, wcsncasecmp.3, wcsncat.3, wcsncmp.3, wcsncpy.3, wcsnlen.3, wcsnrtombs.3, wcspbrk.3, wcsrchr.3, wcsrtombs.3, wcsspn.3, wcsstr.3, wcstok.3, wcstombs.3, wcswidth.3, wctob.3, wctomb.3, wctrans.3, wctype.3, wcwidth.3, wmemchr.3, wmemcmp.3, wmemcpy.3, wmemmove.3, wmemset.3, wprintf.3, console_ioctl.4, pts.4, elf.5, filesystems.5, hosts.5, proc.5, ttytype.5, boot.7, capabilities.7, credentials.7, epoll.7, glob.7, koi8-r.7, path_resolution.7, pty.7, signal.7, suffixes.7, time.7, unicode.7, unix.7, uri.7, utf-8.7: global fix: s/Unix/UNIX/
The man pages were rather inconsistent in the use of "Unix"
versus "UNIX". Let's go with the trademark usage.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2010-10-12 04:45:38 +00:00
|
|
|
socket option does have an effect for UNIX domain sockets, but the
|
2008-08-08 16:41:48 +00:00
|
|
|
.B SO_RCVBUF
|
|
|
|
option does not.
|
|
|
|
For datagram sockets, the
|
|
|
|
.B SO_SNDBUF
|
|
|
|
value imposes an upper limit on the size of outgoing datagrams.
|
|
|
|
This limit is calculated as the doubled (see
|
|
|
|
.BR socket (7))
|
|
|
|
option value less 32 bytes used for overhead.
|
intro.1, time.1, _syscall.2, accept.2, brk.2, capget.2, faccessat.2, futimesat.2, gethostname.2, intro.2, ioprio_set.2, kill.2, madvise.2, mlock.2, mount.2, msgget.2, perf_event_open.2, poll.2, readv.2, sched_rr_get_interval.2, sched_setscheduler.2, select.2, select_tut.2, shmget.2, stat.2, timer_create.2, ustat.2, vfork.2, wait.2, alloca.3, atexit.3, catopen.3, crypt.3, dbopen.3, fenv.3, fopen.3, getaddrinfo_a.3, gethostbyname.3, getutent.3, intro.3, login.3, mallopt.3, queue.3, regex.3, sigpause.3, sigsetops.3, stdio.3, strftime.3, strptime.3, sysconf.3, ttyslot.3, undocumented.3, cciss.4, console_codes.4, hpsa.4, initrd.4, intro.4, rtc.4, st.4, tty_ioctl.4, wavelan.4, acct.5, charmap.5, dir_colors.5, hosts.5, intro.5, termcap.5, utmp.5, intro.6, armscii-8.7, boot.7, bootparam.7, capabilities.7, cpuset.7, credentials.7, ddp.7, epoll.7, glob.7, intro.7, ip.7, ipv6.7, iso_8859-1.7, iso_8859-10.7, iso_8859-11.7, iso_8859-13.7, iso_8859-14.7, iso_8859-15.7, iso_8859-16.7, iso_8859-2.7, iso_8859-3.7, iso_8859-4.7, iso_8859-5.7, iso_8859-6.7, iso_8859-7.7, iso_8859-8.7, iso_8859-9.7, koi8-r.7, koi8-u.7, man-pages.7, man.7, math_error.7, netlink.7, numa.7, packet.7, path_resolution.7, pipe.7, pthreads.7, raw.7, rtnetlink.7, signal.7, socket.7, spufs.7, svipc.7, tcp.7, time.7, udp.7, udplite.7, unicode.7, unix.7, uri.7, utf-8.7, x25.7, intro.8: Global fix: use consistent capitalization in .SS headings
Capitalization in .SS sections across pages (and sometimes even
within a single page) is wildly inconsistent. Make it consistent.
Capitalize first word in heading, but otherwise use lower case,
except where English usage (e.g., proper nouns) or programming
language requirements (e.g., identifier names) dictate otherwise.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2013-02-24 14:08:38 +00:00
|
|
|
.SS Ancillary messages
|
2008-08-08 16:41:48 +00:00
|
|
|
Ancillary data is sent and received using
|
|
|
|
.BR sendmsg (2)
|
|
|
|
and
|
|
|
|
.BR recvmsg (2).
|
|
|
|
For historical reasons the ancillary message types listed below
|
|
|
|
are specified with a
|
|
|
|
.B SOL_SOCKET
|
|
|
|
type even though they are
|
2008-08-08 16:47:53 +00:00
|
|
|
.B AF_UNIX
|
2008-08-08 16:41:48 +00:00
|
|
|
specific.
|
|
|
|
To send them set the
|
|
|
|
.I cmsg_level
|
|
|
|
field of the struct
|
|
|
|
.I cmsghdr
|
|
|
|
to
|
|
|
|
.B SOL_SOCKET
|
|
|
|
and the
|
|
|
|
.I cmsg_type
|
|
|
|
field to the type.
|
|
|
|
For more information see
|
|
|
|
.BR cmsg (3).
|
|
|
|
.TP
|
|
|
|
.B SCM_RIGHTS
|
|
|
|
Send or receive a set of open file descriptors from another process.
|
|
|
|
The data portion contains an integer array of the file descriptors.
|
|
|
|
The passed file descriptors behave as though they have been created with
|
|
|
|
.BR dup (2).
|
|
|
|
.TP
|
|
|
|
.B SCM_CREDENTIALS
|
intro.1, time.1, accept.2, bind.2, connect.2, execve.2, flock.2, getdents.2, getpriority.2, getuid.2, intro.2, ioctl.2, mincore.2, mknod.2, personality.2, ptrace.2, read.2, recv.2, select_tut.2, send.2, sendfile.2, shmctl.2, sigaction.2, signal.2, stat.2, times.2, truncate.2, umask.2, wait.2, MB_CUR_MAX.3, MB_LEN_MAX.3, argz_add.3, btowc.3, clearenv.3, clock.3, cmsg.3, end.3, endian.3, errno.3, exit.3, fgetwc.3, fgetws.3, fopen.3, fputwc.3, fputws.3, fseek.3, fwide.3, getfsent.3, getgrnam.3, gethostid.3, getipnodebyname.3, getmntent.3, getpwnam.3, getwchar.3, grantpt.3, iconv.3, iconv_close.3, iconv_open.3, insque.3, intro.3, iswalnum.3, iswalpha.3, iswblank.3, iswcntrl.3, iswctype.3, iswdigit.3, iswgraph.3, iswlower.3, iswprint.3, iswpunct.3, iswspace.3, iswupper.3, iswxdigit.3, malloc.3, mblen.3, mbrlen.3, mbrtowc.3, mbsinit.3, mbsnrtowcs.3, mbsrtowcs.3, mbstowcs.3, mbtowc.3, mkstemp.3, mktemp.3, nl_langinfo.3, openpty.3, posix_openpt.3, printf.3, ptsname.3, putwchar.3, qecvt.3, rcmd.3, readdir.3, rexec.3, rpc.3, setnetgrent.3, shm_open.3, sigpause.3, stdin.3, stpcpy.3, strftime.3, strptime.3, syslog.3, towctrans.3, towlower.3, towupper.3, ttyslot.3, ungetwc.3, unlocked_stdio.3, wcpcpy.3, wcpncpy.3, wcrtomb.3, wcscasecmp.3, wcscat.3, wcschr.3, wcscmp.3, wcscpy.3, wcscspn.3, wcsdup.3, wcslen.3, wcsncasecmp.3, wcsncat.3, wcsncmp.3, wcsncpy.3, wcsnlen.3, wcsnrtombs.3, wcspbrk.3, wcsrchr.3, wcsrtombs.3, wcsspn.3, wcsstr.3, wcstok.3, wcstombs.3, wcswidth.3, wctob.3, wctomb.3, wctrans.3, wctype.3, wcwidth.3, wmemchr.3, wmemcmp.3, wmemcpy.3, wmemmove.3, wmemset.3, wprintf.3, console_ioctl.4, pts.4, elf.5, filesystems.5, hosts.5, proc.5, ttytype.5, boot.7, capabilities.7, credentials.7, epoll.7, glob.7, koi8-r.7, path_resolution.7, pty.7, signal.7, suffixes.7, time.7, unicode.7, unix.7, uri.7, utf-8.7: global fix: s/Unix/UNIX/
The man pages were rather inconsistent in the use of "Unix"
versus "UNIX". Let's go with the trademark usage.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2010-10-12 04:45:38 +00:00
|
|
|
Send or receive UNIX credentials.
|
2008-08-08 16:41:48 +00:00
|
|
|
This can be used for authentication.
|
|
|
|
The credentials are passed as a
|
|
|
|
.I struct ucred
|
|
|
|
ancillary message.
|
2008-09-01 14:57:49 +00:00
|
|
|
Thus structure is defined in
|
|
|
|
.I <sys/socket.h>
|
|
|
|
as follows:
|
2008-08-08 16:41:48 +00:00
|
|
|
|
|
|
|
.in +4n
|
|
|
|
.nf
|
|
|
|
struct ucred {
|
|
|
|
pid_t pid; /* process ID of the sending process */
|
|
|
|
uid_t uid; /* user ID of the sending process */
|
|
|
|
gid_t gid; /* group ID of the sending process */
|
|
|
|
};
|
|
|
|
.fi
|
|
|
|
.in
|
|
|
|
|
2008-09-01 14:57:49 +00:00
|
|
|
Since glibc 2.8, the
|
2008-12-01 12:20:45 +00:00
|
|
|
.B _GNU_SOURCE
|
2010-09-10 04:33:31 +00:00
|
|
|
feature test macro must be defined (before including
|
|
|
|
.I any
|
|
|
|
header files) in order to obtain the definition
|
2008-09-01 14:57:49 +00:00
|
|
|
of this structure.
|
|
|
|
|
2008-08-08 16:41:48 +00:00
|
|
|
The credentials which the sender specifies are checked by the kernel.
|
|
|
|
A process with effective user ID 0 is allowed to specify values that do
|
|
|
|
not match its own.
|
|
|
|
The sender must specify its own process ID (unless it has the capability
|
|
|
|
.BR CAP_SYS_ADMIN ),
|
|
|
|
its user ID, effective user ID, or saved set-user-ID (unless it has
|
|
|
|
.BR CAP_SETUID ),
|
|
|
|
and its group ID, effective group ID, or saved set-group-ID
|
|
|
|
(unless it has
|
|
|
|
.BR CAP_SETGID ).
|
|
|
|
To receive a
|
|
|
|
.I struct ucred
|
|
|
|
message the
|
|
|
|
.B SO_PASSCRED
|
|
|
|
option must be enabled on the socket.
|
2010-09-10 04:00:39 +00:00
|
|
|
.SS Ioctls
|
|
|
|
The following
|
|
|
|
.BR ioctl (2)
|
|
|
|
calls return information in
|
|
|
|
.IR value .
|
|
|
|
The correct syntax is:
|
|
|
|
.PP
|
|
|
|
.RS
|
|
|
|
.nf
|
|
|
|
.BI int " value";
|
2011-09-08 16:20:44 +00:00
|
|
|
.IB error " = ioctl(" unix_socket ", " ioctl_type ", &" value ");"
|
2010-09-10 04:00:39 +00:00
|
|
|
.fi
|
|
|
|
.RE
|
|
|
|
.PP
|
|
|
|
.I ioctl_type
|
|
|
|
can be:
|
|
|
|
.TP
|
|
|
|
.B SIOCINQ
|
2014-10-18 15:36:00 +00:00
|
|
|
For
|
|
|
|
.B SOCK_STREAM
|
|
|
|
socket the function returns the amount of queued unread data in the receive buffer.
|
2010-09-10 04:00:39 +00:00
|
|
|
The socket must not be in LISTEN state, otherwise an error
|
|
|
|
.RB ( EINVAL )
|
|
|
|
is returned.
|
|
|
|
.B SIOCINQ
|
|
|
|
is defined in
|
|
|
|
.IR <linux/sockios.h> .
|
adjtimex.2, bind.2, cacheflush.2, clone.2, fallocate.2, fanotify_init.2, fanotify_mark.2, flock.2, futex.2, getdents.2, getpriority.2, getrlimit.2, gettid.2, gettimeofday.2, ioprio_set.2, kexec_load.2, migrate_pages.2, modify_ldt.2, mount.2, move_pages.2, mprotect.2, msgop.2, nfsservctl.2, perf_event_open.2, pread.2, ptrace.2, recvmmsg.2, rename.2, restart_syscall.2, sched_setattr.2, send.2, shmop.2, shutdown.2, sigaction.2, signalfd.2, syscalls.2, timer_create.2, timerfd_create.2, tkill.2, vmsplice.2, wait.2, aio_init.3, confstr.3, exit.3, fmemopen.3, fopen.3, getaddrinfo.3, getauxval.3, getspnam.3, isalpha.3, isatty.3, mallinfo.3, malloc.3, mallopt.3, psignal.3, pthread_attr_setinheritsched.3, qecvt.3, queue.3, rtnetlink.3, strerror.3, strftime.3, toupper.3, towlower.3, towupper.3, initrd.4, locale.5, proc.5, bootparam.7, capabilities.7, ddp.7, fanotify.7, icmp.7, inotify.7, ip.7, ipv6.7, netdevice.7, netlink.7, path_resolution.7, rtld-audit.7, rtnetlink.7, sched.7, signal.7, socket.7, svipc.7, tcp.7, unix.7, ld.so.8: srcfix: Update FIXMEs
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2014-08-21 21:47:44 +00:00
|
|
|
.\" FIXME . http://sources.redhat.com/bugzilla/show_bug.cgi?id=12002,
|
2010-09-10 04:00:39 +00:00
|
|
|
.\" filed 2010-09-10, may cause SIOCINQ to be defined in glibc headers
|
|
|
|
Alternatively,
|
|
|
|
you can use the synonymous
|
|
|
|
.BR FIONREAD ,
|
|
|
|
defined in
|
|
|
|
.IR <sys/ioctl.h> .
|
2010-09-10 04:01:31 +00:00
|
|
|
.\" SIOCOUTQ also has an effect for UNIX domain sockets, but not
|
2010-09-10 04:00:39 +00:00
|
|
|
.\" quite what userland might expect. It seems to return the number
|
|
|
|
.\" of bytes allocated for buffers containing pending output.
|
|
|
|
.\" That number is normally larger than the number of bytes of pending
|
|
|
|
.\" output. Since this info is, from userland's point of view, imprecise,
|
|
|
|
.\" and it may well change, probably best not to document this now.
|
2014-10-18 15:36:00 +00:00
|
|
|
For
|
|
|
|
.B SOCK_DGRAM
|
|
|
|
socket,
|
|
|
|
the returned value is the same as
|
|
|
|
for Internet domain datagram socket;
|
|
|
|
see
|
|
|
|
.BR udp (7).
|
2008-08-08 16:41:48 +00:00
|
|
|
.SH ERRORS
|
|
|
|
.TP
|
|
|
|
.B EADDRINUSE
|
intro.1, time.1, access.2, acct.2, alloc_hugepages.2, bind.2, chdir.2, chmod.2, chown.2, chroot.2, clone.2, close.2, execve.2, fallocate.2, fcntl.2, getdents.2, getrusage.2, getxattr.2, init_module.2, inotify_add_watch.2, ioprio_set.2, kcmp.2, link.2, listxattr.2, lseek.2, madvise.2, mkdir.2, mknod.2, mmap.2, mount.2, move_pages.2, msgctl.2, nfsservctl.2, open.2, pivot_root.2, quotactl.2, read.2, readlink.2, removexattr.2, rename.2, rmdir.2, semctl.2, setfsgid.2, setfsuid.2, setresuid.2, setuid.2, setup.2, setxattr.2, shmctl.2, splice.2, spu_create.2, stat.2, statfs.2, swapon.2, symlink.2, sync.2, sync_file_range.2, sysfs.2, truncate.2, umount.2, unlink.2, unshare.2, ustat.2, utime.2, utimensat.2, write.2, btree.3, errno.3, fexecve.3, ftw.3, futimes.3, get_nprocs_conf.3, getcwd.3, getdirentries.3, getmntent.3, glob.3, mkfifo.3, mq_open.3, readdir.3, realpath.3, recno.3, remove.3, sem_open.3, shm_open.3, statvfs.3, sysconf.3, telldir.3, tmpfile.3, cciss.4, initrd.4, pts.4, sk98lin.4, vcs.4, core.5, filesystems.5, proc.5, boot.7, bootparam.7, capabilities.7, cpuset.7, credentials.7, feature_test_macros.7, fifo.7, hier.7, inotify.7, intro.7, mq_overview.7, path_resolution.7, pipe.7, sem_overview.7, shm_overview.7, spufs.7, symlink.7, unix.7, uri.7, sync.8: Global fix: s/file system/filesystem/
Notwithstanding 24d01c530c5a3f75217543d02bf6712395e5f90c,
"filesystem" is the form used by the great majority of man pages
outside the man-pages project and in a number of other sources,
so let's go with that.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2013-08-08 08:07:57 +00:00
|
|
|
The specified local address is already in use or the filesystem socket
|
2008-08-08 16:41:48 +00:00
|
|
|
object already exists.
|
|
|
|
.TP
|
|
|
|
.B ECONNREFUSED
|
2010-11-15 05:26:41 +00:00
|
|
|
The remote address specified by
|
2008-08-08 16:41:48 +00:00
|
|
|
.BR connect (2)
|
2010-11-15 05:26:41 +00:00
|
|
|
was not a listening socket.
|
2012-04-17 10:56:21 +00:00
|
|
|
This error can also occur if the target pathname is not a socket.
|
2008-08-08 16:41:48 +00:00
|
|
|
.TP
|
|
|
|
.B ECONNRESET
|
|
|
|
Remote socket was unexpectedly closed.
|
|
|
|
.TP
|
|
|
|
.B EFAULT
|
|
|
|
User memory address was not valid.
|
|
|
|
.TP
|
|
|
|
.B EINVAL
|
|
|
|
Invalid argument passed.
|
2010-11-15 05:26:41 +00:00
|
|
|
A common cause is that the value
|
2010-11-15 05:18:31 +00:00
|
|
|
.B AF_UNIX
|
2010-11-15 05:26:41 +00:00
|
|
|
was not specified in the
|
2008-08-08 16:41:48 +00:00
|
|
|
.I sun_type
|
2010-11-15 05:26:41 +00:00
|
|
|
field of passed addresses, or the socket was in an
|
2008-08-08 16:41:48 +00:00
|
|
|
invalid state for the applied operation.
|
|
|
|
.TP
|
|
|
|
.B EISCONN
|
|
|
|
.BR connect (2)
|
|
|
|
called on an already connected socket or a target address was
|
|
|
|
specified on a connected socket.
|
|
|
|
.TP
|
2010-11-15 05:29:21 +00:00
|
|
|
.B ENOENT
|
|
|
|
The pathname in the remote address specified to
|
2011-09-08 15:32:08 +00:00
|
|
|
.BR connect (2)
|
2010-11-15 05:29:21 +00:00
|
|
|
did not exist.
|
|
|
|
.TP
|
2008-08-08 16:41:48 +00:00
|
|
|
.B ENOMEM
|
|
|
|
Out of memory.
|
|
|
|
.TP
|
|
|
|
.B ENOTCONN
|
|
|
|
Socket operation needs a target address, but the socket is not connected.
|
|
|
|
.TP
|
|
|
|
.B EOPNOTSUPP
|
|
|
|
Stream operation called on non-stream oriented socket or tried to
|
|
|
|
use the out-of-band data option.
|
|
|
|
.TP
|
|
|
|
.B EPERM
|
|
|
|
The sender passed invalid credentials in the
|
|
|
|
.IR "struct ucred" .
|
|
|
|
.TP
|
|
|
|
.B EPIPE
|
|
|
|
Remote socket was closed on a stream socket.
|
|
|
|
If enabled, a
|
|
|
|
.B SIGPIPE
|
|
|
|
is sent as well.
|
|
|
|
This can be avoided by passing the
|
|
|
|
.B MSG_NOSIGNAL
|
|
|
|
flag to
|
|
|
|
.BR sendmsg (2)
|
|
|
|
or
|
|
|
|
.BR recvmsg (2).
|
|
|
|
.TP
|
|
|
|
.B EPROTONOSUPPORT
|
2010-11-15 05:29:39 +00:00
|
|
|
Passed protocol is not
|
|
|
|
.BR AF_UNIX .
|
2008-08-08 16:41:48 +00:00
|
|
|
.TP
|
|
|
|
.B EPROTOTYPE
|
|
|
|
Remote socket does not match the local socket type
|
|
|
|
.RB ( SOCK_DGRAM
|
2010-11-15 05:36:53 +00:00
|
|
|
versus
|
2008-08-08 16:41:48 +00:00
|
|
|
.BR SOCK_STREAM )
|
|
|
|
.TP
|
|
|
|
.B ESOCKTNOSUPPORT
|
|
|
|
Unknown socket type.
|
|
|
|
.PP
|
|
|
|
Other errors can be generated by the generic socket layer or
|
intro.1, time.1, access.2, acct.2, alloc_hugepages.2, bind.2, chdir.2, chmod.2, chown.2, chroot.2, clone.2, close.2, execve.2, fallocate.2, fcntl.2, getdents.2, getrusage.2, getxattr.2, init_module.2, inotify_add_watch.2, ioprio_set.2, kcmp.2, link.2, listxattr.2, lseek.2, madvise.2, mkdir.2, mknod.2, mmap.2, mount.2, move_pages.2, msgctl.2, nfsservctl.2, open.2, pivot_root.2, quotactl.2, read.2, readlink.2, removexattr.2, rename.2, rmdir.2, semctl.2, setfsgid.2, setfsuid.2, setresuid.2, setuid.2, setup.2, setxattr.2, shmctl.2, splice.2, spu_create.2, stat.2, statfs.2, swapon.2, symlink.2, sync.2, sync_file_range.2, sysfs.2, truncate.2, umount.2, unlink.2, unshare.2, ustat.2, utime.2, utimensat.2, write.2, btree.3, errno.3, fexecve.3, ftw.3, futimes.3, get_nprocs_conf.3, getcwd.3, getdirentries.3, getmntent.3, glob.3, mkfifo.3, mq_open.3, readdir.3, realpath.3, recno.3, remove.3, sem_open.3, shm_open.3, statvfs.3, sysconf.3, telldir.3, tmpfile.3, cciss.4, initrd.4, pts.4, sk98lin.4, vcs.4, core.5, filesystems.5, proc.5, boot.7, bootparam.7, capabilities.7, cpuset.7, credentials.7, feature_test_macros.7, fifo.7, hier.7, inotify.7, intro.7, mq_overview.7, path_resolution.7, pipe.7, sem_overview.7, shm_overview.7, spufs.7, symlink.7, unix.7, uri.7, sync.8: Global fix: s/file system/filesystem/
Notwithstanding 24d01c530c5a3f75217543d02bf6712395e5f90c,
"filesystem" is the form used by the great majority of man pages
outside the man-pages project and in a number of other sources,
so let's go with that.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2013-08-08 08:07:57 +00:00
|
|
|
by the filesystem while generating a filesystem socket object.
|
2008-08-08 16:41:48 +00:00
|
|
|
See the appropriate manual pages for more information.
|
|
|
|
.SH VERSIONS
|
|
|
|
.B SCM_CREDENTIALS
|
|
|
|
and the abstract namespace were introduced with Linux 2.2 and should not
|
|
|
|
be used in portable programs.
|
|
|
|
(Some BSD-derived systems also support credential passing,
|
|
|
|
but the implementation details differ.)
|
|
|
|
.SH NOTES
|
|
|
|
In the Linux implementation, sockets which are visible in the
|
intro.1, time.1, access.2, acct.2, alloc_hugepages.2, bind.2, chdir.2, chmod.2, chown.2, chroot.2, clone.2, close.2, execve.2, fallocate.2, fcntl.2, getdents.2, getrusage.2, getxattr.2, init_module.2, inotify_add_watch.2, ioprio_set.2, kcmp.2, link.2, listxattr.2, lseek.2, madvise.2, mkdir.2, mknod.2, mmap.2, mount.2, move_pages.2, msgctl.2, nfsservctl.2, open.2, pivot_root.2, quotactl.2, read.2, readlink.2, removexattr.2, rename.2, rmdir.2, semctl.2, setfsgid.2, setfsuid.2, setresuid.2, setuid.2, setup.2, setxattr.2, shmctl.2, splice.2, spu_create.2, stat.2, statfs.2, swapon.2, symlink.2, sync.2, sync_file_range.2, sysfs.2, truncate.2, umount.2, unlink.2, unshare.2, ustat.2, utime.2, utimensat.2, write.2, btree.3, errno.3, fexecve.3, ftw.3, futimes.3, get_nprocs_conf.3, getcwd.3, getdirentries.3, getmntent.3, glob.3, mkfifo.3, mq_open.3, readdir.3, realpath.3, recno.3, remove.3, sem_open.3, shm_open.3, statvfs.3, sysconf.3, telldir.3, tmpfile.3, cciss.4, initrd.4, pts.4, sk98lin.4, vcs.4, core.5, filesystems.5, proc.5, boot.7, bootparam.7, capabilities.7, cpuset.7, credentials.7, feature_test_macros.7, fifo.7, hier.7, inotify.7, intro.7, mq_overview.7, path_resolution.7, pipe.7, sem_overview.7, shm_overview.7, spufs.7, symlink.7, unix.7, uri.7, sync.8: Global fix: s/file system/filesystem/
Notwithstanding 24d01c530c5a3f75217543d02bf6712395e5f90c,
"filesystem" is the form used by the great majority of man pages
outside the man-pages project and in a number of other sources,
so let's go with that.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2013-08-08 08:07:57 +00:00
|
|
|
filesystem honor the permissions of the directory they are in.
|
2012-04-17 10:56:21 +00:00
|
|
|
Their owner, group, and permissions can be changed.
|
2008-08-08 16:41:48 +00:00
|
|
|
Creation of a new socket will fail if the process does not have write and
|
|
|
|
search (execute) permission on the directory the socket is created in.
|
|
|
|
Connecting to the socket object requires read/write permission.
|
|
|
|
This behavior differs from many BSD-derived systems which
|
2010-10-12 04:48:33 +00:00
|
|
|
ignore permissions for UNIX domain sockets.
|
2008-08-08 16:41:48 +00:00
|
|
|
Portable programs should not rely on
|
|
|
|
this feature for security.
|
|
|
|
|
|
|
|
Binding to a socket with a filename creates a socket
|
intro.1, time.1, access.2, acct.2, alloc_hugepages.2, bind.2, chdir.2, chmod.2, chown.2, chroot.2, clone.2, close.2, execve.2, fallocate.2, fcntl.2, getdents.2, getrusage.2, getxattr.2, init_module.2, inotify_add_watch.2, ioprio_set.2, kcmp.2, link.2, listxattr.2, lseek.2, madvise.2, mkdir.2, mknod.2, mmap.2, mount.2, move_pages.2, msgctl.2, nfsservctl.2, open.2, pivot_root.2, quotactl.2, read.2, readlink.2, removexattr.2, rename.2, rmdir.2, semctl.2, setfsgid.2, setfsuid.2, setresuid.2, setuid.2, setup.2, setxattr.2, shmctl.2, splice.2, spu_create.2, stat.2, statfs.2, swapon.2, symlink.2, sync.2, sync_file_range.2, sysfs.2, truncate.2, umount.2, unlink.2, unshare.2, ustat.2, utime.2, utimensat.2, write.2, btree.3, errno.3, fexecve.3, ftw.3, futimes.3, get_nprocs_conf.3, getcwd.3, getdirentries.3, getmntent.3, glob.3, mkfifo.3, mq_open.3, readdir.3, realpath.3, recno.3, remove.3, sem_open.3, shm_open.3, statvfs.3, sysconf.3, telldir.3, tmpfile.3, cciss.4, initrd.4, pts.4, sk98lin.4, vcs.4, core.5, filesystems.5, proc.5, boot.7, bootparam.7, capabilities.7, cpuset.7, credentials.7, feature_test_macros.7, fifo.7, hier.7, inotify.7, intro.7, mq_overview.7, path_resolution.7, pipe.7, sem_overview.7, shm_overview.7, spufs.7, symlink.7, unix.7, uri.7, sync.8: Global fix: s/file system/filesystem/
Notwithstanding 24d01c530c5a3f75217543d02bf6712395e5f90c,
"filesystem" is the form used by the great majority of man pages
outside the man-pages project and in a number of other sources,
so let's go with that.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2013-08-08 08:07:57 +00:00
|
|
|
in the filesystem that must be deleted by the caller when it is no
|
2008-08-08 16:41:48 +00:00
|
|
|
longer needed (using
|
|
|
|
.BR unlink (2)).
|
intro.1, time.1, accept.2, bind.2, connect.2, execve.2, flock.2, getdents.2, getpriority.2, getuid.2, intro.2, ioctl.2, mincore.2, mknod.2, personality.2, ptrace.2, read.2, recv.2, select_tut.2, send.2, sendfile.2, shmctl.2, sigaction.2, signal.2, stat.2, times.2, truncate.2, umask.2, wait.2, MB_CUR_MAX.3, MB_LEN_MAX.3, argz_add.3, btowc.3, clearenv.3, clock.3, cmsg.3, end.3, endian.3, errno.3, exit.3, fgetwc.3, fgetws.3, fopen.3, fputwc.3, fputws.3, fseek.3, fwide.3, getfsent.3, getgrnam.3, gethostid.3, getipnodebyname.3, getmntent.3, getpwnam.3, getwchar.3, grantpt.3, iconv.3, iconv_close.3, iconv_open.3, insque.3, intro.3, iswalnum.3, iswalpha.3, iswblank.3, iswcntrl.3, iswctype.3, iswdigit.3, iswgraph.3, iswlower.3, iswprint.3, iswpunct.3, iswspace.3, iswupper.3, iswxdigit.3, malloc.3, mblen.3, mbrlen.3, mbrtowc.3, mbsinit.3, mbsnrtowcs.3, mbsrtowcs.3, mbstowcs.3, mbtowc.3, mkstemp.3, mktemp.3, nl_langinfo.3, openpty.3, posix_openpt.3, printf.3, ptsname.3, putwchar.3, qecvt.3, rcmd.3, readdir.3, rexec.3, rpc.3, setnetgrent.3, shm_open.3, sigpause.3, stdin.3, stpcpy.3, strftime.3, strptime.3, syslog.3, towctrans.3, towlower.3, towupper.3, ttyslot.3, ungetwc.3, unlocked_stdio.3, wcpcpy.3, wcpncpy.3, wcrtomb.3, wcscasecmp.3, wcscat.3, wcschr.3, wcscmp.3, wcscpy.3, wcscspn.3, wcsdup.3, wcslen.3, wcsncasecmp.3, wcsncat.3, wcsncmp.3, wcsncpy.3, wcsnlen.3, wcsnrtombs.3, wcspbrk.3, wcsrchr.3, wcsrtombs.3, wcsspn.3, wcsstr.3, wcstok.3, wcstombs.3, wcswidth.3, wctob.3, wctomb.3, wctrans.3, wctype.3, wcwidth.3, wmemchr.3, wmemcmp.3, wmemcpy.3, wmemmove.3, wmemset.3, wprintf.3, console_ioctl.4, pts.4, elf.5, filesystems.5, hosts.5, proc.5, ttytype.5, boot.7, capabilities.7, credentials.7, epoll.7, glob.7, koi8-r.7, path_resolution.7, pty.7, signal.7, suffixes.7, time.7, unicode.7, unix.7, uri.7, utf-8.7: global fix: s/Unix/UNIX/
The man pages were rather inconsistent in the use of "Unix"
versus "UNIX". Let's go with the trademark usage.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2010-10-12 04:45:38 +00:00
|
|
|
The usual UNIX close-behind semantics apply; the socket can be unlinked
|
intro.1, time.1, access.2, acct.2, alloc_hugepages.2, bind.2, chdir.2, chmod.2, chown.2, chroot.2, clone.2, close.2, execve.2, fallocate.2, fcntl.2, getdents.2, getrusage.2, getxattr.2, init_module.2, inotify_add_watch.2, ioprio_set.2, kcmp.2, link.2, listxattr.2, lseek.2, madvise.2, mkdir.2, mknod.2, mmap.2, mount.2, move_pages.2, msgctl.2, nfsservctl.2, open.2, pivot_root.2, quotactl.2, read.2, readlink.2, removexattr.2, rename.2, rmdir.2, semctl.2, setfsgid.2, setfsuid.2, setresuid.2, setuid.2, setup.2, setxattr.2, shmctl.2, splice.2, spu_create.2, stat.2, statfs.2, swapon.2, symlink.2, sync.2, sync_file_range.2, sysfs.2, truncate.2, umount.2, unlink.2, unshare.2, ustat.2, utime.2, utimensat.2, write.2, btree.3, errno.3, fexecve.3, ftw.3, futimes.3, get_nprocs_conf.3, getcwd.3, getdirentries.3, getmntent.3, glob.3, mkfifo.3, mq_open.3, readdir.3, realpath.3, recno.3, remove.3, sem_open.3, shm_open.3, statvfs.3, sysconf.3, telldir.3, tmpfile.3, cciss.4, initrd.4, pts.4, sk98lin.4, vcs.4, core.5, filesystems.5, proc.5, boot.7, bootparam.7, capabilities.7, cpuset.7, credentials.7, feature_test_macros.7, fifo.7, hier.7, inotify.7, intro.7, mq_overview.7, path_resolution.7, pipe.7, sem_overview.7, shm_overview.7, spufs.7, symlink.7, unix.7, uri.7, sync.8: Global fix: s/file system/filesystem/
Notwithstanding 24d01c530c5a3f75217543d02bf6712395e5f90c,
"filesystem" is the form used by the great majority of man pages
outside the man-pages project and in a number of other sources,
so let's go with that.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2013-08-08 08:07:57 +00:00
|
|
|
at any time and will be finally removed from the filesystem when the last
|
2008-08-08 16:41:48 +00:00
|
|
|
reference to it is closed.
|
|
|
|
|
|
|
|
To pass file descriptors or credentials over a
|
|
|
|
.BR SOCK_STREAM ,
|
|
|
|
you need
|
accept.2, access.2, acct.2, clock_nanosleep.2, mbind.2, mincore.2, remap_file_pages.2, sched_setscheduler.2, set_mempolicy.2, splice.2, stat.2, syslog.2, timer_create.2, timerfd_create.2, truncate.2, fenv.3, ferror.3, fflush.3, fgetwc.3, fgetws.3, flockfile.3, fputwc.3, fputws.3, fread.3, getopt.3, gets.3, getwchar.3, glob.3, iconv.3, longjmp.3, pow.3, printf.3, puts.3, putwchar.3, regex.3, rpc.3, scanf.3, setjmp.3, termios.3, unlocked_stdio.3, wcswidth.3, hd.4, rtc.4, st.4, core.5, dir_colors.5, elf.5, proc.5, arp.7, ascii.7, boot.7, bootparam.7, charsets.7, futex.7, ip.7, iso_8859-11.7, man-pages.7, man.7, mdoc.samples.7, path_resolution.7, pipe.7, posixoptions.7, unicode.7, unix.7, uri.7, utf-8.7, ld.so.8: s/non-/non/
The tendency in English, as prescribed in style guides like
Chicago MoS, is towards removing hyphens after prefixes
like "non-" etc.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2010-01-16 17:20:12 +00:00
|
|
|
to send or receive at least one byte of nonancillary data in the same
|
2008-08-08 16:41:48 +00:00
|
|
|
.BR sendmsg (2)
|
|
|
|
or
|
|
|
|
.BR recvmsg (2)
|
|
|
|
call.
|
|
|
|
|
intro.1, time.1, accept.2, bind.2, connect.2, execve.2, flock.2, getdents.2, getpriority.2, getuid.2, intro.2, ioctl.2, mincore.2, mknod.2, personality.2, ptrace.2, read.2, recv.2, select_tut.2, send.2, sendfile.2, shmctl.2, sigaction.2, signal.2, stat.2, times.2, truncate.2, umask.2, wait.2, MB_CUR_MAX.3, MB_LEN_MAX.3, argz_add.3, btowc.3, clearenv.3, clock.3, cmsg.3, end.3, endian.3, errno.3, exit.3, fgetwc.3, fgetws.3, fopen.3, fputwc.3, fputws.3, fseek.3, fwide.3, getfsent.3, getgrnam.3, gethostid.3, getipnodebyname.3, getmntent.3, getpwnam.3, getwchar.3, grantpt.3, iconv.3, iconv_close.3, iconv_open.3, insque.3, intro.3, iswalnum.3, iswalpha.3, iswblank.3, iswcntrl.3, iswctype.3, iswdigit.3, iswgraph.3, iswlower.3, iswprint.3, iswpunct.3, iswspace.3, iswupper.3, iswxdigit.3, malloc.3, mblen.3, mbrlen.3, mbrtowc.3, mbsinit.3, mbsnrtowcs.3, mbsrtowcs.3, mbstowcs.3, mbtowc.3, mkstemp.3, mktemp.3, nl_langinfo.3, openpty.3, posix_openpt.3, printf.3, ptsname.3, putwchar.3, qecvt.3, rcmd.3, readdir.3, rexec.3, rpc.3, setnetgrent.3, shm_open.3, sigpause.3, stdin.3, stpcpy.3, strftime.3, strptime.3, syslog.3, towctrans.3, towlower.3, towupper.3, ttyslot.3, ungetwc.3, unlocked_stdio.3, wcpcpy.3, wcpncpy.3, wcrtomb.3, wcscasecmp.3, wcscat.3, wcschr.3, wcscmp.3, wcscpy.3, wcscspn.3, wcsdup.3, wcslen.3, wcsncasecmp.3, wcsncat.3, wcsncmp.3, wcsncpy.3, wcsnlen.3, wcsnrtombs.3, wcspbrk.3, wcsrchr.3, wcsrtombs.3, wcsspn.3, wcsstr.3, wcstok.3, wcstombs.3, wcswidth.3, wctob.3, wctomb.3, wctrans.3, wctype.3, wcwidth.3, wmemchr.3, wmemcmp.3, wmemcpy.3, wmemmove.3, wmemset.3, wprintf.3, console_ioctl.4, pts.4, elf.5, filesystems.5, hosts.5, proc.5, ttytype.5, boot.7, capabilities.7, credentials.7, epoll.7, glob.7, koi8-r.7, path_resolution.7, pty.7, signal.7, suffixes.7, time.7, unicode.7, unix.7, uri.7, utf-8.7: global fix: s/Unix/UNIX/
The man pages were rather inconsistent in the use of "Unix"
versus "UNIX". Let's go with the trademark usage.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2010-10-12 04:45:38 +00:00
|
|
|
UNIX domain stream sockets do not support the notion of out-of-band data.
|
2012-04-17 10:56:21 +00:00
|
|
|
.\"
|
|
|
|
.SH BUGS
|
|
|
|
When binding a socket to an address,
|
|
|
|
Linux is one of the implementations that appends a null terminator
|
|
|
|
if none is supplied in
|
|
|
|
.IR sun_path .
|
|
|
|
In most cases this is unproblematic:
|
|
|
|
when the socket address is retrieved,
|
|
|
|
it will be one byte longer than that supplied when the socket was bound.
|
|
|
|
However, there is one case where confusing behavior can result:
|
|
|
|
if 108 non-null bytes are supplied when a socket is bound,
|
|
|
|
then the addition of the null terminator takes the length of
|
|
|
|
the pathname beyond
|
|
|
|
.IR sizeof(sun_path) .
|
|
|
|
Consequently, when retrieving the socket address
|
|
|
|
(for example, via
|
|
|
|
.BR accept (2)),
|
|
|
|
.\" The behavior on Solaris is quite similar.
|
|
|
|
if the input
|
|
|
|
.I addrlen
|
|
|
|
argument for the retrieving call is specified as
|
|
|
|
.IR "sizeof(struct sockaddr_un)" ,
|
|
|
|
then the returned address structure
|
|
|
|
.I won't
|
|
|
|
have a null terminator in
|
|
|
|
.IR sun_path .
|
|
|
|
|
|
|
|
In addition, some implementations
|
|
|
|
.\" i.e., traditional BSD
|
|
|
|
don't require a null terminator when binding a socket (the
|
|
|
|
.I addrlen
|
|
|
|
argument is used to determine the length of
|
|
|
|
.IR sun_path )
|
|
|
|
and when the socket address is retrieved on these implementations,
|
|
|
|
there is no null terminator in
|
|
|
|
.IR sun_path .
|
|
|
|
|
2014-10-15 09:17:46 +00:00
|
|
|
Applications that retrieve socket addresses can (portably) code
|
2012-04-17 10:56:21 +00:00
|
|
|
to handle the possibility that there is no null terminator in
|
|
|
|
.IR sun_path
|
|
|
|
by respecting the fact that the number of valid bytes in the pathname is:
|
|
|
|
|
|
|
|
strnlen(addr.sun_path, addrlen \- offsetof(sockaddr_un, sun_path))
|
|
|
|
.\" The following patch to amend kernel behavior was rejected:
|
|
|
|
.\" http://thread.gmane.org/gmane.linux.kernel.api/2437
|
|
|
|
.\" Subject: [patch] Fix handling of overlength pathname in AF_UNIX sun_path
|
|
|
|
.\" 2012-04-17
|
|
|
|
.\" And there was a related discussion in the Austin list:
|
|
|
|
.\" http://thread.gmane.org/gmane.comp.standards.posix.austin.general/5735
|
|
|
|
.\" Subject: Having a sun_path with no null terminator
|
|
|
|
.\" 2012-04-18
|
|
|
|
.\"
|
|
|
|
.\" FIXME . Track http://austingroupbugs.net/view.php?id=561
|
|
|
|
|
|
|
|
Alternatively, an application can retrieve
|
|
|
|
the socket address by allocating a buffer of size
|
|
|
|
.I "sizeof(struct sockaddr_un)+1"
|
|
|
|
that is zeroed out before the retrieval.
|
|
|
|
The retrieving call can specify
|
|
|
|
.I addrlen
|
|
|
|
as
|
|
|
|
.IR "sizeof(struct sockaddr_un)" ,
|
|
|
|
and the extra zero byte ensures that there will be
|
|
|
|
a null terminator for the string returned in
|
|
|
|
.IR sun_path :
|
|
|
|
|
|
|
|
.nf
|
|
|
|
.in +3
|
|
|
|
void *addrp;
|
|
|
|
|
|
|
|
addrlen = sizeof(struct sockaddr_un);
|
|
|
|
addrp = malloc(addrlen + 1);
|
|
|
|
if (addrp == NULL)
|
|
|
|
/* Handle error */ ;
|
|
|
|
memset(addrp, 0, addrlen + 1);
|
|
|
|
|
2014-11-09 20:15:56 +00:00
|
|
|
if (getsockname(sfd, (struct sockaddr *) addrp, &addrlen)) == \-1)
|
2012-04-17 10:56:21 +00:00
|
|
|
/* handle error */ ;
|
|
|
|
|
|
|
|
printf("sun_path = %s\\n", ((struct sockaddr_un *) addrp)\->sun_path);
|
|
|
|
.in
|
|
|
|
.fi
|
|
|
|
|
|
|
|
This sort of messiness can be avoided if it is guaranteed
|
|
|
|
that the applications that
|
|
|
|
.I create
|
|
|
|
pathname sockets follow the rules outlined above under
|
|
|
|
.IR "Pathname sockets" .
|
2008-08-08 16:41:48 +00:00
|
|
|
.SH EXAMPLE
|
2016-01-08 19:47:20 +00:00
|
|
|
The following code demonstrates the use of sequenced-packet
|
|
|
|
sockets for local interprocess communication.
|
2016-01-08 19:40:30 +00:00
|
|
|
It consists of two programs.
|
2016-01-06 22:57:32 +00:00
|
|
|
The server program waits for a connection from the client program.
|
2016-01-08 19:47:20 +00:00
|
|
|
The client sends each of its command-line arguments in separate messages.
|
|
|
|
The server treats the incoming messages as integers and adds them up.
|
2016-01-08 19:40:30 +00:00
|
|
|
The client sends the command string "END".
|
2016-01-08 19:47:20 +00:00
|
|
|
The server sends back a message containing the sum of the client's integers.
|
|
|
|
The client prints the sum and exits.
|
2016-01-06 22:57:32 +00:00
|
|
|
The server waits for the next client to connect.
|
2016-01-08 19:47:20 +00:00
|
|
|
To stop the server, the client is called with the command-line argument "DOWN".
|
2016-01-06 22:57:32 +00:00
|
|
|
.PP
|
|
|
|
The following output was recorded while running the server in the background
|
2016-01-08 19:47:20 +00:00
|
|
|
and repeatedly executing the client.
|
|
|
|
Execution of the server program ends when it receives the "DOWN" command.
|
2016-01-06 22:57:32 +00:00
|
|
|
.SS Example output
|
|
|
|
.in +4n
|
|
|
|
.nf
|
2016-01-08 19:40:30 +00:00
|
|
|
$ \fB./server &\fP
|
2016-01-06 22:57:32 +00:00
|
|
|
[1] 25887
|
2016-01-08 19:40:30 +00:00
|
|
|
$ \fB./client 3 4\fP
|
2016-01-06 22:57:32 +00:00
|
|
|
Result = 7
|
2016-01-08 19:40:30 +00:00
|
|
|
$ \fB./client 11 \-5\fP
|
2016-01-06 22:57:32 +00:00
|
|
|
Result = 6
|
2016-01-08 19:40:30 +00:00
|
|
|
$ \fB./client DOWN\fP
|
2016-01-06 22:57:32 +00:00
|
|
|
Result = 0
|
|
|
|
[1]+ Done ./server
|
|
|
|
$
|
|
|
|
.fi
|
|
|
|
.in
|
|
|
|
.SS Program source
|
|
|
|
.nf
|
|
|
|
/*
|
|
|
|
* File connection.h
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define SOCKET_NAME "/tmp/9Lq7BNBnBycd6nxy.socket"
|
|
|
|
#define BUFFER_SIZE 12
|
|
|
|
|
|
|
|
/*
|
|
|
|
* File server.c
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <sys/socket.h>
|
|
|
|
#include <sys/un.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include "connection.h"
|
|
|
|
|
|
|
|
int
|
|
|
|
main(int argc, char *argv[])
|
|
|
|
{
|
|
|
|
struct sockaddr_un name;
|
|
|
|
int down_flag = 0;
|
|
|
|
int ret;
|
|
|
|
int connection_socket;
|
|
|
|
int data_socket;
|
|
|
|
int result;
|
|
|
|
char buffer[BUFFER_SIZE];
|
|
|
|
|
|
|
|
/*
|
2016-01-08 19:40:30 +00:00
|
|
|
* In case the program exited inadvertently on the last run,
|
2016-01-06 22:57:32 +00:00
|
|
|
* remove the socket.
|
|
|
|
*/
|
|
|
|
|
|
|
|
unlink(SOCKET_NAME);
|
|
|
|
|
|
|
|
/* Create local socket. */
|
|
|
|
|
|
|
|
connection_socket = socket(AF_UNIX, SOCK_SEQPACKET, 0);
|
|
|
|
if (connection_socket == \-1) {
|
|
|
|
perror("socket");
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2016-01-08 19:40:30 +00:00
|
|
|
* For portability clear the whole structure, since some
|
|
|
|
* implementations have additional (nonstandard) fields in
|
|
|
|
* the structure.
|
2016-01-06 22:57:32 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
memset(&name, 0, sizeof(struct sockaddr_un));
|
|
|
|
|
|
|
|
/* Bind socket to socket name. */
|
|
|
|
|
|
|
|
name.sun_family = AF_UNIX;
|
|
|
|
strncpy(name.sun_path, SOCKET_NAME, sizeof(name.sun_path) \- 1);
|
|
|
|
|
|
|
|
ret = bind(connection_socket, (const struct sockaddr *) &name,
|
|
|
|
sizeof(struct sockaddr_un));
|
|
|
|
if (ret == \-1) {
|
|
|
|
perror("bind");
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2016-01-08 19:40:30 +00:00
|
|
|
* Prepare for accepting connections. The backlog size is set
|
|
|
|
* to 20. So while one request is being processed other requests
|
|
|
|
* can be waiting.
|
2016-01-06 22:57:32 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
ret = listen(connection_socket, 20);
|
|
|
|
if (ret == \-1) {
|
|
|
|
perror("listen");
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* This is the main loop for handling connections. */
|
|
|
|
|
|
|
|
for (;;) {
|
|
|
|
|
|
|
|
/* Wait for incoming connection. */
|
|
|
|
|
|
|
|
data_socket = accept(connection_socket, NULL, NULL);
|
|
|
|
if (ret == \-1) {
|
|
|
|
perror("accept");
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
}
|
|
|
|
|
|
|
|
result = 0;
|
|
|
|
for(;;) {
|
|
|
|
|
|
|
|
/* Wait for next data packet. */
|
|
|
|
|
|
|
|
ret = read(data_socket, buffer, BUFFER_SIZE);
|
|
|
|
if (ret == \-1) {
|
2016-01-08 19:40:30 +00:00
|
|
|
perror("read");
|
2016-01-06 22:57:32 +00:00
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Ensure buffer is 0\-terminated. */
|
|
|
|
|
|
|
|
buffer[BUFFER_SIZE \- 1] = 0;
|
|
|
|
|
|
|
|
/* Handle commands. */
|
|
|
|
|
|
|
|
if (!strncmp(buffer, "DOWN", BUFFER_SIZE)) {
|
|
|
|
down_flag = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!strncmp(buffer, "END", BUFFER_SIZE)) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Add received summand. */
|
|
|
|
|
|
|
|
result += atoi(buffer);
|
|
|
|
}
|
2011-09-15 00:41:59 +00:00
|
|
|
|
2016-01-06 22:57:32 +00:00
|
|
|
/* Send result. */
|
|
|
|
|
|
|
|
sprintf(buffer, "%d", result);
|
|
|
|
ret = write(data_socket, buffer, BUFFER_SIZE);
|
|
|
|
|
|
|
|
if (ret == \-1) {
|
2016-01-08 19:40:30 +00:00
|
|
|
perror("write");
|
2016-01-06 22:57:32 +00:00
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Close socket. */
|
|
|
|
|
|
|
|
close(data_socket);
|
|
|
|
|
|
|
|
/* Quit on DOWN command. */
|
|
|
|
|
|
|
|
if (down_flag) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
close(connection_socket);
|
|
|
|
|
|
|
|
/* Unlink the socket. */
|
|
|
|
|
|
|
|
unlink(SOCKET_NAME);
|
|
|
|
|
|
|
|
exit(EXIT_SUCCESS);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* File client.c
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <errno.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <sys/socket.h>
|
|
|
|
#include <sys/un.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include "connection.h"
|
|
|
|
|
|
|
|
int
|
|
|
|
main(int argc, char *argv[])
|
|
|
|
{
|
accept.2, bind.2, connect.2, getpeername.2, getsockname.2, recv.2, recvmmsg.2, select_tut.2, send.2, sendmmsg.2, getaddrinfo.3, getnameinfo.3, epoll.7, unix.7: Use consistent argument/variable names for socket addresses and lengths
As noted by Carlos, there's quite a bit of inconsistency across
pages. Use 'addr' and 'addrlen' consistently in variables and
function arguments.
Cowritten-by: Carlos O'Donell <carlos@redhat.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2016-02-03 12:10:04 +00:00
|
|
|
struct sockaddr_un addr;
|
2016-01-06 22:57:32 +00:00
|
|
|
int i;
|
|
|
|
int ret;
|
|
|
|
int data_socket;
|
|
|
|
char buffer[BUFFER_SIZE];
|
|
|
|
|
|
|
|
/* Create local socket. */
|
|
|
|
|
|
|
|
data_socket = socket(AF_UNIX, SOCK_SEQPACKET, 0);
|
|
|
|
if (data_socket == \-1) {
|
|
|
|
perror("socket");
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2016-01-08 19:40:30 +00:00
|
|
|
* For portability clear the whole structure, since some
|
|
|
|
* implementations have additional (nonstandard) fields in
|
|
|
|
* the structure.
|
2016-01-06 22:57:32 +00:00
|
|
|
*/
|
|
|
|
|
accept.2, bind.2, connect.2, getpeername.2, getsockname.2, recv.2, recvmmsg.2, select_tut.2, send.2, sendmmsg.2, getaddrinfo.3, getnameinfo.3, epoll.7, unix.7: Use consistent argument/variable names for socket addresses and lengths
As noted by Carlos, there's quite a bit of inconsistency across
pages. Use 'addr' and 'addrlen' consistently in variables and
function arguments.
Cowritten-by: Carlos O'Donell <carlos@redhat.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2016-02-03 12:10:04 +00:00
|
|
|
memset(&addr, 0, sizeof(struct sockaddr_un));
|
2016-01-06 22:57:32 +00:00
|
|
|
|
accept.2, bind.2, connect.2, getpeername.2, getsockname.2, recv.2, recvmmsg.2, select_tut.2, send.2, sendmmsg.2, getaddrinfo.3, getnameinfo.3, epoll.7, unix.7: Use consistent argument/variable names for socket addresses and lengths
As noted by Carlos, there's quite a bit of inconsistency across
pages. Use 'addr' and 'addrlen' consistently in variables and
function arguments.
Cowritten-by: Carlos O'Donell <carlos@redhat.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2016-02-03 12:10:04 +00:00
|
|
|
/* Connect socket to socket address */
|
2016-01-06 22:57:32 +00:00
|
|
|
|
accept.2, bind.2, connect.2, getpeername.2, getsockname.2, recv.2, recvmmsg.2, select_tut.2, send.2, sendmmsg.2, getaddrinfo.3, getnameinfo.3, epoll.7, unix.7: Use consistent argument/variable names for socket addresses and lengths
As noted by Carlos, there's quite a bit of inconsistency across
pages. Use 'addr' and 'addrlen' consistently in variables and
function arguments.
Cowritten-by: Carlos O'Donell <carlos@redhat.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2016-02-03 12:10:04 +00:00
|
|
|
addr.sun_family = AF_UNIX;
|
|
|
|
strncpy(addr.sun_path, SOCKET_NAME, sizeof(addr.sun_path) \- 1);
|
2016-01-06 22:57:32 +00:00
|
|
|
|
accept.2, bind.2, connect.2, getpeername.2, getsockname.2, recv.2, recvmmsg.2, select_tut.2, send.2, sendmmsg.2, getaddrinfo.3, getnameinfo.3, epoll.7, unix.7: Use consistent argument/variable names for socket addresses and lengths
As noted by Carlos, there's quite a bit of inconsistency across
pages. Use 'addr' and 'addrlen' consistently in variables and
function arguments.
Cowritten-by: Carlos O'Donell <carlos@redhat.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2016-02-03 12:10:04 +00:00
|
|
|
ret = connect (data_socket, (const struct sockaddr *) &addr,
|
2016-01-06 22:57:32 +00:00
|
|
|
sizeof(struct sockaddr_un));
|
|
|
|
if (ret == \-1) {
|
|
|
|
fprintf(stderr, "The server is down.\\n");
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Send arguments. */
|
|
|
|
|
|
|
|
for (i = 1; i < argc; ++i) {
|
|
|
|
ret = write(data_socket, argv[i], strlen(argv[i]) + 1);
|
|
|
|
if (ret == \-1) {
|
2016-01-08 19:40:30 +00:00
|
|
|
perror("write");
|
2016-01-06 22:57:32 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Request result. */
|
|
|
|
|
|
|
|
strcpy (buffer, "END");
|
|
|
|
ret = write(data_socket, buffer, strlen(buffer) + 1);
|
|
|
|
if (ret == \-1) {
|
2016-01-08 19:40:30 +00:00
|
|
|
perror("write");
|
2016-01-06 22:57:32 +00:00
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Receive result. */
|
|
|
|
|
|
|
|
ret = read(data_socket, buffer, BUFFER_SIZE);
|
|
|
|
if (ret == \-1) {
|
2016-01-08 19:40:30 +00:00
|
|
|
perror("read");
|
2016-01-06 22:57:32 +00:00
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Ensure buffer is 0\-terminated. */
|
|
|
|
|
|
|
|
buffer[BUFFER_SIZE \- 1] = 0;
|
|
|
|
|
|
|
|
printf("Result = %s\\n", buffer);
|
|
|
|
|
|
|
|
/* Close socket. */
|
|
|
|
|
|
|
|
close(data_socket);
|
|
|
|
|
|
|
|
exit(EXIT_SUCCESS);
|
|
|
|
}
|
|
|
|
.fi
|
|
|
|
.PP
|
2011-09-15 00:41:59 +00:00
|
|
|
For an example of the use of
|
|
|
|
.BR SCM_RIGHTS
|
|
|
|
see
|
|
|
|
.BR cmsg (3).
|
getent.1, intro.1, time.1, _exit.2, _syscall.2, accept.2, access.2, acct.2, adjtimex.2, alarm.2, alloc_hugepages.2, arch_prctl.2, bdflush.2, bind.2, brk.2, cacheflush.2, capget.2, chdir.2, chmod.2, chown.2, chroot.2, clock_getres.2, clock_nanosleep.2, clone.2, close.2, connect.2, create_module.2, delete_module.2, dup.2, epoll_create.2, epoll_ctl.2, epoll_wait.2, eventfd.2, execve.2, exit_group.2, faccessat.2, fchmodat.2, fchownat.2, fcntl.2, flock.2, fork.2, fstatat.2, fsync.2, futex.2, futimesat.2, get_kernel_syms.2, get_robust_list.2, get_thread_area.2, getcpu.2, getdents.2, getdomainname.2, getgid.2, getgroups.2, gethostname.2, getitimer.2, getpagesize.2, getpeername.2, getpid.2, getpriority.2, getresuid.2, getrlimit.2, getrusage.2, getsid.2, getsockname.2, getsockopt.2, gettid.2, gettimeofday.2, getuid.2, getunwind.2, getxattr.2, idle.2, init_module.2, inotify_add_watch.2, inotify_init.2, inotify_rm_watch.2, intro.2, io_cancel.2, io_destroy.2, io_getevents.2, io_setup.2, io_submit.2, ioctl.2, ioctl_list.2, ioperm.2, iopl.2, ioprio_set.2, ipc.2, kcmp.2, kill.2, killpg.2, link.2, linkat.2, listen.2, listxattr.2, llseek.2, lookup_dcookie.2, lseek.2, madvise.2, migrate_pages.2, mincore.2, mkdir.2, mkdirat.2, mknod.2, mknodat.2, mlock.2, mmap.2, mmap2.2, modify_ldt.2, mount.2, move_pages.2, mprotect.2, mq_getsetattr.2, mremap.2, msgctl.2, msgget.2, msgop.2, msync.2, nanosleep.2, nfsservctl.2, nice.2, open.2, openat.2, outb.2, pause.2, pciconfig_read.2, perf_event_open.2, perfmonctl.2, personality.2, pipe.2, pivot_root.2, poll.2, posix_fadvise.2, prctl.2, pread.2, process_vm_readv.2, ptrace.2, query_module.2, quotactl.2, read.2, readahead.2, readdir.2, readlink.2, readlinkat.2, readv.2, reboot.2, recv.2, remap_file_pages.2, removexattr.2, rename.2, renameat.2, rmdir.2, rt_sigqueueinfo.2, sched_get_priority_max.2, sched_rr_get_interval.2, sched_setaffinity.2, sched_setparam.2, sched_setscheduler.2, sched_yield.2, select.2, semctl.2, semget.2, semop.2, send.2, sendfile.2, set_thread_area.2, set_tid_address.2, seteuid.2, setfsgid.2, setfsuid.2, setgid.2, setpgid.2, setresuid.2, setreuid.2, setsid.2, setuid.2, setup.2, setxattr.2, shmctl.2, shmget.2, shmop.2, shutdown.2, sigaction.2, sigaltstack.2, signal.2, signalfd.2, sigpending.2, sigprocmask.2, sigreturn.2, sigsuspend.2, sigwaitinfo.2, socket.2, socketcall.2, socketpair.2, splice.2, stat.2, statfs.2, stime.2, swapon.2, symlink.2, symlinkat.2, sync.2, sync_file_range.2, sysctl.2, sysfs.2, sysinfo.2, syslog.2, tee.2, time.2, timerfd_create.2, times.2, tkill.2, truncate.2, umask.2, umount.2, uname.2, unimplemented.2, unlink.2, unlinkat.2, uselib.2, ustat.2, utime.2, utimensat.2, vfork.2, vhangup.2, vm86.2, vmsplice.2, wait.2, wait4.2, write.2, CPU_SET.3, INFINITY.3, MB_CUR_MAX.3, MB_LEN_MAX.3, __setfpucw.3, a64l.3, abort.3, abs.3, acos.3, acosh.3, addseverity.3, adjtime.3, aio_cancel.3, aio_error.3, aio_fsync.3, aio_read.3, aio_return.3, aio_suspend.3, aio_write.3, alloca.3, argz_add.3, asin.3, asinh.3, asprintf.3, assert.3, assert_perror.3, atan.3, atan2.3, atanh.3, atexit.3, atof.3, atoi.3, backtrace.3, basename.3, bcmp.3, bcopy.3, bindresvport.3, bsd_signal.3, bsearch.3, bstring.3, btowc.3, btree.3, byteorder.3, bzero.3, cabs.3, cacos.3, cacosh.3, canonicalize_file_name.3, carg.3, casin.3, casinh.3, catan.3, catanh.3, catgets.3, catopen.3, cbrt.3, ccos.3, ccosh.3, ceil.3, cerf.3, cexp.3, cexp2.3, cfree.3, cimag.3, clearenv.3, clock.3, clock_getcpuclockid.3, clog.3, clog10.3, clog2.3, closedir.3, cmsg.3, confstr.3, conj.3, copysign.3, cos.3, cosh.3, cpow.3, cproj.3, creal.3, crypt.3, csin.3, csinh.3, csqrt.3, ctan.3, ctanh.3, ctermid.3, ctime.3, daemon.3, dbopen.3, des_crypt.3, difftime.3, dirfd.3, div.3, dl_iterate_phdr.3, dlopen.3, dprintf.3, drand48.3, drand48_r.3, dysize.3, ecvt.3, ecvt_r.3, encrypt.3, end.3, endian.3, envz_add.3, erf.3, erfc.3, err.3, errno.3, error.3, ether_aton.3, euidaccess.3, exec.3, exit.3, exp.3, exp10.3, exp2.3, expm1.3, fabs.3, fclose.3, fcloseall.3, fdim.3, fenv.3, ferror.3, fexecve.3, fflush.3, ffs.3, fgetgrent.3, fgetpwent.3, fgetwc.3, fgetws.3, finite.3, flockfile.3, floor.3, fma.3, fmax.3, fmemopen.3, fmin.3, fmod.3, fmtmsg.3, fnmatch.3, fopen.3, fpathconf.3, fpclassify.3, fpurge.3, fputwc.3, fputws.3, fread.3, frexp.3, fseek.3, fseeko.3, ftime.3, ftok.3, fts.3, ftw.3, futimes.3, fwide.3, gamma.3, gcvt.3, getaddrinfo.3, getaddrinfo_a.3, getauxval.3, getcontext.3, getcwd.3, getdate.3, getdirentries.3, getdtablesize.3, getenv.3, getfsent.3, getgrent.3, getgrent_r.3, getgrnam.3, getgrouplist.3, gethostbyname.3, gethostid.3, getipnodebyname.3, getline.3, getloadavg.3, getlogin.3, getmntent.3, getnameinfo.3, getnetent.3, getnetent_r.3, getopt.3, getpass.3, getprotoent.3, getprotoent_r.3, getpt.3, getpw.3, getpwent.3, getpwent_r.3, getpwnam.3, getrpcent.3, getrpcent_r.3, getrpcport.3, gets.3, getservent.3, getservent_r.3, getspnam.3, getttyent.3, getumask.3, getusershell.3, getutent.3, getw.3, getwchar.3, glob.3, grantpt.3, gsignal.3, hash.3, hsearch.3, hypot.3, iconv.3, iconv_close.3, iconv_open.3, ilogb.3, index.3, inet.3, inet_ntop.3, inet_pton.3, infnan.3, initgroups.3, insque.3, intro.3, isalpha.3, isatty.3, isgreater.3, iswalnum.3, iswalpha.3, iswblank.3, iswcntrl.3, iswctype.3, iswdigit.3, iswgraph.3, iswlower.3, iswprint.3, iswpunct.3, iswspace.3, iswupper.3, iswxdigit.3, j0.3, key_setsecret.3, ldexp.3, lgamma.3, lio_listio.3, localeconv.3, lockf.3, log.3, log10.3, log1p.3, log2.3, logb.3, login.3, longjmp.3, lrint.3, lround.3, lsearch.3, lseek64.3, makecontext.3, makedev.3, malloc.3, malloc_hook.3, mblen.3, mbrlen.3, mbrtowc.3, mbsinit.3, mbsnrtowcs.3, mbsrtowcs.3, mbstowcs.3, mbtowc.3, memccpy.3, memchr.3, memcmp.3, memcpy.3, memfrob.3, memmem.3, memmove.3, mempcpy.3, memset.3, mkdtemp.3, mkfifo.3, mkfifoat.3, mkstemp.3, mktemp.3, modf.3, mpool.3, mq_close.3, mq_getattr.3, mq_notify.3, mq_open.3, mq_receive.3, mq_send.3, mq_unlink.3, mtrace.3, nan.3, netlink.3, nextafter.3, nl_langinfo.3, offsetof.3, on_exit.3, opendir.3, openpty.3, perror.3, popen.3, posix_fallocate.3, posix_memalign.3, posix_openpt.3, pow.3, pow10.3, printf.3, profil.3, program_invocation_name.3, psignal.3, pthread_kill_other_threads_np.3, ptsname.3, putenv.3, putgrent.3, putpwent.3, puts.3, putwchar.3, qecvt.3, qsort.3, queue.3, raise.3, rand.3, random.3, random_r.3, rcmd.3, re_comp.3, readdir.3, realpath.3, recno.3, regex.3, remainder.3, remove.3, remquo.3, resolver.3, rewinddir.3, rexec.3, rint.3, round.3, rpc.3, rpmatch.3, rtime.3, rtnetlink.3, scalb.3, scalbln.3, scandir.3, scandirat.3, scanf.3, seekdir.3, sem_close.3, sem_destroy.3, sem_getvalue.3, sem_init.3, sem_open.3, sem_post.3, sem_unlink.3, sem_wait.3, setaliasent.3, setbuf.3, setenv.3, setjmp.3, setlocale.3, setlogmask.3, setnetgrent.3, shm_open.3, siginterrupt.3, signbit.3, significand.3, sigpause.3, sigqueue.3, sigset.3, sigsetops.3, sigvec.3, sin.3, sincos.3, sinh.3, sleep.3, sockatmark.3, sqrt.3, statvfs.3, stdarg.3, stdin.3, stdio.3, stdio_ext.3, stpcpy.3, stpncpy.3, strcasecmp.3, strcat.3, strchr.3, strcmp.3, strcoll.3, strcpy.3, strdup.3, strerror.3, strfmon.3, strfry.3, strftime.3, string.3, strlen.3, strnlen.3, strpbrk.3, strptime.3, strsep.3, strsignal.3, strspn.3, strstr.3, strtod.3, strtoimax.3, strtok.3, strtol.3, strtoul.3, strverscmp.3, strxfrm.3, swab.3, sysconf.3, syslog.3, system.3, sysv_signal.3, tan.3, tanh.3, tcgetpgrp.3, tcgetsid.3, telldir.3, tempnam.3, termios.3, tgamma.3, timegm.3, timeradd.3, tmpfile.3, tmpnam.3, toascii.3, toupper.3, towctrans.3, towlower.3, towupper.3, trunc.3, tsearch.3, ttyname.3, ttyslot.3, tzset.3, ualarm.3, ulimit.3, ungetwc.3, unlocked_stdio.3, unlockpt.3, updwtmp.3, usleep.3, wcpcpy.3, wcpncpy.3, wcrtomb.3, wcscasecmp.3, wcscat.3, wcschr.3, wcscmp.3, wcscpy.3, wcscspn.3, wcsdup.3, wcslen.3, wcsncasecmp.3, wcsncat.3, wcsncmp.3, wcsncpy.3, wcsnlen.3, wcsnrtombs.3, wcspbrk.3, wcsrchr.3, wcsrtombs.3, wcsspn.3, wcsstr.3, wcstoimax.3, wcstok.3, wcstombs.3, wcswidth.3, wctob.3, wctomb.3, wctrans.3, wctype.3, wcwidth.3, wmemchr.3, wmemcmp.3, wmemcpy.3, wmemmove.3, wmemset.3, wordexp.3, wprintf.3, xcrypt.3, xdr.3, y0.3, cciss.4, console.4, console_codes.4, console_ioctl.4, dsp56k.4, fd.4, full.4, hd.4, hpsa.4, initrd.4, intro.4, lp.4, mem.4, mouse.4, null.4, pts.4, ram.4, random.4, rtc.4, sk98lin.4, st.4, tty.4, ttyS.4, tty_ioctl.4, vcs.4, wavelan.4, acct.5, charmap.5, dir_colors.5, filesystems.5, ftpusers.5, group.5, host.conf.5, hosts.5, hosts.equiv.5, intro.5, issue.5, locale.5, motd.5, networks.5, nologin.5, nscd.conf.5, passwd.5, proc.5, protocols.5, resolv.conf.5, rpc.5, securetty.5, services.5, shells.5, termcap.5, ttytype.5, utmp.5, armscii-8.7, arp.7, ascii.7, bootparam.7, capabilities.7, charsets.7, complex.7, cp1251.7, credentials.7, ddp.7, environ.7, epoll.7, fifo.7, futex.7, glob.7, hier.7, icmp.7, inotify.7, intro.7, ip.7, ipv6.7, iso_8859-1.7, iso_8859-10.7, iso_8859-11.7, iso_8859-13.7, iso_8859-14.7, iso_8859-15.7, iso_8859-16.7, iso_8859-2.7, iso_8859-3.7, iso_8859-4.7, iso_8859-5.7, iso_8859-6.7, iso_8859-7.7, iso_8859-8.7, iso_8859-9.7, koi8-r.7, koi8-u.7, locale.7, mailaddr.7, man.7, mq_overview.7, netdevice.7, netlink.7, numa.7, packet.7, path_resolution.7, pipe.7, posixoptions.7, pthreads.7, pty.7, raw.7, regex.7, rtld-audit.7, rtnetlink.7, sem_overview.7, shm_overview.7, sigevent.7, signal.7, socket.7, standards.7, suffixes.7, svipc.7, tcp.7, termio.7, time.7, udp.7, udplite.7, unicode.7, unix.7, uri.7, utf-8.7, x25.7, nscd.8, sync.8, tzselect.8, zdump.8, zic.8: Global fix: remove unneeded double quotes in .SH headings
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2013-02-24 18:01:36 +00:00
|
|
|
.SH SEE ALSO
|
2008-08-08 16:41:48 +00:00
|
|
|
.BR recvmsg (2),
|
|
|
|
.BR sendmsg (2),
|
|
|
|
.BR socket (2),
|
|
|
|
.BR socketpair (2),
|
|
|
|
.BR cmsg (3),
|
|
|
|
.BR capabilities (7),
|
|
|
|
.BR credentials (7),
|
2014-10-18 15:36:00 +00:00
|
|
|
.BR socket (7),
|
|
|
|
.BR udp (7)
|