From fdffefb8032922ce7ffe4c00816072a8ff2148fc Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Fri, 17 Feb 2017 22:30:53 +0000 Subject: More types changes New disize Add size_t to the autotypes list Delete redundant and replace-libc files dev_t/ino_t pass Big size_t pass More things missing, still not operational yet --- src/include/skalibs/bufalloc.h | 4 +-- src/include/skalibs/buffer.h | 53 ++++++++++++++++---------------- src/include/skalibs/bytestr.h | 2 +- src/include/skalibs/cbuffer.h | 40 ++++++++++++------------ src/include/skalibs/cdb.h | 26 ++++++++-------- src/include/skalibs/cdb_make.h | 6 ++-- src/include/skalibs/direntry.h | 1 - src/include/skalibs/disize.h | 17 ++++++++++ src/include/skalibs/diuint32.h | 10 +++--- src/include/skalibs/djbtime.h | 3 +- src/include/skalibs/djbunix.h | 37 ++++++++++------------ src/include/skalibs/functypes.h | 7 +++-- src/include/skalibs/kolbak.h | 9 +++--- src/include/skalibs/netstring.h | 2 +- src/include/skalibs/siovec.h | 26 +++++----------- src/include/skalibs/skaclient.h | 30 +++++++++--------- src/include/skalibs/skamisc.h | 19 ++++++------ src/include/skalibs/stddjb.h | 1 + src/include/skalibs/unix-timed.h | 15 ++++----- src/include/skalibs/unix-transactional.h | 16 +++++----- src/include/skalibs/unixmessage.h | 30 +++++++++--------- 21 files changed, 181 insertions(+), 173 deletions(-) create mode 100644 src/include/skalibs/disize.h (limited to 'src/include') diff --git a/src/include/skalibs/bufalloc.h b/src/include/skalibs/bufalloc.h index 838ab02..46b4f84 100644 --- a/src/include/skalibs/bufalloc.h +++ b/src/include/skalibs/bufalloc.h @@ -13,12 +13,12 @@ struct bufalloc stralloc x ; size_t p ; int fd ; - int (*op) (int, char const *, unsigned int) ; + ssize_t (*op) (int, char const *, size_t) ; } ; #define BUFALLOC_ZERO { .x = STRALLOC_ZERO, .p = 0, .fd = -1, .op = 0 } #define BUFALLOC_INIT(f, d) { .x = STRALLOC_ZERO, .p = 0, .fd = (d), .op = (f) } -extern void bufalloc_init (bufalloc *, int (*)(int, char const *, size_t), int) ; +extern void bufalloc_init (bufalloc *, ssize_t (*)(int, char const *, size_t), int) ; #define bufalloc_shrink(ba) stralloc_shrink(&(ba)->x) #define bufalloc_free(ba) stralloc_free(&(ba)->x) #define bufalloc_put(ba, s, n) stralloc_catb(&(ba)->x, s, n) diff --git a/src/include/skalibs/buffer.h b/src/include/skalibs/buffer.h index 0c7866a..18db87e 100644 --- a/src/include/skalibs/buffer.h +++ b/src/include/skalibs/buffer.h @@ -3,12 +3,13 @@ #ifndef BUFFER_H #define BUFFER_H +#include +#include +#include #include #include -#include #include #include -#include typedef struct buffer_s buffer, buffer_t, *buffer_ref, *buffer_t_ref ; struct buffer_s @@ -32,7 +33,7 @@ struct buffer_s #define BUFFER_OUTSIZE_SMALL 512 #define BUFFER_INIT(f, d, buf, len) { .op = (f), .fd = (d), .c = CBUFFER_INIT(buf, len) } -extern int buffer_init (buffer *, iovfunc_t_ref, int, char *, unsigned int) ; +extern int buffer_init (buffer *, iovfunc_t_ref, int, char *, size_t) ; /* Writing */ @@ -41,27 +42,27 @@ extern int buffer_flush (buffer *) ; #define buffer_putnoflush(b, s, len) cbuffer_put(&(b)->c, s, len) #define buffer_putvnoflush(b, v, n) cbuffer_putv(&(b)->c, v, n) -extern int buffer_putsnoflush (buffer *, char const *) ; +extern size_t buffer_putsnoflush (buffer *, char const *) ; -extern int buffer_putallnoflush (buffer *, char const *, unsigned int) ; -extern int buffer_putvallnoflush (buffer *, siovec_t const *, unsigned int) ; +extern int buffer_putallnoflush (buffer *, char const *, size_t) ; +extern int buffer_putvallnoflush (buffer *, struct iovec const *, unsigned int) ; extern int buffer_putsallnoflush (buffer *, char const *) ; -extern int buffer_putall (buffer *, char const *, unsigned int, unsigned int *) ; -extern int buffer_putvall (buffer *, siovec_t const *, unsigned int, unsigned int *) ; -extern int buffer_putsall (buffer *, char const *, unsigned int *) ; +extern int buffer_putall (buffer *, char const *, size_t, size_t *) ; +extern int buffer_putvall (buffer *, struct iovec const *, unsigned int, size_t *) ; +extern int buffer_putsall (buffer *, char const *, size_t *) ; #define buffer_putallflush(b, s, len, w) (buffer_putall(b, s, len, w) && buffer_flush(b)) #define buffer_putvallflush(b, v, n, w) (buffer_putvall(b, v, n, w) && buffer_flush(b)) -extern int buffer_putsallflush (buffer *, char const *, unsigned int *) ; +extern int buffer_putsallflush (buffer *, char const *, size_t *) ; -extern int buffer_put (buffer *, char const *, unsigned int) ; -extern int buffer_putv (buffer *, siovec_t const *, unsigned int) ; -extern int buffer_puts (buffer *, char const *) ; +extern ssize_t buffer_put (buffer *, char const *, size_t) ; +extern ssize_t buffer_putv (buffer *, struct iovec const *, unsigned int) ; +extern ssize_t buffer_puts (buffer *, char const *) ; -extern int buffer_putflush (buffer *, char const *, unsigned int) ; -extern int buffer_putvflush (buffer *, siovec_t const *, unsigned int) ; -extern int buffer_putsflush (buffer *, char const *) ; +extern ssize_t buffer_putflush (buffer *, char const *, size_t) ; +extern ssize_t buffer_putvflush (buffer *, struct iovec const *, unsigned int) ; +extern ssize_t buffer_putsflush (buffer *, char const *) ; #define buffer_unput(b, n) cbuffer_unput(&(b)->c, n) #define buffer_wpeek(b, v) cbuffer_wpeek(&(b)->c, v) @@ -70,19 +71,19 @@ extern int buffer_putsflush (buffer *, char const *) ; /* Reading */ -extern int buffer_fill (buffer *) ; +extern ssize_t buffer_fill (buffer *) ; #define buffer_getnofill(b, s, len) cbuffer_get(&(b)->c, s, len) #define buffer_getvnofill(b, v, n) cbuffer_getv(&(b)->c, v, n) -extern int buffer_getallnofill (buffer *, char *, unsigned int) ; -extern int buffer_getvallnofill (buffer *, siovec_t const *, unsigned int) ; +extern int buffer_getallnofill (buffer *, char *, size_t) ; +extern int buffer_getvallnofill (buffer *, struct iovec const *, unsigned int) ; -extern int buffer_getall (buffer *, char *, unsigned int, unsigned int *) ; -extern int buffer_getvall (buffer *, siovec_t const *, unsigned int, unsigned int *) ; +extern int buffer_getall (buffer *, char *, size_t, size_t *) ; +extern int buffer_getvall (buffer *, struct iovec const *, unsigned int, size_t *) ; -extern int buffer_get (buffer *, char *, unsigned int) ; -extern int buffer_getv (buffer *, siovec_t const *, unsigned int) ; +extern ssize_t buffer_get (buffer *, char *, size_t) ; +extern ssize_t buffer_getv (buffer *, struct iovec const *, unsigned int) ; #define buffer_unget(b, n) cbuffer_unget(&(b)->c, n) #define buffer_rpeek(b, n) cbuffer_rpeek(&(b)->c, n) @@ -92,7 +93,7 @@ extern int buffer_getv (buffer *, siovec_t const *, unsigned int) ; /* Utility */ #define buffer_len(b) cbuffer_len(&(b)->c) -extern unsigned int buffer_getlen (buffer const *) gccattr_pure ; +extern size_t buffer_getlen (buffer const *) gccattr_pure ; #define buffer_available(b) cbuffer_available(&(b)->c) #define buffer_isempty(b) cbuffer_isempty(&(b)->c) #define buffer_isfull(b) cbuffer_isfull(&(b)->c) @@ -104,8 +105,8 @@ extern int buffer_getfd (buffer const *) gccattr_pure ; /* Globals */ -#define buffer_read fd_readsv -#define buffer_write fd_writesv +#define buffer_read fd_readv +#define buffer_write fd_writev extern iovfunc_t buffer_flush1read ; extern buffer buffer_0_ ; diff --git a/src/include/skalibs/bytestr.h b/src/include/skalibs/bytestr.h index 79768a8..25f05d3 100644 --- a/src/include/skalibs/bytestr.h +++ b/src/include/skalibs/bytestr.h @@ -37,7 +37,7 @@ extern size_t byte_chr (char const *, size_t, int) gccattr_pure ; extern size_t byte_rchr (char const *, size_t, int) gccattr_pure ; extern size_t byte_in (char const *, size_t, char const *, size_t) gccattr_pure ; #define byte_equal(s, n, t) (!byte_diff((s), (n), (t))) -extern uint64_t byte_count (char const *, size_t, char) gccattr_pure ; +extern size_t byte_count (char const *, size_t, char) gccattr_pure ; #define str_diffb(a, n, b) str_diffn(a, (b), n) extern size_t str_chr (char const *, int) gccattr_pure ; diff --git a/src/include/skalibs/cbuffer.h b/src/include/skalibs/cbuffer.h index a80e3af..19b3078 100644 --- a/src/include/skalibs/cbuffer.h +++ b/src/include/skalibs/cbuffer.h @@ -3,18 +3,18 @@ #ifndef CBUFFER_H #define CBUFFER_H +#include +#include +#include #include -#include -#include -#include typedef struct cbuffer_s cbuffer_t, *cbuffer_t_ref ; struct cbuffer_s { char *x ; - unsigned int a ; /* total length */ - unsigned int p ; /* head */ - unsigned int n ; /* tail */ + size_t a ; /* total length */ + size_t p ; /* head */ + size_t n ; /* tail */ } ; #define CBUFFER_ZERO { .x = 0, .a = 0, .p = 0, .n = 0 } @@ -24,38 +24,38 @@ struct cbuffer_s */ #define CBUFFER_INIT(buf, len) { .x = (buf), .a = (len), .p = 0, .n = 0 } -extern int cbuffer_init (cbuffer_t *, char *, unsigned int) ; +extern int cbuffer_init (cbuffer_t *, char *, size_t) ; /* Writing */ -extern unsigned int cbuffer_put (cbuffer_t *, char const *, unsigned int) ; -extern unsigned int cbuffer_putv (cbuffer_t *, siovec_t const *, unsigned int) ; -#define cbuffer_puts(b, s) cbuffer_put(b, (s), str_len(s)) +extern size_t cbuffer_put (cbuffer_t *, char const *, size_t) ; +extern size_t cbuffer_putv (cbuffer_t *, struct iovec const *, unsigned int) ; +#define cbuffer_puts(b, s) cbuffer_put(b, (s), strlen(s)) #define cbuffer_UNPUT(b, w) ((b)->n = ((b)->a + (b)->n - w) % (b)->a, w) ; -extern unsigned int cbuffer_unput (cbuffer_t *, unsigned int) ; -extern void cbuffer_wpeek (cbuffer_t *, siovec_t *) ; +extern size_t cbuffer_unput (cbuffer_t *, size_t) ; +extern void cbuffer_wpeek (cbuffer_t *, struct iovec *) ; #define cbuffer_WSEEK(b, w) ((b)->n = ((b)->n + (w)) % (b)->a, w) -extern unsigned int cbuffer_wseek (cbuffer_t *, unsigned int) ; +extern size_t cbuffer_wseek (cbuffer_t *, size_t) ; /* Reading */ -extern unsigned int cbuffer_get (cbuffer_t *, char *, unsigned int) ; -extern unsigned int cbuffer_getv (cbuffer_t *, siovec_t const *, unsigned int) ; +extern size_t cbuffer_get (cbuffer_t *, char *, size_t) ; +extern size_t cbuffer_getv (cbuffer_t *, struct iovec const *, unsigned int) ; #define cbuffer_UNGET(b, n) ((b)->p = ((b)->a + (b)->p - n) % (b)->a, n) ; -extern unsigned int cbuffer_unget (cbuffer_t *, unsigned int) ; -extern void cbuffer_rpeek (cbuffer_t *, siovec_t *) ; +extern size_t cbuffer_unget (cbuffer_t *, size_t) ; +extern void cbuffer_rpeek (cbuffer_t *, struct iovec *) ; #define cbuffer_RSEEK(b, n) ((b)->p = ((b)->p + (n)) % (b)->a, n) -extern unsigned int cbuffer_rseek (cbuffer_t *, unsigned int) ; +extern size_t cbuffer_rseek (cbuffer_t *, size_t) ; /* Utility */ -#define cbuffer_len(b) ((unsigned int)(((b)->a - (b)->p + (b)->n) % (b)->a)) -#define cbuffer_available(b) ((unsigned int)(((b)->a - (b)->n + (b)->p - 1) % (b)->a)) +#define cbuffer_len(b) ((size_t)(((b)->a - (b)->p + (b)->n) % (b)->a)) +#define cbuffer_available(b) ((size_t)(((b)->a - (b)->n + (b)->p - 1) % (b)->a)) #define cbuffer_isempty(b) (!cbuffer_len(b)) #define cbuffer_isfull(b) (!cbuffer_available(b)) diff --git a/src/include/skalibs/cdb.h b/src/include/skalibs/cdb.h index 9e9aae0..52e72ee 100644 --- a/src/include/skalibs/cdb.h +++ b/src/include/skalibs/cdb.h @@ -3,26 +3,26 @@ #ifndef CDB_H #define CDB_H +#include #include -#include #define CDB_HASHSTART 5381 -extern uint32 cdb_hashadd (uint32, unsigned char) gccattr_const ; -extern uint32 cdb_hash (char const *, unsigned int) gccattr_pure ; +extern uint32_t cdb_hashadd (uint32_t, unsigned char) gccattr_const ; +extern uint32_t cdb_hash (char const *, unsigned int) gccattr_pure ; typedef struct cdb cdb_t, *cdb_t_ref ; struct cdb { char *map ; /* 0 if no map */ int fd ; /* -1 if uninitted, negative if mapped, nonnegative if nomapped */ - uint32 size ; /* initialized if map is nonzero */ - uint32 loop ; /* number of hash slots searched under this key */ - uint32 khash ; /* initialized if loop is nonzero */ - uint32 kpos ; /* initialized if loop is nonzero */ - uint32 hpos ; /* initialized if loop is nonzero */ - uint32 hslots ; /* initialized if loop is nonzero */ - uint32 dpos ; /* initialized if cdb_findnext() returns 1 */ - uint32 dlen ; /* initialized if cdb_findnext() returns 1 */ + uint32_t size ; /* initialized if map is nonzero */ + uint32_t loop ; /* number of hash slots searched under this key */ + uint32_t khash ; /* initialized if loop is nonzero */ + uint32_t kpos ; /* initialized if loop is nonzero */ + uint32_t hpos ; /* initialized if loop is nonzero */ + uint32_t hslots ; /* initialized if loop is nonzero */ + uint32_t dpos ; /* initialized if cdb_findnext() returns 1 */ + uint32_t dlen ; /* initialized if cdb_findnext() returns 1 */ } ; #define CDB_ZERO { .map = 0, .fd = -1, .size = 0, .loop = 0, .khash = 0, .kpos = 0, .hpos = 0, .hslots = 0, .dpos = 0, .dlen = 0 } @@ -33,7 +33,7 @@ extern void cdb_free (struct cdb *) ; #define cdb_init(c, fd) (cdb_init_map(c, (fd), 1) ? 0 : -1) extern int cdb_init_map (struct cdb *, int fd, int) ; extern int cdb_mapfile (struct cdb *, char const *) ; -extern int cdb_read (struct cdb *, char *, unsigned int, uint32) ; +extern int cdb_read (struct cdb *, char *, unsigned int, uint32_t) ; #define cdb_findstart(c) ((c)->loop = 0) extern int cdb_findnext (struct cdb *, char const *, unsigned int) ; #define cdb_find(c, s, len) (cdb_findstart(c), cdb_findnext(c, s, len)) @@ -45,7 +45,7 @@ extern int cdb_findnext (struct cdb *, char const *, unsigned int) ; #define cdb_traverse_init(c, kpos) (*(kpos) = 2048) #define cdb_firstkey(c, kpos) (cdb_traverse_init(c, kpos), cdb_nextkey(c, kpos)) -extern int cdb_nextkey (struct cdb *, uint32 *) ; +extern int cdb_nextkey (struct cdb *, uint32_t *) ; extern int cdb_successor (struct cdb *, char const *, unsigned int) ; #endif diff --git a/src/include/skalibs/cdb_make.h b/src/include/skalibs/cdb_make.h index 2858358..69e1c68 100644 --- a/src/include/skalibs/cdb_make.h +++ b/src/include/skalibs/cdb_make.h @@ -3,7 +3,7 @@ #ifndef CDB_MAKE_H #define CDB_MAKE_H -#include +#include #include #include #include @@ -13,12 +13,12 @@ typedef struct cdb_make cdb_make, *cdb_make_ref ; struct cdb_make { genalloc hplist ; /* array of diuint32 */ - uint32 pos ; + uint32_t pos ; buffer b ; char buf[BUFFER_OUTSIZE] ; } ; -#define CDB_MAKE_ZERO { .hplist = GENALLOC_ZERO, .pos = 2048, .b = BUFFER_INIT(&fd_writesv, -1, 0, 0) } +#define CDB_MAKE_ZERO { .hplist = GENALLOC_ZERO, .pos = 2048, .b = BUFFER_INIT(&fd_writev, -1, 0, 0) } extern int cdb_make_start (struct cdb_make *, int) ; extern int cdb_make_add (struct cdb_make *, char const *, unsigned int, char const *, unsigned int) ; diff --git a/src/include/skalibs/direntry.h b/src/include/skalibs/direntry.h index 3150e51..518ce77 100644 --- a/src/include/skalibs/direntry.h +++ b/src/include/skalibs/direntry.h @@ -3,7 +3,6 @@ #ifndef DIRENTRY_H #define DIRENTRY_H -#include #include typedef struct dirent direntry, direntry_t, *direntry_ref, *direntry_t_ref ; diff --git a/src/include/skalibs/disize.h b/src/include/skalibs/disize.h new file mode 100644 index 0000000..418b518 --- /dev/null +++ b/src/include/skalibs/disize.h @@ -0,0 +1,17 @@ +/* ISC license. */ + +#ifndef DISIZE_H +#define DISIZE_H + +#include + +typedef struct disize_s disize, *disize_ref ; +struct disize_s +{ + size_t left ; + size_t right ; +} ; + +#define DISIZE_ZERO { .left = 0, .right = 0 } + +#endif diff --git a/src/include/skalibs/diuint32.h b/src/include/skalibs/diuint32.h index cd8ae75..fb0a2de 100644 --- a/src/include/skalibs/diuint32.h +++ b/src/include/skalibs/diuint32.h @@ -3,13 +3,13 @@ #ifndef DIUINT32_H #define DIUINT32_H -#include +#include -typedef struct diuint32 diuint32, *diuint32_ref ; -struct diuint32 +typedef struct diuint32_s diuint32, *diuint32_ref ; +struct diuint32_s { - uint32 left ; - uint32 right ; + uint32_t left ; + uint32_t right ; } ; #define DIUINT32_ZERO { .left = 0, .right = 0 } diff --git a/src/include/skalibs/djbtime.h b/src/include/skalibs/djbtime.h index 07ad662..2f924c7 100644 --- a/src/include/skalibs/djbtime.h +++ b/src/include/skalibs/djbtime.h @@ -3,9 +3,8 @@ #ifndef DJBTIME_H #define DJBTIME_H -#include +#include #include -#include #include #include diff --git a/src/include/skalibs/djbunix.h b/src/include/skalibs/djbunix.h index a0d65a0..03fd092 100644 --- a/src/include/skalibs/djbunix.h +++ b/src/include/skalibs/djbunix.h @@ -9,8 +9,6 @@ #include #include #include -#include -#include #include #include #include /* compatibility */ @@ -32,7 +30,7 @@ extern int fd_move (int, int) ; extern int fd_move2 (int, int, int, int) ; extern int fd_close (int) ; extern int fd_chmod (int, unsigned int) ; -extern int fd_chown (int, unsigned int, unsigned int) ; +extern int fd_chown (int, uid_t, gid_t) ; extern int fd_sync (int) ; extern int fd_cat (int, int) ; extern size_t fd_catn (int, int, size_t) ; @@ -56,9 +54,9 @@ extern int socket_internal (int, int, int, unsigned int) ; extern int socketpair_internal (int, int, int, unsigned int, int *) ; extern int pathexec_env (char const *, char const *) ; -extern void pathexec_r (char const *const *, char const *const *, unsigned int, char const *, unsigned int) ; -extern void pathexec_r_name (char const *, char const *const *, char const *const *, unsigned int, char const *, unsigned int) ; -extern void pathexec_fromenv (char const *const *, char const *const *, unsigned int) ; +extern void pathexec_r (char const *const *, char const *const *, size_t, char const *, size_t) ; +extern void pathexec_r_name (char const *, char const *const *, char const *const *, size_t, char const *, size_t) ; +extern void pathexec_fromenv (char const *const *, char const *const *, size_t) ; extern void execvep (char const *, char const *const *, char const *const *, char const *) ; extern void pathexec_run (char const *, char const *const *, char const *const *) ; extern void pathexec0_run (char const *const *, char const *const *) ; @@ -72,9 +70,9 @@ extern int prot_grps (char const *) ; extern int prot_setuidgid (char const *) ; extern long seek_cur (int) ; -extern int seek_set (int, long) ; +extern int seek_set (int, off_t) ; extern int seek_end (int) ; -extern int seek_trunc (int, long) ; +extern int seek_trunc (int, off_t) ; #define seek_begin(fd) (seek_set((fd), 0)) extern pid_t wait_nointr (int *) ; @@ -98,48 +96,45 @@ extern int fd_chdir (int) ; extern char *realpath_tmp (char const *, char *, stralloc *) ; extern int sarealpath (stralloc *, char const *) ; extern int sarealpath_tmp (stralloc *, char const *, stralloc *) ; -/* extern char *basename (char *) ; */ -extern int sabasename (stralloc *, char const *, unsigned int) ; -/* extern char *dirname (char *) ; */ -extern int sadirname (stralloc *, char const *, unsigned int) ; +extern int sabasename (stralloc *, char const *, size_t) ; +extern int sadirname (stralloc *, char const *, size_t) ; extern int sagetcwd (stralloc *) ; extern int sareadlink (stralloc *, char const *) ; extern int sagethostname (stralloc *) ; extern int slurp (stralloc *, int) ; extern int openslurpclose (stralloc *, char const *) ; -extern int openreadclose (char const *, stralloc *, unsigned int) ; -extern int openreadnclose (char const *, char *, unsigned int) ; -extern int openreadnclose_nb (char const *, char *, unsigned int) ; -extern int openreadfileclose (char const *, stralloc *, unsigned int) ; +extern ssize_t openreadnclose (char const *, char *, size_t) ; +extern ssize_t openreadnclose_nb (char const *, char *, size_t) ; +extern int openreadfileclose (char const *, stralloc *, size_t) ; #define openwritenclose_unsafe(f, s, n) openwritenclose_unsafe_internal(f, s, (n), 0, 0, 0) #define openwritenclose_unsafe_sync(f, s, n) openwritenclose_unsafe_internal(f, s, (n), 0, 0, 1) #define openwritenclose_unsafe_devino(f, s, n, dev, ino) openwritenclose_unsafe_internal(f, s, n, dev, (ino), 0) #define openwritenclose_unsafe_devino_sync(f, s, n, dev, ino) openwritenclose_unsafe_internal(f, s, n, dev, (ino), 1) -extern int openwritenclose_unsafe_internal (char const *, char const *, unsigned int, uint64 *, uint64 *, int) ; +extern int openwritenclose_unsafe_internal (char const *, char const *, size_t, dev_t *, ino_t *, int) ; #define openwritenclose_suffix(f, s, n, t) openwritenclose_suffix_internal(f, s, n, 0, 0, 0, t) #define openwritenclose_suffix_sync(f, s, n, t) openwritenclose_suffix_internal(f, s, n, 0, 0, 1, t) #define openwritenclose_suffix_devino(f, s, n, t, dev, ino) openwritenclose_suffix_internal(f, s, n, dev, (ino), 0, t) #define openwritenclose_suffix_devino_sync(f, s, n, t, dev, ino) openwritenclose_suffix_internal(f, s, n, dev, (ino), 1, t) -extern int openwritenclose_suffix_internal (char const *, char const *, unsigned int, uint64 *, uint64 *, int, char const *) ; +extern int openwritenclose_suffix_internal (char const *, char const *, size_t, dev_t *, ino_t *, int, char const *) ; #define openwritevnclose_unsafe(f, v, n) openwritevnclose_unsafe_internal(f, v, (n), 0, 0, 0) #define openwritevnclose_unsafe_sync(f, v, n) openwritevnclose_unsafe_internal(f, v, (n), 0, 0, 1) #define openwritevnclose_unsafe_devino(f, v, n, dev, ino) openwritevnclose_unsafe_internal(f, v, n, dev, (ino), 0) #define openwritevnclose_unsafe_devino_sync(f, v, n, dev, ino) openwritevnclose_unsafe_internal(f, v, n, dev, (ino), 1) -extern int openwritevnclose_unsafe_internal (char const *, siovec_t const *, unsigned int, uint64 *, uint64 *, int) ; +extern int openwritevnclose_unsafe_internal (char const *, struct iovec const *, unsigned int, dev_t *, ino_t *, int) ; #define openwritevnclose_suffix(f, v, n, t) openwritevnclose_suffix_internal(f, v, n, 0, 0, 0, t) #define openwritevnclose_suffix_sync(f, v, n, t) openwritevnclose_suffix_internal(f, v, n, 0, 0, 1, t) #define openwritevnclose_suffix_devino(f, v, n, t, dev, ino) openwritevnclose_suffix_internal(f, v, n, dev, (ino), 0, t) #define openwritevnclose_suffix_devino_sync(f, v, n, t, dev, ino) openwritevnclose_suffix_internal(f, v, n, dev, (ino), 1, t) -extern int openwritevnclose_suffix_internal (char const *, siovec_t const *, unsigned int, uint64 *, uint64 *, int, char const *) ; +extern int openwritevnclose_suffix_internal (char const *, struct iovec const *, unsigned int, dev_t *, ino_t *, int, char const *) ; extern int rm_rf (char const *) ; extern int rm_rf_tmp (char const *, stralloc *) ; -extern int rm_rf_in_tmp (stralloc *, unsigned int) ; /* caution ! */ +extern int rm_rf_in_tmp (stralloc *, size_t) ; /* caution ! */ extern int rmstar (char const *) ; extern int rmstar_tmp (char const *, stralloc *) ; diff --git a/src/include/skalibs/functypes.h b/src/include/skalibs/functypes.h index a443c2a..f67a0bc 100644 --- a/src/include/skalibs/functypes.h +++ b/src/include/skalibs/functypes.h @@ -24,8 +24,11 @@ typedef freefunc_t *freefunc_t_ref ; typedef int initfunc_t (void *) ; typedef initfunc_t *initfunc_t_ref ; -typedef unsigned int uinitfunc_t (void *) ; -typedef uinitfunc_t *uinitfunc_t_ref ; +typedef ssize_t getfunc_t (void *) ; +typedef getfunc_t *getfunc_t_ref ; + +typedef size_t ugetfunc_t (void *) ; +typedef ugetfunc_t *ugetfunc_t_ref ; typedef ssize_t iofunc_t (int, char *, size_t) ; typedef iofunc_t *iofunc_t_ref ; diff --git a/src/include/skalibs/kolbak.h b/src/include/skalibs/kolbak.h index 86a2170..566f065 100644 --- a/src/include/skalibs/kolbak.h +++ b/src/include/skalibs/kolbak.h @@ -3,6 +3,7 @@ #ifndef KOLBAK_H #define KOLBAK_H +#include #include typedef struct kolbak_closure_s kolbak_closure_t, *kolbak_closure_t_ref ; @@ -17,14 +18,14 @@ typedef struct kolbak_queue_s kolbak_queue_t, *kolbak_queue_t_ref ; struct kolbak_queue_s { kolbak_closure_t *x ; - unsigned int n ; - unsigned int head ; - unsigned int tail ; + size_t n ; + size_t head ; + size_t tail ; } ; #define KOLBAK_QUEUE_ZERO { .x = 0, .n = 0, .head = 0, .tail = 0 } #define KOLBAK_QUEUE_INIT(s, len) { .x = (s), .n = (len), .head = 0, .tail = 0 } -extern int kolbak_queue_init (kolbak_queue_t *, kolbak_closure_t *, unsigned int) ; +extern int kolbak_queue_init (kolbak_queue_t *, kolbak_closure_t *, size_t) ; extern int kolbak_enqueue (kolbak_queue_t *, unixmessage_handler_func_t_ref, void *) ; extern int kolbak_unenqueue (kolbak_queue_t *) ; extern int kolbak_call (unixmessage_t const *, kolbak_queue_t *) ; diff --git a/src/include/skalibs/netstring.h b/src/include/skalibs/netstring.h index f6663c3..107e796 100644 --- a/src/include/skalibs/netstring.h +++ b/src/include/skalibs/netstring.h @@ -17,7 +17,7 @@ extern int netstring_encode (stralloc *, char const *, size_t) ; extern ssize_t netstring_decode (stralloc *, char const *, size_t) ; extern int netstring_okeof (buffer *, size_t) ; -extern ssize_t netstring_get (buffer *, stralloc *, size_t *) ; +extern int netstring_get (buffer *, stralloc *, size_t *) ; extern int netstring_put (buffer *, char const *, size_t, size_t *) ; #define netstring_putba(ba, s, n) netstring_appendb(&(ba)->x, s, n) #define netstring_putbav(ba, v, n) netstring_appendv(&(ba)->x, v, n) diff --git a/src/include/skalibs/siovec.h b/src/include/skalibs/siovec.h index 55ef993..a543d93 100644 --- a/src/include/skalibs/siovec.h +++ b/src/include/skalibs/siovec.h @@ -7,24 +7,14 @@ #include #include -typedef struct siovec_s siovec_t, *siovec_t_ref ; -struct siovec_s -{ - char *s ; - unsigned int len ; -} ; +extern size_t siovec_len (struct iovec const *, unsigned int) gccattr_pure ; +extern size_t siovec_gather (struct iovec const *, unsigned int, char *, size_t) ; +extern size_t siovec_scatter (struct iovec const *, unsigned int, char const *, size_t) ; +extern size_t siovec_deal (struct iovec const *, unsigned int, struct iovec const *, unsigned int) ; +extern size_t siovec_seek (struct iovec *, unsigned int, size_t) ; +extern unsigned int siovec_trunc (struct iovec *, unsigned int, size_t) ; -extern unsigned int siovec_len (siovec_t const *, unsigned int) gccattr_pure ; -extern unsigned int siovec_gather (siovec_t const *, unsigned int, char *, unsigned int) ; -extern unsigned int siovec_scatter (siovec_t const *, unsigned int, char const *, unsigned int) ; -extern unsigned int siovec_deal (siovec_t const *, unsigned int, siovec_t const *, unsigned int) ; -extern unsigned int siovec_seek (siovec_t *, unsigned int, unsigned int) ; -extern unsigned int siovec_trunc (siovec_t *, unsigned int, unsigned int) ; - -extern void siovec_from_iovec (siovec_t *, struct iovec const *, unsigned int) ; -extern void iovec_from_siovec (struct iovec *, siovec_t const *, unsigned int) ; - -extern unsigned int siovec_bytechr (siovec_t const *, unsigned int, char) ; -extern unsigned int siovec_bytein (siovec_t const *, unsigned int, char const *, unsigned int) ; +extern size_t siovec_bytechr (struct iovec const *, unsigned int, char) ; +extern size_t siovec_bytein (struct iovec const *, unsigned int, char const *, size_t) ; #endif diff --git a/src/include/skalibs/skaclient.h b/src/include/skalibs/skaclient.h index 5b73852..2e6e251 100644 --- a/src/include/skalibs/skaclient.h +++ b/src/include/skalibs/skaclient.h @@ -4,18 +4,18 @@ #define SKACLIENT_H #include +#include +#include #include -#include #include -#include #include /* Server part */ -extern int skaclient_server_ack (unixmessage_t const *, unixmessage_sender_t *, unixmessage_sender_t *, char const *, unsigned int, char const *, unsigned int) ; -extern int skaclient_server_bidi_ack (unixmessage_t const *, unixmessage_sender_t *, unixmessage_sender_t *, unixmessage_receiver_t *, char *, unsigned int, char *, unsigned int, char const *, unsigned int, char const *, unsigned int) ; -extern int skaclient_server_init (unixmessage_receiver_t *, unixmessage_sender_t *, unixmessage_sender_t *, char const *, unsigned int, char const *, unsigned int, tain_t const *, tain_t *) ; +extern int skaclient_server_ack (unixmessage_t const *, unixmessage_sender_t *, unixmessage_sender_t *, char const *, size_t, char const *, size_t) ; +extern int skaclient_server_bidi_ack (unixmessage_t const *, unixmessage_sender_t *, unixmessage_sender_t *, unixmessage_receiver_t *, char *, size_t, char *, size_t, char const *, size_t, char const *, size_t) ; +extern int skaclient_server_init (unixmessage_receiver_t *, unixmessage_sender_t *, unixmessage_sender_t *, char const *, size_t, char const *, size_t, tain_t const *, tain_t *) ; #define skaclient_server_init_g(in, out, asyncout, before, beforelen, after, afterlen, deadline) skaclient_server_init(in, out, asyncout, before, beforelen, after, afterlen, (deadline), &STAMP) #define skaclient_server_01x_init(before, beforelen, after, afterlen, deadline, stamp) skaclient_server_init(unixmessage_receiver_0, unixmessage_sender_1, unixmessage_sender_x, before, beforelen, after, afterlen, deadline, stamp) #define skaclient_server_01x_init_g(before, beforelen, after, afterlen, deadline) skaclient_server_01x_init(before, beforelen, after, afterlen, (deadline), &STAMP) @@ -43,7 +43,7 @@ struct skaclient_s unixmessage_receiver_t asyncin ; unixmessage_sender_t asyncout ; pid_t pid ; - uint32 options ; + uint32_t options ; } ; #define SKACLIENT_ZERO { .syncin = UNIXMESSAGE_RECEIVER_ZERO, .syncout = UNIXMESSAGE_SENDER_ZERO, .kq = KOLBAK_QUEUE_ZERO, .asyncin = UNIXMESSAGE_RECEIVER_ZERO, .asyncout = UNIXMESSAGE_SENDER_ZERO, .pid = 0, .options = 0 } extern skaclient_t const skaclient_zero ; @@ -56,7 +56,7 @@ struct skaclient_cbdata_s { skaclient_t *a ; char const *after ; - unsigned int afterlen ; + size_t afterlen ; } ; @@ -64,17 +64,17 @@ struct skaclient_cbdata_s extern void skaclient_end (skaclient_t *) ; -extern int skaclient_start_async (skaclient_t *, char *, unsigned int, char *, unsigned int, char *, unsigned int, char *, unsigned int, kolbak_closure_t *, unsigned int, char const *, uint32, char const *, unsigned int, char const *, unsigned int, skaclient_cbdata_t *) ; +extern int skaclient_start_async (skaclient_t *, char *, size_t, char *, size_t, char *, size_t, char *, size_t, kolbak_closure_t *, size_t, char const *, uint32_t, char const *, size_t, char const *, size_t, skaclient_cbdata_t *) ; #define skaclient_start_async_b(a, sb, path, options, before, beforelen, after, afterlen, blah) skaclient_start_async(a, (sb)->bufs, sizeof((sb)->bufs), (sb)->auxbufs, sizeof((sb)->auxbufs), (sb)->bufa, sizeof((sb)->bufa), (sb)->auxbufa, sizeof((sb)->auxbufa), (sb)->q, sizeof((sb)->q), path, options, before, beforelen, after, afterlen, blah) -extern int skaclient_startf_async (skaclient_t *, char *, unsigned int, char *, unsigned int, char *, unsigned int, char *, unsigned int, kolbak_closure_t *, unsigned int, char const *, char const *const *, char const *const *, uint32, char const *, unsigned int, char const *, unsigned int, skaclient_cbdata_t *) ; +extern int skaclient_startf_async (skaclient_t *, char *, size_t, char *, size_t, char *, size_t, char *, size_t, kolbak_closure_t *, size_t, char const *, char const *const *, char const *const *, uint32_t, char const *, size_t, char const *, size_t, skaclient_cbdata_t *) ; #define skaclient_startf_async_b(a, sb, prog, argv, envp, options, before, beforelen, after, afterlen, blah) skaclient_startf_async(a, (sb)->bufs, sizeof((sb)->bufs), (sb)->auxbufs, sizeof((sb)->auxbufs), (sb)->bufa, sizeof((sb)->bufa), (sb)->auxbufa, sizeof((sb)->auxbufa), (sb)->q, sizeof((sb)->q) / sizeof(kolbak_closure_t), prog, argv, envp, options, before, beforelen, after, afterlen, blah) -extern int skaclient_start (skaclient_t *, char *, unsigned int, char *, unsigned int, char *, unsigned int, char *, unsigned int, kolbak_closure_t *, unsigned int, char const *, uint32, char const *, unsigned int, char const *, unsigned int, tain_t const *, tain_t *) ; +extern int skaclient_start (skaclient_t *, char *, size_t, char *, size_t, char *, size_t, char *, size_t, kolbak_closure_t *, size_t, char const *, uint32_t, char const *, size_t, char const *, size_t, tain_t const *, tain_t *) ; #define skaclient_start_b(a, sb, path, options, before, beforelen, after, afterlen, deadline, stamp) skaclient_start(a, (sb)->bufs, sizeof((sb)->bufs), (sb)->auxbufs, sizeof((sb)->auxbufs), (sb)->bufa, sizeof((sb)->bufa), (sb)->auxbufa, sizeof((sb)->auxbufa), (sb)->q, sizeof((sb)->q) / sizeof(kolbak_closure_t), path, options, before, beforelen, after, afterlen, deadline, stamp) #define skaclient_start_g(a, bufs, bufsn, auxbufs, auxbufsn, bufa, bufan, auxbufa, auxbufan, q, qlen, path, options, before, beforelen, after, afterlen, deadline) skaclient_start(a, bufs, bufsn, auxbufs, auxbufsn, bufa, bufan, auxbufa, auxbufan, q, qlen, path, options, before, beforelen, after, afterlen, (deadline), &STAMP) #define skaclient_start_b_g(a, sb, path, options, before, beforelen, after, afterlen, deadline) skaclient_start_b(a, sb, path, options, before, beforelen, after, afterlen, (deadline), &STAMP) -extern int skaclient_startf (skaclient_t *, char *, unsigned int, char *, unsigned int, char *, unsigned int, char *, unsigned int, kolbak_closure_t *, unsigned int, char const *, char const *const *, char const *const *, uint32, char const *, unsigned int, char const *, unsigned int, tain_t const *, tain_t *) ; +extern int skaclient_startf (skaclient_t *, char *, size_t, char *, size_t, char *, size_t, char *, size_t, kolbak_closure_t *, size_t, char const *, char const *const *, char const *const *, uint32_t, char const *, size_t, char const *, size_t, tain_t const *, tain_t *) ; #define skaclient_startf_b(a, sb, prog, argv, envp, options, before, beforelen, after, afterlen, deadline, stamp) skaclient_startf(a, (sb)->bufs, sizeof((sb)->bufs), (sb)->auxbufs, sizeof((sb)->auxbufs), (sb)->bufa, sizeof((sb)->bufa), (sb)->auxbufa, sizeof((sb)->auxbufa), (sb)->q, sizeof((sb)->q) / sizeof(kolbak_closure_t), prog, argv, envp, options, before, beforelen, after, afterlen, deadline, stamp) #define skaclient_startf_g(a, bufs, bufsn, auxbufs, auxbufsn, bufa, bufan, auxbufa, auxbufan, q, qlen, prog, argv, envp, options, before, beforelen, after, afterlen, deadline) skaclient_startf(a, bufs, bufsn, auxbufs, auxbufsn, bufa, bufan, auxbufa, auxbufan, q, qlen, prog, argv, envp, options, before, beforelen, after, afterlen, (deadline), &STAMP) #define skaclient_startf_b_g(a, sb, prog, argv, envp, options, before, beforelen, after, afterlen, deadline) skaclient_startf_b(a, sb, prog, argv, envp, options, before, beforelen, after, afterlen, (deadline), &STAMP) @@ -87,8 +87,8 @@ extern int skaclient_putmsg_and_close (skaclient_t *, unixmessage_t const *, uns extern int skaclient_putmsgv_and_close (skaclient_t *, unixmessage_v_t const *, unsigned char const *, unixmessage_handler_func_t *, void *) ; #define skaclient_putmsgv(a, m, cb, result) skaclient_putmsgv_and_close(a, m, unixmessage_bits_closenone, cb, result) -extern int skaclient_put (skaclient_t *, char const *, unsigned int, unixmessage_handler_func_t *, void *) ; -extern int skaclient_putv (skaclient_t *, siovec_t const *, unsigned int, unixmessage_handler_func_t *, void *) ; +extern int skaclient_put (skaclient_t *, char const *, size_t, unixmessage_handler_func_t *, void *) ; +extern int skaclient_putv (skaclient_t *, struct iovec const *, unsigned int, unixmessage_handler_func_t *, void *) ; /* Writing and flushing */ @@ -103,9 +103,9 @@ extern int skaclient_sendmsgv_and_close (skaclient_t *, unixmessage_v_t const *, #define skaclient_sendmsgv(a, m, cb, result, deadline, stamp) skaclient_sendmsgv_and_close(a, m, unixmessage_bits_closenone, cb, result, deadline, stamp) #define skaclient_sendmsgv_g(a, m, cb, result, deadline) skaclient_sendmsgv(a, m, cb, result, (deadline), &STAMP) -extern int skaclient_send (skaclient_t *, char const *, unsigned int, unixmessage_handler_func_t *, void *, tain_t const *, tain_t *) ; +extern int skaclient_send (skaclient_t *, char const *, size_t, unixmessage_handler_func_t *, void *, tain_t const *, tain_t *) ; #define skaclient_send_g(a, s, len, cb, result, deadline) skaclient_send(a, s, len, cb, result, (deadline), &STAMP) -extern int skaclient_sendv (skaclient_t *, siovec_t const *, unsigned int, unixmessage_handler_func_t *, void *, tain_t const *, tain_t *) ; +extern int skaclient_sendv (skaclient_t *, struct iovec const *, unsigned int, unixmessage_handler_func_t *, void *, tain_t const *, tain_t *) ; #define skaclient_sendv_g(a, v, vlen, cb, result, deadline) skaclient_sendv(a, v, vlen, cb, result, (deadline), &STAMP) diff --git a/src/include/skalibs/skamisc.h b/src/include/skalibs/skamisc.h index 4b76fb7..cf33ec2 100644 --- a/src/include/skalibs/skamisc.h +++ b/src/include/skalibs/skamisc.h @@ -3,6 +3,7 @@ #ifndef SKAMISC_H #define SKAMISC_H +#include #include #include @@ -10,18 +11,18 @@ extern stralloc satmp ; extern int skagetln (buffer *, stralloc *, char) ; extern int skagetln_nofill (buffer *, stralloc *, char) ; -extern int skagetlnsep (buffer *, stralloc *, char const *, unsigned int) ; -extern int getlnmax (buffer *, char *, unsigned int, unsigned int *, char) ; -extern int getlnmaxsep (buffer *, char *, unsigned int, unsigned int *, char const *, unsigned int) ; +extern int skagetlnsep (buffer *, stralloc *, char const *, size_t) ; +extern int getlnmax (buffer *, char *, size_t, size_t *, char) ; +extern int getlnmaxsep (buffer *, char *, size_t, size_t *, char const *, size_t) ; extern int sauniquename (stralloc *) ; -extern int string_quote (stralloc *, char const *, unsigned int) ; -extern int string_quote_nodelim (stralloc *, char const *, unsigned int) ; -extern int string_quote_nodelim_mustquote (stralloc *, char const *, unsigned int, char const *, unsigned int) ; -extern int string_unquote (char *, unsigned int *, char const *, unsigned int, unsigned int *) ; -extern int string_unquote_nodelim (char *, char const *, unsigned int) ; -extern int string_unquote_withdelim (char *, unsigned int *, char const *, unsigned int, unsigned int *, char const *, unsigned int) ; +extern int string_quote (stralloc *, char const *, size_t) ; +extern int string_quote_nodelim (stralloc *, char const *, size_t) ; +extern int string_quote_nodelim_mustquote (stralloc *, char const *, size_t, char const *, size_t) ; +extern int string_unquote (char *, size_t *, char const *, size_t, size_t *) ; +extern ssize_t string_unquote_nodelim (char *, char const *, size_t) ; +extern int string_unquote_withdelim (char *, size_t *, char const *, size_t, size_t *, char const *, size_t) ; extern int string_format (stralloc *, char const *, char const *, char const *const *) ; diff --git a/src/include/skalibs/stddjb.h b/src/include/skalibs/stddjb.h index b1f54cb..1a2ccca 100644 --- a/src/include/skalibs/stddjb.h +++ b/src/include/skalibs/stddjb.h @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include diff --git a/src/include/skalibs/unix-timed.h b/src/include/skalibs/unix-timed.h index 17bda9d..84b5465 100644 --- a/src/include/skalibs/unix-timed.h +++ b/src/include/skalibs/unix-timed.h @@ -3,39 +3,40 @@ #ifndef UNIX_TIMED_H #define UNIX_TIMED_H +#include #include #include #include #include #include - /* Timed "blocking" operations (the fd must still be non-blocking) */ + /* Timed "blocking" operations (the fd must still be non-blocking) */ extern int timed_flush (void *, initfunc_t_ref, initfunc_t_ref, initfunc_t_ref, tain_t const *, tain_t *) ; #define timed_flush_g(b, getfd, isnonempty, flush, deadline) timed_flush(b, getfd, isnonempty, flush, (deadline_), &STAMP) -extern int timed_get (void *, initfunc_t_ref, initfunc_t_ref, tain_t const *, tain_t *) ; +extern ssize_t timed_get (void *, initfunc_t_ref, getfunc_t_ref, tain_t const *, tain_t *) ; #define timed_get_g (b, getfd, get, deadline) timed_get(b, getfd, get, (deadline), &STAMP) -extern int buffer_timed_fill (buffer *, tain_t const *, tain_t *) ; +extern ssize_t buffer_timed_fill (buffer *, tain_t const *, tain_t *) ; #define buffer_timed_fill_g(b, deadline) buffer_timed_fill(b, (deadline), &STAMP) extern int bufalloc_timed_flush (bufalloc *, tain_t const *, tain_t *) ; #define bufalloc_timed_flush_g(ba, deadline) bufalloc_timed_flush(ba, (deadline), &STAMP) extern int buffer_timed_flush (buffer *, tain_t const *, tain_t *) ; #define buffer_timed_flush_g(b, deadline) buffer_timed_flush(b, (deadline), &STAMP) -extern unsigned int buffer_timed_get (buffer *, char *, unsigned int, tain_t const *, tain_t *) ; +extern size_t buffer_timed_get (buffer *, char *, size_t, tain_t const *, tain_t *) ; #define buffer_timed_get_g(b, buf, buflen, deadline) buffer_timed_get(b, buf, buflen, (deadline), &STAMP) extern int timed_getln (buffer *, stralloc *, char, tain_t const *, tain_t *) ; #define timed_getln_g(b, sa, sep, deadline) timed_getln(b, sa, sep, (deadline), &STAMP) -extern int timed_getlnmax (buffer *, char *, unsigned int, unsigned int *, char, tain_t const *, tain_t *) ; +extern ssize_t timed_getlnmax (buffer *, char *, size_t, size_t *, char, tain_t const *, tain_t *) ; #define timed_getlnmax_g(b, max, maxlen, len, sep, deadline) timed_getlnmax(b, max, maxlen, len, sep, (deadline), &STAMP) extern int netstring_timed_get (buffer *, stralloc *, tain_t const *, tain_t *) ; #define netstring_timed_get_g(b, sa, deadline) netstring_timed_get(b, sa, (deadline), &STAMP) -extern int ipc_timed_send (int, char const *, unsigned int, tain_t const *, tain_t *) ; +extern int ipc_timed_send (int, char const *, size_t, tain_t const *, tain_t *) ; #define ipc_timed_send_g(fd, s, len, deadline) ipc_timed_send(fd, s, len, (deadline), &STAMP) -extern int ipc_timed_recv (int, char *, unsigned int, char *, tain_t const *, tain_t *) ; +extern ssize_t ipc_timed_recv (int, char *, size_t, char *, tain_t const *, tain_t *) ; #define ipc_timed_recv_g(fd, s, len, path, deadline) ipc_timed_recv(fd, s, len, path, (deadline), &STAMP) #endif diff --git a/src/include/skalibs/unix-transactional.h b/src/include/skalibs/unix-transactional.h index beb27b4..b1decb5 100644 --- a/src/include/skalibs/unix-transactional.h +++ b/src/include/skalibs/unix-transactional.h @@ -4,9 +4,9 @@ #define UNIX_TRANSACTIONAL_H #include +#include #include #include -#include #include /* Transactional/reliable filesystem operations */ @@ -28,16 +28,16 @@ extern int open_appendatb (int, char const *) ; extern int stat_at (int, char const *, struct stat *) ; extern int lstat_at (int, char const *, struct stat *) ; -extern unsigned int openreadnclose_at (int, char const *, char *, unsigned int) ; +extern size_t openreadnclose_at (int, char const *, char *, size_t) ; extern int openslurpclose_at (int, char const *, stralloc *) ; extern int opengetlnclose_at (int, char const *, stralloc *, int) ; -extern int openwritenclose (char const *, char const *, unsigned int) ; -extern int openwritenclose_devino (char const *, char const *, unsigned int, uint64 *, uint64 *) ; -extern int openwritenclose_tmp (char const *, char const *, unsigned int, stralloc *) ; -extern int openwritenclose_devino_tmp (char const *, char const *, unsigned int, uint64 *, uint64 *, stralloc *) ; -extern unsigned int openwritenclose_at (int, char const *, char const *, unsigned int) ; -extern unsigned int openwritevnclose_at (int, char const *, siovec_t const *, unsigned int) ; +extern int openwritenclose (char const *, char const *, size_t) ; +extern int openwritenclose_devino (char const *, char const *, size_t, dev_t *, ino_t *) ; +extern int openwritenclose_tmp (char const *, char const *, size_t, stralloc *) ; +extern int openwritenclose_devino_tmp (char const *, char const *, size_t, dev_t *, ino_t *, stralloc *) ; +extern size_t openwritenclose_at (int, char const *, char const *, size_t) ; +extern size_t openwritevnclose_at (int, char const *, struct iovec const *, unsigned int) ; extern int mkdir_unique (stralloc *, char const *, unsigned int) ; extern int atomic_rm_rf (char const *) ; diff --git a/src/include/skalibs/unixmessage.h b/src/include/skalibs/unixmessage.h index f971a65..4c98ed6 100644 --- a/src/include/skalibs/unixmessage.h +++ b/src/include/skalibs/unixmessage.h @@ -3,14 +3,14 @@ #ifndef UNIXMESSAGE_H #define UNIXMESSAGE_H -#include -#include +#include +#include +#include +#include #include #include -#include #include #include -#include #include @@ -20,7 +20,7 @@ typedef struct unixmessage_s unixmessage_t, *unixmessage_t_ref ; struct unixmessage_s { char *s ; - unsigned int len ; + size_t len ; int *fds ; unsigned int nfds ; } ; @@ -32,7 +32,7 @@ extern void unixmessage_drop (unixmessage_t const *) ; typedef struct unixmessage_v_s unixmessage_v_t, *unixmessage_v_t_ref ; struct unixmessage_v_s { - siovec_t *v ; + struct iovec *v ; unsigned int vlen ; int *fds ; unsigned int nfds ; @@ -40,7 +40,7 @@ struct unixmessage_v_s #define UNIXMESSAGE_V_ZERO { .v = 0, .vlen = 0, .fds = 0, .nfds = 0 } extern unixmessage_v_t const unixmessage_v_zero ; -#define UNIXMESSAGE_MAXSIZE (2U << 27) +#define UNIXMESSAGE_MAXSIZE (1U << 28) #define UNIXMESSAGE_MAXFDS 255 #define UNIXMESSAGE_BUFSIZE 2048 #define UNIXMESSAGE_AUXBUFSIZE (sizeof(int) * UNIXMESSAGE_MAXFDS + 1) @@ -58,9 +58,9 @@ struct unixmessage_sender_s int fd ; stralloc data ; genalloc fds ; /* int */ - genalloc offsets ; /* diuint */ - unsigned int head ; - unsigned int shorty ; + genalloc offsets ; /* disize */ + size_t head ; + size_t shorty ; unixmessage_sender_closecb_func_t_ref closecb ; void *closecbdata ; } ; @@ -104,8 +104,8 @@ struct unixmessage_receiver_s cbuffer_t auxb ; stralloc maindata ; stralloc auxdata ; - uint32 mainlen ; - uint16 auxlen ; + uint32_t mainlen ; + uint16_t auxlen ; unsigned int fds_ok : 2 ; } ; #define UNIXMESSAGE_RECEIVER_ZERO { .fd = -1, .mainb = CBUFFER_ZERO, .auxb = CBUFFER_ZERO, .maindata = STRALLOC_ZERO, .auxdata = STRALLOC_ZERO, .mainlen = 0, .auxlen = 0, .fds_ok = 3 } @@ -120,7 +120,7 @@ struct unixmessage_receiver_s .auxlen = 0, \ .fds_ok = 3 \ } -extern int unixmessage_receiver_init (unixmessage_receiver_t *, int, char *, unsigned int, char *, unsigned int) ; +extern int unixmessage_receiver_init (unixmessage_receiver_t *, int, char *, size_t, char *, size_t) ; extern void unixmessage_receiver_free (unixmessage_receiver_t *) ; #define unixmessage_receiver_fd(b) ((b)->fd) #define unixmessage_receiver_isempty(b) (cbuffer_isempty(&(b)->mainb) && cbuffer_isempty(&(b)->auxb)) @@ -137,8 +137,8 @@ extern int unixmessage_timed_receive (unixmessage_receiver_t *, unixmessage_t *, typedef int unixmessage_handler_func_t (unixmessage_t const *, void *) ; typedef unixmessage_handler_func_t *unixmessage_handler_func_t_ref ; -extern int unixmessage_handle (unixmessage_receiver_t *, unixmessage_handler_func_t *, void *) ; -extern int unixmessage_timed_handle (unixmessage_receiver_t *, unixmessage_handler_func_t *, void *, tain_t const *, tain_t *) ; +extern int unixmessage_handle (unixmessage_receiver_t *, unixmessage_handler_func_t_ref, void *) ; +extern int unixmessage_timed_handle (unixmessage_receiver_t *, unixmessage_handler_func_t_ref, void *, tain_t const *, tain_t *) ; #define unixmessage_timed_handle_g(b, f, p, deadline) unixmessage_timed_handle(b, f, p, (deadline), &STAMP) -- cgit v1.2.3