Skip to content

Commit

Permalink
Generated from commit 526f5bb6f17b4301a6e3ab812c36d530b104f3d0
Browse files Browse the repository at this point in the history
  • Loading branch information
Pusnow committed Jan 4, 2024
1 parent 826fdbb commit 2aa91d1
Show file tree
Hide file tree
Showing 14 changed files with 2,244 additions and 2,283 deletions.
12 changes: 9 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
cmake_minimum_required(VERSION 3.11)

project(e VERSION 3.3.2)
project(e VERSION 3.3.3)

# Avoid warning about DOWNLOAD_EXTRACT_TIMESTAMP in CMake 3.24:
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0")
cmake_policy(SET CMP0135 NEW)
endif()

if(WIN32)
message(
Expand Down Expand Up @@ -134,8 +139,9 @@ include(FetchContent)

FetchContent_Declare(
googletest
URL https://github.com/google/googletest/archive/b007c54f2944e193ac44fba1bc997cb65826a0b9.zip
)
URL https://github.com/google/googletest/archive/dddb219c3eb96d7f9200f09b0a381f016e6b4562.zip
URL_HASH
SHA256=4599154210502714ad841821b9d086431816e5c8bfae90872e43305cc0f12eb2)

FetchContent_GetProperties(googletest)
if(NOT googletest_POPULATED)
Expand Down
203 changes: 101 additions & 102 deletions Documentation/man/accept.2.txt

Large diffs are not rendered by default.

115 changes: 57 additions & 58 deletions Documentation/man/bind.2.txt
Original file line number Diff line number Diff line change
@@ -1,100 +1,99 @@
BIND(2) Linux Programmer's Manual BIND(2)
BIND(2) Linux Programmer's Manual BIND(2)

NAME
NNAAMMEE
bind - bind a name to a socket

SYNOPSIS
#include <sys/socket.h>
SSYYNNOOPPSSIISS
##iinncclluuddee <<ssyyss//ssoocckkeett..hh>>

int bind(int sockfd, const struct sockaddr *addr,
socklen_t addrlen);
iinntt bbiinndd((iinntt _s_o_c_k_f_d,, ccoonnsstt ssttrruucctt ssoocckkaaddddrr **_a_d_d_r,,
ssoocckklleenn__tt _a_d_d_r_l_e_n));;

DESCRIPTION
When a socket is created with socket(2), it exists in a name space (address family) but has no ad‐
dress assigned to it. bind() assigns the address specified by addr to the socket referred to by the
file descriptor sockfd. addrlen specifies the size, in bytes, of the address structure pointed to
by addr. Traditionally, this operation is called “assigning a name to a socket”.
DDEESSCCRRIIPPTTIIOONN
When a socket is created with ssoocckkeett(2), it exists in a name space (address family) but has no address
assigned to it. bbiinndd() assigns the address specified by _a_d_d_r to the socket referred to by the file
descriptor _s_o_c_k_f_d. _a_d_d_r_l_e_n specifies the size, in bytes, of the address structure pointed to by _a_d_d_r.
Traditionally, this operation is called “assigning a name to a socket”.

It is normally necessary to assign a local address using bind() before a SOCK_STREAM socket may re‐
ceive connections (see accept(2)).
It is normally necessary to assign a local address using bbiinndd() before a SSOOCCKK__SSTTRREEAAMM socket may receive
connections (see aacccceepptt(2)).

The rules used in name binding vary between address families. Consult the manual entries in Section
7 for detailed information. For AF_INET, see ip(7); for AF_INET6, see ipv6(7); for AF_UNIX, see
unix(7); for AF_APPLETALK, see ddp(7); for AF_PACKET, see packet(7); for AF_X25, see x25(7); and for
AF_NETLINK, see netlink(7).
The rules used in name binding vary between address families. Consult the manual entries in Section 7
for detailed information. For AAFF__IINNEETT, see iipp(7); for AAFF__IINNEETT66, see iippvv66(7); for AAFF__UUNNIIXX, see uunniixx(7);
for AAFF__AAPPPPLLEETTAALLKK, see ddddpp(7); for AAFF__PPAACCKKEETT, see ppaacckkeett(7); for AAFF__XX2255, see xx2255(7); and for AAFF__NNEETTLLIINNKK,
see nneettlliinnkk(7).

The actual structure passed for the addr argument will depend on the address family. The sockaddr
The actual structure passed for the _a_d_d_r argument will depend on the address family. The _s_o_c_k_a_d_d_r
structure is defined as something like:

struct sockaddr {
sa_family_t sa_family;
char sa_data[14];
}

The only purpose of this structure is to cast the structure pointer passed in addr in order to avoid
The only purpose of this structure is to cast the structure pointer passed in _a_d_d_r in order to avoid
compiler warnings. See EXAMPLES below.

RETURN VALUE
On success, zero is returned. On error, -1 is returned, and errno is set to indicate the error.
RREETTUURRNN VVAALLUUEE
On success, zero is returned. On error, -1 is returned, and _e_r_r_n_o is set to indicate the error.

