Manual Pages for Linux CentOS command on man bindresvport
MyWebUniversity

Manual Pages for Linux CentOS command on man bindresvport

BINDRESVPORT(3) Linux Programmer's Manual BINDRESVPORT(3)

NAME

bindresvport - bind a socket to a privileged IP port SYNOPSIS

#include

#include int bindresvport(int sockfd, struct sockaddrin *sin); DESCRIPTION bindresvport() is used to bind a socket descriptor to a privileged anonymous IP port, that is, a port number arbitrarily selected from the range 512 to 1023. If the bind(2) performed by bindresvport() is successful, and sin is

not NULL, then sin->sinport returns the port number actually allo‐ cated.

sin can be NULL, in which case sin->sinfamily is implicitly taken to be AFINET. However, in this case, bindresvport() has no way to return the port number actually allocated. (This information can later be obtained using getsockname(2).) RETURN VALUE

bindresvport() returns 0 on success; otherwise -1 is returned and errno set to indicate the cause of the error. ERRORS bindresvport() can fail for any of the same reasons as bind(2). In addition, the following errors may occur: EACCES The caller did not have superuser privilege (to be precise: the CAPNETBINDSERVICE capability is required). EADDRINUSE All privileged ports are in use. EAFNOSUPPORT (EPFNOSUPPORT in glibc 2.7 and earlier)

sin is not NULL and sin->sinfamily is not AFINET. ATTRIBUTES For an explanation of the terms used in this section, see attributes(7). ┌───────────────┬───────────────┬─────────────────────────┐ │Interface │ Attribute │ Value │ ├───────────────┼───────────────┼─────────────────────────┤

│bindresvport() │ Thread safety │ glibc >= 2.17: MT-Safe │

│ │ │ glibc < 2.17: MT-Unsafe │ └───────────────┴───────────────┴─────────────────────────┘ The bindresvport() function uses a static variable that was not pro‐

tected by a lock before glibc 2.17, rendering the function MT-Unsafe. CONFORMING TO

Not in POSIX.1-2001. Present on the BSDs, Solaris, and many other sys‐ tems. NOTES Unlike some bindresvport() implementations, the glibc implementation

ignores any value that the caller supplies in sin->sinport. SEE ALSO bind(2), getsockname(2) COLOPHON

This page is part of release 3.53 of the Linux man-pages project. A description of the project, and information about reporting bugs, can

be found at http://www.kernel.org/doc/man-pages/.

2013-06-21 BINDRESVPORT(3)




Contact us      |      About us      |      Term of use      |       Copyright © 2000-2019 MyWebUniversity.com ™