From 04905aaeffba2bc77866a4056dc3f2020a86bb26 Mon Sep 17 00:00:00 2001
From: Laurent Bercot
- If this option is given, then the low-level components -of libstddjb, such as byte_copy(), -will be built using independent, failsafe implementations; skalibs will -avoid relying on the libc when possible. -
- -- If this option is not given, then native libc primitives such as -memmove() -will be used for the low-levels components of libstddjb. This is the default. -
- -- This flag should be set if your libc has known bugs or you are uncertain -of it for some reason. Standard libcs on modern systems have been thoroughly -tested, so it's usually safe, and faster, to stick to the default. -
-diff --git a/doc/libbiguint/index.html b/doc/libbiguint/index.html index bce94ca..bbe724e 100644 --- a/doc/libbiguint/index.html +++ b/doc/libbiguint/index.html @@ -46,7 +46,7 @@ Definitions
- Just declare uint32 x[n] ; - n being the length of the + Just declare uint32_t x[n] ; - n being the length of the biguint. You could also allocate x in the heap, possibly using a -uint32 genalloc. In the following, -a biguint is always referred to as a uint32 * with its +uint32_t genalloc. In the following, +a biguint is always referred to as a uint32_t * with its unsigned int length ; it must always be pre-allocated.
@@ -77,7 +77,7 @@ EOVERFLOW.-uint32 *x ; +uint32_t *x ; unsigned int n ; bu_zero(x, n) ; @@ -90,9 +90,9 @@ unsigned int n ;Copying a biguint
-uint32 const *x ; +uint32_t const *x ; unsigned int xn ; -uint32 *y ; +uint32_t *y ; unsigned int yn ; bu_copy(y, yn, x, xn) ; @@ -107,7 +107,7 @@ the function returns 0 EOVERFLOW.Calculating the order
-uint32 const *x ; +uint32_t const *x ; unsigned int n ; unsigned int r ; @@ -122,9 +122,9 @@ unsigned int r ;Comparing two biguints
-uint32 const *a ; +uint32_t const *a ; unsigned int an ; -uint32 const *b ; +uint32_t const *b ; unsigned int bn ; int r ; @@ -143,7 +143,7 @@ I/O operationschar *s ; -uint32 const *x ; +uint32_t const *x ; unsigned int n ; bu_pack(s, x, n) ; @@ -160,7 +160,7 @@ are a little-endian representation of x.
char const *s ; -uint32 *x ; +uint32_t *x ; unsigned int n ; bu_unpack(s, x, n) ; @@ -178,7 +178,7 @@ big-endian.char *s ; -uint32 const *x ; +uint32_t const *x ; unsigned int n ; bu_fmt(s, x, n) ; @@ -195,7 +195,7 @@ starts with zeros. bu_fmt returns the number of bytes written.char const *s ; -uint32 *x ; +uint32_t *x ; unsigned int xn ; unsigned int z ; unsigned int len ; @@ -231,11 +231,11 @@ Arithmetic operationsAddition
-uint32 const *a ; +uint32_t const *a ; unsigned int an ; -uint32 const *b ; +uint32_t const *b ; unsigned int bn ; -uint32 *c ; +uint32_t *c ; unsigned int cn ; unsigned char carrybefore ; unsigned char carryafter ; @@ -258,11 +258,11 @@ written as (2^32)^cn - c and the function returns 0 EOVERFLOW.Multiplication
-uint32 const *a ; +uint32_t const *a ; unsigned int an ; -uint32 const *b ; +uint32_t const *b ; unsigned int bn ; -uint32 *c ; +uint32_t *c ; unsigned int cn ; bu_mul(c, cn, a, an, b, bn) ; @@ -278,13 +278,13 @@ If it is not the case, the result will be truncated and bu_mul will returnDivision
-uint32 const *a ; +uint32_t const *a ; unsigned int an ; -uint32 const *b ; +uint32_t const *b ; unsigned int bn ; -uint32 *q ; +uint32_t *q ; unsigned int qn ; -uint32 *r ; +uint32_t *r ; unsigned int rn ; bu_div(a, an, b, bn, q, qn, r, rn) ; @@ -302,11 +302,11 @@ quotient or the remainder, it returns 0 EOVERFLOW.GCD
-uint32 *r ; +uint32_t *r ; unsigned int rn ; -uint32 const *a ; +uint32_t const *a ; unsigned int an ; -uint32 const *b ; +uint32_t const *b ; unsigned int bn ; bu_gcd(r, rn, a, an, b, bn) ; @@ -327,7 +327,7 @@ negligible amount of CPU time.Left-shifts and right-shifts
-uint32 *x ; +uint32_t *x ; unsigned int xn ; unsigned char carryafter ; unsigned char carrybefore ; @@ -352,13 +352,13 @@ respectively bu_slbc(x, n, 0) and bu_srbc(x, n, 0).Modular operations
-uint32 const *a ; +uint32_t const *a ; unsigned int an ; -uint32 const *b ; +uint32_t const *b ; unsigned int bn ; -uint32 *c ; +uint32_t *c ; unsigned int cn ; -uint32 const *m ; +uint32_t const *m ; unsigned int mn ; bu_addmod(c, cn, a, an, b, bn, m, mn) ; diff --git a/doc/librandom/index.html b/doc/librandom/index.html index 26669fa..e431c57 100644 --- a/doc/librandom/index.html +++ b/doc/librandom/index.html @@ -46,7 +46,7 @@ function prototypes. unsigned char c ; uint32_t max ; uint32_t n ; - unsigned int b ; + size_t b ; char data[at least b] ; int r ; @@ -88,7 +88,7 @@ Bytes are not permuted inside chunks.-
void random_name (char *s, unsigned int n)
+void random_name (char *s, size_t n)
Writes n random readable ASCII characters into s: letters, numbers, hyphens or underscores. Does not terminate with a null character. diff --git a/doc/libstdcrypto/index.html b/doc/libstdcrypto/index.html index ca47ff9..cf45f20 100644 --- a/doc/libstdcrypto/index.html +++ b/doc/libstdcrypto/index.html @@ -33,6 +33,11 @@ operations are provided:
+ Please bear in mind that rc4 and md5 are broken, and that sha1 is about to be. +Do not use them in security-critical applications. +
+RC4Schedule ctx ; unsigned char const *key ; - unsigned int keylen ; + size_t keylen ; unsigned char const *in ; unsigned char *out ; - unsigned int len ; + size_t len ; rc4_init(&ctx, key, keylen) ; rc4(&ctx, in, out, len) ; @@ -75,7 +80,7 @@ MD5MD5Schedule ctx ; char const *message ; - unsigned int messagelen ; + size_t messagelen ; char digest[16] ; md5_init(&ctx) ; @@ -95,7 +100,7 @@ SHA1SHA1Schedule ctx ; char const *message ; - unsigned int messagelen ; + size_t messagelen ; unsigned char digest[20] ; sha1_init(&ctx) ; @@ -115,7 +120,7 @@ SHA256SHA256Schedule ctx ; char const *message ; - unsigned int messagelen ; + size_t messagelen ; char digest[32] ; sha256_init(&ctx) ; @@ -135,7 +140,7 @@ SHA512SHA512Schedule ctx ; char const *message ; - unsigned int messagelen ; + size_t messagelen ; char digest[64] ; sha512_init(&ctx) ; diff --git a/doc/libstddjb/alloc.html b/doc/libstddjb/alloc.html index 083b5de..615e67d 100644 --- a/doc/libstddjb/alloc.html +++ b/doc/libstddjb/alloc.html @@ -65,7 +65,7 @@ should favor them over basic interfaces like malloc().Functions
-
char *alloc (unsigned int len)
+char *alloc (size_t len)
Allocates a block of len bytes in the heap and returns a pointer to the start of the block (or NULL if it failed). Though the pointer type is char *, the block of memory is correctly aligned for any type @@ -80,7 +80,7 @@ Frees the block of heap memory pointed to by p.-
int alloc_realloc (char **p, unsigned int newlen)
+int alloc_realloc (char **p, size_t newlen)
Redimension the block of heap memory pointed to by *p to newlen bytes. The block may have to be moved, in which case *p will be modified. Normally returns 1; if an error occurred, @@ -89,7 +89,7 @@ modified.-
int alloc_re (char **p, unsigned int oldlen, unsigned int newlen)
+int alloc_re (char **p, size_t oldlen, size_t newlen)
Legacy interface for reallocation. It works like alloc_realloc, except that the original block length must be provided as the oldlen argument. diff --git a/doc/libstddjb/allreadwrite.html b/doc/libstddjb/allreadwrite.html index f71ce09..2ab8d8f 100644 --- a/doc/libstddjb/allreadwrite.html +++ b/doc/libstddjb/allreadwrite.html @@ -44,19 +44,15 @@ use higher-level APIs such as read() and write(). -Unless your system's int is 64-bit, skalibs - which has been -optimized for small systems - does not support IO operations of more than -2 GB of data, for the sake of simplicity. In any case, it's always -possible to send data in several smaller chunks.-
typedef unsigned int alliofunc_t (int fd, char *buf, unsigned int len)
+typedef size_t alliofunc_t (int fd, char *buf, size_t len)
This is the type of an IO operation that expects all of its len bytes to be sent or received, and that will loop around a lower-level IO function until either len bytes have been @@ -68,7 +64,7 @@ it means that an error has occurred and errno is set.Functions
-
int sanitize_read (int r)
+ssize_t sanitize_read (ssize_t r)
Reading functions such as read() and fd_read return a positive number when they succeed, -1 when they fail, and 0 when they read an EOF. No data available on the descriptor when reading in @@ -87,7 +83,7 @@ on reading.)-
unsigned int allreadwrite (iofunc_t *f, int fd, char *s, unsigned int len)
+size_t allreadwrite (iofunc_t *f, int fd, char *s, size_t len)
*f must be a basic reading or writing function such as fd_read or fd_write. allreadwrite() performs *f on fd, s and len until len @@ -99,35 +95,35 @@ set errno to EWOULDBLOCK or EAGAIN.-
int fd_read (int fd, char *s, unsigned int len)
+ssize_t fd_read (int fd, char *s, size_t len)
Safe wrapper around the read() function.-
int fd_write (int fd, char const *s, unsigned int len)
+ssize_t fd_write (int fd, char const *s, size_t len)
Safe wrapper around the write() function.-
int fd_recv (int fd, char *s, unsigned int len, unsigned int flags)
+ssize_t fd_recv (int fd, char *s, size_t len, unsigned int flags)
Safe wrapper around the recv() function.-
int fd_send (int fd, char const *s, unsigned int len, unsigned int flags)
+ssize_t fd_send (int fd, char const *s, size_t len, unsigned int flags)
Safe wrapper around the send() function.-
unsigned int allread (int fd, char *s, unsigned int len)
+size_t allread (int fd, char *s, size_t len)
Equivalent toallreadwrite(&fd_read, fd, s, len)
: attempts to read len bytes from fd into s, looping around fd_read() if necessary, until either len bytes are read or @@ -135,7 +131,7 @@ an error occurs. EOF is reported as EPIPE.-
unsigned int allwrite (int fd, char const *s, unsigned int len)
+size_t allwrite (int fd, char const *s, size_t len)
Equivalent toallreadwrite((iofunc_t *)&fd_write, fd, s, len)
: attempts to write len bytes from s to fd, looping around fd_write() if necessary, until either len bytes are diff --git a/doc/libstddjb/bitarray.html b/doc/libstddjb/bitarray.html index 0695ff1..b727975 100644 --- a/doc/libstddjb/bitarray.html +++ b/doc/libstddjb/bitarray.html @@ -47,69 +47,69 @@ can grow in size should be stored in aFunctions
-
unsigned int bitarray_div8 (unsigned int n)
+size_t bitarray_div8 (size_t n)
Returns the minimum number of bytes needed to store a field of n bits.-
void bitarray_clearsetn (unsigned char *s, unsigned int start, unsigned int len, int h)
+void bitarray_clearsetn (unsigned char *s, size_t start, size_t len, int h)
Sets (if h is nonzero) or clears (if h is zero) len bits in field s, starting at bit start.-
void bitarray_clearn (unsigned char *s, unsigned int start, unsigned int len)
+void bitarray_clearn (unsigned char *s, size_t start, size_t len)
Clears len bits in field s, starting at bit start.-
void bitarray_setn (unsigned char *s, unsigned int start, unsigned int len)
+void bitarray_setn (unsigned char *s, size_t start, size_t len)
Sets len bits in field s, starting at bit start.-
int bitarray_peek (unsigned char const *s, unsigned int n)
+int bitarray_peek (unsigned char const *s, size_t n)
Returns the value of the nth bit in field s.-
void bitarray_poke (unsigned char *s, unsigned int n, int h)
+void bitarray_poke (unsigned char *s, size_t n, int h)
Sets (if h is nonzero) or clears (if h is zero) the nth bit in field s.-
void bitarray_clear (unsigned char *s, unsigned int n)
+void bitarray_clear (unsigned char *s, size_t n)
Clears the nth bit in field s.-
void bitarray_set (unsigned char *s, unsigned int n)
+void bitarray_set (unsigned char *s, size_t n)
Sets the nth bit in field s.-
int bitarray_testandpoke (unsigned char *s, unsigned int n, int h)
+int bitarray_testandpoke (unsigned char *s, size_t n, int h)
Sets (if h is nonzero) or clears (if h is zero) the nth bit in field s, and returns the previous value of that bit.-
int bitarray_testandclear (unsigned char *s, unsigned int n)
+int bitarray_testandclear (unsigned char *s, size_t n)
Clear the nth bit in field s, and returns the previous value of that bit.-
int bitarray_testandset (unsigned char *s, unsigned int n)
+int bitarray_testandset (unsigned char *s, size_t n)
Sets the nth bit in field s, and returns the previous value of that bit.-
unsigned int bitarray_first (unsigned char const *s, unsigned int len, int h)
+size_t bitarray_first (unsigned char const *s, size_t len, int h)
Returns the number of the first set (if h is nonzero) or clear (if h is zero) bit in s, len being the total number of bits. If all bits in s are the negation of @@ -117,26 +117,26 @@ the total number of bits. If all bits in s are the negation of-
unsigned int bitarray_firstclear (unsigned char const *s, unsigned int len)
+size_t bitarray_firstclear (unsigned char const *s, size_t len)
Returns the number of the first clear bit in s, len being the total number of bits. If all bits in s are set, len is returned.-
unsigned int bitarray_firstclear_skip (unsigned char const *s, unsigned int len, unsigned int skip)
+size_t bitarray_firstclear_skip (unsigned char const *s, size_t len, size_t skip)
Like bitarray_firstclear, but the first skip bits are ignored: the function cannot return less than skip. It is a programming error if skip > len.-
unsigned int bitarray_firstset (unsigned char const *s, unsigned int len)
+size_t bitarray_firstset (unsigned char const *s, size_t len)
Returns the number of the first set bit in s, len being the total number of bits. If all bits in s are clear, len is returned.-
unsigned int bitarray_firstset_skip (unsigned char const *s, unsigned int len, unsigned int skip)
+size_t bitarray_firstset_skip (unsigned char const *s, size_t len, size_t skip)
Like bitarray_firstset, but the first skip bits are ignored: the function cannot return less than skip. It is a programming error if skip > len. diff --git a/doc/libstddjb/djbtime.html b/doc/libstddjb/djbtime.html index d20131e..869b90b 100644 --- a/doc/libstddjb/djbtime.html +++ b/doc/libstddjb/djbtime.html @@ -39,7 +39,7 @@ other time formats and user-friendly representations.
- int utc_from_tai (uint64 *u, tai_t const *t)
+ int utc_from_tai (uint64_t *u, tai_t const *t)
Converts the absolute TAI64 time in *t to an UTC time, stored in
*u as an unsigned 64-bit integer. *u is actually 2^62
plus the number of seconds since the Epoch.
@@ -61,7 +61,7 @@ error occurs.
- int tai_from_utc (tai_t *t, uint64 u)
+ int tai_from_utc (tai_t *t, uint64_t u)
Converts the UTC time in u, stored
as an unsigned 64-bit integer (2^62 plus the number of seconds since
the Epoch), to a TAI64 time in *t.
@@ -72,7 +72,7 @@ error occurs.
- int ntp_from_tain (uint64 *ntp, tain_t const *a)
+ int ntp_from_tain (uint64_t *ntp, tain_t const *a)
Converts the absolute TAI64N time in *a to a 64-bit NTP timestamp,
stored in *ntp. The higher 32 bits of *ntp represent a number
of seconds ; the lower 32 bits are the fractional part of the timestamp.
@@ -82,7 +82,7 @@ error occurs (for instance:
- int tain_from_ntp (tain_t *a, uint64 ntp)
+ int tain_from_ntp (tain_t *a, uint64_t ntp)
Converts the NTP timestamp in ntp to a TAI64N time in
*a.
The function returns 1 if it succeeds, or 0 (and sets errno) if an
@@ -110,7 +110,7 @@ in a struct tm).
- int localtm_from_utc (struct tm *tm, uint64 u, int lo)
+ int localtm_from_utc (struct tm *tm, uint64_t u, int lo)
Converts the UTC time in u to broken-down GMT (if
lo is zero) or local (if lo is nonzero) time in
*tm.
@@ -120,7 +120,7 @@ in a struct tm).
- int localtm_from_sysclock (struct tm *tm, uint64 u, int lo)
+ int localtm_from_sysclock (struct tm *tm, uint64_t u, int lo)
Converts the time in u to broken-down GMT (if
lo is zero) or local (if lo is nonzero) time in
*tm. u will be interpreted as a TAI-10 value (with
@@ -131,7 +131,7 @@ in a struct tm).
- int utc_from_localtm (uint64 *u, struct tm const *tm)
+ int utc_from_localtm (uint64_t *u, struct tm const *tm)
Converts the broken-down local time in *tm to an UTC value
in *u.
The function returns 1 if it succeeds, or 0 (and sets errno) if an
@@ -147,7 +147,7 @@ error occurs.
- int sysclock_from_localtm (uint64 *u, struct tm const *tm)
+ int sysclock_from_localtm (uint64_t *u, struct tm const *tm)
Converts the broken-down local time in *tm to a value
in *u - either TAI-10 or UTC depending on your system clock.
The function returns 1 if it succeeds, or 0 (and sets errno) if an
@@ -163,7 +163,7 @@ a broken-down time and a nanosecond count:
struct localtmn_s
{
struct tm tm ;
- uint32 nano ;
+ uint32_t nano ;
} ;
diff --git a/doc/libstddjb/djbunix.html b/doc/libstddjb/djbunix.html
index b698069..5e9cae1 100644
--- a/doc/libstddjb/djbunix.html
+++ b/doc/libstddjb/djbunix.html
@@ -140,7 +140,7 @@ Safe wrapper around
- int fd_chown (int fd, unsigned int uid, unsigned int gid)
+ int fd_chown (int fd, uid_t uid, gid_t gid)
Safe wrapper around
fchown().
This function requires root privileges.
@@ -177,7 +177,7 @@ in Linux 2.6.17 and later
- unsigned int fd_catn (int from, int to, unsigned int n)
+ size_t fd_catn (int from, int to, size_t n)
Synchronously copies at most n bytes from fd from to fd to.
Returns the total number of transmitted bytes; sets errno if this number
is lesser than n. EOF is reported as EPIPE. See above for zero-copy
@@ -319,16 +319,6 @@ group database. This is a privileged operation.
Returns -1 and sets errno if it fails; returns 0 if it succeeds.
- int prot_gid (int gid)
-Alias to setgid.
-
- int prot_uid (int uid)
-Alias to setuid.
-
@@ -382,7 +372,7 @@ simply exiting 0.
- void pathexec_r_name (char const *file, char const *const *argv, char const *const *envp, unsigned int envlen, char const *modifs, unsigned int modiflen)
+ void pathexec_r_name (char const *file, char const *const *argv, char const *const *envp, size_t envlen, char const *modifs, size_t modiflen)
Alters envp (which does not have to be NULL-terminated, but the
number envlen of elements must be provided) with the modifier
string modifs of length modiflen, then performs
@@ -390,7 +380,7 @@ string modifs of length modiflen, then performs
- void pathexec_r (char const *const *argv, char const *const *envp, unsigned int envlen, char const *modifs, unsigned int modiflen)
+ void pathexec_r (char const *const *argv, char const *const *envp, size_t envlen, char const *modifs, size_t modiflen)
Same as pathexec_r_name, except that the file argument is read from argv[0].
- void pathexec_fromenv (char const *const *argv, char const *const *envp, unsigned int envlen)
+ void pathexec_fromenv (char const *const *argv, char const *const *envp, size_t envlen)
Performs pathexec_r() with the given arguments and the hidden modifier
string.
- int doublefork ()
+ pid_t doublefork ()
Performs a double fork. Returns -1 if it fails (and
sets errno, EINTR meaning that the intermediate process
was killed by a signal), 0 if the current process is the grandchild,
@@ -512,7 +502,7 @@ be unchanged.
- int wait_nohang (int *wstat)
+ pid_t wait_nohang (int *wstat)
Instantly reaps one zombie, and stores the status information into
*wstat.
Returns the PID of the reaped zombie if it succeeds, 0 if there was
@@ -522,13 +512,13 @@ or -1 (and sets errno) if it fails.
- int waitpid_nointr (pid_t pid, int *wstat, int flags)
+ pid_t waitpid_nointr (pid_t pid, int *wstat, int flags)
Safe wrapper around
waitpid().
- int wait_pid_nohang (pid_t pid, int *wstat)
+ pid_t wait_pid_nohang (pid_t pid, int *wstat)
Instantly reaps an undetermined number of zombies until it finds pid.
Stores the status information for dead pid into *wstat.
Returns pid if it succeeds, 0 if there was
@@ -587,33 +577,27 @@ Returns 1 if it succeeds, and 0 (and sets errno) if it fails.
- int openreadclose (char const *file, stralloc *sa, unsigned int dummy)
-Legacy interface for openslurpclose(sa, file)
. The dummy
-argument is unused. Returns 0 if it succeeds, and -1 (and sets errno) if it fails.
-
- int openreadnclose (char const *file, char *s, unsigned int n)
+ ssize_t openreadnclose (char const *file, char *s, size_t n)
Reads at most n bytes from file file into preallocated
buffer s. Returns -1 (and sets errno) if it fails; else returns the
number of read bytes. If that number is not n, errno is set to EPIPE.
- int openreadnclose_nb (char const *file, char *s, unsigned int n)
+ ssize_t openreadnclose_nb (char const *file, char *s, size_t n)
Like openreadnclose, but can fail with EAGAIN if the file cannot be
immediately read (for instance if it's a named pipe or other special file).
- int openreadfileclose (char const *file, stralloc *sa, unsigned int n)
+ int openreadfileclose (char const *file, stralloc *sa, size_t n)
Reads at most n bytes from file file into the *sa
stralloc, which is grown (if needed) to just accommodate the file
size. Returns 1 if it succeeds and 0 (and sets errno) if it fails.
- int openwritenclose_unsafe_internal (char const *file, char const *s, unsigned int len, uint64 *dev, uint64 *ino, unsigned char dosync)
+ int openwritenclose_unsafe_internal (char const *file, char const *s, size_t len, dev_t *dev, ino_t *ino, int dosync)
Writes the n bytes stored at s into file file.
The previous contents of file are destroyed even if the function
fails. If dosync is nonzero, the new contents of file
@@ -623,16 +607,16 @@ The function returns 1 if it succeeds, or 0 (and sets errno) if it fails.
- int openwritenclose_unsafe (char const *file, char const *s, unsigned int len)
-int openwritenclose_unsafe_sync (char const *file, char const *s, unsigned int len)
-int openwritenclose_unsafe_devino (char const *file, char const *s, unsigned int len, uint64 *dev, uint64 *ino)
-int openwritenclose_unsafe_devino_sync (char const *file, char const *s, unsigned int len, uint64 *dev, uint64 *ino)
+ int openwritenclose_unsafe (char const *file, char const *s, size_t len)
+int openwritenclose_unsafe_sync (char const *file, char const *s, size_t len)
+int openwritenclose_unsafe_devino (char const *file, char const *s, size_t len, dev_t *dev, ino_t *ino)
+int openwritenclose_unsafe_devino_sync (char const *file, char const *s, size_t len, dev_t *dev, ino_t *ino)
Trivial shortcuts around openwritenclose_unsafe_internal(). The
reader can easily figure out what they do.
- int openwritenclose_suffix_internal (char const *file, char const *s, unsigned int len, uint64 *dev, uint64 *ino, unsigned char dosync, char const *suffix)
+ int openwritenclose_suffix_internal (char const *file, char const *s, size_t len, dev_t *dev, ino_t *ino, int dosync, char const *suffix)
Writes the n bytes stored at s into file file,
by first writing into filesuffix and atomically renaming
filesuffix to file. IOW, the old contents of file
@@ -645,43 +629,43 @@ The function returns 1 if it succeeds, or 0 (and sets errno) if it fails.
- int openwritenclose_suffix (char const *file, char const *s, unsigned int len, char const *suffix)
-int openwritenclose_suffix_sync (char const *file, char const *s, unsigned int len, char const *suffix)
-int openwritenclose_suffix_devino (char const *file, char const *s, unsigned int len, uint64 *dev, uint64 *ino, char const *suffix)
-int openwritenclose_suffix_devino_sync (char const *file, char const *s, unsigned int len, uint64 *dev, uint64 *ino, char const *suffix)
+ int openwritenclose_suffix (char const *file, char const *s, size_t len, char const *suffix)
+int openwritenclose_suffix_sync (char const *file, char const *s, size_t len, char const *suffix)
+int openwritenclose_suffix_devino (char const *file, char const *s, size_t len, dev_t *dev, ino_t *ino, char const *suffix)
+int openwritenclose_suffix_devino_sync (char const *file, char const *s, size_t len, dev_t *dev, ino_t *ino, char const *suffix)
Trivial shortcuts around openwritenclose_suffix_internal(). The
reader can easily figure out what they do.
- int openwritevnclose_unsafe_internal (char const *file, siovec_t const *v, unsigned int vlen, uint64 *dev, uint64 *ino, unsigned char dosync)
+ int openwritevnclose_unsafe_internal (char const *file, struct iovec const *v, unsigned int vlen, dev_t *dev, ino_t *ino, int dosync)
Like openwritenclose_unsafe_internal, but the content to
write is taken from a
-siovec_t scatter/gather array of vlen
+scatter/gather array of vlen
elements instead of a single string.
- int openwritevnclose_unsafe (char const *file, siovec_t const *v, unsigned int vlen)
-int openwritevnclose_unsafe_sync (char const *file, siovec_t const *v, unsigned int vlen)
-int openwritevnclose_unsafe_devino (char const *file, siovec_t const *v, unsigned int vlen, uint64 *dev, uint64 *ino)
-int openwritevnclose_unsafe_devino_sync (char const *file, siovec_t const *v, unsigned int vlen, uint64 *dev, uint64 *ino)
+ int openwritevnclose_unsafe (char const *file, struct iovec const *v, unsigned int vlen)
+int openwritevnclose_unsafe_sync (char const *file, struct iovec const *v, unsigned int vlen)
+int openwritevnclose_unsafe_devino (char const *file, struct iovec const *v, unsigned int vlen, dev_t *dev, ino_t *ino)
+int openwritevnclose_unsafe_devino_sync (char const *file, struct iovec const *v, unsigned int vlen, dev_t *dev, ino_t *ino)
Trivial wrappers around openwritevnclose_unsafe_internal().
- int openwritevnclose_suffix_internal (char const *file, siovec_t const *v, unsigned int vlen, uint64 *dev, uint64 *ino, unsigned char dosync, char const *suffix)
+ int openwritevnclose_suffix_internal (char const *file, struct iovec const *v, unsigned int vlen, dev_t *dev, ino_t *ino, int dosync, char const *suffix)
Like openwritenclose_suffix_internal, but the content to
write is taken from a
-siovec_t scatter/gather array of vlen
+scatter/gather array of vlen
elements instead of a single string.
- int openwritenclose_suffix (char const *file, char const *s, unsigned int len, char const *suffix)
-int openwritenclose_suffix_sync (char const *file, char const *s, unsigned int len, char const *suffix)
-int openwritenclose_suffix_devino (char const *file, char const *s, unsigned int len, uint64 *dev, uint64 *ino, char const *suffix)
-int openwritenclose_suffix_devino_sync (char const *file, char const *s, unsigned int len, uint64 *dev, uint64 *ino, char const *suffix)
+ int openwritenclose_suffix (char const *file, char const *s, size_t len, char const *suffix)
+int openwritenclose_suffix_sync (char const *file, char const *s, size_t len, char const *suffix)
+int openwritenclose_suffix_devino (char const *file, char const *s, size_t len, dev_t *dev, ino_t *ino, char const *suffix)
+int openwritenclose_suffix_devino_sync (char const *file, char const *s, size_t len, dev_t *dev, ino_t *ino, char const *suffix)
Trivial wrappers around openwritevnclose_suffix_internal().
- int rm_rf_in_tmp (stralloc *tmp, unsigned int n)
+ int rm_rf_in_tmp (stralloc *tmp, size_t n)
Deletes a filesystem subtree, using *tmp
as heap-allocated temporary space.
Returns 0 if it succeeds or -1 (and sets errno) if it fails.
@@ -763,14 +747,14 @@ Returns 0 if it succeeds and -1 (and sets errno) if it fails.
- int sabasename (stralloc *sa, char const *s, unsigned int len)
+ int sabasename (stralloc *sa, char const *s, size_t len)
Appends the basename of filename s (of length len)
to *sa.
Returns 1 if it succeeds and 0 (and sets errno) if it fails.
- int sadirname (stralloc *sa, char const *s, unsigned int len)
+ int sadirname (stralloc *sa, char const *s, size_t len)
Appends the dirname of filename s (of length len)
to *sa.
Returns 1 if it succeeds and 0 (and sets errno) if it fails.
diff --git a/doc/libstddjb/gccattributes.html b/doc/libstddjb/gccattributes.html
index 1e66aee..71a5e97 100644
--- a/doc/libstddjb/gccattributes.html
+++ b/doc/libstddjb/gccattributes.html
@@ -33,7 +33,7 @@ of gcc does not support the wanted attribute.
- extern unsigned int str_len (char const *) gccattr_pure ; + extern size_t str_len (char const *) gccattr_pure ;
diff --git a/doc/libstddjb/index.html b/doc/libstddjb/index.html index 6ecfeb2..63a786b 100644 --- a/doc/libstddjb/index.html +++ b/doc/libstddjb/index.html @@ -78,6 +78,9 @@ functions writing into buffers or skalibs/sgetopt.h: getopt()-style command-line options management
+libstddjb
+libskarnet
+skalibs
+Software
+skarnet.org
+
+ TODO: write this documentation page. (Sorry!) +
+ +diff --git a/doc/libstddjb/iopause.html b/doc/libstddjb/iopause.html index ff8727c..bcefb91 100644 --- a/doc/libstddjb/iopause.html +++ b/doc/libstddjb/iopause.html @@ -29,12 +29,12 @@ and implemented in the libskarnet.a or libskarnet.so library.
iopause is the skalibs API for event loop selection. It's a -wrapper around the system's +wrapper around the system's ppoll() or poll() (if available) or select() -(if poll() is unavailable) function. It -works around some system-dependent quirks; also it works with +(if neither ppoll() n or poll() is available) function. + It works around some system-dependent quirks; also it works with absolute dates instead of timeouts. This is a good thing: see below.
@@ -175,22 +175,23 @@ it is recommended to use this function instead of the lower-level
- iopause is an alias to either iopause_poll or -or iopause_select. By default, it is aliased to iopause_poll; to -alias it to iopause_select instead, configure skalibs with the ---enable-iopause-select option. + iopause is an alias to one of iopause_ppoll, iopause_poll or +iopause_select. It is always aliased to iopause_ppoll if +the ppoll() function is available on the system; else, it's aliased to +iopause_poll by default, and users can alias it to iopause_select +instead if they configure skalibs with the --enable-iopause-select option.
-Both iopause_poll and iopause_select are implemented on top of the -ppoll() system call -if it is available; but if it is not, then iopause_poll defaults to -poll(), -which has a more comfortable API than +poll() +has a more comfortable API than select(), -but a maximum precision of 1 millisecond which might not be enough for some applications; whereas -iopause_select defaults to select(), which incurs some CPU overhead for the -API conversion, but has a 1 microsecond precision. +but its maximum precision is 1 millisecond, which might not be enough for some applications; +using select() instead incurs some CPU overhead for the API conversion, but has a +1 microsecond precision. +ppoll() gets the best of +both worlds with the same interface model as poll() and a 1 nanosecond precision, +which is why skalibs always uses it when available.
diff --git a/doc/libstddjb/ip46.html b/doc/libstddjb/ip46.html index 8d13640..e0e95b3 100644 --- a/doc/libstddjb/ip46.html +++ b/doc/libstddjb/ip46.html @@ -74,21 +74,21 @@ except if IPv6 is unavailable, in which case it returns 0 ENOSYS.
- unsigned int ip46_fmt (char *s, ip46_t const *a)
+ size_t ip46_fmt (char *s, ip46_t const *a)
Formats the address in *a into the string s, which
must be preallocated. Returns the number of bytes written. The address
will be accordingly formatted as IPv4 or IPv6.
- unsigned int ip46_scan (char const *s, ip46_t *a)
+ size_t ip46_scan (char const *s, ip46_t *a)
Scans the string s for an IPv4 or IPv6 address. If it finds
one, writes it into *a and returns the number of bytes read.
If it cannot, returns 0.
- unsigned int ip46_scanlist (ip46_t *list, unsigned int max, char const *s, unsigned int *n)
+ size_t ip46_scanlist (ip46_t *list, size_t max, char const *s, size_t *n)
Scans the string s for a list of comma-, semicolon-, space-, tab- or
newline-separated IPv4 or IPv6 addresses, up to a maximum of max. It
stores them into the (preallocated) ip46_t array pointed to by list.
@@ -97,24 +97,24 @@ IP list at all), and stores the number of found and scanned addresses into *
- int socket_connect46 (int fd, ip46_t *a, uint16 port)
+ int socket_connect46 (int fd, ip46_t *a, uint16_t port)
Connects the socket fd to address *a and port port.
Returns 0 in case of success, and -1 (and sets errno) in case of failure.
- int socket_bind46 (int fd, ip46_t *a, uint16 port)
+ int socket_bind46 (int fd, ip46_t *a, uint16_t port)
Binds the socket fd to address *a and port port.
Returns 0 in case of success, and -1 (and sets errno) in case of failure.
- int socket_bind46_reuse (int fd, ip46_t *a, uint16 port)
+ int socket_bind46_reuse (int fd, ip46_t *a, uint16_t port)
Same as the previous function, with the SO_REUSEADDR option.
- int socket_deadlineconnstamp46 (int fd, ip46_t const *a, uint16 port, tain_t const *deadline, tain_t *stamp)
+ int socket_deadlineconnstamp46 (int fd, ip46_t const *a, uint16_t port, tain_t const *deadline, tain_t *stamp)
Attempts to synchronously connect the socket fd to address aa
and port port. Returns 1 if it succeeds and 0 (and sets errno)
if it fails. stamp must contain an accurate enough
@@ -124,35 +124,35 @@ returns 0 ETIMEDOUT.
- int socket_recv46 (int fd, char *s, unsigned int len, ip46_t *a, uint16 *port)
+ ssize_t socket_recv46 (int fd, char *s, size_t len, ip46_t *a, uint16_t *port)
Reads a datagram from socket fd. The message is stored into buffer s
of max length len, and stores the sender information into address *a
and port *port. Returns the length of the read datagram, or -1 if it fails.
- int socket_send46 (int fd, char const *s, unsigned int len, ip46_t const *a, uint16 port)
+ ssize_t socket_send46 (int fd, char const *s, size_t len, ip46_t const *a, uint16_t port)
Writes a datagram to socket fd. The message is read from buffer s
of length len, and the recipient information is address *a
and port port. Returns the number of written bytes, or -1 if it fails.
- int socket_local46 (int fd, ip46_t *a, uint16 *port)
+ int socket_local46 (int fd, ip46_t *a, uint16_t *port)
Gets the local information about bound socket fd: the local IP
address is stored into *a and the local port into *port.
Returns 0 in case of success, and -1 (and sets errno) in case of failure.
- int socket_remote46 (int fd, ip46_t *a, uint16 *port)
+ int socket_remote46 (int fd, ip46_t *a, uint16_t *port)
Gets the peer information about connected socket fd: the remote IP
address is stored into *a and the remote port into *port.
Returns 0 in case of success, and -1 (and sets errno) in case of failure.
- int socket_recvnb46 (int fd, char *s, unsigned int len, ip46_t *a, uint16 *port,
+
ssize_t socket_recvnb46 (int fd, char *s, size_t len, ip46_t *a, uint16_t *port,
tain_t const *deadline, tain_t *stamp)
Like socket_recv46, except that the function blocks until a datagram
is received. *stamp must be an accurate enough approximation of the
@@ -161,7 +161,7 @@ arrived by absolute date *deadline, the function returns -1 ETIMEOUT.
- int socket_sendnb46 (int fd, char const *s, unsigned int len, ip46_t const *a, uint16 port,
+
ssize_t socket_sendnb46 (int fd, char const *s, size_t len, ip46_t const *a, uint16_t port,
tain_t const *deadline, tain_t *stamp)
Like socket_send46, except that the function blocks until a datagram
has been effectively sent. *stamp must be an accurate enough approximation of the
diff --git a/doc/libstddjb/lolstdio.html b/doc/libstddjb/lolstdio.html
index 2ec923b..8971137 100644
--- a/doc/libstddjb/lolstdio.html
+++ b/doc/libstddjb/lolstdio.html
@@ -38,8 +38,8 @@ formatting but interacting with buffers or
Like any printf-style functions, the lolstdio functions are rather
complex and inefficient, and not recommended for general use; they are
provided as a quick and dirty way to debug or test things. Programmers
-are advised to use the type-specific formatting
-functions instead in production-quality code.
+are advised to use type-specific formatting functions instead in
+production-quality code.
diff --git a/doc/libstddjb/siovec.html b/doc/libstddjb/siovec.html new file mode 100644 index 0000000..c308d9a --- /dev/null +++ b/doc/libstddjb/siovec.html @@ -0,0 +1,28 @@ + +
+ + + +
+ + + + +
+