/usr.bin/xlint/llib/llib-lposix

https://bitbucket.org/freebsd/freebsd-head/ · #! · 314 lines · 306 code · 8 blank · 0 comment · 0 complexity · 817062fb7711895f8a3a6cadb7e2e521 MD5 · raw file

  1. /* $NetBSD: llib-lposix,v 1.2 1995/07/03 21:25:09 cgd Exp $ */
  2. /* $FreeBSD$ */
  3. /*
  4. * Copyright (c) 1994, 1995 Jochen Pohl
  5. * All Rights Reserved.
  6. *
  7. * Redistribution and use in source and binary forms, with or without
  8. * modification, are permitted provided that the following conditions
  9. * are met:
  10. * 1. Redistributions of source code must retain the above copyright
  11. * notice, this list of conditions and the following disclaimer.
  12. * 2. Redistributions in binary form must reproduce the above copyright
  13. * notice, this list of conditions and the following disclaimer in the
  14. * documentation and/or other materials provided with the distribution.
  15. * 3. All advertising materials mentioning features or use of this software
  16. * must display the following acknowledgement:
  17. * This product includes software developed by Jochen Pohl for
  18. * The NetBSD Project.
  19. * 4. The name of the author may not be used to endorse or promote products
  20. * derived from this software without specific prior written permission.
  21. *
  22. * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  23. * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  24. * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  25. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  26. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  27. * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  28. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  29. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  30. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  31. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  32. */
  33. /* LINTLIBRARY */
  34. #define _POSIX_SOURCE
  35. #include <sys/types.h>
  36. #include <sys/time.h>
  37. #include <sys/stat.h>
  38. #include <sys/utsname.h>
  39. #include <sys/times.h>
  40. #include <stdio.h>
  41. #include <stdarg.h>
  42. #include <stdlib.h>
  43. #include <unistd.h>
  44. #include <math.h>
  45. #include <time.h>
  46. #include <assert.h>
  47. #include <termios.h>
  48. #include <dirent.h>
  49. #include <fcntl.h>
  50. #include <grp.h>
  51. #include <pwd.h>
  52. #include <ctype.h>
  53. #include <signal.h>
  54. #include <locale.h>
  55. #include <setjmp.h>
  56. #include <string.h>
  57. #include <utime.h>
  58. /* PROTOLIB1 */
  59. void (abort)(void);
  60. int (abs)(int j);
  61. int (access)(const char *path, int amode);
  62. double (acos)(double x);
  63. unsigned (alarm)(unsigned seconds);
  64. char *(asctime)(const struct tm *timeptr);
  65. double (asin)(double x);
  66. void (__assert)(const char *expression, const char *func, int line,
  67. const char *file);
  68. double (atan)(double x);
  69. double (atan2)(double y, double x);
  70. int (atexit)(void (*func)(void));
  71. double (atof)(const char *nptr);
  72. int (atoi)(const char *nptr);
  73. long (atol)(const char *nptr);
  74. void *(bsearch)(const void *key, const void *base, size_t nmemb,
  75. size_t size, int (*compar)(const void *, const void *));
  76. void *(calloc)(size_t nmemb, size_t size);
  77. double (ceil)(double x);
  78. speed_t (cfgetispeed)(const struct termios *p);
  79. speed_t (cfgetospeed)(const struct termios *p);
  80. int (cfsetispeed)(struct termios *p, speed_t speed);
  81. int (cfsetospeed)(struct termios *p, speed_t speed);
  82. int (chdir)(const char *path);
  83. int (chmod)(const char *path, mode_t mode);
  84. int (chown)(const char *path, uid_t owner, gid_t group);
  85. void (clearerr)(FILE *stream);
  86. clock_t (clock)(void);
  87. int (close)(int fildes);
  88. int (closedir)(DIR *dirp);
  89. double (cos)(double x);
  90. double (cosh)(double x);
  91. int (creat)(const char *path, mode_t mode);
  92. char *(ctermid)(char *s);
  93. char *(ctime)(const time_t *timer);
  94. char *(cuserid)(char *s);
  95. double (difftime)(time_t time1, time_t time0);
  96. div_t (div)(int numer, int denom);
  97. int (dup)(int fildes);
  98. int (dup2)(int fildes, int fildes2);
  99. int (errno);
  100. int (execl)(const char *path, const char *arg, ...);
  101. int (execle)(const char *path, const char *arg, ...);
  102. int (execlp)(const char *file, const char *arg, ...);
  103. int (execv)(const char *path, char *const argv[]);
  104. int (execve)(const char *path, char *const argv[], char *const *envp);
  105. int (execvp)(const char *file, char *const argv[]);
  106. void (exit)(int status);
  107. void (_exit)(int status);
  108. double (exp)(double x);
  109. double (fabs)(double x);
  110. int (fclose)(FILE *stream);
  111. int (fcntl)(int fildes, int cmd, ...);
  112. FILE *(fdopen)(int fildes, const char *type);
  113. int (feof)(FILE *stream);
  114. int (ferror)(FILE *stream);
  115. int (fflush)(FILE *stream);
  116. int (fgetc)(FILE *stream);
  117. int (fgetpos)(FILE *stream, fpos_t *pos);
  118. char *(fgets)(char *s, int n, FILE *stream);
  119. int (fileno)(FILE *stream);
  120. double (floor)(double x);
  121. double (fmod)(double x, double y);
  122. FILE *(fopen)(const char *filename, const char *mode);
  123. pid_t (fork)(void);
  124. long (fpathconf)(int fildes, int name);
  125. /* PRINTFLIKE2 */
  126. int (fprintf)(FILE *stream, const char *format, ...);
  127. int (fputc)(int c, FILE *stream);
  128. int (fputs)(const char *s, FILE *stream);
  129. size_t (fread)(void *ptr, size_t size, size_t nmemb, FILE *stream);
  130. void (free)(void *ptr);
  131. FILE *(freopen)(const char *filename, const char *mode, FILE *stream);
  132. double (frepx)(double value, int *exp);
  133. /* SCANFLIKE2 */
  134. int (fscanf)(FILE *stream, const char *format, ...);
  135. int (fseek)(FILE *stream, long int offset, int whence);
  136. int (fsetpos)(FILE *stream, const fpos_t *pos);
  137. int (fstat)(int fildes, struct stat *buf);
  138. long (ftell)(FILE *stream);
  139. size_t (fwrite)(const void *ptr, size_t size, size_t nmemb, FILE *stream);
  140. int (getc)(FILE *stream);
  141. int (getchar)(void);
  142. char *(getcwd)(char *buf, size_t size);
  143. gid_t (getegid)(void);
  144. char *(getenv)(const char *name);
  145. uid_t (geteuid)(void);
  146. gid_t (getgid)(void);
  147. struct group *(getgrgid)(gid_t gid);
  148. struct group *(getgrnam)(const char *name);
  149. int (getgroups)(int gidsetsize, gid_t grouplist[]);
  150. char *(getlogin)(void);
  151. pid_t (getpgrp)(void);
  152. pid_t (getpid)(void);
  153. pid_t (getppid)(void);
  154. struct passwd *(getpwnam)(const char *name);
  155. struct passwd *(getpwuid)(uid_t uid);
  156. char *(gets)(char *s);
  157. uid_t (getuid)(void);
  158. struct tm *(gmtime)(const time_t *timer);
  159. int (isalnum)(int c);
  160. int (isalpha)(int c);
  161. int (isatty)(int fildes);
  162. int (iscntrl)(int c);
  163. int (isdigit)(int c);
  164. int (isgraph)(int c);
  165. int (islower)(int c);
  166. int (isprint)(int c);
  167. int (ispunct)(int c);
  168. int (isspace)(int c);
  169. int (isupper)(int c);
  170. int (isxdigit)(int c);
  171. int (kill)(pid_t pid, int sig);
  172. long (labs)(long j);
  173. double (ldexp)(double x, int exp);
  174. ldiv_t (ldiv)(long numer, long denom);
  175. int (link)(const char *existing, const char *new);
  176. struct lconv *(localeconv)(void);
  177. struct tm *(localtime)(const time_t *timer);
  178. double (log)(double x);
  179. double (log10)(double x);
  180. void (longjmp)(jmp_buf env, int val);
  181. off_t (lseek)(int fildes, off_t offset, int whence);
  182. void *(malloc)(size_t size);
  183. int (mblen)(const char *s, size_t n);
  184. size_t (mbstowcs)(wchar_t *pwcs, const char *s, size_t n);
  185. int (mbtowc)(wchar_t *pwc, const char *s, size_t n);
  186. void *(memchr)(const void *s, int c, size_t n);
  187. int (memcmp)(const void *s1, const void *s2, size_t n);
  188. void *(memcpy)(void *s1, const void *s2, size_t n);
  189. void *(memmove)(void *s1, const void *s2, size_t n);
  190. void *(memset)(void *s, int c, size_t n);
  191. int (mkdir)(const char *path, mode_t mode);
  192. int (mkfifo)(const char *path, mode_t mode);
  193. time_t (mktime)(struct tm *timeptr);
  194. double (modf)(double value, double *iptr);
  195. int (open)(const char *path, int oflag, ...);
  196. DIR *(opendir)(const char *dirname);
  197. long (pathconf)(const char *path, int name);
  198. int (pause)(void);
  199. void (perror)(const char *s);
  200. int (pipe)(int fildes[2]);
  201. double (pow)(double x, double y);
  202. /* PRINTFLIKE1 */
  203. int (printf)(const char *format, ...);
  204. int (putc)(int c, FILE *stream);
  205. int (putchar)(int c);
  206. int (puts)(const char *s);
  207. void (qsort)(void *base, size_t nmemb, size_t size,
  208. int (*compar)(const void *, const void *));
  209. int (raise)(int sig);
  210. int (rand)(void);
  211. ssize_t (read)(int fildes, void *buf, size_t nbyte);
  212. struct dirent *(readdir)(DIR *dirp);
  213. void *(realloc)(void *ptr, size_t size);
  214. int (remove)(const char *filename);
  215. int (rename)(const char *old, const char *new);
  216. void (rewind)(FILE *stream);
  217. void (rewinddir)(DIR *dirp);
  218. int (rmdir)(const char *path);
  219. /* SCANFLIKE1 */
  220. int (scanf)(const char *format, ...);
  221. void (setbuf)(FILE *stream, char *buf);
  222. int (setgid)(gid_t gid);
  223. int (setjmp)(jmp_buf env);
  224. char *(setlocale)(int category, const char *locale);
  225. int (setpgid)(pid_t pid, pid_t pgid);
  226. pid_t (setsid)(void);
  227. int (setuid)(uid_t uid);
  228. int (setvbuf)(FILE *stream, char *buf, int mode, size_t size);
  229. int (sigaction)(int sig, const struct sigaction *act,
  230. struct sigaction *oact);
  231. int (sigaddset)(sigset_t *set, int signo);
  232. int (sigdelset)(sigset_t *set, int signo);
  233. int (sigemptyset)(sigset_t *set);
  234. int (sigfillset)(sigset_t *set);
  235. int (sigismember)(const sigset_t *set, int signo);
  236. void (siglongjmp)(sigjmp_buf env, int val);
  237. void (*(signal)(int sig, void (*func)(int)))(int);
  238. int (sigpending)(sigset_t *set);
  239. int (sigprocmask)(int how, const sigset_t *set, sigset_t *oset);
  240. int (sigsetjmp)(sigjmp_buf env, int savemask);
  241. int (sigsuspend)(const sigset_t *sigmask);
  242. double (sin)(double x);
  243. double (sinh)(double x);
  244. unsigned (sleep)(unsigned seconds);
  245. /* PRINTFLIKE2 */
  246. int (sprintf)(char *s, const char *format, ...);
  247. double (sqrt)(double x);
  248. void (srand)(unsigned seed);
  249. /* SCANFLIKE2 */
  250. int (sscanf)(const char *s, const char *format, ...);
  251. int (stat)(const char *path, struct stat *buf);
  252. char *(strcat)(char *s1, const char *s2);
  253. char *(strchr)(const char *s, int c);
  254. int (strcmp)(const char *s1, const char *s2);
  255. int (strcoll)(const char *s1, const char *s2);
  256. char *(strcpy)(char *s1, const char *s2);
  257. size_t (strcspn)(const char *s1, const char *s2);
  258. char *(strerror)(int errnum);
  259. size_t (strftime)(char *s, size_t maxsize, const char *format,
  260. const struct tm *timeptr);
  261. size_t (strlen)(const char *s);
  262. char *(strncat)(char *s1, const char *s2, size_t n);
  263. int (strncmp)(const char *s1, const char *s2, size_t n);
  264. char *(strncpy)(char *s1, const char *s2, size_t n);
  265. char *(strpbrk)(const char *s1, const char *s2);
  266. char *(strrchr)(const char *s, int c);
  267. size_t (strspn)(const char *s1, const char *s2);
  268. char *(strstr)(const char *s1, const char *s2);
  269. double (strtod)(const char *nptr, char **endptr);
  270. char *(strtok)(char *s1, const char *s2);
  271. long (strtol)(const char *nptr, char **endptr, int base);
  272. unsigned long (strtoul)(const char *nptr, char **endptr, int base);
  273. size_t (strxfrm)(char *s1, const char *s2, size_t n);
  274. long (sysconf)(int name);
  275. int (system)(const char *string);
  276. double (tan)(double x);
  277. double (tanh)(double x);
  278. int (tcdrain)(int fildes);
  279. int (tcflow)(int fildes, int action);
  280. int (tcflush)(int fildes, int queue_selector);
  281. int (tcgetattr)(int fildes, struct termios *tp);
  282. pid_t (tcgetpgrp)(int fildes);
  283. int (tcsendbreak)(int fildes, int duration);
  284. int (tcsetattr)(int fildes, int options, const struct termios *tp);
  285. int (tcsetpgrp)(int fildes, pid_t pgrpid);
  286. time_t (time)(time_t *timer);
  287. clock_t (times)(struct tms *buffer);
  288. FILE *(tmpfile)(void);
  289. char *(tmpnam)(char *s);
  290. int (tolower)(int c);
  291. int (toupper)(int c);
  292. char *(ttyname)(int filedes);
  293. void (tzset)(void);
  294. mode_t (umask)(mode_t cmask);
  295. int (uname)(struct utsname *name);
  296. int (ungetc)(int c, FILE *stream);
  297. int (unlink)(const char *path);
  298. int (utime)(const char *path, const struct utimbuf *times);
  299. int (vfprintf)(FILE *stream, const char *format, va_list arg);
  300. int (vprintf)(const char *format, va_list arg);
  301. int (vsprintf)(char *s, const char *format, va_list arg);
  302. pid_t (wait)(int *statloc);
  303. pid_t (waitpid)(pid_t pid, int *stat_loc, int options);
  304. size_t (wcstombs)(char *s, const wchar_t *pwcs, size_t n);
  305. int (wctomb)(char *s, wchar_t wchar);
  306. ssize_t (write)(int fildes, const void *buf, size_t nbyte);