Commit Graph
34 Commits
Author SHA1 Message Date
Joachim Nilsson 94ad65a121 Factor out string functions to lite/strlite.h
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-05-30 22:27:41 +02:00
Joachim Nilsson 18dde87f0a Add NetBSD fparseln(3) v1.10
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-05-09 19:14:05 +02:00
Joachim Nilsson fcb38c9cc5 Constify fisdir() argument
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-05-09 19:10:05 +02:00
Joachim Nilsson ab69ae8374 Add OpenBSD reallocarray(3) v1.2
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-05-09 00:37:05 +02:00
Joachim Nilsson aab5a1145c Remove Emacs version-control handling
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-05-07 22:35:49 +02:00
Joachim Nilsson 604b503b84 Fix issue #2: GCC6 -Wmisleading-indentation causing FTBFS in pimd
- Add function comment
- Fix misleading indentaion
- Fix coding sttle

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-01-23 11:16:53 +01:00
Joachim Nilsson 84650d8836 Update include file boiler plate
We're not in Kansas anymore, Toto.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-01-07 02:58:06 +01:00
Joachim Nilsson b4fbd54a8c Update copyright years
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-01-07 02:58:06 +01:00
Tobias Waldekranz 61254279b9 lite.h: Add min() and max() macros
These macros take care to avoid double evaluation.

Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-01-05 13:16:34 +01:00
Joachim Nilsson a7b5c240c1 Add UNIX lfile_t parser API to lite.h
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-10-25 23:25:17 +01:00
Joachim Nilsson 3f89fafe24 Fix macro definitions for compat APIs
Seems cpp is a bit uptight about spaces.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-09-27 00:56:20 +02:00
Joachim Nilsson 1f1e88a640 New function: tree(), simple /bin/tree replacement.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-08-23 05:12:38 +02:00
Joachim Nilsson 117ec58a90 Add some very useful helper macros: NELEMS() and bitops.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-08-21 09:42:43 +02:00
Joachim Nilsson 3eb1fbb31d lite.h: Minor coding style cleanup.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-07-22 11:52:41 +02:00
Joachim Nilsson f5355ecf7b lite.h: Convert from error.h to the more BSD friendly err.h
OpenBSD, and possibly the other BSD's, do not have error.h so we replace
it with err.h, which exists almost everywhere.

This means the macros in lite.h that used error() now instead use
warn(),  with the same semantics as before.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-07-18 15:36:06 +02:00
Joachim Nilsson 51c73030e0 Minor change.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-07-12 12:43:57 +02:00
Joachim Nilsson 1147e547dc Followup to atonum(), missing include file and const.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-07-10 19:06:17 +02:00
Joachim Nilsson 41c9caff17 Add atonum() - Convert string to natural number, returns -1 on error.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-07-10 19:00:11 +02:00
Joachim Nilsson 4005dd5e2c Add simple IPv4 only ifconfig() function from Finit
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-07-10 18:28:57 +02:00
Joachim Nilsson e731d83881 Add pidfile_poll() from Finit, waits max 5 sec for pidfile.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-07-09 03:19:56 +02:00
Joachim Nilsson 5a50a6add1 Add client side pidfile functions: pidfile_read(), pidfile_signal().
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-07-09 01:36:58 +02:00
Joachim Nilsson 9ed00baa94 Add pidfile() from NetBSD/OpenBSD, missing in GLIBC.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-07-09 01:25:19 +02:00
Joachim Nilsson 1561e7567e Add recursive mkpath() and makepath(), works like mkdir -p
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-07-09 01:25:19 +02:00
Joachim Nilsson c5366a33da fsendfile(): Break ABI by switching src and dst to match rest of API.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-07-06 02:04:28 +02:00
Joachim Nilsson af39ae5fa9 Refactor copyfile(), and copy_filep() --> fcopyfile() to use same backend.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-07-06 02:03:28 +02:00
Joachim Nilsson c5434a4bc0 Add tempfile() - a secure tmpfile() replacement using O_TMPFILE.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-06-22 21:42:38 +02:00
Tobias Waldekranz 121e8ee888 Add Westermo chomp() function, slightly improved from Finit original.
Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-06-17 22:07:10 +02:00
Joachim Nilsson 9f0979daea Add some helper macros and wrappers for C library functions.
- touch()    - Create a file, or update mtime.  Errors on stderr
- makedir()  - Create directory, like mkdir().  Errors on stderr
- makefifo() - Create a FIFO, like mkfifo().  Errors on stderr
- erase()    - Erase file/directory with remove().  Errors on stderr
- chardev()  - Create character device
- blkdev()   - Create block device
- S_ISEXEC() - Mysteriously missing from GLIBC
- UNUSED()   - Shorter and more readable version of __attribute__ ((unused))

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2015-06-17 20:56:07 +02:00
Joachim Nilsson 949d0a020f Bump version for release and update copyright years.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2014-04-21 16:03:54 +02:00
Joachim Nilsson 36d24ce366 lite.h: Add some helper string comparison methods.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2014-04-21 15:45:23 +02:00
Joachim Nilsson bf9d1ec012 libite: Copy utility fixes and new functionality
- Add support for symlinks to copyfile()
- Fix memory leak in copy_filep()
- New function, fsendfile(), copy data between FILE streams

