This source file includes following definitions.
- fd_set_blocked
1
2
3
4
5 #ifndef FPM_MISC_H
6 #define FPM_MISC_H 1
7
8 #include <sys/types.h>
9 #include <sys/socket.h>
10 #include <sys/un.h>
11 #include <unistd.h>
12 #include <fcntl.h>
13
14 #include "fpm_worker_pool.h"
15
16
17
18
19 #if (__FreeBSD__) || (__OpenBSD__)
20 #define FPM_BACKLOG_DEFAULT -1
21 #else
22 #define FPM_BACKLOG_DEFAULT 511
23 #endif
24
25 enum fpm_address_domain fpm_sockets_domain_from_address(char *addr);
26 int fpm_sockets_init_main();
27 int fpm_socket_get_listening_queue(int sock, unsigned *cur_lq, unsigned *max_lq);
28 int fpm_socket_unix_test_connect(struct sockaddr_un *sock, size_t socklen);
29
30
31 static inline int fd_set_blocked(int fd, int blocked)
32 {
33 int flags = fcntl(fd, F_GETFL);
34
35 if (flags < 0) {
36 return -1;
37 }
38
39 if (blocked) {
40 flags &= ~O_NONBLOCK;
41 } else {
42 flags |= O_NONBLOCK;
43 }
44 return fcntl(fd, F_SETFL, flags);
45 }
46
47
48 #endif