2 #include <socket/sys/socket.h>
4 /* Now define the internal interfaces. */
5 extern int __socket (int __domain
, int __type
, int __protocol
);
7 /* Create two new sockets, of type TYPE in domain DOMAIN and using
8 protocol PROTOCOL, which are connected to each other, and put file
9 descriptors for them in FDS[0] and FDS[1]. If PROTOCOL is zero,
10 one will be chosen automatically. Returns 0 on success, -1 for errors. */
11 extern int __socketpair (int __domain
, int __type
, int __protocol
,
14 /* Return a socket of any type. The socket can be used in subsequent
15 ioctl calls to talk to the kernel. */
16 extern int __opensock (void) internal_function
;
18 /* Put the address of the peer connected to socket FD into *ADDR
19 (which is *LEN bytes long), and its actual length into *LEN. */
20 extern int __getpeername (int __fd
, __SOCKADDR_ARG __addr
, socklen_t
*__len
);
22 /* Send N bytes of BUF to socket FD. Returns the number sent or -1. */
23 extern int __send (int __fd
, __const
void *__buf
, size_t __n
, int __flags
);
25 /* Open a connection on socket FD to peer at ADDR (which LEN bytes long).
26 For connectionless socket types, just set the default address to send to
27 and the only address from which to accept transmissions.
28 Return 0 on success, -1 for errors. */
29 extern int __connect (int __fd
, __CONST_SOCKADDR_ARG __addr
, socklen_t __len
);
31 /* Return the length of a `sockaddr' structure. */
33 # define SA_LEN(_x) (_x)->sa_len
35 # define SA_LEN(_x) __libc_sa_len((_x)->sa_family)
36 extern int __libc_sa_len (sa_family_t __af
) __THROW
;