summaryrefslogtreecommitdiff
path: root/src/libstddjb
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2021-07-28 23:45:20 +0000
committerLaurent Bercot <ska@appnovation.com>2021-07-28 23:45:20 +0000
commit9592bfd0dda7c575de07bce2c7a81b8432d845a4 (patch)
tree57c66c3e0dfeb63cfd3ebfef18e30a2145ae3f88 /src/libstddjb
parentc15bccec3fd551583ff838673ba284ee6c7e788a (diff)
downloadskalibs-9592bfd0dda7c575de07bce2c7a81b8432d845a4.tar.xz
Huge incompatible changes.
- Obsolete skalibs/environ.h and skalibs/getpeereid.h removed. - rc4 and md5 removed. - All *_t types renamed to avoid treading on POSIX namespace. - subgetopt() renamed to lgetopt(). - signal functions reworked; skasigaction removed; sig_stack removed - Various functions removed: skaoffsetof(), selfpipe_untrap() - New posixplz function: munmap_void. Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'src/libstddjb')
-rw-r--r--src/libstddjb/alarm_deadline.c6
-rw-r--r--src/libstddjb/alarm_timeout.c6
-rw-r--r--src/libstddjb/allreadwrite.c2
-rw-r--r--src/libstddjb/allreadwritev.c2
-rw-r--r--src/libstddjb/allwrite.c2
-rw-r--r--src/libstddjb/bufalloc_flush.c2
-rw-r--r--src/libstddjb/buffer_init.c2
-rw-r--r--src/libstddjb/cbuffer_get.c2
-rw-r--r--src/libstddjb/cbuffer_getv.c2
-rw-r--r--src/libstddjb/cbuffer_init.c2
-rw-r--r--src/libstddjb/cbuffer_put.c2
-rw-r--r--src/libstddjb/cbuffer_putv.c2
-rw-r--r--src/libstddjb/cbuffer_rpeek.c2
-rw-r--r--src/libstddjb/cbuffer_rseek.c2
-rw-r--r--src/libstddjb/cbuffer_unget.c2
-rw-r--r--src/libstddjb/cbuffer_unput.c2
-rw-r--r--src/libstddjb/cbuffer_wpeek.c2
-rw-r--r--src/libstddjb/cbuffer_wseek.c2
-rw-r--r--src/libstddjb/deepsleepuntil.c2
-rw-r--r--src/libstddjb/genalloc_deepfree.c2
-rw-r--r--src/libstddjb/genwrite_stderr.c2
-rw-r--r--src/libstddjb/genwrite_stdout.c2
-rw-r--r--src/libstddjb/iobufferk_fill.c4
-rw-r--r--src/libstddjb/iobufferk_finish.c4
-rw-r--r--src/libstddjb/iobufferk_flush.c4
-rw-r--r--src/libstddjb/iobufferk_init.c2
-rw-r--r--src/libstddjb/iopause.c6
-rw-r--r--src/libstddjb/iopause_poll.c5
-rw-r--r--src/libstddjb/iopause_ppoll.c6
-rw-r--r--src/libstddjb/iopause_select.c4
-rw-r--r--src/libstddjb/iopause_stamp.c2
-rw-r--r--src/libstddjb/ip46_scan.c4
-rw-r--r--src/libstddjb/ip46_scanlist.c5
-rw-r--r--src/libstddjb/ipc_timed_connect.c2
-rw-r--r--src/libstddjb/localtm_from_tai.c2
-rw-r--r--src/libstddjb/localtmn_fmt.c2
-rw-r--r--src/libstddjb/localtmn_from_sysclock.c3
-rw-r--r--src/libstddjb/localtmn_from_tain.c2
-rw-r--r--src/libstddjb/localtmn_scan.c4
-rw-r--r--src/libstddjb/ltm64_from_sysclock.c2
-rw-r--r--src/libstddjb/ltm64_from_tai.c2
-rw-r--r--src/libstddjb/ntp_from_tain.c2
-rw-r--r--src/libstddjb/selfpipe-internal.h2
-rw-r--r--src/libstddjb/selfpipe_finish.c24
-rw-r--r--src/libstddjb/selfpipe_init.c29
-rw-r--r--src/libstddjb/selfpipe_internal.c11
-rw-r--r--src/libstddjb/selfpipe_read.c2
-rw-r--r--src/libstddjb/selfpipe_trap.c28
-rw-r--r--src/libstddjb/selfpipe_trapset.c28
-rw-r--r--src/libstddjb/selfpipe_untrap.c54
-rw-r--r--src/libstddjb/sgetopt.c2
-rw-r--r--src/libstddjb/sig-internal.h8
-rw-r--r--src/libstddjb/sig0_scan.c1
-rw-r--r--src/libstddjb/sig_block.c1
-rw-r--r--src/libstddjb/sig_blocknone.c4
-rw-r--r--src/libstddjb/sig_blockset.c9
-rw-r--r--src/libstddjb/sig_catch.c10
-rw-r--r--src/libstddjb/sig_name.c2
-rw-r--r--src/libstddjb/sig_number.c3
-rw-r--r--src/libstddjb/sig_pause.c11
-rw-r--r--src/libstddjb/sig_push.c11
-rw-r--r--src/libstddjb/sig_restoreto.c3
-rw-r--r--src/libstddjb/sig_shield.c17
-rw-r--r--src/libstddjb/sig_stack.c28
-rw-r--r--src/libstddjb/sig_table.c3
-rw-r--r--src/libstddjb/sig_unblock.c1
-rw-r--r--src/libstddjb/sig_unshield.c17
-rw-r--r--src/libstddjb/skasig_dfl.c7
-rw-r--r--src/libstddjb/skasigaction.c27
-rw-r--r--src/libstddjb/socket_deadlineconnstamp4.c2
-rw-r--r--src/libstddjb/socket_deadlineconnstamp46.c3
-rw-r--r--src/libstddjb/socket_deadlineconnstamp4_u32.c2
-rw-r--r--src/libstddjb/socket_deadlineconnstamp6.c2
-rw-r--r--src/libstddjb/socket_ioloop.c2
-rw-r--r--src/libstddjb/socket_local46.c4
-rw-r--r--src/libstddjb/socket_remote46.c4
-rw-r--r--src/libstddjb/socket_timeoutconn.c2
-rw-r--r--src/libstddjb/socket_waitconn.c2
-rw-r--r--src/libstddjb/stamp.c2
-rw-r--r--src/libstddjb/subgetopt.c2
-rw-r--r--src/libstddjb/subgetopt_here.c2
-rw-r--r--src/libstddjb/sysclock_from_localtmn.c2
-rw-r--r--src/libstddjb/sysclock_from_ltm64.c2
-rw-r--r--src/libstddjb/sysclock_from_tai.c4
-rw-r--r--src/libstddjb/sysclock_from_tain.c2
-rw-r--r--src/libstddjb/sysclock_from_utc.c2
-rw-r--r--src/libstddjb/sysclock_get.c8
-rw-r--r--src/libstddjb/sysclock_set.c8
-rw-r--r--src/libstddjb/tai_add.c2
-rw-r--r--src/libstddjb/tai_from_localtm.c2
-rw-r--r--src/libstddjb/tai_from_ltm64.c2
-rw-r--r--src/libstddjb/tai_from_sysclock.c4
-rw-r--r--src/libstddjb/tai_from_utc.c2
-rw-r--r--src/libstddjb/tai_now.c2
-rw-r--r--src/libstddjb/tai_pack.c2
-rw-r--r--src/libstddjb/tai_pack_little.c2
-rw-r--r--src/libstddjb/tai_sub.c2
-rw-r--r--src/libstddjb/tai_u64.c2
-rw-r--r--src/libstddjb/tai_unpack.c2
-rw-r--r--src/libstddjb/tai_unpack_little.c2
-rw-r--r--src/libstddjb/tain_add.c2
-rw-r--r--src/libstddjb/tain_addsec.c6
-rw-r--r--src/libstddjb/tain_approx.c2
-rw-r--r--src/libstddjb/tain_fmt.c2
-rw-r--r--src/libstddjb/tain_frac.c2
-rw-r--r--src/libstddjb/tain_from_localtmn.c4
-rw-r--r--src/libstddjb/tain_from_millisecs.c2
-rw-r--r--src/libstddjb/tain_from_ntp.c4
-rw-r--r--src/libstddjb/tain_from_sysclock.c2
-rw-r--r--src/libstddjb/tain_from_timespec.c2
-rw-r--r--src/libstddjb/tain_from_timespec_sysclock.c2
-rw-r--r--src/libstddjb/tain_from_timeval.c2
-rw-r--r--src/libstddjb/tain_from_timeval_sysclock.c2
-rw-r--r--src/libstddjb/tain_half.c2
-rw-r--r--src/libstddjb/tain_infinite_relative.c2
-rw-r--r--src/libstddjb/tain_less.c2
-rw-r--r--src/libstddjb/tain_nano500.c2
-rw-r--r--src/libstddjb/tain_now.c2
-rw-r--r--src/libstddjb/tain_now_set_stopwatch.c8
-rw-r--r--src/libstddjb/tain_now_set_wallclock.c2
-rw-r--r--src/libstddjb/tain_pack.c2
-rw-r--r--src/libstddjb/tain_pack_little.c2
-rw-r--r--src/libstddjb/tain_relative_from_timespec.c2
-rw-r--r--src/libstddjb/tain_relative_from_timeval.c2
-rw-r--r--src/libstddjb/tain_scan.c2
-rw-r--r--src/libstddjb/tain_setnow.c4
-rw-r--r--src/libstddjb/tain_stopwatch.c14
-rw-r--r--src/libstddjb/tain_sub.c4
-rw-r--r--src/libstddjb/tain_to_millisecs.c2
-rw-r--r--src/libstddjb/tain_ulong.c2
-rw-r--r--src/libstddjb/tain_unpack.c2
-rw-r--r--src/libstddjb/tain_unpack_little.c2
-rw-r--r--src/libstddjb/tain_wallclock_read.c4
-rw-r--r--src/libstddjb/tain_zero.c2
-rw-r--r--src/libstddjb/time_from_tai.c2
-rw-r--r--src/libstddjb/time_from_tai_relative.c2
-rw-r--r--src/libstddjb/time_sysclock_from_tai.c2
-rw-r--r--src/libstddjb/timespec_from_tain.c2
-rw-r--r--src/libstddjb/timespec_from_tain_relative.c2
-rw-r--r--src/libstddjb/timespec_sysclock_from_tain.c2
-rw-r--r--src/libstddjb/timestamp.c2
-rw-r--r--src/libstddjb/timestamp_fmt.c2
-rw-r--r--src/libstddjb/timestamp_r.c2
-rw-r--r--src/libstddjb/timestamp_scan.c2
-rw-r--r--src/libstddjb/timeval_from_tain.c2
-rw-r--r--src/libstddjb/timeval_from_tain_relative.c2
-rw-r--r--src/libstddjb/timeval_sysclock_from_tain.c2
-rw-r--r--src/libstddjb/utc_from_sysclock.c2
-rw-r--r--src/libstddjb/utc_from_tai.c2
149 files changed, 270 insertions, 405 deletions
diff --git a/src/libstddjb/alarm_deadline.c b/src/libstddjb/alarm_deadline.c
index 768ee5c..1844c8c 100644
--- a/src/libstddjb/alarm_deadline.c
+++ b/src/libstddjb/alarm_deadline.c
@@ -18,7 +18,7 @@
# define MYCLOCK CLOCK_REALTIME
#endif
-int alarm_deadline (tain_t const *deadline)
+int alarm_deadline (tain const *deadline)
{
struct itimerspec it = { .it_interval = { .tv_sec = 0, .tv_nsec = 0 } } ;
struct sigevent se = { .sigev_notify = SIGEV_SIGNAL, .sigev_signo = SIGALRM, .sigev_value = { .sival_int = 0 }, .sigev_notify_function = 0, .sigev_notify_attributes = 0 } ;
@@ -36,9 +36,9 @@ int alarm_deadline (tain_t const *deadline)
#else
-int alarm_deadline (tain_t const *deadline)
+int alarm_deadline (tain const *deadline)
{
- tain_t tto ;
+ tain tto ;
tain_now(&tto) ;
tain_sub(&tto, deadline, &tto) ;
return alarm_timeout(&tto) ;
diff --git a/src/libstddjb/alarm_timeout.c b/src/libstddjb/alarm_timeout.c
index 630b524..1c1b865 100644
--- a/src/libstddjb/alarm_timeout.c
+++ b/src/libstddjb/alarm_timeout.c
@@ -18,7 +18,7 @@
# define MYCLOCK CLOCK_REALTIME
#endif
-int alarm_timeout (tain_t const *tto)
+int alarm_timeout (tain const *tto)
{
struct itimerspec it = { .it_interval = { .tv_sec = 0, .tv_nsec = 0 } } ;
struct sigevent se = { .sigev_notify = SIGEV_SIGNAL, .sigev_signo = SIGALRM, .sigev_value = { .sival_int = 0 }, .sigev_notify_function = 0, .sigev_notify_attributes = 0 } ;
@@ -39,7 +39,7 @@ int alarm_timeout (tain_t const *tto)
#include <sys/time.h>
-int alarm_timeout (tain_t const *tto)
+int alarm_timeout (tain const *tto)
{
struct itimerval it = { .it_interval = { .tv_sec = 0, .tv_usec = 0 } } ;
if (!timeval_from_tain_relative(&it.it_value, tto)) return 0 ;
@@ -52,7 +52,7 @@ int alarm_timeout (tain_t const *tto)
#include <unistd.h>
#include <limits.h>
-int alarm_timeout (tain_t const *tto)
+int alarm_timeout (tain const *tto)
{
int t = tain_to_millisecs(tto) ;
if (t < 0 || t > INT_MAX - 999) return 0 ;
diff --git a/src/libstddjb/allreadwrite.c b/src/libstddjb/allreadwrite.c
index f377cf0..0e9351a 100644
--- a/src/libstddjb/allreadwrite.c
+++ b/src/libstddjb/allreadwrite.c
@@ -3,7 +3,7 @@
#include <errno.h>
#include <skalibs/allreadwrite.h>
-size_t allreadwrite (iofunc_t_ref op, int fd, char *buf, size_t len)
+size_t allreadwrite (io_func_ref op, int fd, char *buf, size_t len)
{
size_t written = 0 ;
while (len)
diff --git a/src/libstddjb/allreadwritev.c b/src/libstddjb/allreadwritev.c
index 9d10361..41d6eef 100644
--- a/src/libstddjb/allreadwritev.c
+++ b/src/libstddjb/allreadwritev.c
@@ -4,7 +4,7 @@
#include <skalibs/siovec.h>
#include <skalibs/allreadwrite.h>
-size_t allreadwritev (iovfunc_t_ref op, int fd, struct iovec const *v, unsigned int vlen)
+size_t allreadwritev (iov_func_ref op, int fd, struct iovec const *v, unsigned int vlen)
{
size_t written = 0 ;
struct iovec vv[vlen ? vlen : 1] ;
diff --git a/src/libstddjb/allwrite.c b/src/libstddjb/allwrite.c
index 66bc5d2..c23025c 100644
--- a/src/libstddjb/allwrite.c
+++ b/src/libstddjb/allwrite.c
@@ -5,5 +5,5 @@
size_t allwrite (int fd, char const *buf, size_t len)
{
- return allreadwrite((iofunc_t_ref)&fd_write, fd, (char *)buf, len) ;
+ return allreadwrite((io_func_ref)&fd_write, fd, (char *)buf, len) ;
}
diff --git a/src/libstddjb/bufalloc_flush.c b/src/libstddjb/bufalloc_flush.c
index b6de51e..23a91d6 100644
--- a/src/libstddjb/bufalloc_flush.c
+++ b/src/libstddjb/bufalloc_flush.c
@@ -6,7 +6,7 @@
int bufalloc_flush (bufalloc *ba)
{
- ba->p += allreadwrite((iofunc_t_ref)ba->op, ba->fd, ba->x.s + ba->p, ba->x.len - ba->p) ;
+ ba->p += allreadwrite((io_func_ref)ba->op, ba->fd, ba->x.s + ba->p, ba->x.len - ba->p) ;
bufalloc_clean(ba) ;
return !ba->x.len ;
}
diff --git a/src/libstddjb/buffer_init.c b/src/libstddjb/buffer_init.c
index e143d70..d016cfb 100644
--- a/src/libstddjb/buffer_init.c
+++ b/src/libstddjb/buffer_init.c
@@ -4,7 +4,7 @@
#include <skalibs/cbuffer.h>
#include <skalibs/buffer.h>
-int buffer_init (buffer *b, iovfunc_t_ref op, int fd, char *s, size_t len)
+int buffer_init (buffer *b, iov_func_ref op, int fd, char *s, size_t len)
{
if (!cbuffer_init(&b->c, s, len)) return 0 ;
b->fd = fd ;
diff --git a/src/libstddjb/cbuffer_get.c b/src/libstddjb/cbuffer_get.c
index 315751a..a331799 100644
--- a/src/libstddjb/cbuffer_get.c
+++ b/src/libstddjb/cbuffer_get.c
@@ -4,7 +4,7 @@
#include <skalibs/siovec.h>
#include <skalibs/cbuffer.h>
-size_t cbuffer_get (cbuffer_t *b, char *s, size_t len)
+size_t cbuffer_get (cbuffer *b, char *s, size_t len)
{
struct iovec v[2] ;
size_t w ;
diff --git a/src/libstddjb/cbuffer_getv.c b/src/libstddjb/cbuffer_getv.c
index afdf8f9..99808fd 100644
--- a/src/libstddjb/cbuffer_getv.c
+++ b/src/libstddjb/cbuffer_getv.c
@@ -4,7 +4,7 @@
#include <skalibs/siovec.h>
#include <skalibs/cbuffer.h>
-size_t cbuffer_getv (cbuffer_t *b, struct iovec const *v, unsigned int n)
+size_t cbuffer_getv (cbuffer *b, struct iovec const *v, unsigned int n)
{
struct iovec vsrc[2] ;
size_t w ;
diff --git a/src/libstddjb/cbuffer_init.c b/src/libstddjb/cbuffer_init.c
index b4cb1bc..722ca4a 100644
--- a/src/libstddjb/cbuffer_init.c
+++ b/src/libstddjb/cbuffer_init.c
@@ -3,7 +3,7 @@
#include <errno.h>
#include <skalibs/cbuffer.h>
-int cbuffer_init (cbuffer_t *b, char *s, size_t len)
+int cbuffer_init (cbuffer *b, char *s, size_t len)
{
if (len < 2) return (errno = EINVAL, 0) ;
b->x = s ;
diff --git a/src/libstddjb/cbuffer_put.c b/src/libstddjb/cbuffer_put.c
index 428a430..6d57087 100644
--- a/src/libstddjb/cbuffer_put.c
+++ b/src/libstddjb/cbuffer_put.c
@@ -4,7 +4,7 @@
#include <skalibs/siovec.h>
#include <skalibs/cbuffer.h>
-size_t cbuffer_put (cbuffer_t *b, char const *s, size_t len)
+size_t cbuffer_put (cbuffer *b, char const *s, size_t len)
{
struct iovec v[2] ;
size_t w ;
diff --git a/src/libstddjb/cbuffer_putv.c b/src/libstddjb/cbuffer_putv.c
index 62af494..8afbee6 100644
--- a/src/libstddjb/cbuffer_putv.c
+++ b/src/libstddjb/cbuffer_putv.c
@@ -4,7 +4,7 @@
#include <skalibs/siovec.h>
#include <skalibs/cbuffer.h>
-size_t cbuffer_putv (cbuffer_t *b, struct iovec const *v, unsigned int n)
+size_t cbuffer_putv (cbuffer *b, struct iovec const *v, unsigned int n)
{
struct iovec vdest[2] ;
size_t w ;
diff --git a/src/libstddjb/cbuffer_rpeek.c b/src/libstddjb/cbuffer_rpeek.c
index 8592d00..c58a464 100644
--- a/src/libstddjb/cbuffer_rpeek.c
+++ b/src/libstddjb/cbuffer_rpeek.c
@@ -3,7 +3,7 @@
#include <sys/uio.h>
#include <skalibs/cbuffer.h>
-void cbuffer_rpeek (cbuffer_t const *b, struct iovec *v)
+void cbuffer_rpeek (cbuffer const *b, struct iovec *v)
{
v[0].iov_base = b->x + b->p ;
if (b->n >= b->p)
diff --git a/src/libstddjb/cbuffer_rseek.c b/src/libstddjb/cbuffer_rseek.c
index 9454c71..f53dc1b 100644
--- a/src/libstddjb/cbuffer_rseek.c
+++ b/src/libstddjb/cbuffer_rseek.c
@@ -2,7 +2,7 @@
#include <skalibs/cbuffer.h>
-size_t cbuffer_rseek (cbuffer_t *b, size_t len)
+size_t cbuffer_rseek (cbuffer *b, size_t len)
{
size_t max = cbuffer_len(b) ;
if (len > max) len = max ;
diff --git a/src/libstddjb/cbuffer_unget.c b/src/libstddjb/cbuffer_unget.c
index 97a066c..07ddbbe 100644
--- a/src/libstddjb/cbuffer_unget.c
+++ b/src/libstddjb/cbuffer_unget.c
@@ -2,7 +2,7 @@
#include <skalibs/cbuffer.h>
-size_t cbuffer_unget (cbuffer_t *b, size_t len)
+size_t cbuffer_unget (cbuffer *b, size_t len)
{
size_t max = cbuffer_available(b) ;
if (len > max) len = max ;
diff --git a/src/libstddjb/cbuffer_unput.c b/src/libstddjb/cbuffer_unput.c
index 0d9faa0..2801624 100644
--- a/src/libstddjb/cbuffer_unput.c
+++ b/src/libstddjb/cbuffer_unput.c
@@ -2,7 +2,7 @@
#include <skalibs/cbuffer.h>
-size_t cbuffer_unput (cbuffer_t *b, size_t len)
+size_t cbuffer_unput (cbuffer *b, size_t len)
{
size_t max = cbuffer_len(b) ;
if (len > max) len = max ;
diff --git a/src/libstddjb/cbuffer_wpeek.c b/src/libstddjb/cbuffer_wpeek.c
index d023294..cb3fc5e 100644
--- a/src/libstddjb/cbuffer_wpeek.c
+++ b/src/libstddjb/cbuffer_wpeek.c
@@ -3,7 +3,7 @@
#include <sys/uio.h>
#include <skalibs/cbuffer.h>
-void cbuffer_wpeek (cbuffer_t const *b, struct iovec *v)
+void cbuffer_wpeek (cbuffer const *b, struct iovec *v)
{
size_t last = (b->a - 1 + b->p) % b->a ;
v[0].iov_base = b->x + b->n ;
diff --git a/src/libstddjb/cbuffer_wseek.c b/src/libstddjb/cbuffer_wseek.c
index a36ae62..35860a8 100644
--- a/src/libstddjb/cbuffer_wseek.c
+++ b/src/libstddjb/cbuffer_wseek.c
@@ -2,7 +2,7 @@
#include <skalibs/cbuffer.h>
-size_t cbuffer_wseek (cbuffer_t *b, size_t len)
+size_t cbuffer_wseek (cbuffer *b, size_t len)
{
size_t max = cbuffer_available(b) ;
if (len > max) len = max ;
diff --git a/src/libstddjb/deepsleepuntil.c b/src/libstddjb/deepsleepuntil.c
index 77ac080..825014a 100644
--- a/src/libstddjb/deepsleepuntil.c
+++ b/src/libstddjb/deepsleepuntil.c
@@ -3,7 +3,7 @@
#include <skalibs/tai.h>
#include <skalibs/iopause.h>
-void deepsleepuntil (tain_t const *deadline, tain_t *stamp)
+void deepsleepuntil (tain const *deadline, tain *stamp)
{
iopause_fd x ;
while (tain_less(stamp, deadline)) iopause_stamp(&x, 0, deadline, stamp) ;
diff --git a/src/libstddjb/genalloc_deepfree.c b/src/libstddjb/genalloc_deepfree.c
index 2688047..17cdf3a 100644
--- a/src/libstddjb/genalloc_deepfree.c
+++ b/src/libstddjb/genalloc_deepfree.c
@@ -3,7 +3,7 @@
#include <skalibs/stralloc.h>
#include <skalibs/genalloc.h>
-void genalloc_deepfree_size (genalloc *g, freefunc_t_ref f, size_t size)
+void genalloc_deepfree_size (genalloc *g, free_func_ref f, size_t size)
{
size_t len = g->len / size ;
size_t i = 0 ;
diff --git a/src/libstddjb/genwrite_stderr.c b/src/libstddjb/genwrite_stderr.c
index 1d6bae3..cd8268a 100644
--- a/src/libstddjb/genwrite_stderr.c
+++ b/src/libstddjb/genwrite_stderr.c
@@ -3,4 +3,4 @@
#include <skalibs/buffer.h>
#include <skalibs/genwrite.h>
-genwrite_t genwrite_stderr = GENWRITE_BUFFER_INIT(buffer_2) ;
+genwrite genwrite_stderr = GENWRITE_BUFFER_INIT(buffer_2) ;
diff --git a/src/libstddjb/genwrite_stdout.c b/src/libstddjb/genwrite_stdout.c
index 4fec080..d4dcf4c 100644
--- a/src/libstddjb/genwrite_stdout.c
+++ b/src/libstddjb/genwrite_stdout.c
@@ -3,4 +3,4 @@
#include <skalibs/buffer.h>
#include <skalibs/genwrite.h>
-genwrite_t genwrite_stdout = GENWRITE_BUFFER_INIT(buffer_1) ;
+genwrite genwrite_stdout = GENWRITE_BUFFER_INIT(buffer_1) ;
diff --git a/src/libstddjb/iobufferk_fill.c b/src/libstddjb/iobufferk_fill.c
index 2117c45..c24ceba 100644
--- a/src/libstddjb/iobufferk_fill.c
+++ b/src/libstddjb/iobufferk_fill.c
@@ -32,7 +32,7 @@ static ssize_t iobufferk_fill_3 (iobufferk *k)
return r ;
}
-iobufferk_input_func_t_ref const iobufferk_fill_f[4] =
+iobufferk_input_func_ref const iobufferk_fill_f[4] =
{
&iobufferk_tee, &iobufferk_splice, &iobufferk_splice, &iobufferk_fill_3
} ;
@@ -48,7 +48,7 @@ static ssize_t iobufferk_inosys (iobufferk *k)
return (errno = ENOSYS, -1) ;
}
-iobufferk_input_func_t_ref const iobufferk_fill_f[4] =
+iobufferk_input_func_ref const iobufferk_fill_f[4] =
{
&iobufferk_inosys, &iobufferk_inosys, &iobufferk_inosys, &iobufferk_inosys
} ;
diff --git a/src/libstddjb/iobufferk_finish.c b/src/libstddjb/iobufferk_finish.c
index 4e4a73c..1640836 100644
--- a/src/libstddjb/iobufferk_finish.c
+++ b/src/libstddjb/iobufferk_finish.c
@@ -23,7 +23,7 @@ static void iobufferk_finish_3 (iobufferk *k)
fd_close(k->p[0]) ;
}
-iobufferk_finish_func_t_ref const iobufferk_finish_f[4] =
+iobufferk_finish_func_ref const iobufferk_finish_f[4] =
{
&iobufferk_finish_0, &iobufferk_nop, &iobufferk_nop, &iobufferk_finish_3
} ;
@@ -37,7 +37,7 @@ static void iobufferk_nop (iobufferk *k)
(void)k ;
}
-iobufferk_finish_func_t_ref const iobufferk_finish_f[4] =
+iobufferk_finish_func_ref const iobufferk_finish_f[4] =
{
&iobufferk_nop, &iobufferk_nop, &iobufferk_nop, &iobufferk_nop
} ;
diff --git a/src/libstddjb/iobufferk_flush.c b/src/libstddjb/iobufferk_flush.c
index 3c906dd..3f8d657 100644
--- a/src/libstddjb/iobufferk_flush.c
+++ b/src/libstddjb/iobufferk_flush.c
@@ -43,7 +43,7 @@ static int iobufferk_flush_3 (iobufferk *k)
return 1 ;
}
-iobufferk_output_func_t_ref const iobufferk_flush_f[4] =
+iobufferk_output_func_ref const iobufferk_flush_f[4] =
{
&iobufferk_flush_0, &fakeflush, &fakeflush, &iobufferk_flush_3
} ;
@@ -59,7 +59,7 @@ static int iobufferk_onosys (iobufferk *k)
return (errno = ENOSYS, -1) ;
}
-iobufferk_output_func_t_ref const iobufferk_flush_f[4] =
+iobufferk_output_func_ref const iobufferk_flush_f[4] =
{
&iobufferk_onosys, &iobufferk_onosys, &iobufferk_onosys, &iobufferk_onosys
} ;
diff --git a/src/libstddjb/iobufferk_init.c b/src/libstddjb/iobufferk_init.c
index 12a2822..b7a91d7 100644
--- a/src/libstddjb/iobufferk_init.c
+++ b/src/libstddjb/iobufferk_init.c
@@ -30,7 +30,7 @@ static int iobufferk_init_3 (iobufferk *k)
return (pipecoe(k->p) >= 0) ;
}
-static iobufferk_output_func_t_ref iobufferk_init_f[4] =
+static iobufferk_output_func_ref iobufferk_init_f[4] =
{
&iobufferk_init_0, &iobufferk_nofd, &iobufferk_nofd, &iobufferk_init_3
} ;
diff --git a/src/libstddjb/iopause.c b/src/libstddjb/iopause.c
index 38e3b54..7c62420 100644
--- a/src/libstddjb/iopause.c
+++ b/src/libstddjb/iopause.c
@@ -5,7 +5,7 @@
#ifdef SKALIBS_HASPPOLL
-iopause_func_t_ref const iopause_ = &iopause_ppoll ;
+iopause_func_ref const iopause_ = &iopause_ppoll ;
#else
@@ -13,11 +13,11 @@ iopause_func_t_ref const iopause_ = &iopause_ppoll ;
#ifdef SKALIBS_FLAG_PREFERSELECT
-iopause_func_t_ref const iopause_ = &iopause_select ;
+iopause_func_ref const iopause_ = &iopause_select ;
#else
-iopause_func_t_ref const iopause_ = &iopause_poll ;
+iopause_func_ref const iopause_ = &iopause_poll ;
#endif
diff --git a/src/libstddjb/iopause_poll.c b/src/libstddjb/iopause_poll.c
index 396122b..0c7c681 100644
--- a/src/libstddjb/iopause_poll.c
+++ b/src/libstddjb/iopause_poll.c
@@ -2,16 +2,17 @@
#include <errno.h>
#include <poll.h>
+
#include <skalibs/tai.h>
#include <skalibs/iopause.h>
-int iopause_poll (iopause_fd *x, unsigned int len, tain_t const *deadline, tain_t const *stamp)
+int iopause_poll (iopause_fd *x, unsigned int len, tain const *deadline, tain const *stamp)
{
int millisecs = 0 ;
if (!deadline) millisecs = -1 ;
else if (tain_less(stamp, deadline))
{
- tain_t t ;
+ tain t ;
tain_sub(&t, deadline, stamp) ;
millisecs = tain_to_millisecs(&t) ;
}
diff --git a/src/libstddjb/iopause_ppoll.c b/src/libstddjb/iopause_ppoll.c
index 0c571e1..336bf8e 100644
--- a/src/libstddjb/iopause_ppoll.c
+++ b/src/libstddjb/iopause_ppoll.c
@@ -11,12 +11,12 @@
#include <skalibs/tai.h>
#include <skalibs/iopause.h>
-int iopause_ppoll (iopause_fd *x, unsigned int len, tain_t const *deadline, tain_t const *stamp)
+int iopause_ppoll (iopause_fd *x, unsigned int len, tain const *deadline, tain const *stamp)
{
struct timespec ts = { .tv_sec = 0, .tv_nsec = 0 } ;
if (deadline && tain_less(stamp, deadline))
{
- tain_t delta ;
+ tain delta ;
tain_sub(&delta, deadline, stamp) ;
if (!timespec_from_tain_relative(&ts, &delta))
{
@@ -32,7 +32,7 @@ int iopause_ppoll (iopause_fd *x, unsigned int len, tain_t const *deadline, tain
#include <errno.h>
#include <skalibs/iopause.h>
-int iopause_ppoll (iopause_fd *x, unsigned int len, tain_t const *deadline, tain_t const *stamp)
+int iopause_ppoll (iopause_fd *x, unsigned int len, tain const *deadline, tain const *stamp)
{
(void)x ;
(void)len ;
diff --git a/src/libstddjb/iopause_select.c b/src/libstddjb/iopause_select.c
index a98767c..ec439d6 100644
--- a/src/libstddjb/iopause_select.c
+++ b/src/libstddjb/iopause_select.c
@@ -7,7 +7,7 @@
#include <skalibs/tai.h>
#include <skalibs/iopause.h>
-int iopause_select (iopause_fd *x, unsigned int len, tain_t const *deadline, tain_t const *stamp)
+int iopause_select (iopause_fd *x, unsigned int len, tain const *deadline, tain const *stamp)
{
struct timeval tv = { .tv_sec = 0, .tv_usec = 0 } ;
int nfds = 0 ;
@@ -19,7 +19,7 @@ int iopause_select (iopause_fd *x, unsigned int len, tain_t const *deadline, tai
FD_ZERO(&xfds) ;
if (deadline && tain_less(stamp, deadline))
{
- tain_t delta ;
+ tain delta ;
tain_sub(&delta, deadline, stamp) ;
if (!timeval_from_tain_relative(&tv, &delta))
{
diff --git a/src/libstddjb/iopause_stamp.c b/src/libstddjb/iopause_stamp.c
index 81056f4..a2ac8fa 100644
--- a/src/libstddjb/iopause_stamp.c
+++ b/src/libstddjb/iopause_stamp.c
@@ -4,7 +4,7 @@
#include <skalibs/tai.h>
#include <skalibs/iopause.h>
-int iopause_stamp (iopause_fd *x, unsigned int n, tain_t const *deadline, tain_t *stamp)
+int iopause_stamp (iopause_fd *x, unsigned int n, tain const *deadline, tain *stamp)
{
int r ;
do
diff --git a/src/libstddjb/ip46_scan.c b/src/libstddjb/ip46_scan.c
index 3e2f645..8b30fc1 100644
--- a/src/libstddjb/ip46_scan.c
+++ b/src/libstddjb/ip46_scan.c
@@ -1,9 +1,11 @@
/* ISC license. */
+#include <stddef.h>
+
#include <skalibs/fmtscan.h>
#include <skalibs/ip46.h>
-size_t ip46full_scan (char const *s, ip46full_t *ip)
+size_t ip46full_scan (char const *s, ip46full *ip)
{
size_t len = ip6_scan(s, ip->ip) ;
if (len) ip->is6 = 1 ;
diff --git a/src/libstddjb/ip46_scanlist.c b/src/libstddjb/ip46_scanlist.c
index d6d5cbc..1211ac3 100644
--- a/src/libstddjb/ip46_scanlist.c
+++ b/src/libstddjb/ip46_scanlist.c
@@ -1,15 +1,16 @@
/* ISC license. */
#include <string.h>
+
#include <skalibs/fmtscan.h>
#include <skalibs/ip46.h>
-size_t ip46full_scanlist (ip46full_t *out, size_t max, char const *s, size_t *num)
+size_t ip46full_scanlist (ip46full *out, size_t max, char const *s, size_t *num)
{
size_t n = 0, w = 0 ;
for (; s[w] && (n < max) ; n++)
{
- ip46full_t z ;
+ ip46full z ;
size_t i = ip6_scan(s + w, z.ip) ;
if (i) z.is6 = 1 ;
else
diff --git a/src/libstddjb/ipc_timed_connect.c b/src/libstddjb/ipc_timed_connect.c
index ff88018..495f9e6 100644
--- a/src/libstddjb/ipc_timed_connect.c
+++ b/src/libstddjb/ipc_timed_connect.c
@@ -6,7 +6,7 @@
#include <skalibs/iopause.h>
#include <skalibs/socket.h>
-int ipc_timed_connect (int s, char const *path, tain_t const *deadline, tain_t *stamp)
+int ipc_timed_connect (int s, char const *path, tain const *deadline, tain *stamp)
{
if (!ipc_connect(s, path))
{
diff --git a/src/libstddjb/localtm_from_tai.c b/src/libstddjb/localtm_from_tai.c
index c11131c..8b7fa22 100644
--- a/src/libstddjb/localtm_from_tai.c
+++ b/src/libstddjb/localtm_from_tai.c
@@ -4,7 +4,7 @@
#include <skalibs/uint64.h>
#include <skalibs/djbtime.h>
-int localtm_from_tai (struct tm *l, tai_t const *t, int tz)
+int localtm_from_tai (struct tm *l, tai const *t, int tz)
{
uint64_t u ;
int h = ltm64_from_tai(&u, t) ;
diff --git a/src/libstddjb/localtmn_fmt.c b/src/libstddjb/localtmn_fmt.c
index 25d5786..00147ec 100644
--- a/src/libstddjb/localtmn_fmt.c
+++ b/src/libstddjb/localtmn_fmt.c
@@ -3,7 +3,7 @@
#include <skalibs/uint32.h>
#include <skalibs/djbtime.h>
-size_t localtmn_fmt (char *s, localtmn_t const *l)
+size_t localtmn_fmt (char *s, localtmn const *l)
{
char *p = s ;
p += localtm_fmt(p, &l->tm) ; *p++ = '.' ;
diff --git a/src/libstddjb/localtmn_from_sysclock.c b/src/libstddjb/localtmn_from_sysclock.c
index f02927e..19f724b 100644
--- a/src/libstddjb/localtmn_from_sysclock.c
+++ b/src/libstddjb/localtmn_from_sysclock.c
@@ -1,9 +1,10 @@
/* ISC license. */
#include <time.h>
+
#include <skalibs/djbtime.h>
-int localtmn_from_sysclock (localtmn_t *l, tain_t const *a, int tz)
+int localtmn_from_sysclock (localtmn *l, tain const *a, int tz)
{
struct tm t ;
if (!localtm_from_sysclock(&t, a->sec.x, tz)) return 0 ;
diff --git a/src/libstddjb/localtmn_from_tain.c b/src/libstddjb/localtmn_from_tain.c
index f94f294..9860895 100644
--- a/src/libstddjb/localtmn_from_tain.c
+++ b/src/libstddjb/localtmn_from_tain.c
@@ -3,7 +3,7 @@
#include <time.h>
#include <skalibs/djbtime.h>
-int localtmn_from_tain (localtmn_t *l, tain_t const *a, int tz)
+int localtmn_from_tain (localtmn *l, tain const *a, int tz)
{
struct tm t ;
if (!localtm_from_tai(&t, tain_secp(a), tz)) return 0 ;
diff --git a/src/libstddjb/localtmn_scan.c b/src/libstddjb/localtmn_scan.c
index 4ecfdd7..caacd6a 100644
--- a/src/libstddjb/localtmn_scan.c
+++ b/src/libstddjb/localtmn_scan.c
@@ -3,9 +3,9 @@
#include <skalibs/uint32.h>
#include <skalibs/djbtime.h>
-size_t localtmn_scan (char const *s, localtmn_t *l)
+size_t localtmn_scan (char const *s, localtmn *l)
{
- localtmn_t m ;
+ localtmn m ;
size_t n = localtm_scan(s, &m.tm) ;
if (!n) return 0 ;
s += n ;
diff --git a/src/libstddjb/ltm64_from_sysclock.c b/src/libstddjb/ltm64_from_sysclock.c
index 4804b39..648ac3b 100644
--- a/src/libstddjb/ltm64_from_sysclock.c
+++ b/src/libstddjb/ltm64_from_sysclock.c
@@ -9,7 +9,7 @@
int ltm64_from_sysclock (uint64_t *u)
{
- tai_t t = { .x = *u + 10U } ;
+ tai t = { .x = *u + 10U } ;
return ltm64_from_tai(u, &t) ;
}
diff --git a/src/libstddjb/ltm64_from_tai.c b/src/libstddjb/ltm64_from_tai.c
index 39e6205..01709fa 100644
--- a/src/libstddjb/ltm64_from_tai.c
+++ b/src/libstddjb/ltm64_from_tai.c
@@ -3,7 +3,7 @@
#include <skalibs/djbtime.h>
#include "djbtime-internal.h"
-int ltm64_from_tai (uint64_t *u, tai_t const *t)
+int ltm64_from_tai (uint64_t *u, tai const *t)
{
switch (skalibs_tzisright())
{
diff --git a/src/libstddjb/ntp_from_tain.c b/src/libstddjb/ntp_from_tain.c
index 276a775..85a338a 100644
--- a/src/libstddjb/ntp_from_tain.c
+++ b/src/libstddjb/ntp_from_tain.c
@@ -5,7 +5,7 @@
#include <skalibs/tai.h>
#include <skalibs/djbtime.h>
-int ntp_from_tain (uint64_t *u, tain_t const *a)
+int ntp_from_tain (uint64_t *u, tain const *a)
{
uint64_t secs, frac ;
if (!utc_from_tai(&secs, tain_secp(a))) return 0 ;
diff --git a/src/libstddjb/selfpipe-internal.h b/src/libstddjb/selfpipe-internal.h
index 994c179..08d5738 100644
--- a/src/libstddjb/selfpipe-internal.h
+++ b/src/libstddjb/selfpipe-internal.h
@@ -21,7 +21,7 @@ extern int selfpipe_fd ;
extern int selfpipe[2] ;
#define selfpipe_fd selfpipe[0]
-extern struct skasigaction const selfpipe_ssa ;
+extern sig_func_ref selfpipe_tophalf ;
#endif
diff --git a/src/libstddjb/selfpipe_finish.c b/src/libstddjb/selfpipe_finish.c
index 60899eb..db42430 100644
--- a/src/libstddjb/selfpipe_finish.c
+++ b/src/libstddjb/selfpipe_finish.c
@@ -6,36 +6,48 @@
#ifdef SKALIBS_HASSIGNALFD
+#include <errno.h>
#include <signal.h>
+
#include <skalibs/djbunix.h>
-#include "selfpipe-internal.h"
#include <skalibs/selfpipe.h>
+#include "selfpipe-internal.h"
void selfpipe_finish (void)
{
+ int e = errno ;
+ fd_close(selfpipe_fd) ;
sigprocmask(SIG_UNBLOCK, &selfpipe_caught, 0) ;
sigemptyset(&selfpipe_caught) ;
- fd_close(selfpipe_fd) ;
selfpipe_fd = -1 ;
+ errno = e ;
}
#else
#include <skalibs/nonposix.h>
+#include <skalibs/bsdsnowflake.h>
+
+#include <errno.h>
#include <signal.h>
-#include <skalibs/sig.h>
+
#include <skalibs/nsig.h>
+#include <skalibs/sig.h>
#include <skalibs/djbunix.h>
-#include "selfpipe-internal.h"
#include <skalibs/selfpipe.h>
+#include "selfpipe-internal.h"
void selfpipe_finish (void)
{
- sig_restoreto(&selfpipe_caught, SKALIBS_NSIG-1) ;
- sigemptyset(&selfpipe_caught) ;
+ int e = errno ;
+ sigprocmask(SIG_BLOCK, &selfpipe_caught, 0) ;
+ sig_restoreto(&selfpipe_caught, SKALIBS_NSIG) ;
fd_close(selfpipe[1]) ;
fd_close(selfpipe[0]) ;
+ sigprocmask(SIG_UNBLOCK, &selfpipe_caught, 0) ;
+ sigemptyset(&selfpipe_caught) ;
selfpipe[0] = selfpipe[1] = -1 ;
+ errno = e ;
}
#endif
diff --git a/src/libstddjb/selfpipe_init.c b/src/libstddjb/selfpipe_init.c
index bd26d2f..8dcdcca 100644
--- a/src/libstddjb/selfpipe_init.c
+++ b/src/libstddjb/selfpipe_init.c
@@ -2,26 +2,35 @@
/* MT-unsafe */
-#include <errno.h>
#include <signal.h>
+
#include <skalibs/sysdeps.h>
-#include "selfpipe-internal.h"
+#include <skalibs/sig.h>
#include <skalibs/selfpipe.h>
+#include "selfpipe-internal.h"
#ifdef SKALIBS_HASSIGNALFD
+
#include <sys/signalfd.h>
+
+int selfpipe_init (void)
+{
+ sigemptyset(&selfpipe_caught) ;
+ selfpipe_fd = signalfd(selfpipe_fd, &selfpipe_caught, SFD_NONBLOCK | SFD_CLOEXEC) ;
+ sig_blocknone() ;
+ return selfpipe_fd ;
+}
+
#else
+
#include <skalibs/djbunix.h>
-#endif
int selfpipe_init (void)
{
- if (selfpipe_fd >= 0) return (errno = EBUSY, -1) ;
+ if (selfpipe_fd >= 0) selfpipe_finish() ;
sigemptyset(&selfpipe_caught) ;
-#ifdef SKALIBS_HASSIGNALFD
- selfpipe_fd = signalfd(-1, &selfpipe_caught, SFD_NONBLOCK | SFD_CLOEXEC) ;
-#else
- if (pipenbcoe(selfpipe) < 0) return -1 ;
-#endif
- return selfpipe_fd ;
+ sig_blocknone() ;
+ return pipenbcoe(selfpipe) < 0 ? -1 : selfpipe_fd ;
}
+
+#endif
diff --git a/src/libstddjb/selfpipe_internal.c b/src/libstddjb/selfpipe_internal.c
index f65e07a..34bdd51 100644
--- a/src/libstddjb/selfpipe_internal.c
+++ b/src/libstddjb/selfpipe_internal.c
@@ -3,6 +3,7 @@
/* MT-unsafe */
#include <signal.h>
+
#include <skalibs/sysdeps.h>
#include "selfpipe-internal.h"
@@ -14,18 +15,16 @@ int selfpipe_fd = -1 ;
#else
-#include <errno.h>
+#include <unistd.h>
+
#include <skalibs/allreadwrite.h>
-#include <skalibs/djbunix.h>
int selfpipe[2] = { -1, -1 } ;
-static void selfpipe_trigger (int s)
+void selfpipe_tophalf (int s)
{
unsigned char c = (unsigned char)s ;
- fd_write(selfpipe[1], (char *)&c, 1) ;
+ write(selfpipe[1], (char *)&c, 1) ;
}
-struct skasigaction const selfpipe_ssa = { &selfpipe_trigger, SKASA_NOCLDSTOP | SKASA_MASKALL } ;
-
#endif
diff --git a/src/libstddjb/selfpipe_read.c b/src/libstddjb/selfpipe_read.c
index cd7098f..4bf1988 100644
--- a/src/libstddjb/selfpipe_read.c
+++ b/src/libstddjb/selfpipe_read.c
@@ -4,8 +4,8 @@
#include <skalibs/sysdeps.h>
#include <skalibs/allreadwrite.h>
-#include "selfpipe-internal.h"
#include <skalibs/selfpipe.h>
+#include "selfpipe-internal.h"
#ifdef SKALIBS_HASSIGNALFD
diff --git a/src/libstddjb/selfpipe_trap.c b/src/libstddjb/selfpipe_trap.c
index 1dd4320..6ff8f09 100644
--- a/src/libstddjb/selfpipe_trap.c
+++ b/src/libstddjb/selfpipe_trap.c
@@ -4,9 +4,10 @@
#include <errno.h>
#include <signal.h>
+
#include <skalibs/sysdeps.h>
-#include "selfpipe-internal.h"
#include <skalibs/selfpipe.h>
+#include "selfpipe-internal.h"
#ifdef SKALIBS_HASSIGNALFD
@@ -16,18 +17,17 @@ int selfpipe_trap (int sig)
{
sigset_t ss = selfpipe_caught ;
sigset_t old ;
- if (selfpipe_fd < 0) return (errno = EBADF, -1) ;
- if ((sigaddset(&ss, sig) < 0) || (sigprocmask(SIG_BLOCK, &ss, &old) < 0))
- return -1 ;
+ if (selfpipe_fd < 0) return (errno = EBADF, 0) ;
+ if ((sigaddset(&ss, sig) < 0) || (sigprocmask(SIG_BLOCK, &ss, &old) < 0)) return 0 ;
if (signalfd(selfpipe_fd, &ss, SFD_NONBLOCK | SFD_CLOEXEC) < 0)
{
int e = errno ;
sigprocmask(SIG_SETMASK, &old, 0) ;
errno = e ;
- return -1 ;
+ return 0 ;
}
selfpipe_caught = ss ;
- return 0 ;
+ return 1 ;
}
#else
@@ -36,16 +36,12 @@ int selfpipe_trap (int sig)
int selfpipe_trap (int sig)
{
- if (selfpipe_fd < 0) return (errno = EBADF, -1) ;
- if (sig_catcha(sig, &selfpipe_ssa) < 0) return -1 ;
- if (sigaddset(&selfpipe_caught, sig) < 0 || sigprocmask(SIG_UNBLOCK, &selfpipe_caught, 0) < 0)
- {
- int e = errno ;
- sig_restore(sig) ;
- errno = e ;
- return -1 ;
- }
- return 0 ;
+ sigset_t set ;
+ if (selfpipe_fd < 0) return (errno = EBADF, 0) ;
+ if (!sig_catch(sig, &selfpipe_tophalf)) return 0 ;
+ sigaddset(&selfpipe_caught, sig) ;
+ sig_unblock(sig) ;
+ return 1 ;
}
#endif
diff --git a/src/libstddjb/selfpipe_trapset.c b/src/libstddjb/selfpipe_trapset.c
index 542ad10..9559c07 100644
--- a/src/libstddjb/selfpipe_trapset.c
+++ b/src/libstddjb/selfpipe_trapset.c
@@ -7,60 +7,66 @@
#include <errno.h>
#include <signal.h>
#include <sys/signalfd.h>
+
#include <skalibs/selfpipe.h>
#include "selfpipe-internal.h"
int selfpipe_trapset (sigset_t const *set)
{
sigset_t old ;
- if (selfpipe_fd < 0) return (errno = EBADF, -1) ;
- if (sigprocmask(SIG_BLOCK, set, &old) < 0) return -1 ;
+ if (selfpipe_fd < 0) return (errno = EBADF, 0) ;
+ if (sigprocmask(SIG_SETMASK, set, &old) < 0) return 0 ;
if (signalfd(selfpipe_fd, set, SFD_NONBLOCK | SFD_CLOEXEC) < 0)
{
int e = errno ;
sigprocmask(SIG_SETMASK, &old, 0) ;
errno = e ;
- return -1 ;
+ return 0 ;
}
selfpipe_caught = *set ;
- return 0 ;
+ return 1 ;
}
#else
#include <skalibs/nonposix.h>
+#include <skalibs/bsdsnowflake.h>
+
#include <errno.h>
#include <signal.h>
-#include <skalibs/sig.h>
+
#include <skalibs/nsig.h>
+#include <skalibs/sig.h>
#include <skalibs/selfpipe.h>
#include "selfpipe-internal.h"
int selfpipe_trapset (sigset_t const *set)
{
unsigned int i = 1 ;
- if (selfpipe_fd < 0) return (errno = EBADF, -1) ;
+ if (selfpipe_fd < 0) return (errno = EBADF, 0) ;
for (; i < SKALIBS_NSIG ; i++)
{
int h = sigismember(set, i) ;
if (h < 0) continue ;
if (h)
{
- if (sig_catcha(i, &selfpipe_ssa) < 0) break ;
+ if (!sig_catch(i, &selfpipe_tophalf)) goto err ;
}
else if (sigismember(&selfpipe_caught, i))
{
- if (sig_restore(i) < 0) break ;
+ if (!sig_restore(i)) goto err ;
}
}
- if (i < SKALIBS_NSIG || sigprocmask(SIG_UNBLOCK, set, 0) < 0)
+ sig_blocknone() ;
+ selfpipe_caught = *set ;
+ return 1 ;
+
+ err:
{
int e = errno ;
sig_restoreto(set, i) ;
errno = e ;
- return -1 ;
}
- selfpipe_caught = *set ;
return 0 ;
}
diff --git a/src/libstddjb/selfpipe_untrap.c b/src/libstddjb/selfpipe_untrap.c
deleted file mode 100644
index 7d82cf4..0000000
--- a/src/libstddjb/selfpipe_untrap.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/* ISC license. */
-
-/* MT-unsafe */
-
-#include <errno.h>
-#include <signal.h>
-#include <skalibs/sysdeps.h>
-#include "selfpipe-internal.h"
-#include <skalibs/selfpipe.h>
-
-#ifdef SKALIBS_HASSIGNALFD
-
-#include <sys/signalfd.h>
-
-int selfpipe_untrap (int sig)
-{
- sigset_t ss = selfpipe_caught ;
- sigset_t blah ;
- int r = sigismember(&selfpipe_caught, sig) ;
- if (selfpipe_fd < 0) return (errno = EBADF, -1) ;
- if (r < 0) return -1 ;
- if (!r) return (errno = EINVAL, -1) ;
- if ((sigdelset(&ss, sig) < 0)
- || (signalfd(selfpipe_fd, &ss, SFD_NONBLOCK | SFD_CLOEXEC) < 0))
- return -1 ;
- sigemptyset(&blah) ;
- sigaddset(&blah, sig) ;
- if (sigprocmask(SIG_UNBLOCK, &blah, 0) < 0)
- {
- int e = errno ;
- signalfd(selfpipe_fd, &selfpipe_caught, SFD_NONBLOCK | SFD_CLOEXEC) ;
- errno = e ;
- return -1 ;
- }
- selfpipe_caught = ss ;
- return 0 ;
-}
-
-#else
-
-#include <skalibs/sig.h>
-
-int selfpipe_untrap (int sig)
-{
- int r = sigismember(&selfpipe_caught, sig) ;
- if (selfpipe_fd < 0) return (errno = EBADF, -1) ;
- if (r < 0) return -1 ;
- if (!r) return (errno = EINVAL, -1) ;
- if (sig_restore(sig) < 0) return -1 ;
- sigdelset(&selfpipe_caught, sig) ;
- return 0 ;
-}
-
-#endif
diff --git a/src/libstddjb/sgetopt.c b/src/libstddjb/sgetopt.c
index f576689..31ea28f 100644
--- a/src/libstddjb/sgetopt.c
+++ b/src/libstddjb/sgetopt.c
@@ -7,7 +7,7 @@
#include <skalibs/buffer.h>
#include <skalibs/sgetopt.h>
-int sgetopt_r (int argc, char const *const *argv, char const *opts, subgetopt_t *o)
+int sgetopt_r (int argc, char const *const *argv, char const *opts, subgetopt *o)
{
int c = subgetopt_r(argc, argv, opts, o) ;
if (o->err && ((c == '?') || (c == ':')))
diff --git a/src/libstddjb/sig-internal.h b/src/libstddjb/sig-internal.h
index 9b540fa..573fbfa 100644
--- a/src/libstddjb/sig-internal.h
+++ b/src/libstddjb/sig-internal.h
@@ -1,15 +1,15 @@
/* ISC license. */
-#ifndef SIG_INTERNAL
-#define SIG_INTERNAL
+#ifndef SKALIBS_SIG_INTERNAL_H
+#define SKALIBS_SIG_INTERNAL_H
-typedef struct sigtable_s sigtable_t, *sigtable_t_ref ;
+typedef struct sigtable_s sigtable, *sigtable_ref ;
struct sigtable_s
{
int number ;
char const *name ;
} ;
-extern sigtable_t const skalibs_sigtable[] ;
+extern sigtable const skalibs_sigtable[] ;
#endif
diff --git a/src/libstddjb/sig0_scan.c b/src/libstddjb/sig0_scan.c
index d6b2b90..453c527 100644
--- a/src/libstddjb/sig0_scan.c
+++ b/src/libstddjb/sig0_scan.c
@@ -2,6 +2,7 @@
#include <string.h>
#include <strings.h>
+
#include <skalibs/types.h>
#include <skalibs/sig.h>
diff --git a/src/libstddjb/sig_block.c b/src/libstddjb/sig_block.c
index 89ae51f..fc67390 100644
--- a/src/libstddjb/sig_block.c
+++ b/src/libstddjb/sig_block.c
@@ -1,6 +1,7 @@
/* ISC license. */
#include <signal.h>
+
#include <skalibs/sig.h>
void sig_block (int sig)
diff --git a/src/libstddjb/sig_blocknone.c b/src/libstddjb/sig_blocknone.c
index 8498f0f..a8d1fbc 100644
--- a/src/libstddjb/sig_blocknone.c
+++ b/src/libstddjb/sig_blocknone.c
@@ -1,11 +1,15 @@
/* ISC license. */
+#include <errno.h>
#include <signal.h>
+
#include <skalibs/sig.h>
void sig_blocknone (void)
{
+ int e = errno ;
sigset_t ss ;
sigemptyset(&ss) ;
sigprocmask(SIG_SETMASK, &ss, 0) ;
+ errno = e ;
}
diff --git a/src/libstddjb/sig_blockset.c b/src/libstddjb/sig_blockset.c
deleted file mode 100644
index 206c157..0000000
--- a/src/libstddjb/sig_blockset.c
+++ /dev/null
@@ -1,9 +0,0 @@
-/* ISC license. */
-
-#include <signal.h>
-#include <skalibs/sig.h>
-
-void sig_blockset (sigset_t const *set)
-{
- sigprocmask(SIG_SETMASK, set, 0) ;
-}
diff --git a/src/libstddjb/sig_catch.c b/src/libstddjb/sig_catch.c
index d0a72df..5195d4b 100644
--- a/src/libstddjb/sig_catch.c
+++ b/src/libstddjb/sig_catch.c
@@ -2,10 +2,14 @@
/* MT-unsafe */
+#include <signal.h>
+
+#include <skalibs/functypes.h>
#include <skalibs/sig.h>
-int sig_catch (int sig, skasighandler_t_ref f)
+int sig_catch (int sig, sig_func_ref f)
{
- struct skasigaction ssa = { f, SKASA_MASKALL | SKASA_NOCLDSTOP } ;
- return sig_catcha(sig, &ssa) ;
+ struct sigaction action = { .sa_handler = f, .sa_flags = SA_RESTART | SA_NOCLDSTOP } ;
+ sigfillset(&action.sa_mask) ;
+ return sigaction(sig, &action, 0) >= 0 ;
}
diff --git a/src/libstddjb/sig_name.c b/src/libstddjb/sig_name.c
index 0679055..c8d7b6f 100644
--- a/src/libstddjb/sig_name.c
+++ b/src/libstddjb/sig_name.c
@@ -5,7 +5,7 @@
char const *sig_name (int sig)
{
- sigtable_t const *p = skalibs_sigtable ;
+ sigtable const *p = skalibs_sigtable ;
for (; p->number ; p++) if (sig == p->number) break ;
return p->number ? p->name : "???" ;
}
diff --git a/src/libstddjb/sig_number.c b/src/libstddjb/sig_number.c
index a588abd..d234185 100644
--- a/src/libstddjb/sig_number.c
+++ b/src/libstddjb/sig_number.c
@@ -1,12 +1,13 @@
/* ISC license. */
#include <strings.h>
+
#include <skalibs/sig.h>
#include "sig-internal.h"
int sig_number (char const *name)
{
- sigtable_t const *p = skalibs_sigtable ;
+ sigtable const *p = skalibs_sigtable ;
for (; p->name ; p++) if (!strcasecmp(name, p->name)) break ;
return p->number ;
}
diff --git a/src/libstddjb/sig_pause.c b/src/libstddjb/sig_pause.c
deleted file mode 100644
index 7de8ff5..0000000
--- a/src/libstddjb/sig_pause.c
+++ /dev/null
@@ -1,11 +0,0 @@
-/* ISC license. */
-
-#include <signal.h>
-#include <skalibs/sig.h>
-
-void sig_pause (void)
-{
- sigset_t ss ;
- sigemptyset(&ss) ;
- sigsuspend(&ss) ;
-}
diff --git a/src/libstddjb/sig_push.c b/src/libstddjb/sig_push.c
deleted file mode 100644
index 96e5fb2..0000000
--- a/src/libstddjb/sig_push.c
+++ /dev/null
@@ -1,11 +0,0 @@
-/* ISC license. */
-
-/* MT-unsafe */
-
-#include <skalibs/sig.h>
-
-int sig_push (int sig, skasighandler_t_ref f)
-{
- struct skasigaction ssa = { f, SKASA_MASKALL | SKASA_NOCLDSTOP } ;
- return sig_pusha(sig, &ssa) ;
-}
diff --git a/src/libstddjb/sig_restoreto.c b/src/libstddjb/sig_restoreto.c
index 580ba32..1a9250e 100644
--- a/src/libstddjb/sig_restoreto.c
+++ b/src/libstddjb/sig_restoreto.c
@@ -3,12 +3,13 @@
/* MT-unsafe */
#include <signal.h>
+
#include <skalibs/sig.h>
void sig_restoreto (sigset_t const *set, unsigned int n)
{
unsigned int i = 1 ;
- for (; i <= n ; i++)
+ for (; i < n ; i++)
{
int h = sigismember(set, i) ;
if (h < 0) continue ;
diff --git a/src/libstddjb/sig_shield.c b/src/libstddjb/sig_shield.c
deleted file mode 100644
index ee5d9a9..0000000
--- a/src/libstddjb/sig_shield.c
+++ /dev/null
@@ -1,17 +0,0 @@
-/* ISC license. */
-
-#include <signal.h>
-#include <skalibs/sig.h>
-
-void sig_shield (void)
-{
- sigset_t ss ;
- sigemptyset(&ss) ;
- sigaddset(&ss, SIGTERM) ;
- sigaddset(&ss, SIGQUIT) ;
- sigaddset(&ss, SIGABRT) ;
- sigaddset(&ss, SIGINT) ;
- sigaddset(&ss, SIGPIPE) ;
- sigaddset(&ss, SIGHUP) ;
- sigprocmask(SIG_BLOCK, &ss, 0) ;
-}
diff --git a/src/libstddjb/sig_stack.c b/src/libstddjb/sig_stack.c
deleted file mode 100644
index 88c78ec..0000000
--- a/src/libstddjb/sig_stack.c
+++ /dev/null
@@ -1,28 +0,0 @@
-/* ISC license. */
-
-#include <skalibs/nonposix.h>
-#include <errno.h>
-#include <signal.h>
-#include <skalibs/sig.h>
-#include <skalibs/nsig.h>
-
-static struct skasigaction skasigstack[SKALIBS_NSIG-1][SIGSTACKSIZE] ;
-static unsigned int sigsp[SKALIBS_NSIG-1] ;
-
-int sig_pusha (int sig, struct skasigaction const *ssa)
-{
- if ((sig <= 0) || (sig >= SKALIBS_NSIG)) return (errno = EINVAL, -1) ;
- if (sigsp[sig-1] >= SIGSTACKSIZE) return (errno = ENOBUFS, -1) ;
- if (skasigaction(sig, ssa, &skasigstack[sig-1][sigsp[sig-1]]) == -1)
- return -1 ;
- return ++sigsp[sig-1] ;
-}
-
-int sig_pop (int sig)
-{
- if ((sig <= 0) || (sig >= SKALIBS_NSIG)) return (errno = EINVAL, -1) ;
- if (!sigsp[sig-1]) return (errno = EFAULT, -1);
- if (skasigaction(sig, &skasigstack[sig-1][sigsp[sig-1]-1], 0) == -1)
- return -1 ;
- return --sigsp[sig-1] ;
-}
diff --git a/src/libstddjb/sig_table.c b/src/libstddjb/sig_table.c
index d097cb5..9858695 100644
--- a/src/libstddjb/sig_table.c
+++ b/src/libstddjb/sig_table.c
@@ -1,9 +1,10 @@
/* ISC license. */
#include <signal.h>
+
#include "sig-internal.h"
-sigtable_t const skalibs_sigtable[] =
+sigtable const skalibs_sigtable[] =
{
{ SIGABRT, "ABRT" },
{ SIGALRM, "ALRM" },
diff --git a/src/libstddjb/sig_unblock.c b/src/libstddjb/sig_unblock.c
index 26d5c1b..9a15175 100644
--- a/src/libstddjb/sig_unblock.c
+++ b/src/libstddjb/sig_unblock.c
@@ -1,6 +1,7 @@
/* ISC license. */
#include <signal.h>
+
#include <skalibs/sig.h>
void sig_unblock (int sig)
diff --git a/src/libstddjb/sig_unshield.c b/src/libstddjb/sig_unshield.c
deleted file mode 100644
index 24918b4..0000000
--- a/src/libstddjb/sig_unshield.c
+++ /dev/null
@@ -1,17 +0,0 @@
-/* ISC license. */
-
-#include <signal.h>
-#include <skalibs/sig.h>
-
-void sig_unshield (void)
-{
- sigset_t ss ;
- sigemptyset(&ss) ;
- sigaddset(&ss, SIGTERM) ;
- sigaddset(&ss, SIGQUIT) ;
- sigaddset(&ss, SIGABRT) ;
- sigaddset(&ss, SIGINT) ;
- sigaddset(&ss, SIGPIPE) ;
- sigaddset(&ss, SIGHUP) ;
- sigprocmask(SIG_UNBLOCK, &ss, 0) ;
-}
diff --git a/src/libstddjb/skasig_dfl.c b/src/libstddjb/skasig_dfl.c
deleted file mode 100644
index ca97b4f..0000000
--- a/src/libstddjb/skasig_dfl.c
+++ /dev/null
@@ -1,7 +0,0 @@
-/* ISC license. */
-
-#include <signal.h>
-#include <skalibs/sig.h>
-
-struct skasigaction const SKASIG_DFL = { SIG_DFL, 0 } ;
-struct skasigaction const SKASIG_IGN = { SIG_IGN, 0 } ;
diff --git a/src/libstddjb/skasigaction.c b/src/libstddjb/skasigaction.c
deleted file mode 100644
index e86cc0c..0000000
--- a/src/libstddjb/skasigaction.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/* ISC license. */
-
-#include <skalibs/config.h>
-#include <signal.h>
-#include <skalibs/sig.h>
-
-int skasigaction (int sig, struct skasigaction const *new, struct skasigaction *old)
-{
- struct sigaction sanew, saold ;
- if (((new->flags & SKASA_MASKALL) ? sigfillset(&sanew.sa_mask) : sigemptyset(&sanew.sa_mask)) == -1) return -1 ;
- sanew.sa_handler = new->handler ;
- sanew.sa_flags = (new->flags & SKASA_NOCLDSTOP) ? SA_NOCLDSTOP : 0 ;
-#ifndef SKALIBS_FLAG_PREFERSELECT
- sanew.sa_flags |= SA_RESTART ;
-#endif
- if (sigaction(sig, &sanew, &saold) < 0) return -1 ;
- if (old)
- {
- int r = sigismember(&saold.sa_mask, (sig == SIGTERM) ? SIGPIPE : SIGTERM) ;
- if (r < 0) return -1 ;
- old->flags = 0 ;
- if (r) old->flags |= SKASA_MASKALL ;
- if (saold.sa_flags & SA_NOCLDSTOP) old->flags |= SKASA_NOCLDSTOP ;
- old->handler = saold.sa_handler ;
- }
- return 0 ;
-}
diff --git a/src/libstddjb/socket_deadlineconnstamp4.c b/src/libstddjb/socket_deadlineconnstamp4.c
index 5691932..da6aa22 100644
--- a/src/libstddjb/socket_deadlineconnstamp4.c
+++ b/src/libstddjb/socket_deadlineconnstamp4.c
@@ -4,7 +4,7 @@
#include <skalibs/error.h>
#include <skalibs/socket.h>
-int socket_deadlineconnstamp (int s, char const *ip, uint16_t port, tain_t const *deadline, tain_t *stamp)
+int socket_deadlineconnstamp (int s, char const *ip, uint16_t port, tain const *deadline, tain *stamp)
{
int e = errno ;
if (socket_connect4(s, ip, port) >= 0) return 1 ;
diff --git a/src/libstddjb/socket_deadlineconnstamp46.c b/src/libstddjb/socket_deadlineconnstamp46.c
index ac1160c..04d1a51 100644
--- a/src/libstddjb/socket_deadlineconnstamp46.c
+++ b/src/libstddjb/socket_deadlineconnstamp46.c
@@ -1,11 +1,12 @@
/* ISC license. */
#include <errno.h>
+
#include <skalibs/error.h>
#include <skalibs/socket.h>
#include <skalibs/ip46.h>
-int socket_deadlineconnstamp46 (int s, ip46_t const *i, uint16_t port, tain_t const *deadline, tain_t *stamp)
+int socket_deadlineconnstamp46 (int s, ip46 const *i, uint16_t port, tain const *deadline, tain *stamp)
{
int e = errno ;
if (socket_connect46(s, i, port) >= 0) return 1 ;
diff --git a/src/libstddjb/socket_deadlineconnstamp4_u32.c b/src/libstddjb/socket_deadlineconnstamp4_u32.c
index 655c379..5287100 100644
--- a/src/libstddjb/socket_deadlineconnstamp4_u32.c
+++ b/src/libstddjb/socket_deadlineconnstamp4_u32.c
@@ -3,7 +3,7 @@
#include <skalibs/uint32.h>
#include <skalibs/socket.h>
-int socket_deadlineconnstamp4_u32 (int s, uint32_t ip, uint16_t port, tain_t const *deadline, tain_t *stamp)
+int socket_deadlineconnstamp4_u32 (int s, uint32_t ip, uint16_t port, tain const *deadline, tain *stamp)
{
char pack[4] ;
uint32_pack_big(pack, ip) ;
diff --git a/src/libstddjb/socket_deadlineconnstamp6.c b/src/libstddjb/socket_deadlineconnstamp6.c
index d03fabe..7e63b52 100644
--- a/src/libstddjb/socket_deadlineconnstamp6.c
+++ b/src/libstddjb/socket_deadlineconnstamp6.c
@@ -4,7 +4,7 @@
#include <skalibs/error.h>
#include <skalibs/socket.h>
-int socket_deadlineconnstamp6 (int s, char const *ip, uint16_t port, tain_t const *deadline, tain_t *stamp)
+int socket_deadlineconnstamp6 (int s, char const *ip, uint16_t port, tain const *deadline, tain *stamp)
{
int e = errno ;
if (socket_connect6(s, ip, port) >= 0) return 1 ;
diff --git a/src/libstddjb/socket_ioloop.c b/src/libstddjb/socket_ioloop.c
index 0a61a8c..aa674b0 100644
--- a/src/libstddjb/socket_ioloop.c
+++ b/src/libstddjb/socket_ioloop.c
@@ -5,7 +5,7 @@
#include <skalibs/iopause.h>
#include <skalibs/socket.h>
-ssize_t socket_ioloop (int s, char *buf, size_t len, char *ip, uint16_t *port, socket_io_func_t_ref f, int w, tain_t const *deadline, tain_t *stamp)
+ssize_t socket_ioloop (int s, char *buf, size_t len, char *ip, uint16_t *port, socket_io_func_ref f, int w, tain const *deadline, tain *stamp)
{
iopause_fd x = { .fd = s, .events = w ? IOPAUSE_WRITE : IOPAUSE_READ, .revents = 0 } ;
for (;;)
diff --git a/src/libstddjb/socket_local46.c b/src/libstddjb/socket_local46.c
index e913634..aaf1da0 100644
--- a/src/libstddjb/socket_local46.c
+++ b/src/libstddjb/socket_local46.c
@@ -1,16 +1,18 @@
/* ISC license. */
#include <skalibs/nonposix.h>
+
#include <errno.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <string.h>
+
#include <skalibs/uint16.h>
#include <skalibs/ip46.h>
#ifdef SKALIBS_IPV6_ENABLED
-int socket_local46 (int s, ip46_t *ip, uint16_t *port)
+int socket_local46 (int s, ip46 *ip, uint16_t *port)
{
struct sockaddr_storage sa ;
socklen_t dummy = sizeof sa ;
diff --git a/src/libstddjb/socket_remote46.c b/src/libstddjb/socket_remote46.c
index 5681ce3..d0f1548 100644
--- a/src/libstddjb/socket_remote46.c
+++ b/src/libstddjb/socket_remote46.c
@@ -1,16 +1,18 @@
/* ISC license. */
#include <skalibs/nonposix.h>
+
#include <errno.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <string.h>
+
#include <skalibs/uint16.h>
#include <skalibs/ip46.h>
#ifdef SKALIBS_IPV6_ENABLED
-int socket_remote46 (int s, ip46_t *ip, uint16_t *port)
+int socket_remote46 (int s, ip46 *ip, uint16_t *port)
{
struct sockaddr_storage sa ;
socklen_t dummy = sizeof sa ;
diff --git a/src/libstddjb/socket_timeoutconn.c b/src/libstddjb/socket_timeoutconn.c
index 5f9f0cd..854a635 100644
--- a/src/libstddjb/socket_timeoutconn.c
+++ b/src/libstddjb/socket_timeoutconn.c
@@ -5,7 +5,7 @@
int socket_timeoutconn (int s, char const *ip, uint16_t port, unsigned int timeout)
{
- tain_t stamp, deadline ;
+ tain stamp, deadline ;
tain_now(&stamp) ;
tain_addsec(&deadline, &stamp, timeout) ;
return socket_deadlineconnstamp4(s, ip, port, &deadline, &stamp) ;
diff --git a/src/libstddjb/socket_waitconn.c b/src/libstddjb/socket_waitconn.c
index 35eb526..a69fed8 100644
--- a/src/libstddjb/socket_waitconn.c
+++ b/src/libstddjb/socket_waitconn.c
@@ -5,7 +5,7 @@
#include <skalibs/iopause.h>
#include <skalibs/socket.h>
-int socket_waitconn (int s, tain_t const *deadline, tain_t *stamp)
+int socket_waitconn (int s, tain const *deadline, tain *stamp)
{
iopause_fd x = { s, IOPAUSE_WRITE, 0 } ;
for (;;)
diff --git a/src/libstddjb/stamp.c b/src/libstddjb/stamp.c
index 65becc6..7504bfe 100644
--- a/src/libstddjb/stamp.c
+++ b/src/libstddjb/stamp.c
@@ -4,4 +4,4 @@
#include <skalibs/tai.h>
-tain_t STAMP = TAIN_EPOCH ;
+tain STAMP = TAIN_EPOCH ;
diff --git a/src/libstddjb/subgetopt.c b/src/libstddjb/subgetopt.c
index 67cdfa1..940eb6a 100644
--- a/src/libstddjb/subgetopt.c
+++ b/src/libstddjb/subgetopt.c
@@ -3,7 +3,7 @@
#undef SUBGETOPT_SHORT
#include <skalibs/sgetopt.h>
-int subgetopt_r (int argc, char const *const *argv, char const *opts, subgetopt_t *o)
+int subgetopt_r (int argc, char const *const *argv, char const *opts, subgetopt *o)
{
o->arg = 0 ;
if ((o->ind >= argc) || !argv[o->ind]) return -1 ;
diff --git a/src/libstddjb/subgetopt_here.c b/src/libstddjb/subgetopt_here.c
index e0be29a..7d69248 100644
--- a/src/libstddjb/subgetopt_here.c
+++ b/src/libstddjb/subgetopt_here.c
@@ -4,4 +4,4 @@
#include <skalibs/sgetopt.h>
-subgetopt_t subgetopt_here = SUBGETOPT_ZERO ;
+subgetopt subgetopt_here = SUBGETOPT_ZERO ;
diff --git a/src/libstddjb/sysclock_from_localtmn.c b/src/libstddjb/sysclock_from_localtmn.c
index 2b9dbb9..5dcbc5a 100644
--- a/src/libstddjb/sysclock_from_localtmn.c
+++ b/src/libstddjb/sysclock_from_localtmn.c
@@ -2,7 +2,7 @@
#include <skalibs/djbtime.h>
-int sysclock_from_localtmn (tain_t *a, localtmn_t const *l)
+int sysclock_from_localtmn (tain *a, localtmn const *l)
{
if (!sysclock_from_localtm(&a->sec.x, &l->tm)) return 0 ;
a->nano = l->nano ;
diff --git a/src/libstddjb/sysclock_from_ltm64.c b/src/libstddjb/sysclock_from_ltm64.c
index 8e951d5..a1f5444 100644
--- a/src/libstddjb/sysclock_from_ltm64.c
+++ b/src/libstddjb/sysclock_from_ltm64.c
@@ -8,7 +8,7 @@
int sysclock_from_ltm64 (uint64_t *u)
{
- tai_t t ;
+ tai t ;
if (!tai_from_ltm64(&t, *u)) return 0 ;
*u = t.x - 10U ;
return 1 ;
diff --git a/src/libstddjb/sysclock_from_tai.c b/src/libstddjb/sysclock_from_tai.c
index 003e962..f08ad71 100644
--- a/src/libstddjb/sysclock_from_tai.c
+++ b/src/libstddjb/sysclock_from_tai.c
@@ -6,7 +6,7 @@
#ifdef SKALIBS_FLAG_CLOCKISTAI
-int sysclock_from_tai (uint64_t *u, tai_t const *t)
+int sysclock_from_tai (uint64_t *u, tai const *t)
{
if (t->x < 10U) return (errno = EINVAL, 0) ;
*u = t->x - 10U ;
@@ -17,7 +17,7 @@ int sysclock_from_tai (uint64_t *u, tai_t const *t)
#include <skalibs/djbtime.h>
-int sysclock_from_tai (uint64_t *u, tai_t const *t)
+int sysclock_from_tai (uint64_t *u, tai const *t)
{
return utc_from_tai(u, t) ;
}
diff --git a/src/libstddjb/sysclock_from_tain.c b/src/libstddjb/sysclock_from_tain.c
index 8a2bd12..c53eaee 100644
--- a/src/libstddjb/sysclock_from_tain.c
+++ b/src/libstddjb/sysclock_from_tain.c
@@ -2,7 +2,7 @@
#include <skalibs/tai.h>
-int sysclock_from_tain (tain_t *u, tain_t const *t)
+int sysclock_from_tain (tain *u, tain const *t)
{
if (!sysclock_from_tai(&u->sec.x, &t->sec)) return 0 ;
u->nano = t->nano ;
diff --git a/src/libstddjb/sysclock_from_utc.c b/src/libstddjb/sysclock_from_utc.c
index 49fe558..c3f8df1 100644
--- a/src/libstddjb/sysclock_from_utc.c
+++ b/src/libstddjb/sysclock_from_utc.c
@@ -9,7 +9,7 @@
int sysclock_from_utc (uint64_t *u)
{
- tai_t t ;
+ tai t ;
if (!tai_from_utc(&t, *u)) return 0 ;
if (t.x < 10) return (errno = EINVAL, 0) ;
*u = t.x - 10 ;
diff --git a/src/libstddjb/sysclock_get.c b/src/libstddjb/sysclock_get.c
index 6c5041d..1325903 100644
--- a/src/libstddjb/sysclock_get.c
+++ b/src/libstddjb/sysclock_get.c
@@ -7,9 +7,9 @@
#include <time.h>
-int sysclock_get (tain_t *a)
+int sysclock_get (tain *a)
{
- tain_t aa ;
+ tain aa ;
struct timespec now ;
if (clock_gettime(CLOCK_REALTIME, &now) < 0) return 0 ;
if (!tain_from_timespec(&aa, &now)) return 0 ;
@@ -21,9 +21,9 @@ int sysclock_get (tain_t *a)
#include <sys/time.h>
-int sysclock_get (tain_t *a)
+int sysclock_get (tain *a)
{
- tain_t aa ;
+ tain aa ;
struct timeval now ;
if (gettimeofday(&now, 0) < 0) return 0 ;
if (!tain_from_timeval(&aa, &now)) return 0 ;
diff --git a/src/libstddjb/sysclock_set.c b/src/libstddjb/sysclock_set.c
index 76917af..de638db 100644
--- a/src/libstddjb/sysclock_set.c
+++ b/src/libstddjb/sysclock_set.c
@@ -9,10 +9,10 @@
#include <time.h>
#include <skalibs/tai.h>
-int sysclock_set (tain_t const *a)
+int sysclock_set (tain const *a)
{
struct timespec now ;
- tain_t aa ;
+ tain aa ;
tain_add(&aa, a, &tain_nano500) ;
if (!timespec_from_tain(&now, &aa)) return 0 ;
if (clock_settime(CLOCK_REALTIME, &now) < 0) return 0 ;
@@ -26,10 +26,10 @@ int sysclock_set (tain_t const *a)
#include <sys/time.h>
#include <skalibs/tai.h>
-int sysclock_set (tain_t const *a)
+int sysclock_set (tain const *a)
{
struct timeval now ;
- tain_t aa ;
+ tain aa ;
tain_add(&aa, a, &tain_nano500) ;
if (!timeval_from_tain(&now, &aa)) return 0 ;
if (settimeofday(&now, 0) < 0) return 0 ;
diff --git a/src/libstddjb/tai_add.c b/src/libstddjb/tai_add.c
index 5a3d47a..8f13c26 100644
--- a/src/libstddjb/tai_add.c
+++ b/src/libstddjb/tai_add.c
@@ -2,7 +2,7 @@
#include <skalibs/tai.h>
-int tai_add (tai_t *t, tai_t const *u, tai_t const *v)
+int tai_add (tai *t, tai const *u, tai const *v)
{
t->x = u->x + v->x ;
return 1 ;
diff --git a/src/libstddjb/tai_from_localtm.c b/src/libstddjb/tai_from_localtm.c
index b2dfbc6..d2dc276 100644
--- a/src/libstddjb/tai_from_localtm.c
+++ b/src/libstddjb/tai_from_localtm.c
@@ -4,7 +4,7 @@
#include <skalibs/uint64.h>
#include <skalibs/djbtime.h>
-int tai_from_localtm (tai_t *t, struct tm const *l)
+int tai_from_localtm (tai *t, struct tm const *l)
{
uint64_t u ;
if (!ltm64_from_localtm(&u, l)) return 0 ;
diff --git a/src/libstddjb/tai_from_ltm64.c b/src/libstddjb/tai_from_ltm64.c
index be3a11b..c59a9e3 100644
--- a/src/libstddjb/tai_from_ltm64.c
+++ b/src/libstddjb/tai_from_ltm64.c
@@ -3,7 +3,7 @@
#include <skalibs/djbtime.h>
#include "djbtime-internal.h"
-int tai_from_ltm64 (tai_t *t, uint64_t u)
+int tai_from_ltm64 (tai *t, uint64_t u)
{
switch (skalibs_tzisright())
{
diff --git a/src/libstddjb/tai_from_sysclock.c b/src/libstddjb/tai_from_sysclock.c
index b813108..006c859 100644
--- a/src/libstddjb/tai_from_sysclock.c
+++ b/src/libstddjb/tai_from_sysclock.c
@@ -6,7 +6,7 @@
#ifdef SKALIBS_FLAG_CLOCKISTAI
-int tai_from_sysclock (tai_t *t, uint64_t u)
+int tai_from_sysclock (tai *t, uint64_t u)
{
return tai_u64(t, u + 10U) ;
}
@@ -15,7 +15,7 @@ int tai_from_sysclock (tai_t *t, uint64_t u)
#include <skalibs/djbtime.h>
-int tai_from_sysclock (tai_t *t, uint64_t u)
+int tai_from_sysclock (tai *t, uint64_t u)
{
return tai_from_utc(t, u) ;
}
diff --git a/src/libstddjb/tai_from_utc.c b/src/libstddjb/tai_from_utc.c
index f1cea31..5eb6308 100644
--- a/src/libstddjb/tai_from_utc.c
+++ b/src/libstddjb/tai_from_utc.c
@@ -4,7 +4,7 @@
#include <skalibs/djbtime.h>
#include "djbtime-internal.h"
-int tai_from_utc (tai_t *t, uint64_t u)
+int tai_from_utc (tai *t, uint64_t u)
{
leapsecs_add(&u, 0) ;
return tai_u64(t, u + 10) ;
diff --git a/src/libstddjb/tai_now.c b/src/libstddjb/tai_now.c
index a9710d4..ca67bb7 100644
--- a/src/libstddjb/tai_now.c
+++ b/src/libstddjb/tai_now.c
@@ -5,7 +5,7 @@
#include <time.h>
#include <skalibs/tai.h>
-int tai_now (tai_t *t)
+int tai_now (tai *t)
{
time_t u = time(0) ;
if (u == (time_t)-1) return 0 ;
diff --git a/src/libstddjb/tai_pack.c b/src/libstddjb/tai_pack.c
index f81afe2..94ee363 100644
--- a/src/libstddjb/tai_pack.c
+++ b/src/libstddjb/tai_pack.c
@@ -3,7 +3,7 @@
#include <skalibs/uint64.h>
#include <skalibs/tai.h>
-void tai_pack (char *s, tai_t const *t)
+void tai_pack (char *s, tai const *t)
{
uint64_pack_big(s, tai_sec(t)) ;
}
diff --git a/src/libstddjb/tai_pack_little.c b/src/libstddjb/tai_pack_little.c
index 41e552a..e47286e 100644
--- a/src/libstddjb/tai_pack_little.c
+++ b/src/libstddjb/tai_pack_little.c
@@ -3,7 +3,7 @@
#include <skalibs/uint64.h>
#include <skalibs/tai.h>
-void tai_pack_little (char *s, tai_t const *t)
+void tai_pack_little (char *s, tai const *t)
{
uint64_pack(s, tai_sec(t)) ;
}
diff --git a/src/libstddjb/tai_sub.c b/src/libstddjb/tai_sub.c
index b85f1f2..c61c736 100644
--- a/src/libstddjb/tai_sub.c
+++ b/src/libstddjb/tai_sub.c
@@ -2,7 +2,7 @@
#include <skalibs/tai.h>
-int tai_sub (tai_t *t, tai_t const *u, tai_t const *v)
+int tai_sub (tai *t, tai const *u, tai const *v)
{
t->x = u->x - v->x ;
return 1 ;
diff --git a/src/libstddjb/tai_u64.c b/src/libstddjb/tai_u64.c
index 1d7eabe..55d5b40 100644
--- a/src/libstddjb/tai_u64.c
+++ b/src/libstddjb/tai_u64.c
@@ -5,7 +5,7 @@
#include <skalibs/uint64.h>
#include <skalibs/tai.h>
-int tai_u64 (tai_t *t, uint64_t u)
+int tai_u64 (tai *t, uint64_t u)
{
if (u & ((uint64_t)1 << 63)) return (errno = EOVERFLOW, 0) ;
t->x = u ;
diff --git a/src/libstddjb/tai_unpack.c b/src/libstddjb/tai_unpack.c
index a733c4a..36c2e35 100644
--- a/src/libstddjb/tai_unpack.c
+++ b/src/libstddjb/tai_unpack.c
@@ -3,7 +3,7 @@
#include <skalibs/uint64.h>
#include <skalibs/tai.h>
-void tai_unpack (char const *s, tai_t *t)
+void tai_unpack (char const *s, tai *t)
{
uint64_unpack_big(s, &t->x) ;
}
diff --git a/src/libstddjb/tai_unpack_little.c b/src/libstddjb/tai_unpack_little.c
index 71804a5..b2bafbf 100644
--- a/src/libstddjb/tai_unpack_little.c
+++ b/src/libstddjb/tai_unpack_little.c
@@ -3,7 +3,7 @@
#include <skalibs/uint64.h>
#include <skalibs/tai.h>
-void tai_unpack_little (char const *s, tai_t *t)
+void tai_unpack_little (char const *s, tai *t)
{
uint64_unpack(s, &t->x) ;
}
diff --git a/src/libstddjb/tain_add.c b/src/libstddjb/tain_add.c
index b119270..2c0f98d 100644
--- a/src/libstddjb/tain_add.c
+++ b/src/libstddjb/tain_add.c
@@ -2,7 +2,7 @@
#include <skalibs/tai.h>
-int tain_add (tain_t *t, tain_t const *u, tain_t const *v)
+int tain_add (tain *t, tain const *u, tain const *v)
{
t->sec.x = u->sec.x + v->sec.x ;
t->nano = u->nano + v->nano ;
diff --git a/src/libstddjb/tain_addsec.c b/src/libstddjb/tain_addsec.c
index cd22b18..c580444 100644
--- a/src/libstddjb/tain_addsec.c
+++ b/src/libstddjb/tain_addsec.c
@@ -3,16 +3,16 @@
#include <skalibs/uint64.h>
#include <skalibs/tai.h>
-int tain_addsec (tain_t *b, tain_t const *a, int c)
+int tain_addsec (tain *b, tain const *a, int c)
{
if (c >= 0)
{
- tai_t t = { .x = (uint64_t)c } ;
+ tai t = { .x = (uint64_t)c } ;
tai_add(&b->sec, &a->sec, &t) ;
}
else
{
- tai_t t = { .x = (uint64_t)-c } ;
+ tai t = { .x = (uint64_t)-c } ;
tai_sub(&b->sec, &a->sec, &t) ;
}
b->nano = a->nano ;
diff --git a/src/libstddjb/tain_approx.c b/src/libstddjb/tain_approx.c
index d749cdf..c1f6023 100644
--- a/src/libstddjb/tain_approx.c
+++ b/src/libstddjb/tain_approx.c
@@ -2,7 +2,7 @@
#include <skalibs/tai.h>
-double tain_approx (tain_t const *t)
+double tain_approx (tain const *t)
{
return tai_approx(&t->sec) + tain_frac(t) ;
}
diff --git a/src/libstddjb/tain_fmt.c b/src/libstddjb/tain_fmt.c
index 54f0e6a..9b98b59 100644
--- a/src/libstddjb/tain_fmt.c
+++ b/src/libstddjb/tain_fmt.c
@@ -3,7 +3,7 @@
#include <skalibs/fmtscan.h>
#include <skalibs/tai.h>
-size_t tain_fmt (char *s, tain_t const *a)
+size_t tain_fmt (char *s, tain const *a)
{
char pack[TAIN_PACK] ;
tain_pack(pack, a) ;
diff --git a/src/libstddjb/tain_frac.c b/src/libstddjb/tain_frac.c
index 45ee3b4..ff6bbd3 100644
--- a/src/libstddjb/tain_frac.c
+++ b/src/libstddjb/tain_frac.c
@@ -2,7 +2,7 @@
#include <skalibs/tai.h>
-double tain_frac (tain_t const *t)
+double tain_frac (tain const *t)
{
return t->nano * 0.000000001 ;
}
diff --git a/src/libstddjb/tain_from_localtmn.c b/src/libstddjb/tain_from_localtmn.c
index 3a71889..a9a669f 100644
--- a/src/libstddjb/tain_from_localtmn.c
+++ b/src/libstddjb/tain_from_localtmn.c
@@ -2,9 +2,9 @@
#include <skalibs/djbtime.h>
-int tain_from_localtmn (tain_t *a, localtmn_t const *l)
+int tain_from_localtmn (tain *a, localtmn const *l)
{
- tai_t t ;
+ tai t ;
if (!tai_from_localtm(&t, &l->tm)) return 0 ;
a->sec = t ;
a->nano = l->nano ;
diff --git a/src/libstddjb/tain_from_millisecs.c b/src/libstddjb/tain_from_millisecs.c
index e6bfca4..8978aa3 100644
--- a/src/libstddjb/tain_from_millisecs.c
+++ b/src/libstddjb/tain_from_millisecs.c
@@ -3,7 +3,7 @@
#include <errno.h>
#include <skalibs/tai.h>
-int tain_from_millisecs (tain_t *a, int millisecs)
+int tain_from_millisecs (tain *a, int millisecs)
{
if (millisecs < 0) return (errno = EINVAL, 0) ;
a->sec.x = millisecs / 1000 ;
diff --git a/src/libstddjb/tain_from_ntp.c b/src/libstddjb/tain_from_ntp.c
index 68fa699..d6e3248 100644
--- a/src/libstddjb/tain_from_ntp.c
+++ b/src/libstddjb/tain_from_ntp.c
@@ -4,9 +4,9 @@
#include <skalibs/tai.h>
#include <skalibs/djbtime.h>
-int tain_from_ntp (tain_t *a, uint64_t u)
+int tain_from_ntp (tain *a, uint64_t u)
{
- tai_t secs = { .x = u >> 32 } ;
+ tai secs = { .x = u >> 32 } ;
if (secs.x <= 0x7FFFFFFFUL) secs.x |= ((uint64_t)1 << 32) ;
secs.x += TAI_MAGIC ;
secs.x -= NTP_OFFSET ;
diff --git a/src/libstddjb/tain_from_sysclock.c b/src/libstddjb/tain_from_sysclock.c
index 468c248..4328564 100644
--- a/src/libstddjb/tain_from_sysclock.c
+++ b/src/libstddjb/tain_from_sysclock.c
@@ -2,7 +2,7 @@
#include <skalibs/tai.h>
-int tain_from_sysclock (tain_t *a, tain_t const *u)
+int tain_from_sysclock (tain *a, tain const *u)
{
if (!tai_from_sysclock(&a->sec, u->sec.x)) return 0 ;
a->nano = u->nano ;
diff --git a/src/libstddjb/tain_from_timespec.c b/src/libstddjb/tain_from_timespec.c
index e471b95..174f055 100644
--- a/src/libstddjb/tain_from_timespec.c
+++ b/src/libstddjb/tain_from_timespec.c
@@ -3,7 +3,7 @@
#include <time.h>
#include <skalibs/tai.h>
-int tain_from_timespec (tain_t *t, struct timespec const *ts)
+int tain_from_timespec (tain *t, struct timespec const *ts)
{
if (!tai_from_time(&t->sec, ts->tv_sec)) return 0 ;
t->nano = ts->tv_nsec ;
diff --git a/src/libstddjb/tain_from_timespec_sysclock.c b/src/libstddjb/tain_from_timespec_sysclock.c
index b79cda8..2dff04b 100644
--- a/src/libstddjb/tain_from_timespec_sysclock.c
+++ b/src/libstddjb/tain_from_timespec_sysclock.c
@@ -3,7 +3,7 @@
#include <time.h>
#include <skalibs/tai.h>
-int tain_from_timespec_sysclock (tain_t *t, struct timespec const *ts)
+int tain_from_timespec_sysclock (tain *t, struct timespec const *ts)
{
if (!tai_from_time_sysclock(&t->sec, ts->tv_sec)) return 0 ;
t->nano = ts->tv_nsec ;
diff --git a/src/libstddjb/tain_from_timeval.c b/src/libstddjb/tain_from_timeval.c
index 0536070..6f2616d 100644
--- a/src/libstddjb/tain_from_timeval.c
+++ b/src/libstddjb/tain_from_timeval.c
@@ -3,7 +3,7 @@
#include <sys/time.h>
#include <skalibs/tai.h>
-int tain_from_timeval (tain_t *t, struct timeval const *tv)
+int tain_from_timeval (tain *t, struct timeval const *tv)
{
if (!tai_from_time(&t->sec, tv->tv_sec)) return 0 ;
t->nano = 1000 * tv->tv_usec ;
diff --git a/src/libstddjb/tain_from_timeval_sysclock.c b/src/libstddjb/tain_from_timeval_sysclock.c
index 625c4cd..2f50418 100644
--- a/src/libstddjb/tain_from_timeval_sysclock.c
+++ b/src/libstddjb/tain_from_timeval_sysclock.c
@@ -3,7 +3,7 @@
#include <sys/time.h>
#include <skalibs/tai.h>
-int tain_from_timeval_sysclock (tain_t *t, struct timeval const *tv)
+int tain_from_timeval_sysclock (tain *t, struct timeval const *tv)
{
if (!tai_from_time_sysclock(&t->sec, tv->tv_sec)) return 0 ;
t->nano = 1000 * tv->tv_usec ;
diff --git a/src/libstddjb/tain_half.c b/src/libstddjb/tain_half.c
index 4b8f404..8d3e199 100644
--- a/src/libstddjb/tain_half.c
+++ b/src/libstddjb/tain_half.c
@@ -2,7 +2,7 @@
#include <skalibs/tai.h>
-void tain_half (tain_t *t, tain_t const *u)
+void tain_half (tain *t, tain const *u)
{
t->nano = u->nano >> 1 ;
if (u->sec.x & 1) t->nano += 500000000U ;
diff --git a/src/libstddjb/tain_infinite_relative.c b/src/libstddjb/tain_infinite_relative.c
index 89d750c..7640588 100644
--- a/src/libstddjb/tain_infinite_relative.c
+++ b/src/libstddjb/tain_infinite_relative.c
@@ -2,4 +2,4 @@
#include <skalibs/tai.h>
-tain_t const tain_infinite_relative = TAIN_INFINITE_RELATIVE ;
+tain const tain_infinite_relative = TAIN_INFINITE_RELATIVE ;
diff --git a/src/libstddjb/tain_less.c b/src/libstddjb/tain_less.c
index e52c058..a316fe0 100644
--- a/src/libstddjb/tain_less.c
+++ b/src/libstddjb/tain_less.c
@@ -2,7 +2,7 @@
#include <skalibs/tai.h>
-int tain_less (tain_t const *t, tain_t const *u)
+int tain_less (tain const *t, tain const *u)
{
if (tai_sec(&t->sec) < tai_sec(&u->sec)) return 1 ;
if (tai_sec(&t->sec) > tai_sec(&u->sec)) return 0 ;
diff --git a/src/libstddjb/tain_nano500.c b/src/libstddjb/tain_nano500.c
index 70d86c5..22b0f9c 100644
--- a/src/libstddjb/tain_nano500.c
+++ b/src/libstddjb/tain_nano500.c
@@ -2,4 +2,4 @@
#include <skalibs/tai.h>
-tain_t const tain_nano500 = TAIN_NANO500 ;
+tain const tain_nano500 = TAIN_NANO500 ;
diff --git a/src/libstddjb/tain_now.c b/src/libstddjb/tain_now.c
index d6625d6..5e66fc7 100644
--- a/src/libstddjb/tain_now.c
+++ b/src/libstddjb/tain_now.c
@@ -4,4 +4,4 @@
#include <skalibs/tai.h>
-tain_clockread_func_t_ref tain_now = &tain_wallclock_read ;
+tain_clockread_func_ref tain_now = &tain_wallclock_read ;
diff --git a/src/libstddjb/tain_now_set_stopwatch.c b/src/libstddjb/tain_now_set_stopwatch.c
index a770141..fd31950 100644
--- a/src/libstddjb/tain_now_set_stopwatch.c
+++ b/src/libstddjb/tain_now_set_stopwatch.c
@@ -15,14 +15,14 @@
# define SKALIBS_STOPWATCH CLOCK_BOOTTIME
#endif
-static tain_t offset ;
+static tain offset ;
-static int tain_now_stopwatch (tain_t *now)
+static int tain_now_stopwatch (tain *now)
{
return tain_stopwatch_read(now, SKALIBS_STOPWATCH, &offset) ;
}
-int tain_now_set_stopwatch (tain_t *now)
+int tain_now_set_stopwatch (tain *now)
{
if (!tain_stopwatch_init(now, SKALIBS_STOPWATCH, &offset))
return tain_now_set_wallclock(now) ;
@@ -32,7 +32,7 @@ int tain_now_set_stopwatch (tain_t *now)
#else
-int tain_now_set_stopwatch (tain_t *now)
+int tain_now_set_stopwatch (tain *now)
{
return tain_now_set_wallclock(now) ;
}
diff --git a/src/libstddjb/tain_now_set_wallclock.c b/src/libstddjb/tain_now_set_wallclock.c
index 34a44cc..80c5fd6 100644
--- a/src/libstddjb/tain_now_set_wallclock.c
+++ b/src/libstddjb/tain_now_set_wallclock.c
@@ -4,7 +4,7 @@
#include <skalibs/tai.h>
-int tain_now_set_wallclock (tain_t *now)
+int tain_now_set_wallclock (tain *now)
{
tain_now = &tain_wallclock_read ;
return tain_wallclock_read(now) ;
diff --git a/src/libstddjb/tain_pack.c b/src/libstddjb/tain_pack.c
index cb1918a..da8a92f 100644
--- a/src/libstddjb/tain_pack.c
+++ b/src/libstddjb/tain_pack.c
@@ -3,7 +3,7 @@
#include <skalibs/uint32.h>
#include <skalibs/tai.h>
-void tain_pack (char *s, tain_t const *t)
+void tain_pack (char *s, tain const *t)
{
tai_pack(s, &t->sec) ;
uint32_pack_big(s+8, t->nano) ;
diff --git a/src/libstddjb/tain_pack_little.c b/src/libstddjb/tain_pack_little.c
index 170da28..b4c6bff 100644
--- a/src/libstddjb/tain_pack_little.c
+++ b/src/libstddjb/tain_pack_little.c
@@ -3,7 +3,7 @@
#include <skalibs/uint32.h>
#include <skalibs/tai.h>
-void tain_pack_little (char *s, tain_t const *t)
+void tain_pack_little (char *s, tain const *t)
{
uint32_pack(s, t->nano) ;
tai_pack_little(s+4, &t->sec) ;
diff --git a/src/libstddjb/tain_relative_from_timespec.c b/src/libstddjb/tain_relative_from_timespec.c
index 5f492ff..394785b 100644
--- a/src/libstddjb/tain_relative_from_timespec.c
+++ b/src/libstddjb/tain_relative_from_timespec.c
@@ -3,7 +3,7 @@
#include <time.h>
#include <skalibs/tai.h>
-int tain_relative_from_timespec (tain_t *a, struct timespec const *ts)
+int tain_relative_from_timespec (tain *a, struct timespec const *ts)
{
tai_relative_from_time(&a->sec, ts->tv_sec) ;
a->nano = ts->tv_nsec ;
diff --git a/src/libstddjb/tain_relative_from_timeval.c b/src/libstddjb/tain_relative_from_timeval.c
index eafb57a..6fa67e5 100644
--- a/src/libstddjb/tain_relative_from_timeval.c
+++ b/src/libstddjb/tain_relative_from_timeval.c
@@ -3,7 +3,7 @@
#include <sys/time.h>
#include <skalibs/tai.h>
-int tain_relative_from_timeval (tain_t *a, struct timeval const *tv)
+int tain_relative_from_timeval (tain *a, struct timeval const *tv)
{
tai_relative_from_time(&a->sec, tv->tv_sec) ;
a->nano = 1000 * tv->tv_usec ;
diff --git a/src/libstddjb/tain_scan.c b/src/libstddjb/tain_scan.c
index 2522726..fab0ba4 100644
--- a/src/libstddjb/tain_scan.c
+++ b/src/libstddjb/tain_scan.c
@@ -3,7 +3,7 @@
#include <skalibs/fmtscan.h>
#include <skalibs/tai.h>
-size_t tain_scan (char const *s, tain_t *a)
+size_t tain_scan (char const *s, tain *a)
{
char pack[TAIN_PACK] ;
size_t r = ucharn_scan(s, pack, TAIN_PACK) ;
diff --git a/src/libstddjb/tain_setnow.c b/src/libstddjb/tain_setnow.c
index a8b372f..a6ed337 100644
--- a/src/libstddjb/tain_setnow.c
+++ b/src/libstddjb/tain_setnow.c
@@ -4,9 +4,9 @@
#include <skalibs/tai.h>
-int tain_setnow (tain_t const *a)
+int tain_setnow (tain const *a)
{
- tain_t aa ;
+ tain aa ;
if (!sysclock_from_tai(&aa.sec.x, &a->sec)) return 0 ;
aa.nano = a->nano ;
return sysclock_set(&aa) ;
diff --git a/src/libstddjb/tain_stopwatch.c b/src/libstddjb/tain_stopwatch.c
index adcaace..a5f3ef7 100644
--- a/src/libstddjb/tain_stopwatch.c
+++ b/src/libstddjb/tain_stopwatch.c
@@ -7,9 +7,9 @@
#include <time.h>
-int tain_stopwatch_init (tain_t *now, clock_t cl, tain_t *offset)
+int tain_stopwatch_init (tain *now, clock_t cl, tain *offset)
{
- tain_t a, b ;
+ tain a, b ;
struct timespec ts ;
if (clock_gettime(cl, &ts) < 0) return 0 ;
if (!tain_from_timespec(&b, &ts)) return 0 ;
@@ -19,12 +19,12 @@ int tain_stopwatch_init (tain_t *now, clock_t cl, tain_t *offset)
return 1 ;
}
-int tain_stopwatch_read (tain_t *a, clock_t cl, tain_t const *offset)
+int tain_stopwatch_read (tain *now, clock_t cl, tain const *offset)
{
struct timespec ts ;
if (clock_gettime(cl, &ts) < 0) return 0 ;
- if (!tain_from_timespec(a, &ts)) return 0 ;
- tain_add(a, a, offset) ;
+ if (!tain_from_timespec(now, &ts)) return 0 ;
+ tain_add(now, now, offset) ;
return 1 ;
}
@@ -32,7 +32,7 @@ int tain_stopwatch_read (tain_t *a, clock_t cl, tain_t const *offset)
#include <errno.h>
-int tain_stopwatch_init (tain_t *now, clock_t cl, tain_t *offset)
+int tain_stopwatch_init (tain *now, clock_t cl, tain *offset)
{
(void)now ;
(void)cl ;
@@ -40,7 +40,7 @@ int tain_stopwatch_init (tain_t *now, clock_t cl, tain_t *offset)
return (errno = ENOSYS, 0) ;
}
-int tain_stopwatch_read (tain_t *now, clock_t cl, tain_t const *offset)
+int tain_stopwatch_read (tain *now, clock_t cl, tain const *offset)
{
(void)now ;
(void)cl ;
diff --git a/src/libstddjb/tain_sub.c b/src/libstddjb/tain_sub.c
index 0d756e7..12bc98e 100644
--- a/src/libstddjb/tain_sub.c
+++ b/src/libstddjb/tain_sub.c
@@ -2,9 +2,9 @@
#include <skalibs/tai.h>
-int tain_sub (tain_t *t, tain_t const *u, tain_t const *v)
+int tain_sub (tain *t, tain const *u, tain const *v)
{
- tain_t tt ;
+ tain tt ;
tt.sec.x = u->sec.x - v->sec.x ;
tt.nano = u->nano - v->nano ;
if (tt.nano > u->nano)
diff --git a/src/libstddjb/tain_to_millisecs.c b/src/libstddjb/tain_to_millisecs.c
index 0854c49..0ccf641 100644
--- a/src/libstddjb/tain_to_millisecs.c
+++ b/src/libstddjb/tain_to_millisecs.c
@@ -3,7 +3,7 @@
#include <skalibs/uint64.h>
#include <skalibs/tai.h>
-int tain_to_millisecs (tain_t const *a)
+int tain_to_millisecs (tain const *a)
{
if (a->sec.x > (uint64_t)2147483) return -1 ;
if ((a->sec.x == (uint64_t)2147483) && (a->nano > 646000000U)) return -1 ;
diff --git a/src/libstddjb/tain_ulong.c b/src/libstddjb/tain_ulong.c
index 8eb890b..b9b885d 100644
--- a/src/libstddjb/tain_ulong.c
+++ b/src/libstddjb/tain_ulong.c
@@ -2,7 +2,7 @@
#include <skalibs/tai.h>
-int tain_ulong (tain_t *t, unsigned long s)
+int tain_ulong (tain *t, unsigned long s)
{
if (!tai_u64(&t->sec, s)) return 0 ;
t->nano = 0 ;
diff --git a/src/libstddjb/tain_unpack.c b/src/libstddjb/tain_unpack.c
index a62dc29..9c31e4a 100644
--- a/src/libstddjb/tain_unpack.c
+++ b/src/libstddjb/tain_unpack.c
@@ -3,7 +3,7 @@
#include <skalibs/uint32.h>
#include <skalibs/tai.h>
-void tain_unpack (char const *s, tain_t *t)
+void tain_unpack (char const *s, tain *t)
{
tai_unpack(s, &t->sec) ;
uint32_unpack_big(s+8, &t->nano) ;
diff --git a/src/libstddjb/tain_unpack_little.c b/src/libstddjb/tain_unpack_little.c
index 278d494..3d370c8 100644
--- a/src/libstddjb/tain_unpack_little.c
+++ b/src/libstddjb/tain_unpack_little.c
@@ -3,7 +3,7 @@
#include <skalibs/uint32.h>
#include <skalibs/tai.h>
-void tain_unpack_little (char const *s, tain_t *t)
+void tain_unpack_little (char const *s, tain *t)
{
uint32_unpack(s, &t->nano) ;
tai_unpack_little(s+4, &t->sec) ;
diff --git a/src/libstddjb/tain_wallclock_read.c b/src/libstddjb/tain_wallclock_read.c
index 96ed861..57222d0 100644
--- a/src/libstddjb/tain_wallclock_read.c
+++ b/src/libstddjb/tain_wallclock_read.c
@@ -2,9 +2,9 @@
#include <skalibs/tai.h>
-int tain_wallclock_read (tain_t *a)
+int tain_wallclock_read (tain *a)
{
- tain_t aa ;
+ tain aa ;
if (!sysclock_get(&aa)) return 0 ;
return tain_from_sysclock(a, &aa) ;
}
diff --git a/src/libstddjb/tain_zero.c b/src/libstddjb/tain_zero.c
index 4a82f08..38f530d 100644
--- a/src/libstddjb/tain_zero.c
+++ b/src/libstddjb/tain_zero.c
@@ -2,4 +2,4 @@
#include <skalibs/tai.h>
-tain_t const tain_zero = TAIN_ZERO ;
+tain const tain_zero = TAIN_ZERO ;
diff --git a/src/libstddjb/time_from_tai.c b/src/libstddjb/time_from_tai.c
index f3f9538..33ab888 100644
--- a/src/libstddjb/time_from_tai.c
+++ b/src/libstddjb/time_from_tai.c
@@ -7,7 +7,7 @@
#include <skalibs/uint64.h>
#include <skalibs/tai.h>
-int time_from_tai (time_t *u, tai_t const *t)
+int time_from_tai (time_t *u, tai const *t)
{
uint64_t uu = t->x - TAI_MAGIC ;
#if SKALIBS_SIZEOFTIME < 8
diff --git a/src/libstddjb/time_from_tai_relative.c b/src/libstddjb/time_from_tai_relative.c
index 598d80b..88b928f 100644
--- a/src/libstddjb/time_from_tai_relative.c
+++ b/src/libstddjb/time_from_tai_relative.c
@@ -6,7 +6,7 @@
#include <errno.h>
#include <skalibs/tai.h>
-int time_from_tai_relative (time_t *u, tai_t const *t)
+int time_from_tai_relative (time_t *u, tai const *t)
{
#if SKALIBS_SIZEOFTIME < 8
if ((t->x >> 32) && (t->x >> 32) != 0xffffffffUL)
diff --git a/src/libstddjb/time_sysclock_from_tai.c b/src/libstddjb/time_sysclock_from_tai.c
index b0fd689..afa2456 100644
--- a/src/libstddjb/time_sysclock_from_tai.c
+++ b/src/libstddjb/time_sysclock_from_tai.c
@@ -7,7 +7,7 @@
#include <skalibs/uint64.h>
#include <skalibs/tai.h>
-int time_sysclock_from_tai (time_t *u, tai_t const *t)
+int time_sysclock_from_tai (time_t *u, tai const *t)
{
uint64_t uu ;
if (!sysclock_from_tai(&uu, t)) return 0 ;
diff --git a/src/libstddjb/timespec_from_tain.c b/src/libstddjb/timespec_from_tain.c
index cd63547..1feb34d 100644
--- a/src/libstddjb/timespec_from_tain.c
+++ b/src/libstddjb/timespec_from_tain.c
@@ -3,7 +3,7 @@
#include <time.h>
#include <skalibs/tai.h>
-int timespec_from_tain (struct timespec *ts, tain_t const *t)
+int timespec_from_tain (struct timespec *ts, tain const *t)
{
if (!time_from_tai(&ts->tv_sec, &t->sec)) return 0 ;
ts->tv_nsec = t->nano ;
diff --git a/src/libstddjb/timespec_from_tain_relative.c b/src/libstddjb/timespec_from_tain_relative.c
index 8ef34e8..36b58fd 100644
--- a/src/libstddjb/timespec_from_tain_relative.c
+++ b/src/libstddjb/timespec_from_tain_relative.c
@@ -3,7 +3,7 @@
#include <time.h>
#include <skalibs/tai.h>
-int timespec_from_tain_relative (struct timespec *ts, tain_t const *t)
+int timespec_from_tain_relative (struct timespec *ts, tain const *t)
{
if (!time_from_tai_relative(&ts->tv_sec, &t->sec)) return 0 ;
ts->tv_nsec = t->nano ;
diff --git a/src/libstddjb/timespec_sysclock_from_tain.c b/src/libstddjb/timespec_sysclock_from_tain.c
index 5544511..4e9513c 100644
--- a/src/libstddjb/timespec_sysclock_from_tain.c
+++ b/src/libstddjb/timespec_sysclock_from_tain.c
@@ -3,7 +3,7 @@
#include <time.h>
#include <skalibs/tai.h>
-int timespec_sysclock_from_tain (struct timespec *ts, tain_t const *t)
+int timespec_sysclock_from_tain (struct timespec *ts, tain const *t)
{
if (!time_sysclock_from_tai(&ts->tv_sec, &t->sec)) return 0 ;
ts->tv_nsec = t->nano ;
diff --git a/src/libstddjb/timestamp.c b/src/libstddjb/timestamp.c
index 7feb7c2..064946b 100644
--- a/src/libstddjb/timestamp.c
+++ b/src/libstddjb/timestamp.c
@@ -4,6 +4,6 @@
int timestamp (char *s)
{
- tain_t now ;
+ tain now ;
return timestamp_r(s, &now) ;
}
diff --git a/src/libstddjb/timestamp_fmt.c b/src/libstddjb/timestamp_fmt.c
index 78d2dc2..537f61d 100644
--- a/src/libstddjb/timestamp_fmt.c
+++ b/src/libstddjb/timestamp_fmt.c
@@ -2,7 +2,7 @@
#include <skalibs/tai.h>
-size_t timestamp_fmt (char *s, tain_t const *a)
+size_t timestamp_fmt (char *s, tain const *a)
{
*s = '@' ;
return 1 + tain_fmt(s+1, a) ;
diff --git a/src/libstddjb/timestamp_r.c b/src/libstddjb/timestamp_r.c
index 46be7a4..4c8ac58 100644
--- a/src/libstddjb/timestamp_r.c
+++ b/src/libstddjb/timestamp_r.c
@@ -2,7 +2,7 @@
#include <skalibs/tai.h>
-int timestamp_r (char *s, tain_t *stamp)
+int timestamp_r (char *s, tain *stamp)
{
if (!tain_wallclock_read(stamp)) return 0 ;
timestamp_fmt(s, stamp) ;
diff --git a/src/libstddjb/timestamp_scan.c b/src/libstddjb/timestamp_scan.c
index 677cf09..3557a2f 100644
--- a/src/libstddjb/timestamp_scan.c
+++ b/src/libstddjb/timestamp_scan.c
@@ -2,7 +2,7 @@
#include <skalibs/tai.h>
-size_t timestamp_scan (char const *s, tain_t *a)
+size_t timestamp_scan (char const *s, tain *a)
{
size_t r ;
if (*s != '@') return 0 ;
diff --git a/src/libstddjb/timeval_from_tain.c b/src/libstddjb/timeval_from_tain.c
index 2b4d577..b178bba 100644
--- a/src/libstddjb/timeval_from_tain.c
+++ b/src/libstddjb/timeval_from_tain.c
@@ -3,7 +3,7 @@
#include <sys/time.h>
#include <skalibs/tai.h>
-int timeval_from_tain (struct timeval *tv, tain_t const *t)
+int timeval_from_tain (struct timeval *tv, tain const *t)
{
if (!time_from_tai(&tv->tv_sec, &t->sec)) return 0 ;
tv->tv_usec = (t->nano + 500) / 1000 ;
diff --git a/src/libstddjb/timeval_from_tain_relative.c b/src/libstddjb/timeval_from_tain_relative.c
index de775fd..f340f3f 100644
--- a/src/libstddjb/timeval_from_tain_relative.c
+++ b/src/libstddjb/timeval_from_tain_relative.c
@@ -3,7 +3,7 @@
#include <sys/time.h>
#include <skalibs/tai.h>
-int timeval_from_tain_relative (struct timeval *tv, tain_t const *t)
+int timeval_from_tain_relative (struct timeval *tv, tain const *t)
{
if (!time_from_tai_relative(&tv->tv_sec, &t->sec)) return 0 ;
tv->tv_usec = (t->nano + 500) / 1000 ;
diff --git a/src/libstddjb/timeval_sysclock_from_tain.c b/src/libstddjb/timeval_sysclock_from_tain.c
index c41b133..ff94c2c 100644
--- a/src/libstddjb/timeval_sysclock_from_tain.c
+++ b/src/libstddjb/timeval_sysclock_from_tain.c
@@ -3,7 +3,7 @@
#include <sys/time.h>
#include <skalibs/tai.h>
-int timeval_sysclock_from_tain (struct timeval *tv, tain_t const *t)
+int timeval_sysclock_from_tain (struct timeval *tv, tain const *t)
{
if (!time_sysclock_from_tai(&tv->tv_sec, &t->sec)) return 0 ;
tv->tv_usec = (t->nano + 500) / 1000 ;
diff --git a/src/libstddjb/utc_from_sysclock.c b/src/libstddjb/utc_from_sysclock.c
index 7310a10..8eb5d53 100644
--- a/src/libstddjb/utc_from_sysclock.c
+++ b/src/libstddjb/utc_from_sysclock.c
@@ -10,7 +10,7 @@
int utc_from_sysclock (uint64_t *u)
{
- tai_t t = { .x = *u + 10U } ;
+ tai t = { .x = *u + 10U } ;
return utc_from_tai(u, &t) ;
}
diff --git a/src/libstddjb/utc_from_tai.c b/src/libstddjb/utc_from_tai.c
index a0e087e..1413b38 100644
--- a/src/libstddjb/utc_from_tai.c
+++ b/src/libstddjb/utc_from_tai.c
@@ -4,7 +4,7 @@
#include <skalibs/djbtime.h>
#include "djbtime-internal.h"
-int utc_from_tai (uint64_t *u, tai_t const *t)
+int utc_from_tai (uint64_t *u, tai const *t)
{
int r = 1 ;
uint64_t tt = t->x - 10 ;