Commit Graph

14 Commits

Author SHA1 Message Date
Yaakov Selkowitz 9087163804 ansification: remove _DEFUN
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2018-01-17 11:47:26 -06:00
Yaakov Selkowitz 6783860a2e ansification: remove _AND
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2018-01-17 11:47:05 -06:00
Corinna Vinschen 1ec7de7271 * libc/stdio/fwalk.c (_fwalk_reent): Remove redundant test. 2014-09-05 09:31:32 +00:00
Corinna Vinschen 5dad9defd0 * libc/stdio/fwalk.c (_fwalk): Remove redundant test. 2013-07-09 13:07:16 +00:00
Corinna Vinschen 656df313e0 * libc/stdio/fclose.c: Only use sfp lock to guard non-atomic
changes of flags and fp lock.
	* libc/stdio/freopen.c: Ditto.
	* libc/stdio/freopen64.c: Ditto.
	* libc/stdio/fgetc.c: Revert change from 2009-04-24, remove sfp locks
	which guard entire function to avoid potential deadlocks when using
	stdio functions in multiple thraeds.
	* libc/stdio/fgets.c: Ditto.
	* libc/stdio/fgetwc.c: Ditto.
	* libc/stdio/fgetws.c: Ditto.
	* libc/stdio/fread.c: Ditto.
	* libc/stdio/fseek.c: Ditto.
	* libc/stdio/getc.c: Ditto.
	* libc/stdio/getdelim.c: Ditto.
	* libc/stdio/gets.c: Ditto.
	* libc/stdio/vfscanf.c: Ditto.
	* libc/stdio/vfwscanf.c: Ditto.

	* libc/stdio/fflush.c (_fflush_r): Split out core functionality into
	new function __sflush_r.  Just lock file and call __sflush_r from here.
	* libc/stdio/fwalk.c (_fwalk): Remove static helper function and move
	functionality back into main function. Don't walk a file with flags
	value of 1.  Add comment.
	(_fwalk_reent): Ditto.
	* libc/stdio/local.h (__sflush_r): Declare.
	* libc/stdio/refill.c (__srefill): Before calling fwalk, set flags
	value to 1 so this file pointer isn't walked.  Revert flags afterwards
	and call __sflush_r for this fp if necessary.  Add comments.
2011-01-28 10:49:11 +00:00
Jeff Johnston ceedb0dcb8 2009-01-12 Jeff Johnston <jjohnstn@redhat.com>
* libc/stdio/fwalk.c (__fwalk, __fwalk_reent): Remove locking of
        each fp.  Let the function being called lock the fp, if necessary.
2009-01-12 22:19:11 +00:00
Jeff Johnston 7a0f696676 2004-09-16 Antony King <antony.king@st.com>
* libc/stdio/fwalk.c (_fwalk): Remove check for _GLOBAL_REENT
        and only walk the reentrancy parameter.
        (_fwalk_reent): Ditto.
        * libc/stdlib/exit.c: Remove out of date _REENT_ONLY check.
2004-09-16 21:26:51 +00:00
Jeff Johnston 6194cf4a4b 2004-04-28 Artem B. Bityuckiy <abitytsky@softminecorp.com>
* libc/stdio/local.h (_fwalk_reent): Specify prototype of
        function pointer argument.
        * libc/stdio/fwalk.c (_fwalk, _fwalk_reent): Change prototypes
        to specify function pointer arguments.
        (__fwalk, __fwalk_reent): Ditto.
2004-04-28 18:02:38 +00:00
Jeff Johnston 05b315770a 2004-04-23 Artem B. Bityuckiy <abitytsky@softminecorp.com>
* libc/stdio/asprintf.c libc/stdio/clearerr.c,
        libc/stdio/fclose.c libc/stdio/fcloseall.c libc/stdio/fdopen.c,
        libc/stdio/feof.c libc/stdio/ferror.c libc/stdio/fflush.c,
        libc/stdio/fgetc.c libc/stdio/fgetpos.c libc/stdio/fgets.c,
        libc/stdio/fileno.c libc/stdio/findfp.c libc/stdio/fiprintf.c,
        libc/stdio/flags.c libc/stdio/fopen.c libc/stdio/fprintf.c,
        libc/stdio/fputc.c libc/stdio/fputs.c libc/stdio/fread.c,
        libc/stdio/freopen.c libc/stdio/fscanf.c libc/stdio/fseek.c,
        libc/stdio/fseeko.c libc/stdio/fsetpos.c libc/stdio/ftell.c,
        libc/stdio/ftello.c libc/stdio/fvwrite.c libc/stdio/fwalk.c,
        libc/stdio/fwrite.c libc/stdio/getc.c libc/stdio/getc_u.c,
        libc/stdio/getchar.c libc/stdio/getchar_u.c,
        libc/stdio/getdelim.c libc/stdio/getline.c libc/stdio/gets.c,
        libc/stdio/getw.c libc/stdio/iprintf.c libc/stdio/local.h,
        libc/stdio/makebuf.c libc/stdio/mktemp.c libc/stdio/perror.c,
        libc/stdio/printf.c libc/stdio/putc.c libc/stdio/putc_u.c,
        libc/stdio/putchar.c libc/stdio/putchar_u.c libc/stdio/puts.c,
        libc/stdio/putw.c libc/stdio/refill.c libc/stdio/remove.c,
        libc/stdio/rename.c libc/stdio/rewind.c libc/stdio/rget.c,
        libc/stdio/scanf.c libc/stdio/setbuf.c libc/stdio/setbuffer.c,
        libc/stdio/setlinebuf.c libc/stdio/setvbuf.c,
        libc/stdio/siprintf.c libc/stdio/snprintf.c,
        libc/stdio/sprintf.c libc/stdio/sscanf.c libc/stdio/stdio.c,
        libc/stdio/tmpfile.c libc/stdio/tmpnam.c libc/stdio/ungetc.c,
        libc/stdio/vasprintf.c libc/stdio/vfieeefp.h,
        libc/stdio/vfprintf.c libc/stdio/vfscanf.c,
        libc/stdio/vprintf.c libc/stdio/vscanf.c,
        libc/stdio/vsnprintf.c libc/stdio/vsprintf.c,
        libc/stdio/vsscanf.c libc/stdio/wbuf.c,
        libc/stdio/wsetup.c: Perform minor formatting changes.  Move
        copyright notices to top of file, ensure that <_ansi.h> is
        included, be consistent with open parentheses, use _DEFUN macro,
        include "local.h" where needed, and remove various compiler
        warnings.
