PageRenderTime 60ms CodeModel.GetById 34ms RepoModel.GetById 0ms app.codeStats 0ms

/dash-0.5.5.1/src/system.h

https://github.com/GNA-SERVICES-INC/MoNGate
C Header | 105 lines | 60 code | 14 blank | 31 comment | 1 complexity | 4a78f99721b69ea26124075ea9ff5034 MD5 | raw file
  1. /*
  2. * Copyright (c) 2004
  3. * Herbert Xu <herbert@gondor.apana.org.au>. All rights reserved.
  4. *
  5. * Redistribution and use in source and binary forms, with or without
  6. * modification, are permitted provided that the following conditions
  7. * are met:
  8. * 1. Redistributions of source code must retain the above copyright
  9. * notice, this list of conditions and the following disclaimer.
  10. * 2. Redistributions in binary form must reproduce the above copyright
  11. * notice, this list of conditions and the following disclaimer in the
  12. * documentation and/or other materials provided with the distribution.
  13. * 3. The name of the author may not be used to endorse or promote products
  14. * derived from this software without specific prior written permission.
  15. *
  16. * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  17. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  18. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  19. * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  20. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  21. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  22. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  23. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  24. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  25. * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  26. * SUCH DAMAGE.
  27. */
  28. #include <limits.h>
  29. #include <signal.h>
  30. #include <sys/types.h>
  31. #ifndef SSIZE_MAX
  32. #define SSIZE_MAX ((ssize_t)((size_t)-1 >> 1))
  33. #endif
  34. static inline void sigclearmask(void)
  35. {
  36. #ifdef HAVE_SIGSETMASK
  37. sigsetmask(0);
  38. #else
  39. sigset_t set;
  40. sigemptyset(&set);
  41. sigprocmask(SIG_SETMASK, &set, 0);
  42. #endif
  43. }
  44. #ifndef HAVE_MEMPCPY
  45. void *mempcpy(void *, const void *, size_t);
  46. #endif
  47. #ifndef HAVE_STPCPY
  48. char *stpcpy(char *, const char *);
  49. #endif
  50. #ifndef HAVE_STRCHRNUL
  51. char *strchrnul(const char *, int);
  52. #endif
  53. #ifndef HAVE_STRSIGNAL
  54. char *strsignal(int);
  55. #endif
  56. #ifndef HAVE_STRTOD
  57. static inline double strtod(const char *nptr, char **endptr)
  58. {
  59. *endptr = (char *)nptr;
  60. return 0;
  61. }
  62. #endif
  63. #ifndef HAVE_STRTOIMAX
  64. #define strtoimax strtoll
  65. #endif
  66. #ifndef HAVE_STRTOUMAX
  67. #define strtoumax strtoull
  68. #endif
  69. #ifndef HAVE_BSEARCH
  70. void *bsearch(const void *, const void *, size_t, size_t,
  71. int (*)(const void *, const void *));
  72. #endif
  73. #ifndef HAVE_KILLPG
  74. static inline int killpg(pid_t pid, int signal)
  75. {
  76. #ifdef DEBUG
  77. if (pid < 0)
  78. abort();
  79. #endif
  80. return kill(-pid, signal);
  81. }
  82. #endif
  83. #ifndef HAVE_SYSCONF
  84. #define _SC_CLK_TCK 2
  85. long sysconf(int) __attribute__((__noreturn__));
  86. #endif
  87. /*
  88. * A trick to suppress uninitialized variable warning without generating any
  89. * code
  90. */
  91. #define uninitialized_var(x) x = x