Jump to content

Libslack

From Wikipedia, the free encyclopedia

Libslack is a library of general utilities designed to make UNIX/C programming a bit easier on the eye.[1] It is a seemingly random collection of modules and functions. It was originally implemented as part of the "daemon" program[2] (although some of the code dates back much further).

It's a small library with much functionality, accurately documented and thoroughly tested. Good library naming conventions are not rigorously observed on the principle that common operations should always be easy to write and code should always be easy to read.

Libslack comprises the following modules covering various topics:

agent agent-oriented programming (callbacks for file I/O stream events and scheduled timers)
coproc co-processes communicating via pipes or a pseudo terminal, with or without involving a shell
daemon become a daemon process, locked pid files, prevent core files, revoke privileges, change user, parse simple configs
err message/error/debug/verbose/alert messaging
fio universal getline, fifos, file control, read/write timeouts, sub-second sleep
hsort heap sort (by Stephen Russell)
lim POSIX.1 limits convenience functions
link singly- and doubly-linked lists with optional growable free lists
list list data type (growable pointer array) with flexible locking
locker abstract locking (with reader/writer lock implementation if missing)
map map data type (hash table) with flexible locking
mem memory helper functions, dynamic n-dimensional arrays, secure memory, memory pools
msg generic message handling (including muliplexing and stacked filters), and syslog helper functions
net networking: servers/clients (IPv4/IPv6/unix domain), multicast, reliable UDP, TOS, passing an open file descriptor to another process, receiving the credentials of the process on the other side of a Unix domain socket, send/expect for text protocols, pack/unpack for binary protocols, simple SMTP client for sending email
prog lightweight program "framework", flexible command line option handling, usage messages
prop program properties files (key-value pairs)
pseudo pseudo terminals (by Tatu Ylonen)
sig ISO C-compliant signal handling adapter
str string data type with flexible locking and C-string helper functions (tr, regex, regsub, fmt, split/join, soundex, trim/squeeze, quote/unquote, encode/decode, lc/lcfirst, uc/ucfirst, chop/chomp, bin/hex/oct, strcasecmp, strlcpy/strlcat, asprintf)

Libslack is freely available under the GNU General Public License, Version 2 or later.

See also

[edit]

References

[edit]
  1. ^ "libslack". Libslack. Retrieved 28 December 2024.
  2. ^ "daemon". Daemon. Retrieved 6 January 2025.
[edit]