syslog.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /* Checking macros for syslog functions.
  2. Copyright (C) 2005-2026 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. <https://www.gnu.org/licenses/>. */
  15. #ifndef _SYS_SYSLOG_H
  16. # error "Never include <bits/syslog.h> directly; use <sys/syslog.h> instead."
  17. #endif
  18. #include <bits/syslog-decl.h>
  19. #include <bits/floatn.h>
  20. #if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
  21. # include <bits/syslog-ldbl.h>
  22. #endif
  23. /* The following functions must be used only after applying all asm
  24. redirections, e.g. long double asm redirections. */
  25. #ifdef __va_arg_pack
  26. __fortify_function void
  27. syslog (int __pri, const char *__fmt, ...)
  28. {
  29. __syslog_chk (__pri, __USE_FORTIFY_LEVEL - 1, __fmt, __va_arg_pack ());
  30. }
  31. #elif __fortify_use_clang && defined __USE_MISC
  32. __fortify_function_error_function __attribute_overloadable__ void
  33. syslog (int __pri, __fortify_clang_overload_arg (const char *, , __fmt), ...)
  34. {
  35. __gnuc_va_list __fortify_ap;
  36. __builtin_va_start (__fortify_ap, __fmt);
  37. __vsyslog_chk (__pri, __USE_FORTIFY_LEVEL - 1, __fmt, __fortify_ap);
  38. __builtin_va_end (__fortify_ap);
  39. }
  40. #elif !defined __cplusplus
  41. # define syslog(pri, ...) \
  42. __syslog_chk (pri, __USE_FORTIFY_LEVEL - 1, __VA_ARGS__)
  43. #endif
  44. #ifdef __USE_MISC
  45. __fortify_function __attribute_overloadable__ void
  46. vsyslog (int __pri, __fortify_clang_overload_arg (const char *, ,__fmt),
  47. __gnuc_va_list __ap)
  48. {
  49. __vsyslog_chk (__pri, __USE_FORTIFY_LEVEL - 1, __fmt, __ap);
  50. }
  51. #endif