NIH Utility Library

libnih is a light-weight "standard library" of C functions to ease the
development of other libraries and applications.

Its goals are:

 * despite its name, to _not_ reimplement anything found in the
   standard C library or any library normally found in /lib;

 * use standard C types and conventions where appropriate;

 * have a simple and consistent programming interface;

 * be useful to library developers without needing to be exposed in
   the library's API;

 * not hide implementation details or structure contents, we're all
   adults after all.


Dependencies
------------

The D-Bus messaging system is required to build the libnih-dbus library
and nih-dbus-tool utility.  In order to query the availability of the
external library, the pkg-config tool is used; and in order to parse
D-Bus introspection data, the expat XML parsing library will be used.

The recommended versions are:

	* pkg-config 0.22
	* D-Bus 1.2.16
	* expat 2.0.0

These should all be available from the current release of any modern
Linux distribution.

For detailed compilation and installation instructions see the INSTALL
file.  If you've checked libnih out from revision control, or want to
hack on libnih, see the HACKING file.


Cross-compiling
---------------

libnih uses the nih-dbus-tool utility it builds during its own build
process to generate further sources to be built.  When cross-compiling
this will fail because the built nih-dbus-tool will most likely not be
able to run on the build architecture.

This can be solved by building and installing nih-dbus-tool for the
build architecture first, then when performing the cross-compile, the
installed copy will be used instead.

If installed into a common system directory, this is automatic; if not,
you can pass the path of the nih-dbus-tool binary to the configure
script, e.g.:

	./configure --build=i486-linux-gnu --host=gnueabi-linux-arm \
		NIH_DBUS_TOOL=/cross/bin/nih-dbus-tool
