skalibs

Mirror/fork of https://skarnet.org/software/skalibs/
git clone https://ccx.te2000.cz/git/skalibs
Log | Files | Refs | README | LICENSE

commit e557bab0dcaf35f003fa755b74e4c80000e05e42
parent 86312d159d55e99db5a5c82d9c50f31a1fe28199
Author: Laurent Bercot <ska-skaware@skarnet.org>
Date:   Wed,  9 Dec 2020 17:16:40 +0000

 Get rid of webipc.h and DJBUNIX_FLAG_*

 Decent semantic header separation is hard. It's always
an ongoing process. Here socket.h always included webipc.h
for listen(), and webipc.h always included djbunix.h for
socket_internal() and socketpair_internal(). That's ugh.
Just move all the socket stuff into one socket header.
Of course, djbunix.h is still needed most of the time for
fd_close() and other operations on fds, but those are
generic anyway.

 Also, O_CLOEXEC exists everywhere now, so we can use it as well
as O_NONBLOCK instead of redefining the flags in djbunix.h.

Diffstat:
Mpackage/deps.mak | 47+++++++++++++++++++++++------------------------
Msrc/include/skalibs/djbunix.h | 12++++--------
Msrc/include/skalibs/socket.h | 95++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------
Msrc/include/skalibs/stddjb.h | 1-
Dsrc/include/skalibs/webipc.h | 63---------------------------------------------------------------
Msrc/libstddjb/child_spawn1_socket.c | 2+-
Msrc/libstddjb/ipc_accept.c | 10++++++----
Msrc/libstddjb/ipc_bind.c | 3+--
Msrc/libstddjb/ipc_bind_reuse.c | 2+-
Msrc/libstddjb/ipc_bind_reuse_lock.c | 6++++--
Msrc/libstddjb/ipc_connect.c | 3+--
Msrc/libstddjb/ipc_connected.c | 3++-
Msrc/libstddjb/ipc_dgram.c | 3+--
Msrc/libstddjb/ipc_listen.c | 2+-
Msrc/libstddjb/ipc_local.c | 3++-
Msrc/libstddjb/ipc_pair.c | 3+--
Msrc/libstddjb/ipc_recv.c | 5++---
Msrc/libstddjb/ipc_send.c | 3+--
Msrc/libstddjb/ipc_stream.c | 3+--
Msrc/libstddjb/ipc_timed_connect.c | 3++-
Msrc/libstddjb/pipe_internal.c | 10++++++----
Msrc/libstddjb/socket_accept4.c | 8+++++---
Msrc/libstddjb/socket_accept6.c | 8+++++---
Msrc/libstddjb/socket_internal.c | 9++++++---
Msrc/libstddjb/socket_tcp4.c | 1+
Msrc/libstddjb/socketpair_internal.c | 9++++++---
Msrc/libunixonacid/ipc_timed_recv.c | 2+-
Msrc/libunixonacid/skaclient_server_ack.c | 2+-
Msrc/libunixonacid/skaclient_start_async.c | 4+++-
Msrc/libunixonacid/textclient_start.c | 2+-
30 files changed, 162 insertions(+), 165 deletions(-)

