diff options
Diffstat (limited to 'src/rpc')
-rw-r--r-- | src/rpc/skabus-rpc-client.c | 2 | ||||
-rw-r--r-- | src/rpc/skabus-rpc-daemon.c | 2 | ||||
-rw-r--r-- | src/rpc/skabus-rpcc.c | 53 | ||||
-rw-r--r-- | src/rpc/skabus-rpccctl.c | 4 | ||||
-rw-r--r-- | src/rpc/skabus-rpccctl.h | 14 | ||||
-rw-r--r-- | src/rpc/skabus-rpcd.c | 45 | ||||
-rw-r--r-- | src/rpc/skabus-rpcd.h | 28 | ||||
-rw-r--r-- | src/rpc/skabus_rpccctl.c | 10 | ||||
-rw-r--r-- | src/rpc/skabus_rpcd_client.c | 8 | ||||
-rw-r--r-- | src/rpc/skabus_rpcd_query.c | 22 |
10 files changed, 95 insertions, 93 deletions
diff --git a/src/rpc/skabus-rpc-client.c b/src/rpc/skabus-rpc-client.c index bd7566d..5ab1a4b 100644 --- a/src/rpc/skabus-rpc-client.c +++ b/src/rpc/skabus-rpc-client.c @@ -26,7 +26,7 @@ int main (int argc, char const *const *argv) unsigned int ifn = 1 ; char const *interfaces[SKABUS_RPCC_INTERFACES_MAX] = { 0 } ; { - subgetopt_t l = SUBGETOPT_ZERO ; + subgetopt l = SUBGETOPT_ZERO ; for (;;) { register int opt = subgetopt_r(argc, argv, "Dd1v:c:b:t:T:C:y:", &l) ; diff --git a/src/rpc/skabus-rpc-daemon.c b/src/rpc/skabus-rpc-daemon.c index 76a8e1e..67697f4 100644 --- a/src/rpc/skabus-rpc-daemon.c +++ b/src/rpc/skabus-rpc-daemon.c @@ -35,7 +35,7 @@ int main (int argc, char const *const *argv) char const *rulesfile = 0 ; PROG = "skabus-rpc-daemon" ; { - subgetopt_t l = SUBGETOPT_ZERO ; + subgetopt l = SUBGETOPT_ZERO ; for (;;) { int opt = subgetopt_r(argc, argv, "Dd1USsJjv:c:b:u:g:G:t:T:i:x:", &l) ; diff --git a/src/rpc/skabus-rpcc.c b/src/rpc/skabus-rpcc.c index 58d0cab..6c43a97 100644 --- a/src/rpc/skabus-rpcc.c +++ b/src/rpc/skabus-rpcc.c @@ -10,7 +10,6 @@ #include <errno.h> #include <signal.h> -#include <skalibs/posixishard.h> #include <skalibs/posixplz.h> #include <skalibs/uint32.h> #include <skalibs/uint64.h> @@ -39,14 +38,16 @@ #include <skabus/rpc.h> #include "skabus-rpcc.h" +#include <skalibs/posixishard.h> + #define USAGE "skabus-rpcc [ -v verbosity ] [ -1 ] [ -c maxconn ] [ -t timeout ] [ -T lameducktimeout ] [ -C pmprog:sep:flags ] [ -y ifname:ifprog:sep:flags ... ] rpcdpath clientname" #define dieusage() strerr_dieusage(100, USAGE) ; -static tain_t answertto = TAIN_INFINITE_RELATIVE ; +static tain answertto = TAIN_INFINITE_RELATIVE ; static unsigned int verbosity = 1 ; static int cont = 1 ; -static tain_t lameduckdeadline = TAIN_INFINITE_RELATIVE ; +static tain lameduckdeadline = TAIN_INFINITE_RELATIVE ; static skabus_rpc_t a = SKABUS_RPC_ZERO ; static void quit (void) @@ -72,8 +73,8 @@ struct interface_s buffer in ; stralloc insa ; bufalloc out ; - tain_t tto ; - tain_t deadline ; + tain tto ; + tain deadline ; genqdyn serialq ; char sep[2] ; char buf[SKABUS_RPCC_BUFSIZE] ; @@ -103,9 +104,9 @@ static inline void interface_delete (uint32_t i, uint32_t prev) gensetdyn_delete(&interfaces, i) ; } -static int rclient_function (skabus_rpc_t *a, skabus_rpc_rinfo_t const *info, unixmessage_t const *m, void *aux) +static int rclient_function (skabus_rpc_t *a, skabus_rpc_rinfo_t const *info, unixmessage const *m, void *aux) { - tain_t deadline ; + tain deadline ; interface_t *y = aux ; if (m->nfds) { unixmessage_drop(m) ; return (errno = EPROTO, 0) ; } if (cont) @@ -143,7 +144,7 @@ static int interface_add (char const *ifname, char const *ifprog, char const *re uint32_t yy ; interface_t *y ; int fd[2] ; - tain_t deadline ; + tain deadline ; skabus_rpc_interface_t ifbody = { .f = &rclient_function, .cancelf = &rclient_cancel_function, .aux = y } char const *argv[4] = { EXECLINE_EXTBINPREFIX "execlineb", "-Pc", ifprog, 0 } ; pid_t pid = child_spawn2(argv[0], argv, (char const *const *)environ, fd) ; @@ -196,7 +197,7 @@ static inline int interface_lookup_by_name (char const *ifname, uint32_t *n, uin static int interface_remove (char const *ifname) { - tain_t deadline ; + tain deadline ; uint32_t i, prev, id ; if (!interface_lookup_by_name(ifname, &i, &prev)) return 0 ; id = INTERFACE(i)->id ; @@ -206,7 +207,7 @@ static int interface_remove (char const *ifname) return skabus_rpc_interface_unregister_g(a, INTERFACE(i)->id, &deadline) ; } -static inline int interface_prepare_iopause (uint32_t i, tain_t *deadline, iopause_fd *x, uint32_t *j) +static inline int interface_prepare_iopause (uint32_t i, tain *deadline, iopause_fd *x, uint32_t *j) { interface_t *y = INTERFACE(i) ; if (tain_less(&y->deadline, deadline)) *deadline = y->deadline ; @@ -235,7 +236,7 @@ static inline int interface_event (iopause_fd const *x, uint32_t i) if (!genqdyn_n(&y->serialq)) return 0 ; while (genqdyn_n(&y->serialq)) { - tain_t deadline ; + tain deadline ; int r = sanitize_read(skagetln(&y->in, &y->insa, y->sep[1])) ; if (r < 0) return 0 ; if (!r) break ; @@ -253,10 +254,10 @@ static inline int interface_event (iopause_fd const *x, uint32_t i) -static int query (char const *ifname, char const *q, tain_t const *limit, uint64_t *qid) +static int query (char const *ifname, char const *q, tain const *limit, uint64_t *qid) { uint64_t id ; - tain_t deadline ; + tain deadline ; tain_uint(&deadline, 2) ; tain_add_g(&deadline, &deadline) ; id = skabus_rpc_send_g(a, ifname, q, strlen(q), limit, &deadline) ; @@ -273,9 +274,9 @@ struct client_s { uint32_t next ; uint32_t xindex ; - textmessage_sender_t out ; - textmessage_receiver_t in ; - tain_t deadline ; + textmessage_sender out ; + textmessage_receiver in ; + tain deadline ; uint64_t query ; } ; @@ -301,14 +302,14 @@ static inline void client_delete (uint32_t cc, uint32_t prev) static void client_setdeadline (client_t *c) { - tain_t blah ; + tain blah ; tain_half(&blah, &tain_infinite_relative) ; tain_add_g(&blah, &blah) ; if (tain_less(&blah, &c->deadline)) tain_add_g(&c->deadline, &answertto) ; } -static inline int client_prepare_iopause (uint32_t i, tain_t *deadline, iopause_fd *x, uint32_t *j) +static inline int client_prepare_iopause (uint32_t i, tain *deadline, iopause_fd *x, uint32_t *j) { client_t *c = CLIENT(i) ; if (tain_less(&c->deadline, deadline)) *deadline = c->deadline ; @@ -397,7 +398,7 @@ static int do_interface_unregister (uint32_t cc, char const *s, size_t len) static int do_query (uint32_t cc, char const *s, size_t len) { client_t *c = CLIENT(cc) ; - tain_t limit ; + tain limit ; uint32_t querylen, timeout ; unsigned char ifnamelen ; if (len < 12) return (errno = EPROTO, 0) ; @@ -428,12 +429,12 @@ static int do_error (uint32_t cc, char const *s, size_t len) return (errno = EPROTO, 0) ; } -typedef int parsefunc_t (uint32_t, char const *, size_t) ; -typedef parsefunc_t *parsefunc_t_ref ; +typedef int parse_func (uint32_t, char const *, size_t) ; +typedef parse_func *parse_func_ref ; static int parse_client_protocol (struct iovec const *v, void *p) { - static parsefunc_t_ref const f[5] = + static parse_func_ref const f[5] = { &do_interface_register, &do_interface_unregister, @@ -459,7 +460,7 @@ static void removeclient (uint32_t *i, uint32_t j) int main (int argc, char const *const *argv, char const *const *envp) { - tain_t deadline ; + tain deadline ; int spfd ; int flag1 = 0 ; uint32_t maxconn = 8 ; @@ -467,7 +468,7 @@ int main (int argc, char const *const *argv, char const *const *envp) PROG = "skabus-rpcc" ; { - subgetopt_t l = SUBGETOPT_ZERO ; + subgetopt l = SUBGETOPT_ZERO ; unsigned int t = 0, T = 0 ; for (;;) { @@ -511,13 +512,13 @@ int main (int argc, char const *const *argv, char const *const *envp) else close(1) ; spfd = selfpipe_init() ; if (spfd < 0) strerr_diefu1sys(111, "selfpipe_init") ; - if (sig_ignore(SIGPIPE) < 0) strerr_diefu1sys(111, "ignore SIGPIPE") ; + if (!sig_ignore(SIGPIPE)) strerr_diefu1sys(111, "ignore SIGPIPE") ; { sigset_t set ; sigemptyset(&set) ; sigaddset(&set, SIGTERM) ; sigaddset(&set, SIGHUP) ; - if (selfpipe_trapset(&set) < 0) strerr_diefu1sys(111, "trap signals") ; + if (!selfpipe_trapset(&set)) strerr_diefu1sys(111, "trap signals") ; } tain_now_set_stopwatch_g() ; diff --git a/src/rpc/skabus-rpccctl.c b/src/rpc/skabus-rpccctl.c index e6d8b6a..7c21e69 100644 --- a/src/rpc/skabus-rpccctl.c +++ b/src/rpc/skabus-rpccctl.c @@ -13,7 +13,7 @@ #define USAGE "skabus-rpccctl [ -t timeout ] help|interface|interface-remove|query args..." #define dieusage() strerr_dieusage(100, USAGE) -static tain_t deadline ; +static tain deadline ; static skabus_rpcc_t a = SKABUS_RPCC_ZERO ; static void add_interface (char const *rpccpath, char const *ifname, char const *ifprog, char const *re) @@ -98,7 +98,7 @@ int main (int argc, char const *const *argv) PROG = "skabus-rpccctl" ; { unsigned int t = 0 ; - subgetopt_t l = SUBGETOPT_ZERO ; + subgetopt l = SUBGETOPT_ZERO ; for (;;) { int opt = subgetopt_r(argc, argv, "t:T:", &l) ; diff --git a/src/rpc/skabus-rpccctl.h b/src/rpc/skabus-rpccctl.h index fe5b620..6be6a7f 100644 --- a/src/rpc/skabus-rpccctl.h +++ b/src/rpc/skabus-rpccctl.h @@ -11,26 +11,26 @@ typedef struct skabus_rpcc_s skabus_rpcc_t, *skabus_rpcc_t_ref ; struct skabus_rpcc_s { - textmessage_sender_t out ; - textmessage_receiver_t in ; + textmessage_sender out ; + textmessage_receiver in ; } ; #define SKABUS_RPCC_ZERO { .in = TEXTMESSAGE_RECEIVER_ZERO, .out = TEXTMESSAGE_SENDER_ZERO } -extern int skabus_rpcc_start (skabus_rpcc_t *, char const *, tain_t const *, tain_t *) ; +extern int skabus_rpcc_start (skabus_rpcc_t *, char const *, tain const *, tain *) ; #define skabus_rpcc_start_g(a, name, deadline) skabus_rpcc_start(a, name, (deadline), &STAMP) extern void skabus_rpcc_end (skabus_rpcc_t *) ; -extern int skabus_rpcc_interface_register (skabus_rpcc_t *, char const *, char const *, char const *, tain_t const *, tain_t *) ; +extern int skabus_rpcc_interface_register (skabus_rpcc_t *, char const *, char const *, char const *, tain const *, tain *) ; #define skabus_rpcc_interface_register_g(a, ifname, ifprog, re, deadline) skabus_rpcc_interface_register(a, ifname, ifprog, re, (deadline), &STAMP) -extern int skabus_rpcc_interface_unregister (skabus_rpcc_t *, char const *, tain_t const *, tain_t *) ; +extern int skabus_rpcc_interface_unregister (skabus_rpcc_t *, char const *, tain const *, tain *) ; #define skabus_rpcc_interface_unregister_g(a, ifname, deadline) skabus_rpcc_interface_unregister(a, ifname, (deadline), &STAMP) -extern int skabus_rpcc_query (skabus_rpcc_t *, stralloc *, char const *, char const *, uint32_t, tain_t const *, tain_t *) ; +extern int skabus_rpcc_query (skabus_rpcc_t *, stralloc *, char const *, char const *, uint32_t, tain const *, tain *) ; #define skabus_rpcc_query_g(a, reply, ifname, query, timeout, deadline) skabus_rpcc_query(a, reply, ifname, query, timeout, (deadline), &STAMP) -extern int skabus_rpcc_quit (skabus_rpcc_t *, tain_t const *, tain_t *) ; +extern int skabus_rpcc_quit (skabus_rpcc_t *, tain const *, tain *) ; #define skabus_rpcc_quit_g(a, deadline) skabus_rpcc_quit(a, (deadline), &STAMP) #endif diff --git a/src/rpc/skabus-rpcd.c b/src/rpc/skabus-rpcd.c index 9535887..aaa0566 100644 --- a/src/rpc/skabus-rpcd.c +++ b/src/rpc/skabus-rpcd.c @@ -11,7 +11,6 @@ #include <signal.h> #include <skalibs/posixplz.h> -#include <skalibs/posixishard.h> #include <skalibs/uint32.h> #include <skalibs/uint64.h> #include <skalibs/types.h> @@ -37,14 +36,16 @@ #include <skabus/rpc.h> #include "skabus-rpcd.h" +#include <skalibs/posixishard.h> + #define USAGE "skabus-rpcd [ -v verbosity ] [ -1 ] [ -c maxconn ] [ -t timeout ] [ -T lameducktimeout ] [ -i rulesdir | -x rulesfile ] [ -S | -s ] [ -J | -j ]" #define dieusage() strerr_dieusage(100, USAGE) ; -tain_t answertto = TAIN_INFINITE_RELATIVE ; +tain answertto = TAIN_INFINITE_RELATIVE ; static unsigned int verbosity = 1 ; static int cont = 1 ; -static tain_t lameduckdeadline = TAIN_INFINITE_RELATIVE ; +static tain lameduckdeadline = TAIN_INFINITE_RELATIVE ; static unsigned int rulestype = 0 ; static char const *rules = 0 ; @@ -78,11 +79,11 @@ static inline void handle_signals (void) } } -int parse_protocol_async (unixmessage_t const *m, void *p) +int parse_protocol_async (unixmessage const *m, void *p) { uint64_t serial ; uint32_t qq ; - unixmessage_t mtosend = { .s = m->s + 10, .len = m->len - 10, .fds = m->fds, .nfds = m->nfds } ; + unixmessage mtosend = { .s = m->s + 10, .len = m->len - 10, .fds = m->fds, .nfds = m->nfds } ; if (m->len < 10 || m->s[0] != 'R') { unixmessage_drop(m) ; @@ -103,19 +104,19 @@ int parse_protocol_async (unixmessage_t const *m, void *p) return 1 ; } -typedef int hlparsefunc_t (uint32_t, unixmessage_t *) ; -typedef hlparsefunc_t *hlparsefunc_t_ref ; +typedef int hlparse_func (uint32_t, unixmessage *) ; +typedef hlparse_func *hlparse_func_ref ; static int answer (uint32_t cc, char e) { - unixmessage_t m = { .s = &e, .len = 1, .fds = 0, .nfds = 0 } ; + unixmessage m = { .s = &e, .len = 1, .fds = 0, .nfds = 0 } ; client_t *c = CLIENT(cc) ; if (!unixmessage_put(&c->sync.out, &m)) return 0 ; if (client_isregistered(cc)) client_setdeadline(c) ; return 1 ; } -static int do_idstr (uint32_t cc, unixmessage_t *m) +static int do_idstr (uint32_t cc, unixmessage *m) { uint32_t relen, pmid, yy ; unsigned char idlen ; @@ -134,7 +135,7 @@ static int do_idstr (uint32_t cc, unixmessage_t *m) return answer(cc, 0) ; } -static int do_interface_register (uint32_t cc, unixmessage_t *m) +static int do_interface_register (uint32_t cc, unixmessage *m) { uint32_t id, relen, yy ; unsigned char iflen ; @@ -151,7 +152,7 @@ static int do_interface_register (uint32_t cc, unixmessage_t *m) return answer(cc, 0) ; } -static int do_interface_unregister (uint32_t cc, unixmessage_t *m) +static int do_interface_unregister (uint32_t cc, unixmessage *m) { uint32_t yy ; unsigned char iflen ; @@ -166,9 +167,9 @@ static int do_interface_unregister (uint32_t cc, unixmessage_t *m) return answer(cc, 0) ; } -static int do_query_send (uint32_t cc, unixmessage_t *m) +static int do_query_send (uint32_t cc, unixmessage *m) { - tain_t limit ; + tain limit ; uint32_t yy, qq ; unsigned char iflen ; int e ; @@ -190,7 +191,7 @@ static int do_query_send (uint32_t cc, unixmessage_t *m) return 1 ; } -static int do_query_cancel (uint32_t cc, unixmessage_t *m) +static int do_query_cancel (uint32_t cc, unixmessage *m) { uint64_t serial ; uint32_t qq ; @@ -203,16 +204,16 @@ static int do_query_cancel (uint32_t cc, unixmessage_t *m) return answer(cc, 0) ; } -static int do_error (uint32_t cc, unixmessage_t *m) +static int do_error (uint32_t cc, unixmessage *m) { (void)cc ; (void)m ; return (errno = EPROTO, 0) ; } -int parse_protocol_sync (unixmessage_t const *m, void *p) +int parse_protocol_sync (unixmessage const *m, void *p) { - static hlparsefunc_t_ref const f[6] = + static hlparse_func_ref const f[6] = { &do_idstr, &do_interface_register, @@ -221,7 +222,7 @@ int parse_protocol_sync (unixmessage_t const *m, void *p) &do_query_cancel, &do_error } ; - unixmessage_t mcopy = { .s = m->s + 1, .len = m->len -1, .fds = m->fds, .nfds = m->nfds } ; + unixmessage mcopy = { .s = m->s + 1, .len = m->len -1, .fds = m->fds, .nfds = m->nfds } ; if (!m->len) { unixmessage_drop(m) ; @@ -383,7 +384,7 @@ int main (int argc, char const *const *argv, char const *const *envp) PROG = "skabus-rpcd" ; { - subgetopt_t l = SUBGETOPT_ZERO ; + subgetopt l = SUBGETOPT_ZERO ; unsigned int t = 0, T = 0 ; for (;;) { @@ -424,13 +425,13 @@ int main (int argc, char const *const *argv, char const *const *envp) else close(1) ; spfd = selfpipe_init() ; if (spfd < 0) strerr_diefu1sys(111, "selfpipe_init") ; - if (sig_ignore(SIGPIPE) < 0) strerr_diefu1sys(111, "ignore SIGPIPE") ; + if (!sig_ignore(SIGPIPE)) strerr_diefu1sys(111, "ignore SIGPIPE") ; { sigset_t set ; sigemptyset(&set) ; sigaddset(&set, SIGTERM) ; sigaddset(&set, SIGHUP) ; - if (selfpipe_trapset(&set) < 0) strerr_diefu1sys(111, "trap signals") ; + if (!selfpipe_trapset(&set)) strerr_diefu1sys(111, "trap signals") ; } if (rulestype == 2) @@ -460,7 +461,7 @@ int main (int argc, char const *const *argv, char const *const *envp) for (;;) { - tain_t deadline ; + tain deadline ; int r = 1 ; uint32_t i = clientstorage[sentinel].next, j = 2 ; query_get_mindeadline(&deadline) ; diff --git a/src/rpc/skabus-rpcd.h b/src/rpc/skabus-rpcd.h index fec72f1..e9b63fe 100644 --- a/src/rpc/skabus-rpcd.h +++ b/src/rpc/skabus-rpcd.h @@ -29,7 +29,7 @@ typedef struct query_s query_t, *query_t_ref ; struct query_s { uint64_t serial ; - tain_t deadline ; + tain deadline ; uint32_t client ; uint32_t clientindex ; uint32_t interface ; @@ -78,11 +78,11 @@ struct client_s uint32_t next ; uid_t uid ; gid_t gid ; - tain_t deadline ; + tain deadline ; genalloc interfaces ; /* uint32_t */ gensetdyn queries ; /* uint32_t */ - unixconnection_t sync ; - unixconnection_t async ; + unixconnection sync ; + unixconnection async ; uint32_t xindex[2] ; regex_t idstr_re ; regex_t interfaces_re ; @@ -118,11 +118,11 @@ extern int query_cancel (uint32_t, char) ; extern int query_cancelremove (uint32_t, char) ; extern int query_lookup_by_serial (uint64_t, uint32_t *) ; extern int query_lookup_by_mindeadline (uint32_t *) ; -extern void query_get_mindeadline (tain_t *) ; -extern int query_add (uint32_t *, tain_t const *, uint32_t, uint32_t) ; -extern int query_send (uint32_t, unixmessage_t const *) ; -extern int query_sendpm (uint32_t, unixmessage_t const *) ; -extern void query_reply (uint32_t, char, unixmessage_t const *) ; +extern void query_get_mindeadline (tain *) ; +extern int query_add (uint32_t *, tain const *, uint32_t, uint32_t) ; +extern int query_send (uint32_t, unixmessage const *) ; +extern int query_sendpm (uint32_t, unixmessage const *) ; +extern void query_reply (uint32_t, char, unixmessage const *) ; extern void interface_remove (uint32_t) ; extern int interface_lookup_by_name (char const *, uint32_t *) ; @@ -132,15 +132,15 @@ extern int interface_add (uint32_t *, char const *, size_t, uint32_t, char const #define client_idstr(c) (INTERFACE(genalloc_s(uint32_t, &(c)->interfaces)[0])->name + 1) extern void client_remove (uint32_t, uint32_t) ; extern void client_add (uint32_t *, regex_t const *, regex_t const *, uid_t, gid_t, int, uint32_t) ; -extern void client_nextdeadline (uint32_t, tain_t *) ; +extern void client_nextdeadline (uint32_t, tain *) ; extern void client_setdeadline (client_t *) ; -extern int client_prepare_iopause (uint32_t, tain_t *, iopause_fd *, uint32_t *, int) ; +extern int client_prepare_iopause (uint32_t, tain *, iopause_fd *, uint32_t *, int) ; extern int client_flush (uint32_t, iopause_fd const *) ; extern int client_read (uint32_t, iopause_fd const *) ; -extern int parse_protocol_sync (unixmessage_t const *, void *) ; -extern int parse_protocol_async (unixmessage_t const *, void *) ; +extern int parse_protocol_sync (unixmessage const *, void *) ; +extern int parse_protocol_async (unixmessage const *, void *) ; -extern tain_t answertto ; +extern tain answertto ; #endif diff --git a/src/rpc/skabus_rpccctl.c b/src/rpc/skabus_rpccctl.c index d3ee6ef..1e9efcf 100644 --- a/src/rpc/skabus_rpccctl.c +++ b/src/rpc/skabus_rpccctl.c @@ -17,7 +17,7 @@ #include <skabus/rpc.h> #include "skabus-rpccctl.h" -int skabus_rpcc_start (skabus_rpcc_t *a, char const *path, tain_t const *deadline, tain_t *stamp) +int skabus_rpcc_start (skabus_rpcc_t *a, char const *path, tain const *deadline, tain *stamp) { int fd = ipc_stream_nb() ; if (fd < 0) return 0 ; @@ -38,7 +38,7 @@ void skabus_rpcc_end (skabus_rpcc_t *a) textmessage_receiver_free(&a->in) ; } -int skabus_rpcc_interface_register (skabus_rpcc_t *a, char const *ifname, char const *ifprog, char const *re, tain_t const *deadline, tain_t *stamp) +int skabus_rpcc_interface_register (skabus_rpcc_t *a, char const *ifname, char const *ifprog, char const *re, tain const *deadline, tain *stamp) { size_t ifnamelen, ifproglen, relen ; char *ifprogfn = realpath(ifprog, 0) ; @@ -72,7 +72,7 @@ int skabus_rpcc_interface_register (skabus_rpcc_t *a, char const *ifname, char c return 0 ; } -int skabus_rpcc_interface_unregister (skabus_rpcc_t *a, char const *ifname, tain_t const *deadline, tain_t *stamp) +int skabus_rpcc_interface_unregister (skabus_rpcc_t *a, char const *ifname, tain const *deadline, tain *stamp) { size_t ifnamelen = strlen(ifname) ; if (ifnamelen > SKABUS_RPC_INTERFACE_MAXLEN) return (errno = ENAMETOOLONG, 0) ; @@ -89,7 +89,7 @@ int skabus_rpcc_interface_unregister (skabus_rpcc_t *a, char const *ifname, tain return 1 ; } -int skabus_rpcc_query (skabus_rpcc_t *a, stralloc *reply, char const *ifname, char const *query, uint32_t timeout, tain_t const *deadline, tain_t *stamp) +int skabus_rpcc_query (skabus_rpcc_t *a, stralloc *reply, char const *ifname, char const *query, uint32_t timeout, tain const *deadline, tain *stamp) { size_t ifnamelen = strlen(ifname) ; size_t querylen = strlen(query) ; @@ -118,7 +118,7 @@ int skabus_rpcc_query (skabus_rpcc_t *a, stralloc *reply, char const *ifname, ch return 1 ; } -int skabus_rpcc_quit (skabus_rpcc_t *a, tain_t const *deadline, tain_t *stamp) +int skabus_rpcc_quit (skabus_rpcc_t *a, tain const *deadline, tain *stamp) { return textmessage_timed_command(&a->out, ".", 1, deadline, stamp) ; } diff --git a/src/rpc/skabus_rpcd_client.c b/src/rpc/skabus_rpcd_client.c index deac459..198f0da 100644 --- a/src/rpc/skabus_rpcd_client.c +++ b/src/rpc/skabus_rpcd_client.c @@ -62,7 +62,7 @@ void client_remove (uint32_t i, uint32_t prev) void client_setdeadline (client_t *c) { - tain_t blah ; + tain blah ; tain_half(&blah, &tain_infinite_relative) ; tain_add_g(&blah, &blah) ; if (tain_less(&blah, &c->deadline)) tain_add_g(&c->deadline, &answertto) ; @@ -87,13 +87,13 @@ void client_add (uint32_t *d, regex_t const *idstr_re, regex_t const *interfaces *d = cc ; } -void client_nextdeadline (uint32_t i, tain_t *deadline) +void client_nextdeadline (uint32_t i, tain *deadline) { client_t *c = CLIENT(i) ; if (tain_less(&c->deadline, deadline)) *deadline = c->deadline ; } -int client_prepare_iopause (uint32_t cc, tain_t *deadline, iopause_fd *x, uint32_t *j, int notlameduck) +int client_prepare_iopause (uint32_t cc, tain *deadline, iopause_fd *x, uint32_t *j, int notlameduck) { client_t *c = CLIENT(cc) ; int inflight = 0 ; @@ -158,7 +158,7 @@ int client_read (uint32_t cc, iopause_fd const *x) { if (unixmessage_sender_fd(&c->async.out) < 0) { - unixmessage_t m ; + unixmessage m ; int r = unixmessage_receive(&c->sync.in, &m) ; if (r < 0) return -1 ; if (r) diff --git a/src/rpc/skabus_rpcd_query.c b/src/rpc/skabus_rpcd_query.c index baa6df5..13f3ebe 100644 --- a/src/rpc/skabus_rpcd_query.c +++ b/src/rpc/skabus_rpcd_query.c @@ -36,8 +36,8 @@ static int query_serial_cmp (void const *a, void const *b, void *x) static int query_deadline_cmp (void const *a, void const *b, void *x) { - tain_t const *aa = (tain_t const *)a ; - tain_t const *bb = (tain_t const *)b ; + tain const *aa = (tain const *)a ; + tain const *bb = (tain const *)b ; (void)x ; return tain_less(aa, bb) ? -1 : tain_less(bb, aa) ; } @@ -73,7 +73,7 @@ void query_fail (uint32_t i, char status) query_t *q = QUERY(i) ; client_t *c = CLIENT(q->client) ; char pack[10] = "Rssssssssr" ; - unixmessage_t m = { .s = pack, .len = 10, .fds = 0, .nfds = 0 } ; + unixmessage m = { .s = pack, .len = 10, .fds = 0, .nfds = 0 } ; uint64_pack_big(pack+1, q->serial) ; pack[9] = status ; if (!unixmessage_put(&c->async.out, &m)) @@ -88,7 +88,7 @@ int query_cancel (uint32_t i, char reason) interface_t *y = INTERFACE(q->interface) ; client_t *c = CLIENT(y->client) ; char pack[14] = "Ciiiissssssssr" ; - unixmessage_t m = { .s = pack, .len = 14, .fds = 0, .nfds = 0 } ; + unixmessage m = { .s = pack, .len = 14, .fds = 0, .nfds = 0 } ; uint32_pack_big(pack+1, y->id) ; uint64_pack_big(pack+5, q->serial) ; pack[13] = reason ; @@ -114,14 +114,14 @@ int query_lookup_by_mindeadline (uint32_t *d) return avltree_min(&qdeadlinedict, d) ; } -void query_get_mindeadline (tain_t *deadline) +void query_get_mindeadline (tain *deadline) { uint32_t d ; if (query_lookup_by_mindeadline(&d)) *deadline = QUERY(d)->deadline ; else tain_add_g(deadline, &tain_infinite_relative) ; } -int query_add (uint32_t *d, tain_t const *deadline, uint32_t client, uint32_t interface) +int query_add (uint32_t *d, tain const *deadline, uint32_t client, uint32_t interface) { static uint64_t serial = 1 ; uint32_t qq, cc, yy ; @@ -139,7 +139,7 @@ int query_add (uint32_t *d, tain_t const *deadline, uint32_t client, uint32_t in if (!avltree_insert(&qserialdict, qq)) goto end2 ; for (;;) { - static tain_t const nano1 = { .sec = TAI_ZERO, .nano = 1 } ; + static tain const nano1 = { .sec = TAI_ZERO, .nano = 1 } ; uint32_t d ; if (!avltree_search(&qdeadlinedict, &q->deadline, &d)) break ; tain_add(&q->deadline, &q->deadline, &nano1) ; @@ -164,12 +164,12 @@ int query_add (uint32_t *d, tain_t const *deadline, uint32_t client, uint32_t in return 0 ; } -int query_send (uint32_t qq, unixmessage_t const *m) +int query_send (uint32_t qq, unixmessage const *m) { skabus_rpc_rinfo_t rinfo ; char pack[4 + SKABUS_RPC_RINFO_PACK] = "Q" ; struct iovec v[2] = { { .iov_base = pack, .iov_len = 4 + SKABUS_RPC_RINFO_PACK }, { .iov_base = m->s, .iov_len = m->len } } ; - unixmessage_v_t mtosend = { .v = v, .vlen = 2, .fds = m->fds, .nfds = m->nfds } ; + unixmessagev mtosend = { .v = v, .vlen = 2, .fds = m->fds, .nfds = m->nfds } ; query_t *q = QUERY(qq) ; interface_t *y = INTERFACE(q->interface) ; client_t *c = CLIENT(q->client) ; @@ -190,11 +190,11 @@ int query_send (uint32_t qq, unixmessage_t const *m) return 1 ; } -void query_reply (uint32_t qq, char result, unixmessage_t const *m) +void query_reply (uint32_t qq, char result, unixmessage const *m) { char pack[11] = "R" ; struct iovec v[2] = { { .iov_base = pack, .iov_len = 11 }, { .iov_base = m->s, .iov_len = m->len } } ; - unixmessage_v_t mtosend = { .v = v, .vlen = 2, .fds = m->fds, .nfds = m->nfds } ; + unixmessagev mtosend = { .v = v, .vlen = 2, .fds = m->fds, .nfds = m->nfds } ; query_t *q = QUERY(qq) ; client_t *c = CLIENT(q->client) ; uint64_pack_big(pack+1, q->serial) ; |