sysmacros.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /* Definitions of macros to access `dev_t' values.
  2. Copyright (C) 1996-2019 Free Software Foundation, Inc.
  3. This file is part of the GNU C Library.
  4. The GNU C Library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Lesser General Public
  6. License as published by the Free Software Foundation; either
  7. version 2.1 of the License, or (at your option) any later version.
  8. The GNU C Library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with the GNU C Library; if not, see
  14. <http://www.gnu.org/licenses/>. */
  15. #ifndef _SYS_SYSMACROS_H
  16. #define _SYS_SYSMACROS_H 1
  17. #include <features.h>
  18. #include <bits/types.h>
  19. #include <bits/sysmacros.h>
  20. #define __SYSMACROS_DECL_TEMPL(rtype, name, proto) \
  21. extern rtype gnu_dev_##name proto __THROW __attribute_const__;
  22. #define __SYSMACROS_IMPL_TEMPL(rtype, name, proto) \
  23. __extension__ __extern_inline __attribute_const__ rtype \
  24. __NTH (gnu_dev_##name proto)
  25. __BEGIN_DECLS
  26. __SYSMACROS_DECLARE_MAJOR (__SYSMACROS_DECL_TEMPL)
  27. __SYSMACROS_DECLARE_MINOR (__SYSMACROS_DECL_TEMPL)
  28. __SYSMACROS_DECLARE_MAKEDEV (__SYSMACROS_DECL_TEMPL)
  29. #ifdef __USE_EXTERN_INLINES
  30. __SYSMACROS_DEFINE_MAJOR (__SYSMACROS_IMPL_TEMPL)
  31. __SYSMACROS_DEFINE_MINOR (__SYSMACROS_IMPL_TEMPL)
  32. __SYSMACROS_DEFINE_MAKEDEV (__SYSMACROS_IMPL_TEMPL)
  33. #endif
  34. __END_DECLS
  35. #ifndef __SYSMACROS_NEED_IMPLEMENTATION
  36. # undef __SYSMACROS_DECL_TEMPL
  37. # undef __SYSMACROS_IMPL_TEMPL
  38. # undef __SYSMACROS_DECLARE_MAJOR
  39. # undef __SYSMACROS_DECLARE_MINOR
  40. # undef __SYSMACROS_DECLARE_MAKEDEV
  41. # undef __SYSMACROS_DEFINE_MAJOR
  42. # undef __SYSMACROS_DEFINE_MINOR
  43. # undef __SYSMACROS_DEFINE_MAKEDEV
  44. #endif
  45. #define major(dev) gnu_dev_major (dev)
  46. #define minor(dev) gnu_dev_minor (dev)
  47. #define makedev(maj, min) gnu_dev_makedev (maj, min)
  48. #endif /* sys/sysmacros.h */