Home | History | Annotate | Download | only in stdio
History log of /src/lib/libc/stdio/freopen.c
RevisionDateAuthorComments
 1.22  17-Jan-2018  kamil Revert to commits as they broke few rump tests

"Include namespace.h in a few of libc source files
[...]
This change finishes elimination of usage of the global name of the
following symbols:
- close -> _close
- execve -> _execve
- fcntl -> _fcntl
- setcontext -> _setcontext
- wait6 -> _wait6
- write -> _write
- writev -> _writev"

"Register more syscalls in namespace.h (of libc)

Add weak symbols for:
- fcntl
- close
- execve
- setcontext
- wait6
- write
- writev"

These changes broke:

fs/nfs/t_rquotad:get_nfs_be_1_both
fs/nfs/t_rquotad:get_nfs_be_1_group
fs/nfs/t_rquotad:get_nfs_be_1_user
fs/nfs/t_rquotad:get_nfs_le_1_both
fs/nfs/t_rquotad:get_nfs_le_1_group
fs/nfs/t_rquotad:get_nfs_le_1_user
lib/librumphijack/t_config:fdoff
lib/librumphijack/t_tcpip:http
lib/librumphijack/t_tcpip:nfs
lib/librumphijack/t_vfs:cpcopy
lib/librumphijack/t_vfs:mv_x
lib/librumphijack/t_vfs:paxcopy
net/net/t_forwarding:ipforwarding_fastforward_v4
net/net/t_forwarding:ipforwarding_fastforward_v6
net/net/t_forwarding:ipforwarding_fragment_v4
net/net/t_forwarding:ipforwarding_misc
net/net/t_mtudisc6:mtudisc6_basic

This revert fixes the failures, except lib/librumphijack/t_vfs.

The original changes were added in order to facilitate a usage of
sanitizers against programs linked with NetBSD's libc. It is no longer
needed, so abandon these changes.

Sponsored by <The NetBSD Foundation>
 1.21  05-Jan-2018  kamil Include namespace.h in a few of libc source files

The NetBSD Standard C Library uses internally some of its functions with
a mangled symbol name, usually "_symbol". The internal functions shall not
use the global (public) symbols.

This change finishes elimination of usage of the global name of the
following symbols:
- close -> _close
- execve -> _execve
- fcntl -> _fcntl
- setcontext -> _setcontext
- wait6 -> _wait6
- write -> _write
- writev -> _writev

Sponsored by <The NetBSD Foundation>
 1.20  09-Nov-2017  christos Add O_REGULAR to enforce opening of only regular files
(like we have O_DIRECTORY for directories).
This is better than open(, O_NONBLOCK), fstat()+S_ISREG() because opening
devices can have side effects.
 1.19  27-Mar-2012  christos branches: 1.19.24;
- widen the internal read and write calls to match the syscalls
- add funopen2() which provides access to flush() and the wider calls.
- make use of the new flush call in fmemopen()
 1.18  15-Mar-2012  christos - ansify, knf.
- no functional changes
 1.17  22-Jan-2012  christos From tnozaki@: make fpos_t a complex object that keeps track of the parse
state of the stream. Change argument of the seek function to funopen() from
fpos_t to off_t. Make f{g,s}etpos() use the new fpos_t struct, while providing
backwards compatible entry points. Approved by releng@
 1.16  11-Jan-2010  joerg branches: 1.16.6;
Use a proper char */size_t pair in __sfileext to keep track of the line
buffer for fgetln and fgetwln. Simplifies code by dropping the INT_MAX
related logic. Drop conditionals around FREELB, free(NULL) is valid.
 1.15  13-Mar-2008  christos Since _file is a short, check that the fd fits in it, otherwise bail with
EMFILE. We treat _file as an unsigned short to double our range, with a
special case for -1 (closed). Make a note of what we should do about stdio
if we ever bump libc. We could change _file in the future compatibly to an
int by putting it in the extension space but for now we don't bother.
 1.14  07-Aug-2003  agc branches: 1.14.22; 1.14.28;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22280, verified by myself.
 1.13  18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.12  07-Dec-2001  yamt - make FILE structure extensible without breaking binary-compatibility.
