From cb450d22332f4ea2344bd480ac855cbaea9df7d8 Mon Sep 17 00:00:00 2001 From: Bruce M Simpson Date: Wed, 23 Jun 2004 00:20:46 +0000 Subject: [PATCH] Be specific about which socket properties are inherited from the original socket upon accept(2). PR: docs/54995, kern/45733 --- lib/libc/sys/accept.2 | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/lib/libc/sys/accept.2 b/lib/libc/sys/accept.2 index a876774abd5..387c7fc76aa 100644 --- a/lib/libc/sys/accept.2 +++ b/lib/libc/sys/accept.2 @@ -56,18 +56,21 @@ and is listening for connections after a .Xr listen 2 . The .Fn accept -system call -extracts the first connection request -on the queue of pending connections, creates -a new socket with the same properties as -.Fa s , -and allocates a new file descriptor -for the socket. If no pending connections are -present on the queue, and the socket is not marked -as non-blocking, +system call extracts the first connection request on the +queue of pending connections, creates a new socket, +and allocates a new file descriptor for the socket which +inherits the state of the +.Dv O_NONBLOCK +property from the original socket +.Fa s . +.Pp +If no pending connections are +present on the queue, and the original socket +is not marked as non-blocking, .Fn accept blocks the caller until a connection is present. -If the socket is marked non-blocking and no pending +If the original socket +is marked non-blocking and no pending connections are present on the queue, .Fn accept returns an error as described below.