summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--package/deps.mak10
-rw-r--r--src/include/skalibs/skaclient.h6
-rw-r--r--src/include/skalibs/unixmessage.h14
-rw-r--r--src/libunixonacid/unixmessage_receiver_0.c6
-rw-r--r--src/libunixonacid/unixmessage_sender_timed_flush.c3
5 files changed, 26 insertions, 13 deletions
diff --git a/package/deps.mak b/package/deps.mak
index 7e177b5..4dd3897 100644
--- a/package/deps.mak
+++ b/package/deps.mak
@@ -21,6 +21,7 @@ src/include/skalibs/djbtime.h: src/include/skalibs/config.h src/include/skalibs/
src/include/skalibs/djbunix.h: src/include/skalibs/env.h src/include/skalibs/envalloc.h src/include/skalibs/gccattributes.h src/include/skalibs/stralloc.h src/include/skalibs/uint64.h
src/include/skalibs/env.h: src/include/skalibs/gccattributes.h src/include/skalibs/stralloc.h
src/include/skalibs/envalloc.h: src/include/skalibs/genalloc.h
+src/include/skalibs/error.h: src/include/skalibs/gccattributes.h
src/include/skalibs/fmtscan.h: src/include/skalibs/gccattributes.h src/include/skalibs/uint32.h
src/include/skalibs/genalloc.h: src/include/skalibs/functypes.h src/include/skalibs/stralloc.h
src/include/skalibs/genset.h: src/include/skalibs/functypes.h
@@ -49,6 +50,9 @@ src/include/skalibs/strerr.h: src/include/skalibs/gccattributes.h
src/include/skalibs/strerr2.h: src/include/skalibs/strerr.h
src/include/skalibs/surf.h: src/include/skalibs/uint32.h
src/include/skalibs/tai.h: src/include/skalibs/gccattributes.h src/include/skalibs/uint32.h src/include/skalibs/uint64.h
+src/include/skalibs/uint.h: src/include/skalibs/uint32.h
+src/include/skalibs/uint16.h: src/include/skalibs/uint64.h
+src/include/skalibs/uint32.h: src/include/skalibs/uint64.h
src/include/skalibs/unirandom.h: src/include/skalibs/buffer.h src/include/skalibs/surf.h
src/include/skalibs/unirandomdev.h: src/include/skalibs/unirandom.h
src/include/skalibs/unirandomegd.h: src/include/skalibs/unirandom.h
@@ -723,6 +727,7 @@ 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/include/skalibs/tai.h src/include/skalibs/unixmessage.h
src/libunixonacid/skaclient_sendmsgv.o src/libunixonacid/skaclient_sendmsgv.lo: src/libunixonacid/skaclient_sendmsgv.c src/include/skalibs/skaclient.h src/include/skalibs/tai.h src/include/skalibs/unixmessage.h
src/libunixonacid/skaclient_sendv.o src/libunixonacid/skaclient_sendv.lo: src/libunixonacid/skaclient_sendv.c src/include/skalibs/siovec.h src/include/skalibs/skaclient.h src/include/skalibs/tai.h src/include/skalibs/unixmessage.h
+src/libunixonacid/skaclient_server_01x.o src/libunixonacid/skaclient_server_01x.lo: src/libunixonacid/skaclient_server_01x.c src/include/skalibs/skaclient.h src/include/skalibs/tai.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/bytestr.h src/include/skalibs/djbunix.h src/include/skalibs/error.h src/include/skalibs/skaclient.h src/include/skalibs/unixmessage.h src/include/skalibs/webipc.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/skaclient.h src/include/skalibs/tai.h src/include/skalibs/unixmessage.h
@@ -742,13 +747,16 @@ src/libunixonacid/unixmessage_handle.o src/libunixonacid/unixmessage_handle.lo:
src/libunixonacid/unixmessage_put.o src/libunixonacid/unixmessage_put.lo: src/libunixonacid/unixmessage_put.c src/include/skalibs/bitarray.h src/include/skalibs/bytestr.h src/include/skalibs/diuint.h src/include/skalibs/genalloc.h src/include/skalibs/siovec.h src/include/skalibs/stralloc.h src/include/skalibs/sysdeps.h src/include/skalibs/unixmessage.h
src/libunixonacid/unixmessage_read.o src/libunixonacid/unixmessage_read.lo: src/libunixonacid/unixmessage_read.c src/include/skalibs/buffer.h src/include/skalibs/cbuffer.h src/include/skalibs/djbunix.h src/include/skalibs/error.h src/include/skalibs/nonposix.h src/include/skalibs/siovec.h src/include/skalibs/sysdeps.h src/include/skalibs/unixmessage.h
src/libunixonacid/unixmessage_receive.o src/libunixonacid/unixmessage_receive.lo: src/libunixonacid/unixmessage_receive.c src/include/skalibs/allreadwrite.h src/include/skalibs/buffer.h src/include/skalibs/cbuffer.h src/include/skalibs/error.h src/include/skalibs/stralloc.h src/include/skalibs/uint.h src/include/skalibs/unixmessage.h
+src/libunixonacid/unixmessage_receiver_0.o src/libunixonacid/unixmessage_receiver_0.lo: src/libunixonacid/unixmessage_receiver_0.c src/include/skalibs/unixmessage.h
src/libunixonacid/unixmessage_receiver_free.o src/libunixonacid/unixmessage_receiver_free.lo: src/libunixonacid/unixmessage_receiver_free.c src/include/skalibs/stralloc.h src/include/skalibs/unixmessage.h
src/libunixonacid/unixmessage_receiver_init.o src/libunixonacid/unixmessage_receiver_init.lo: src/libunixonacid/unixmessage_receiver_init.c src/include/skalibs/buffer.h src/include/skalibs/cbuffer.h src/include/skalibs/stralloc.h src/include/skalibs/unixmessage.h
+src/libunixonacid/unixmessage_sender_1.o src/libunixonacid/unixmessage_sender_1.lo: src/libunixonacid/unixmessage_sender_1.c src/include/skalibs/unixmessage.h
src/libunixonacid/unixmessage_sender_flush.o src/libunixonacid/unixmessage_sender_flush.lo: src/libunixonacid/unixmessage_sender_flush.c src/include/skalibs/diuint.h src/include/skalibs/djbunix.h src/include/skalibs/genalloc.h src/include/skalibs/nonposix.h src/include/skalibs/stralloc.h src/include/skalibs/sysdeps.h src/include/skalibs/uint.h src/include/skalibs/unixmessage.h
src/libunixonacid/unixmessage_sender_free.o src/libunixonacid/unixmessage_sender_free.lo: src/libunixonacid/unixmessage_sender_free.c src/include/skalibs/diuint.h src/include/skalibs/genalloc.h src/include/skalibs/stralloc.h src/include/skalibs/sysdeps.h src/include/skalibs/unixmessage.h
src/libunixonacid/unixmessage_sender_getfd.o src/libunixonacid/unixmessage_sender_getfd.lo: src/libunixonacid/unixmessage_sender_getfd.c src/include/skalibs/unixmessage.h
src/libunixonacid/unixmessage_sender_init.o src/libunixonacid/unixmessage_sender_init.lo: src/libunixonacid/unixmessage_sender_init.c src/include/skalibs/genalloc.h src/include/skalibs/stralloc.h src/include/skalibs/unixmessage.h
-src/libunixonacid/unixmessage_sender_timed_flush.o src/libunixonacid/unixmessage_sender_timed_flush.lo: src/libunixonacid/unixmessage_sender_timed_flush.c src/include/skalibs/functypes.h src/include/skalibs/genalloc.h src/include/skalibs/tai.h src/include/skalibs/unix-timed.h src/include/skalibs/unixmessage.h
+src/libunixonacid/unixmessage_sender_timed_flush.o src/libunixonacid/unixmessage_sender_timed_flush.lo: src/libunixonacid/unixmessage_sender_timed_flush.c src/include/skalibs/functypes.h src/include/skalibs/tai.h src/include/skalibs/unix-timed.h src/include/skalibs/unixmessage.h
+src/libunixonacid/unixmessage_sender_x.o src/libunixonacid/unixmessage_sender_x.lo: src/libunixonacid/unixmessage_sender_x.c src/include/skalibs/unixmessage.h
src/libunixonacid/unixmessage_sender_zero.o src/libunixonacid/unixmessage_sender_zero.lo: src/libunixonacid/unixmessage_sender_zero.c src/include/skalibs/unixmessage.h
src/libunixonacid/unixmessage_timed_handle.o src/libunixonacid/unixmessage_timed_handle.lo: src/libunixonacid/unixmessage_timed_handle.c src/include/skalibs/functypes.h src/include/skalibs/tai.h src/include/skalibs/unix-timed.h src/include/skalibs/unixmessage.h
src/libunixonacid/unixmessage_timed_receive.o src/libunixonacid/unixmessage_timed_receive.lo: src/libunixonacid/unixmessage_timed_receive.c src/include/skalibs/functypes.h src/include/skalibs/tai.h src/include/skalibs/unix-timed.h src/include/skalibs/unixmessage.h
diff --git a/src/include/skalibs/skaclient.h b/src/include/skalibs/skaclient.h
index 3c7f6db..602adce 100644
--- a/src/include/skalibs/skaclient.h
+++ b/src/include/skalibs/skaclient.h
@@ -66,13 +66,13 @@ extern int skaclient_startf_async (skaclient_t *, char *, unsigned int, char *,
#define skaclient_startf_async_b(a, sb, prog, argv, envp, options, before, beforelen, after, afterlen, blah) skaclient_startf_async(a, (sb)->bufs, sizeof((sb)->bufs), (sb)->auxbufs, sizeof((sb)->auxbufs), (sb)->bufa, sizeof((sb)->bufa), (sb)->auxbufa, sizeof((sb)->auxbufa), (sb)->q, sizeof((sb)->q), prog, argv, envp, options, before, beforelen, after, afterlen, blah)
extern int skaclient_start (skaclient_t *, char *, unsigned int, char *, unsigned int, char *, unsigned int, char *, unsigned int, kolbak_closure_t *, unsigned int, char const *, char const *, unsigned int, char const *, unsigned int, tain_t const *, tain_t *) ;
-#define skaclient_start_b(a, sb, path, before, beforelen, after, afterlen, deadline, stamp) skaclient_start((a, (sb)->bufs, sizeof((sb)->bufs), (sb)->auxbufs, sizeof((sb)->auxbufs), (sb)->bufa, sizeof((sb)->bufa), (sb)->auxbufa, sizeof((sb)->auxbufa), (sb)->q, sizeof((sb)->q), path, before, beforelen, after, afterlen, deadline, stamp)
+#define skaclient_start_b(a, sb, path, before, beforelen, after, afterlen, deadline, stamp) skaclient_start(a, (sb)->bufs, sizeof((sb)->bufs), (sb)->auxbufs, sizeof((sb)->auxbufs), (sb)->bufa, sizeof((sb)->bufa), (sb)->auxbufa, sizeof((sb)->auxbufa), (sb)->q, sizeof((sb)->q), path, before, beforelen, after, afterlen, deadline, stamp)
#define skaclient_start_g(a, bufs, bufsn, auxbufs, auxbufsn, bufa, bufan, auxbufa, auxbufan, q, qlen, path, before, beforelen, after, afterlen, deadline) skaclient_start(a, bufs, bufsn, auxbufs, auxbufsn, bufa, bufan, auxbufa, auxbufan, q, qlen, path, before, beforelen, after, afterlen, (deadline), &STAMP)
#define skaclient_start_b_g(a, sb, path, before, beforelen, after, afterlen, deadline) skaclient_start_b(a, sb, path, before, beforelen, after, afterlen, (deadline), &STAMP)
extern int skaclient_startf (skaclient_t *, char *, unsigned int, char *, unsigned int, char *, unsigned int, char *, unsigned int, kolbak_closure_t *, unsigned int, char const *, char const *const *, char const *const *, uint32, char const *, unsigned int, char const *, unsigned int, tain_t const *, tain_t *) ;
-#define skaclient_startf_b(a, sb, prog, argv, envp, before, beforelen, after, afterlen, deadline, stamp) skaclient_start((a, (sb)->bufs, sizeof((sb)->bufs), (sb)->auxbufs, sizeof((sb)->auxbufs), (sb)->bufa, sizeof((sb)->bufa), (sb)->auxbufa, sizeof((sb)->auxbufa), (sb)->q, sizeof((sb)->q), prog, argv, envp, before, beforelen, after, afterlen, deadline, stamp)
-#define skaclient_startf_g(a, bufs, bufsn, auxbufs, auxbufsn, bufa, bufan, auxbufa, auxbufan, q, qlen, prog, argv, envp, options, before, beforelen, after, afterlen, deadline) skaclient_startf(a, bufs, bufsn, auxbufs, auxbufsn, bufa, bufan, auxbufa, auxbufan, q, qlen, prog, argv, envp, options, before, beforelen, after, afterlen, (deadline), &STAMP)
+#define skaclient_startf_b(a, sb, prog, argv, envp, options, before, beforelen, after, afterlen, deadline, stamp) skaclient_startf(a, (sb)->bufs, sizeof((sb)->bufs), (sb)->auxbufs, sizeof((sb)->auxbufs), (sb)->bufa, sizeof((sb)->bufa), (sb)->auxbufa, sizeof((sb)->auxbufa), (sb)->q, sizeof((sb)->q), prog, argv, envp, options, before, beforelen, after, afterlen, deadline, stamp)
+#define skaclient_startf_g(a, bufs, bufsn, auxbufs, auxbufsn, bufa, bufan, auxbufa, auxbufan, q, qlen, prog, argv, envp, options, before, beforelen, after, afterlen, deadline) skaclient_startf(a, bufs, bufsn, auxbufs, auxbufsn, bufa, bufan, auxbufa, auxbufan, q, qlen, prog, argv, envp, options, before, beforelen, after, afterlen, (deadline), &STAMP)
#define skaclient_startf_b_g(a, sb, prog, argv, envp, options, before, beforelen, after, afterlen, deadline) skaclient_startf_b(a, sb, prog, argv, envp, options, before, beforelen, after, afterlen, (deadline), &STAMP)
extern int skaclient_putmsg_and_close (skaclient_t *, unixmessage_t const *, unsigned char const *, unixmessage_handler_func_t *, void *) ;
diff --git a/src/include/skalibs/unixmessage.h b/src/include/skalibs/unixmessage.h
index accc258..58c11eb 100644
--- a/src/include/skalibs/unixmessage.h
+++ b/src/include/skalibs/unixmessage.h
@@ -11,6 +11,9 @@
#include <skalibs/stralloc.h>
#include <skalibs/tai.h>
+
+ /* Message */
+
typedef struct unixmessage_s unixmessage_t, *unixmessage_t_ref ;
struct unixmessage_s
{
@@ -33,12 +36,14 @@ struct unixmessage_v_s
#define UNIXMESSAGE_V_ZERO { .v = 0, .vlen = 0, .fds = 0, .nfds = 0 }
extern unixmessage_v_t const unixmessage_v_zero ;
-
#define UNIXMESSAGE_BUFSIZE 2049
#define UNIXMESSAGE_AUXBUFSIZE 2049
#define UNIXMESSAGE_MAXFDS 256
#define UNIXMESSAGE_MAXREADS 32
+
+ /* Sender */
+
typedef struct unixmessage_sender_s unixmessage_sender_t, *unixmessage_sender_t_ref ;
struct unixmessage_sender_s
{
@@ -56,6 +61,7 @@ extern void unixmessage_sender_init (unixmessage_sender_t *, int) ;
extern void unixmessage_sender_free (unixmessage_sender_t *) ;
#define unixmessage_sender_fd(b) ((b)->fd)
extern int unixmessage_sender_getfd (unixmessage_sender_t const *) gccattr_pure ;
+#define unixmessage_sender_isempty(b) (!genalloc_len(unsigned int, &(b)->offsets))
extern int unixmessage_put_and_close (unixmessage_sender_t *, unixmessage_t const *, unsigned char const *) ;
#define unixmessage_put(b, m) unixmessage_put_and_close(b, m, unixmessage_bits_closenone)
@@ -70,6 +76,8 @@ extern int unixmessage_sender_timed_flush (unixmessage_sender_t *, tain_t const
#define unixmessage_sender_timed_flush_g(sender, deadline) unixmessage_sender_timed_flush(sender, (deadline), &STAMP)
+ /* Receiver */
+
typedef struct unixmessage_receiver_s unixmessage_receiver_t, *unixmessage_receiver_t_ref ;
struct unixmessage_receiver_s
{
@@ -86,6 +94,7 @@ struct unixmessage_receiver_s
extern int unixmessage_receiver_init (unixmessage_receiver_t *, int, char *, unsigned int, char *, unsigned int) ;
extern void unixmessage_receiver_free (unixmessage_receiver_t *) ;
#define unixmessage_receiver_fd(b) buffer_fd(&(b)->mainb)
+#define unixmessage_receiver_isempty(b) (buffer_isempty(&(b)->mainb) && cbuffer_isempty(&(b)->auxb))
extern int unixmessage_receive (unixmessage_receiver_t *, unixmessage_t *) ;
extern int unixmessage_timed_receive (unixmessage_receiver_t *, unixmessage_t *, tain_t const *, tain_t *) ;
@@ -103,9 +112,6 @@ extern int unixmessage_timed_handle (unixmessage_receiver_t *, unixmessage_handl
/* Globals */
-#define UNIXMESSAGE_RECEIVER_MAINBUFSIZE 4097
-#define UNIXMESSAGE_RECEIVER_AUXBUFSIZE 4097
-
extern unixmessage_receiver_t unixmessage_receiver_0_ ;
#define unixmessage_receiver_0 (&unixmessage_receiver_0_)
extern int unixmessage_receiver_0_init (void) ;
diff --git a/src/libunixonacid/unixmessage_receiver_0.c b/src/libunixonacid/unixmessage_receiver_0.c
index 2b6f165..b43bdfb 100644
--- a/src/libunixonacid/unixmessage_receiver_0.c
+++ b/src/libunixonacid/unixmessage_receiver_0.c
@@ -4,12 +4,12 @@
#include <skalibs/unixmessage.h>
-static char mainbuf[UNIXMESSAGE_RECEIVER_MAINBUFSIZE] ;
-static char auxbuf[UNIXMESSAGE_RECEIVER_AUXBUFSIZE] ;
+static char mainbuf[UNIXMESSAGE_BUFSIZE] ;
+static char auxbuf[UNIXMESSAGE_AUXBUFSIZE] ;
unixmessage_receiver_t unixmessage_receiver_0_ = UNIXMESSAGE_RECEIVER_ZERO ;
int unixmessage_receiver_0_init ()
{
- return unixmessage_receiver_init(&unixmessage_receiver_0_, 0, mainbuf, UNIXMESSAGE_RECEIVER_MAINBUFSIZE, auxbuf, UNIXMESSAGE_RECEIVER_AUXBUFSIZE) ;
+ return unixmessage_receiver_init(&unixmessage_receiver_0_, 0, mainbuf, UNIXMESSAGE_BUFSIZE, auxbuf, UNIXMESSAGE_AUXBUFSIZE) ;
}
diff --git a/src/libunixonacid/unixmessage_sender_timed_flush.c b/src/libunixonacid/unixmessage_sender_timed_flush.c
index 74e4937..e144c82 100644
--- a/src/libunixonacid/unixmessage_sender_timed_flush.c
+++ b/src/libunixonacid/unixmessage_sender_timed_flush.c
@@ -1,14 +1,13 @@
/* ISC license. */
#include <skalibs/functypes.h>
-#include <skalibs/genalloc.h>
#include <skalibs/tai.h>
#include <skalibs/unix-timed.h>
#include <skalibs/unixmessage.h>
static int unixmessage_sender_isnonempty (unixmessage_sender_t *b)
{
- return !!genalloc_len(unsigned int, &b->offsets) ;
+ return !unixmessage_sender_isempty(b) ;
}
int unixmessage_sender_timed_flush (unixmessage_sender_t *b, tain_t const *deadline, tain_t *stamp)