index.html (7216B)
1 <html> 2 <head> 3 <meta name="viewport" content="width=device-width, initial-scale=1.0" /> 4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 5 <meta http-equiv="Content-Language" content="en" /> 6 <title>skalibs: the stddjb library interface</title> 7 <meta name="Description" content="skalibs: the stddjb library interface" /> 8 <meta name="Keywords" content="skalibs stddjb libstddjb library interface" /> 9 <!-- <link rel="stylesheet" type="text/css" href="//skarnet.org/default.css" /> --> 10 </head> 11 <body> 12 13 <p> 14 <a href="../libskarnet.html">libskarnet</a><br /> 15 <a href="../index.html">skalibs</a><br /> 16 <a href="//skarnet.org/software/">Software</a><br /> 17 <a href="//skarnet.org/">www.skarnet.org</a> 18 </p> 19 20 <h1> The <tt>stddjb</tt> library interface </h1> 21 22 <p> 23 <tt>libstddjb</tt> is the base, and the most important part, of skalibs. 24 It is a set of general-purpose C functions wrapping some 25 system calls, hiding some Unix portability problems, providing some 26 basic low-level buffering functions and string handling, and generally 27 offering a nice API to Unix programming - in many ways nicer and safer 28 than the "standard" Unix APIs like <tt>stdio.h</tt>. 29 </p> 30 31 <p> 32 It is mostly based on some excellent code written and placed into the 33 public domain by <a href="../djblegacy.html">D. J. Bernstein</a>. 34 </p> 35 36 <h2> Compiling </h2> 37 38 <ul> 39 <li> The libstddjb functions are available under the <tt>skalibs/stddjb.h</tt> 40 header, which includes a lot of lower-level headers. If you know what 41 lower-level headers to use, you might speed up your compilation process by 42 including them directly. </li> 43 </ul> 44 45 <h2> Programming </h2> 46 47 <ul> 48 <li> <a href="alarm.html">skalibs/alarm.h</a>: sub-second precision <a href="https://pubs.opengroup.org/onlinepubs/9699919799/functions/alarm.html">alarm()</a> </li> 49 <li> <a href="alloc.html">skalibs/alloc.h</a>: basic heap memory allocation primitives </li> 50 <li> <a href="allreadwrite.html">skalibs/allreadwrite.h</a>: <a href="safewrappers.html">safe 51 wrappers</a> around I/O functions, extra I/O functions </li> 52 <li> <a href="bitarray.html">skalibs/bitarray.h</a>: how to handle large arrays of bits </li> 53 <li> <a href="bufalloc.html">skalibs/bufalloc.h</a>: bufferized output (with dynamically allocated buffers)</li> 54 <li> <a href="buffer.html">skalibs/buffer.h</a>: bufferized I/O (with statically allocated buffers) </li> 55 <li> <a href="bytestr.html">skalibs/bytestr.h</a>: basic operations on strings and byte arrays </li> 56 <li> <a href="cdb.html">skalibs/cdb.h</a>: how to read 57 <a href="https://en.wikipedia.org/wiki/Cdb_%28software%29">cdb</a> files </li> 58 <li> <a href="cdbmake.html">skalibs/cdbmake.h</a>: how to write 59 <a href="https://en.wikipedia.org/wiki/Cdb_%28software%29">cdb</a> files </li> 60 <li> <a href="cspawn.html">skalibs/cspawn.h</a>: child spawning primitives that use posix_spawn instead of fork when supported </li> 61 <li> <a href="direntry.html">skalibs/direntry.h</a>: portable directory operations </li> 62 <li> <a href="djbtime.html">skalibs/djbtime.h</a>: conversions between date and time formats </li> 63 <li> <a href="djbunix.html">skalibs/djbunix.h</a>: management of basic Unix concepts </li> 64 <li> <a href="envalloc.html">skalibs/envalloc.h</a>: management of dynamically allocated <em>argv</em> and <em>envp</em> </li> 65 <li> <a href="env.html">skalibs/env.h</a>: management of <em>argv</em> and <em>envp</em> </li> 66 <li> <a href="exec.html">skalibs/exec.h</a>: execution functions, with or without a newly built environment </li> 67 <li> <a href="fmtscan.html">skalibs/fmtscan.h</a>: formatters (printers) and scanners (parsers) for basic C types </li> 68 <li> <a href="genalloc.html">skalibs/genalloc.h</a>: generic advanced management of dynamically allocated structures </li> 69 <li> <a href="genwrite.html">skalibs/genwrite.h</a>: interface to generic writes either to strallocs or to buffers </li> 70 <li> <a href="getpeereid.html">skalibs/getpeereid.h</a>: the <tt>getpeereid()</tt> system call </li> 71 <li> <a href="iopause.html">skalibs/iopause.h</a>: the skalibs event loop selection function </li> 72 <li> <a href="lolstdio.html">skalibs/lolstdio.h</a>: 73 <a href="https://pubs.opengroup.org/onlinepubs/9699919799/functions/printf.html">printf</a>-like 74 functions writing into <a href="buffer.html">buffers</a> or <a href="bufalloc.html">bufallocs</a> </li> 75 <li> <a href="mininetstring.html">skalibs/mininetstring.h</a>: a protocol to transmit variable-length messages (limited to 64kB) </li> 76 <li> <a href="netstring.html">skalibs/netstring.h</a>: a protocol to transmit variable-length messages (limited to 2^32 bytes) </li> 77 <li> <a href="segfault.html">skalibs/segfault.h</a>: voluntary error generation </li> 78 <li> <a href="selfpipe.html">skalibs/selfpipe.h</a>: automated selfpipe trick (i.e. 79 how to safely handle signals in event loops) </li> 80 <li> <a href="sgetopt.html">skalibs/sgetopt.h</a>: <tt>getopt()</tt>-style command-line options management </li> 81 <li> <a href="sig.html">skalibs/sig.h</a>: safe signal management </li> 82 <li> <a href="siovec.html">skalibs/siovec.h</a>: scatter/gather IO primitives working with an 83 <a href="https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_uio.h.html">iovec</a> 84 structure </li> 85 <li> <a href="skamisc.html">skalibs/skamisc.h</a>: general string quoting and parsing; miscellaneous, unclassifiable functions </li> 86 <li> <a href="socket.html">skalibs/socket.h</a>: UNIX, INET and INET6 domain sockets </li> 87 <li> <a href="stralloc.html">skalibs/stralloc.h</a>: advanced management of dynamically allocated strings </li> 88 <li> <a href="strerr.html">skalibs/strerr.h</a>: print error messages </li> 89 <li> <a href="tai.html">skalibs/tai.h</a>: time, timers and system clock </li> 90 </ul> 91 92 <p> 93 The following headers are automatically generated at compile-time, when the 94 <em>headers</em> subsystem is made. The <tt>skalibs/stddjb.h</tt> file also 95 includes them. 96 </p> 97 98 <ul> 99 <li> skalibs/uint16.h: operations with 16-bit unsigned integers </li> 100 <li> skalibs/uint32.h: operations with 32-bit unsigned integers </li> 101 <li> skalibs/uint64.h: operations with 64-bit unsigned integers </li> 102 <li> skalibs/types.h: portable helpers for common Unix types: size_t, 103 uid_t, gid_t, pid_t, time_t, dev_t and ino_t. </li> 104 <li> skalibs/error.h: portable macros for errno management </li> 105 <li> skalibs/setgroups.h: stub for the setgroups() function, for systems that do not define it</li> 106 <li> <a href="ip46.html">skalibs/ip46.h</a>: IPv4/IPv6 abstraction layer </li> 107 </ul> 108 109 <p> 110 Additionally, <tt>stddjb.h</tt> also includes the following headers, which 111 are not associated with any code and are mostly self-explanatory: 112 </p> 113 114 <ul> 115 <li> <a href="gccattributes.html">skalibs/gccattributes.h</a>: wrappers around a few GCC-specific optimizations </li> 116 <li> skalibs/diuint.h: for associative arrays of unsigned integers </li> 117 <li> skalibs/diuint32.h: for associative arrays of 32-bit unsigned integers </li> 118 <li> skalibs/disize.h: for associative arrays of size_t </li> 119 <li> skalibs/nsig.h: the number of system signals, for systems that do not define it </li> 120 <li> skalibs/nonposix.h: feature test macros for non-POSIX-compliant systems </li> 121 </ul> 122 123 </body> 124 </html>