diff --git a/package/deps.mak b/package/deps.mak @@ -46,9 +46,9 @@ src/include/skalibs/siovec.h: src/include/skalibs/gccattributes.h src/include/skalibs/skaclient.h: src/include/skalibs/kolbak.h src/include/skalibs/tai.h src/include/skalibs/unixmessage.h src/include/skalibs/skalibs.h: src/include/skalibs/biguint.h src/include/skalibs/datastruct.h src/include/skalibs/posixplz.h src/include/skalibs/random.h src/include/skalibs/stdcrypto.h src/include/skalibs/stddjb.h src/include/skalibs/unixonacid.h src/include/skalibs/skamisc.h: src/include/skalibs/buffer.h src/include/skalibs/stralloc.h -src/include/skalibs/socket.h: src/include/skalibs/djbunix.h src/include/skalibs/gccattributes.h src/include/skalibs/tai.h src/include/skalibs/webipc.h +src/include/skalibs/socket.h: src/include/skalibs/gccattributes.h src/include/skalibs/posixplz.h src/include/skalibs/tai.h src/include/skalibs/stdcrypto.h: src/include/skalibs/md5.h src/include/skalibs/rc4.h src/include/skalibs/sha1.h src/include/skalibs/sha256.h src/include/skalibs/sha512.h -src/include/skalibs/stddjb.h: src/include/skalibs/alarm.h src/include/skalibs/alloc.h src/include/skalibs/allreadwrite.h src/include/skalibs/bitarray.h src/include/skalibs/bufalloc.h src/include/skalibs/buffer.h src/include/skalibs/bytestr.h src/include/skalibs/cbuffer.h src/include/skalibs/cdb.h src/include/skalibs/cdb_make.h src/include/skalibs/direntry.h src/include/skalibs/disize.h src/include/skalibs/diuint.h src/include/skalibs/diuint32.h src/include/skalibs/djbtime.h src/include/skalibs/djbunix.h src/include/skalibs/env.h src/include/skalibs/envalloc.h src/include/skalibs/error.h src/include/skalibs/exec.h src/include/skalibs/fmtscan.h src/include/skalibs/functypes.h src/include/skalibs/gccattributes.h src/include/skalibs/genalloc.h src/include/skalibs/genwrite.h src/include/skalibs/iobuffer.h src/include/skalibs/iopause.h src/include/skalibs/ip46.h src/include/skalibs/lolstdio.h src/include/skalibs/netstring.h src/include/skalibs/nsig.h src/include/skalibs/segfault.h src/include/skalibs/selfpipe.h src/include/skalibs/setgroups.h src/include/skalibs/sgetopt.h src/include/skalibs/sig.h src/include/skalibs/siovec.h src/include/skalibs/skamisc.h src/include/skalibs/socket.h src/include/skalibs/stralloc.h src/include/skalibs/strerr.h src/include/skalibs/strerr2.h src/include/skalibs/tai.h src/include/skalibs/types.h src/include/skalibs/uint16.h src/include/skalibs/uint32.h src/include/skalibs/uint64.h src/include/skalibs/webipc.h +src/include/skalibs/stddjb.h: src/include/skalibs/alarm.h src/include/skalibs/alloc.h src/include/skalibs/allreadwrite.h src/include/skalibs/bitarray.h src/include/skalibs/bufalloc.h src/include/skalibs/buffer.h src/include/skalibs/bytestr.h src/include/skalibs/cbuffer.h src/include/skalibs/cdb.h src/include/skalibs/cdb_make.h src/include/skalibs/direntry.h src/include/skalibs/disize.h src/include/skalibs/diuint.h src/include/skalibs/diuint32.h src/include/skalibs/djbtime.h src/include/skalibs/djbunix.h src/include/skalibs/env.h src/include/skalibs/envalloc.h src/include/skalibs/error.h src/include/skalibs/exec.h src/include/skalibs/fmtscan.h src/include/skalibs/functypes.h src/include/skalibs/gccattributes.h src/include/skalibs/genalloc.h src/include/skalibs/genwrite.h src/include/skalibs/iobuffer.h src/include/skalibs/iopause.h src/include/skalibs/ip46.h src/include/skalibs/lolstdio.h src/include/skalibs/netstring.h src/include/skalibs/nsig.h src/include/skalibs/segfault.h src/include/skalibs/selfpipe.h src/include/skalibs/setgroups.h src/include/skalibs/sgetopt.h src/include/skalibs/sig.h src/include/skalibs/siovec.h src/include/skalibs/skamisc.h src/include/skalibs/socket.h src/include/skalibs/stralloc.h src/include/skalibs/strerr.h src/include/skalibs/strerr2.h src/include/skalibs/tai.h src/include/skalibs/types.h src/include/skalibs/uint16.h src/include/skalibs/uint32.h src/include/skalibs/uint64.h src/include/skalibs/strerr.h: src/include/skalibs/gccattributes.h src/include/skalibs/strerr2.h: src/include/skalibs/strerr.h src/include/skalibs/tai.h: src/include/skalibs/gccattributes.h src/include/skalibs/uint64.h @@ -59,7 +59,6 @@ src/include/skalibs/unix-transactional.h: src/include/skalibs/stralloc.h src/inc src/include/skalibs/unixconnection.h: src/include/skalibs/unixmessage.h src/include/skalibs/unixmessage.h: src/include/skalibs/buffer.h src/include/skalibs/cbuffer.h src/include/skalibs/gccattributes.h src/include/skalibs/genalloc.h src/include/skalibs/stralloc.h src/include/skalibs/tai.h src/include/skalibs/unixonacid.h: src/include/skalibs/ancil.h src/include/skalibs/kolbak.h src/include/skalibs/skaclient.h src/include/skalibs/textclient.h src/include/skalibs/textmessage.h src/include/skalibs/unix-timed.h src/include/skalibs/unix-transactional.h src/include/skalibs/unixconnection.h src/include/skalibs/unixmessage.h -src/include/skalibs/webipc.h: src/include/skalibs/djbunix.h src/include/skalibs/posixplz.h src/include/skalibs/tai.h src/libdatastruct/avlnode-internal.h: src/include/skalibs/avlnode.h src/libdatastruct/genqdyn-internal.h: src/include/skalibs/genqdyn.h src/librandom/random-internal.h: src/include/skalibs/surf.h @@ -331,7 +330,7 @@ src/libstddjb/child_spawn.o src/libstddjb/child_spawn.lo: src/libstddjb/child_sp src/libstddjb/child_spawn0.o src/libstddjb/child_spawn0.lo: src/libstddjb/child_spawn0.c src/include/skalibs/allreadwrite.h src/include/skalibs/config.h src/include/skalibs/djbunix.h src/include/skalibs/exec.h src/include/skalibs/sig.h src/include/skalibs/strerr2.h src/include/skalibs/sysdeps.h src/libstddjb/child_spawn1_internal.o src/libstddjb/child_spawn1_internal.lo: src/libstddjb/child_spawn1_internal.c src/include/skalibs/allreadwrite.h src/include/skalibs/config.h src/include/skalibs/djbunix.h src/include/skalibs/exec.h src/include/skalibs/sig.h src/include/skalibs/strerr2.h src/include/skalibs/sysdeps.h src/libstddjb/child_spawn1_pipe.o src/libstddjb/child_spawn1_pipe.lo: src/libstddjb/child_spawn1_pipe.c src/libstddjb/djbunix-internal.h src/include/skalibs/djbunix.h -src/libstddjb/child_spawn1_socket.o src/libstddjb/child_spawn1_socket.lo: src/libstddjb/child_spawn1_socket.c src/libstddjb/djbunix-internal.h src/include/skalibs/djbunix.h src/include/skalibs/webipc.h +src/libstddjb/child_spawn1_socket.o src/libstddjb/child_spawn1_socket.lo: src/libstddjb/child_spawn1_socket.c src/libstddjb/djbunix-internal.h src/include/skalibs/djbunix.h src/include/skalibs/socket.h src/libstddjb/child_spawn2.o src/libstddjb/child_spawn2.lo: src/libstddjb/child_spawn2.c src/include/skalibs/allreadwrite.h src/include/skalibs/config.h src/include/skalibs/djbunix.h src/include/skalibs/exec.h src/include/skalibs/sig.h src/include/skalibs/strerr2.h src/include/skalibs/sysdeps.h src/libstddjb/child_spawn3.o src/libstddjb/child_spawn3.lo: src/libstddjb/child_spawn3.c src/include/skalibs/allreadwrite.h src/include/skalibs/config.h src/include/skalibs/djbunix.h src/include/skalibs/env.h src/include/skalibs/exec.h src/include/skalibs/sig.h src/include/skalibs/strerr2.h src/include/skalibs/sysdeps.h src/include/skalibs/types.h src/libstddjb/coe.o src/libstddjb/coe.lo: src/libstddjb/coe.c src/include/skalibs/djbunix.h @@ -424,20 +423,20 @@ src/libstddjb/ip4_scanu32.o src/libstddjb/ip4_scanu32.lo: src/libstddjb/ip4_scan src/libstddjb/ip6_fmt.o src/libstddjb/ip6_fmt.lo: src/libstddjb/ip6_fmt.c src/include/skalibs/diuint.h src/include/skalibs/fmtscan.h src/libstddjb/ip6_scan.o src/libstddjb/ip6_scan.lo: src/libstddjb/ip6_scan.c src/include/skalibs/fmtscan.h src/include/skalibs/uint16.h src/libstddjb/ip6_scanlist.o src/libstddjb/ip6_scanlist.lo: src/libstddjb/ip6_scanlist.c src/include/skalibs/fmtscan.h -src/libstddjb/ipc_accept.o src/libstddjb/ipc_accept.lo: src/libstddjb/ipc_accept.c src/include/skalibs/bytestr.h src/include/skalibs/djbunix.h src/include/skalibs/nonposix.h src/include/skalibs/sysdeps.h src/include/skalibs/webipc.h -src/libstddjb/ipc_bind.o src/libstddjb/ipc_bind.lo: src/libstddjb/ipc_bind.c src/include/skalibs/nonposix.h src/include/skalibs/posixishard.h src/include/skalibs/webipc.h -src/libstddjb/ipc_bind_reuse.o src/libstddjb/ipc_bind_reuse.lo: src/libstddjb/ipc_bind_reuse.c src/include/skalibs/webipc.h -src/libstddjb/ipc_bind_reuse_lock.o src/libstddjb/ipc_bind_reuse_lock.lo: src/libstddjb/ipc_bind_reuse_lock.c src/include/skalibs/djbunix.h src/include/skalibs/nonposix.h src/include/skalibs/webipc.h -src/libstddjb/ipc_connect.o src/libstddjb/ipc_connect.lo: src/libstddjb/ipc_connect.c src/include/skalibs/nonposix.h src/include/skalibs/posixishard.h src/include/skalibs/webipc.h -src/libstddjb/ipc_connected.o src/libstddjb/ipc_connected.lo: src/libstddjb/ipc_connected.c src/include/skalibs/allreadwrite.h src/include/skalibs/nonposix.h src/include/skalibs/webipc.h -src/libstddjb/ipc_dgram.o src/libstddjb/ipc_dgram.lo: src/libstddjb/ipc_dgram.c src/include/skalibs/djbunix.h src/include/skalibs/nonposix.h src/include/skalibs/webipc.h -src/libstddjb/ipc_listen.o src/libstddjb/ipc_listen.lo: src/libstddjb/ipc_listen.c src/include/skalibs/nonposix.h src/include/skalibs/webipc.h -src/libstddjb/ipc_local.o src/libstddjb/ipc_local.lo: src/libstddjb/ipc_local.c src/include/skalibs/bytestr.h src/include/skalibs/nonposix.h src/include/skalibs/webipc.h -src/libstddjb/ipc_pair.o src/libstddjb/ipc_pair.lo: src/libstddjb/ipc_pair.c src/include/skalibs/djbunix.h src/include/skalibs/nonposix.h src/include/skalibs/webipc.h -src/libstddjb/ipc_recv.o src/libstddjb/ipc_recv.lo: src/libstddjb/ipc_recv.c src/include/skalibs/nonposix.h src/include/skalibs/posixishard.h src/include/skalibs/webipc.h -src/libstddjb/ipc_send.o src/libstddjb/ipc_send.lo: src/libstddjb/ipc_send.c src/include/skalibs/nonposix.h src/include/skalibs/posixishard.h src/include/skalibs/webipc.h -src/libstddjb/ipc_stream.o src/libstddjb/ipc_stream.lo: src/libstddjb/ipc_stream.c src/include/skalibs/djbunix.h src/include/skalibs/nonposix.h src/include/skalibs/webipc.h -src/libstddjb/ipc_timed_connect.o src/libstddjb/ipc_timed_connect.lo: src/libstddjb/ipc_timed_connect.c src/include/skalibs/error.h src/include/skalibs/iopause.h src/include/skalibs/webipc.h +src/libstddjb/ipc_accept.o src/libstddjb/ipc_accept.lo: src/libstddjb/ipc_accept.c src/include/skalibs/bytestr.h src/include/skalibs/djbunix.h src/include/skalibs/nonposix.h src/include/skalibs/socket.h src/include/skalibs/sysdeps.h +src/libstddjb/ipc_bind.o src/libstddjb/ipc_bind.lo: src/libstddjb/ipc_bind.c src/include/skalibs/nonposix.h src/include/skalibs/posixishard.h src/include/skalibs/socket.h +src/libstddjb/ipc_bind_reuse.o src/libstddjb/ipc_bind_reuse.lo: src/libstddjb/ipc_bind_reuse.c src/include/skalibs/socket.h +src/libstddjb/ipc_bind_reuse_lock.o src/libstddjb/ipc_bind_reuse_lock.lo: src/libstddjb/ipc_bind_reuse_lock.c src/include/skalibs/djbunix.h src/include/skalibs/nonposix.h src/include/skalibs/socket.h +src/libstddjb/ipc_connect.o src/libstddjb/ipc_connect.lo: src/libstddjb/ipc_connect.c src/include/skalibs/nonposix.h src/include/skalibs/posixishard.h src/include/skalibs/socket.h +src/libstddjb/ipc_connected.o src/libstddjb/ipc_connected.lo: src/libstddjb/ipc_connected.c src/include/skalibs/allreadwrite.h src/include/skalibs/nonposix.h src/include/skalibs/socket.h +src/libstddjb/ipc_dgram.o src/libstddjb/ipc_dgram.lo: src/libstddjb/ipc_dgram.c src/include/skalibs/nonposix.h src/include/skalibs/socket.h +src/libstddjb/ipc_listen.o src/libstddjb/ipc_listen.lo: src/libstddjb/ipc_listen.c src/include/skalibs/nonposix.h src/include/skalibs/socket.h +src/libstddjb/ipc_local.o src/libstddjb/ipc_local.lo: src/libstddjb/ipc_local.c src/include/skalibs/bytestr.h src/include/skalibs/nonposix.h src/include/skalibs/socket.h +src/libstddjb/ipc_pair.o src/libstddjb/ipc_pair.lo: src/libstddjb/ipc_pair.c src/include/skalibs/nonposix.h src/include/skalibs/socket.h +src/libstddjb/ipc_recv.o src/libstddjb/ipc_recv.lo: src/libstddjb/ipc_recv.c src/include/skalibs/nonposix.h src/include/skalibs/posixishard.h src/include/skalibs/socket.h +src/libstddjb/ipc_send.o src/libstddjb/ipc_send.lo: src/libstddjb/ipc_send.c src/include/skalibs/nonposix.h src/include/skalibs/posixishard.h src/include/skalibs/socket.h +src/libstddjb/ipc_stream.o src/libstddjb/ipc_stream.lo: src/libstddjb/ipc_stream.c src/include/skalibs/nonposix.h src/include/skalibs/socket.h +src/libstddjb/ipc_timed_connect.o src/libstddjb/ipc_timed_connect.lo: src/libstddjb/ipc_timed_connect.c src/include/skalibs/error.h src/include/skalibs/iopause.h src/include/skalibs/socket.h src/libstddjb/leapsecs_add.o src/libstddjb/leapsecs_add.lo: src/libstddjb/leapsecs_add.c src/libstddjb/djbtime-internal.h src/include/skalibs/uint64.h src/libstddjb/leapsecs_sub.o src/libstddjb/leapsecs_sub.lo: src/libstddjb/leapsecs_sub.c src/libstddjb/djbtime-internal.h src/include/skalibs/uint64.h src/libstddjb/leapsecs_table.o src/libstddjb/leapsecs_table.lo: src/libstddjb/leapsecs_table.c src/libstddjb/djbtime-internal.h src/include/skalibs/tai.h src/include/skalibs/uint64.h @@ -568,7 +567,7 @@ src/libstddjb/socket_deadlineconnstamp46.o src/libstddjb/socket_deadlineconnstam src/libstddjb/socket_deadlineconnstamp4_u32.o src/libstddjb/socket_deadlineconnstamp4_u32.lo: src/libstddjb/socket_deadlineconnstamp4_u32.c src/include/skalibs/socket.h src/include/skalibs/uint32.h src/libstddjb/socket_deadlineconnstamp6.o src/libstddjb/socket_deadlineconnstamp6.lo: src/libstddjb/socket_deadlineconnstamp6.c src/include/skalibs/error.h src/include/skalibs/socket.h src/libstddjb/socket_delay.o src/libstddjb/socket_delay.lo: src/libstddjb/socket_delay.c src/include/skalibs/nonposix.h src/include/skalibs/socket.h -src/libstddjb/socket_internal.o src/libstddjb/socket_internal.lo: src/libstddjb/socket_internal.c src/include/skalibs/djbunix.h src/include/skalibs/nonposix.h src/include/skalibs/sysdeps.h +src/libstddjb/socket_internal.o src/libstddjb/socket_internal.lo: src/libstddjb/socket_internal.c src/include/skalibs/djbunix.h src/include/skalibs/nonposix.h src/include/skalibs/socket.h src/include/skalibs/sysdeps.h src/libstddjb/socket_ioloop.o src/libstddjb/socket_ioloop.lo: src/libstddjb/socket_ioloop.c src/include/skalibs/error.h src/include/skalibs/iopause.h src/include/skalibs/socket.h src/libstddjb/socket_ioloop_send4.o src/libstddjb/socket_ioloop_send4.lo: src/libstddjb/socket_ioloop_send4.c src/include/skalibs/socket.h src/libstddjb/socket_ioloop_send6.o src/libstddjb/socket_ioloop_send6.lo: src/libstddjb/socket_ioloop_send6.c src/include/skalibs/socket.h @@ -589,7 +588,7 @@ src/libstddjb/socket_tryr.o src/libstddjb/socket_tryr.lo: src/libstddjb/socket_t src/libstddjb/socket_udp4.o src/libstddjb/socket_udp4.lo: src/libstddjb/socket_udp4.c src/include/skalibs/nonposix.h src/include/skalibs/socket.h src/libstddjb/socket_udp6.o src/libstddjb/socket_udp6.lo: src/libstddjb/socket_udp6.c src/include/skalibs/djbunix.h src/include/skalibs/ip46.h src/include/skalibs/nonposix.h src/include/skalibs/socket.h src/libstddjb/socket_waitconn.o src/libstddjb/socket_waitconn.lo: src/libstddjb/socket_waitconn.c src/include/skalibs/allreadwrite.h src/include/skalibs/iopause.h src/include/skalibs/socket.h -src/libstddjb/socketpair_internal.o src/libstddjb/socketpair_internal.lo: src/libstddjb/socketpair_internal.c src/include/skalibs/djbunix.h src/include/skalibs/nonposix.h src/include/skalibs/sysdeps.h +src/libstddjb/socketpair_internal.o src/libstddjb/socketpair_internal.lo: src/libstddjb/socketpair_internal.c src/include/skalibs/djbunix.h src/include/skalibs/nonposix.h src/include/skalibs/socket.h src/include/skalibs/sysdeps.h src/libstddjb/stamp.o src/libstddjb/stamp.lo: src/libstddjb/stamp.c src/include/skalibs/tai.h src/libstddjb/str_chr.o src/libstddjb/str_chr.lo: src/libstddjb/str_chr.c src/include/skalibs/bytestr.h src/libstddjb/str_fmt.o src/libstddjb/str_fmt.lo: src/libstddjb/str_fmt.c src/include/skalibs/fmtscan.h @@ -761,7 +760,7 @@ src/libunixonacid/dd_commit.o src/libunixonacid/dd_commit.lo: src/libunixonacid/ src/libunixonacid/dd_commit_devino.o src/libunixonacid/dd_commit_devino.lo: src/libunixonacid/dd_commit_devino.c src/include/skalibs/unix-transactional.h src/libunixonacid/dd_open_read.o src/libunixonacid/dd_open_read.lo: src/libunixonacid/dd_open_read.c src/include/skalibs/djbunix.h src/include/skalibs/unix-transactional.h src/libunixonacid/dd_open_write.o src/libunixonacid/dd_open_write.lo: src/libunixonacid/dd_open_write.c src/include/skalibs/djbunix.h src/include/skalibs/random.h src/include/skalibs/stralloc.h src/include/skalibs/unix-transactional.h -src/libunixonacid/ipc_timed_recv.o src/libunixonacid/ipc_timed_recv.lo: src/libunixonacid/ipc_timed_recv.c src/include/skalibs/allreadwrite.h src/include/skalibs/functypes.h src/include/skalibs/unix-timed.h src/include/skalibs/webipc.h +src/libunixonacid/ipc_timed_recv.o src/libunixonacid/ipc_timed_recv.lo: src/libunixonacid/ipc_timed_recv.c src/include/skalibs/allreadwrite.h src/include/skalibs/functypes.h src/include/skalibs/socket.h src/include/skalibs/unix-timed.h src/libunixonacid/ipc_timed_send.o src/libunixonacid/ipc_timed_send.lo: src/libunixonacid/ipc_timed_send.c src/include/skalibs/error.h src/include/skalibs/iopause.h src/include/skalibs/nonposix.h src/include/skalibs/posixishard.h src/include/skalibs/unix-timed.h src/libunixonacid/ipc_timed_sendv.o src/libunixonacid/ipc_timed_sendv.lo: src/libunixonacid/ipc_timed_sendv.c src/include/skalibs/error.h src/include/skalibs/iopause.h src/include/skalibs/nonposix.h src/include/skalibs/posixishard.h src/include/skalibs/siovec.h src/include/skalibs/unix-timed.h src/libunixonacid/kolbak_call.o src/libunixonacid/kolbak_call.lo: src/libunixonacid/kolbak_call.c src/include/skalibs/kolbak.h src/include/skalibs/unixmessage.h @@ -796,11 +795,11 @@ src/libunixonacid/skaclient_send.o src/libunixonacid/skaclient_send.lo: src/libu src/libunixonacid/skaclient_sendmsg.o src/libunixonacid/skaclient_sendmsg.lo: src/libunixonacid/skaclient_sendmsg.c src/include/skalibs/skaclient.h src/libunixonacid/skaclient_sendmsgv.o src/libunixonacid/skaclient_sendmsgv.lo: src/libunixonacid/skaclient_sendmsgv.c src/include/skalibs/skaclient.h src/libunixonacid/skaclient_sendv.o src/libunixonacid/skaclient_sendv.lo: src/libunixonacid/skaclient_sendv.c src/include/skalibs/skaclient.h src/include/skalibs/unixmessage.h -src/libunixonacid/skaclient_server_ack.o src/libunixonacid/skaclient_server_ack.lo: src/libunixonacid/skaclient_server_ack.c src/include/skalibs/djbunix.h src/include/skalibs/posixishard.h src/include/skalibs/skaclient.h src/include/skalibs/unixmessage.h src/include/skalibs/webipc.h +src/libunixonacid/skaclient_server_ack.o src/libunixonacid/skaclient_server_ack.lo: src/libunixonacid/skaclient_server_ack.c src/include/skalibs/djbunix.h src/include/skalibs/posixishard.h src/include/skalibs/skaclient.h src/include/skalibs/socket.h src/include/skalibs/unixmessage.h src/libunixonacid/skaclient_server_bidi_ack.o src/libunixonacid/skaclient_server_bidi_ack.lo: src/libunixonacid/skaclient_server_bidi_ack.c src/include/skalibs/skaclient.h src/include/skalibs/unixmessage.h src/libunixonacid/skaclient_server_init.o src/libunixonacid/skaclient_server_init.lo: src/libunixonacid/skaclient_server_init.c src/include/skalibs/allreadwrite.h src/include/skalibs/skaclient.h src/include/skalibs/unixmessage.h src/libunixonacid/skaclient_start.o src/libunixonacid/skaclient_start.lo: src/libunixonacid/skaclient_start.c src/include/skalibs/kolbak.h src/libunixonacid/skaclient-internal.h src/include/skalibs/skaclient.h -src/libunixonacid/skaclient_start_async.o src/libunixonacid/skaclient_start_async.lo: src/libunixonacid/skaclient_start_async.c src/include/skalibs/error.h src/include/skalibs/kolbak.h src/libunixonacid/skaclient-internal.h src/include/skalibs/skaclient.h src/include/skalibs/unixmessage.h src/include/skalibs/webipc.h +src/libunixonacid/skaclient_start_async.o src/libunixonacid/skaclient_start_async.lo: src/libunixonacid/skaclient_start_async.c src/include/skalibs/djbunix.h src/include/skalibs/error.h src/include/skalibs/kolbak.h src/libunixonacid/skaclient-internal.h src/include/skalibs/skaclient.h src/include/skalibs/socket.h src/include/skalibs/unixmessage.h src/libunixonacid/skaclient_start_cb.o src/libunixonacid/skaclient_start_cb.lo: src/libunixonacid/skaclient_start_cb.c src/include/skalibs/posixishard.h src/libunixonacid/skaclient-internal.h src/include/skalibs/skaclient.h src/include/skalibs/unixmessage.h src/libunixonacid/skaclient_startf.o src/libunixonacid/skaclient_startf.lo: src/libunixonacid/skaclient_startf.c src/include/skalibs/kolbak.h src/libunixonacid/skaclient-internal.h src/include/skalibs/skaclient.h src/libunixonacid/skaclient_startf_async.o src/libunixonacid/skaclient_startf_async.lo: src/libunixonacid/skaclient_startf_async.c src/include/skalibs/djbunix.h src/include/skalibs/kolbak.h src/libunixonacid/skaclient-internal.h src/include/skalibs/skaclient.h @@ -813,7 +812,7 @@ src/libunixonacid/textclient_end.o src/libunixonacid/textclient_end.lo: src/libu src/libunixonacid/textclient_server_init.o src/libunixonacid/textclient_server_init.lo: src/libunixonacid/textclient_server_init.c src/include/skalibs/djbunix.h src/include/skalibs/textclient.h src/libunixonacid/textclient_server_init_frompipe.o src/libunixonacid/textclient_server_init_frompipe.lo: src/libunixonacid/textclient_server_init_frompipe.c src/include/skalibs/allreadwrite.h src/include/skalibs/djbunix.h src/include/skalibs/posixishard.h src/include/skalibs/textclient.h src/include/skalibs/textmessage.h src/include/skalibs/types.h src/libunixonacid/textclient_server_init_fromsocket.o src/libunixonacid/textclient_server_init_fromsocket.lo: src/libunixonacid/textclient_server_init_fromsocket.c src/include/skalibs/allreadwrite.h src/include/skalibs/posixishard.h src/include/skalibs/textclient.h src/include/skalibs/textmessage.h -src/libunixonacid/textclient_start.o src/libunixonacid/textclient_start.lo: src/libunixonacid/textclient_start.c src/include/skalibs/djbunix.h src/include/skalibs/posixishard.h src/include/skalibs/textclient.h src/include/skalibs/textmessage.h src/include/skalibs/webipc.h +src/libunixonacid/textclient_start.o src/libunixonacid/textclient_start.lo: src/libunixonacid/textclient_start.c src/include/skalibs/djbunix.h src/include/skalibs/posixishard.h src/include/skalibs/socket.h src/include/skalibs/textclient.h src/include/skalibs/textmessage.h src/libunixonacid/textclient_startf.o src/libunixonacid/textclient_startf.lo: src/libunixonacid/textclient_startf.c src/include/skalibs/allreadwrite.h src/include/skalibs/djbunix.h src/include/skalibs/posixishard.h src/include/skalibs/textclient.h src/include/skalibs/textmessage.h src/libunixonacid/textclient_zero.o src/libunixonacid/textclient_zero.lo: src/libunixonacid/textclient_zero.c src/include/skalibs/textclient.h src/libunixonacid/textmessage_create_send_channel.o src/libunixonacid/textmessage_create_send_channel.lo: src/libunixonacid/textmessage_create_send_channel.c src/include/skalibs/ancil.h src/include/skalibs/djbunix.h src/include/skalibs/posixishard.h src/include/skalibs/textclient.h src/include/skalibs/textmessage.h src/include/skalibs/unix-timed.h diff --git a/src/include/skalibs/djbunix.h b/src/include/skalibs/djbunix.h @@ -6,21 +6,19 @@ #include <sys/types.h> #include <sys/uio.h> #include <sys/wait.h> +#include <fcntl.h> #include <skalibs/gccattributes.h> #include <skalibs/stralloc.h> -#define DJBUNIX_FLAG_NB 0x01U -#define DJBUNIX_FLAG_COE 0x02U - extern int coe (int) ; extern int uncoe (int) ; extern int ndelay_on (int) ; extern int ndelay_off (int) ; extern int pipe_internal (int *, unsigned int) ; -#define pipenb(p) pipe_internal(p, DJBUNIX_FLAG_NB) -#define pipecoe(p) pipe_internal(p, DJBUNIX_FLAG_COE) -#define pipenbcoe(p) pipe_internal(p, DJBUNIX_FLAG_NB|DJBUNIX_FLAG_COE) +#define pipenb(p) pipe_internal(p, O_NONBLOCK) +#define pipecoe(p) pipe_internal(p, O_CLOEXEC) +#define pipenbcoe(p) pipe_internal(p, O_NONBLOCK|O_CLOEXEC) extern int fd_copy (int, int) ; extern int fd_copy2 (int, int, int, int) ; extern int fd_move (int, int) ; @@ -57,8 +55,6 @@ extern int open_trunc (char const *) ; extern int openc_trunc (char const *) ; extern int open_write (char const *) ; extern int openc_write (char const *) ; -extern int socket_internal (int, int, int, unsigned int) ; -extern int socketpair_internal (int, int, int, unsigned int, int *) ; extern size_t path_canonicalize (char *, char const *, int) ; diff --git a/src/include/skalibs/socket.h b/src/include/skalibs/socket.h @@ -3,18 +3,69 @@ #ifndef SOCKET_H #define SOCKET_H -#include <sys/types.h> +#include <stddef.h> #include <stdint.h> +#include <fcntl.h> + #include <skalibs/gccattributes.h> +#include <skalibs/posixplz.h> #include <skalibs/tai.h> -#include <skalibs/djbunix.h> -#include <skalibs/webipc.h> typedef ssize_t socket_io_func_t (int, char *, size_t, char *, uint16_t *) ; typedef socket_io_func_t *socket_io_func_t_ref ; +extern int socket_internal (int, int, int, unsigned int) ; +extern int socketpair_internal (int, int, int, unsigned int, int *) ; + + + /* UNIX domain sockets */ + +#define IPCPATH_MAX 107 + +#define ipc_stream() ipc_stream_nb() +#define ipc_stream_b() ipc_stream_internal(0) +#define ipc_stream_nb() ipc_stream_internal(O_NONBLOCK) +#define ipc_stream_coe() ipc_stream_internal(O_CLOEXEC) +#define ipc_stream_nbcoe() ipc_stream_internal(O_NONBLOCK|O_CLOEXEC) +extern int ipc_stream_internal (unsigned int) ; + +#define ipc_datagram() ipc_datagram_nb() +#define ipc_datagram_b() ipc_datagram_internal(0) +#define ipc_datagram_nb() ipc_datagram_internal(O_NONBLOCK) +#define ipc_datagram_coe() ipc_datagram_internal(O_CLOEXEC) +#define ipc_datagram_nbcoe() ipc_datagram_internal(O_NONBLOCK|O_CLOEXEC) +extern int ipc_datagram_internal (unsigned int) ; + +#define ipc_pair(sv) ipc_pair_nb(sv) +#define ipc_pair_b(sv) ipc_pair_internal((sv), 0) +#define ipc_pair_nb(sv) ipc_pair_internal((sv), O_NONBLOCK) +#define ipc_pair_coe(sv) ipc_pair_internal((sv), O_CLOEXEC) +#define ipc_pair_nbcoe(sv) ipc_pair_internal((sv), O_NONBLOCK|O_CLOEXEC) +extern int ipc_pair_internal (int *, unsigned int) ; + +extern int ipc_bind (int, char const *) ; +extern int ipc_bind_reuse (int, char const *) ; +extern int ipc_bind_reuse_lock (int, char const *, int *) ; +extern int ipc_listen (int, int) ; + +#define ipc_accept(s, path, len, trunc) ipc_accept_internal(s, path, len, (trunc), 0) +#define ipc_accept_nb(s, path, len, trunc) ipc_accept_internal(s, path, len, (trunc), O_NONBLOCK) +#define ipc_accept_coe(s, path, len, trunc) ipc_accept_internal(s, path, len, (trunc), O_CLOEXEC) +#define ipc_accept_nbcoe(s, path, len, trunc) ipc_accept_internal(s, path, len, (trunc), O_NONBLOCK|O_CLOEXEC) +extern int ipc_accept_internal (int, char *, size_t, int *, unsigned int) ; + +extern int ipc_local (int, char *, size_t, int *) ; + +extern int ipc_connect (int, char const *) ; +extern int ipc_connected (int) ; +extern int ipc_timed_connect (int, char const *, tain_t const *, tain_t *) ; +#define ipc_timed_connect_g(fd, path, deadline) ipc_timed_connect(fd, path, (deadline), &STAMP) + +extern ssize_t ipc_send (int, char const *, size_t, char const *) ; +extern ssize_t ipc_recv (int, char *, size_t, char *) ; + - /* INET and INET6 domain socket operations */ + /* INET and INET6 domain sockets */ #define socket_tcp() socket_tcp4() #define socket_tcp_b() socket_tcp4_b() @@ -24,16 +75,16 @@ typedef socket_io_func_t *socket_io_func_t_ref ; #define socket_tcp4() socket_tcp4_nb() #define socket_tcp4_b() socket_tcp4_internal(0) -#define socket_tcp4_nb() socket_tcp4_internal(DJBUNIX_FLAG_NB) -#define socket_tcp4_coe() socket_tcp4_internal(DJBUNIX_FLAG_COE) -#define socket_tcp4_nbcoe() socket_tcp4_internal(DJBUNIX_FLAG_NB|DJBUNIX_FLAG_COE) +#define socket_tcp4_nb() socket_tcp4_internal(O_NONBLOCK) +#define socket_tcp4_coe() socket_tcp4_internal(O_CLOEXEC) +#define socket_tcp4_nbcoe() socket_tcp4_internal(O_NONBLOCK|O_CLOEXEC) extern int socket_tcp4_internal (unsigned int) ; #define socket_tcp6() socket_tcp6_nb() #define socket_tcp6_b() socket_tcp6_internal(0) -#define socket_tcp6_nb() socket_tcp6_internal(DJBUNIX_FLAG_NB) -#define socket_tcp6_coe() socket_tcp6_internal(DJBUNIX_FLAG_COE) -#define socket_tcp6_nbcoe() socket_tcp6_internal(DJBUNIX_FLAG_NB|DJBUNIX_FLAG_COE) +#define socket_tcp6_nb() socket_tcp6_internal(O_NONBLOCK) +#define socket_tcp6_coe() socket_tcp6_internal(O_CLOEXEC) +#define socket_tcp6_nbcoe() socket_tcp6_internal(O_NONBLOCK|O_CLOEXEC) extern int socket_tcp6_internal (unsigned int) ; #define socket_udp() socket_udp4() @@ -44,16 +95,16 @@ extern int socket_tcp6_internal (unsigned int) ; #define socket_udp4() socket_udp4_nb() #define socket_udp4_b() socket_udp4_internal(0) -#define socket_udp4_nb() socket_udp4_internal(DJBUNIX_FLAG_NB) -#define socket_udp4_coe() socket_udp4_internal(DJBUNIX_FLAG_COE) -#define socket_udp4_nbcoe() socket_udp4_internal(DJBUNIX_FLAG_NB|DJBUNIX_FLAG_COE) +#define socket_udp4_nb() socket_udp4_internal(O_NONBLOCK) +#define socket_udp4_coe() socket_udp4_internal(O_CLOEXEC) +#define socket_udp4_nbcoe() socket_udp4_internal(O_NONBLOCK|O_CLOEXEC) extern int socket_udp4_internal (unsigned int) ; #define socket_udp6() socket_udp6_nb() #define socket_udp6_b() socket_udp6_internal(0) -#define socket_udp6_nb() socket_udp6_internal(DJBUNIX_FLAG_NB) -#define socket_udp6_coe() socket_udp6_internal(DJBUNIX_FLAG_COE) -#define socket_udp6_nbcoe() socket_udp6_internal(DJBUNIX_FLAG_NB|DJBUNIX_FLAG_COE) +#define socket_udp6_nb() socket_udp6_internal(O_NONBLOCK) +#define socket_udp6_coe() socket_udp6_internal(O_CLOEXEC) +#define socket_udp6_nbcoe() socket_udp6_internal(O_NONBLOCK|O_CLOEXEC) extern int socket_udp6_internal (unsigned int) ; extern int socket_waitconn (int, tain_t const *, tain_t *) ; @@ -79,9 +130,9 @@ extern int socket_bind6 (int, char const *, uint16_t) ; extern int socket_bind6_reuse (int, char const *, uint16_t) ; #define socket_accept4(s, ip, port) socket_accept4_internal(s, ip, (port), 0) -#define socket_accept4_nb(s, ip, port) socket_accept4_internal(s, ip, (port), DJBUNIX_FLAG_NB) -#define socket_accept4_coe(s, ip, port) socket_accept4_internal(s, ip, (port), DJBUNIX_FLAG_COE) -#define socket_accept4_nbcoe(s, ip, port) socket_accept4_internal(s, ip, (port), DJBUNIX_FLAG_NB|DJBUNIX_FLAG_COE) +#define socket_accept4_nb(s, ip, port) socket_accept4_internal(s, ip, (port), O_NONBLOCK) +#define socket_accept4_coe(s, ip, port) socket_accept4_internal(s, ip, (port), O_CLOEXEC) +#define socket_accept4_nbcoe(s, ip, port) socket_accept4_internal(s, ip, (port), O_NONBLOCK|O_CLOEXEC) extern int socket_accept4_internal (int, char *, uint16_t *, unsigned int) ; extern socket_io_func_t socket_recv4 ; extern ssize_t socket_send4 (int, char const *, size_t, char const *, uint16_t) ; @@ -90,9 +141,9 @@ extern int socket_local4 (int, char *, uint16_t *) ; extern int socket_remote4 (int, char *, uint16_t *) ; #define socket_accept6(s, ip6, port) socket_accept6_internal(s, ip6, (port), 0) -#define socket_accept6_nb(s, ip6, port) socket_accept6_internal(s, ip6, (port), DJBUNIX_FLAG_NB) -#define socket_accept6_coe(s, ip6, port) socket_accept6_internal(s, ip6, (port), DJBUNIX_FLAG_COE) -#define socket_accept6_nbcoe(s, ip6, port) socket_accept6_internal(s, ip6, (port), DJBUNIX_FLAG_NB|DJBUNIX_FLAG_COE) +#define socket_accept6_nb(s, ip6, port) socket_accept6_internal(s, ip6, (port), O_NONBLOCK) +#define socket_accept6_coe(s, ip6, port) socket_accept6_internal(s, ip6, (port), O_CLOEXEC) +#define socket_accept6_nbcoe(s, ip6, port) socket_accept6_internal(s, ip6, (port), O_NONBLOCK|O_CLOEXEC) extern int socket_accept6_internal (int, char *, uint16_t *, unsigned int) ; extern socket_io_func_t socket_recv6 ; extern ssize_t socket_send6 (int, char const *, size_t, char const *, uint16_t) ; diff --git a/src/include/skalibs/stddjb.h b/src/include/skalibs/stddjb.h @@ -51,6 +51,5 @@ #include <skalibs/strerr.h> #include <skalibs/strerr2.h> #include <skalibs/tai.h> -#include <skalibs/webipc.h> #endif diff --git a/src/include/skalibs/webipc.h b/src/include/skalibs/webipc.h @@ -1,63 +0,0 @@ -/* ISC license. */ - -#ifndef WEBIPC_H -#define WEBIPC_H - - /* - UNIX domain socket functions. - "web" stands for William E. Baxter, the original author, who kindly - permitted me to modify and release his code as a part of skalibs. - It has nothing to do with the World Wide Web. - */ - -#define IPCPATH_MAX 107 - -#include <sys/types.h> -#include <skalibs/posixplz.h> -#include <skalibs/tai.h> -#include <skalibs/djbunix.h> - -#define ipc_stream() ipc_stream_nb() -#define ipc_stream_b() ipc_stream_internal(0) -#define ipc_stream_nb() ipc_stream_internal(DJBUNIX_FLAG_NB) -#define ipc_stream_coe() ipc_stream_internal(DJBUNIX_FLAG_COE) -#define ipc_stream_nbcoe() ipc_stream_internal(DJBUNIX_FLAG_NB|DJBUNIX_FLAG_COE) -extern int ipc_stream_internal (unsigned int) ; - -#define ipc_datagram() ipc_datagram_nb() -#define ipc_datagram_b() ipc_datagram_internal(0) -#define ipc_datagram_nb() ipc_datagram_internal(DJBUNIX_FLAG_NB) -#define ipc_datagram_coe() ipc_datagram_internal(DJBUNIX_FLAG_COE) -#define ipc_datagram_nbcoe() ipc_datagram_internal(DJBUNIX_FLAG_NB|DJBUNIX_FLAG_COE) -extern int ipc_datagram_internal (unsigned int) ; - -#define ipc_pair(sv) ipc_pair_nb(sv) -#define ipc_pair_b(sv) ipc_pair_internal((sv), 0) -#define ipc_pair_nb(sv) ipc_pair_internal((sv), DJBUNIX_FLAG_NB) -#define ipc_pair_coe(sv) ipc_pair_internal((sv), DJBUNIX_FLAG_COE) -#define ipc_pair_nbcoe(sv) ipc_pair_internal((sv), DJBUNIX_FLAG_NB|DJBUNIX_FLAG_COE) -extern int ipc_pair_internal (int *, unsigned int) ; - -extern int ipc_bind (int, char const *) ; -extern int ipc_bind_reuse (int, char const *) ; -extern int ipc_bind_reuse_lock (int, char const *, int *) ; -extern int ipc_listen (int, int) ; - -#define ipc_accept(s, path, len, trunc) ipc_accept_internal(s, path, len, (trunc), 0) -#define ipc_accept_nb(s, path, len, trunc) ipc_accept_internal(s, path, len, (trunc), DJBUNIX_FLAG_NB) -#define ipc_accept_coe(s, path, len, trunc) ipc_accept_internal(s, path, len, (trunc), DJBUNIX_FLAG_COE) -#define ipc_accept_nbcoe(s, path, len, trunc) ipc_accept_internal(s, path, len, (trunc), DJBUNIX_FLAG_NB|DJBUNIX_FLAG_COE) -extern int ipc_accept_internal (int, char *, size_t, int *, unsigned int) ; - -#define ipc_eid getpeereid -extern int ipc_local (int, char *, size_t, int *) ; - -extern int ipc_connect (int, char const *) ; -extern int ipc_connected (int) ; -extern int ipc_timed_connect (int, char const *, tain_t const *, tain_t *) ; -#define ipc_timed_connect_g(fd, path, deadline) ipc_timed_connect(fd, path, (deadline), &STAMP) - -extern ssize_t ipc_send (int, char const *, size_t, char const *) ; -extern ssize_t ipc_recv (int, char *, size_t, char *) ; - -#endif diff --git a/src/libstddjb/child_spawn1_socket.c b/src/libstddjb/child_spawn1_socket.c @@ -1,6 +1,6 @@ /* ISC license. */ -#include <skalibs/webipc.h> +#include <skalibs/socket.h> #include <skalibs/djbunix.h> #include "djbunix-internal.h" diff --git a/src/libstddjb/ipc_accept.c b/src/libstddjb/ipc_accept.c @@ -6,9 +6,11 @@ #include <sys/un.h> #include <string.h> #include <errno.h> +#include <fcntl.h> + #include <skalibs/bytestr.h> #include <skalibs/djbunix.h> -#include <skalibs/webipc.h> +#include <skalibs/socket.h> int ipc_accept_internal (int s, char *p, size_t l, int *trunc, unsigned int options) { @@ -18,15 +20,15 @@ int ipc_accept_internal (int s, char *p, size_t l, int *trunc, unsigned int opti memset(&sa, 0, dummy) ; do #ifdef SKALIBS_HASACCEPT4 - fd = accept4(s, (struct sockaddr *)&sa, &dummy, ((options & DJBUNIX_FLAG_NB) ? SOCK_NONBLOCK : 0) | ((options & DJBUNIX_FLAG_COE) ? SOCK_CLOEXEC : 0)) ; + fd = accept4(s, (struct sockaddr *)&sa, &dummy, ((options & O_NONBLOCK) ? SOCK_NONBLOCK : 0) | ((options & O_CLOEXEC) ? SOCK_CLOEXEC : 0)) ; #else fd = accept(s, (struct sockaddr *)&sa, &dummy) ; #endif while ((fd == -1) && (errno == EINTR)) ; if (fd == -1) return -1 ; #ifndef SKALIBS_HASACCEPT4 - if ((((options & DJBUNIX_FLAG_NB) ? ndelay_on(fd) : ndelay_off(fd)) < 0) - || (((options & DJBUNIX_FLAG_COE) ? coe(fd) : uncoe(fd)) < 0)) + if ((((options & O_NONBLOCK) ? ndelay_on(fd) : ndelay_off(fd)) < 0) + || (((options & O_CLOEXEC) ? coe(fd) : uncoe(fd)) < 0)) { fd_close(fd) ; return -1 ; diff --git a/src/libstddjb/ipc_bind.c b/src/libstddjb/ipc_bind.c @@ -1,13 +1,12 @@ /* ISC license. */ #include <skalibs/nonposix.h> - #include <sys/socket.h> #include <sys/un.h> #include <string.h> #include <errno.h> -#include <skalibs/webipc.h> +#include <skalibs/socket.h> #include <skalibs/posixishard.h> int ipc_bind (int s, char const *p) diff --git a/src/libstddjb/ipc_bind_reuse.c b/src/libstddjb/ipc_bind_reuse.c @@ -1,6 +1,6 @@ /* ISC license. */ -#include <skalibs/webipc.h> +#include <skalibs/socket.h> int ipc_bind_reuse (int s, char const *p) { diff --git a/src/libstddjb/ipc_bind_reuse_lock.c b/src/libstddjb/ipc_bind_reuse_lock.c @@ -8,7 +8,7 @@ #include <sys/socket.h> #include <skalibs/djbunix.h> -#include <skalibs/webipc.h> +#include <skalibs/socket.h> int ipc_bind_reuse_lock (int s, char const *p, int *fdlock) { @@ -24,8 +24,10 @@ int ipc_bind_reuse_lock (int s, char const *p, int *fdlock) r = fd_lock(fd, 1, 1) ; if (r < 0) return -1 ; if (!r) return (errno = EBUSY, -1) ; + r = errno ; setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof opt) ; - unlink(p) ; + errno = r ; + unlink_void(p) ; if (ipc_bind(s, p) < 0) return -1 ; *fdlock = fd ; return 0 ; diff --git a/src/libstddjb/ipc_connect.c b/src/libstddjb/ipc_connect.c @@ -1,13 +1,12 @@ /* ISC license. */ #include <skalibs/nonposix.h> - #include <errno.h> #include <sys/socket.h> #include <sys/un.h> #include <string.h> -#include <skalibs/webipc.h> +#include <skalibs/socket.h> #include <skalibs/posixishard.h> int ipc_connect (int s, char const *p) diff --git a/src/libstddjb/ipc_connected.c b/src/libstddjb/ipc_connected.c @@ -3,8 +3,9 @@ #include <skalibs/nonposix.h> #include <sys/socket.h> #include <sys/un.h> + #include <skalibs/allreadwrite.h> -#include <skalibs/webipc.h> +#include <skalibs/socket.h> int ipc_connected (int s) { diff --git a/src/libstddjb/ipc_dgram.c b/src/libstddjb/ipc_dgram.c @@ -2,8 +2,7 @@ #include <skalibs/nonposix.h> #include <sys/socket.h> -#include <skalibs/djbunix.h> -#include <skalibs/webipc.h> +#include <skalibs/socket.h> int ipc_datagram_internal (unsigned int flags) { diff --git a/src/libstddjb/ipc_listen.c b/src/libstddjb/ipc_listen.c @@ -2,7 +2,7 @@ #include <skalibs/nonposix.h> #include <sys/socket.h> -#include <skalibs/webipc.h> +#include <skalibs/socket.h> int ipc_listen (int s, int backlog) { diff --git a/src/libstddjb/ipc_local.c b/src/libstddjb/ipc_local.c @@ -4,8 +4,9 @@ #include <sys/socket.h> #include <sys/un.h> #include <string.h> + #include <skalibs/bytestr.h> -#include <skalibs/webipc.h> +#include <skalibs/socket.h> int ipc_local (int s, char *p, size_t l, int *trunc) { diff --git a/src/libstddjb/ipc_pair.c b/src/libstddjb/ipc_pair.c @@ -2,8 +2,7 @@ #include <skalibs/nonposix.h> #include <sys/socket.h> -#include <skalibs/djbunix.h> -#include <skalibs/webipc.h> +#include <skalibs/socket.h> int ipc_pair_internal (int *sv, unsigned int flags) { diff --git a/src/libstddjb/ipc_recv.c b/src/libstddjb/ipc_recv.c @@ -1,13 +1,12 @@ /* ISC license. */ #include <skalibs/nonposix.h> - +#include <string.h> #include <errno.h> #include <sys/socket.h> #include <sys/un.h> -#include <string.h> -#include <skalibs/webipc.h> +#include <skalibs/socket.h> #include <skalibs/posixishard.h> ssize_t ipc_recv (int fd, char *s, size_t len, char *path) diff --git a/src/libstddjb/ipc_send.c b/src/libstddjb/ipc_send.c @@ -1,13 +1,12 @@ /* ISC license. */ #include <skalibs/nonposix.h> - #include <errno.h> #include <sys/socket.h> #include <sys/un.h> #include <string.h> -#include <skalibs/webipc.h> +#include <skalibs/socket.h> #include <skalibs/posixishard.h> ssize_t ipc_send (int fd, char const *s, size_t len, char const *path) diff --git a/src/libstddjb/ipc_stream.c b/src/libstddjb/ipc_stream.c @@ -2,8 +2,7 @@ #include <skalibs/nonposix.h> #include <sys/socket.h> -#include <skalibs/djbunix.h> -#include <skalibs/webipc.h> +#include <skalibs/socket.h> int ipc_stream_internal (unsigned int flags) { diff --git a/src/libstddjb/ipc_timed_connect.c b/src/libstddjb/ipc_timed_connect.c @@ -1,9 +1,10 @@ /* ISC license. */ #include <errno.h> + #include <skalibs/error.h> #include <skalibs/iopause.h> -#include <skalibs/webipc.h> +#include <skalibs/socket.h> int ipc_timed_connect (int s, char const *path, tain_t const *deadline, tain_t *stamp) { diff --git a/src/libstddjb/pipe_internal.c b/src/libstddjb/pipe_internal.c @@ -6,26 +6,28 @@ #include <skalibs/nonposix.h> #include <unistd.h> -#include <fcntl.h> + #include <skalibs/djbunix.h> int pipe_internal (int *p, unsigned int flags) { - return pipe2(p, ((flags & DJBUNIX_FLAG_COE) ? O_CLOEXEC : 0) | ((flags & DJBUNIX_FLAG_NB) ? O_NONBLOCK : 0)) ; + return pipe2(p, flags) ; } #else #include <unistd.h> +#include <fcntl.h> + #include <skalibs/djbunix.h> int pipe_internal (int *p, unsigned int flags) { int pi[2] ; if (pipe(pi) < 0) return -1 ; - if (flags & DJBUNIX_FLAG_COE) + if (flags & O_CLOEXEC) if ((coe(pi[0]) < 0) || (coe(pi[1]) < 0)) goto err ; - if (flags & DJBUNIX_FLAG_NB) + if (flags & O_NONBLOCK) if ((ndelay_on(pi[0]) < 0) || (ndelay_on(pi[1]) < 0)) goto err ; p[0] = pi[0] ; p[1] = pi[1] ; return 0 ; diff --git a/src/libstddjb/socket_accept4.c b/src/libstddjb/socket_accept4.c @@ -6,6 +6,8 @@ #include <netinet/in.h> #include <string.h> #include <errno.h> +#include <fcntl.h> + #include <skalibs/uint16.h> #include <skalibs/djbunix.h> #include <skalibs/socket.h> @@ -17,15 +19,15 @@ int socket_accept4_internal (int s, char *ip, uint16_t *port, unsigned int optio int fd ; do #ifdef SKALIBS_HASACCEPT4 - fd = accept4(s, (struct sockaddr *)&sa, &dummy, ((options & DJBUNIX_FLAG_NB) ? SOCK_NONBLOCK : 0) | ((options & DJBUNIX_FLAG_COE) ? SOCK_CLOEXEC : 0)) ; + fd = accept4(s, (struct sockaddr *)&sa, &dummy, ((options & O_NONBLOCK) ? SOCK_NONBLOCK : 0) | ((options & O_CLOEXEC) ? SOCK_CLOEXEC : 0)) ; #else fd = accept(s, (struct sockaddr *)&sa, &dummy) ; #endif while ((fd < 0) && (errno == EINTR)) ; if (fd < 0) return -1 ; #ifndef SKALIBS_HASACCEPT4 - if ((((options & DJBUNIX_FLAG_NB) ? ndelay_on(fd) : ndelay_off(fd)) < 0) - || (((options & DJBUNIX_FLAG_COE) ? coe(fd) : uncoe(fd)) < 0)) + if ((((options & O_NONBLOCK) ? ndelay_on(fd) : ndelay_off(fd)) < 0) + || (((options & O_CLOEXEC) ? coe(fd) : uncoe(fd)) < 0)) { fd_close(fd) ; return -1 ; diff --git a/src/libstddjb/socket_accept6.c b/src/libstddjb/socket_accept6.c @@ -6,6 +6,8 @@ #include <netinet/in.h> #include <string.h> #include <errno.h> +#include <fcntl.h> + #include <skalibs/uint16.h> #include <skalibs/djbunix.h> #include <skalibs/ip46.h> @@ -20,15 +22,15 @@ int socket_accept6_internal (int s, char *ip6, uint16_t *port, unsigned int opti int fd ; do #ifdef SKALIBS_HASACCEPT4 - fd = accept4(s, (struct sockaddr *)&sa, &dummy, ((options & DJBUNIX_FLAG_NB) ? SOCK_NONBLOCK : 0) | ((options & DJBUNIX_FLAG_COE) ? SOCK_CLOEXEC : 0)) ; + fd = accept4(s, (struct sockaddr *)&sa, &dummy, ((options & O_NONBLOCK) ? SOCK_NONBLOCK : 0) | ((options & O_CLOEXEC) ? SOCK_CLOEXEC : 0)) ; #else fd = accept(s, (struct sockaddr *)&sa, &dummy) ; #endif while ((fd < 0) && (errno == EINTR)) ; if (fd < 0) return -1 ; #ifndef SKALIBS_HASACCEPT4 - if ((((options & DJBUNIX_FLAG_NB) ? ndelay_on(fd) : ndelay_off(fd)) < 0) - || (((options & DJBUNIX_FLAG_COE) ? coe(fd) : uncoe(fd)) < 0)) + if ((((options & O_NONBLOCK) ? ndelay_on(fd) : ndelay_off(fd)) < 0) + || (((options & O_CLOEXEC) ? coe(fd) : uncoe(fd)) < 0)) { fd_close(fd) ; return -1 ; diff --git a/src/libstddjb/socket_internal.c b/src/libstddjb/socket_internal.c @@ -3,13 +3,16 @@ #include <skalibs/sysdeps.h> #include <skalibs/nonposix.h> #include <sys/socket.h> +#include <fcntl.h> + #include <skalibs/djbunix.h> +#include <skalibs/socket.h> #ifdef SKALIBS_HASACCEPT4 int socket_internal (int domain, int type, int protocol, unsigned int flags) { - return socket(domain, type | ((flags & DJBUNIX_FLAG_NB) ? SOCK_NONBLOCK : 0) | ((flags & DJBUNIX_FLAG_COE) ? SOCK_CLOEXEC : 0), protocol) ; + return socket(domain, type | ((flags & O_NONBLOCK) ? SOCK_NONBLOCK : 0) | ((flags & O_CLOEXEC) ? SOCK_CLOEXEC : 0), protocol) ; } #else @@ -18,8 +21,8 @@ int socket_internal (int domain, int type, int protocol, unsigned int flags) { int s = socket(domain, type, protocol) ; if (s == -1) return -1 ; - if ((((flags & DJBUNIX_FLAG_NB) ? ndelay_on(s) : ndelay_off(s)) < 0) - || (((flags & DJBUNIX_FLAG_COE) ? coe(s) : uncoe(s)) < 0)) + if ((((flags & O_NONBLOCK) ? ndelay_on(s) : ndelay_off(s)) < 0) + || (((flags & O_CLOEXEC) ? coe(s) : uncoe(s)) < 0)) { fd_close(s) ; return -1 ; diff --git a/src/libstddjb/socket_tcp4.c b/src/libstddjb/socket_tcp4.c @@ -3,6 +3,7 @@ #include <skalibs/nonposix.h> #include <sys/socket.h> #include <netinet/in.h> + #include <skalibs/socket.h> int socket_tcp4_internal (unsigned int flags) diff --git a/src/libstddjb/socketpair_internal.c b/src/libstddjb/socketpair_internal.c @@ -4,13 +4,16 @@ #include <skalibs/nonposix.h> #include <sys/socket.h> #include <errno.h> +#include <fcntl.h> + #include <skalibs/djbunix.h> +#include <skalibs/socket.h> #ifdef SKALIBS_HASACCEPT4 int socketpair_internal (int domain, int type, int protocol, unsigned int flags, int *sv) { - return socketpair(domain, type | ((flags & DJBUNIX_FLAG_NB) ? SOCK_NONBLOCK : 0) | ((flags & DJBUNIX_FLAG_COE) ? SOCK_CLOEXEC : 0), protocol, sv) ; + return socketpair(domain, type | ((flags & O_NONBLOCK) ? SOCK_NONBLOCK : 0) | ((flags & O_CLOEXEC) ? SOCK_CLOEXEC : 0), protocol, sv) ; } #else @@ -19,7 +22,7 @@ int socketpair_internal (int domain, int type, int protocol, unsigned int flags, { int fd[2] ; if (socketpair(domain, type, protocol, fd) < 0) return -1 ; - if (flags & DJBUNIX_FLAG_NB) + if (flags & O_NONBLOCK) { if (ndelay_on(fd[0]) < 0) goto err ; if (ndelay_on(fd[1]) < 0) goto err ; @@ -29,7 +32,7 @@ int socketpair_internal (int domain, int type, int protocol, unsigned int flags, if (ndelay_off(fd[0]) < 0) goto err ; if (ndelay_off(fd[1]) < 0) goto err ; } - if (flags & DJBUNIX_FLAG_COE) + if (flags & O_CLOEXEC) { if (coe(fd[0]) < 0) goto err ; if (coe(fd[1]) < 0) goto err ; diff --git a/src/libunixonacid/ipc_timed_recv.c b/src/libunixonacid/ipc_timed_recv.c @@ -2,7 +2,7 @@ #include <skalibs/functypes.h> #include <skalibs/allreadwrite.h> -#include <skalibs/webipc.h> +#include <skalibs/socket.h> #include <skalibs/unix-timed.h> struct blah_s diff --git a/src/libunixonacid/skaclient_server_ack.c b/src/libunixonacid/skaclient_server_ack.c @@ -6,7 +6,7 @@ #include <skalibs/djbunix.h> #include <skalibs/skaclient.h> #include <skalibs/unixmessage.h> -#include <skalibs/webipc.h> +#include <skalibs/socket.h> #include <skalibs/posixishard.h> int skaclient_server_ack (unixmessage_t const *clientmsg, unixmessage_sender_t *out, unixmessage_sender_t *asyncout, char const *before, size_t beforelen, char const *after, size_t afterlen) diff --git a/src/libunixonacid/skaclient_start_async.c b/src/libunixonacid/skaclient_start_async.c @@ -1,11 +1,13 @@ /* ISC license. */ #include <errno.h> + #include <skalibs/error.h> #include <skalibs/kolbak.h> #include <skalibs/skaclient.h> #include <skalibs/unixmessage.h> -#include <skalibs/webipc.h> +#include <skalibs/djbunix.h> +#include <skalibs/socket.h> #include "skaclient-internal.h" int skaclient_start_async ( diff --git a/src/libunixonacid/textclient_start.c b/src/libunixonacid/textclient_start.c @@ -4,7 +4,7 @@ #include <string.h> #include <errno.h> -#include <skalibs/webipc.h> +#include <skalibs/socket.h> #include <skalibs/djbunix.h> #include <skalibs/textmessage.h> #include <skalibs/textclient.h>