File: socket.h

package info (click to toggle)
openntpd 1%3A6.2p3-4.2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 2,472 kB
  • sloc: ansic: 9,413; sh: 4,425; yacc: 692; makefile: 310
file content (39 lines) | stat: -rw-r--r-- 997 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*
 * Public domain
 * sys/socket.h compatibility shim
 */

#include_next <sys/socket.h>

#ifndef SA_LEN
#define SA_LEN(X) \
	(((struct sockaddr*)(X))->sa_family == AF_INET ? sizeof(struct sockaddr_in) : \
	 ((struct sockaddr*)(X))->sa_family == AF_INET6 ? sizeof(struct sockaddr_in6) : \
	 ((struct sockaddr*)(X))->sa_family == AF_UNSPEC ? sizeof(struct sockaddr) : \
	   sizeof(struct sockaddr))
#endif

#if !defined(SOCK_NONBLOCK) || !defined(SOCK_CLOEXEC)
#define NEED_SOCKET_FLAGS
int _socket(int domain, int type, int protocol);
int _socketpair(int domain, int type, int protocol, int socket_vector[2]);
#ifndef SOCKET_FLAGS_PRIV
#define socket(d, t, p) _socket(d, t, p)
#define socketpair(d, t, p, s) _socketpair(d, t, p, s)
#endif
#endif

/*
 * Prevent Solaris 10 system header leakage
 */
#ifdef MODEMASK
#undef MODEMASK
#endif

#ifndef SOCK_NONBLOCK
#define	SOCK_NONBLOCK		0x4000	/* set O_NONBLOCK */
#endif

#ifndef SOCK_CLOEXEC
#define	SOCK_CLOEXEC		0x8000	/* set FD_CLOEXEC */
#endif