diff options
| author | Michael Kerrisk <mtk.manpages@gmail.com> | 2015-02-05 15:06:17 +0100 |
|---|---|---|
| committer | Michael Kerrisk <mtk.manpages@gmail.com> | 2015-02-21 08:32:11 +0100 |
| commit | 11af2d4b98cdf8bcd606798f128fc4a55db7dd21 (patch) | |
| tree | bc05cf1fd31996098d688c6b6622bc844de4dbf6 /man7/socket.7 | |
| parent | c28f1dd3ec33efaba85933b1e5c64e61b217e6bb (diff) | |
| download | man-pages-11af2d4b98cdf8bcd606798f128fc4a55db7dd21.tar.gz | |
socket.7: Add some details for SO_REUSEPORT
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
Diffstat (limited to 'man7/socket.7')
| -rw-r--r-- | man7/socket.7 | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/man7/socket.7 b/man7/socket.7 index 5284cf35f7..0571edbdd7 100644 --- a/man7/socket.7 +++ b/man7/socket.7 @@ -662,19 +662,37 @@ to bind to this port for any local address. Argument is an integer boolean flag. .TP .BR SO_REUSEPORT " (since Linux 3.9)" -Indicates that attempts to bind an identical listening address to -multiple +Permits multiple .B AF_INET or .B AF_INET6 -sockets by the same UID may succeed. -This option allows +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. + +For TCP sockets, this option allows .BR accept (2) load distribution in a multi-threaded server to be improved by using a distinct listener socket for each thread. -This option must be set on each socket prior to calling -.BR bind (2) -on the socket. +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. + +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. .TP .BR SO_RXQ_OVFL " (since Linux 2.6.33)" .\" commit 3b885787ea4112eaa80945999ea0901bf742707f |
