Re: svn commit: r357284 - in head: include lib/libc/stdio

2020-02-02 Thread Kyle Evans
On Sun, Feb 2, 2020 at 12:57 AM Antoine Brodin  wrote:
>
> On Thu, Jan 30, 2020 at 4:31 AM Kyle Evans  wrote:
> >
> > Author: kevans
> > Date: Thu Jan 30 03:31:16 2020
> > New Revision: 357284
> > URL: https://svnweb.freebsd.org/changeset/base/357284
> >
> > Log:
> >   stdio: provide _unlocked variants of fflush, fputc, fputs, fread, fwrite
> >
> >   fflush_unlocked is currently desired in ports by sysutils/metalog, and
> >   redefined as the locked fflush.
> >
> >   fputc_unlocked, fputs_unlocked, fread_unlocked, and fwrite_unlocked are
> >   currently desired in ports by devel/elfutils, and redefined as the locked
> >   fputs, fread, and fwrite respectively.
> >
> >   Reviewed by:  kib
> >   MFC after:2 weeks
> >   Differential Revision:https://reviews.freebsd.org/D23336
>
> Hi,
>
> It seems that this change broke lang/gcc* ports.
>

Tested/fixed with r357419; sorry for the breakage!

Thanks,

Kyle Evans
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r357284 - in head: include lib/libc/stdio

2020-02-01 Thread Antoine Brodin
On Thu, Jan 30, 2020 at 4:31 AM Kyle Evans  wrote:
>
> Author: kevans
> Date: Thu Jan 30 03:31:16 2020
> New Revision: 357284
> URL: https://svnweb.freebsd.org/changeset/base/357284
>
> Log:
>   stdio: provide _unlocked variants of fflush, fputc, fputs, fread, fwrite
>
>   fflush_unlocked is currently desired in ports by sysutils/metalog, and
>   redefined as the locked fflush.
>
>   fputc_unlocked, fputs_unlocked, fread_unlocked, and fwrite_unlocked are
>   currently desired in ports by devel/elfutils, and redefined as the locked
>   fputs, fread, and fwrite respectively.
>
>   Reviewed by:  kib
>   MFC after:2 weeks
>   Differential Revision:https://reviews.freebsd.org/D23336

Hi,

It seems that this change broke lang/gcc* ports.

Antoine
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r357284 - in head: include lib/libc/stdio

2020-01-29 Thread Kyle Evans
Author: kevans
Date: Thu Jan 30 03:31:16 2020
New Revision: 357284
URL: https://svnweb.freebsd.org/changeset/base/357284

Log:
  stdio: provide _unlocked variants of fflush, fputc, fputs, fread, fwrite
  
  fflush_unlocked is currently desired in ports by sysutils/metalog, and
  redefined as the locked fflush.
  
  fputc_unlocked, fputs_unlocked, fread_unlocked, and fwrite_unlocked are
  currently desired in ports by devel/elfutils, and redefined as the locked
  fputs, fread, and fwrite respectively.
  
  Reviewed by:  kib
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D23336

Modified:
  head/include/stdio.h
  head/lib/libc/stdio/Makefile.inc
  head/lib/libc/stdio/Symbol.map
  head/lib/libc/stdio/fflush.3
  head/lib/libc/stdio/fflush.c
  head/lib/libc/stdio/fputc.c
  head/lib/libc/stdio/fputs.3
  head/lib/libc/stdio/fputs.c
  head/lib/libc/stdio/fread.3
  head/lib/libc/stdio/fread.c
  head/lib/libc/stdio/fwrite.c
  head/lib/libc/stdio/putc.3

Modified: head/include/stdio.h
==
--- head/include/stdio.hThu Jan 30 03:01:00 2020(r357283)
+++ head/include/stdio.hThu Jan 30 03:31:16 2020(r357284)
@@ -346,7 +346,12 @@ int putchar_unlocked(int);
 voidclearerr_unlocked(FILE *);
 int feof_unlocked(FILE *);
 int ferror_unlocked(FILE *);
+int fflush_unlocked(FILE *);
 int fileno_unlocked(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,
+FILE * __restrict);
 #endif
 
 #if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE >= 500
@@ -507,10 +512,11 @@ extern int __isthreaded;
  * See ISO/IEC 9945-1 ANSI/IEEE Std 1003.1 Second Edition 1996-07-12
  * B.8.2.7 for the rationale behind the *_unlocked() macros.
  */
