diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2020-12-09 18:30:22 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2020-12-09 18:30:22 +0000 |
commit | b6de172b3545a73f6f31500ee9c4d51898fbe2bc (patch) | |
tree | 8ecf4a5b3f1c5e2711057b468c017e8ebfa621b7 /src/conn-tools | |
parent | f7e676abdc799fcee5138807447b5e91ab05508f (diff) | |
download | s6-networking-b6de172b3545a73f6f31500ee9c4d51898fbe2bc.tar.xz |
Get rid of webipc.h
Diffstat (limited to 'src/conn-tools')
-rw-r--r-- | src/conn-tools/s6-tcpserver4-socketbinder.c | 8 | ||||
-rw-r--r-- | src/conn-tools/s6-tcpserver6-socketbinder.c | 8 |
2 files changed, 8 insertions, 8 deletions
diff --git a/src/conn-tools/s6-tcpserver4-socketbinder.c b/src/conn-tools/s6-tcpserver4-socketbinder.c index a37fae1..c02c3a6 100644 --- a/src/conn-tools/s6-tcpserver4-socketbinder.c +++ b/src/conn-tools/s6-tcpserver4-socketbinder.c @@ -3,13 +3,13 @@ #include <skalibs/nonposix.h> #include <stdint.h> #include <unistd.h> +#include <fcntl.h> #include <sys/socket.h> #include <skalibs/types.h> #include <skalibs/sgetopt.h> #include <skalibs/fmtscan.h> #include <skalibs/strerr2.h> -#include <skalibs/djbunix.h> #include <skalibs/socket.h> #include <skalibs/exec.h> @@ -21,7 +21,7 @@ int main (int argc, char const *const *argv) unsigned int backlog = SOMAXCONN ; int flagreuse = 1 ; int flagudp = 0 ; - int flagblocking = 0 ; + unsigned int flags = O_NONBLOCK ; char ip[4] ; uint16_t port ; PROG = "s6-tcpserver4-socketbinder" ; @@ -37,7 +37,7 @@ int main (int argc, char const *const *argv) case 'd' : flagreuse = 1 ; break ; case 'M' : flagudp = 0 ; break ; case 'm' : flagudp = 1 ; break ; - case 'B' : flagblocking = 1 ; break ; + case 'B' : flags = 0 ; break ; case 'b' : if (!uint0_scan(l.arg, &backlog)) dieusage() ; break ; default : dieusage() ; } @@ -47,7 +47,7 @@ int main (int argc, char const *const *argv) if (argc < 3) dieusage() ; if (!ip4_scan(argv[0], ip) || !uint160_scan(argv[1], &port)) dieusage() ; close(0) ; - if (flagudp ? socket_udp4_internal(flagblocking ? 0 : DJBUNIX_FLAG_NB) : socket_tcp4_internal(flagblocking ? 0 : DJBUNIX_FLAG_NB)) + if (flagudp ? socket_udp4_internal(flags) : socket_tcp4_internal(flags)) strerr_diefu1sys(111, "create socket") ; if ((flagreuse ? socket_bind4_reuse(0, ip, port) : socket_bind4(0, ip, port)) < 0) strerr_diefu5sys(111, "bind to ", argv[0], ":", argv[1], " ") ; diff --git a/src/conn-tools/s6-tcpserver6-socketbinder.c b/src/conn-tools/s6-tcpserver6-socketbinder.c index 683dc7c..6890d7e 100644 --- a/src/conn-tools/s6-tcpserver6-socketbinder.c +++ b/src/conn-tools/s6-tcpserver6-socketbinder.c @@ -3,13 +3,13 @@ #include <skalibs/nonposix.h> #include <stdint.h> #include <unistd.h> +#include <fcntl.h> #include <sys/socket.h> #include <skalibs/types.h> #include <skalibs/sgetopt.h> #include <skalibs/fmtscan.h> #include <skalibs/strerr2.h> -#include <skalibs/djbunix.h> #include <skalibs/socket.h> #include <skalibs/exec.h> @@ -21,7 +21,7 @@ int main (int argc, char const *const *argv) unsigned int backlog = SOMAXCONN ; int flagreuse = 1 ; int flagudp = 0 ; - int flagblocking = 0 ; + unsigned int flags = O_NONBLOCK ; char ip[16] ; uint16_t port ; PROG = "s6-tcpserver6-socketbinder" ; @@ -37,7 +37,7 @@ int main (int argc, char const *const *argv) case 'd' : flagreuse = 1 ; break ; case 'M' : flagudp = 0 ; break ; case 'm' : flagudp = 1 ; break ; - case 'B' : flagblocking = 1 ; break ; + case 'B' : flags = 0 ; break ; case 'b' : if (!uint0_scan(l.arg, &backlog)) dieusage() ; break ; default : dieusage() ; } @@ -47,7 +47,7 @@ int main (int argc, char const *const *argv) if (argc < 3) dieusage() ; if (!ip6_scan(argv[0], ip) || !uint160_scan(argv[1], &port)) dieusage() ; close(0) ; - if (flagudp ? socket_udp6_internal(flagblocking ? 0 : DJBUNIX_FLAG_NB) : socket_tcp6_internal(flagblocking ? 0 : DJBUNIX_FLAG_NB)) + if (flagudp ? socket_udp6_internal(flags) : socket_tcp6_internal(flags)) strerr_diefu1sys(111, "create socket") ; if ((flagreuse ? socket_bind6_reuse(0, ip, port) : socket_bind6(0, ip, port)) < 0) strerr_diefu5sys(111, "bind to ", argv[0], ":", argv[1], " ") ; |