diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2017-03-08 09:39:11 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2017-03-08 09:39:11 +0000 |
commit | 04905aaeffba2bc77866a4056dc3f2020a86bb26 (patch) | |
tree | f66439aeb6cfe05268824ac890169e5cd306f3f3 /doc/libstddjb | |
parent | a5079576ae9007fb1ca7ebcc911b5fb035cd2d06 (diff) | |
download | skalibs-04905aaeffba2bc77866a4056dc3f2020a86bb26.tar.xz |
Update documentation for the types change, with some extra fixes
Also remove --enable-replace-libc from configure
Diffstat (limited to 'doc/libstddjb')
-rw-r--r-- | doc/libstddjb/alloc.html | 6 | ||||
-rw-r--r-- | doc/libstddjb/allreadwrite.html | 24 | ||||
-rw-r--r-- | doc/libstddjb/bitarray.html | 32 | ||||
-rw-r--r-- | doc/libstddjb/djbtime.html | 20 | ||||
-rw-r--r-- | doc/libstddjb/djbunix.html | 90 | ||||
-rw-r--r-- | doc/libstddjb/gccattributes.html | 2 | ||||
-rw-r--r-- | doc/libstddjb/index.html | 13 | ||||
-rw-r--r-- | doc/libstddjb/iopause.html | 31 | ||||
-rw-r--r-- | doc/libstddjb/ip46.html | 26 | ||||
-rw-r--r-- | doc/libstddjb/lolstdio.html | 4 | ||||
-rw-r--r-- | doc/libstddjb/siovec.html | 28 | ||||
-rw-r--r-- | doc/libstddjb/stralloc.html | 2 |
12 files changed, 143 insertions, 135 deletions
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 <tt>malloc()</tt>. <h2> Functions </h2> <p> -<code> char *alloc (unsigned int len) </code> <br /> +<code> char *alloc (size_t len) </code> <br /> Allocates a block of <em>len</em> bytes in the heap and returns a pointer to the start of the block (or NULL if it failed). Though the pointer type is <tt>char *</tt>, the block of memory is correctly aligned for any type @@ -80,7 +80,7 @@ Frees the block of heap memory pointed to by <em>p</em>. </p> <p> -<code> int alloc_realloc (char **p, unsigned int newlen) </code> <br /> +<code> int alloc_realloc (char **p, size_t newlen) </code> <br /> Redimension the block of heap memory pointed to by *<em>p</em> to <em>newlen</em> bytes. The block may have to be moved, in which case *<em>p</em> will be modified. Normally returns 1; if an error occurred, @@ -89,7 +89,7 @@ modified. </p> <p> -<code> int alloc_re (char **p, unsigned int oldlen, unsigned int newlen) </code> <br /> +<code> int alloc_re (char **p, size_t oldlen, size_t newlen) </code> <br /> Legacy interface for reallocation. It works like <tt>alloc_realloc</tt>, except that the original block length must be provided as the <em>oldlen</em> 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 <a href="buffer.html>buffer</a> and <h2> Function types </h2> <p> -<code> typedef int iofunc_t (int fd, char *buf, unsigned int len) </code> <br /> +<code> typedef ssize_t iofunc_t (int fd, char *buf, size_t len) </code> <br /> This is the simplified type of IO functions such as <a href="http://www.opengroup.org/onlinepubs/9699919799/functions/read.html">read()</a> and <a href="http://www.opengroup.org/onlinepubs/9699919799/functions/write.html">write()</a>. -Unless your system's <tt>int</tt> 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. </p> <p> -<code> typedef unsigned int alliofunc_t (int fd, char *buf, unsigned int len) </code> <br /> +<code> typedef size_t alliofunc_t (int fd, char *buf, size_t len) </code> <br /> This is the type of an IO operation that expects <em>all</em> of its <em>len</em> bytes to be sent or received, and that will loop around a lower-level IO function until either <em>len</em> bytes have been @@ -68,7 +64,7 @@ it means that an error has occurred and <tt>errno</tt> is set. <h2> Functions </h2> <p> -<code> int sanitize_read (int r) </code> <br /> +<code> ssize_t sanitize_read (ssize_t r) </code> <br /> Reading functions such as <tt>read()</tt> and <tt>fd_read</tt> 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.) </p> <p> -<code> unsigned int allreadwrite (iofunc_t *f, int fd, char *s, unsigned int len) </code> <br /> +<code> size_t allreadwrite (iofunc_t *f, int fd, char *s, size_t len) </code> <br /> *<em>f</em> must be a basic reading or writing function such as <tt>fd_read</tt> or <tt>fd_write</tt>. <tt>allreadwrite()</tt> performs *<em>f</em> on <em>fd</em>, <em>s</em> and <em>len</em> until <em>len</em> @@ -99,35 +95,35 @@ set errno to EWOULDBLOCK or EAGAIN. </p> <p> -<code> int fd_read (int fd, char *s, unsigned int len) </code> <br /> +<code> ssize_t fd_read (int fd, char *s, size_t len) </code> <br /> <a href="safewrappers.html">Safe wrapper</a> around the <a href="http://www.opengroup.org/onlinepubs/9699919799/functions/read.html">read()</a> function. </p> <p> -<code> int fd_write (int fd, char const *s, unsigned int len) </code> <br /> +<code> ssize_t fd_write (int fd, char const *s, size_t len) </code> <br /> <a href="safewrappers.html">Safe wrapper</a> around the <a href="http://www.opengroup.org/onlinepubs/9699919799/functions/write.html">write()</a> function. </p> <p> -<code> int fd_recv (int fd, char *s, unsigned int len, unsigned int flags) </code> <br /> +<code> ssize_t fd_recv (int fd, char *s, size_t len, unsigned int flags) </code> <br /> <a href="safewrappers.html">Safe wrapper</a> around the <a href="http://www.opengroup.org/onlinepubs/9699919799/functions/recv.html">recv()</a> function. </p> <p> -<code> int fd_send (int fd, char const *s, unsigned int len, unsigned int flags) </code> <br /> +<code> ssize_t fd_send (int fd, char const *s, size_t len, unsigned int flags) </code> <br /> <a href="safewrappers.html">Safe wrapper</a> around the <a href="http://www.opengroup.org/onlinepubs/9699919799/functions/send.html">send()</a> function. </p> <p> -<code> unsigned int allread (int fd, char *s, unsigned int len) </code> <br /> +<code> size_t allread (int fd, char *s, size_t len) </code> <br /> Equivalent to <code> allreadwrite(&fd_read, fd, s, len) </code>: attempts to read <em>len</em> bytes from <em>fd</em> into <em>s</em>, looping around <tt>fd_read()</tt> if necessary, until either <em>len</em> bytes are read or @@ -135,7 +131,7 @@ an error occurs. EOF is reported as EPIPE. </p> <p> -<code> unsigned int allwrite (int fd, char const *s, unsigned int len) </code> <br /> +<code> size_t allwrite (int fd, char const *s, size_t len) </code> <br /> Equivalent to <code> allreadwrite((iofunc_t *)&fd_write, fd, s, len) </code>: attempts to write <em>len</em> bytes from <em>s</em> to <em>fd</em>, looping around <tt>fd_write()</tt> if necessary, until either <em>len</em> 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 a <h2> Functions </h2> <p> -<code> unsigned int bitarray_div8 (unsigned int n) </code> <br /> +<code> size_t bitarray_div8 (size_t n) </code> <br /> Returns the minimum number of bytes needed to store a field of <em>n</em> bits. </p> <p> -<code> void bitarray_clearsetn (unsigned char *s, unsigned int start, unsigned int len, int h) </code> <br /> +<code> void bitarray_clearsetn (unsigned char *s, size_t start, size_t len, int h) </code> <br /> Sets (if <em>h</em> is nonzero) or clears (if <em>h</em> is zero) <em>len</em> bits in field <em>s</em>, starting at bit <em>start</em>. </p> <p> -<code> void bitarray_clearn (unsigned char *s, unsigned int start, unsigned int len) </code> <br /> +<code> void bitarray_clearn (unsigned char *s, size_t start, size_t len) </code> <br /> Clears <em>len</em> bits in field <em>s</em>, starting at bit <em>start</em>. </p> <p> -<code> void bitarray_setn (unsigned char *s, unsigned int start, unsigned int len) </code> <br /> +<code> void bitarray_setn (unsigned char *s, size_t start, size_t len) </code> <br /> Sets <em>len</em> bits in field <em>s</em>, starting at bit <em>start</em>. </p> <p> -<code> int bitarray_peek (unsigned char const *s, unsigned int n) </code> <br /> +<code> int bitarray_peek (unsigned char const *s, size_t n) </code> <br /> Returns the value of the <em>n</em>th bit in field <em>s</em>. </p> <p> -<code> void bitarray_poke (unsigned char *s, unsigned int n, int h) </code> <br /> +<code> void bitarray_poke (unsigned char *s, size_t n, int h) </code> <br /> Sets (if <em>h</em> is nonzero) or clears (if <em>h</em> is zero) the <em>n</em>th bit in field <em>s</em>. </p> <p> -<code> void bitarray_clear (unsigned char *s, unsigned int n) </code> <br /> +<code> void bitarray_clear (unsigned char *s, size_t n) </code> <br /> Clears the <em>n</em>th bit in field <em>s</em>. </p> <p> -<code> void bitarray_set (unsigned char *s, unsigned int n) </code> <br /> +<code> void bitarray_set (unsigned char *s, size_t n) </code> <br /> Sets the <em>n</em>th bit in field <em>s</em>. </p> <p> -<code> int bitarray_testandpoke (unsigned char *s, unsigned int n, int h) </code> <br /> +<code> int bitarray_testandpoke (unsigned char *s, size_t n, int h) </code> <br /> Sets (if <em>h</em> is nonzero) or clears (if <em>h</em> is zero) the <em>n</em>th bit in field <em>s</em>, and returns the previous value of that bit. </p> <p> -<code> int bitarray_testandclear (unsigned char *s, unsigned int n) </code> <br /> +<code> int bitarray_testandclear (unsigned char *s, size_t n) </code> <br /> Clear the <em>n</em>th bit in field <em>s</em>, and returns the previous value of that bit. </p> <p> -<code> int bitarray_testandset (unsigned char *s, unsigned int n) </code> <br /> +<code> int bitarray_testandset (unsigned char *s, size_t n) </code> <br /> Sets the <em>n</em>th bit in field <em>s</em>, and returns the previous value of that bit. </p> <p> -<code> unsigned int bitarray_first (unsigned char const *s, unsigned int len, int h) </code> <br /> +<code> size_t bitarray_first (unsigned char const *s, size_t len, int h) </code> <br /> Returns the number of the first set (if <em>h</em> is nonzero) or clear (if <em>h</em> is zero) bit in <em>s</em>, <em>len</em> being the total number of bits. If all bits in <em>s</em> are the negation of @@ -117,26 +117,26 @@ the total number of bits. If all bits in <em>s</em> are the negation of </p> <p> -<code> unsigned int bitarray_firstclear (unsigned char const *s, unsigned int len) </code> <br /> +<code> size_t bitarray_firstclear (unsigned char const *s, size_t len) </code> <br /> Returns the number of the first clear bit in <em>s</em>, <em>len</em> being the total number of bits. If all bits in <em>s</em> are set, <em>len</em> is returned. </p> <p> -<code> unsigned int bitarray_firstclear_skip (unsigned char const *s, unsigned int len, unsigned int skip) </code> <br /> +<code> size_t bitarray_firstclear_skip (unsigned char const *s, size_t len, size_t skip) </code> <br /> Like <tt>bitarray_firstclear</tt>, but the first <em>skip</em> bits are ignored: the function cannot return less than <em>skip</em>. It is a programming error if <em>skip</em> > <em>len</em>. </p> <p> -<code> unsigned int bitarray_firstset (unsigned char const *s, unsigned int len) </code> <br /> +<code> size_t bitarray_firstset (unsigned char const *s, size_t len) </code> <br /> Returns the number of the first set bit in <em>s</em>, <em>len</em> being the total number of bits. If all bits in <em>s</em> are clear, <em>len</em> is returned. </p> <p> -<code> unsigned int bitarray_firstset_skip (unsigned char const *s, unsigned int len, unsigned int skip) </code> <br /> +<code> size_t bitarray_firstset_skip (unsigned char const *s, size_t len, size_t skip) </code> <br /> Like <tt>bitarray_firstset</tt>, but the first <em>skip</em> bits are ignored: the function cannot return less than <em>skip</em>. It is a programming error if <em>skip</em> > <em>len</em>. 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. <ul> <li> TAI time with 1-second precision is represented as a <a href="tai.html">tai_t</a>. </li> <li> TAI time with more precision is represented as a <a href="tai.html">tain_t</a>. </li> - <li> UTC time is represented as an <a href="headers.html#uint64">unsigned 64-bit integer</a> + <li> UTC time is represented as an unsigned 64-bit integer equal to 2^62 added to the number of seconds since the Epoch. It's a trivial extension of the standard 32-bit Unix time that will expire in 2038. </li> <li> Broken-down GMT or local time with more than a 1-second precision is stored in a @@ -52,7 +52,7 @@ field and an unsigned long <em>nano</em> field. </li> <h3> UTC </h3> <p> -<code> int utc_from_tai (uint64 *u, tai_t const *t) </code> <br /> +<code> int utc_from_tai (uint64_t *u, tai_t const *t) </code> <br /> Converts the absolute TAI64 time in *<em>t</em> to an UTC time, stored in *<em>u</em> as an unsigned 64-bit integer. *<em>u</em> is actually 2^62 plus the number of seconds since the Epoch. @@ -61,7 +61,7 @@ error occurs. </p> <p> -<code> int tai_from_utc (tai_t *t, uint64 u) </code> <br /> +<code> int tai_from_utc (tai_t *t, uint64_t u) </code> <br /> Converts the UTC time in <em>u</em>, stored as an unsigned 64-bit integer (2^62 plus the number of seconds since the Epoch), to a TAI64 time in *<em>t</em>. @@ -72,7 +72,7 @@ error occurs. <h3> NTP </h3> <p> -<code> int ntp_from_tain (uint64 *ntp, tain_t const *a) </code> <br /> +<code> int ntp_from_tain (uint64_t *ntp, tain_t const *a) </code> <br /> Converts the absolute TAI64N time in *<em>a</em> to a 64-bit NTP timestamp, stored in *<em>ntp</em>. The higher 32 bits of *<em>ntp</em> represent a number of seconds ; the lower 32 bits are the fractional part of the timestamp. @@ -82,7 +82,7 @@ error occurs (for instance: </p> <p> -<code> int tain_from_ntp (tain_t *a, uint64 ntp) </code> <br /> +<code> int tain_from_ntp (tain_t *a, uint64_t ntp) </code> <br /> Converts the NTP timestamp in <em>ntp</em> to a TAI64N time in *<em>a</em>. The function returns 1 if it succeeds, or 0 (and sets errno) if an @@ -110,7 +110,7 @@ in a struct tm). </p> <p> -<code> int localtm_from_utc (struct tm *tm, uint64 u, int lo) </code> <br /> +<code> int localtm_from_utc (struct tm *tm, uint64_t u, int lo) </code> <br /> Converts the UTC time in <em>u</em> to broken-down GMT (if <em>lo</em> is zero) or local (if <em>lo</em> is nonzero) time in *<em>tm</em>. @@ -120,7 +120,7 @@ in a struct tm). </p> <p> -<code> int localtm_from_sysclock (struct tm *tm, uint64 u, int lo) </code> <br /> +<code> int localtm_from_sysclock (struct tm *tm, uint64_t u, int lo) </code> <br /> Converts the time in <em>u</em> to broken-down GMT (if <em>lo</em> is zero) or local (if <em>lo</em> is nonzero) time in *<em>tm</em>. <em>u</em> will be interpreted as a TAI-10 value (with @@ -131,7 +131,7 @@ in a struct tm). </p> <p> -<code> int utc_from_localtm (uint64 *u, struct tm const *tm) </code> <br /> +<code> int utc_from_localtm (uint64_t *u, struct tm const *tm) </code> <br /> Converts the broken-down local time in *<em>tm</em> to an UTC value in *<em>u</em>. The function returns 1 if it succeeds, or 0 (and sets errno) if an @@ -147,7 +147,7 @@ error occurs. </p> <p> -<code> int sysclock_from_localtm (uint64 *u, struct tm const *tm) </code> <br /> +<code> int sysclock_from_localtm (uint64_t *u, struct tm const *tm) </code> <br /> Converts the broken-down local time in *<em>tm</em> to a value in *<em>u</em> - 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 ; } ; </pre> 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 </p> <p> -<code> int fd_chown (int fd, unsigned int uid, unsigned int gid) </code> <br /> +<code> int fd_chown (int fd, uid_t uid, gid_t gid) </code> <br /> Safe wrapper around <a href="http://www.opengroup.org/onlinepubs/9699919799/functions/fchown.html">fchown()</a>. This function requires root privileges. @@ -177,7 +177,7 @@ in Linux 2.6.17 and later </li> </ul> <p> -<code> unsigned int fd_catn (int from, int to, unsigned int n) </code> <br /> +<code> size_t fd_catn (int from, int to, size_t n) </code> <br /> Synchronously copies at most <em>n</em> bytes from fd <em>from</em> to fd <em>to</em>. Returns the total number of transmitted bytes; sets errno if this number is lesser than <em>n</em>. 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. </p> -<p> -<code> int prot_gid (int gid) </code> <br /> -Alias to <a href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/setgid.html">setgid</a>. -</p> - -<p> -<code> int prot_uid (int uid) </code> <br /> -Alias to <a href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/setuid.html">setuid</a>. -</p> - <h3> Executable search and execution, and environment </h3> <p> @@ -382,7 +372,7 @@ simply exiting 0. </p> <p> -<code> void pathexec_r_name (char const *file, char const *const *argv, char const *const *envp, unsigned int envlen, char const *modifs, unsigned int modiflen) </code> <br /> +<code> void pathexec_r_name (char const *file, char const *const *argv, char const *const *envp, size_t envlen, char const *modifs, size_t modiflen) </code> <br /> Alters <em>envp</em> (which does not have to be NULL-terminated, but the number <em>envlen</em> of elements must be provided) with the modifier string <em>modifs</em> of length <em>modiflen</em>, then performs @@ -390,7 +380,7 @@ string <em>modifs</em> of length <em>modiflen</em>, then performs </p> <p> -<code> void pathexec_r (char const *const *argv, char const *const *envp, unsigned int envlen, char const *modifs, unsigned int modiflen) </code> <br /> +<code> void pathexec_r (char const *const *argv, char const *const *envp, size_t envlen, char const *modifs, size_t modiflen) </code> <br /> Same as <tt>pathexec_r_name</tt>, except that the <em>file</em> argument is read from <em>argv</em>[0]. </p> @@ -404,7 +394,7 @@ Returns 1 if it succeeds and 0 (and sets errno) if it fails. </p> <p> -<code> void pathexec_fromenv (char const *const *argv, char const *const *envp, unsigned int envlen) </code> <br /> +<code> void pathexec_fromenv (char const *const *argv, char const *const *envp, size_t envlen) </code> <br /> Performs <tt>pathexec_r()</tt> with the given arguments and the hidden modifier string. </p> @@ -430,7 +420,7 @@ to manipulate modifier strings and environments. <h3> Forking children </h3> <p> -<code> int doublefork () </code> <br /> +<code> pid_t doublefork () </code> <br /> 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. </p> <p> -<code> int wait_nohang (int *wstat) </code> <br /> +<code> pid_t wait_nohang (int *wstat) </code> <br /> Instantly reaps one zombie, and stores the status information into *<em>wstat</em>. 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. </p> <p> -<code> int waitpid_nointr (pid_t pid, int *wstat, int flags) </code> <br /> +<code> pid_t waitpid_nointr (pid_t pid, int *wstat, int flags) </code> <br /> Safe wrapper around <a href="http://www.opengroup.org/onlinepubs/9699919799/functions/waitpid.html">waitpid()</a>. </p> <p> -<code> int wait_pid_nohang (pid_t pid, int *wstat) </code> <br /> +<code> pid_t wait_pid_nohang (pid_t pid, int *wstat) </code> <br /> Instantly reaps an undetermined number of zombies until it finds <em>pid</em>. Stores the status information for dead <em>pid</em> into *<em>wstat</em>. Returns <em>pid</em> if it succeeds, 0 if there was @@ -587,33 +577,27 @@ Returns 1 if it succeeds, and 0 (and sets errno) if it fails. </p> <p> -<code> int openreadclose (char const *file, stralloc *sa, unsigned int dummy) </code> <br /> -Legacy interface for <code>openslurpclose(sa, file)</code>. The <em>dummy</em> -argument is unused. Returns 0 if it succeeds, and -1 (and sets errno) if it fails. -</p> - -<p> -<code> int openreadnclose (char const *file, char *s, unsigned int n) </code> <br /> +<code> ssize_t openreadnclose (char const *file, char *s, size_t n) </code> <br /> Reads at most <em>n</em> bytes from file <em>file</em> into preallocated buffer <em>s</em>. Returns -1 (and sets errno) if it fails; else returns the number of read bytes. If that number is not <em>n</em>, errno is set to EPIPE. </p> <p> -<code> int openreadnclose_nb (char const *file, char *s, unsigned int n) </code> <br /> +<code> ssize_t openreadnclose_nb (char const *file, char *s, size_t n) </code> <br /> Like <tt>openreadnclose</tt>, but can fail with EAGAIN if the file cannot be immediately read (for instance if it's a named pipe or other special file). </p> <p> -<code> int openreadfileclose (char const *file, stralloc *sa, unsigned int n) </code> <br /> +<code> int openreadfileclose (char const *file, stralloc *sa, size_t n) </code> <br /> Reads at most <em>n</em> bytes from file <em>file</em> into the *<em>sa</em> stralloc, which is grown (if needed) to <em>just</em> accommodate the file size. Returns 1 if it succeeds and 0 (and sets errno) if it fails. </p> <p> -<code> int openwritenclose_unsafe_internal (char const *file, char const *s, unsigned int len, uint64 *dev, uint64 *ino, unsigned char dosync) </code> <br /> +<code> int openwritenclose_unsafe_internal (char const *file, char const *s, size_t len, dev_t *dev, ino_t *ino, int dosync) </code> <br /> Writes the <em>n</em> bytes stored at <em>s</em> into file <em>file</em>. The previous contents of <em>file</em> are destroyed even if the function fails. If <em>dosync</em> is nonzero, the new contents of <em>file</em> @@ -623,16 +607,16 @@ The function returns 1 if it succeeds, or 0 (and sets errno) if it fails. </p> <p> -<code> int openwritenclose_unsafe (char const *file, char const *s, unsigned int len) <br /> -int openwritenclose_unsafe_sync (char const *file, char const *s, unsigned int len) <br /> -int openwritenclose_unsafe_devino (char const *file, char const *s, unsigned int len, uint64 *dev, uint64 *ino) <br /> -int openwritenclose_unsafe_devino_sync (char const *file, char const *s, unsigned int len, uint64 *dev, uint64 *ino) </code> <br /> +<code> int openwritenclose_unsafe (char const *file, char const *s, size_t len) <br /> +int openwritenclose_unsafe_sync (char const *file, char const *s, size_t len) <br /> +int openwritenclose_unsafe_devino (char const *file, char const *s, size_t len, dev_t *dev, ino_t *ino) <br /> +int openwritenclose_unsafe_devino_sync (char const *file, char const *s, size_t len, dev_t *dev, ino_t *ino) </code> <br /> Trivial shortcuts around <tt>openwritenclose_unsafe_internal()</tt>. The reader can easily figure out what they do. </p> <p> -<code> int openwritenclose_suffix_internal (char const *file, char const *s, unsigned int len, uint64 *dev, uint64 *ino, unsigned char dosync, char const *suffix) </code> <br /> +<code> int openwritenclose_suffix_internal (char const *file, char const *s, size_t len, dev_t *dev, ino_t *ino, int dosync, char const *suffix) </code> <br /> Writes the <em>n</em> bytes stored at <em>s</em> into file <em>file</em>, by first writing into <em>filesuffix</em> and atomically renaming <em>filesuffix</em> to <em>file</em>. IOW, the old contents of <em>file</em> @@ -645,43 +629,43 @@ The function returns 1 if it succeeds, or 0 (and sets errno) if it fails. </p> <p> -<code> int openwritenclose_suffix (char const *file, char const *s, unsigned int len, char const *suffix) <br /> -int openwritenclose_suffix_sync (char const *file, char const *s, unsigned int len, char const *suffix) <br /> -int openwritenclose_suffix_devino (char const *file, char const *s, unsigned int len, uint64 *dev, uint64 *ino, char const *suffix) <br /> -int openwritenclose_suffix_devino_sync (char const *file, char const *s, unsigned int len, uint64 *dev, uint64 *ino, char const *suffix) </code> <br /> +<code> int openwritenclose_suffix (char const *file, char const *s, size_t len, char const *suffix) <br /> +int openwritenclose_suffix_sync (char const *file, char const *s, size_t len, char const *suffix) <br /> +int openwritenclose_suffix_devino (char const *file, char const *s, size_t len, dev_t *dev, ino_t *ino, char const *suffix) <br /> +int openwritenclose_suffix_devino_sync (char const *file, char const *s, size_t len, dev_t *dev, ino_t *ino, char const *suffix) </code> <br /> Trivial shortcuts around <tt>openwritenclose_suffix_internal()</tt>. The reader can easily figure out what they do. </p> <p> -<code> int openwritevnclose_unsafe_internal (char const *file, siovec_t const *v, unsigned int vlen, uint64 *dev, uint64 *ino, unsigned char dosync) </code> <br /> +<code> int openwritevnclose_unsafe_internal (char const *file, struct iovec const *v, unsigned int vlen, dev_t *dev, ino_t *ino, int dosync) </code> <br /> Like <tt>openwritenclose_unsafe_internal</tt>, but the content to write is taken from a -<a href="siovec.html">siovec_t</a> scatter/gather array of <em>vlen</em> +<a href="siovec.html">scatter/gather array</a> of <em>vlen</em> elements instead of a single string. </p> <p> -<code> int openwritevnclose_unsafe (char const *file, siovec_t const *v, unsigned int vlen) <br /> -int openwritevnclose_unsafe_sync (char const *file, siovec_t const *v, unsigned int vlen) <br /> -int openwritevnclose_unsafe_devino (char const *file, siovec_t const *v, unsigned int vlen, uint64 *dev, uint64 *ino) <br /> -int openwritevnclose_unsafe_devino_sync (char const *file, siovec_t const *v, unsigned int vlen, uint64 *dev, uint64 *ino) </code> <br /> +<code> int openwritevnclose_unsafe (char const *file, struct iovec const *v, unsigned int vlen) <br /> +int openwritevnclose_unsafe_sync (char const *file, struct iovec const *v, unsigned int vlen) <br /> +int openwritevnclose_unsafe_devino (char const *file, struct iovec const *v, unsigned int vlen, dev_t *dev, ino_t *ino) <br /> +int openwritevnclose_unsafe_devino_sync (char const *file, struct iovec const *v, unsigned int vlen, dev_t *dev, ino_t *ino) </code> <br /> Trivial wrappers around <tt>openwritevnclose_unsafe_internal()</tt>. </p> <p> -<code> int openwritevnclose_suffix_internal (char const *file, siovec_t const *v, unsigned int vlen, uint64 *dev, uint64 *ino, unsigned char dosync, char const *suffix) </code> <br /> +<code> 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) </code> <br /> Like <tt>openwritenclose_suffix_internal</tt>, but the content to write is taken from a -<a href="siovec.html">siovec_t</a> scatter/gather array of <em>vlen</em> +<a href="siovec.html">scatter/gather array</a> of <em>vlen</em> elements instead of a single string. </p> <p> -<code> int openwritenclose_suffix (char const *file, char const *s, unsigned int len, char const *suffix) <br /> -int openwritenclose_suffix_sync (char const *file, char const *s, unsigned int len, char const *suffix) <br /> -int openwritenclose_suffix_devino (char const *file, char const *s, unsigned int len, uint64 *dev, uint64 *ino, char const *suffix) <br /> -int openwritenclose_suffix_devino_sync (char const *file, char const *s, unsigned int len, uint64 *dev, uint64 *ino, char const *suffix) </code> <br /> +<code> int openwritenclose_suffix (char const *file, char const *s, size_t len, char const *suffix) <br /> +int openwritenclose_suffix_sync (char const *file, char const *s, size_t len, char const *suffix) <br /> +int openwritenclose_suffix_devino (char const *file, char const *s, size_t len, dev_t *dev, ino_t *ino, char const *suffix) <br /> +int openwritenclose_suffix_devino_sync (char const *file, char const *s, size_t len, dev_t *dev, ino_t *ino, char const *suffix) </code> <br /> Trivial wrappers around <tt>openwritevnclose_suffix_internal()</tt>. </p> @@ -706,7 +690,7 @@ Returns 0 if it succeeds or -1 (and sets errno) if it fails. </p> <p> -<code> int rm_rf_in_tmp (stralloc *tmp, unsigned int n) </code> <br /> +<code> int rm_rf_in_tmp (stralloc *tmp, size_t n) </code> <br /> Deletes a filesystem subtree, using *<em>tmp</em> 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. </p> <p> -<code> int sabasename (stralloc *sa, char const *s, unsigned int len) </code> <br /> +<code> int sabasename (stralloc *sa, char const *s, size_t len) </code> <br /> Appends the basename of filename <em>s</em> (of length <em>len</em>) to *<em>sa</em>. Returns 1 if it succeeds and 0 (and sets errno) if it fails. </p> <p> -<code> int sadirname (stralloc *sa, char const *s, unsigned int len) </code> <br /> +<code> int sadirname (stralloc *sa, char const *s, size_t len) </code> <br /> Appends the dirname of filename <em>s</em> (of length <em>len</em>) to *<em>sa</em>. 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. </p> <pre> - extern unsigned int str_len (char const *) gccattr_pure ; + extern size_t str_len (char const *) gccattr_pure ; </pre> <p> 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 <a href="buffer.html">buffers</a> or <a href="bufalloc.ht how to safely handle signals in event loops) </li> <li> <a href="sgetopt.html">skalibs/sgetopt.h</a>: <tt>getopt()</tt>-style command-line options management </li> <li> <a href="sig.html">skalibs/sig.h</a>: safe signal management </li> + <li> <a href="siovec.html">skalibs/siovec.h</a>: scatter/gather IO primitives working with an +<a href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_uio.h.html">iovec</a> +structure </li> <li> <a href="skamisc.html">skalibs/skamisc.h</a>: general string quoting and parsing; miscellaneous, unclassifiable functions </li> <li> <a href="socket.html">skalibs/socket.h</a>: INET domain sockets </li> <li> <a href="stralloc.html">skalibs/stralloc.h</a>: advanced management of dynamically allocated strings </li> @@ -97,11 +100,9 @@ includes them. <li> skalibs/uint16.h: operations with 16-bit unsigned integers </li> <li> skalibs/uint32.h: operations with 32-bit unsigned integers </li> <li> skalibs/uint64.h: operations with 64-bit unsigned integers </li> - <li> skalibs/ushort.h: portable helpers for the "unsigned short" basic type </li> - <li> skalibs/uint.h: portable helpers for the "unsigned int" basic type </li> - <li> skalibs/ulong.h: portable helpers for the "unsigned long" basic type </li> + <li> skalibs/types.h: portable helpers for common Unix types: size_t, +uid_t, gid_t, pid_t, time_t, dev_t and ino_t. </li> <li> skalibs/error.h: portable macros for errno management </li> - <li> skalibs/gidstuff.h: helpers for the "gid_t" type </li> <li> skalibs/setgroups.h: stub for the setgroups() function, for systems that do not define it</li> <li> <a href="ip46.html">skalibs/ip46.h</a>: IPv4/IPv6 abstraction layer </li> </ul> @@ -115,12 +116,10 @@ are not associated with any code and are mostly self-explanatory: <li> <a href="gccattributes.html">skalibs/gccattributes.h</a>: wrappers around a few GCC-specific optimizations </li> <li> skalibs/diuint.h: for associative arrays of unsigned integers </li> <li> skalibs/diuint32.h: for associative arrays of 32-bit unsigned integers </li> + <li> skalibs/disize.h: for associative arrays of size_t </li> <li> skalibs/environ.h: declaration of the <em>environ</em> variable </li> <li> skalibs/nsig.h: the number of system signals, for systems that do not define it </li> <li> skalibs/nonposix.h: feature test macros for non-POSIX-compliant systems </li> - <li> skalibs/siovec.h: -<a href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_uio.h.html">iovec</a>-like -structure for scatter/gather IO operations </li> </ul> </body> 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 <tt>libskarnet.a</tt> or <tt>libskarnet.so</tt> library. <p> <tt>iopause</tt> is the skalibs API for event loop selection. It's a -wrapper around the system's +wrapper around the system's <tt>ppoll()</tt> or <a href="http://www.opengroup.org/onlinepubs/9699919799/functions/poll.html">poll()</a> (if available) or <a href="http://www.opengroup.org/onlinepubs/9699919799/functions/select.html">select()</a> -(if <tt>poll()</tt> is unavailable) function. It -works around some system-dependent quirks; also it works with +(if neither <tt>ppoll()</tt> n or <tt>poll()</tt> is available) function. + It works around some system-dependent quirks; also it works with <em>absolute dates</em> instead of timeouts. This is a good thing: see below. </p> @@ -175,22 +175,23 @@ it is recommended to use this function instead of the lower-level <h3> Underlying implementations </h3> <p> - <tt>iopause</tt> is an alias to either <tt>iopause_poll</tt> or -or <tt>iopause_select</tt>. By default, it is aliased to <tt>iopause_poll</tt>; to -alias it to <tt>iopause_select</tt> instead, configure skalibs with the -<tt>--enable-iopause-select</tt> option. + <tt>iopause</tt> is an alias to one of <tt>iopause_ppoll</tt>, <tt>iopause_poll</tt> or +<tt>iopause_select</tt>. It is always aliased to <tt>iopause_ppoll</tt> if +the <tt>ppoll()</tt> function is available on the system; else, it's aliased to +<tt>iopause_poll</tt> by default, and users can alias it to <tt>iopause_select</tt> +instead if they configure skalibs with the <tt>--enable-iopause-select</tt> option. </p> <p> -Both <tt>iopause_poll</tt> and <tt>iopause_select</tt> are implemented on top of the -<a href="http://man7.org/linux/man-pages/man2/ppoll.2.html">ppoll()</a> system call -if it is available; but if it is not, then <tt>iopause_poll</tt> defaults to -<a href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/poll.html">poll()</a>, -which has a more comfortable API than +<a href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/poll.html">poll()</a> +has a more comfortable API than <a href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/select.html">select()</a>, -but a maximum precision of 1 millisecond which might not be enough for some applications; whereas -<tt>iopause_select</tt> 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 <tt>select()</tt> instead incurs some CPU overhead for the API conversion, but has a +1 microsecond precision. +<a href="http://man7.org/linux/man-pages/man2/poll.2.html">ppoll()</a> gets the best of +both worlds with the same interface model as <tt>poll()</tt> and a 1 nanosecond precision, +which is why skalibs always uses it when available. </p> </body> 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. </p> <p> -<code> unsigned int ip46_fmt (char *s, ip46_t const *a) </code> <br /> +<code> size_t ip46_fmt (char *s, ip46_t const *a) </code> <br /> Formats the address in *<em>a</em> into the string <em>s</em>, which must be preallocated. Returns the number of bytes written. The address will be accordingly formatted as IPv4 or IPv6. </p> <p> -<code> unsigned int ip46_scan (char const *s, ip46_t *a) </code> <br /> +<code> size_t ip46_scan (char const *s, ip46_t *a) </code> <br /> Scans the string <em>s</em> for an IPv4 or IPv6 address. If it finds one, writes it into *<em>a</em> and returns the number of bytes read. If it cannot, returns 0. </p> <p> -<code> unsigned int ip46_scanlist (ip46_t *list, unsigned int max, char const *s, unsigned int *n) </code> <br /> +<code> size_t ip46_scanlist (ip46_t *list, size_t max, char const *s, size_t *n) </code> <br /> Scans the string <em>s</em> for a list of comma-, semicolon-, space-, tab- or newline-separated IPv4 or IPv6 addresses, up to a maximum of <em>max</em>. It stores them into the (preallocated) ip46_t array pointed to by <em>list</em>. @@ -97,24 +97,24 @@ IP list at all), and stores the number of found and scanned addresses into *<em> </p> <p> -<code> int socket_connect46 (int fd, ip46_t *a, uint16 port) </code> <br /> +<code> int socket_connect46 (int fd, ip46_t *a, uint16_t port) </code> <br /> Connects the socket <em>fd</em> to address *<em>a</em> and port <em>port</em>. Returns 0 in case of success, and -1 (and sets errno) in case of failure. </p> <p> -<code> int socket_bind46 (int fd, ip46_t *a, uint16 port) </code> <br /> +<code> int socket_bind46 (int fd, ip46_t *a, uint16_t port) </code> <br /> Binds the socket <em>fd</em> to address *<em>a</em> and port <em>port</em>. Returns 0 in case of success, and -1 (and sets errno) in case of failure. </p> <p> -<code> int socket_bind46_reuse (int fd, ip46_t *a, uint16 port) </code> <br /> +<code> int socket_bind46_reuse (int fd, ip46_t *a, uint16_t port) </code> <br /> Same as the previous function, with the SO_REUSEADDR option. </p> <p> -<code> int socket_deadlineconnstamp46 (int fd, ip46_t const *a, uint16 port, tain_t const *deadline, tain_t *stamp) </code> <br /> +<code> int socket_deadlineconnstamp46 (int fd, ip46_t const *a, uint16_t port, tain_t const *deadline, tain_t *stamp) </code> <br /> Attempts to synchronously connect the socket <em>fd</em> to address a<em>a</em> and port <em>port</em>. Returns 1 if it succeeds and 0 (and sets errno) if it fails. <em>stamp</em> must contain an accurate enough @@ -124,35 +124,35 @@ returns 0 ETIMEDOUT. </p> <p> -<code> int socket_recv46 (int fd, char *s, unsigned int len, ip46_t *a, uint16 *port) </code> <br /> +<code> ssize_t socket_recv46 (int fd, char *s, size_t len, ip46_t *a, uint16_t *port) </code> <br /> Reads a datagram from socket <em>fd</em>. The message is stored into buffer <em>s</em> of max length <em>len</em>, and stores the sender information into address *<em>a</em> and port *<em>port</em>. Returns the length of the read datagram, or -1 if it fails. </p> <p> -<code> int socket_send46 (int fd, char const *s, unsigned int len, ip46_t const *a, uint16 port) </code> <br /> +<code> ssize_t socket_send46 (int fd, char const *s, size_t len, ip46_t const *a, uint16_t port) </code> <br /> Writes a datagram to socket <em>fd</em>. The message is read from buffer <em>s</em> of length <em>len</em>, and the recipient information is address *<em>a</em> and port <em>port</em>. Returns the number of written bytes, or -1 if it fails. </p> <p> -<code> int socket_local46 (int fd, ip46_t *a, uint16 *port) </code> <br /> +<code> int socket_local46 (int fd, ip46_t *a, uint16_t *port) </code> <br /> Gets the local information about bound socket <em>fd</em>: the local IP address is stored into *<em>a</em> and the local port into *<em>port</em>. Returns 0 in case of success, and -1 (and sets errno) in case of failure. </p> <p> -<code> int socket_remote46 (int fd, ip46_t *a, uint16 *port) </code> <br /> +<code> int socket_remote46 (int fd, ip46_t *a, uint16_t *port) </code> <br /> Gets the peer information about connected socket <em>fd</em>: the remote IP address is stored into *<em>a</em> and the remote port into *<em>port</em>. Returns 0 in case of success, and -1 (and sets errno) in case of failure. </p> <p> -<code> int socket_recvnb46 (int fd, char *s, unsigned int len, ip46_t *a, uint16 *port, +<code> ssize_t socket_recvnb46 (int fd, char *s, size_t len, ip46_t *a, uint16_t *port, tain_t const *deadline, tain_t *stamp) </code> <br /> Like <tt>socket_recv46</tt>, except that the function blocks until a datagram is received. *<em>stamp</em> must be an accurate enough approximation of the @@ -161,7 +161,7 @@ arrived by absolute date *<em>deadline</em>, the function returns -1 ETIMEOUT. </p> <p> -<code> int socket_sendnb46 (int fd, char const *s, unsigned int len, ip46_t const *a, uint16 port, +<code> 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) </code> <br /> Like <tt>socket_send46</tt>, except that the function blocks until a datagram has been effectively sent. *<em>stamp</em> 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 <a href="buffer.html">buffers</a> 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 <a href="fmtscan.html">type-specific formatting -functions</a> instead in production-quality code. +are advised to use type-specific formatting functions instead in +production-quality code. </p> <p> 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 @@ +<html> + <head> + <meta name="viewport" content="width=device-width, initial-scale=1.0" /> + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> + <meta http-equiv="Content-Language" content="en" /> + <title>skalibs: the siovec header</title> + <meta name="Description" content="skalibs: the siovec header" /> + <meta name="Keywords" content="skalibs header siovec struct iovec scatter gather array I/O" /> + <!-- <link rel="stylesheet" type="text/css" href="http://skarnet.org/default.css" /> --> + </head> +<body> + +<p> +<a href="index.html">libstddjb</a><br /> +<a href="../libskarnet.html">libskarnet</a><br /> +<a href="../index.html">skalibs</a><br /> +<a href="http://skarnet.org/software/">Software</a><br /> +<a href="http://skarnet.org/">skarnet.org</a> +</p> + +<h1> The <tt>skalibs/siovec.h</tt> header </h1> + +<p> + TODO: write this documentation page. (Sorry!) +</p> + +</body> +</html> diff --git a/doc/libstddjb/stralloc.html b/doc/libstddjb/stralloc.html index 75e3d45..0147466 100644 --- a/doc/libstddjb/stralloc.html +++ b/doc/libstddjb/stralloc.html @@ -93,7 +93,7 @@ A stralloc should be initialized to STRALLOC_ZERO before its first use. <h2> Functions </h2> <p> -<code> int stralloc_catb (stralloc *sa, char const *s, unsigned int len) </code> <br /> +<code> int stralloc_catb (stralloc *sa, char const *s, size_t len) </code> <br /> Appends the <em>len</em> bytes pointed to by <em>s</em> to the end of the memory zone handled by *<em>sa</em>, automatically allocating more memory if needed. Returns 1 if it succeeds, and 0 if it fails. |