2008-08-08 16:41:48 +00:00
|
|
|
'\" t
|
|
|
|
.\" This man page is Copyright (C) 1999 Andi Kleen <ak@muc.de>.
|
|
|
|
.\" and copyright (c) 1999 Matthew Wilcox.
|
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
|
|
|
.\"
|
|
|
|
.\" 2002-10-30, Michael Kerrisk, <mtk.manpages@gmail.com>
|
|
|
|
.\" Added description of SO_ACCEPTCONN
|
|
|
|
.\" 2004-05-20, aeb, added SO_RCVTIMEO/SO_SNDTIMEO text.
|
|
|
|
.\" Modified, 27 May 2004, Michael Kerrisk <mtk.manpages@gmail.com>
|
|
|
|
.\" Added notes on capability requirements
|
|
|
|
.\" A few small grammar fixes
|
2010-06-13 02:21:37 +00:00
|
|
|
.\" 2010-06-13 Jan Engelhardt <jengelh@medozas.de>
|
|
|
|
.\" Documented SO_DOMAIN and SO_PROTOCOL.
|
2016-10-29 10:49:34 +00:00
|
|
|
.\"
|
2010-01-19 00:43:43 +00:00
|
|
|
.\" FIXME
|
|
|
|
.\" The following are not yet documented:
|
2016-10-29 10:49:34 +00:00
|
|
|
.\"
|
|
|
|
.\" SO_PEERNAME (2.4?)
|
|
|
|
.\" get only
|
|
|
|
.\" Seems to do something similar to getpeername(), but then
|
|
|
|
.\" why is it necessary / how does it differ?
|
|
|
|
.\"
|
|
|
|
.\" SO_TIMESTAMPNS (2.6.22)
|
|
|
|
.\" Documentation/networking/timestamping.txt
|
|
|
|
.\" commit 92f37fd2ee805aa77925c1e64fd56088b46094fc
|
|
|
|
.\" Author: Eric Dumazet <dada1@cosmosbay.com>
|
|
|
|
.\"
|
|
|
|
.\" SO_TIMESTAMPING (2.6.30)
|
|
|
|
.\" Documentation/networking/timestamping.txt
|
|
|
|
.\" commit cb9eff097831007afb30d64373f29d99825d0068
|
|
|
|
.\" Author: Patrick Ohly <patrick.ohly@intel.com>
|
|
|
|
.\"
|
|
|
|
.\" SO_WIFI_STATUS (3.3)
|
|
|
|
.\" commit 6e3e939f3b1bf8534b32ad09ff199d88800835a0
|
|
|
|
.\" Author: Johannes Berg <johannes.berg@intel.com>
|
|
|
|
.\" Also: SCM_WIFI_STATUS
|
|
|
|
.\"
|
|
|
|
.\" SO_NOFCS (3.4)
|
|
|
|
.\" commit 3bdc0eba0b8b47797f4a76e377dd8360f317450f
|
|
|
|
.\" Author: Ben Greear <greearb@candelatech.com>
|
|
|
|
.\"
|
|
|
|
.\" SO_GET_FILTER (3.8)
|
|
|
|
.\" commit a8fc92778080c845eaadc369a0ecf5699a03bef0
|
|
|
|
.\" Author: Pavel Emelyanov <xemul@parallels.com>
|
|
|
|
.\"
|
|
|
|
.\" SO_SELECT_ERR_QUEUE (3.10)
|
|
|
|
.\" commit 7d4c04fc170087119727119074e72445f2bb192b
|
|
|
|
.\" Author: Keller, Jacob E <jacob.e.keller@intel.com>
|
|
|
|
.\"
|
|
|
|
.\" SO_MAX_PACING_RATE (3.13)
|
|
|
|
.\" commit 62748f32d501f5d3712a7c372bbb92abc7c62bc7
|
|
|
|
.\" Author: Eric Dumazet <edumazet@google.com>
|
|
|
|
.\"
|
|
|
|
.\" SO_BPF_EXTENSIONS (3.14)
|
|
|
|
.\" commit ea02f9411d9faa3553ed09ce0ec9f00ceae9885e
|
|
|
|
.\" Author: Michal Sekletar <msekleta@redhat.com>
|
2008-08-08 16:41:48 +00:00
|
|
|
.\"
|
_exit.2, alarm.2, chmod.2, clone.2, epoll_ctl.2, fcntl.2, fork.2, fsync.2, getdents.2, getpid.2, ioctl.2, ioctl_console.2, ioctl_list.2, ioctl_ns.2, ioctl_tty.2, ioctl_userfaultfd.2, kexec_load.2, lseek.2, mincore.2, mkdir.2, mknod.2, mmap.2, open.2, poll.2, posix_fadvise.2, prctl.2, rename.2, sched_setaffinity.2, select.2, select_tut.2, sigaction.2, signalfd.2, sigprocmask.2, sigwaitinfo.2, socketcall.2, stat.2, statx.2, syscalls.2, truncate.2, umask.2, unshare.2, userfaultfd.2, utime.2, utimensat.2, wait.2, bzero.3, cfree.3, exit.3, getentropy.3, grantpt.3, insque.3, shm_open.3, syslog.3, termios.3, ttyname.3, wcsdup.3, console_codes.4, tty.4, vcs.4, elf.5, nsswitch.conf.5, proc.5, slabinfo.5, tmpfs.5, bootparam.7, environ.7, hostname.7, inotify.7, mailaddr.7, man-pages.7, namespaces.7, pid_namespaces.7, pthreads.7, pty.7, sem_overview.7, signal.7, socket.7, tcp.7, termio.7, user_namespaces.7, xattr.7, ld.so.8, zdump.8: tstamp
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-05-03 17:27:48 +00:00
|
|
|
.TH SOCKET 7 2017-05-03 Linux "Linux Programmer's Manual"
|
2008-08-08 16:41:48 +00:00
|
|
|
.SH NAME
|
|
|
|
socket \- Linux socket interface
|
|
|
|
.SH SYNOPSIS
|
|
|
|
.B #include <sys/socket.h>
|
_exit.2, bpf.2, cacheflush.2, capget.2, chdir.2, chmod.2, chroot.2, clock_getres.2, clock_nanosleep.2, close.2, connect.2, create_module.2, dup.2, epoll_create.2, epoll_ctl.2, epoll_wait.2, eventfd.2, execve.2, execveat.2, exit_group.2, fanotify_mark.2, flock.2, fork.2, fsync.2, futex.2, futimesat.2, get_kernel_syms.2, get_mempolicy.2, get_robust_list.2, getcpu.2, getdomainname.2, getgid.2, getgroups.2, gethostname.2, getitimer.2, getpagesize.2, getpeername.2, getpid.2, getpriority.2, getrandom.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, inotify_add_watch.2, inotify_init.2, inotify_rm_watch.2, ioctl.2, ioctl_fat.2, ioctl_ficlonerange.2, ioctl_fideduperange.2, ioctl_getfsmap.2, ioctl_tty.2, ioperm.2, iopl.2, keyctl.2, kill.2, link.2, listen.2, listxattr.2, llseek.2, lseek.2, madvise.2, mbind.2, membarrier.2, memfd_create.2, migrate_pages.2, mincore.2, mkdir.2, mknod.2, mlock.2, mmap.2, mmap2.2, modify_ldt.2, mount.2, move_pages.2, mprotect.2, mq_getsetattr.2, mremap.2, msgop.2, msync.2, nanosleep.2, nfsservctl.2, nice.2, pause.2, pciconfig_read.2, perf_event_open.2, perfmonctl.2, personality.2, pkey_alloc.2, poll.2, posix_fadvise.2, prctl.2, pread.2, process_vm_readv.2, ptrace.2, query_module.2, read.2, readahead.2, readdir.2, readv.2, reboot.2, recv.2, remap_file_pages.2, removexattr.2, rename.2, request_key.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, select_tut.2, semctl.2, semget.2, semop.2, send.2, sendfile.2, set_mempolicy.2, set_tid_address.2, seteuid.2, setfsgid.2, setfsuid.2, setgid.2, setns.2, setpgid.2, setresuid.2, setreuid.2, setsid.2, setuid.2, setup.2, setxattr.2, sgetmask.2, shmctl.2, shmget.2, shutdown.2, sigaction.2, sigaltstack.2, sigpending.2, sigprocmask.2, sigsuspend.2, sigwaitinfo.2, socket.2, socketcall.2, socketpair.2, stat.2, statfs.2, stime.2, swapon.2, symlink.2, sync.2, sysctl.2, sysinfo.2, syslog.2, time.2, timer_create.2, timer_delete.2, timer_getoverrun.2, timer_settime.2, timerfd_create.2, times.2, tkill.2, truncate.2, umask.2, umount.2, uname.2, unlink.2, unshare.2, uselib.2, userfaultfd.2, ustat.2, utime.2, utimensat.2, vfork.2, vhangup.2, vm86.2, wait.2, wait4.2, write.2, CPU_SET.3, INFINITY.3, __ppc_get_timebase.3, __ppc_set_ppr_med.3, __ppc_yield.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_init.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, basename.3, bcmp.3, bcopy.3, bsd_signal.3, bsearch.3, bstring.3, btowc.3, byteorder.3, cabs.3, cacos.3, cacosh.3, canonicalize_file_name.3, carg.3, casin.3, casinh.3, catan.3, catanh.3, catopen.3, cbrt.3, ccos.3, ccosh.3, ceil.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, difftime.3, dirfd.3, div.3, dlerror.3, dlopen.3, dlsym.3, drand48.3, drand48_r.3, duplocale.3, dysize.3, ecvt.3, ecvt_r.3, encrypt.3, endian.3, erf.3, erfc.3, err.3, errno.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, fgetc.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, get_nprocs_conf.3, get_phys_pages.3, getaddrinfo.3, getaddrinfo_a.3, getauxval.3, getcontext.3, getcwd.3, getdate.3, getdirentries.3, getdtablesize.3, getentropy.3, getenv.3, getfsent.3, getgrent.3, getgrent_r.3, getgrnam.3, getgrouplist.3, gethostbyname.3, gethostid.3, getifaddrs.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_r.3, getrpcport.3, gets.3, getservent.3, getservent_r.3, getspnam.3, getsubopt.3, getttyent.3, getumask.3, getusershell.3, getutent.3, getw.3, getwchar.3, glob.3, grantpt.3, group_member.3, gsignal.3, hsearch.3, hypot.3, iconv.3, iconv_close.3, iconv_open.3, if_nameindex.3, if_nametoindex.3, ilogb.3, index.3, inet.3, inet_net_pton.3, inet_ntop.3, infnan.3, initgroups.3, insque.3, isalpha.3, isatty.3, isfdtype.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, killpg.3, ldexp.3, lgamma.3, localeconv.3, lockf.3, log.3, log10.3, log1p.3, log2.3, logb.3, login.3, lrint.3, lround.3, lsearch.3, lseek64.3, makecontext.3, malloc.3, malloc_get_state.3, malloc_hook.3, malloc_info.3, matherr.3, mblen.3, mbrlen.3, mbrtowc.3, mbsinit.3, mbsnrtowcs.3, mbsrtowcs.3, mbstowcs.3, mbtowc.3, mcheck.3, memccpy.3, memchr.3, memcmp.3, memcpy.3, memfrob.3, memmem.3, memmove.3, mempcpy.3, memset.3, mkdtemp.3, mkfifo.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, newlocale.3, nextafter.3, nl_langinfo.3, offsetof.3, on_exit.3, open_memstream.3, opendir.3, openpty.3, perror.3, popen.3, posix_fallocate.3, posix_madvise.3, posix_memalign.3, posix_openpt.3, pow.3, pow10.3, printf.3, profil.3, psignal.3, pthread_atfork.3, pthread_attr_init.3, pthread_attr_setaffinity_np.3, pthread_attr_setdetachstate.3, pthread_attr_setguardsize.3, pthread_attr_setinheritsched.3, pthread_attr_setschedparam.3, pthread_attr_setschedpolicy.3, pthread_attr_setscope.3, pthread_attr_setstack.3, pthread_attr_setstackaddr.3, pthread_attr_setstacksize.3, pthread_cancel.3, pthread_cleanup_push.3, pthread_cleanup_push_defer_np.3, pthread_create.3, pthread_detach.3, pthread_equal.3, pthread_exit.3, pthread_getattr_default_np.3, pthread_getattr_np.3, pthread_getcpuclockid.3, pthread_join.3, pthread_kill.3, pthread_rwlockattr_setkind_np.3, pthread_self.3, pthread_setaffinity_np.3, pthread_setcancelstate.3, pthread_setconcurrency.3, pthread_setname_np.3, pthread_setschedparam.3, pthread_setschedprio.3, pthread_sigmask.3, pthread_sigqueue.3, pthread_testcancel.3, pthread_tryjoin_np.3, pthread_yield.3, ptsname.3, putenv.3, putgrent.3, putpwent.3, puts.3, putwchar.3, qecvt.3, qsort.3, raise.3, rand.3, random.3, random_r.3, rcmd.3, re_comp.3, readdir.3, realpath.3, remainder.3, remove.3, remquo.3, resolver.3, rewinddir.3, rexec.3, rint.3, round.3, rpmatch.3, rtime.3, rtnetlink.3, scalb.3, scalbln.3, scandir.3, scanf.3, sched_getcpu.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, setlocale.3, setlogmask.3, setnetgrent.3, shm_open.3, siginterrupt.3, signbit.3, significand.3, sigpause.3, sigqueue.3, sigset.3, sigvec.3, sigwait.3, sin.3, sincos.3, sinh.3, sleep.3, sockatmark.3, sqrt.3, statvfs.3, stdarg.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, strfromd.3, strfry.3, strftime.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, uselocale.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, y0.3, dsp56k.4, random.4, rtc.4, st.4, ddp.7, ip.7, ipv6.7, packet.7, rtnetlink.7, socket.7, tcp.7, udp.7, udplite.7, x25.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-15 15:16:29 +00:00
|
|
|
.PP
|
2008-12-03 18:56:22 +00:00
|
|
|
.IB sockfd " = socket(int " socket_family ", int " socket_type ", int " protocol );
|
2008-08-08 16:41:48 +00:00
|
|
|
.SH DESCRIPTION
|
|
|
|
This manual page describes the Linux networking socket layer user
|
|
|
|
interface.
|
|
|
|
The BSD compatible sockets
|
|
|
|
are the uniform interface
|
|
|
|
between the user process and the network protocol stacks in the kernel.
|
|
|
|
The protocol modules are grouped into
|
|
|
|
.I protocol families
|
2013-12-30 20:59:22 +00:00
|
|
|
such as
|
2014-02-05 15:08:12 +00:00
|
|
|
.BR AF_INET ", " AF_IPX ", and " AF_PACKET ,
|
2008-08-08 16:41:48 +00:00
|
|
|
and
|
|
|
|
.I socket types
|
2013-12-30 20:59:22 +00:00
|
|
|
such as
|
2008-08-08 16:41:48 +00:00
|
|
|
.B SOCK_STREAM
|
|
|
|
or
|
|
|
|
.BR SOCK_DGRAM .
|
|
|
|
See
|
|
|
|
.BR socket (2)
|
|
|
|
for more information on families and types.
|
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-layer functions
|
2008-08-08 16:41:48 +00:00
|
|
|
These functions are used by the user process to send or receive packets
|
|
|
|
and to do other socket operations.
|
|
|
|
For more information see their respective manual pages.
|
environ.7, epoll.7, feature_test_macros.7, futex.7, ip.7, ipv6.7, locale.7, man-pages.7, man.7, math_error.7, netdevice.7, netlink.7, packet.7, raw.7, rtld-audit.7, rtnetlink.7, sock_diag.7, socket.7, tcp.7, udp.7, udplite.7, unix.7, uri.7, vdso.7: Formatting fix: replace blank lines with .PP/.IP
Blank lines shouldn't generally appear in *roff source (other
than in code examples), since they create large vertical
spaces between text blocks.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-16 01:01:48 +00:00
|
|
|
.PP
|
2008-08-08 16:41:48 +00:00
|
|
|
.BR socket (2)
|
|
|
|
creates a socket,
|
|
|
|
.BR connect (2)
|
|
|
|
connects a socket to a remote socket address,
|
|
|
|
the
|
|
|
|
.BR bind (2)
|
|
|
|
function binds a socket to a local socket address,
|
|
|
|
.BR listen (2)
|
|
|
|
tells the socket that new connections shall be accepted, and
|
|
|
|
.BR accept (2)
|
|
|
|
is used to get a new socket with a new incoming connection.
|
|
|
|
.BR socketpair (2)
|
intro.1, _syscall.2, access.2, arch_prctl.2, cacheflush.2, chown.2, clock_getres.2, clone.2, create_module.2, fcntl.2, flock.2, get_kernel_syms.2, get_robust_list.2, get_thread_area.2, getcpu.2, getpriority.2, getrlimit.2, getrusage.2, ioprio_set.2, kexec_load.2, madvise.2, mbind.2, migrate_pages.2, mknod.2, mmap.2, mount.2, move_pages.2, mprotect.2, open.2, pause.2, pciconfig_read.2, perf_event_open.2, prctl.2, ptrace.2, query_module.2, read.2, reboot.2, recv.2, s390_runtime_instr.2, sched_setscheduler.2, select_tut.2, send.2, set_mempolicy.2, setfsgid.2, setfsuid.2, sigaction.2, spu_create.2, spu_run.2, stime.2, swapon.2, syslog.2, timer_create.2, timer_getoverrun.2, times.2, tkill.2, umount.2, unimplemented.2, ustat.2, vm86.2, wait.2, abs.3, aio_read.3, aio_write.3, bsd_signal.3, catgets.3, clearenv.3, cmsg.3, dbopen.3, dirfd.3, dlopen.3, exec.3, fenv.3, ferror.3, fmemopen.3, fnmatch.3, fopen.3, futimes.3, getaddrinfo.3, getifaddrs.3, getipnodebyname.3, hsearch.3, if_nameindex.3, inet_pton.3, mblen.3, mbrlen.3, mbsrtowcs.3, mbtowc.3, mcheck.3, memfrob.3, mq_notify.3, netlink.3, posix_memalign.3, printf.3, pthread_attr_setscope.3, pthread_cleanup_push.3, pthread_kill_other_threads_np.3, pthread_self.3, pthread_setcancelstate.3, pthread_setconcurrency.3, raise.3, resolver.3, rpc.3, rtime.3, rtnetlink.3, scanf.3, setbuf.3, setnetgrent.3, shm_open.3, sigpause.3, sigset.3, sigwait.3, sockatmark.3, strcasecmp.3, strcmp.3, strdup.3, strftime.3, strptime.3, strsignal.3, strverscmp.3, sysv_signal.3, termios.3, wcrtomb.3, wcsnlen.3, wcsnrtombs.3, wcsrtombs.3, wctomb.3, wprintf.3, console_codes.4, cpuid.4, msr.4, rtc.4, sk98lin.4, st.4, tty.4, charmap.5, core.5, elf.5, hosts.equiv.5, proc.5, resolv.conf.5, services.5, slabinfo.5, arp.7, bootparam.7, capabilities.7, charsets.7, cpuset.7, ddp.7, epoll.7, feature_test_macros.7, futex.7, hier.7, icmp.7, inotify.7, ip.7, ipv6.7, man-pages.7, mdoc.7, mdoc.samples.7, netdevice.7, netlink.7, numa.7, packet.7, path_resolution.7, posixoptions.7, pthreads.7, raw.7, rtld-audit.7, rtnetlink.7, sem_overview.7, sigevent.7, socket.7, spufs.7, tcp.7, udp.7, unicode.7, uri.7, utf-8.7, intro.8, ldconfig.8, sync.8: Global fix: fix placement of word "only"
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2013-03-31 08:53:00 +00:00
|
|
|
returns two connected anonymous sockets (implemented only for a few
|
2008-08-08 16:41:48 +00:00
|
|
|
local families like
|
2008-08-08 16:47:53 +00:00
|
|
|
.BR AF_UNIX )
|
2008-08-08 16:41:48 +00:00
|
|
|
.PP
|
|
|
|
.BR send (2),
|
|
|
|
.BR sendto (2),
|
|
|
|
and
|
|
|
|
.BR sendmsg (2)
|
|
|
|
send data over a socket, and
|
|
|
|
.BR recv (2),
|
|
|
|
.BR recvfrom (2),
|
|
|
|
.BR recvmsg (2)
|
|
|
|
receive data from a socket.
|
|
|
|
.BR poll (2)
|
|
|
|
and
|
|
|
|
.BR select (2)
|
|
|
|
wait for arriving data or a readiness to send data.
|
|
|
|
In addition, the standard I/O operations like
|
|
|
|
.BR write (2),
|
|
|
|
.BR writev (2),
|
|
|
|
.BR sendfile (2),
|
|
|
|
.BR read (2),
|
|
|
|
and
|
|
|
|
.BR readv (2)
|
|
|
|
can be used to read and write data.
|
|
|
|
.PP
|
|
|
|
.BR getsockname (2)
|
|
|
|
returns the local socket address and
|
|
|
|
.BR getpeername (2)
|
|
|
|
returns the remote socket address.
|
|
|
|
.BR getsockopt (2)
|
|
|
|
and
|
|
|
|
.BR setsockopt (2)
|
|
|
|
are used to set or get socket layer or protocol options.
|
|
|
|
.BR ioctl (2)
|
|
|
|
can be used to set or read some other options.
|
|
|
|
.PP
|
|
|
|
.BR close (2)
|
|
|
|
is used to close a socket.
|
|
|
|
.BR shutdown (2)
|
|
|
|
closes parts of a full-duplex socket connection.
|
|
|
|
.PP
|
|
|
|
Seeking, or calling
|
|
|
|
.BR pread (2)
|
|
|
|
or
|
|
|
|
.BR pwrite (2)
|
intro.1, time.1, adjtimex.2, capget.2, eventfd.2, fcntl.2, getrlimit.2, getsockopt.2, gettimeofday.2, intro.2, ioctl_list.2, ioperm.2, mlock.2, pivot_root.2, poll.2, prctl.2, ptrace.2, sched_setscheduler.2, select_tut.2, semget.2, sigaltstack.2, signalfd.2, sysctl.2, timer_settime.2, timerfd_create.2, wait.2, CPU_SET.3, argz_add.3, assert_perror.3, atexit.3, backtrace.3, bcmp.3, clearenv.3, ctime.3, dl_iterate_phdr.3, dlopen.3, ecvt.3, errno.3, error.3, ether_aton.3, exit.3, fenv.3, ferror.3, finite.3, flockfile.3, fnmatch.3, fpathconf.3, fpclassify.3, ftime.3, ftok.3, ftw.3, fwide.3, getaddrinfo.3, gethostbyname.3, getlogin.3, getnameinfo.3, getnetent.3, getopt.3, getprotoent.3, getrpcent.3, getservent.3, glob.3, hsearch.3, inet.3, isalpha.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, longjmp.3, lsearch.3, malloc.3, matherr.3, mblen.3, mbsinit.3, mbtowc.3, on_exit.3, printf.3, pthread_attr_init.3, pthread_attr_setaffinity_np.3, pthread_attr_setdetachstate.3, pthread_attr_setguardsize.3, pthread_attr_setinheritsched.3, pthread_attr_setschedparam.3, pthread_attr_setschedpolicy.3, pthread_attr_setscope.3, pthread_attr_setstack.3, pthread_attr_setstackaddr.3, pthread_attr_setstacksize.3, pthread_cancel.3, pthread_cleanup_push.3, pthread_equal.3, pthread_getattr_np.3, pthread_getcpuclockid.3, pthread_setaffinity_np.3, pthread_setcancelstate.3, pthread_setconcurrency.3, pthread_setschedparam.3, pthread_setschedprio.3, ptsname.3, putenv.3, putgrent.3, raise.3, rcmd.3, regex.3, rexec.3, rpc.3, rpmatch.3, rtnetlink.3, scandir.3, sem_init.3, setaliasent.3, setbuf.3, setenv.3, setjmp.3, signbit.3, stdio_ext.3, strtod.3, strtol.3, strtoul.3, system.3, termios.3, timeradd.3, tzset.3, ualarm.3, wctomb.3, xdr.3, st.4, tty_ioctl.4, core.5, elf.5, proc.5, bootparam.7, capabilities.7, icmp.7, ip.7, ipv6.7, math_error.7, mdoc.samples.7, mq_overview.7, pthreads.7, raw.7, regex.7, socket.7, tcp.7, tzselect.8: Global fix: s/non-zero/nonzero/
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:40:55 +00:00
|
|
|
with a nonzero position is not supported on sockets.
|
2008-08-08 16:41:48 +00:00
|
|
|
.PP
|
accept.2, connect.2, eventfd.2, flock.2, open.2, posix_fadvise.2, read.2, recv.2, sched_setscheduler.2, select_tut.2, send.2, signalfd.2, splice.2, timerfd_create.2, write.2, flockfile.3, mkfifo.3, mq_notify.3, mq_open.3, pthread_tryjoin_np.3, scanf.3, random.4, ddp.7, epoll.7, fifo.7, ip.7, pipe.7, socket.7, spufs.7: Global fix: s/non-blocking/nonblocking/
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:43:10 +00:00
|
|
|
It is possible to do nonblocking I/O on sockets by setting the
|
2008-08-08 16:41:48 +00:00
|
|
|
.B O_NONBLOCK
|
|
|
|
flag on a socket file descriptor using
|
|
|
|
.BR fcntl (2).
|
|
|
|
Then all operations that would block will (usually)
|
|
|
|
return with
|
|
|
|
.B EAGAIN
|
|
|
|
(operation should be retried later);
|
|
|
|
.BR connect (2)
|
|
|
|
will return
|
|
|
|
.B EINPROGRESS
|
|
|
|
error.
|
|
|
|
The user can then wait for various events via
|
|
|
|
.BR poll (2)
|
|
|
|
or
|
|
|
|
.BR select (2).
|
|
|
|
.TS
|
|
|
|
tab(:) allbox;
|
|
|
|
c s s
|
|
|
|
l l l.
|
|
|
|
I/O events
|
|
|
|
Event:Poll flag:Occurrence
|
|
|
|
Read:POLLIN:T{
|
|
|
|
New data arrived.
|
|
|
|
T}
|
|
|
|
Read:POLLIN:T{
|
|
|
|
A connection setup has been completed
|
|
|
|
(for connection-oriented sockets)
|
|
|
|
T}
|
|
|
|
Read:POLLHUP:T{
|
|
|
|
A disconnection request has been initiated by the other end.
|
|
|
|
T}
|
|
|
|
Read:POLLHUP:T{
|
|
|
|
A connection is broken (only for connection-oriented protocols).
|
|
|
|
When the socket is written
|
|
|
|
.B SIGPIPE
|
|
|
|
is also sent.
|
|
|
|
T}
|
|
|
|
Write:POLLOUT:T{
|
|
|
|
Socket has enough send buffer space for writing new data.
|
|
|
|
T}
|
|
|
|
Read/Write:T{
|
2016-03-01 20:16:46 +00:00
|
|
|
POLLIN |
|
2008-08-08 16:41:48 +00:00
|
|
|
.br
|
|
|
|
POLLOUT
|
|
|
|
T}:T{
|
|
|
|
An outgoing
|
|
|
|
.BR connect (2)
|
|
|
|
finished.
|
|
|
|
T}
|
|
|
|
Read/Write:POLLERR:An asynchronous error occurred.
|
|
|
|
Read/Write:POLLHUP:The other end has shut down one direction.
|
|
|
|
Exception:POLLPRI:T{
|
|
|
|
Urgent data arrived.
|
|
|
|
.B SIGURG
|
|
|
|
is sent then.
|
|
|
|
T}
|
|
|
|
.\" FIXME . The following is not true currently:
|
|
|
|
.\" It is no I/O event when the connection
|
|
|
|
.\" is broken from the local end using
|
|
|
|
.\" .BR shutdown (2)
|
|
|
|
.\" or
|
|
|
|
.\" .BR close (2).
|
|
|
|
.TE
|
|
|
|
.PP
|
|
|
|
An alternative to
|
|
|
|
.BR poll (2)
|
|
|
|
and
|
|
|
|
.BR select (2)
|
|
|
|
is to let the kernel inform the application about events
|
|
|
|
via a
|
|
|
|
.B SIGIO
|
|
|
|
signal.
|
|
|
|
For that the
|
|
|
|
.B O_ASYNC
|
|
|
|
flag must be set on a socket file descriptor via
|
|
|
|
.BR fcntl (2)
|
|
|
|
and a valid signal handler for
|
|
|
|
.B SIGIO
|
|
|
|
must be installed via
|
|
|
|
.BR sigaction (2).
|
|
|
|
See the
|
|
|
|
.I Signals
|
|
|
|
discussion below.
|
2012-12-14 16:44:58 +00:00
|
|
|
.SS Socket address structures
|
|
|
|
Each socket domain has its own format for socket addresses,
|
|
|
|
with a domain-specific address structure.
|
|
|
|
Each of these structures begins with an
|
|
|
|
integer "family" field (typed as
|
|
|
|
.IR sa_family_t )
|
|
|
|
that indicates the type of the address structure.
|
|
|
|
This allows
|
|
|
|
the various system calls (e.g.,
|
|
|
|
.BR connect (2),
|
|
|
|
.BR bind (2),
|
|
|
|
.BR accept (2),
|
|
|
|
.BR getsockname (2),
|
|
|
|
.BR getpeername (2)),
|
|
|
|
which are generic to all socket domains,
|
|
|
|
to determine the domain of a particular socket address.
|
environ.7, epoll.7, feature_test_macros.7, futex.7, ip.7, ipv6.7, locale.7, man-pages.7, man.7, math_error.7, netdevice.7, netlink.7, packet.7, raw.7, rtld-audit.7, rtnetlink.7, sock_diag.7, socket.7, tcp.7, udp.7, udplite.7, unix.7, uri.7, vdso.7: Formatting fix: replace blank lines with .PP/.IP
Blank lines shouldn't generally appear in *roff source (other
than in code examples), since they create large vertical
spaces between text blocks.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-16 01:01:48 +00:00
|
|
|
.PP
|
2012-12-14 16:44:58 +00:00
|
|
|
To allow any type of socket address to be passed to
|
|
|
|
interfaces in the sockets API,
|
|
|
|
the type
|
|
|
|
.IR "struct sockaddr"
|
|
|
|
is defined.
|
2012-12-20 17:17:09 +00:00
|
|
|
The purpose of this type is purely to allow casting of
|
2012-12-14 16:44:58 +00:00
|
|
|
domain-specific socket address types to a "generic" type,
|
2012-12-20 17:17:09 +00:00
|
|
|
so as to avoid compiler warnings about type mismatches in
|
2012-12-14 16:44:58 +00:00
|
|
|
calls to the sockets API.
|
environ.7, epoll.7, feature_test_macros.7, futex.7, ip.7, ipv6.7, locale.7, man-pages.7, man.7, math_error.7, netdevice.7, netlink.7, packet.7, raw.7, rtld-audit.7, rtnetlink.7, sock_diag.7, socket.7, tcp.7, udp.7, udplite.7, unix.7, uri.7, vdso.7: Formatting fix: replace blank lines with .PP/.IP
Blank lines shouldn't generally appear in *roff source (other
than in code examples), since they create large vertical
spaces between text blocks.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-16 01:01:48 +00:00
|
|
|
.PP
|
2012-12-14 16:44:58 +00:00
|
|
|
In addition, the sockets API provides the data type
|
|
|
|
.IR "struct sockaddr_storage".
|
|
|
|
This type
|
|
|
|
is suitable to accommodate all supported domain-specific socket
|
|
|
|
address structures; it is large enough and is aligned properly.
|
2012-12-20 17:17:09 +00:00
|
|
|
(In particular, it is large enough to hold
|
2012-12-14 16:44:58 +00:00
|
|
|
IPv6 socket addresses.)
|
|
|
|
The structure includes the following field, which can be used to identify
|
|
|
|
the type of socket address actually stored in the structure:
|
environ.7, epoll.7, feature_test_macros.7, futex.7, ip.7, ipv6.7, locale.7, man-pages.7, man.7, math_error.7, netdevice.7, netlink.7, packet.7, raw.7, rtld-audit.7, rtnetlink.7, sock_diag.7, socket.7, tcp.7, udp.7, udplite.7, unix.7, uri.7, vdso.7: Formatting fix: replace blank lines with .PP/.IP
Blank lines shouldn't generally appear in *roff source (other
than in code examples), since they create large vertical
spaces between text blocks.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-16 01:01:48 +00:00
|
|
|
.PP
|
2012-12-14 16:44:58 +00:00
|
|
|
.in +4n
|
execve.2, ioctl_console.2, ioctl_iflags.2, ioctl_ns.2, ioctl_userfaultfd.2, kcmp.2, kexec_load.2, keyctl.2, link.2, listxattr.2, membarrier.2, memfd_create.2, mmap.2, modify_ldt.2, mprotect.2, msgctl.2, nanosleep.2, open_by_handle_at.2, perf_event_open.2, poll.2, posix_fadvise.2, process_vm_readv.2, ptrace.2, query_module.2, quotactl.2, readdir.2, readv.2, recv.2, recvmmsg.2, request_key.2, sched_rr_get_interval.2, sched_setaffinity.2, sched_setattr.2, sched_setscheduler.2, seccomp.2, select.2, select_tut.2, semctl.2, semop.2, send.2, sendmmsg.2, set_thread_area.2, setns.2, shmctl.2, shmget.2, sigaction.2, sigaltstack.2, signal.2, sigwaitinfo.2, stat.2, statfs.2, statx.2, sync_file_range.2, syscall.2, sysctl.2, sysinfo.2, tee.2, timer_create.2, timer_settime.2, timerfd_create.2, unshare.2, userfaultfd.2, ustat.2, utime.2, utimensat.2, vmsplice.2, wait.2, adjtime.3, aio_init.3, backtrace.3, basename.3, bswap.3, btree.3, clock_getcpuclockid.3, cmsg.3, confstr.3, dbopen.3, dl_iterate_phdr.3, dladdr.3, dlinfo.3, dlopen.3, duplocale.3, encrypt.3, end.3, endian.3, err.3, errno.3, ether_aton.3, fgetgrent.3, fgetpwent.3, fmemopen.3, frexp.3, ftime.3, fts.3, getaddrinfo.3, getaddrinfo_a.3, getdate.3, getfsent.3, getgrent.3, getgrent_r.3, getgrnam.3, getgrouplist.3, gethostbyname.3, getifaddrs.3, getipnodebyname.3, getmntent.3, getnameinfo.3, getnetent.3, getopt.3, getprotoent.3, getprotoent_r.3, getpw.3, getpwent.3, getpwent_r.3, getpwnam.3, getrpcent.3, getservent.3, getservent_r.3, getspnam.3, getttyent.3, glob.3, gnu_get_libc_version.3, hash.3, hsearch.3, if_nameindex.3, inet.3, inet_net_pton.3, inet_pton.3, insque.3, isalpha.3, makecontext.3, mallinfo.3, malloc_info.3, mallopt.3, matherr.3, mbstowcs.3, mcheck.3, memchr.3, mq_getattr.3, mq_open.3, mq_receive.3, mq_send.3, mtrace.3, newlocale.3, ntp_gettime.3, posix_openpt.3, printf.3, pthread_attr_init.3, pthread_attr_setschedparam.3, pthread_cancel.3, pthread_cleanup_push.3, pthread_cleanup_push_defer_np.3, pthread_create.3, pthread_getattr_default_np.3, pthread_getattr_np.3, pthread_getcpuclockid.3, pthread_setname_np.3, pthread_setschedparam.3, pthread_sigmask.3, pthread_tryjoin_np.3, readdir.3, realpath.3, recno.3, regex.3, rpc.3, scanf.3, sched_getcpu.3, sem_wait.3, setaliasent.3, sigqueue.3, statvfs.3, strcat.3, strcpy.3, strftime.3, strtok.3, strtol.3, strverscmp.3, toupper.3, ttyslot.3, xdr.3, fuse.4, loop.4, rtc.4, st.4, acct.5, core.5, elf.5, slabinfo.5, aio.7, arp.7, capabilities.7, cgroup_namespaces.7, cgroups.7, ddp.7, fanotify.7, feature_test_macros.7, inode.7, inotify.7, ip.7, keyrings.7, locale.7, mount_namespaces.7, namespaces.7, netdevice.7, netlink.7, packet.7, pkeys.7, pthreads.7, sched.7, session-keyring.7, sock_diag.7, socket.7, spufs.7, udplite.7, unix.7, user_namespaces.7, vdso.7, x25.7, ld.so.8: Use consistent markup for code snippets
Change .nf/.fi to .EX/.EE
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-18 19:52:46 +00:00
|
|
|
.EX
|
2012-12-14 16:44:58 +00:00
|
|
|
sa_family_t ss_family;
|
execve.2, ioctl_console.2, ioctl_iflags.2, ioctl_ns.2, ioctl_userfaultfd.2, kcmp.2, kexec_load.2, keyctl.2, link.2, listxattr.2, membarrier.2, memfd_create.2, mmap.2, modify_ldt.2, mprotect.2, msgctl.2, nanosleep.2, open_by_handle_at.2, perf_event_open.2, poll.2, posix_fadvise.2, process_vm_readv.2, ptrace.2, query_module.2, quotactl.2, readdir.2, readv.2, recv.2, recvmmsg.2, request_key.2, sched_rr_get_interval.2, sched_setaffinity.2, sched_setattr.2, sched_setscheduler.2, seccomp.2, select.2, select_tut.2, semctl.2, semop.2, send.2, sendmmsg.2, set_thread_area.2, setns.2, shmctl.2, shmget.2, sigaction.2, sigaltstack.2, signal.2, sigwaitinfo.2, stat.2, statfs.2, statx.2, sync_file_range.2, syscall.2, sysctl.2, sysinfo.2, tee.2, timer_create.2, timer_settime.2, timerfd_create.2, unshare.2, userfaultfd.2, ustat.2, utime.2, utimensat.2, vmsplice.2, wait.2, adjtime.3, aio_init.3, backtrace.3, basename.3, bswap.3, btree.3, clock_getcpuclockid.3, cmsg.3, confstr.3, dbopen.3, dl_iterate_phdr.3, dladdr.3, dlinfo.3, dlopen.3, duplocale.3, encrypt.3, end.3, endian.3, err.3, errno.3, ether_aton.3, fgetgrent.3, fgetpwent.3, fmemopen.3, frexp.3, ftime.3, fts.3, getaddrinfo.3, getaddrinfo_a.3, getdate.3, getfsent.3, getgrent.3, getgrent_r.3, getgrnam.3, getgrouplist.3, gethostbyname.3, getifaddrs.3, getipnodebyname.3, getmntent.3, getnameinfo.3, getnetent.3, getopt.3, getprotoent.3, getprotoent_r.3, getpw.3, getpwent.3, getpwent_r.3, getpwnam.3, getrpcent.3, getservent.3, getservent_r.3, getspnam.3, getttyent.3, glob.3, gnu_get_libc_version.3, hash.3, hsearch.3, if_nameindex.3, inet.3, inet_net_pton.3, inet_pton.3, insque.3, isalpha.3, makecontext.3, mallinfo.3, malloc_info.3, mallopt.3, matherr.3, mbstowcs.3, mcheck.3, memchr.3, mq_getattr.3, mq_open.3, mq_receive.3, mq_send.3, mtrace.3, newlocale.3, ntp_gettime.3, posix_openpt.3, printf.3, pthread_attr_init.3, pthread_attr_setschedparam.3, pthread_cancel.3, pthread_cleanup_push.3, pthread_cleanup_push_defer_np.3, pthread_create.3, pthread_getattr_default_np.3, pthread_getattr_np.3, pthread_getcpuclockid.3, pthread_setname_np.3, pthread_setschedparam.3, pthread_sigmask.3, pthread_tryjoin_np.3, readdir.3, realpath.3, recno.3, regex.3, rpc.3, scanf.3, sched_getcpu.3, sem_wait.3, setaliasent.3, sigqueue.3, statvfs.3, strcat.3, strcpy.3, strftime.3, strtok.3, strtol.3, strverscmp.3, toupper.3, ttyslot.3, xdr.3, fuse.4, loop.4, rtc.4, st.4, acct.5, core.5, elf.5, slabinfo.5, aio.7, arp.7, capabilities.7, cgroup_namespaces.7, cgroups.7, ddp.7, fanotify.7, feature_test_macros.7, inode.7, inotify.7, ip.7, keyrings.7, locale.7, mount_namespaces.7, namespaces.7, netdevice.7, netlink.7, packet.7, pkeys.7, pthreads.7, sched.7, session-keyring.7, sock_diag.7, socket.7, spufs.7, udplite.7, unix.7, user_namespaces.7, vdso.7, x25.7, ld.so.8: Use consistent markup for code snippets
Change .nf/.fi to .EX/.EE
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-18 19:52:46 +00:00
|
|
|
.EE
|
2012-12-14 16:44:58 +00:00
|
|
|
.in
|
environ.7, epoll.7, feature_test_macros.7, futex.7, ip.7, ipv6.7, locale.7, man-pages.7, man.7, math_error.7, netdevice.7, netlink.7, packet.7, raw.7, rtld-audit.7, rtnetlink.7, sock_diag.7, socket.7, tcp.7, udp.7, udplite.7, unix.7, uri.7, vdso.7: Formatting fix: replace blank lines with .PP/.IP
Blank lines shouldn't generally appear in *roff source (other
than in code examples), since they create large vertical
spaces between text blocks.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-16 01:01:48 +00:00
|
|
|
.PP
|
2012-12-20 17:17:09 +00:00
|
|
|
The
|
2012-12-14 16:44:58 +00:00
|
|
|
.I sockaddr_storage
|
|
|
|
structure is useful in programs that must handle socket addresses
|
|
|
|
in a generic way
|
|
|
|
(e.g., programs that must deal with both IPv4 and IPv6 socket addresses).
|
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
|
2013-04-18 14:14:38 +00:00
|
|
|
The socket options listed below can be set by using
|
2008-08-08 16:41:48 +00:00
|
|
|
.BR setsockopt (2)
|
|
|
|
and read with
|
|
|
|
.BR getsockopt (2)
|
|
|
|
with the socket level set to
|
|
|
|
.B SOL_SOCKET
|
2013-04-18 14:14:38 +00:00
|
|
|
for all sockets.
|
|
|
|
Unless otherwise noted,
|
|
|
|
.I optval
|
|
|
|
is a pointer to an
|
|
|
|
.IR int .
|
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 .
|
2010-06-13 02:31:58 +00:00
|
|
|
.\" In the list below, the text used to describe argument types
|
|
|
|
.\" for each socket option should be more consistent
|
|
|
|
.\"
|
2008-08-08 16:41:48 +00:00
|
|
|
.\" SO_ACCEPTCONN is in POSIX.1-2001, and its origin is explained in
|
|
|
|
.\" W R Stevens, UNPv1
|
|
|
|
.TP
|
|
|
|
.B SO_ACCEPTCONN
|
|
|
|
Returns a value indicating whether or not this socket has been marked
|
|
|
|
to accept connections with
|
|
|
|
.BR listen (2).
|
|
|
|
The value 0 indicates that this is not a listening socket,
|
|
|
|
the value 1 indicates that this is a listening socket.
|
2010-06-13 02:26:57 +00:00
|
|
|
This socket option is read-only.
|
2008-08-08 16:41:48 +00:00
|
|
|
.TP
|
2016-03-01 08:40:22 +00:00
|
|
|
.BR SO_ATTACH_FILTER " (since Linux 2.2), " SO_ATTACH_BPF " (since Linux 3.19)"
|
|
|
|
Attach a classic BPF
|
|
|
|
.RB ( SO_ATTACH_FILTER )
|
|
|
|
or an extended BPF
|
|
|
|
.RB ( SO_ATTACH_BPF )
|
|
|
|
program to the socket for use as a filter of incoming packets.
|
|
|
|
A packet will be dropped if the filter program returns zero.
|
|
|
|
If the filter program returns a
|
|
|
|
non-zero value which is less than the packet's data length,
|
|
|
|
the packet will be truncated to the length returned.
|
|
|
|
If the value returned by the filter is greater than or equal to the
|
|
|
|
packet's data length, the packet is allowed to proceed unmodified.
|
environ.7, epoll.7, feature_test_macros.7, futex.7, ip.7, ipv6.7, locale.7, man-pages.7, man.7, math_error.7, netdevice.7, netlink.7, packet.7, raw.7, rtld-audit.7, rtnetlink.7, sock_diag.7, socket.7, tcp.7, udp.7, udplite.7, unix.7, uri.7, vdso.7: Formatting fix: replace blank lines with .PP/.IP
Blank lines shouldn't generally appear in *roff source (other
than in code examples), since they create large vertical
spaces between text blocks.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-16 01:01:48 +00:00
|
|
|
.IP
|
2016-02-29 17:36:39 +00:00
|
|
|
The argument for
|
|
|
|
.BR SO_ATTACH_FILTER
|
|
|
|
is a
|
|
|
|
.I sock_fprog
|
2016-03-01 08:40:22 +00:00
|
|
|
structure, defined in
|
|
|
|
.IR <linux/filter.h> :
|
dir_colors.5, feature_test_macros.7, glob.7, ip.7, ipv6.7, man-pages.7, man.7, netdevice.7, rtnetlink.7, socket.7, svipc.7, tcp.7, units.7, user_namespaces.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-17 22:55:49 +00:00
|
|
|
.IP
|
2016-02-29 17:36:39 +00:00
|
|
|
.in +4n
|
dir_colors.5, feature_test_macros.7, glob.7, ip.7, ipv6.7, man-pages.7, man.7, netdevice.7, rtnetlink.7, socket.7, svipc.7, tcp.7, units.7, user_namespaces.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-17 22:55:49 +00:00
|
|
|
.EX
|
2016-02-29 17:36:39 +00:00
|
|
|
struct sock_fprog {
|
|
|
|
unsigned short len;
|
|
|
|
struct sock_filter *filter;
|
|
|
|
};
|
dir_colors.5, feature_test_macros.7, glob.7, ip.7, ipv6.7, man-pages.7, man.7, netdevice.7, rtnetlink.7, socket.7, svipc.7, tcp.7, units.7, user_namespaces.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-17 22:55:49 +00:00
|
|
|
.EE
|
2016-02-29 17:36:39 +00:00
|
|
|
.in
|
|
|
|
.IP
|
|
|
|
The argument for
|
|
|
|
.BR SO_ATTACH_BPF
|
|
|
|
is a file descriptor returned by the
|
|
|
|
.BR bpf (2)
|
|
|
|
system call and must refer to a program of type
|
|
|
|
.BR BPF_PROG_TYPE_SOCKET_FILTER.
|
environ.7, epoll.7, feature_test_macros.7, futex.7, ip.7, ipv6.7, locale.7, man-pages.7, man.7, math_error.7, netdevice.7, netlink.7, packet.7, raw.7, rtld-audit.7, rtnetlink.7, sock_diag.7, socket.7, tcp.7, udp.7, udplite.7, unix.7, uri.7, vdso.7: Formatting fix: replace blank lines with .PP/.IP
Blank lines shouldn't generally appear in *roff source (other
than in code examples), since they create large vertical
spaces between text blocks.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-16 01:01:48 +00:00
|
|
|
.IP
|
2016-03-01 08:40:22 +00:00
|
|
|
These options may be set multiple times for a given socket,
|
|
|
|
each time replacing the previous filter program.
|
|
|
|
The classic and extended versions may be called on the same socket,
|
|
|
|
but the previous filter will always be replaced such that a socket
|
|
|
|
never has more than one filter defined.
|
environ.7, epoll.7, feature_test_macros.7, futex.7, ip.7, ipv6.7, locale.7, man-pages.7, man.7, math_error.7, netdevice.7, netlink.7, packet.7, raw.7, rtld-audit.7, rtnetlink.7, sock_diag.7, socket.7, tcp.7, udp.7, udplite.7, unix.7, uri.7, vdso.7: Formatting fix: replace blank lines with .PP/.IP
Blank lines shouldn't generally appear in *roff source (other
than in code examples), since they create large vertical
spaces between text blocks.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-16 01:01:48 +00:00
|
|
|
.IP
|
2016-03-01 08:40:22 +00:00
|
|
|
Both classic and extended BPF are explained in the kernel source file
|
2016-02-29 17:36:39 +00:00
|
|
|
.I Documentation/networking/filter.txt
|
|
|
|
.TP
|
2016-03-01 08:40:22 +00:00
|
|
|
.BR SO_ATTACH_REUSEPORT_CBPF ", " SO_ATTACH_REUSEPORT_EBPF
|
2016-02-29 17:36:39 +00:00
|
|
|
For use with the
|
|
|
|
.BR SO_REUSEPORT
|
2016-03-01 08:40:22 +00:00
|
|
|
option, these options allow the user to set a classic BPF
|
|
|
|
.RB ( SO_ATTACH_REUSEPORT_CBPF )
|
|
|
|
or an extended BPF
|
|
|
|
.RB ( SO_ATTACH_REUSEPORT_EBPF )
|
|
|
|
program which defines how packets are assigned to
|
2016-02-29 17:36:39 +00:00
|
|
|
the sockets in the reuseport group (that is, all sockets which have
|
|
|
|
.BR SO_REUSEPORT
|
2016-03-01 08:40:22 +00:00
|
|
|
set and are using the same local address to receive packets).
|
environ.7, epoll.7, feature_test_macros.7, futex.7, ip.7, ipv6.7, locale.7, man-pages.7, man.7, math_error.7, netdevice.7, netlink.7, packet.7, raw.7, rtld-audit.7, rtnetlink.7, sock_diag.7, socket.7, tcp.7, udp.7, udplite.7, unix.7, uri.7, vdso.7: Formatting fix: replace blank lines with .PP/.IP
Blank lines shouldn't generally appear in *roff source (other
than in code examples), since they create large vertical
spaces between text blocks.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-16 01:01:48 +00:00
|
|
|
.IP
|
2016-03-01 08:40:22 +00:00
|
|
|
The BPF program must return an index between 0 and N\-1 representing
|
|
|
|
the socket which should receive the packet
|
|
|
|
(where N is the number of sockets in the group).
|
|
|
|
If the BPF program returns an invalid index,
|
|
|
|
socket selection will fall back to the plain
|
2016-02-29 17:36:39 +00:00
|
|
|
.BR SO_REUSEPORT
|
|
|
|
mechanism.
|
environ.7, epoll.7, feature_test_macros.7, futex.7, ip.7, ipv6.7, locale.7, man-pages.7, man.7, math_error.7, netdevice.7, netlink.7, packet.7, raw.7, rtld-audit.7, rtnetlink.7, sock_diag.7, socket.7, tcp.7, udp.7, udplite.7, unix.7, uri.7, vdso.7: Formatting fix: replace blank lines with .PP/.IP
Blank lines shouldn't generally appear in *roff source (other
than in code examples), since they create large vertical
spaces between text blocks.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-16 01:01:48 +00:00
|
|
|
.IP
|
2016-02-29 17:36:39 +00:00
|
|
|
Sockets are numbered in the order in which they are added to the group
|
|
|
|
(that is, the order of
|
|
|
|
.BR bind (2)
|
|
|
|
calls for UDP sockets or the order of
|
|
|
|
.BR listen (2)
|
2016-03-01 08:40:22 +00:00
|
|
|
calls for TCP sockets).
|
|
|
|
New sockets added to a reuseport group will inherit the BPF program.
|
|
|
|
When a socket is removed from a reuseport group (via
|
|
|
|
.BR close (2)),
|
2016-02-29 17:36:39 +00:00
|
|
|
the last socket in the group will be moved into the closed socket's
|
|
|
|
position.
|
environ.7, epoll.7, feature_test_macros.7, futex.7, ip.7, ipv6.7, locale.7, man-pages.7, man.7, math_error.7, netdevice.7, netlink.7, packet.7, raw.7, rtld-audit.7, rtnetlink.7, sock_diag.7, socket.7, tcp.7, udp.7, udplite.7, unix.7, uri.7, vdso.7: Formatting fix: replace blank lines with .PP/.IP
Blank lines shouldn't generally appear in *roff source (other
than in code examples), since they create large vertical
spaces between text blocks.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-16 01:01:48 +00:00
|
|
|
.IP
|
2016-03-01 08:40:22 +00:00
|
|
|
These options may be set repeatedly at any time on any socket in the group
|
|
|
|
to replace the current BPF program used by all sockets in the group.
|
environ.7, epoll.7, feature_test_macros.7, futex.7, ip.7, ipv6.7, locale.7, man-pages.7, man.7, math_error.7, netdevice.7, netlink.7, packet.7, raw.7, rtld-audit.7, rtnetlink.7, sock_diag.7, socket.7, tcp.7, udp.7, udplite.7, unix.7, uri.7, vdso.7: Formatting fix: replace blank lines with .PP/.IP
Blank lines shouldn't generally appear in *roff source (other
than in code examples), since they create large vertical
spaces between text blocks.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-16 01:01:48 +00:00
|
|
|
.IP
|
2016-02-29 17:36:39 +00:00
|
|
|
.BR SO_ATTACH_REUSEPORT_CBPF
|
2016-03-01 08:40:22 +00:00
|
|
|
takes the same argument type as
|
2016-02-29 17:36:39 +00:00
|
|
|
.BR SO_ATTACH_FILTER
|
|
|
|
and
|
|
|
|
.BR SO_ATTACH_REUSEPORT_EBPF
|
2016-03-01 08:40:22 +00:00
|
|
|
takes the same argument type as
|
2016-02-29 17:36:39 +00:00
|
|
|
.BR SO_ATTACH_BPF.
|
environ.7, epoll.7, feature_test_macros.7, futex.7, ip.7, ipv6.7, locale.7, man-pages.7, man.7, math_error.7, netdevice.7, netlink.7, packet.7, raw.7, rtld-audit.7, rtnetlink.7, sock_diag.7, socket.7, tcp.7, udp.7, udplite.7, unix.7, uri.7, vdso.7: Formatting fix: replace blank lines with .PP/.IP
Blank lines shouldn't generally appear in *roff source (other
than in code examples), since they create large vertical
spaces between text blocks.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-16 01:01:48 +00:00
|
|
|
.IP
|
2016-03-01 08:40:22 +00:00
|
|
|
UDP support for this feature is available since Linux 4.5;
|
|
|
|
TCP support is available since Linux 4.6.
|
2016-02-29 17:36:39 +00:00
|
|
|
.TP
|
2008-08-08 16:41:48 +00:00
|
|
|
.B SO_BINDTODEVICE
|
|
|
|
Bind this socket to a particular device like \(lqeth0\(rq,
|
|
|
|
as specified in the passed interface name.
|
|
|
|
If the
|
|
|
|
name is an empty string or the option length is zero, the socket device
|
|
|
|
binding is removed.
|
2008-09-26 05:13:25 +00:00
|
|
|
The passed option is a variable-length null-terminated
|
2008-08-08 16:41:48 +00:00
|
|
|
interface name string with the maximum size of
|
|
|
|
.BR IFNAMSIZ .
|
|
|
|
If a socket is bound to an interface,
|
|
|
|
only packets received from that particular interface are processed by the
|
|
|
|
socket.
|
intro.1, _syscall.2, access.2, arch_prctl.2, cacheflush.2, chown.2, clock_getres.2, clone.2, create_module.2, fcntl.2, flock.2, get_kernel_syms.2, get_robust_list.2, get_thread_area.2, getcpu.2, getpriority.2, getrlimit.2, getrusage.2, ioprio_set.2, kexec_load.2, madvise.2, mbind.2, migrate_pages.2, mknod.2, mmap.2, mount.2, move_pages.2, mprotect.2, open.2, pause.2, pciconfig_read.2, perf_event_open.2, prctl.2, ptrace.2, query_module.2, read.2, reboot.2, recv.2, s390_runtime_instr.2, sched_setscheduler.2, select_tut.2, send.2, set_mempolicy.2, setfsgid.2, setfsuid.2, sigaction.2, spu_create.2, spu_run.2, stime.2, swapon.2, syslog.2, timer_create.2, timer_getoverrun.2, times.2, tkill.2, umount.2, unimplemented.2, ustat.2, vm86.2, wait.2, abs.3, aio_read.3, aio_write.3, bsd_signal.3, catgets.3, clearenv.3, cmsg.3, dbopen.3, dirfd.3, dlopen.3, exec.3, fenv.3, ferror.3, fmemopen.3, fnmatch.3, fopen.3, futimes.3, getaddrinfo.3, getifaddrs.3, getipnodebyname.3, hsearch.3, if_nameindex.3, inet_pton.3, mblen.3, mbrlen.3, mbsrtowcs.3, mbtowc.3, mcheck.3, memfrob.3, mq_notify.3, netlink.3, posix_memalign.3, printf.3, pthread_attr_setscope.3, pthread_cleanup_push.3, pthread_kill_other_threads_np.3, pthread_self.3, pthread_setcancelstate.3, pthread_setconcurrency.3, raise.3, resolver.3, rpc.3, rtime.3, rtnetlink.3, scanf.3, setbuf.3, setnetgrent.3, shm_open.3, sigpause.3, sigset.3, sigwait.3, sockatmark.3, strcasecmp.3, strcmp.3, strdup.3, strftime.3, strptime.3, strsignal.3, strverscmp.3, sysv_signal.3, termios.3, wcrtomb.3, wcsnlen.3, wcsnrtombs.3, wcsrtombs.3, wctomb.3, wprintf.3, console_codes.4, cpuid.4, msr.4, rtc.4, sk98lin.4, st.4, tty.4, charmap.5, core.5, elf.5, hosts.equiv.5, proc.5, resolv.conf.5, services.5, slabinfo.5, arp.7, bootparam.7, capabilities.7, charsets.7, cpuset.7, ddp.7, epoll.7, feature_test_macros.7, futex.7, hier.7, icmp.7, inotify.7, ip.7, ipv6.7, man-pages.7, mdoc.7, mdoc.samples.7, netdevice.7, netlink.7, numa.7, packet.7, path_resolution.7, posixoptions.7, pthreads.7, raw.7, rtld-audit.7, rtnetlink.7, sem_overview.7, sigevent.7, socket.7, spufs.7, tcp.7, udp.7, unicode.7, uri.7, utf-8.7, intro.8, ldconfig.8, sync.8: Global fix: fix placement of word "only"
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2013-03-31 08:53:00 +00:00
|
|
|
Note that this works only for some socket types, particularly
|
2008-08-08 16:41:48 +00:00
|
|
|
.B AF_INET
|
|
|
|
sockets.
|
|
|
|
It is not supported for packet sockets (use normal
|
2011-09-09 01:01:52 +00:00
|
|
|
.BR bind (2)
|
2008-08-08 16:41:48 +00:00
|
|
|
there).
|
environ.7, epoll.7, feature_test_macros.7, futex.7, ip.7, ipv6.7, locale.7, man-pages.7, man.7, math_error.7, netdevice.7, netlink.7, packet.7, raw.7, rtld-audit.7, rtnetlink.7, sock_diag.7, socket.7, tcp.7, udp.7, udplite.7, unix.7, uri.7, vdso.7: Formatting fix: replace blank lines with .PP/.IP
Blank lines shouldn't generally appear in *roff source (other
than in code examples), since they create large vertical
spaces between text blocks.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-16 01:01:48 +00:00
|
|
|
.IP
|
2013-02-28 14:08:26 +00:00
|
|
|
Before Linux 3.8,
|
|
|
|
this socket option could be set, but could not retrieved with
|
|
|
|
.BR getsockopt (2).
|
|
|
|
Since Linux 3.8, it is readable.
|
|
|
|
The
|
|
|
|
.I optlen
|
2013-03-05 17:22:04 +00:00
|
|
|
argument should contain the buffer size available
|
2013-02-28 14:08:26 +00:00
|
|
|
to receive the device name and is recommended to be
|
2013-02-28 14:04:05 +00:00
|
|
|
.BR IFNAMSZ
|
2013-02-28 14:08:26 +00:00
|
|
|
bytes.
|
|
|
|
The real device name length is reported back in the
|
|
|
|
.I optlen
|
|
|
|
argument.
|
2008-08-08 16:41:48 +00:00
|
|
|
.TP
|
|
|
|
.B SO_BROADCAST
|
|
|
|
Set or get the broadcast flag.
|
2012-04-23 09:02:31 +00:00
|
|
|
When enabled, datagram sockets are allowed to send
|
2008-08-08 16:41:48 +00:00
|
|
|
packets to a broadcast address.
|
|
|
|
This option has no effect on stream-oriented sockets.
|
|
|
|
.TP
|
|
|
|
.B SO_BSDCOMPAT
|
|
|
|
Enable BSD bug-to-bug compatibility.
|
|
|
|
This is used by the UDP protocol module in Linux 2.0 and 2.2.
|
2014-03-26 05:10:59 +00:00
|
|
|
If enabled, ICMP errors received for a UDP socket will not be passed
|
2008-08-08 16:41:48 +00:00
|
|
|
to the user program.
|
|
|
|
In later kernel versions, support for this option has been phased out:
|
|
|
|
Linux 2.4 silently ignores it, and Linux 2.6 generates a kernel warning
|
|
|
|
(printk()) if a program uses this option.
|
|
|
|
Linux 2.0 also enabled BSD bug-to-bug compatibility
|
|
|
|
options (random header changing, skipping of the broadcast flag) for raw
|
|
|
|
sockets with this option, but that was removed in Linux 2.2.
|
|
|
|
.TP
|
|
|
|
.B SO_DEBUG
|
|
|
|
Enable socket debugging.
|
2016-11-11 08:34:08 +00:00
|
|
|
Allowed only for processes with the
|
2008-08-08 16:41:48 +00:00
|
|
|
.B CAP_NET_ADMIN
|
|
|
|
capability or an effective user ID of 0.
|
|
|
|
.TP
|
2016-03-01 08:40:22 +00:00
|
|
|
.BR SO_DETACH_FILTER " (since Linux 2.2), " SO_DETACH_BPF " (since Linux 3.19)"
|
|
|
|
These two options, which are synonyms,
|
|
|
|
may be used to remove the classic or extended BPF
|
|
|
|
program attached to a socket with either
|
2016-02-29 17:36:39 +00:00
|
|
|
.BR SO_ATTACH_FILTER
|
|
|
|
or
|
2016-03-01 08:40:22 +00:00
|
|
|
.BR SO_ATTACH_BPF .
|
2016-02-29 17:36:39 +00:00
|
|
|
The option value is ignored.
|
|
|
|
.TP
|
2010-06-13 02:21:37 +00:00
|
|
|
.BR SO_DOMAIN " (since Linux 2.6.32)"
|
|
|
|
Retrieves the socket domain as an integer, returning a value such as
|
|
|
|
.BR AF_INET6 .
|
|
|
|
See
|
|
|
|
.BR socket (2)
|
|
|
|
for details.
|
2010-06-13 02:26:57 +00:00
|
|
|
This socket option is read-only.
|
2010-06-13 02:21:37 +00:00
|
|
|
.TP
|
2008-08-08 16:41:48 +00:00
|
|
|
.B SO_ERROR
|
|
|
|
Get and clear the pending socket error.
|
2010-06-13 02:26:57 +00:00
|
|
|
This socket option is read-only.
|
2008-08-08 16:41:48 +00:00
|
|
|
Expects an integer.
|
|
|
|
.TP
|
|
|
|
.B SO_DONTROUTE
|
intro.1, _syscall.2, access.2, arch_prctl.2, cacheflush.2, chown.2, clock_getres.2, clone.2, create_module.2, fcntl.2, flock.2, get_kernel_syms.2, get_robust_list.2, get_thread_area.2, getcpu.2, getpriority.2, getrlimit.2, getrusage.2, ioprio_set.2, kexec_load.2, madvise.2, mbind.2, migrate_pages.2, mknod.2, mmap.2, mount.2, move_pages.2, mprotect.2, open.2, pause.2, pciconfig_read.2, perf_event_open.2, prctl.2, ptrace.2, query_module.2, read.2, reboot.2, recv.2, s390_runtime_instr.2, sched_setscheduler.2, select_tut.2, send.2, set_mempolicy.2, setfsgid.2, setfsuid.2, sigaction.2, spu_create.2, spu_run.2, stime.2, swapon.2, syslog.2, timer_create.2, timer_getoverrun.2, times.2, tkill.2, umount.2, unimplemented.2, ustat.2, vm86.2, wait.2, abs.3, aio_read.3, aio_write.3, bsd_signal.3, catgets.3, clearenv.3, cmsg.3, dbopen.3, dirfd.3, dlopen.3, exec.3, fenv.3, ferror.3, fmemopen.3, fnmatch.3, fopen.3, futimes.3, getaddrinfo.3, getifaddrs.3, getipnodebyname.3, hsearch.3, if_nameindex.3, inet_pton.3, mblen.3, mbrlen.3, mbsrtowcs.3, mbtowc.3, mcheck.3, memfrob.3, mq_notify.3, netlink.3, posix_memalign.3, printf.3, pthread_attr_setscope.3, pthread_cleanup_push.3, pthread_kill_other_threads_np.3, pthread_self.3, pthread_setcancelstate.3, pthread_setconcurrency.3, raise.3, resolver.3, rpc.3, rtime.3, rtnetlink.3, scanf.3, setbuf.3, setnetgrent.3, shm_open.3, sigpause.3, sigset.3, sigwait.3, sockatmark.3, strcasecmp.3, strcmp.3, strdup.3, strftime.3, strptime.3, strsignal.3, strverscmp.3, sysv_signal.3, termios.3, wcrtomb.3, wcsnlen.3, wcsnrtombs.3, wcsrtombs.3, wctomb.3, wprintf.3, console_codes.4, cpuid.4, msr.4, rtc.4, sk98lin.4, st.4, tty.4, charmap.5, core.5, elf.5, hosts.equiv.5, proc.5, resolv.conf.5, services.5, slabinfo.5, arp.7, bootparam.7, capabilities.7, charsets.7, cpuset.7, ddp.7, epoll.7, feature_test_macros.7, futex.7, hier.7, icmp.7, inotify.7, ip.7, ipv6.7, man-pages.7, mdoc.7, mdoc.samples.7, netdevice.7, netlink.7, numa.7, packet.7, path_resolution.7, posixoptions.7, pthreads.7, raw.7, rtld-audit.7, rtnetlink.7, sem_overview.7, sigevent.7, socket.7, spufs.7, tcp.7, udp.7, unicode.7, uri.7, utf-8.7, intro.8, ldconfig.8, sync.8: Global fix: fix placement of word "only"
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2013-03-31 08:53:00 +00:00
|
|
|
Don't send via a gateway, send only to directly connected hosts.
|
2008-08-08 16:41:48 +00:00
|
|
|
The same effect can be achieved by setting the
|
|
|
|
.B MSG_DONTROUTE
|
|
|
|
flag on a socket
|
|
|
|
.BR send (2)
|
|
|
|
operation.
|
|
|
|
Expects an integer boolean flag.
|
|
|
|
.TP
|
2017-02-19 07:52:07 +00:00
|
|
|
.BR SO_INCOMING_CPU " (gettable since Linux 3.19, settable since Linux 4.4)"
|
|
|
|
.\" getsockopt 2c8c56e15df3d4c2af3d656e44feb18789f75837
|
|
|
|
.\" setsockopt 70da268b569d32a9fddeea85dc18043de9d89f89
|
|
|
|
Sets or gets the CPU affinity of a socket.
|
|
|
|
Expects an integer flag.
|
environ.7, epoll.7, feature_test_macros.7, futex.7, ip.7, ipv6.7, locale.7, man-pages.7, man.7, math_error.7, netdevice.7, netlink.7, packet.7, raw.7, rtld-audit.7, rtnetlink.7, sock_diag.7, socket.7, tcp.7, udp.7, udplite.7, unix.7, uri.7, vdso.7: Formatting fix: replace blank lines with .PP/.IP
Blank lines shouldn't generally appear in *roff source (other
than in code examples), since they create large vertical
spaces between text blocks.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-16 01:01:48 +00:00
|
|
|
.IP
|
2017-02-19 07:46:17 +00:00
|
|
|
.in +4n
|
execve.2, ioctl_console.2, ioctl_iflags.2, ioctl_ns.2, ioctl_userfaultfd.2, kcmp.2, kexec_load.2, keyctl.2, link.2, listxattr.2, membarrier.2, memfd_create.2, mmap.2, modify_ldt.2, mprotect.2, msgctl.2, nanosleep.2, open_by_handle_at.2, perf_event_open.2, poll.2, posix_fadvise.2, process_vm_readv.2, ptrace.2, query_module.2, quotactl.2, readdir.2, readv.2, recv.2, recvmmsg.2, request_key.2, sched_rr_get_interval.2, sched_setaffinity.2, sched_setattr.2, sched_setscheduler.2, seccomp.2, select.2, select_tut.2, semctl.2, semop.2, send.2, sendmmsg.2, set_thread_area.2, setns.2, shmctl.2, shmget.2, sigaction.2, sigaltstack.2, signal.2, sigwaitinfo.2, stat.2, statfs.2, statx.2, sync_file_range.2, syscall.2, sysctl.2, sysinfo.2, tee.2, timer_create.2, timer_settime.2, timerfd_create.2, unshare.2, userfaultfd.2, ustat.2, utime.2, utimensat.2, vmsplice.2, wait.2, adjtime.3, aio_init.3, backtrace.3, basename.3, bswap.3, btree.3, clock_getcpuclockid.3, cmsg.3, confstr.3, dbopen.3, dl_iterate_phdr.3, dladdr.3, dlinfo.3, dlopen.3, duplocale.3, encrypt.3, end.3, endian.3, err.3, errno.3, ether_aton.3, fgetgrent.3, fgetpwent.3, fmemopen.3, frexp.3, ftime.3, fts.3, getaddrinfo.3, getaddrinfo_a.3, getdate.3, getfsent.3, getgrent.3, getgrent_r.3, getgrnam.3, getgrouplist.3, gethostbyname.3, getifaddrs.3, getipnodebyname.3, getmntent.3, getnameinfo.3, getnetent.3, getopt.3, getprotoent.3, getprotoent_r.3, getpw.3, getpwent.3, getpwent_r.3, getpwnam.3, getrpcent.3, getservent.3, getservent_r.3, getspnam.3, getttyent.3, glob.3, gnu_get_libc_version.3, hash.3, hsearch.3, if_nameindex.3, inet.3, inet_net_pton.3, inet_pton.3, insque.3, isalpha.3, makecontext.3, mallinfo.3, malloc_info.3, mallopt.3, matherr.3, mbstowcs.3, mcheck.3, memchr.3, mq_getattr.3, mq_open.3, mq_receive.3, mq_send.3, mtrace.3, newlocale.3, ntp_gettime.3, posix_openpt.3, printf.3, pthread_attr_init.3, pthread_attr_setschedparam.3, pthread_cancel.3, pthread_cleanup_push.3, pthread_cleanup_push_defer_np.3, pthread_create.3, pthread_getattr_default_np.3, pthread_getattr_np.3, pthread_getcpuclockid.3, pthread_setname_np.3, pthread_setschedparam.3, pthread_sigmask.3, pthread_tryjoin_np.3, readdir.3, realpath.3, recno.3, regex.3, rpc.3, scanf.3, sched_getcpu.3, sem_wait.3, setaliasent.3, sigqueue.3, statvfs.3, strcat.3, strcpy.3, strftime.3, strtok.3, strtol.3, strverscmp.3, toupper.3, ttyslot.3, xdr.3, fuse.4, loop.4, rtc.4, st.4, acct.5, core.5, elf.5, slabinfo.5, aio.7, arp.7, capabilities.7, cgroup_namespaces.7, cgroups.7, ddp.7, fanotify.7, feature_test_macros.7, inode.7, inotify.7, ip.7, keyrings.7, locale.7, mount_namespaces.7, namespaces.7, netdevice.7, netlink.7, packet.7, pkeys.7, pthreads.7, sched.7, session-keyring.7, sock_diag.7, socket.7, spufs.7, udplite.7, unix.7, user_namespaces.7, vdso.7, x25.7, ld.so.8: Use consistent markup for code snippets
Change .nf/.fi to .EX/.EE
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-18 19:52:46 +00:00
|
|
|
.EX
|
2017-02-19 07:46:17 +00:00
|
|
|
int cpu = 1;
|
|
|
|
socklen_t len = sizeof(cpu);
|
|
|
|
setsockopt(fd, SOL_SOCKET, SO_INCOMING_CPU, &cpu, &len);
|
execve.2, ioctl_console.2, ioctl_iflags.2, ioctl_ns.2, ioctl_userfaultfd.2, kcmp.2, kexec_load.2, keyctl.2, link.2, listxattr.2, membarrier.2, memfd_create.2, mmap.2, modify_ldt.2, mprotect.2, msgctl.2, nanosleep.2, open_by_handle_at.2, perf_event_open.2, poll.2, posix_fadvise.2, process_vm_readv.2, ptrace.2, query_module.2, quotactl.2, readdir.2, readv.2, recv.2, recvmmsg.2, request_key.2, sched_rr_get_interval.2, sched_setaffinity.2, sched_setattr.2, sched_setscheduler.2, seccomp.2, select.2, select_tut.2, semctl.2, semop.2, send.2, sendmmsg.2, set_thread_area.2, setns.2, shmctl.2, shmget.2, sigaction.2, sigaltstack.2, signal.2, sigwaitinfo.2, stat.2, statfs.2, statx.2, sync_file_range.2, syscall.2, sysctl.2, sysinfo.2, tee.2, timer_create.2, timer_settime.2, timerfd_create.2, unshare.2, userfaultfd.2, ustat.2, utime.2, utimensat.2, vmsplice.2, wait.2, adjtime.3, aio_init.3, backtrace.3, basename.3, bswap.3, btree.3, clock_getcpuclockid.3, cmsg.3, confstr.3, dbopen.3, dl_iterate_phdr.3, dladdr.3, dlinfo.3, dlopen.3, duplocale.3, encrypt.3, end.3, endian.3, err.3, errno.3, ether_aton.3, fgetgrent.3, fgetpwent.3, fmemopen.3, frexp.3, ftime.3, fts.3, getaddrinfo.3, getaddrinfo_a.3, getdate.3, getfsent.3, getgrent.3, getgrent_r.3, getgrnam.3, getgrouplist.3, gethostbyname.3, getifaddrs.3, getipnodebyname.3, getmntent.3, getnameinfo.3, getnetent.3, getopt.3, getprotoent.3, getprotoent_r.3, getpw.3, getpwent.3, getpwent_r.3, getpwnam.3, getrpcent.3, getservent.3, getservent_r.3, getspnam.3, getttyent.3, glob.3, gnu_get_libc_version.3, hash.3, hsearch.3, if_nameindex.3, inet.3, inet_net_pton.3, inet_pton.3, insque.3, isalpha.3, makecontext.3, mallinfo.3, malloc_info.3, mallopt.3, matherr.3, mbstowcs.3, mcheck.3, memchr.3, mq_getattr.3, mq_open.3, mq_receive.3, mq_send.3, mtrace.3, newlocale.3, ntp_gettime.3, posix_openpt.3, printf.3, pthread_attr_init.3, pthread_attr_setschedparam.3, pthread_cancel.3, pthread_cleanup_push.3, pthread_cleanup_push_defer_np.3, pthread_create.3, pthread_getattr_default_np.3, pthread_getattr_np.3, pthread_getcpuclockid.3, pthread_setname_np.3, pthread_setschedparam.3, pthread_sigmask.3, pthread_tryjoin_np.3, readdir.3, realpath.3, recno.3, regex.3, rpc.3, scanf.3, sched_getcpu.3, sem_wait.3, setaliasent.3, sigqueue.3, statvfs.3, strcat.3, strcpy.3, strftime.3, strtok.3, strtol.3, strverscmp.3, toupper.3, ttyslot.3, xdr.3, fuse.4, loop.4, rtc.4, st.4, acct.5, core.5, elf.5, slabinfo.5, aio.7, arp.7, capabilities.7, cgroup_namespaces.7, cgroups.7, ddp.7, fanotify.7, feature_test_macros.7, inode.7, inotify.7, ip.7, keyrings.7, locale.7, mount_namespaces.7, namespaces.7, netdevice.7, netlink.7, packet.7, pkeys.7, pthreads.7, sched.7, session-keyring.7, sock_diag.7, socket.7, spufs.7, udplite.7, unix.7, user_namespaces.7, vdso.7, x25.7, ld.so.8: Use consistent markup for code snippets
Change .nf/.fi to .EX/.EE
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-18 19:52:46 +00:00
|
|
|
.EE
|
2017-02-19 07:46:17 +00:00
|
|
|
.in
|
environ.7, epoll.7, feature_test_macros.7, futex.7, ip.7, ipv6.7, locale.7, man-pages.7, man.7, math_error.7, netdevice.7, netlink.7, packet.7, raw.7, rtld-audit.7, rtnetlink.7, sock_diag.7, socket.7, tcp.7, udp.7, udplite.7, unix.7, uri.7, vdso.7: Formatting fix: replace blank lines with .PP/.IP
Blank lines shouldn't generally appear in *roff source (other
than in code examples), since they create large vertical
spaces between text blocks.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-16 01:01:48 +00:00
|
|
|
.IP
|
2017-02-19 08:19:57 +00:00
|
|
|
Because all of the packets for a single stream
|
|
|
|
(i.e., all packets for the same 4-tuple)
|
|
|
|
arrive on the single RX queue that is associated with a particular CPU,
|
|
|
|
the typical use case is to employ one listening process per RX queue,
|
|
|
|
with the incoming flow being handled by a listener
|
|
|
|
on the same CPU that is handling the RX queue.
|
2017-02-19 07:52:07 +00:00
|
|
|
This provides optimal NUMA behavior and keeps CPU caches hot.
|
2017-04-20 14:42:14 +00:00
|
|
|
.\"
|
|
|
|
.\" From an email conversation with Eric Dumazet:
|
|
|
|
.\" >> Note that setting the option is not supported if SO_REUSEPORT is used.
|
|
|
|
.\" >
|
|
|
|
.\" > Please define "not supported". Does this yield an API diagnostic?
|
|
|
|
.\" > If so, what is it?
|
|
|
|
.\" >
|
|
|
|
.\" >> Socket will be selected from an array, either by a hash or BPF program
|
|
|
|
.\" >> that has no access to this information.
|
|
|
|
.\" >
|
|
|
|
.\" > Sorry -- I'm lost here. How does this comment relate to the proposed
|
|
|
|
.\" > man page text above?
|
2017-05-03 17:28:59 +00:00
|
|
|
.\"
|
2017-04-20 14:42:14 +00:00
|
|
|
.\" Simply that :
|
2017-05-03 17:28:59 +00:00
|
|
|
.\"
|
2017-04-20 14:42:14 +00:00
|
|
|
.\" If an application uses both SO_INCOMING_CPU and SO_REUSEPORT, then
|
|
|
|
.\" SO_REUSEPORT logic, selecting the socket to receive the packet, ignores
|
|
|
|
.\" SO_INCOMING_CPU setting.
|
2017-02-19 07:46:17 +00:00
|
|
|
.TP
|
2008-08-08 16:41:48 +00:00
|
|
|
.B SO_KEEPALIVE
|
|
|
|
Enable sending of keep-alive messages on connection-oriented sockets.
|
|
|
|
Expects an integer boolean flag.
|
|
|
|
.TP
|
|
|
|
.B SO_LINGER
|
|
|
|
Sets or gets the
|
|
|
|
.B SO_LINGER
|
|
|
|
option.
|
|
|
|
The argument is a
|
|
|
|
.I linger
|
|
|
|
structure.
|
dir_colors.5, feature_test_macros.7, glob.7, ip.7, ipv6.7, man-pages.7, man.7, netdevice.7, rtnetlink.7, socket.7, svipc.7, tcp.7, units.7, user_namespaces.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-17 22:55:49 +00:00
|
|
|
.IP
|
2008-08-08 16:41:48 +00:00
|
|
|
.in +4n
|
dir_colors.5, feature_test_macros.7, glob.7, ip.7, ipv6.7, man-pages.7, man.7, netdevice.7, rtnetlink.7, socket.7, svipc.7, tcp.7, units.7, user_namespaces.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-17 22:55:49 +00:00
|
|
|
.EX
|
2008-08-08 16:41:48 +00:00
|
|
|
struct linger {
|
|
|
|
int l_onoff; /* linger active */
|
|
|
|
int l_linger; /* how many seconds to linger for */
|
|
|
|
};
|
dir_colors.5, feature_test_macros.7, glob.7, ip.7, ipv6.7, man-pages.7, man.7, netdevice.7, rtnetlink.7, socket.7, svipc.7, tcp.7, units.7, user_namespaces.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-17 22:55:49 +00:00
|
|
|
.EE
|
2008-08-08 16:41:48 +00:00
|
|
|
.in
|
|
|
|
.IP
|
|
|
|
When enabled, a
|
|
|
|
.BR close (2)
|
|
|
|
or
|
|
|
|
.BR shutdown (2)
|
|
|
|
will not return until all queued messages for the socket have been
|
|
|
|
successfully sent or the linger timeout has been reached.
|
|
|
|
Otherwise,
|
|
|
|
the call returns immediately and the closing is done in the background.
|
|
|
|
When the socket is closed as part of
|
|
|
|
.BR exit (2),
|
|
|
|
it always lingers in the background.
|
|
|
|
.TP
|
2016-02-29 17:36:39 +00:00
|
|
|
.B SO_LOCK_FILTER
|
2016-03-01 08:40:22 +00:00
|
|
|
.\" commit d59577b6ffd313d0ab3be39cb1ab47e29bdc9182
|
2016-03-01 10:24:11 +00:00
|
|
|
When set, this option will prevent
|
2016-03-01 08:40:22 +00:00
|
|
|
changing the filters associated with the socket.
|
|
|
|
These filters include any set using the socket options
|
2016-02-29 17:36:39 +00:00
|
|
|
.BR SO_ATTACH_FILTER,
|
|
|
|
.BR SO_ATTACH_BPF,
|
|
|
|
.BR SO_ATTACH_REUSEPORT_CBPF
|
2016-03-01 08:40:22 +00:00
|
|
|
and
|
|
|
|
.BR SO_ATTACH_REUSEPORT_EPBF .
|
environ.7, epoll.7, feature_test_macros.7, futex.7, ip.7, ipv6.7, locale.7, man-pages.7, man.7, math_error.7, netdevice.7, netlink.7, packet.7, raw.7, rtld-audit.7, rtnetlink.7, sock_diag.7, socket.7, tcp.7, udp.7, udplite.7, unix.7, uri.7, vdso.7: Formatting fix: replace blank lines with .PP/.IP
Blank lines shouldn't generally appear in *roff source (other
than in code examples), since they create large vertical
spaces between text blocks.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-16 01:01:48 +00:00
|
|
|
.IP
|
2016-03-01 20:22:29 +00:00
|
|
|
The typical use case is for a privileged process to set up a raw socket
|
|
|
|
(an operation that requires the
|
|
|
|
.BR CAP_NET_RAW
|
|
|
|
capability), apply a restrictive filter, set the
|
|
|
|
.BR SO_LOCK_FILTER
|
|
|
|
option,
|
2016-02-29 17:36:39 +00:00
|
|
|
and then either drop its privileges or pass the socket file descriptor
|
2016-03-01 20:22:29 +00:00
|
|
|
to an unprivileged process via a UNIX domain socket.
|
environ.7, epoll.7, feature_test_macros.7, futex.7, ip.7, ipv6.7, locale.7, man-pages.7, man.7, math_error.7, netdevice.7, netlink.7, packet.7, raw.7, rtld-audit.7, rtnetlink.7, sock_diag.7, socket.7, tcp.7, udp.7, udplite.7, unix.7, uri.7, vdso.7: Formatting fix: replace blank lines with .PP/.IP
Blank lines shouldn't generally appear in *roff source (other
than in code examples), since they create large vertical
spaces between text blocks.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-16 01:01:48 +00:00
|
|
|
.IP
|
2016-03-01 08:40:22 +00:00
|
|
|
Once the
|
|
|
|
.BR SO_LOCK_FILTER
|
2016-03-01 10:24:11 +00:00
|
|
|
option has been enabled, attempts to change or remove the filter
|
2016-03-01 08:40:22 +00:00
|
|
|
attached to a socket, or to disable the
|
2016-02-29 17:36:39 +00:00
|
|
|
.BR SO_LOCK_FILTER
|
2016-03-01 08:40:22 +00:00
|
|
|
option will fail with the error
|
|
|
|
.BR EPERM .
|
2016-02-29 17:36:39 +00:00
|
|
|
.TP
|
2012-07-07 05:10:55 +00:00
|
|
|
.BR SO_MARK " (since Linux 2.6.25)"
|
|
|
|
.\" commit 4a19ec5800fc3bb64e2d87c4d9fdd9e636086fe0
|
|
|
|
.\" and 914a9ab386a288d0f22252fc268ecbc048cdcbd5
|
|
|
|
Set the mark for each packet sent through this socket
|
|
|
|
(similar to the netfilter MARK target but socket-based).
|
|
|
|
Changing the mark can be used for mark-based
|
|
|
|
routing without netfilter or for packet filtering.
|
|
|
|
Setting this option requires the
|
|
|
|
.B CAP_NET_ADMIN
|
|
|
|
capability.
|
|
|
|
.TP
|
2008-08-08 16:41:48 +00:00
|
|
|
.B SO_OOBINLINE
|
|
|
|
If this option is enabled,
|
|
|
|
out-of-band data is directly placed into the receive data stream.
|
time.1, get_kernel_syms.2, getitimer.2, open.2, perf_event_open.2, wait.2, alloca.3, bcmp.3, catopen.3, fputwc.3, iconv.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, mbsinit.3, putwchar.3, rcmd.3, rexec.3, sigqueue.3, strverscmp.3, wctrans.3, wctype.3, wcwidth.3, console_codes.4, initrd.4, st.4, elf.5, nss.5, ip.7, netdevice.7, path_resolution.7, socket.7, udp.7, ld.so.8: grfix: s/Otherwise /Otherwise, /
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2014-04-28 08:15:47 +00:00
|
|
|
Otherwise, out-of-band data is passed only when the
|
2008-08-08 16:41:48 +00:00
|
|
|
.B MSG_OOB
|
|
|
|
flag is set during receiving.
|
|
|
|
.\" don't document it because it can do too much harm.
|
|
|
|
.\".B SO_NO_CHECK
|
2015-05-06 08:02:57 +00:00
|
|
|
.\" The kernel has support for the SO_NO_CHECK socket
|
|
|
|
.\" option (boolean: 0 == default, calculate checksum on xmit,
|
|
|
|
.\" 1 == do not calculate checksum on xmit).
|
|
|
|
.\" Additional note from Andi Kleen on SO_NO_CHECK (2010-08-30)
|
|
|
|
.\" On Linux UDP checksums are essentially free and there's no reason
|
|
|
|
.\" to turn them off and it would disable another safety line.
|
|
|
|
.\" That is why I didn't document the option.
|
2008-08-08 16:41:48 +00:00
|
|
|
.TP
|
|
|
|
.B SO_PASSCRED
|
|
|
|
Enable or disable the receiving of the
|
|
|
|
.B SCM_CREDENTIALS
|
|
|
|
control message.
|
|
|
|
For more information see
|
|
|
|
.BR unix (7).
|
|
|
|
.\" FIXME Document SO_PASSSEC, added in 2.6.18; there is some info
|
|
|
|
.\" in the 2.6.18 ChangeLog
|
|
|
|
.TP
|
2013-04-18 14:01:38 +00:00
|
|
|
.BR SO_PEEK_OFF " (since Linux 3.4)"
|
|
|
|
.\" commit ef64a54f6e558155b4f149bb10666b9e914b6c54
|
|
|
|
This option, which is currently supported only for
|
|
|
|
.BR unix (7)
|
|
|
|
sockets, sets the value of the "peek offset" for the
|
2014-02-08 12:19:10 +00:00
|
|
|
.BR recv (2)
|
2013-04-18 14:01:38 +00:00
|
|
|
system call when used with
|
|
|
|
.BR MSG_PEEK
|
|
|
|
flag.
|
environ.7, epoll.7, feature_test_macros.7, futex.7, ip.7, ipv6.7, locale.7, man-pages.7, man.7, math_error.7, netdevice.7, netlink.7, packet.7, raw.7, rtld-audit.7, rtnetlink.7, sock_diag.7, socket.7, tcp.7, udp.7, udplite.7, unix.7, uri.7, vdso.7: Formatting fix: replace blank lines with .PP/.IP
Blank lines shouldn't generally appear in *roff source (other
than in code examples), since they create large vertical
spaces between text blocks.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-16 01:01:48 +00:00
|
|
|
.IP
|
2013-04-18 14:01:38 +00:00
|
|
|
When this option is set to a negative value
|
|
|
|
(it is set to \-1 for all new sockets),
|
|
|
|
traditional behavior is provided:
|
2014-02-08 12:19:10 +00:00
|
|
|
.BR recv (2)
|
2013-04-18 14:01:38 +00:00
|
|
|
with the
|
|
|
|
.BR MSG_PEEK
|
|
|
|
flag will peek data from the front of the queue.
|
environ.7, epoll.7, feature_test_macros.7, futex.7, ip.7, ipv6.7, locale.7, man-pages.7, man.7, math_error.7, netdevice.7, netlink.7, packet.7, raw.7, rtld-audit.7, rtnetlink.7, sock_diag.7, socket.7, tcp.7, udp.7, udplite.7, unix.7, uri.7, vdso.7: Formatting fix: replace blank lines with .PP/.IP
Blank lines shouldn't generally appear in *roff source (other
than in code examples), since they create large vertical
spaces between text blocks.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-16 01:01:48 +00:00
|
|
|
.IP
|
2013-04-18 14:01:38 +00:00
|
|
|
When the option is set to a value greater than or equal to zero,
|
|
|
|
then the next peek at data queued in the socket will occur at
|
|
|
|
the byte offset specified by the option value.
|
|
|
|
At the same time, the "peek offset" will be
|
|
|
|
incremented by the number of bytes that were peeked from the queue,
|
2013-08-01 09:40:20 +00:00
|
|
|
so that a subsequent peek will return the next data in the queue.
|
environ.7, epoll.7, feature_test_macros.7, futex.7, ip.7, ipv6.7, locale.7, man-pages.7, man.7, math_error.7, netdevice.7, netlink.7, packet.7, raw.7, rtld-audit.7, rtnetlink.7, sock_diag.7, socket.7, tcp.7, udp.7, udplite.7, unix.7, uri.7, vdso.7: Formatting fix: replace blank lines with .PP/.IP
Blank lines shouldn't generally appear in *roff source (other
than in code examples), since they create large vertical
spaces between text blocks.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-16 01:01:48 +00:00
|
|
|
.IP
|
2013-04-18 14:01:38 +00:00
|
|
|
If data is removed from the front of the queue via a call to
|
|
|
|
.BR recv (2)
|
|
|
|
(or similar) without the
|
|
|
|
.BR MSG_PEEK
|
|
|
|
flag, the "peek offset" will be decreased by the number of bytes removed.
|
|
|
|
In other words, receiving data without the
|
|
|
|
.B MSG_PEEK
|
|
|
|
flag will cause the "peek offset" to be adjusted to maintain
|
|
|
|
the correct relative position in the queued data,
|
|
|
|
so that a subsequent peek will retrieve the data that would have been
|
|
|
|
retrieved had the data not been removed.
|
environ.7, epoll.7, feature_test_macros.7, futex.7, ip.7, ipv6.7, locale.7, man-pages.7, man.7, math_error.7, netdevice.7, netlink.7, packet.7, raw.7, rtld-audit.7, rtnetlink.7, sock_diag.7, socket.7, tcp.7, udp.7, udplite.7, unix.7, uri.7, vdso.7: Formatting fix: replace blank lines with .PP/.IP
Blank lines shouldn't generally appear in *roff source (other
than in code examples), since they create large vertical
spaces between text blocks.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-16 01:01:48 +00:00
|
|
|
.IP
|
2013-04-18 14:01:38 +00:00
|
|
|
For datagram sockets, if the "peek offset" points to the middle of a packet,
|
|
|
|
the data returned will be marked with the
|
|
|
|
.BR MSG_TRUNC
|
|
|
|
flag.
|
environ.7, epoll.7, feature_test_macros.7, futex.7, ip.7, ipv6.7, locale.7, man-pages.7, man.7, math_error.7, netdevice.7, netlink.7, packet.7, raw.7, rtld-audit.7, rtnetlink.7, sock_diag.7, socket.7, tcp.7, udp.7, udplite.7, unix.7, uri.7, vdso.7: Formatting fix: replace blank lines with .PP/.IP
Blank lines shouldn't generally appear in *roff source (other
than in code examples), since they create large vertical
spaces between text blocks.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-16 01:01:48 +00:00
|
|
|
.IP
|
2013-04-18 14:01:38 +00:00
|
|
|
The following example serves to illustrate the use of
|
|
|
|
.BR SO_PEEK_OFF .
|
|
|
|
Suppose a stream socket has the following queued input data:
|
environ.7, epoll.7, feature_test_macros.7, futex.7, ip.7, ipv6.7, locale.7, man-pages.7, man.7, math_error.7, netdevice.7, netlink.7, packet.7, raw.7, rtld-audit.7, rtnetlink.7, sock_diag.7, socket.7, tcp.7, udp.7, udplite.7, unix.7, uri.7, vdso.7: Formatting fix: replace blank lines with .PP/.IP
Blank lines shouldn't generally appear in *roff source (other
than in code examples), since they create large vertical
spaces between text blocks.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-16 01:01:48 +00:00
|
|
|
.IP
|
2013-04-18 14:01:38 +00:00
|
|
|
aabbccddeeff
|
|
|
|
.IP
|
|
|
|
The following sequence of
|
|
|
|
.BR recv (2)
|
|
|
|
calls would have the effect noted in the comments:
|
environ.7, epoll.7, feature_test_macros.7, futex.7, ip.7, ipv6.7, locale.7, man-pages.7, man.7, math_error.7, netdevice.7, netlink.7, packet.7, raw.7, rtld-audit.7, rtnetlink.7, sock_diag.7, socket.7, tcp.7, udp.7, udplite.7, unix.7, uri.7, vdso.7: Formatting fix: replace blank lines with .PP/.IP
Blank lines shouldn't generally appear in *roff source (other
than in code examples), since they create large vertical
spaces between text blocks.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-16 01:01:48 +00:00
|
|
|
.IP
|
2013-04-18 14:01:38 +00:00
|
|
|
.in +4n
|
execve.2, ioctl_console.2, ioctl_iflags.2, ioctl_ns.2, ioctl_userfaultfd.2, kcmp.2, kexec_load.2, keyctl.2, link.2, listxattr.2, membarrier.2, memfd_create.2, mmap.2, modify_ldt.2, mprotect.2, msgctl.2, nanosleep.2, open_by_handle_at.2, perf_event_open.2, poll.2, posix_fadvise.2, process_vm_readv.2, ptrace.2, query_module.2, quotactl.2, readdir.2, readv.2, recv.2, recvmmsg.2, request_key.2, sched_rr_get_interval.2, sched_setaffinity.2, sched_setattr.2, sched_setscheduler.2, seccomp.2, select.2, select_tut.2, semctl.2, semop.2, send.2, sendmmsg.2, set_thread_area.2, setns.2, shmctl.2, shmget.2, sigaction.2, sigaltstack.2, signal.2, sigwaitinfo.2, stat.2, statfs.2, statx.2, sync_file_range.2, syscall.2, sysctl.2, sysinfo.2, tee.2, timer_create.2, timer_settime.2, timerfd_create.2, unshare.2, userfaultfd.2, ustat.2, utime.2, utimensat.2, vmsplice.2, wait.2, adjtime.3, aio_init.3, backtrace.3, basename.3, bswap.3, btree.3, clock_getcpuclockid.3, cmsg.3, confstr.3, dbopen.3, dl_iterate_phdr.3, dladdr.3, dlinfo.3, dlopen.3, duplocale.3, encrypt.3, end.3, endian.3, err.3, errno.3, ether_aton.3, fgetgrent.3, fgetpwent.3, fmemopen.3, frexp.3, ftime.3, fts.3, getaddrinfo.3, getaddrinfo_a.3, getdate.3, getfsent.3, getgrent.3, getgrent_r.3, getgrnam.3, getgrouplist.3, gethostbyname.3, getifaddrs.3, getipnodebyname.3, getmntent.3, getnameinfo.3, getnetent.3, getopt.3, getprotoent.3, getprotoent_r.3, getpw.3, getpwent.3, getpwent_r.3, getpwnam.3, getrpcent.3, getservent.3, getservent_r.3, getspnam.3, getttyent.3, glob.3, gnu_get_libc_version.3, hash.3, hsearch.3, if_nameindex.3, inet.3, inet_net_pton.3, inet_pton.3, insque.3, isalpha.3, makecontext.3, mallinfo.3, malloc_info.3, mallopt.3, matherr.3, mbstowcs.3, mcheck.3, memchr.3, mq_getattr.3, mq_open.3, mq_receive.3, mq_send.3, mtrace.3, newlocale.3, ntp_gettime.3, posix_openpt.3, printf.3, pthread_attr_init.3, pthread_attr_setschedparam.3, pthread_cancel.3, pthread_cleanup_push.3, pthread_cleanup_push_defer_np.3, pthread_create.3, pthread_getattr_default_np.3, pthread_getattr_np.3, pthread_getcpuclockid.3, pthread_setname_np.3, pthread_setschedparam.3, pthread_sigmask.3, pthread_tryjoin_np.3, readdir.3, realpath.3, recno.3, regex.3, rpc.3, scanf.3, sched_getcpu.3, sem_wait.3, setaliasent.3, sigqueue.3, statvfs.3, strcat.3, strcpy.3, strftime.3, strtok.3, strtol.3, strverscmp.3, toupper.3, ttyslot.3, xdr.3, fuse.4, loop.4, rtc.4, st.4, acct.5, core.5, elf.5, slabinfo.5, aio.7, arp.7, capabilities.7, cgroup_namespaces.7, cgroups.7, ddp.7, fanotify.7, feature_test_macros.7, inode.7, inotify.7, ip.7, keyrings.7, locale.7, mount_namespaces.7, namespaces.7, netdevice.7, netlink.7, packet.7, pkeys.7, pthreads.7, sched.7, session-keyring.7, sock_diag.7, socket.7, spufs.7, udplite.7, unix.7, user_namespaces.7, vdso.7, x25.7, ld.so.8: Use consistent markup for code snippets
Change .nf/.fi to .EX/.EE
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-18 19:52:46 +00:00
|
|
|
.EX
|
2013-04-18 14:01:38 +00:00
|
|
|
int ov = 4; // Set peek offset to 4
|
|
|
|
setsockopt(fd, SOL_SOCKET, SO_PEEK_OFF, &ov, sizeof(ov));
|
|
|
|
|
|
|
|
recv(fd, buf, 2, MSG_PEEK); // Peeks "cc"; offset set to 6
|
|
|
|
recv(fd, buf, 2, MSG_PEEK); // Peeks "dd"; offset set to 8
|
|
|
|
recv(fd, buf, 2, 0); // Reads "aa"; offset set to 6
|
|
|
|
recv(fd, buf, 2, MSG_PEEK); // Peeks "ee"; offset set to 8
|
execve.2, ioctl_console.2, ioctl_iflags.2, ioctl_ns.2, ioctl_userfaultfd.2, kcmp.2, kexec_load.2, keyctl.2, link.2, listxattr.2, membarrier.2, memfd_create.2, mmap.2, modify_ldt.2, mprotect.2, msgctl.2, nanosleep.2, open_by_handle_at.2, perf_event_open.2, poll.2, posix_fadvise.2, process_vm_readv.2, ptrace.2, query_module.2, quotactl.2, readdir.2, readv.2, recv.2, recvmmsg.2, request_key.2, sched_rr_get_interval.2, sched_setaffinity.2, sched_setattr.2, sched_setscheduler.2, seccomp.2, select.2, select_tut.2, semctl.2, semop.2, send.2, sendmmsg.2, set_thread_area.2, setns.2, shmctl.2, shmget.2, sigaction.2, sigaltstack.2, signal.2, sigwaitinfo.2, stat.2, statfs.2, statx.2, sync_file_range.2, syscall.2, sysctl.2, sysinfo.2, tee.2, timer_create.2, timer_settime.2, timerfd_create.2, unshare.2, userfaultfd.2, ustat.2, utime.2, utimensat.2, vmsplice.2, wait.2, adjtime.3, aio_init.3, backtrace.3, basename.3, bswap.3, btree.3, clock_getcpuclockid.3, cmsg.3, confstr.3, dbopen.3, dl_iterate_phdr.3, dladdr.3, dlinfo.3, dlopen.3, duplocale.3, encrypt.3, end.3, endian.3, err.3, errno.3, ether_aton.3, fgetgrent.3, fgetpwent.3, fmemopen.3, frexp.3, ftime.3, fts.3, getaddrinfo.3, getaddrinfo_a.3, getdate.3, getfsent.3, getgrent.3, getgrent_r.3, getgrnam.3, getgrouplist.3, gethostbyname.3, getifaddrs.3, getipnodebyname.3, getmntent.3, getnameinfo.3, getnetent.3, getopt.3, getprotoent.3, getprotoent_r.3, getpw.3, getpwent.3, getpwent_r.3, getpwnam.3, getrpcent.3, getservent.3, getservent_r.3, getspnam.3, getttyent.3, glob.3, gnu_get_libc_version.3, hash.3, hsearch.3, if_nameindex.3, inet.3, inet_net_pton.3, inet_pton.3, insque.3, isalpha.3, makecontext.3, mallinfo.3, malloc_info.3, mallopt.3, matherr.3, mbstowcs.3, mcheck.3, memchr.3, mq_getattr.3, mq_open.3, mq_receive.3, mq_send.3, mtrace.3, newlocale.3, ntp_gettime.3, posix_openpt.3, printf.3, pthread_attr_init.3, pthread_attr_setschedparam.3, pthread_cancel.3, pthread_cleanup_push.3, pthread_cleanup_push_defer_np.3, pthread_create.3, pthread_getattr_default_np.3, pthread_getattr_np.3, pthread_getcpuclockid.3, pthread_setname_np.3, pthread_setschedparam.3, pthread_sigmask.3, pthread_tryjoin_np.3, readdir.3, realpath.3, recno.3, regex.3, rpc.3, scanf.3, sched_getcpu.3, sem_wait.3, setaliasent.3, sigqueue.3, statvfs.3, strcat.3, strcpy.3, strftime.3, strtok.3, strtol.3, strverscmp.3, toupper.3, ttyslot.3, xdr.3, fuse.4, loop.4, rtc.4, st.4, acct.5, core.5, elf.5, slabinfo.5, aio.7, arp.7, capabilities.7, cgroup_namespaces.7, cgroups.7, ddp.7, fanotify.7, feature_test_macros.7, inode.7, inotify.7, ip.7, keyrings.7, locale.7, mount_namespaces.7, namespaces.7, netdevice.7, netlink.7, packet.7, pkeys.7, pthreads.7, sched.7, session-keyring.7, sock_diag.7, socket.7, spufs.7, udplite.7, unix.7, user_namespaces.7, vdso.7, x25.7, ld.so.8: Use consistent markup for code snippets
Change .nf/.fi to .EX/.EE
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-18 19:52:46 +00:00
|
|
|
.EE
|
2013-04-18 14:01:38 +00:00
|
|
|
.in
|
|
|
|
.TP
|
2008-08-08 16:41:48 +00:00
|
|
|
.B SO_PEERCRED
|
|
|
|
Return the credentials of the foreign process connected to this socket.
|
intro.1, _syscall.2, access.2, arch_prctl.2, cacheflush.2, chown.2, clock_getres.2, clone.2, create_module.2, fcntl.2, flock.2, get_kernel_syms.2, get_robust_list.2, get_thread_area.2, getcpu.2, getpriority.2, getrlimit.2, getrusage.2, ioprio_set.2, kexec_load.2, madvise.2, mbind.2, migrate_pages.2, mknod.2, mmap.2, mount.2, move_pages.2, mprotect.2, open.2, pause.2, pciconfig_read.2, perf_event_open.2, prctl.2, ptrace.2, query_module.2, read.2, reboot.2, recv.2, s390_runtime_instr.2, sched_setscheduler.2, select_tut.2, send.2, set_mempolicy.2, setfsgid.2, setfsuid.2, sigaction.2, spu_create.2, spu_run.2, stime.2, swapon.2, syslog.2, timer_create.2, timer_getoverrun.2, times.2, tkill.2, umount.2, unimplemented.2, ustat.2, vm86.2, wait.2, abs.3, aio_read.3, aio_write.3, bsd_signal.3, catgets.3, clearenv.3, cmsg.3, dbopen.3, dirfd.3, dlopen.3, exec.3, fenv.3, ferror.3, fmemopen.3, fnmatch.3, fopen.3, futimes.3, getaddrinfo.3, getifaddrs.3, getipnodebyname.3, hsearch.3, if_nameindex.3, inet_pton.3, mblen.3, mbrlen.3, mbsrtowcs.3, mbtowc.3, mcheck.3, memfrob.3, mq_notify.3, netlink.3, posix_memalign.3, printf.3, pthread_attr_setscope.3, pthread_cleanup_push.3, pthread_kill_other_threads_np.3, pthread_self.3, pthread_setcancelstate.3, pthread_setconcurrency.3, raise.3, resolver.3, rpc.3, rtime.3, rtnetlink.3, scanf.3, setbuf.3, setnetgrent.3, shm_open.3, sigpause.3, sigset.3, sigwait.3, sockatmark.3, strcasecmp.3, strcmp.3, strdup.3, strftime.3, strptime.3, strsignal.3, strverscmp.3, sysv_signal.3, termios.3, wcrtomb.3, wcsnlen.3, wcsnrtombs.3, wcsrtombs.3, wctomb.3, wprintf.3, console_codes.4, cpuid.4, msr.4, rtc.4, sk98lin.4, st.4, tty.4, charmap.5, core.5, elf.5, hosts.equiv.5, proc.5, resolv.conf.5, services.5, slabinfo.5, arp.7, bootparam.7, capabilities.7, charsets.7, cpuset.7, ddp.7, epoll.7, feature_test_macros.7, futex.7, hier.7, icmp.7, inotify.7, ip.7, ipv6.7, man-pages.7, mdoc.7, mdoc.samples.7, netdevice.7, netlink.7, numa.7, packet.7, path_resolution.7, posixoptions.7, pthreads.7, raw.7, rtld-audit.7, rtnetlink.7, sem_overview.7, sigevent.7, socket.7, spufs.7, tcp.7, udp.7, unicode.7, uri.7, utf-8.7, intro.8, ldconfig.8, sync.8: Global fix: fix placement of word "only"
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2013-03-31 08:53:00 +00:00
|
|
|
This is possible only for connected
|
2008-08-08 16:47:53 +00:00
|
|
|
.B AF_UNIX
|
2008-08-08 16:41:48 +00:00
|
|
|
stream sockets and
|
2008-08-08 16:47:53 +00:00
|
|
|
.B AF_UNIX
|
2008-08-08 16:41:48 +00:00
|
|
|
stream and datagram socket pairs created using
|
|
|
|
.BR socketpair (2);
|
|
|
|
see
|
|
|
|
.BR unix (7).
|
|
|
|
The returned credentials are those that were in effect at the time
|
|
|
|
of the call to
|
|
|
|
.BR connect (2)
|
|
|
|
or
|
|
|
|
.BR socketpair (2).
|
2013-03-10 12:04:00 +00:00
|
|
|
The argument is a
|
2008-08-08 16:41:48 +00:00
|
|
|
.I ucred
|
2013-03-10 12:04:00 +00:00
|
|
|
structure; define the
|
2014-03-18 19:17:50 +00:00
|
|
|
.B _GNU_SOURCE
|
2013-03-10 12:04:00 +00:00
|
|
|
feature test macro to obtain the definition of that structure from
|
|
|
|
.IR <sys/socket.h> .
|
2010-06-13 02:26:57 +00:00
|
|
|
This socket option is read-only.
|
2008-08-08 16:41:48 +00:00
|
|
|
.TP
|
|
|
|
.B SO_PRIORITY
|
|
|
|
Set the protocol-defined priority for all packets to be sent on
|
|
|
|
this socket.
|
|
|
|
Linux uses this value to order the networking queues:
|
|
|
|
packets with a higher priority may be processed first depending
|
|
|
|
on the selected device queueing discipline.
|
2015-05-05 19:18:51 +00:00
|
|
|
.\" For
|
|
|
|
.\" .BR ip (7),
|
|
|
|
.\" this also sets the IP type-of-service (TOS) field for outgoing packets.
|
2008-08-08 16:41:48 +00:00
|
|
|
Setting a priority outside the range 0 to 6 requires the
|
|
|
|
.B CAP_NET_ADMIN
|
|
|
|
capability.
|
|
|
|
.TP
|
2010-06-13 02:21:37 +00:00
|
|
|
.BR SO_PROTOCOL " (since Linux 2.6.32)"
|
|
|
|
Retrieves the socket protocol as an integer, returning a value such as
|
|
|
|
.BR IPPROTO_SCTP .
|
|
|
|
See
|
|
|
|
.BR socket (2)
|
|
|
|
for details.
|
2010-06-13 02:26:57 +00:00
|
|
|
This socket option is read-only.
|
2010-06-13 02:21:37 +00:00
|
|
|
.TP
|
2008-08-08 16:41:48 +00:00
|
|
|
.B SO_RCVBUF
|
|
|
|
Sets or gets the maximum socket receive buffer in bytes.
|
|
|
|
The kernel doubles this value (to allow space for bookkeeping overhead)
|
|
|
|
when it is set using
|
|
|
|
.\" Most (all?) other implementations do not do this -- MTK, Dec 05
|
|
|
|
.BR setsockopt (2),
|
|
|
|
and this doubled value is returned by
|
|
|
|
.BR getsockopt (2).
|
2012-07-23 13:00:23 +00:00
|
|
|
.\" The following thread on LMKL is quite informative:
|
2014-06-16 20:25:04 +00:00
|
|
|
.\" getsockopt/setsockopt with SO_RCVBUF and SO_SNDBUF "non-standard" behavior
|
2012-07-23 13:00:23 +00:00
|
|
|
.\" 17 July 2012
|
|
|
|
.\" http://thread.gmane.org/gmane.linux.kernel/1328935
|
2008-08-08 16:41:48 +00:00
|
|
|
The default value is set by the
|
connect.2, listen.2, send.2, uname.2, cmsg.3, proc.5, arp.7, ddp.7, icmp.7, ip.7, raw.7, socket.7, tcp.7, udp.7: Global fix: eliminate mention of the obsolete sysctl(2) interface
Many pages still mention use of the obsolete sysctl(2) system
call, or used the term "sysctls"; rewrite these mentions to
instead be in terms of /proc interfaces.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2008-11-20 20:37:11 +00:00
|
|
|
.I /proc/sys/net/core/rmem_default
|
|
|
|
file, and the maximum allowed value is set by the
|
|
|
|
.I /proc/sys/net/core/rmem_max
|
|
|
|
file.
|
2008-08-08 16:41:48 +00:00
|
|
|
The minimum (doubled) value for this option is 256.
|
|
|
|
.TP
|
|
|
|
.BR SO_RCVBUFFORCE " (since Linux 2.6.14)"
|
|
|
|
Using this socket option, a privileged
|
|
|
|
.RB ( CAP_NET_ADMIN )
|
|
|
|
process can perform the same task as
|
|
|
|
.BR SO_RCVBUF ,
|
|
|
|
but the
|
|
|
|
.I rmem_max
|
|
|
|
limit can be overridden.
|
|
|
|
.TP
|
|
|
|
.BR SO_RCVLOWAT " and " SO_SNDLOWAT
|
|
|
|
Specify the minimum number of bytes in the buffer until the socket layer
|
|
|
|
will pass the data to the protocol
|
|
|
|
.RB ( SO_SNDLOWAT )
|
|
|
|
or the user on receiving
|
|
|
|
.RB ( SO_RCVLOWAT ).
|
|
|
|
These two values are initialized to 1.
|
|
|
|
.B SO_SNDLOWAT
|
|
|
|
is not changeable on Linux
|
|
|
|
.RB ( setsockopt (2)
|
|
|
|
fails with the error
|
|
|
|
.BR ENOPROTOOPT ).
|
|
|
|
.B SO_RCVLOWAT
|
|
|
|
is changeable
|
|
|
|
only since Linux 2.4.
|
|
|
|
The
|
|
|
|
.BR select (2)
|
|
|
|
and
|
|
|
|
.BR poll (2)
|
|
|
|
system calls currently do not respect the
|
|
|
|
.B SO_RCVLOWAT
|
|
|
|
setting on Linux,
|
|
|
|
and mark a socket readable when even a single byte of data is available.
|
|
|
|
A subsequent read from the socket will block until
|
|
|
|
.B SO_RCVLOWAT
|
|
|
|
bytes are available.
|
|
|
|
.\" See http://marc.theaimsgroup.com/?l=linux-kernel&m=111049368106984&w=2
|
|
|
|
.\" Tested on kernel 2.6.14 -- mtk, 30 Nov 05
|
|
|
|
.TP
|
|
|
|
.BR SO_RCVTIMEO " and " SO_SNDTIMEO
|
|
|
|
.\" Not implemented in 2.0.
|
|
|
|
.\" Implemented in 2.1.11 for getsockopt: always return a zero struct.
|
|
|
|
.\" Implemented in 2.3.41 for setsockopt, and actually used.
|
|
|
|
Specify the receiving or sending timeouts until reporting an error.
|
|
|
|
The argument is a
|
|
|
|
.IR "struct timeval" .
|
|
|
|
If an input or output function blocks for this period of time, and
|
|
|
|
data has been sent or received, the return value of that function
|
|
|
|
will be the amount of data transferred; if no data has been transferred
|
2014-03-26 12:55:56 +00:00
|
|
|
and the timeout has been reached, then \-1 is returned with
|
2008-08-08 16:41:48 +00:00
|
|
|
.I errno
|
|
|
|
set to
|
2012-11-09 05:58:36 +00:00
|
|
|
.BR EAGAIN
|
2008-08-08 16:41:48 +00:00
|
|
|
or
|
2012-11-09 05:58:36 +00:00
|
|
|
.BR EWOULDBLOCK ,
|
2008-08-08 16:41:48 +00:00
|
|
|
.\" in fact to EAGAIN
|
2012-11-09 05:58:36 +00:00
|
|
|
or
|
|
|
|
.B EINPROGRESS
|
|
|
|
(for
|
|
|
|
.BR connect (2))
|
accept.2, connect.2, eventfd.2, flock.2, open.2, posix_fadvise.2, read.2, recv.2, sched_setscheduler.2, select_tut.2, send.2, signalfd.2, splice.2, timerfd_create.2, write.2, flockfile.3, mkfifo.3, mq_notify.3, mq_open.3, pthread_tryjoin_np.3, scanf.3, random.4, ddp.7, epoll.7, fifo.7, ip.7, pipe.7, socket.7, spufs.7: Global fix: s/non-blocking/nonblocking/
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:43:10 +00:00
|
|
|
just as if the socket was specified to be nonblocking.
|
2014-03-26 05:10:59 +00:00
|
|
|
If the timeout is set to zero (the default),
|
2008-08-08 16:41:48 +00:00
|
|
|
then the operation will never timeout.
|
|
|
|
Timeouts only have effect for system calls that perform socket I/O (e.g.,
|
|
|
|
.BR read (2),
|
|
|
|
.BR recvmsg (2),
|
|
|
|
.BR send (2),
|
|
|
|
.BR sendmsg (2));
|
|
|
|
timeouts have no effect for
|
|
|
|
.BR select (2),
|
|
|
|
.BR poll (2),
|
|
|
|
.BR epoll_wait (2),
|
2012-05-06 20:15:40 +00:00
|
|
|
and so on.
|
2008-08-08 16:41:48 +00:00
|
|
|
.TP
|
|
|
|
.B SO_REUSEADDR
|
2015-02-05 13:48:47 +00:00
|
|
|
.\" commit c617f398edd4db2b8567a28e899a88f8f574798d
|
|
|
|
.\" https://lwn.net/Articles/542629/
|
2008-08-08 16:41:48 +00:00
|
|
|
Indicates that the rules used in validating addresses supplied in a
|
|
|
|
.BR bind (2)
|
|
|
|
call should allow reuse of local addresses.
|
|
|
|
For
|
2008-08-08 16:47:53 +00:00
|
|
|
.B AF_INET
|
2008-08-08 16:41:48 +00:00
|
|
|
sockets this
|
|
|
|
means that a socket may bind, except when there
|
|
|
|
is an active listening socket bound to the address.
|
|
|
|
When the listening socket is bound to
|
|
|
|
.B INADDR_ANY
|
|
|
|
with a specific port then it is not possible
|
|
|
|
to bind to this port for any local address.
|
|
|
|
Argument is an integer boolean flag.
|
|
|
|
.TP
|
2014-12-20 05:14:29 +00:00
|
|
|
.BR SO_REUSEPORT " (since Linux 3.9)"
|
2015-02-05 14:06:17 +00:00
|
|
|
Permits multiple
|
2014-12-20 05:14:29 +00:00
|
|
|
.B AF_INET
|
|
|
|
or
|
|
|
|
.B AF_INET6
|
2015-02-05 14:06:17 +00:00
|
|
|
sockets to be bound to an identical socket address.
|
|
|
|
This option must be set on each socket (including the first socket)
|
|
|
|
prior to calling
|
|
|
|
.BR bind (2)
|
|
|
|
on the socket.
|
|
|
|
To prevent port hijacking,
|
|
|
|
all of the processes binding to the same address must have the same
|
|
|
|
effective UID.
|
|
|
|
This option can be employed with both TCP and UDP sockets.
|
environ.7, epoll.7, feature_test_macros.7, futex.7, ip.7, ipv6.7, locale.7, man-pages.7, man.7, math_error.7, netdevice.7, netlink.7, packet.7, raw.7, rtld-audit.7, rtnetlink.7, sock_diag.7, socket.7, tcp.7, udp.7, udplite.7, unix.7, uri.7, vdso.7: Formatting fix: replace blank lines with .PP/.IP
Blank lines shouldn't generally appear in *roff source (other
than in code examples), since they create large vertical
spaces between text blocks.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-16 01:01:48 +00:00
|
|
|
.IP
|
2015-02-05 14:06:17 +00:00
|
|
|
For TCP sockets, this option allows
|
2014-12-20 05:14:29 +00:00
|
|
|
.BR accept (2)
|
|
|
|
load distribution in a multi-threaded server to be improved by
|
2015-02-05 13:48:47 +00:00
|
|
|
using a distinct listener socket for each thread.
|
2015-02-05 14:06:17 +00:00
|
|
|
This provides improved load distribution as compared
|
|
|
|
to traditional techniques such using a single
|
|
|
|
.BR accept (2)ing
|
|
|
|
thread that distributes connections,
|
|
|
|
or having multiple threads that compete to
|
|
|
|
.BR accept (2)
|
|
|
|
from the same socket.
|
environ.7, epoll.7, feature_test_macros.7, futex.7, ip.7, ipv6.7, locale.7, man-pages.7, man.7, math_error.7, netdevice.7, netlink.7, packet.7, raw.7, rtld-audit.7, rtnetlink.7, sock_diag.7, socket.7, tcp.7, udp.7, udplite.7, unix.7, uri.7, vdso.7: Formatting fix: replace blank lines with .PP/.IP
Blank lines shouldn't generally appear in *roff source (other
than in code examples), since they create large vertical
spaces between text blocks.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-16 01:01:48 +00:00
|
|
|
.IP
|
2015-02-05 14:06:17 +00:00
|
|
|
For UDP sockets,
|
|
|
|
the use of this option can provide better distribution
|
|
|
|
of incoming datagrams to multiple processes (or threads) as compared
|
|
|
|
to the traditional technique of having multiple processes
|
|
|
|
compete to receive datagrams on the same socket.
|
2014-12-20 05:14:29 +00:00
|
|
|
.TP
|
2014-02-22 09:37:47 +00:00
|
|
|
.BR SO_RXQ_OVFL " (since Linux 2.6.33)"
|
2014-02-22 09:34:57 +00:00
|
|
|
.\" commit 3b885787ea4112eaa80945999ea0901bf742707f
|
2014-05-19 07:32:23 +00:00
|
|
|
Indicates that an unsigned 32-bit value ancillary message (cmsg)
|
2014-02-22 09:34:57 +00:00
|
|
|
should be attached to received skbs indicating
|
|
|
|
the number of packets dropped by the socket between
|
2014-05-19 07:32:33 +00:00
|
|
|
the last received packet and this received packet.
|
2014-01-28 12:24:37 +00:00
|
|
|
.TP
|
2008-08-08 16:41:48 +00:00
|
|
|
.B SO_SNDBUF
|
|
|
|
Sets or gets the maximum socket send buffer in bytes.
|
|
|
|
The kernel doubles this value (to allow space for bookkeeping overhead)
|
|
|
|
when it is set using
|
|
|
|
.\" Most (all?) other implementations do not do this -- MTK, Dec 05
|
2012-07-23 13:00:23 +00:00
|
|
|
.\" See also the comment to SO_RCVBUF (17 Jul 2012 LKML mail)
|
2008-08-08 16:41:48 +00:00
|
|
|
.BR setsockopt (2),
|
|
|
|
and this doubled value is returned by
|
|
|
|
.BR getsockopt (2).
|
|
|
|
The default value is set by the
|
connect.2, listen.2, send.2, uname.2, cmsg.3, proc.5, arp.7, ddp.7, icmp.7, ip.7, raw.7, socket.7, tcp.7, udp.7: Global fix: eliminate mention of the obsolete sysctl(2) interface
Many pages still mention use of the obsolete sysctl(2) system
call, or used the term "sysctls"; rewrite these mentions to
instead be in terms of /proc interfaces.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2008-11-20 20:37:11 +00:00
|
|
|
.I /proc/sys/net/core/wmem_default
|
|
|
|
file and the maximum allowed value is set by the
|
|
|
|
.I /proc/sys/net/core/wmem_max
|
|
|
|
file.
|
2008-08-08 16:41:48 +00:00
|
|
|
The minimum (doubled) value for this option is 2048.
|
|
|
|
.TP
|
|
|
|
.BR SO_SNDBUFFORCE " (since Linux 2.6.14)"
|
|
|
|
Using this socket option, a privileged
|
|
|
|
.RB ( CAP_NET_ADMIN )
|
|
|
|
process can perform the same task as
|
|
|
|
.BR SO_SNDBUF ,
|
|
|
|
but the
|
|
|
|
.I wmem_max
|
|
|
|
limit can be overridden.
|
|
|
|
.TP
|
|
|
|
.B SO_TIMESTAMP
|
|
|
|
Enable or disable the receiving of the
|
|
|
|
.B SO_TIMESTAMP
|
|
|
|
control message.
|
|
|
|
The timestamp control message is sent with level
|
|
|
|
.B SOL_SOCKET
|
|
|
|
and the
|
|
|
|
.I cmsg_data
|
|
|
|
field is a
|
|
|
|
.I "struct timeval"
|
|
|
|
indicating the
|
|
|
|
reception time of the last packet passed to the user in this call.
|
|
|
|
See
|
|
|
|
.BR cmsg (3)
|
|
|
|
for details on control messages.
|
|
|
|
.TP
|
|
|
|
.B SO_TYPE
|
2010-06-13 02:26:57 +00:00
|
|
|
Gets the socket type as an integer (e.g.,
|
2008-08-08 16:41:48 +00:00
|
|
|
.BR SOCK_STREAM ).
|
2010-06-13 02:26:57 +00:00
|
|
|
This socket option is read-only.
|
2013-07-10 14:18:35 +00:00
|
|
|
.TP
|
2014-02-22 15:34:57 +00:00
|
|
|
.BR SO_BUSY_POLL " (since Linux 3.11)"
|
2013-07-10 14:18:35 +00:00
|
|
|
Sets the approximate time in microseconds to busy poll on a blocking receive
|
2014-01-20 16:09:03 +00:00
|
|
|
when there is no data.
|
|
|
|
Increasing this value requires
|
2014-01-24 11:06:21 +00:00
|
|
|
.BR CAP_NET_ADMIN .
|
2013-07-10 14:18:35 +00:00
|
|
|
The default for this option is controlled by the
|
|
|
|
.I /proc/sys/net/core/busy_read
|
2014-01-24 11:06:21 +00:00
|
|
|
file.
|
environ.7, epoll.7, feature_test_macros.7, futex.7, ip.7, ipv6.7, locale.7, man-pages.7, man.7, math_error.7, netdevice.7, netlink.7, packet.7, raw.7, rtld-audit.7, rtnetlink.7, sock_diag.7, socket.7, tcp.7, udp.7, udplite.7, unix.7, uri.7, vdso.7: Formatting fix: replace blank lines with .PP/.IP
Blank lines shouldn't generally appear in *roff source (other
than in code examples), since they create large vertical
spaces between text blocks.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-16 01:01:48 +00:00
|
|
|
.IP
|
2014-01-24 11:06:21 +00:00
|
|
|
The value in the
|
2013-07-10 14:18:35 +00:00
|
|
|
.I /proc/sys/net/core/busy_poll
|
2014-01-24 11:06:21 +00:00
|
|
|
file determines how long
|
2013-07-10 14:18:35 +00:00
|
|
|
.BR select (2)
|
2014-01-24 11:06:21 +00:00
|
|
|
and
|
2013-07-10 14:18:35 +00:00
|
|
|
.BR poll (2)
|
2014-01-24 11:06:21 +00:00
|
|
|
will busy poll when they operate on sockets with
|
2013-07-10 14:18:35 +00:00
|
|
|
.BR SO_BUSY_POLL
|
|
|
|
set and no events to report are found.
|
environ.7, epoll.7, feature_test_macros.7, futex.7, ip.7, ipv6.7, locale.7, man-pages.7, man.7, math_error.7, netdevice.7, netlink.7, packet.7, raw.7, rtld-audit.7, rtnetlink.7, sock_diag.7, socket.7, tcp.7, udp.7, udplite.7, unix.7, uri.7, vdso.7: Formatting fix: replace blank lines with .PP/.IP
Blank lines shouldn't generally appear in *roff source (other
than in code examples), since they create large vertical
spaces between text blocks.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-16 01:01:48 +00:00
|
|
|
.IP
|
2014-01-20 16:09:03 +00:00
|
|
|
In both cases,
|
|
|
|
busy polling will only be done when the socket last received data
|
2013-07-10 14:18:35 +00:00
|
|
|
from a network device that supports this option.
|
environ.7, epoll.7, feature_test_macros.7, futex.7, ip.7, ipv6.7, locale.7, man-pages.7, man.7, math_error.7, netdevice.7, netlink.7, packet.7, raw.7, rtld-audit.7, rtnetlink.7, sock_diag.7, socket.7, tcp.7, udp.7, udplite.7, unix.7, uri.7, vdso.7: Formatting fix: replace blank lines with .PP/.IP
Blank lines shouldn't generally appear in *roff source (other
than in code examples), since they create large vertical
spaces between text blocks.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-16 01:01:48 +00:00
|
|
|
.IP
|
2014-01-20 16:09:03 +00:00
|
|
|
While busy polling may improve latency of some applications,
|
|
|
|
care must be taken when using it since this will increase
|
|
|
|
both CPU utilization and power usage.
|
2008-08-08 16:41:48 +00:00
|
|
|
.SS Signals
|
|
|
|
When writing onto a connection-oriented socket that has been shut down
|
|
|
|
(by the local or the remote end)
|
|
|
|
.B SIGPIPE
|
|
|
|
is sent to the writing process and
|
|
|
|
.B EPIPE
|
|
|
|
is returned.
|
|
|
|
The signal is not sent when the write call
|
|
|
|
specified the
|
|
|
|
.B MSG_NOSIGNAL
|
|
|
|
flag.
|
|
|
|
.PP
|
|
|
|
When requested with the
|
|
|
|
.B FIOSETOWN
|
|
|
|
.BR fcntl (2)
|
|
|
|
or
|
|
|
|
.B SIOCSPGRP
|
|
|
|
.BR ioctl (2),
|
|
|
|
.B SIGIO
|
|
|
|
is sent when an I/O event occurs.
|
|
|
|
It is possible to use
|
|
|
|
.BR poll (2)
|
|
|
|
or
|
|
|
|
.BR select (2)
|
|
|
|
in the signal handler to find out which socket the event occurred on.
|
|
|
|
An alternative (in Linux 2.2) is to set a real-time signal using the
|
|
|
|
.B F_SETSIG
|
|
|
|
.BR fcntl (2);
|
|
|
|
the handler of the real time signal will be called with
|
|
|
|
the file descriptor in the
|
|
|
|
.I si_fd
|
|
|
|
field of its
|
|
|
|
.IR siginfo_t .
|
|
|
|
See
|
|
|
|
.BR fcntl (2)
|
|
|
|
for more information.
|
|
|
|
.PP
|
|
|
|
Under some circumstances (e.g., multiple processes accessing a
|
|
|
|
single socket), the condition that caused the
|
|
|
|
.B SIGIO
|
|
|
|
may have already disappeared when the process reacts to the signal.
|
|
|
|
If this happens, the process should wait again because Linux
|
|
|
|
will resend the signal later.
|
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
|
connect.2, listen.2, send.2, uname.2, cmsg.3, proc.5, arp.7, ddp.7, icmp.7, ip.7, raw.7, socket.7, tcp.7, udp.7: Global fix: eliminate mention of the obsolete sysctl(2) interface
Many pages still mention use of the obsolete sysctl(2) system
call, or used the term "sysctls"; rewrite these mentions to
instead be in terms of /proc interfaces.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2008-11-20 20:37:11 +00:00
|
|
|
.SS /proc interfaces
|
|
|
|
The core socket networking parameters can be accessed
|
|
|
|
via files in the directory
|
|
|
|
.IR /proc/sys/net/core/ .
|
2008-08-08 16:41:48 +00:00
|
|
|
.TP
|
|
|
|
.I rmem_default
|
|
|
|
contains the default setting in bytes of the socket receive buffer.
|
|
|
|
.TP
|
|
|
|
.I rmem_max
|
|
|
|
contains the maximum socket receive buffer size in bytes which a user may
|
|
|
|
set by using the
|
|
|
|
.B SO_RCVBUF
|
|
|
|
socket option.
|
|
|
|
.TP
|
|
|
|
.I wmem_default
|
|
|
|
contains the default setting in bytes of the socket send buffer.
|
|
|
|
.TP
|
|
|
|
.I wmem_max
|
|
|
|
contains the maximum socket send buffer size in bytes which a user may
|
|
|
|
set by using the
|
|
|
|
.B SO_SNDBUF
|
|
|
|
socket option.
|
|
|
|
.TP
|
2008-11-20 19:09:35 +00:00
|
|
|
.IR message_cost " and " message_burst
|
2008-08-08 16:41:48 +00:00
|
|
|
configure the token bucket filter used to load limit warning messages
|
|
|
|
caused by external network events.
|
|
|
|
.TP
|
|
|
|
.I netdev_max_backlog
|
|
|
|
Maximum number of packets in the global input queue.
|
|
|
|
.TP
|
|
|
|
.I optmem_max
|
|
|
|
Maximum length of ancillary data and user control data like the iovecs
|
|
|
|
per socket.
|
|
|
|
.\" netdev_fastroute is not documented because it is experimental
|
|
|
|
.SS Ioctls
|
|
|
|
These operations can be accessed using
|
|
|
|
.BR ioctl (2):
|
environ.7, epoll.7, feature_test_macros.7, futex.7, ip.7, ipv6.7, locale.7, man-pages.7, man.7, math_error.7, netdevice.7, netlink.7, packet.7, raw.7, rtld-audit.7, rtnetlink.7, sock_diag.7, socket.7, tcp.7, udp.7, udplite.7, unix.7, uri.7, vdso.7: Formatting fix: replace blank lines with .PP/.IP
Blank lines shouldn't generally appear in *roff source (other
than in code examples), since they create large vertical
spaces between text blocks.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-16 01:01:48 +00:00
|
|
|
.PP
|
2008-08-08 16:41:48 +00:00
|
|
|
.in +4n
|
execve.2, ioctl_console.2, ioctl_iflags.2, ioctl_ns.2, ioctl_userfaultfd.2, kcmp.2, kexec_load.2, keyctl.2, link.2, listxattr.2, membarrier.2, memfd_create.2, mmap.2, modify_ldt.2, mprotect.2, msgctl.2, nanosleep.2, open_by_handle_at.2, perf_event_open.2, poll.2, posix_fadvise.2, process_vm_readv.2, ptrace.2, query_module.2, quotactl.2, readdir.2, readv.2, recv.2, recvmmsg.2, request_key.2, sched_rr_get_interval.2, sched_setaffinity.2, sched_setattr.2, sched_setscheduler.2, seccomp.2, select.2, select_tut.2, semctl.2, semop.2, send.2, sendmmsg.2, set_thread_area.2, setns.2, shmctl.2, shmget.2, sigaction.2, sigaltstack.2, signal.2, sigwaitinfo.2, stat.2, statfs.2, statx.2, sync_file_range.2, syscall.2, sysctl.2, sysinfo.2, tee.2, timer_create.2, timer_settime.2, timerfd_create.2, unshare.2, userfaultfd.2, ustat.2, utime.2, utimensat.2, vmsplice.2, wait.2, adjtime.3, aio_init.3, backtrace.3, basename.3, bswap.3, btree.3, clock_getcpuclockid.3, cmsg.3, confstr.3, dbopen.3, dl_iterate_phdr.3, dladdr.3, dlinfo.3, dlopen.3, duplocale.3, encrypt.3, end.3, endian.3, err.3, errno.3, ether_aton.3, fgetgrent.3, fgetpwent.3, fmemopen.3, frexp.3, ftime.3, fts.3, getaddrinfo.3, getaddrinfo_a.3, getdate.3, getfsent.3, getgrent.3, getgrent_r.3, getgrnam.3, getgrouplist.3, gethostbyname.3, getifaddrs.3, getipnodebyname.3, getmntent.3, getnameinfo.3, getnetent.3, getopt.3, getprotoent.3, getprotoent_r.3, getpw.3, getpwent.3, getpwent_r.3, getpwnam.3, getrpcent.3, getservent.3, getservent_r.3, getspnam.3, getttyent.3, glob.3, gnu_get_libc_version.3, hash.3, hsearch.3, if_nameindex.3, inet.3, inet_net_pton.3, inet_pton.3, insque.3, isalpha.3, makecontext.3, mallinfo.3, malloc_info.3, mallopt.3, matherr.3, mbstowcs.3, mcheck.3, memchr.3, mq_getattr.3, mq_open.3, mq_receive.3, mq_send.3, mtrace.3, newlocale.3, ntp_gettime.3, posix_openpt.3, printf.3, pthread_attr_init.3, pthread_attr_setschedparam.3, pthread_cancel.3, pthread_cleanup_push.3, pthread_cleanup_push_defer_np.3, pthread_create.3, pthread_getattr_default_np.3, pthread_getattr_np.3, pthread_getcpuclockid.3, pthread_setname_np.3, pthread_setschedparam.3, pthread_sigmask.3, pthread_tryjoin_np.3, readdir.3, realpath.3, recno.3, regex.3, rpc.3, scanf.3, sched_getcpu.3, sem_wait.3, setaliasent.3, sigqueue.3, statvfs.3, strcat.3, strcpy.3, strftime.3, strtok.3, strtol.3, strverscmp.3, toupper.3, ttyslot.3, xdr.3, fuse.4, loop.4, rtc.4, st.4, acct.5, core.5, elf.5, slabinfo.5, aio.7, arp.7, capabilities.7, cgroup_namespaces.7, cgroups.7, ddp.7, fanotify.7, feature_test_macros.7, inode.7, inotify.7, ip.7, keyrings.7, locale.7, mount_namespaces.7, namespaces.7, netdevice.7, netlink.7, packet.7, pkeys.7, pthreads.7, sched.7, session-keyring.7, sock_diag.7, socket.7, spufs.7, udplite.7, unix.7, user_namespaces.7, vdso.7, x25.7, ld.so.8: Use consistent markup for code snippets
Change .nf/.fi to .EX/.EE
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-18 19:52:46 +00:00
|
|
|
.EX
|
2008-08-08 16:41:48 +00:00
|
|
|
.IB error " = ioctl(" ip_socket ", " ioctl_type ", " &value_result ");"
|
execve.2, ioctl_console.2, ioctl_iflags.2, ioctl_ns.2, ioctl_userfaultfd.2, kcmp.2, kexec_load.2, keyctl.2, link.2, listxattr.2, membarrier.2, memfd_create.2, mmap.2, modify_ldt.2, mprotect.2, msgctl.2, nanosleep.2, open_by_handle_at.2, perf_event_open.2, poll.2, posix_fadvise.2, process_vm_readv.2, ptrace.2, query_module.2, quotactl.2, readdir.2, readv.2, recv.2, recvmmsg.2, request_key.2, sched_rr_get_interval.2, sched_setaffinity.2, sched_setattr.2, sched_setscheduler.2, seccomp.2, select.2, select_tut.2, semctl.2, semop.2, send.2, sendmmsg.2, set_thread_area.2, setns.2, shmctl.2, shmget.2, sigaction.2, sigaltstack.2, signal.2, sigwaitinfo.2, stat.2, statfs.2, statx.2, sync_file_range.2, syscall.2, sysctl.2, sysinfo.2, tee.2, timer_create.2, timer_settime.2, timerfd_create.2, unshare.2, userfaultfd.2, ustat.2, utime.2, utimensat.2, vmsplice.2, wait.2, adjtime.3, aio_init.3, backtrace.3, basename.3, bswap.3, btree.3, clock_getcpuclockid.3, cmsg.3, confstr.3, dbopen.3, dl_iterate_phdr.3, dladdr.3, dlinfo.3, dlopen.3, duplocale.3, encrypt.3, end.3, endian.3, err.3, errno.3, ether_aton.3, fgetgrent.3, fgetpwent.3, fmemopen.3, frexp.3, ftime.3, fts.3, getaddrinfo.3, getaddrinfo_a.3, getdate.3, getfsent.3, getgrent.3, getgrent_r.3, getgrnam.3, getgrouplist.3, gethostbyname.3, getifaddrs.3, getipnodebyname.3, getmntent.3, getnameinfo.3, getnetent.3, getopt.3, getprotoent.3, getprotoent_r.3, getpw.3, getpwent.3, getpwent_r.3, getpwnam.3, getrpcent.3, getservent.3, getservent_r.3, getspnam.3, getttyent.3, glob.3, gnu_get_libc_version.3, hash.3, hsearch.3, if_nameindex.3, inet.3, inet_net_pton.3, inet_pton.3, insque.3, isalpha.3, makecontext.3, mallinfo.3, malloc_info.3, mallopt.3, matherr.3, mbstowcs.3, mcheck.3, memchr.3, mq_getattr.3, mq_open.3, mq_receive.3, mq_send.3, mtrace.3, newlocale.3, ntp_gettime.3, posix_openpt.3, printf.3, pthread_attr_init.3, pthread_attr_setschedparam.3, pthread_cancel.3, pthread_cleanup_push.3, pthread_cleanup_push_defer_np.3, pthread_create.3, pthread_getattr_default_np.3, pthread_getattr_np.3, pthread_getcpuclockid.3, pthread_setname_np.3, pthread_setschedparam.3, pthread_sigmask.3, pthread_tryjoin_np.3, readdir.3, realpath.3, recno.3, regex.3, rpc.3, scanf.3, sched_getcpu.3, sem_wait.3, setaliasent.3, sigqueue.3, statvfs.3, strcat.3, strcpy.3, strftime.3, strtok.3, strtol.3, strverscmp.3, toupper.3, ttyslot.3, xdr.3, fuse.4, loop.4, rtc.4, st.4, acct.5, core.5, elf.5, slabinfo.5, aio.7, arp.7, capabilities.7, cgroup_namespaces.7, cgroups.7, ddp.7, fanotify.7, feature_test_macros.7, inode.7, inotify.7, ip.7, keyrings.7, locale.7, mount_namespaces.7, namespaces.7, netdevice.7, netlink.7, packet.7, pkeys.7, pthreads.7, sched.7, session-keyring.7, sock_diag.7, socket.7, spufs.7, udplite.7, unix.7, user_namespaces.7, vdso.7, x25.7, ld.so.8: Use consistent markup for code snippets
Change .nf/.fi to .EX/.EE
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-18 19:52:46 +00:00
|
|
|
.EE
|
2008-08-08 16:41:48 +00:00
|
|
|
.in
|
|
|
|
.TP
|
|
|
|
.B SIOCGSTAMP
|
|
|
|
Return a
|
|
|
|
.I struct timeval
|
|
|
|
with the receive timestamp of the last packet passed to the user.
|
|
|
|
This is useful for accurate round trip time measurements.
|
|
|
|
See
|
|
|
|
.BR setitimer (2)
|
|
|
|
for a description of
|
|
|
|
.IR "struct timeval" .
|
|
|
|
.\"
|
intro.1, _syscall.2, access.2, arch_prctl.2, cacheflush.2, chown.2, clock_getres.2, clone.2, create_module.2, fcntl.2, flock.2, get_kernel_syms.2, get_robust_list.2, get_thread_area.2, getcpu.2, getpriority.2, getrlimit.2, getrusage.2, ioprio_set.2, kexec_load.2, madvise.2, mbind.2, migrate_pages.2, mknod.2, mmap.2, mount.2, move_pages.2, mprotect.2, open.2, pause.2, pciconfig_read.2, perf_event_open.2, prctl.2, ptrace.2, query_module.2, read.2, reboot.2, recv.2, s390_runtime_instr.2, sched_setscheduler.2, select_tut.2, send.2, set_mempolicy.2, setfsgid.2, setfsuid.2, sigaction.2, spu_create.2, spu_run.2, stime.2, swapon.2, syslog.2, timer_create.2, timer_getoverrun.2, times.2, tkill.2, umount.2, unimplemented.2, ustat.2, vm86.2, wait.2, abs.3, aio_read.3, aio_write.3, bsd_signal.3, catgets.3, clearenv.3, cmsg.3, dbopen.3, dirfd.3, dlopen.3, exec.3, fenv.3, ferror.3, fmemopen.3, fnmatch.3, fopen.3, futimes.3, getaddrinfo.3, getifaddrs.3, getipnodebyname.3, hsearch.3, if_nameindex.3, inet_pton.3, mblen.3, mbrlen.3, mbsrtowcs.3, mbtowc.3, mcheck.3, memfrob.3, mq_notify.3, netlink.3, posix_memalign.3, printf.3, pthread_attr_setscope.3, pthread_cleanup_push.3, pthread_kill_other_threads_np.3, pthread_self.3, pthread_setcancelstate.3, pthread_setconcurrency.3, raise.3, resolver.3, rpc.3, rtime.3, rtnetlink.3, scanf.3, setbuf.3, setnetgrent.3, shm_open.3, sigpause.3, sigset.3, sigwait.3, sockatmark.3, strcasecmp.3, strcmp.3, strdup.3, strftime.3, strptime.3, strsignal.3, strverscmp.3, sysv_signal.3, termios.3, wcrtomb.3, wcsnlen.3, wcsnrtombs.3, wcsrtombs.3, wctomb.3, wprintf.3, console_codes.4, cpuid.4, msr.4, rtc.4, sk98lin.4, st.4, tty.4, charmap.5, core.5, elf.5, hosts.equiv.5, proc.5, resolv.conf.5, services.5, slabinfo.5, arp.7, bootparam.7, capabilities.7, charsets.7, cpuset.7, ddp.7, epoll.7, feature_test_macros.7, futex.7, hier.7, icmp.7, inotify.7, ip.7, ipv6.7, man-pages.7, mdoc.7, mdoc.samples.7, netdevice.7, netlink.7, numa.7, packet.7, path_resolution.7, posixoptions.7, pthreads.7, raw.7, rtld-audit.7, rtnetlink.7, sem_overview.7, sigevent.7, socket.7, spufs.7, tcp.7, udp.7, unicode.7, uri.7, utf-8.7, intro.8, ldconfig.8, sync.8: Global fix: fix placement of word "only"
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2013-03-31 08:53:00 +00:00
|
|
|
This ioctl should be used only if the socket option
|
2008-08-08 16:41:48 +00:00
|
|
|
.B SO_TIMESTAMP
|
|
|
|
is not set on the socket.
|
|
|
|
Otherwise, it returns the timestamp of the
|
|
|
|
last packet that was received while
|
|
|
|
.B SO_TIMESTAMP
|
|
|
|
was not set, or it fails if no such packet has been received,
|
|
|
|
(i.e.,
|
|
|
|
.BR ioctl (2)
|
|
|
|
returns \-1 with
|
|
|
|
.I errno
|
|
|
|
set to
|
|
|
|
.BR ENOENT ).
|
|
|
|
.TP
|
|
|
|
.B SIOCSPGRP
|
2016-06-26 12:59:33 +00:00
|
|
|
Set the process or process group that is to receive
|
2008-08-08 16:41:48 +00:00
|
|
|
.B SIGIO
|
|
|
|
or
|
|
|
|
.B SIGURG
|
2016-06-26 12:59:33 +00:00
|
|
|
signals when I/O becomes possible or urgent data is available.
|
2008-08-08 16:41:48 +00:00
|
|
|
The argument is a pointer to a
|
|
|
|
.IR pid_t .
|
2016-06-26 12:59:33 +00:00
|
|
|
For further details, see the description of
|
|
|
|
.BR F_SETOWN
|
|
|
|
in
|
|
|
|
.BR fcntl (2).
|
2008-08-08 16:41:48 +00:00
|
|
|
.TP
|
|
|
|
.B FIOASYNC
|
|
|
|
Change the
|
|
|
|
.B O_ASYNC
|
|
|
|
flag to enable or disable asynchronous I/O mode of the socket.
|
|
|
|
Asynchronous I/O mode means that the
|
|
|
|
.B SIGIO
|
|
|
|
signal or the signal set with
|
|
|
|
.B F_SETSIG
|
|
|
|
is raised when a new I/O event occurs.
|
|
|
|
.IP
|
|
|
|
Argument is an integer boolean flag.
|
|
|
|
(This operation is synonymous with the use of
|
|
|
|
.BR fcntl (2)
|
|
|
|
to set the
|
|
|
|
.B O_ASYNC
|
|
|
|
flag.)
|
|
|
|
.\"
|
|
|
|
.TP
|
|
|
|
.B SIOCGPGRP
|
|
|
|
Get the current process or process group that receives
|
|
|
|
.B SIGIO
|
|
|
|
or
|
|
|
|
.B SIGURG
|
|
|
|
signals,
|
|
|
|
or 0
|
|
|
|
when none is set.
|
|
|
|
.PP
|
|
|
|
Valid
|
|
|
|
.BR fcntl (2)
|
|
|
|
operations:
|
|
|
|
.TP
|
|
|
|
.B FIOGETOWN
|
|
|
|
The same as the
|
|
|
|
.B SIOCGPGRP
|
|
|
|
.BR ioctl (2).
|
|
|
|
.TP
|
|
|
|
.B FIOSETOWN
|
|
|
|
The same as the
|
|
|
|
.B SIOCSPGRP
|
|
|
|
.BR ioctl (2).
|
|
|
|
.SH VERSIONS
|
|
|
|
.B SO_BINDTODEVICE
|
|
|
|
was introduced in Linux 2.0.30.
|
|
|
|
.B SO_PASSCRED
|
|
|
|
is new in Linux 2.2.
|
connect.2, listen.2, send.2, uname.2, cmsg.3, proc.5, arp.7, ddp.7, icmp.7, ip.7, raw.7, socket.7, tcp.7, udp.7: Global fix: eliminate mention of the obsolete sysctl(2) interface
Many pages still mention use of the obsolete sysctl(2) system
call, or used the term "sysctls"; rewrite these mentions to
instead be in terms of /proc interfaces.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2008-11-20 20:37:11 +00:00
|
|
|
The
|
|
|
|
.I /proc
|
2015-03-28 22:55:01 +00:00
|
|
|
interfaces were introduced in Linux 2.2.
|
2008-08-08 16:41:48 +00:00
|
|
|
.B SO_RCVTIMEO
|
|
|
|
and
|
|
|
|
.B SO_SNDTIMEO
|
|
|
|
are supported since Linux 2.3.41.
|
|
|
|
Earlier, timeouts were fixed to
|
|
|
|
a protocol-specific setting, and could not be read or written.
|
|
|
|
.SH NOTES
|
|
|
|
Linux assumes that half of the send/receive buffer is used for internal
|
connect.2, listen.2, send.2, uname.2, cmsg.3, proc.5, arp.7, ddp.7, icmp.7, ip.7, raw.7, socket.7, tcp.7, udp.7: Global fix: eliminate mention of the obsolete sysctl(2) interface
Many pages still mention use of the obsolete sysctl(2) system
call, or used the term "sysctls"; rewrite these mentions to
instead be in terms of /proc interfaces.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2008-11-20 20:37:11 +00:00
|
|
|
kernel structures; thus the values in the corresponding
|
|
|
|
.I /proc
|
|
|
|
files are twice what can be observed on the wire.
|
environ.7, epoll.7, feature_test_macros.7, futex.7, ip.7, ipv6.7, locale.7, man-pages.7, man.7, math_error.7, netdevice.7, netlink.7, packet.7, raw.7, rtld-audit.7, rtnetlink.7, sock_diag.7, socket.7, tcp.7, udp.7, udplite.7, unix.7, uri.7, vdso.7: Formatting fix: replace blank lines with .PP/.IP
Blank lines shouldn't generally appear in *roff source (other
than in code examples), since they create large vertical
spaces between text blocks.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-16 01:01:48 +00:00
|
|
|
.PP
|
2015-01-28 09:59:44 +00:00
|
|
|
Linux will allow port reuse only with the
|
2008-08-08 16:41:48 +00:00
|
|
|
.B SO_REUSEADDR
|
|
|
|
option
|
|
|
|
when this option was set both in the previous program that performed a
|
|
|
|
.BR bind (2)
|
close.2, epoll_create.2, epoll_ctl.2, fcntl.2, madvise.2, mmap.2, mremap.2, select_tut.2, setgid.2, setuid.2, syscalls.2, vmsplice.2, dlopen.3, fts.3, getpw.3, stdio.3, fd.4, initrd.4, random.4, sd.4, bootparam.7, capabilities.7, cpuset.7, epoll.7, inotify.7, man.7, socket.7, x25.7: Global fix: s/re-/re/
The tendency in English, as prescribed in style guides like
Chicago MoS, is towards removing hyphens after prefixes
like "re-" etc.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2010-01-16 17:45:23 +00:00
|
|
|
to the port and in the program that wants to reuse the port.
|
2008-08-08 16:41:48 +00:00
|
|
|
This differs from some implementations (e.g., FreeBSD)
|
|
|
|
where only the later program needs to set the
|
|
|
|
.B SO_REUSEADDR
|
|
|
|
option.
|
|
|
|
Typically this difference is invisible, since, for example, a server
|
|
|
|
program is designed to always set this option.
|
|
|
|
.\" .SH AUTHORS
|
|
|
|
.\" This man page was written by Andi Kleen.
|
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
|
2016-03-01 08:46:33 +00:00
|
|
|
.BR wireshark (1),
|
2015-05-27 08:13:18 +00:00
|
|
|
.BR bpf (2),
|
2012-11-09 05:58:36 +00:00
|
|
|
.BR connect (2),
|
2014-02-10 09:26:57 +00:00
|
|
|
.BR getsockopt (2),
|
2008-08-08 16:41:48 +00:00
|
|
|
.BR setsockopt (2),
|
|
|
|
.BR socket (2),
|
2016-03-01 08:41:03 +00:00
|
|
|
.BR pcap (3),
|
2008-08-08 16:41:48 +00:00
|
|
|
.BR capabilities (7),
|
|
|
|
.BR ddp (7),
|
|
|
|
.BR ip (7),
|
2008-10-24 21:26:39 +00:00
|
|
|
.BR packet (7),
|
2008-12-01 15:22:28 +00:00
|
|
|
.BR tcp (7),
|
|
|
|
.BR udp (7),
|
2016-03-01 08:46:33 +00:00
|
|
|
.BR unix (7),
|
|
|
|
.BR tcpdump (8)
|