diff options
author | David Leonard <d@cvs.openbsd.org> | 1998-11-20 11:19:02 +0000 |
---|---|---|
committer | David Leonard <d@cvs.openbsd.org> | 1998-11-20 11:19:02 +0000 |
commit | f547068f88348f54941dc06da46491f99701933e (patch) | |
tree | 8548a6b78719cba1de575b7f49e5f8ac4e6f1683 /lib/libc/stdio/getc.c | |
parent | 394c7a9821726b84f284c0c4385b1a9198afa0b0 (diff) |
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 'lib/libc/stdio/getc.c')
-rw-r--r-- | lib/libc/stdio/getc.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/lib/libc/stdio/getc.c b/lib/libc/stdio/getc.c index ff4a5168a3f..ce990968202 100644 --- a/lib/libc/stdio/getc.c +++ b/lib/libc/stdio/getc.c @@ -35,12 +35,24 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: getc.c,v 1.2 1996/08/19 08:32:51 tholo Exp $"; +static char rcsid[] = "$OpenBSD: getc.c,v 1.3 1998/11/20 11:18:48 d Exp $"; #endif /* LIBC_SCCS and not lint */ #include <stdio.h> /* + * A subroutine version of the macro getc_unlocked. + */ +#undef getc_unlocked + +int +getc_unlocked(fp) + FILE *fp; +{ + return (__sgetc(fp)); +} + +/* * A subroutine version of the macro getc. */ #undef getc @@ -49,5 +61,10 @@ int getc(fp) register FILE *fp; { - return (__sgetc(fp)); + int c; + + flockfile(fp); + c = __sgetc(fp); + funlockfile(fp); + return (c); } |