# Path: src/pyudev/_ctypeslib/_errorcheckers.py
# def check_errno_on_nonzero_return(result, _func, *_args):
#     """Error checker to check the system ``errno`` as returned by
#     :func:`ctypes.get_errno()`.
# 
#     If ``result`` is not ``0``, an exception according to this errno is raised.
#     Otherwise nothing happens.
# 
#     """
#     if result != 0:
#         errnum = get_errno()
#         if errnum != 0:
#             raise exception_from_errno(errnum)
#     return result
# 
# def check_errno_on_null_pointer_return(result, _func, *_args):
#     """Error checker to check the system ``errno`` as returned by
#     :func:`ctypes.get_errno()`.
# 
#     If ``result`` is a null pointer, an exception according to this errno is
#     raised.  Otherwise nothing happens.
# 
#     """
#     # pylint: disable=invalid-name
#     if not result:
#         errnum = get_errno()
#         if errnum != 0:
#             raise exception_from_errno(errnum)
#     return result
# 
# def check_negative_errorcode(result, _func, *_args):
#     """Error checker for funtions, which return negative error codes.
# 
#     If ``result`` is smaller than ``0``, it is interpreted as negative error
#     code, and an appropriate exception is raised:
# 
#     - ``-ENOMEM`` raises a :exc:`~exceptions.MemoryError`
#     - ``-EOVERFLOW`` raises a :exc:`~exceptions.OverflowError`
#     - all other error codes raise :exc:`~exceptions.EnvironmentError`
# 
#     If result is greater or equal to ``0``, it is returned unchanged.
# 
#     """
#     if result < 0:
#         # udev returns the *negative* errno code at this point
#         errnum = -result
#         raise exception_from_errno(errnum)
#     else:
#         return result


from ctypes import POINTER, Structure, c_char, c_char_p, c_int, c_uint, c_ulonglong
from ._errorcheckers import (
    check_errno_on_nonzero_return,
    check_errno_on_null_pointer_return,
    check_negative_errorcode,
)
    udev_device_get_is_initialized=None,
    udev_device_get_parent=None,
    udev_device_get_parent_with_subsystem_devtype=None,
    udev_device_get_properties_list_entry=None,
    udev_device_get_property_value=None,
    udev_device_get_seqnum=None,
    udev_device_get_subsystem=None,
    udev_device_get_sysattr_list_entry=None,
    udev_device_get_sysattr_value=None,
    udev_device_get_sysname=None,
    udev_device_get_sysnum=None,
    udev_device_get_syspath=None,
    udev_device_get_tags_list_entry=None,
    udev_device_get_usec_since_initialized=None,
    udev_device_has_tag=None,
    udev_device_new_from_device_id=None,
    udev_device_new_from_devnum=None,
    udev_device_new_from_environment=None,
    udev_device_new_from_subsystem_sysname=None,
    udev_device_new_from_syspath=None,
    udev_device_ref=None,
    udev_device_unref=None,
    udev_device_set_sysattr_value=check_negative_errorcode,
    udev_enumerate_add_match_parent=check_negative_errorcode,
    udev_enumerate_add_match_subsystem=check_negative_errorcode,
    udev_enumerate_add_nomatch_subsystem=check_negative_errorcode,
    udev_enumerate_add_match_property=check_negative_errorcode,
    udev_enumerate_add_match_sysattr=check_negative_errorcode,
    udev_enumerate_add_nomatch_sysattr=check_negative_errorcode,
    udev_enumerate_add_match_tag=check_negative_errorcode,

# Path: src/pyudev/_ctypeslib/_errorcheckers.py
# def check_errno_on_nonzero_return(result, _func, *_args):
#     """Error checker to check the system ``errno`` as returned by
#     :func:`ctypes.get_errno()`.
# 
#     If ``result`` is not ``0``, an exception according to this errno is raised.
#     Otherwise nothing happens.
# 
#     """
#     if result != 0:
#         errnum = get_errno()
#         if errnum != 0:
#             raise exception_from_errno(errnum)
#     return result
# 
# def check_errno_on_null_pointer_return(result, _func, *_args):
#     """Error checker to check the system ``errno`` as returned by
#     :func:`ctypes.get_errno()`.
# 
#     If ``result`` is a null pointer, an exception according to this errno is
#     raised.  Otherwise nothing happens.
# 
#     """
#     # pylint: disable=invalid-name
#     if not result:
#         errnum = get_errno()
#         if errnum != 0:
#             raise exception_from_errno(errnum)
#     return result
# 
# def check_negative_errorcode(result, _func, *_args):
#     """Error checker for funtions, which return negative error codes.
# 
#     If ``result`` is smaller than ``0``, it is interpreted as negative error
#     code, and an appropriate exception is raised:
# 
#     - ``-ENOMEM`` raises a :exc:`~exceptions.MemoryError`
#     - ``-EOVERFLOW`` raises a :exc:`~exceptions.OverflowError`
#     - all other error codes raise :exc:`~exceptions.EnvironmentError`
# 
#     If result is greater or equal to ``0``, it is returned unchanged.
# 
#     """
#     if result < 0:
#         # udev returns the *negative* errno code at this point
#         errnum = -result
#         raise exception_from_errno(errnum)
#     else:
#         return result


# Path: src/pyudev/_ctypeslib/libudev.py
from ctypes import POINTER, Structure, c_char, c_char_p, c_int, c_uint, c_ulonglong
from ._errorcheckers import (
    check_errno_on_nonzero_return,
    check_errno_on_null_pointer_return,
    check_negative_errorcode,
)

    udev_device_get_is_initialized=None,
    udev_device_get_parent=None,
    udev_device_get_parent_with_subsystem_devtype=None,
    udev_device_get_properties_list_entry=None,
    udev_device_get_property_value=None,
    udev_device_get_seqnum=None,
    udev_device_get_subsystem=None,
    udev_device_get_sysattr_list_entry=None,
    udev_device_get_sysattr_value=None,
    udev_device_get_sysname=None,
    udev_device_get_sysnum=None,
    udev_device_get_syspath=None,
    udev_device_get_tags_list_entry=None,
    udev_device_get_usec_since_initialized=None,
    udev_device_has_tag=None,
    udev_device_new_from_device_id=None,
    udev_device_new_from_devnum=None,
    udev_device_new_from_environment=None,
    udev_device_new_from_subsystem_sysname=None,
    udev_device_new_from_syspath=None,
    udev_device_ref=None,
    udev_device_unref=None,
    udev_device_set_sysattr_value=check_negative_errorcode,
    udev_enumerate_add_match_parent=check_negative_errorcode,
    udev_enumerate_add_match_subsystem=check_negative_errorcode,
    udev_enumerate_add_nomatch_subsystem=check_negative_errorcode,
    udev_enumerate_add_match_property=check_negative_errorcode,
    udev_enumerate_add_match_sysattr=check_negative_errorcode,
    udev_enumerate_add_nomatch_sysattr=check_negative_errorcode,
    udev_enumerate_add_match_tag=check_negative_errorcode,

    udev_enumerate_add_match_sysname=check_negative_errorcode,