diff options
author | 1998-11-20 11:18:22 +0000 | |
---|---|---|
committer | 1998-11-20 11:18:22 +0000 | |
commit | 92efb7350713770eeac379dc990eaecbee107aa1 (patch) | |
tree | 9e7a54e9f5f807b6269323fc5be9480298ad6de5 /include | |
parent | Move atomic_lock code from asm to C with inline asm; (diff) | |
download | wireguard-openbsd-92efb7350713770eeac379dc990eaecbee107aa1.tar.xz wireguard-openbsd-92efb7350713770eeac379dc990eaecbee107aa1.zip |
Add thread-safety to libc, so that libc_r will build (on i386 at least).
All POSIX libc api now there (to P1003.1c/D10)
(more md stuff is needed for other libc/arch/*)
(setlogin is no longer a special syscall)
Add -pthread option to gcc (that makes it use -lc_r and -D_POSIX_THREADS).
Doc some re-entrant routines
Add libc_r to intro(3)
dig() uses some libc srcs and an extra -I was needed there.
Add more md stuff to libc_r.
Update includes for the pthreads api
Update libc_r TODO
Diffstat (limited to 'include')
-rw-r--r-- | include/dirent.h | 3 | ||||
-rw-r--r-- | include/limits.h | 10 | ||||
-rw-r--r-- | include/signal.h | 3 | ||||
-rw-r--r-- | include/stdio.h | 39 | ||||
-rw-r--r-- | include/stdlib.h | 3 | ||||
-rw-r--r-- | include/string.h | 3 | ||||
-rw-r--r-- | include/time.h | 6 | ||||
-rw-r--r-- | include/unistd.h | 4 |
8 files changed, 61 insertions, 10 deletions
diff --git a/include/dirent.h b/include/dirent.h index 3962c412c04..6023a5db842 100644 --- a/include/dirent.h +++ b/include/dirent.h @@ -1,4 +1,4 @@ -/* $OpenBSD: dirent.h,v 1.3 1997/09/21 10:45:30 niklas Exp $ */ +/* $OpenBSD: dirent.h,v 1.4 1998/11/20 11:18:25 d Exp $ */ /* $NetBSD: dirent.h,v 1.9 1995/03/26 20:13:37 jtc Exp $ */ /*- @@ -105,6 +105,7 @@ int scandir __P((const char *, struct dirent ***, int alphasort __P((const void *, const void *)); int getdirentries __P((int, char *, int, long *)); #endif /* not POSIX */ +int readdir_r __P((DIR *, struct dirent *, struct dirent **)); __END_DECLS #endif /* !_KERNEL */ diff --git a/include/limits.h b/include/limits.h index f9998eb748b..772688e8204 100644 --- a/include/limits.h +++ b/include/limits.h @@ -1,4 +1,4 @@ -/* $OpenBSD: limits.h,v 1.5 1998/07/11 06:02:44 deraadt Exp $ */ +/* $OpenBSD: limits.h,v 1.6 1998/11/20 11:18:25 d Exp $ */ /* $NetBSD: limits.h,v 1.7 1994/10/26 00:56:00 cgd Exp $ */ /* @@ -63,6 +63,10 @@ #define _POSIX2_LINE_MAX 2048 #define _POSIX2_RE_DUP_MAX 255 +/* P1003.1c */ +#define _POSIX_TTY_NAME_MAX 260 +#define _POSIX_LOGIN_NAME_MAX MAXLOGNAME + #if !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) #define PASS_MAX 128 @@ -78,6 +82,10 @@ #endif /* !_ANSI_SOURCE */ +/* where does this belong? it is defined by P1003.1c */ +#define TTY_NAME_MAX _POSIX_TTY_NAME_MAX +#define LOGIN_NAME_MAX MAXLOGNAME + #include <machine/limits.h> #include <sys/syslimits.h> diff --git a/include/signal.h b/include/signal.h index c2ab6cd8382..82f39b14f11 100644 --- a/include/signal.h +++ b/include/signal.h @@ -1,4 +1,4 @@ -/* $OpenBSD: signal.h,v 1.3 1996/09/20 07:27:50 deraadt Exp $ */ +/* $OpenBSD: signal.h,v 1.4 1998/11/20 11:18:26 d Exp $ */ /* $NetBSD: signal.h,v 1.8 1996/02/29 00:04:57 jtc Exp $ */ /*- @@ -113,6 +113,7 @@ int sigstack __P((const struct sigstack *, struct sigstack *)); int sigaltstack __P((const struct sigaltstack *, struct sigaltstack *)); int sigvec __P((int, struct sigvec *, struct sigvec *)); void psignal __P((unsigned int, const char *)); +int sigwait __P((const sigset_t *, int *)); #endif /* !_POSIX_SOURCE */ #endif /* !_ANSI_SOURCE */ __END_DECLS diff --git a/include/stdio.h b/include/stdio.h index 3458c67809c..ed1fb32c7dd 100644 --- a/include/stdio.h +++ b/include/stdio.h @@ -1,4 +1,4 @@ -/* $OpenBSD: stdio.h,v 1.9 1997/11/29 20:01:03 millert Exp $ */ +/* $OpenBSD: stdio.h,v 1.10 1998/11/20 11:18:26 d Exp $ */ /* $NetBSD: stdio.h,v 1.18 1996/04/25 18:29:21 jtc Exp $ */ /*- @@ -271,10 +271,31 @@ __END_DECLS __BEGIN_DECLS char *ctermid __P((char *)); +char *ctermid_r __P((char *)); char *cuserid __P((char *)); FILE *fdopen __P((int, const char *)); int fileno __P((FILE *)); +void flockfile __P((FILE *)); +int ftrylockfile __P((FILE *)); +void funlockfile __P((FILE *)); +void _flockfile_debug __P((FILE *, const char *, int)); +int getc_unlocked __P((FILE *)); +int putc_unlocked __P((int, FILE *)); +int getchar_unlocked __P((void)); +int putchar_unlocked __P((int)); __END_DECLS + +#ifndef _POSIX_THREADS +# define flockfile(fp) /* nothing */ +# define ftrylockfile(fp) (0) +# define funlockfile(fp) /* nothing */ +# define _flockfile_debug(fp,f,l) /* nothing */ +#endif + +#if 0 /* defined(DEBUG_FLOCKFILE) && defined(_POSIX_THREADS) */ +# define flockfile(fp) _flockfile_debug(fp, __FILE__, __LINE__) +#endif + #endif /* not ANSI */ /* @@ -368,23 +389,35 @@ static __inline int __sputc(int _c, FILE *_p) { #define feof(p) __sfeof(p) #define ferror(p) __sferror(p) + +#ifndef _POSIX_THREADS #define clearerr(p) __sclearerr(p) +#endif #ifndef _ANSI_SOURCE #define fileno(p) __sfileno(p) #endif #ifndef lint +#ifndef _POSIX_THREADS #define getc(fp) __sgetc(fp) +#endif /* _POSIX_THREADS */ +#define getc_unlocked(fp) __sgetc(fp) /* - * The macro implementation of putc is not fully POSIX - * compliant; it does not set errno on failure + * The macro implementations of putc and putc_unlocked are not + * fully POSIX compliant; they do not set errno on failure */ #ifndef _POSIX_SOURCE +#ifndef _POSIX_THREADS #define putc(x, fp) __sputc(x, fp) +#endif /* _POSIX_THREADS */ +#define putc_unlocked(x, fp) __sputc(x, fp) #endif /* _POSIX_SOURCE */ #endif /* lint */ #define getchar() getc(stdin) #define putchar(x) putc(x, stdout) +#define getchar_unlocked() getc_unlocked(stdin) +#define putchar_unlocked(c) putc_unlocked(c, stdout) + #endif /* _STDIO_H_ */ diff --git a/include/stdlib.h b/include/stdlib.h index 39aae35f44d..85e0da154fd 100644 --- a/include/stdlib.h +++ b/include/stdlib.h @@ -1,4 +1,4 @@ -/* $OpenBSD: stdlib.h,v 1.7 1998/02/07 02:16:26 millert Exp $ */ +/* $OpenBSD: stdlib.h,v 1.8 1998/11/20 11:18:26 d Exp $ */ /* $NetBSD: stdlib.h,v 1.25 1995/12/27 21:19:08 jtc Exp $ */ /*- @@ -105,6 +105,7 @@ void *malloc __P((size_t)); void qsort __P((void *, size_t, size_t, int (*)(const void *, const void *))); int rand __P((void)); +int rand_r __P((unsigned int *)); void *realloc __P((void *, size_t)); void srand __P((unsigned)); double strtod __P((const char *, char **)); diff --git a/include/string.h b/include/string.h index 42a2e1a4fc9..d170174f80e 100644 --- a/include/string.h +++ b/include/string.h @@ -1,4 +1,4 @@ -/* $OpenBSD: string.h,v 1.4 1998/11/04 19:35:48 millert Exp $ */ +/* $OpenBSD: string.h,v 1.5 1998/11/20 11:18:26 d Exp $ */ /* $NetBSD: string.h,v 1.6 1994/10/26 00:56:30 cgd Exp $ */ /*- @@ -73,6 +73,7 @@ char *strrchr __P((const char *, int)); size_t strspn __P((const char *, const char *)); char *strstr __P((const char *, const char *)); char *strtok __P((char *, const char *)); +char *strtok_r __P((char *, const char *, char **)); size_t strxfrm __P((char *, const char *, size_t)); /* Nonstandard routines */ diff --git a/include/time.h b/include/time.h index 75cb1c52a75..88a1658afdc 100644 --- a/include/time.h +++ b/include/time.h @@ -1,4 +1,4 @@ -/* $OpenBSD: time.h,v 1.3 1998/02/08 18:50:05 deraadt Exp $ */ +/* $OpenBSD: time.h,v 1.4 1998/11/20 11:18:26 d Exp $ */ /* $NetBSD: time.h,v 1.9 1994/10/26 00:56:35 cgd Exp $ */ /* @@ -95,6 +95,10 @@ time_t mktime __P((struct tm *)); size_t strftime __P((char *, size_t, const char *, const struct tm *)); char *strptime __P((const char *, const char *, struct tm *)); time_t time __P((time_t *)); +char *asctime_r __P((const struct tm *, char *)); +char *ctime_r __P((const time_t *, char *)); +struct tm *gmtime_r __P((const time_t *, struct tm *)); +struct tm *localtime_r __P((const time_t *, struct tm *)); #if !defined(_ANSI_SOURCE) #define CLK_TCK 100 diff --git a/include/unistd.h b/include/unistd.h index 7a43d447438..57f9bc53e1d 100644 --- a/include/unistd.h +++ b/include/unistd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: unistd.h,v 1.23 1998/11/19 06:44:07 deraadt Exp $ */ +/* $OpenBSD: unistd.h,v 1.24 1998/11/20 11:18:26 d Exp $ */ /* $NetBSD: unistd.h,v 1.26.4.1 1996/05/28 02:31:51 mrg Exp $ */ /*- @@ -76,6 +76,7 @@ uid_t geteuid __P((void)); gid_t getgid __P((void)); int getgroups __P((int, gid_t *)); char *getlogin __P((void)); +int getlogin_r __P((char *, size_t)); pid_t getpgrp __P((void)); pid_t getpid __P((void)); pid_t getpgid __P((pid_t)); @@ -98,6 +99,7 @@ long sysconf __P((int)); pid_t tcgetpgrp __P((int)); int tcsetpgrp __P((int, pid_t)); char *ttyname __P((int)); +int ttyname_r __P((int, char *, size_t)); int unlink __P((const char *)); ssize_t write __P((int, const void *, size_t)); |