+#defineclearerr_unlocked(p)__sclearerr(p)
 #definefeof_unlocked(p)__sfeof(p)
 #defineferror_unlocked(p)  __sferror(p)
-#defineclearerr_unlocked(p)__sclearerr(p)
 #definefileno_unlocked(p)  __sfileno(p)
+#definefputc_unlocked(s, p)__sputc(s, p)
 #endif
 #if __POSIX_VISIBLE >= 199506
 #definegetc_unlocked(fp)   __sgetc(fp)

Modified: head/lib/libc/stdio/Makefile.inc
==
--- head/lib/libc/stdio/Makefile.incThu Jan 30 03:01:00 2020
(r357283)
+++ head/lib/libc/stdio/Makefile.incThu Jan 30 03:31:16 2020
(r357284)
@@ -48,13 +48,17 @@ MLINKS+=ferror.3 ferror_unlocked.3 \
ferror.3 clearerr.3 ferror.3 clearerr_unlocked.3 \
ferror.3 feof.3 ferror.3 feof_unlocked.3 \
ferror.3 fileno.3 ferror.3 fileno_unlocked.3
-MLINKS+=fflush.3 fpurge.3
+MLINKS+=fflush.3 fflush_unlocked.3 \
+   fflush.3 fpurge.3
 MLINKS+=fgets.3 gets.3
 MLINKS+=fgets.3 gets_s.3
 MLINKS+=flockfile.3 ftrylockfile.3 flockfile.3 funlockfile.3
 MLINKS+=fopen.3 fdopen.3 fopen.3 freopen.3 fopen.3 fmemopen.3
-MLINKS+=fputs.3 puts.3
-MLINKS+=fread.3 fwrite.3
+MLINKS+=fputs.3 fputs_unlocked.3 \
+   fputs.3 puts.3
+MLINKS+=fread.3 fread_unlocked.3 \
+   fread.3 fwrite.3 \
+   fread.3 fwrite_unlocked.3
 MLINKS+=fseek.3 fgetpos.3 fseek.3 fseeko.3 fseek.3 fsetpos.3 fseek.3 ftell.3 \
fseek.3 ftello.3 fseek.3 rewind.3
 MLINKS+=funopen.3 fropen.3 funopen.3 fwopen.3

Modified: head/lib/libc/stdio/Symbol.map
==
--- head/lib/libc/stdio/Symbol.map  Thu Jan 30 03:01:00 2020
(r357283)
+++ head/lib/libc/stdio/Symbol.map  Thu Jan 30 03:31:16 2020
(r357284)
@@ -172,6 +172,10 @@ FBSD_1.5 {
 };
 
 FBSD_1.6 {
+   fflush_unlocked;
+   fputs_unlocked;
+   fread_unlocked;
+   fwrite_unlocked;
mkostempsat;
 };
 

Modified: head/lib/libc/stdio/fflush.3
==
--- head/lib/libc/stdio/fflush.3Thu Jan 30 03:01:00 2020
(r357283)
+++ head/lib/libc/stdio/fflush.3Thu Jan 30 03:31:16 2020
(r357284)
@@ -32,11 +32,12 @@
 .\" @(#)fflush.3   8.1 (Berkeley) 6/4/93
 .\" $FreeBSD$
 .\"
-.Dd December 25, 2017
+.Dd January 23, 2020
 .Dt FFLUSH 3
 .Os
 .Sh NAME
 .Nm fflush ,
+.Nm fflush_unlocked ,
 .Nm fpurge
 .Nd flush a stream
 .Sh LIBRARY
@@ -46,6 +47,8 @@
 .Ft int
 .Fn fflush "FILE *stream"
 .Ft int
+.Fn fflush_unlocked "FILE *stream"
+.Ft int
 .Fn fpurge "FILE *stream"
 .Sh DESCRIPTION
 The function
@@ -63,6 +66,16 @@ argument is
 flushes
 .Em all
 open output streams.
+.Pp
+The
+.Fn fflush_unlocked
+function is equivalent to
+.Fn fflush ,
+except that the caller is responsible for locking the stream with
+.Xr flockfile 3
+before calling it.
+This function may be used to avoid the overhead of locking the