ERRORS
EACCES The address is protected, and the user is not the superuser.
EERRRROORRSS
EEAACCCCEESS The address is protected, and the user is not the superuser.

EADDRINUSE
EEAADDDDRRIINNUUSSEE
The given address is already in use.

EADDRINUSE
(Internet domain sockets) The port number was specified as zero in the socket address struc‐
ture, but, upon attempting to bind to an ephemeral port, it was determined that all port num‐
bers in the ephemeral port range are currently in use. See the discussion of
/proc/sys/net/ipv4/ip_local_port_range ip(7).
EEAADDDDRRIINNUUSSEE
(Internet domain sockets) The port number was specified as zero in the socket address structure,
but, upon attempting to bind to an ephemeral port, it was determined that all port numbers in
the ephemeral port range are currently in use. See the discussion of
_/_p_r_o_c_/_s_y_s_/_n_e_t_/_i_p_v_4_/_i_p___l_o_c_a_l___p_o_r_t___r_a_n_g_e iipp(7).

EBADF sockfd is not a valid file descriptor.
EEBBAADDFF _s_o_c_k_f_d is not a valid file descriptor.

EINVAL The socket is already bound to an address.
EEIINNVVAALL The socket is already bound to an address.

EINVAL addrlen is wrong, or addr is not a valid address for this socket's domain.
EEIINNVVAALL _a_d_d_r_l_e_n is wrong, or _a_d_d_r is not a valid address for this socket's domain.

ENOTSOCK
The file descriptor sockfd does not refer to a socket.
EENNOOTTSSOOCCKK
The file descriptor _s_o_c_k_f_d does not refer to a socket.

The following errors are specific to UNIX domain (AF_UNIX) sockets:
The following errors are specific to UNIX domain (AAFF__UUNNIIXX) sockets:

EACCES Search permission is denied on a component of the path prefix. (See also path_resolu‐
tion(7).)
EEAACCCCEESS Search permission is denied on a component of the path prefix. (See also ppaatthh__rreessoolluuttiioonn(7).)

EADDRNOTAVAIL
EEAADDDDRRNNOOTTAAVVAAIILL
A nonexistent interface was requested or the requested address was not local.

EFAULT addr points outside the user's accessible address space.
EEFFAAUULLTT _a_d_d_r points outside the user's accessible address space.

ELOOP Too many symbolic links were encountered in resolving addr.
EELLOOOOPP Too many symbolic links were encountered in resolving _a_d_d_r.

ENAMETOOLONG
addr is too long.
EENNAAMMEETTOOOOLLOONNGG
_a_d_d_r is too long.

ENOENT A component in the directory prefix of the socket pathname does not exist.
EENNOOEENNTT A component in the directory prefix of the socket pathname does not exist.

ENOMEM Insufficient kernel memory was available.
EENNOOMMEEMM Insufficient kernel memory was available.

ENOTDIR
EENNOOTTDDIIRR
A component of the path prefix is not a directory.

EROFS The socket inode would reside on a read-only filesystem.
EERROOFFSS The socket inode would reside on a read-only filesystem.

CONFORMING TO
POSIX.1-2001, POSIX.1-2008, SVr4, 4.4BSD (bind() first appeared in 4.2BSD).
CCOONNFFOORRMMIINNGG TTOO
POSIX.1-2001, POSIX.1-2008, SVr4, 4.4BSD (bbiinndd() first appeared in 4.2BSD).

NOTES
For background on the socklen_t type, see accept(2).
NNOOTTEESS
For background on the _s_o_c_k_l_e_n___t type, see aacccceepptt(2).

BUGS
BBUUGGSS
The transparent proxy options are not described.

EXAMPLES
An example of the use of bind() with Internet domain sockets can be found in getaddrinfo(3).
EEXXAAMMPPLLEESS
An example of the use of bbiinndd() with Internet domain sockets can be found in ggeettaaddddrriinnffoo(3).

The following example shows how to bind a stream socket in the UNIX (AF_UNIX) domain, and accept
The following example shows how to bind a stream socket in the UNIX (AAFF__UUNNIIXX) domain, and accept
connections:

#include <sys/socket.h>
Expand Down Expand Up @@ -147,8 +146,8 @@ EXAMPLES
should be deleted using unlink(2) or remove(3). */
}

SEE ALSO
accept(2), connect(2), getsockname(2), listen(2), socket(2), getaddrinfo(3), getifaddrs(3), ip(7),
ipv6(7), path_resolution(7), socket(7), unix(7)
SSEEEE AALLSSOO
aacccceepptt(2), ccoonnnneecctt(2), ggeettssoocckknnaammee(2), lliisstteenn(2), ssoocckkeett(2), ggeettaaddddrriinnffoo(3), ggeettiiffaaddddrrss(3), iipp(7),
iippvv66(7), ppaatthh__rreessoolluuttiioonn(7), ssoocckkeett(7), uunniixx(7)

Linux 2021-03-22 BIND(2)
Linux 2021-03-22 BIND(2)
Loading

0 comments on commit 2aa91d1

Please sign in to comment.