diff --git a/include/stdio.h b/include/stdio.h index 279160912ba9..e392bd5eb3e2 100644 --- a/include/stdio.h +++ b/include/stdio.h @@ -348,6 +348,7 @@ int feof_unlocked(FILE *); int ferror_unlocked(FILE *); int fflush_unlocked(FILE *); int fileno_unlocked(FILE *); +int fputc_unlocked(int, FILE *); int fputs_unlocked(const char * __restrict, FILE * __restrict); size_t fread_unlocked(void * __restrict, size_t, size_t, FILE * __restrict); size_t fwrite_unlocked(const void * __restrict, size_t, size_t, diff --git a/lib/libc/stdio/Symbol.map b/lib/libc/stdio/Symbol.map index a17830d9cebf..4926b6f35729 100644 --- a/lib/libc/stdio/Symbol.map +++ b/lib/libc/stdio/Symbol.map @@ -173,6 +173,7 @@ FBSD_1.5 { FBSD_1.6 { fflush_unlocked; + fputc_unlocked; fputs_unlocked; fread_unlocked; fwrite_unlocked; diff --git a/lib/libc/stdio/fputc.c b/lib/libc/stdio/fputc.c index 7a48a93a0071..a2d2d14655bc 100644 --- a/lib/libc/stdio/fputc.c +++ b/lib/libc/stdio/fputc.c @@ -46,14 +46,22 @@ __FBSDID("$FreeBSD$"); #undef fputc_unlocked +int +fputc_unlocked(int c, FILE *fp) +{ + + /* Orientation set by __sputc() when buffer is full. */ + /* ORIENT(fp, -1); */ + return (__sputc(c, fp)); +} + int fputc(int c, FILE *fp) { int retval; + FLOCKFILE_CANCELSAFE(fp); - /* Orientation set by __sputc() when buffer is full. */ - /* ORIENT(fp, -1); */ - retval = __sputc(c, fp); + retval = fputc_unlocked(c, fp); FUNLOCKFILE_CANCELSAFE(); return (retval); }