]> git.ipfire.org Git - thirdparty/glibc.git/blame - include/sys/socket.h
send returns ssize_t.
[thirdparty/glibc.git] / include / sys / socket.h
CommitLineData
6796bc80 1#ifndef _SYS_SOCKET_H
2064087b 2#include <socket/sys/socket.h>
bdbf022d
UD
3
4/* Now define the internal interfaces. */
c19559b0 5extern int __socket (int __domain, int __type, int __protocol);
f720d3d2 6
36f7b1df
MK
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. */
11extern int __socketpair (int __domain, int __type, int __protocol,
12 int __fds[2]);
13
f720d3d2
UD
14/* Return a socket of any type. The socket can be used in subsequent
15 ioctl calls to talk to the kernel. */
16extern int __opensock (void) internal_function;
17
3d421b28
AJ
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. */
20extern int __getpeername (int __fd, __SOCKADDR_ARG __addr, socklen_t *__len);
21
8f589a7c 22/* Send N bytes of BUF to socket FD. Returns the number sent or -1. */
c2063191 23extern ssize_t __send (int __fd, __const void *__buf, size_t __n, int __flags);
8f589a7c
AJ
24
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. */
29extern int __connect (int __fd, __CONST_SOCKADDR_ARG __addr, socklen_t __len);
30
3f66a0cf
UD
31/* Return the length of a `sockaddr' structure. */
32#ifdef _HAVE_SA_LEN
33# define SA_LEN(_x) (_x)->sa_len
34#else
35# define SA_LEN(_x) __libc_sa_len((_x)->sa_family)
36extern int __libc_sa_len (sa_family_t __af) __THROW;
37#endif
38
6796bc80 39#endif