Owner
Scott James Remnant
Scott James Remnant
Comments
  • Update dbus code generator to allow for empty lists for type 'as'

    Update dbus code generator to allow for empty lists for type 'as'

    Upstart when in user-session mode, needs to pass lists over dbus connection which may be empty.

    This drops the != NULL check for NULL terminated arrays and moves the iteration loop inside an 'if' statement.

  • Fallback to lstat, if the non-portable dirent.d_type is not available.

    Fallback to lstat, if the non-portable dirent.d_type is not available.

    Fixes running libnih & upstart on XFS filesystem (and others that don't implement dirent.d_type)

    Bug-Debian: http://bugs.debian.org/695604 Bug-Ubuntu: https://bugs.launchpad.net/bugs/672643

  • Enable automake's subdif-objects option.

    Enable automake's subdif-objects option.

    automake 2.0 will enable subdir-objects by default. 1.14 now issues warnings when sources are used from subdirectories, yet subdir-objects option is not used. libnih compiles with and without this option. with this option enabled, no warnings are displayed for each test_foo_SOURCES = tests/test_foo.c and the test_foo.o is placed in tests/test_foo.o instead of ./test_foo.o

  • Drop including (unused) malloc.h

    Drop including (unused) malloc.h

    malloc.h used to define malloc hooks API, which have been deprecated and marked volatile in (e)glibc 2.14. Malloc hooks, nor other special facilities defined in malloc.h, appear to not be used, thus this include is redundant.

    http://sourceware.org/ml/libc-alpha/2011-05/msg00103.html

  • Fixups

    Fixups

    Libnih fixups:

    • fix FTBFS with external LIBINTL
    • fix FTBFS when certain signals are not defined
    • update to use standard includes
    • update to use PT_* constants
  • nih-dbus-tool cannot handle DBUS_TYPE_VARIANT

    nih-dbus-tool cannot handle DBUS_TYPE_VARIANT

    $ make org.freedesktop.systemd1.h
      GEN      org.freedesktop.systemd1.h
    nih-dbus-tool:marshal.c:172: Not reached assertion failed in marshal
    /bin/bash: line 4: 12193 Aborted                 (core dumped) /usr/bin/nih-dbus-tool --package=upstart --  mode=proxy --prefix=systemd --default-interface=org.freedesktop.systemd1.Manager --output=org.freedesktop.systemd1.h org.freedesktop.systemd1.xml
    

    that seems to explode upon seeing DBUS_TYPE_VARIANT, looking at the code, indeed there is no support to generate that. Not a blocker for me, for now.

  • Possibility of adding a new D-Bus annotation to nih-dbus-tool.

    Possibility of adding a new D-Bus annotation to nih-dbus-tool.

    Hi Scott,

    We're using NIH for https://github.com/cgmanager/cgmanager. However, we need to use SCM_CRED/SCM_CREDENTIALS which is not supported by dbus on Linux.

    We were therefore wondering about the possibility of adding a new D-Bus annotation to nih-dbus-tool say "client must send SCM creds with this method". FWICS, annotations only affect the tools that generate bindings code but are also some sort of loose contract between the D-Bus client and the server.

    The D-Bus spec only seems to touch on the precise meaning of annotations very lightly unless I'm missing something. The D-Bus tutorial does cover them in a little more detail, but it seems unreasonable to consider the tutorial part of the official spec to me.

    What the spec does refer to is "well-known" annotations which implies that other annotations may be possible? Indeed, I notice that although NIH supports async methods it does so using "com.netsplit.Nih.Method.Async" rather than the semi-well-known "org.freedesktop.DBus.GLib.Async" (semi since it's not in the spec, but is in the tutorial!)

    Can you offer any advice or insight into this?

    Cheers,

    James.

  • Add travis support

    Add travis support

    Add integration with free CI service http://travis-ci.org to execute unit-tests on each push/branch/merge-proposal. At the moment nih_watch_reader tests hang indefinitely on travis-ci infrastructure which have been disabled for now.

    I will investigate further why it fails in their environment. To further gather environment details I've executed procenv in that environment (expand context to see line 450 onwards at https://travis-ci.org/xnox/libnih/builds/14676025 ) which indicates an Ubuntu 12.04 OpenVZ container.

  • Make test.h use TAP formatted output

    Make test.h use TAP formatted output

    This branch changes output:

        Testing nih_main_write_pidfile()
        ...with successful write
        ...with overwrite of existing pid
        ...with failure to write to temporary file
    

    To:

    ok 21 - nih_main_write_pidfile() 
    ok 22 - nih_main_write_pidfile() with successful write
    ok 23 - nih_main_write_pidfile() with overwrite of existing pid
    ok 24 - nih_main_write_pidfile() with failure to write to temporary file
    

    Which is in TAP format (Test Anything Protocol).

    This results in automake build logs change from:

    ...
    PASS: test_command
    PASS: test_config
    PASS: test_logging
    PASS: test_error
    ...
    ============================================================================
    Testsuite summary for libnih 1.0.4
    ============================================================================
    # TOTAL: 17
    # PASS:  17
    # SKIP:  0
    # XFAIL: 0
    # FAIL:  0
    # XPASS: 0
    # ERROR: 0
    ============================================================================
    

    To:

    PASS: test_error 1 - nih_error_raise()
    PASS: test_error 2 - nih_error_raise_printf()
    PASS: test_error 3 - nih_error_raise_system()
    PASS: test_error 4 - nih_error_raise_no_memory()
    PASS: test_error 5 - nih_error_raise_error()
    PASS: test_error 6 - nih_error_raise_error() with no current error
    PASS: test_error 7 - nih_error_raise_error() with unhandled error
    PASS: test_error 8 - nih_return_error()
    PASS: test_error 9 - nih_return_system_error()
    PASS: test_error 10 - nih_return_no_memory_error()
    PASS: test_error 11 - nih_error_steal()
    PASS: test_error 12 - nih_error_steal() with same context
    PASS: test_error 13 - nih_error_steal() with different contexts
    PASS: test_error 14 - nih_error_push_context()
    PASS: test_error 15 - nih_error_pop_context()
    PASS: test_error 16 - nih_error_pop_context() with unhandled error in context
    PASS: test_error 17 - nih_error_pop_context() with unhandled error beneath context
    make[3]: Entering directory `/home/xnox/canonical/libnih/libnih/nih'
    make[3]: Nothing to be done for `all'.
    make[3]: Leaving directory `/home/xnox/canonical/libnih/libnih/nih'
    ============================================================================
    Testsuite summary for libnih 1.0.4
    ============================================================================
    # TOTAL: 839
    # PASS:  839
    # SKIP:  0
    # XFAIL: 0
    # FAIL:  0
    # XPASS: 0
    # ERROR: 0
    ============================================================================
    

    Which is a more accurate and useful build-log output. Furthermore it will enable: skipping tests, marking them expected fail, marking them TODO (unimplemented features), whilst accurately reporting each one of them.

    There is no break in testing API and this implementation works across all libnih tests. There is no dependency on executing the test-suite under the TAP runner.

    There is one change of behaviour: instead of aborting (bailing) on test failure, a FAIL is reported and the individual test binary will "keep going". I believe this is acceptable as the overall build will fail and is accurately reported. I added a define "TEST_TAP_BAIL_ON_FAIL" which will report a TAP "bail" command and abort as it was done previously. In case one wants previous behaviour.

Apple Silicon to Apple Silicon VDM utility

Apple Silicon to Apple Silicon VDM tool This tool lets you get a serial console on an Apple Silicon device and reboot it remotely, using only another

Nov 17, 2022
EASTL stands for Electronic Arts Standard Template Library. It is an extensive and robust implementation that has an emphasis on high performance.

EA Standard Template Library EASTL stands for Electronic Arts Standard Template Library. It is a C++ template library of containers, algorithms, and i

Dec 1, 2022
Embedded Template Library

Embedded Template Library (ETL) Motivation C++ is a great language to use for embedded applications and templates are a powerful aspect. The standard

Nov 26, 2022
An open-source C++ library developed and used at Facebook.

Folly: Facebook Open-source Library What is folly? Folly (acronymed loosely after Facebook Open Source Library) is a library of C++14 components desig

Nov 23, 2022
Functional Programming Library for C++. Write concise and readable C++ code.
Functional Programming Library for C++. Write concise and readable C++ code.

FunctionalPlus helps you write concise and readable C++ code. Table of contents Introduction Usage examples Type deduction and useful error messages T

Nov 28, 2022
? A glib-like multi-platform c library
? A glib-like multi-platform c library

A glib-like cross-platform C library Supporting the project Support this project by becoming a sponsor. Your logo will show up here with a link to you

Nov 27, 2022
An open source library for C

Homo Deus - C Library Introduction The Homo Deus C Library (hdelibc) is an open source collection of tools for the C programming language. The project

Nov 28, 2022
NIH Utility Library

libnih is a light-weight "standard library" of C functions to ease the development of other libraries and applications. Its goals are: * despite it

Sep 15, 2022
Nov 27, 2022
C language utility library

versatile and easy to use C language utility library with functions and macros commonly used in various applications

Nov 8, 2022
websocket and http client and server library, coming with ws, a command line swiss army knife utility

Hello world IXWebSocket is a C++ library for WebSocket client and server development. It has minimal dependencies (no boost), is very simple to use an

Nov 19, 2022
libmorse - C library (and utility) for generating Morse code.

libmorse - C library (and utility) for generating Morse code. Library to generate and play morse code. Needs ALSA for audio playout. The intent here i

Nov 2, 2021
A Native Binary Emulator Library and Utility

binmulator A Native Binary Emulator Library and Utility Most emulators for malware detection are written in Python and fail when certain emulated API

Jun 27, 2022
Utility Library for Imaging Systems
Utility Library for Imaging Systems

Overview ULIS is a rendering library written in C++. It is aimed at software rasterization and digital image processing. Official Github Repository Pr

Nov 13, 2022
ZSV/lib: a fast CSV parsing library and standalone utility
ZSV/lib: a fast CSV parsing library and standalone utility

Please note: this code is still alpha / pre-production. Everything here should be considered preliminary. If you like ZSVlib, please give it a star! Z

Nov 28, 2022
A utility library to use/bootstrap Soracom Arc easily on ESP32 Arduino boards

soracom-arc-esp32-arduino A utility library to use/bootstrap Soracom Arc easily on ESP32 Arduino boards. Synopsis #include <SoracomArcESP32.h> #includ

Dec 20, 2021
Utility and common library for all polysquare cmake tools.

Polysquare CMake Tooling Utility Functions Utility and common library for all polysquare cmake tools. Status Travis CI (Ubuntu) AppVeyor (Windows) Cov

May 7, 2021
Simple and Fast Network Utility Library

SFNUL Simple and Fast Network Utility library © binary1248 SFNUL is provided under the Mozilla Public License Version 2.0 (see LICENSE for details)

Feb 17, 2022
JoyfulNoise Tiny Utility Board

JoyfulNoise Tiny Utility Board A versatile ATtiny85-powered Eurorack module in 4HP. License JoyfulNoise hardware and software is Open Source. The JNTU

Jul 25, 2022
Linux x86_64 Process Injection Utility | Manipulate Processes With Customized Payloads (beta)
Linux x86_64 Process Injection Utility | Manipulate Processes With Customized Payloads (beta)

K55 - Linux x86_64 Process Injection Utility (C++11) About K55 (pronounced: "kay fifty-five") The K55 payload injection tool is used for injecting x86

Sep 5, 2022