Skip to content
  • Thomas Haller's avatar
    shared,core: add "nm-errno.h" · 943dcba5
    Thomas Haller authored
    This will be our extension on top of <errno.h>.
    
    We want to use (integer) error numbers, that can both
    contain native errors from <errno.h> and our own defines,
    both merge in one domain. That is, we will reserve a small
    range of integers for our own defines (that hopefully won't
    clash with errors from <errno.h>).
    
    We can use this at places where GError is too cumbersome to use.
    
    The advantage is, that our error numbers extend <errno.h> and can
    be mixed.
    
    This is what "src/platform/nm-netlink.h" already does with nl_errno(). Next,
    the netlink errors from there will be merged into "nm-errno.h".
    
    Also, platform has NMPlatformError, which are a distinct set of error
    numbers. But these work differently in the sense that negative values
    represent codes from <errno.h> and positive numbers are our own platform
    specific defines. NMPlatformError will also be merged into "nm-errno.h".
    
    "nm-errno.h" will unify the error handling of platform and netlink,
    making it more similar to what we are used to from systemd, and give
    room to extend it for our own purpose.
    943dcba5