diff options
author | 1998-11-20 11:18:22 +0000 | |
---|---|---|
committer | 1998-11-20 11:18:22 +0000 | |
commit | 92efb7350713770eeac379dc990eaecbee107aa1 (patch) | |
tree | 9e7a54e9f5f807b6269323fc5be9480298ad6de5 /lib/libc/stdio/putc.c | |
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 'lib/libc/stdio/putc.c')
-rw-r--r-- | lib/libc/stdio/putc.c | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/lib/libc/stdio/putc.c b/lib/libc/stdio/putc.c index b43af508a55..f9a23b2cd41 100644 --- a/lib/libc/stdio/putc.c +++ b/lib/libc/stdio/putc.c @@ -35,7 +35,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: putc.c,v 1.3 1996/10/28 05:32:55 tholo Exp $"; +static char rcsid[] = "$OpenBSD: putc.c,v 1.4 1998/11/20 11:18:48 d Exp $"; #endif /* LIBC_SCCS and not lint */ #include <stdio.h> @@ -43,11 +43,12 @@ static char rcsid[] = "$OpenBSD: putc.c,v 1.3 1996/10/28 05:32:55 tholo Exp $"; #include "local.h" /* - * A subroutine version of the macro putc. + * A subroutine version of the macro putc_unlocked. */ -#undef putc +#undef putc_unlocked -putc(c, fp) +int +putc_unlocked(c, fp) int c; register FILE *fp; { @@ -57,3 +58,21 @@ putc(c, fp) } return (__sputc(c, fp)); } + +/* + * A subroutine version of the macro putc. + */ +#undef putc + +int +putc(c, fp) + int c; + FILE *fp; +{ + int ret; + + flockfile(fp); + ret = putc_unlocked(c, fp); + funlockfile(fp); + return (ret); +} |