- add fputwc, fgetwc, fwide and related functions.
- add hooks needed to maintain the orientation of file stream.
 1.11  29-Nov-2000  christos branches: 1.11.2;
Add checks for O_NDELAY [which indicates that we only want plain files],
and return an error if the file was not plain.
 1.10  20-Sep-1999  lukem back out the #ifdef _DIAGNOSTIC argument checks; too many people complained.
_DIAGASSERT() is still retained.
 1.9  16-Sep-1999  lukem * use _DIAGASSERT() to check pointer arguments against NULL and file
descriptors against -1 (as appropriate).
* add actual checks which to detect stuff that would trigger_DIAGASSERT(),
and attempt to return a sane error condition.
* knf some code
* remove some `register' decls.

the first two items result in the addition of code similar to the
following in various functions:

_DIAGASSERT(path != NULL)
#ifdef _DIAGNOSTIC
if (path == NULL) {
errno = EFAULT;
return (-1);
}
#endif
 1.8  06-Jan-1999  kleink When reopening in append mode, seek to the end of file in order to have the
internally kept offset pointer reflect this; ftell(3) would report an
incorrect current offset otherwise. From Geoff C. Wing in lib/6381.
 1.7  03-Feb-1998  perry remove obsolete register declarations
 1.6  13-Jul-1997  christos branches: 1.6.2;
Fix RCSID's
Fix gcc warnings.
Add prototypes for functions that were declared in more than one place
to local.h or extern.h and use that instead.
 1.5  04-May-1996  mycroft Change suggested by Chris Torek to fix problem freopen()ing with a closed
file descriptor.
 1.4  02-Feb-1995  jtc branches: 1.4.2;
Merged with 4.4lite.
Changed to conform to NetBSD's new RCS Id convention.
 1.3  26-Aug-1993  jtc Declare rcsid strings so they are stored in text segment.
 1.2  01-Aug-1993  mycroft Add RCS identifiers.
 1.1  21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.2  02-Feb-1995  jtc imported from 44lite
 1.1.1.1  21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.4.2.1  02-Mar-1995  jtc #include "namespace.h"
 1.6.2.1  18-Jan-1999  cgd pull up rev 1.8 from trunk (PR#6381). (kleink)
 1.11.2.2  06-Feb-2002  nathanw #include "reentrant.h" before "local.h" so that the thread types used
in fileext.h are avaliable.
 1.11.2.1  28-Jan-2002  nathanw Catch up to -current.
 1.14.28.1  24-Mar-2008  keiichi sync with head.
 1.14.22.1  23-Mar-2008  matt sync with HEAD
 1.16.6.1  17-Apr-2012  yamt sync with head
 1.19.24.1  12-Apr-2018  msaitoh Pull up following revision(s) (requested by christos in ticket #741):
lib/libc/stdio/flags.c: revision 1.19
lib/libc/stdio/fdopen.c: revision 1.18
sys/kern/vfs_vnops.c: revision 1.196
lib/libc/stdio/freopen.c: revision 1.20
lib/libc/stdio/fopen.c: revision 1.17
external/bsd/nvi/dist/common/recover.c: revision 1.10
external/bsd/nvi/dist/common/recover.c: revision 1.11
lib/libc/sys/open.2: revision 1.58
sys/sys/fcntl.h: revision 1.49
make the checkok test stricter to avoid races, and use O_REGULAR.
Instead of opening the file and using popen(3), pass the file descriptor
to sendmail directory. Idea and code from Todd Miller.
Add O_REGULAR to enforce opening of only regular files
(like we have O_DIRECTORY for directories).
This is better than open(, O_NONBLOCK), fstat()+S_ISREG() because opening
devices can have side effects.

RSS XML Feed