libc: provide fputc_unlocked

Among the same justification as the other stdio _unlocked; in addition to an
inline version in <stdio.h>, we must provide a function in libc as well for
the functionality. This fixes the lang/gcc* builds, which want to use the
symbol from libc.

PR:		243810
Reported by:	antoine, swills, Michael <michael.adm gmail com>
X-MFC-With:	r357284
This commit is contained in:
kevans 2020-02-02 19:45:12 +00:00
parent e4fe27d627
commit 66a605b22a
3 changed files with 13 additions and 3 deletions

View File

@ -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,

View File

@ -173,6 +173,7 @@ FBSD_1.5 {
FBSD_1.6 {
fflush_unlocked;
fputc_unlocked;
fputs_unlocked;
fread_unlocked;
fwrite_unlocked;

View File

@ -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);
}