2004-04-23 20:01:55 +00:00
Jeff Johnston 47dcaf565d 2004-04-08 Artem B. Bityuckiy <abitytsky@softminecorp.com>
* libc/stdio/fclose.c (_fclose_r): New function.
        * libc/stdio/freopen.c (_freopen_r): Call _fclose_r.
        * libc/stdio/fcloseall.c (_fcloseall_r): Call _fwalk_reent.
        * libc/stdio64/freopen64.c (_freopen64_r): Use _fclose_r.
        * libc/include/stdio.h (_fclose_r): New prototype.
        * libc/stdio/fopen.c: Fix typo in comment.

2004-04-08  Jeff Johnston  <jjohnstn@redhat.com>

        * libc/stdio/fwalk.c (_fwalk_reent): New version of _fwalk
        to handle _r reentrant functions.
2004-04-08 22:26:50 +00:00
Jeff Johnston 10dcf7e718 2004-03-25 Thomas Pfaff <tpfaff@gmx.net>
* libc/stdio/fclose.c (fclose): Protect file pointer list when
        releasing a file.
         * libc/stdio/fcloseall.c (_fcloseall_r): Close all files via
        fwalk.
        * libc/stdio/fdopen.c (_fdopen_r): Add calls to
        _flockfile/_funlockfile.
        * libc/stdio/findfp.c: Move __sfp_lock. Change __sfp_lock type
        to recursive.
        Change __lock_acquire/__lock_release calls for __sfp_lock to
        __sfp_lock_acquire/__sfp_lock_release throughout.
        (std): Make sure that file lock is only initialized once.
        (__sfp): Move _file initialization. Initialize file lock.
        (__sfp_lock_acquire): New function.
        (__sfp_lock_release): Ditto.
        (__fp_lock_all): Remove __sfp_lock_acquire call.
        (__fp_unlock_all): Remove __sfp_lock_release call.
        * libc/stdio/fopen.c (_fopen_r): Protect file pointer list.
        Add calls to _flockfile/_funlockfile. Remove
        __lock_init_recursive call.
        * libc/stdio/freopen.c (_freopen_r): Protect file pointer list.
        * libc/stdio/fwalk.c (__fwalk): New static function.
        (_fwalk): Protect file pointer list. Use __fwalk to walk through
        file pointers.
        * libc/stdio/local.h: Add defines for
        __sfp_lock_acquire/__sfp_lock_release when
        single threaded. Add function prototypes otherwise.
        * libc/stdio64/fdopen64.c (_fdopen64_r): Add calls to
        _flockfile/_funlockfile.
        * libc/stdio/fopen64.c (_fopen64_r): Protect file pointer list.
        Add calls to _flockfile/_funlockfile. Remove
         __lock_init_recursive call.
        * libc/stdio/freopen64.c (_freopen64_r): Protect file pointer
        list.
2004-03-25 22:29:18 +00:00
Jeff Johnston c730e0e7ca 2004-01-30 Jeff Johnston <jjohnstn@redhat.com>
* libc/stdio/fwalk.c (_fwalk.c): Don't traverse the
        file chain on the passed in reentrancy struct if it
        is _GLOBAL_REENT.
2004-01-31 00:39:07 +00:00
Jeff Johnston ff41498a19 2004-01-30 Thomas Pfaff <tpfaff@gmx.net>
Jeff Johnston  <jjohnstn@redhat.com>

        * libc/stdio/fwalk.c (_fwalk): Traverse the given reentrancy
        struct for std streams and traverse the global reeentrancy
        struct for all other streams.
2004-01-30 20:32:04 +00:00
Christopher Faylor 8a0efa53e4 import newlib-2000-02-17 snapshot 2000-02-17 19:39:52 +00:00