Also, minor whitespace and coding style cleanup.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2014-04-12 15:08:56 +02:00
Joachim Nilsson 499f4d45d3 libite: Add strtonum() from OpenBSD
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2013-05-21 19:55:41 +02:00
Mattias Walström 77971a31b2 libite: Add strlcat and strlcpy.
These function only exist on uClibc and BSD, so if they
not already defined in string.h, define them here.
2013-01-29 13:29:45 +01:00
Joachim Nilsson 777502f175 Fix I/O plugin watcher, load plugins earlier to enable a new early hook!
Restructure start by calling the plugin loader earlier. This makes it
possible to run hooks even earlier.  This also adds a new hook:
HOOK_ROOTFS_UP which runs as soon as the system root (/) is available.

Another very notable change is the slow refactor of helpers.c into a finit
helper library called libite.so (-lite). This is a light-weight

Also, lots of misc. fixes all over the place. Signal handling still really
needs to be looked into once more!

Makefile:
        Add dependency handling for parallell build
        Add libite library

ChangeLog:
        Update with new 1.4 release. There is a lot of fixes!

libite/:
        Collection of utility functions and C library extensions for
        finit & its plugins

reboot.c:
        New reboot tool. Simply sends SIGINT to PID 1

finit.h:
        Cleanup old LISTEN_INITCTL define, code is in an optional plugin now

finit.c:
        Let mdev/udev run *after* cls()
        Add useful debug statement for /proc/cmdline
        Earlier plugin load => new early hook point
        Show OK/FAIL for total plugin load, not for each plugin => speedup

helpers.h:
        Rename syslog macros to prevent common name clashes (DEBUG/ERROR)
        Add __FILE__ to _e(), _d() and _pe() macros

helpers.c:
        In ifconfig() the addr and mask arguments are now optional
        The copyfile() has been moved to libite.so
        Temporarily remove const directive from some functions to build
        Use DFLSIG() macro in run_getty() to simplify code

plugin.h:
        Add new HOOK_ROOTFS_UP hook

plugin.c:
        Fix init_plugins() to actually register the plugin's I/O fd
        Skip verbose listing of all plugins in plugin_load_all()

svc.c:
        svc_start(): Dito

plugins/Makefile:
        Inherit CFLAGS and LDFLAGS, but make sure to filter out -rdynamic
        from LDFLAGS, it's used by the daemon, only

plugins/initctl.c:
        New includes after helpers.h refactor

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2012-10-02 08:25:50 +02:00