All of lore.kernel.org
 help / color / mirror / Atom feed
* socket(2) guarantee to return the lowest-available file descriptor
@ 2017-09-11  2:56 Yubin Ruan
       [not found] ` <CAJYFCiNrUL-Z2R2GsXy_rG-iS_hLWEL-y8wdpw65hdw41T0YWQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Yubin Ruan @ 2017-09-11  2:56 UTC (permalink / raw)
  To: linux-man-u79uwXL29TY76Z2rM5mHXA; +Cc: Michael Kerrisk (man-pages)

Hi,
Is there any guarantee that socket(2) will return the lowest-available
file descriptor?

I note in the man page that open(2) has that guarantee, conforming to
POSIX, but nothing about that has been add to socket(2). As socket(2)
is said to be conforming to POSIX in the main page, which implies that
guarantee, should we add that to the man page?

Yubin
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: socket(2) guarantee to return the lowest-available file descriptor
       [not found] ` <CAJYFCiNrUL-Z2R2GsXy_rG-iS_hLWEL-y8wdpw65hdw41T0YWQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2017-09-13 12:40   ` Michael Kerrisk (man-pages)
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Kerrisk (man-pages) @ 2017-09-13 12:40 UTC (permalink / raw)
  To: Yubin Ruan; +Cc: linux-man

Hello Yubin

On 11 September 2017 at 04:56, Yubin Ruan <ablacktshirt-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> Hi,
> Is there any guarantee that socket(2) will return the lowest-available
> file descriptor?
>
> I note in the man page that open(2) has that guarantee, conforming to
> POSIX, but nothing about that has been add to socket(2). As socket(2)
> is said to be conforming to POSIX in the main page, which implies that
> guarantee, should we add that to the man page?

Yes, I've added the same text to socket(2). Thanks for the report.

Cheers,

Michael

POSIX.1:
2.14
File Descriptor Allocation
All functions that open one or more file descriptors shall, unless
specified otherwise, atomically
allocate the lowest numbered available (that is, not already open in
the calling process) file
descriptor at the time of each allocation. Where a single function
allocates two file descriptors
(for example, pipe( ) or socketpair( )), the allocations may be
independent and therefore
applications should not expect them to have adjacent values or depend
on which has the higher
value.

-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-09-13 12:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-11  2:56 socket(2) guarantee to return the lowest-available file descriptor Yubin Ruan
     [not found] ` <CAJYFCiNrUL-Z2R2GsXy_rG-iS_hLWEL-y8wdpw65hdw41T0YWQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-09-13 12:40   ` Michael Kerrisk (man-pages)

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.