NIH Utility Library

Related tags

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.


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.


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 \
  • License choice

    License choice

    I'm not sure if it's deliberate or not, but can license be changed to LGPL-2.1+ or GPL-2.0+? Instead of current GPL-2.0-only ?

    opened by xnox 4
  • 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.

    opened by xnox 3
  • 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: Bug-Ubuntu:

    opened by xnox 1
  • Release 1.0.4

    Release 1.0.4

    better late than never

    opened by CameronNemo 1
  • docs, sample

    docs, sample

    I just can't find examples nor a manual... could you... ?

    opened by jackghg 1
  • 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
    opened by xnox 0
  • 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.

    opened by xnox 0
  • libnih-dbus requires dbus-1

    libnih-dbus requires dbus-1

    libnih-dbus requires dbus-1

    opened by xnox 0
  • 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

    opened by xnox 0
  • 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.

    opened by xnox 1
  • 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 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?



    opened by jamesodhunt 1
  • Add travis support

    Add travis support

    Add integration with free CI service 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 ) which indicates an Ubuntu 12.04 OpenVZ container.

    opened by xnox 1
  • Add gtkdoc libnih API docs generation.

    Add gtkdoc libnih API docs generation.

    This add gtkdoc generated API docs for nih/*.h Also fixes up a few markup errors.

    published at

    opened by xnox 5
  • 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


    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


    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.

    opened by xnox 4
  • Add LTLIBINTL to

    Add LTLIBINTL to

    In case intl support is not part of libc, and thus local or external libraries are needed at link time to gain NLS.

    opened by xnox 3
  • nih/logging.c: use our own __nih_abort_msg rather than the (e)glibc symbol

    nih/logging.c: use our own __nih_abort_msg rather than the (e)glibc symbol

    1. __abort_msg is not available in all libc's
    2. when it is available, it creates a tight dependancy between libnih and (e)glibc, requiring libnih to be recompiled against each (e)glibc upload
    3. equivalent functionality can be provided by our own implementation on abort_msg.
    4. apport in ubuntu has been modifyied to look up crash message from __nih_abort_msg in additional to __abort_msg, thus decoupling (e)glibc from libnih

    This patch creates our own __nih_abort_msg. There are other alternatives that could be implemented (e.g. add a conditional to offer using __abort_msg (if available) and select/fallback to __nih_abort_msg. Let me know your thoughts on this.

    • nih/logging.c: Use our own __nih_abort_msg rather than the (e)glibc private symbol __abort_msg to avoid upgrade issues (LP: #997359).
    • nih/tests/test_logging.c: Update tests for __nih_abort_msg.


    opened by xnox 3
Scott James Remnant
Scott James Remnant
stb single-file public domain libraries for C/C++

stb single-file public domain (or MIT licensed) libraries for C/C++ Noteworthy: image loader: stb_image.h image writer: stb_image_write.h image resize

Sean Barrett 16.9k Oct 14, 2021
? 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

TBOOX 3.8k Oct 19, 2021
Easy to use, header only, macro generated, generic and type-safe Data Structures in C

C Macro Collections Easy to use, header only, macro generated, generic and type-safe Data Structures in C. Table of Contents Installation Contributing

Leonardo Vencovsky 247 Oct 19, 2021
hypertextcpp - is a hyperfast HTML templating system for C++ applications.

It provides a highly readable .htcpp template file format and a command line utility that transpiles it to C++ HTML rendering code. Include a generated C++ header file in your project, then setup a build system to update it when necessary, and you're all set.

null 17 Oct 8, 2021
KoanLogic 358 Sep 29, 2021
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

Embedded Template Library 962 Oct 15, 2021
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

Homo Deus 43 Sep 29, 2021
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

Asahi Linux 89 Oct 22, 2021
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

Facebook 20.1k Oct 14, 2021
Basic Development Environment - a set of foundational C++ libraries used at Bloomberg.

BDE Libraries This repository contains the BDE libraries, currently BSL (Basic Standard Library), BDL (Basic Development Library), BAL (Basic Applicat

Bloomberg 1.3k Oct 19, 2021
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

Electronic Arts 6k Oct 15, 2021
Fast, orthogonal, open multi-methods. Supersedes yomm11.

YOMM2 This is a complete rewrite of YOMM11, which is now deprecated. This library is much better, see here to find out why. TL;DR If you are familiar

Jean-Louis Leroy 184 Aug 31, 2021
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

Tobias Hermann 1.5k Oct 21, 2021
An eventing framework for building high performance and high scalability systems in C.

NOTE: THIS PROJECT HAS BEEN DEPRECATED AND IS NO LONGER ACTIVELY MAINTAINED As of 2019-03-08, this project will no longer be maintained and will be ar

Facebook Archive 1.7k Oct 1, 2021
A toolkit for making real world machine learning and data analysis applications in C++

dlib C++ library Dlib is a modern C++ toolkit containing machine learning algorithms and tools for creating complex software in C++ to solve real worl

Davis E. King 10.6k Oct 19, 2021
C++14 evented IO libraries for high performance networking and media based applications

LibSourcey C++ Networking Evolved LibSourcey is a collection of cross platform C++14 modules and classes that provide developers with an arsenal for r

Sourcey 1.2k Oct 16, 2021
A collection of single-file C libraries. (generic containers, random number generation, argument parsing and other functionalities)

cauldron A collection of single-file C libraries and tools with the goal to be portable and modifiable. Libraries library description arena-allocator.

Camel Coder 25 Sep 15, 2021
Framework for Enterprise Application Development in c++, HTTP1/HTTP2/HTTP3 compliant, Supports multiple server backends

The ffead-cpp Framework ffead-cpp is a web-framework, application framework, utilities all bundled into one. It also provides an embedded HTTP/Web-Soc

Sumeet Chhetri 481 Oct 13, 2021
PYNQ Framework for ANTSDR

PYNQ Framework for ANTSDR This project was inspired by PYNQ and PlutoSDR. There are already many SDR platforms based on ZYNQ and AD9361, so does ANTSD

null 9 Oct 8, 2021