History log of /freebsd-10.0-release/include/stdio.h
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 259065 07-Dec-2013 gjb

- Copy stable/10 (r259064) to releng/10.0 as part of the
10.0-RELEASE cycle.
- Update __FreeBSD_version [1]
- Set branch name to -RC1

[1] 10.0-CURRENT __FreeBSD_version value ended at '55', so
start releng/10.0 at '100' so the branch is started with
a value ending in zero.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

# 256281 10-Oct-2013 gjb

Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


# 247411 27-Feb-2013 jhb

Add an implementation of open_memstream() and open_wmemstream(). These
routines provide write-only stdio FILE objects that store their data in a
dynamically allocated buffer. They are a string builder interface somewhat
akin to a completely dynamic sbuf.

Reviewed by: bde, jilles (earlier versions)
MFC after: 1 month


# 246120 30-Jan-2013 gahr

Add fmemopen(3), an interface to get a FILE * from a buffer in memory, along
with the respective regression test.
See http://pubs.opengroup.org/onlinepubs/9699919799/functions/fmemopen.html

Reviewed by: cognet
Approved by: cognet


# 233600 28-Mar-2012 theraven

Correctly expose xlocale functions if people include the headers in the wrong
order (as some ports apparently do).

Approved by: dim (mentor)


# 228924 28-Dec-2011 delphij

In POSIX.1-2008:

P_tmpdir [OB XSI] Default directory prefix for tempnam().

This macro is used in a lot of places in legacy applications,
and is why we see a lot of programs written for e.g. Linux
store volatile temporary files in /var/tmp and not /tmp.

MFC after: 2 months


# 228875 25-Dec-2011 theraven

Restore __is_threaded in C++ mode. Some Google stuff needs it apparently.

Reported by: swills
Approved by: dim (mentor)


# 228468 13-Dec-2011 ed

Replace __const by const in all non-contributed source code.

As C1X is close to being released, there is no need to wrap around a
feature that is already part of C90. Most of these files already use
`const' in different placed as well.


# 227487 13-Nov-2011 theraven

The spec says that FILE must be defined in wchar.h, but it wasn't. It
is now. Also hide some macros in C++ mode that will break C++
namespaced calls.

Approved by: dim (mentor)


# 210957 06-Aug-2010 ed

Remove stale reference to UT_NAMESIZE from <stdio.h>.

Spotted by: bde@


# 203964 16-Feb-2010 imp

Remove the Berkeley clause 3's.
Add a few $FreeBSD$


# 194801 23-Jun-2009 delphij

Merge fmtcheck() prototype change.

Obtained from: NetBSD


# 190409 25-Mar-2009 das

Make programs that define a macro called `dprintf' more likely to work.


# 189818 14-Mar-2009 das

Namespace: dprintf() and getline() are in P1003.1-2008.


# 189356 04-Mar-2009 das

Add dprintf() and vdprintf() from POSIX.1-2008. Like getline(),
dprintf() is a simple wrapper around another function, so we may as
well implement it. But also like getline(), we can't prototype it by
default right now because it would break too many ports.


# 189355 04-Mar-2009 das

Add renameat to the POSIX.1-2008 namespace.


# 189136 28-Feb-2009 das

- Add getdelim(), getline(), stpncpy(), strnlen(), wcsnlen(),
wcscasecmp(), and wcsncasecmp().
- Make some previously non-standard extensions visible
if POSIX_VISIBLE >= 200809.
- Use restrict qualifiers in stpcpy().
- Declare off_t and size_t in stdio.h.
- Bump __FreeBSD_version in case the new symbols (particularly
getline()) cause issues with ports.

Reviewed by: standards@


# 178829 07-May-2008 jhb

Tag FILE's _bf as being part of the public ABI as well due to the in-tree
sort(1) referencing it.


# 178782 05-May-2008 jhb

Retire the __fgetcookie(), __fgetpendout(), and __fsetfileno() accessors
as we aren't hiding FILE's internals anymore.


# 178779 05-May-2008 jhb

Note that FILE's __cookie is also part of the public ABI.


# 178778 05-May-2008 jhb

Expose FILE's internals to the world again in all their glory. Restore
all the previous inline optimizations as well. FILE is back to using
__mbstate_t, struct pthread *, and struct pthread_mutex *.


# 178755 03-May-2008 marcel

Unbreak build: gnu sort has been configured to grope inside struct
__sFILE. It's opaque now, so add a function that returns the pending
output bytes.

Pointy hat: jhb


# 178747 03-May-2008 marcel

Unbreak build: libftpio gropes inside struct __sFILE. Implement
accessor functions for its benefit now thaat FILE is opaque.
I'm sure there's a better way. I leave that for people to work
on in a src tree that isn't broken.

Pointy hat: jhb


# 178723 02-May-2008 jhb

Axe now-empty __BSD_VISIBLE block that held renameat().

Reported by: kib
Pointy hat: jhb


# 178722 02-May-2008 jhb

- Move declaration of renameat() to the existing section of BSD_VISIBLE
function prototypes.
- Fix a few whitespace inconsistencies in prototypes.

MFC after: 1 month


# 178721 02-May-2008 jhb

Next round of stdio changes: Remove all inlining of stdio operations and
move the definition of the type backing FILE (struct __sFILE) into an
internal header.
- Remove macros to inline certain operations from stdio.h. Applications
will now always call the functions instead.
- Move the various foo_unlocked() functions from unlocked.c into foo.c.
This lets some of the inlining macros (e.g. __sfeof()) move into
foo.c.
- Update a few comments.
- struct __sFILE can now go back to using mbstate_t, pthread_t, and
pthread_mutex_t instead of knowing about their private, backing types.

MFC after: 1 month
Reviewed by: kan


# 178287 17-Apr-2008 jhb

Next stage of stdio cleanup: Retire __sFILEX and merge the fields back into
__sFILE. This was supposed to be done in 6.0. Some notes:
- Where possible I restored the various lines to their pre-__sFILEX state.
- Retire INITEXTRA() and just initialize the wchar bits (orientation and
mbstate) explicitly instead. The various places that used INITEXTRA
didn't need the locking fields or _up initialized. (Some places needed
_up to exist and not be off the end of a NULL or garbage pointer, but
they didn't require it to be initialized to a specific value.)
- For now, stdio.h "knows" that pthread_t is a 'struct pthread *' to
avoid namespace pollution of including all the pthread types in stdio.h.
Once we remove all the inlines and make __sFILE private it can go back
to using pthread_t, etc.
- This does not remove any of the inlines currently and does not change
any of the public ABI of 'FILE'.

MFC after: 1 month
Reviewed by: peter


# 178282 17-Apr-2008 jhb

Specifically mark the members of 'FILE' that are accessed via inline
functions or macros since they are part of the public ABI as a result.

MFC after: 1 month


# 177791 31-Mar-2008 kib

Add the libc glue and headers definitions for the *at() syscalls.

Based on the submission by rdivacky,
sponsored by Google Summer of Code 2007
Reviewed by: rwatson, rdivacky
Tested by: pho


# 177653 26-Mar-2008 jb

Allow an application to define FOPEN_MAX (like we allow for OPEN_MAX
in sys/syslimits.h).


# 168469 07-Apr-2007 pjd

- Remove SEEK_DATA and SEEK_HOLE from stdio.h, they don't belong here.
- Only define SEEK_DATA and SEEK_HOLE in sys/unistd.h when neither
_POSIX_SOURCE nor _XOPEN_SOURCE is defined.

Pointed out by: bde, ache


# 168397 05-Apr-2007 pjd

Implement SEEK_DATA and SEEK_HOLE extensions to lseek(2) as found in
OpenSolaris. For more information please refer to:

http://blogs.sun.com/bonwick/entry/seek_hole_and_seek_data


# 157960 22-Apr-2006 deischen

Add a prototype for fcloseall().


# 154867 26-Jan-2006 stefanf

Analogous to __printflike and __scanflike, add the macro __format_arg which
expands to the GCC format_arg attribute if supported.

This fixes a syntax error in <nl_types.h> for compilers/tools not
implementing the GCC __attribute__ extensions.


# 130773 20-Jun-2004 tjr

Remove outdated comments.


# 129774 27-May-2004 tjr

Bring back the macro versions of getwc(), getwchar(), putwc() and
putwchar(), but this time avoid redundantly declaring __stdinp and
__stdoutp when source files include both <stdio.h> and <wchar.h>.


# 127230 20-Mar-2004 tjr

Parenthesize function names in masking macros for getc() etc. for the
benefit of obsolete C preprocessors.


# 127100 16-Mar-2004 tjr

Re-add macro versions of getc(), getchar(), putc(), putchar(), feof(),
ferror(), fileno() and clearerr(), using the value of __isthreaded to
decide between the fast inline single-threaded code and the more
general function equivalent. This gives most of the performance
benefits of the old unsafe macros while preserving thread safety.


# 123257 07-Dec-2003 marcel

Change the definition of NULL on ia64 (for LP64 compilations) from
an int constant to a long constant. This change improves consistency
in the following two ways:
1. The first 8 arguments are always passed in registers on ia64, which
by virtue of the generated code implicitly widens ints to longs and
allows the use of an 32-bit integral type for 64-bit arguments.
Subsequent arguments are passed onto the memory stack, which does
not exhibit the same behaviour and consequently do not allow this.
In practice this means that variadic functions taking pointers
and given NULL (without cast) work as long as the NULL is passed
in one of the first 8 arguments. A SIGSEGV is more likely the
result if such would be done for stack-based arguments. This is
due to the fact that the upper 4 bytes remain undefined.
2. All 64-bit platforms that FreeBSD supports, with the obvious
exception of ia64, allow 32-bit integral types (specifically NULL)
when 64-bit pointers are expected in variadic functions by way of
how the compiler generates code. As such, code that works correctly
(whether rightfully so or not) on any platform other than ia64, may
fail on ia64.

To more easily allow tweaking of the definition of NULL, this commit
removes the 12 definitions in the various headers and puts it in a
new header that can be included whenever NULL is to be made visible.

This commit fixes GNOME, emacs, xemacs and a whole bunch of ports
that I don't particularly care about at this time...


# 109168 13-Jan-2003 tjr

Add prototypes for the non-standard _unlocked functions.


# 105098 14-Oct-2002 tjr

Use a weak reference instead of a macro to make vfscanf an alias
for __vfscanf.


# 104989 12-Oct-2002 mike

Add restrict type-qualifier.


# 104941 11-Oct-2002 peter

Zap the early-adopter transition aid before we get into serious
5.0-R territory, as threatened. This only affects antique 5.0
systems that have not had a 'make world' done for well over a year.


# 104585 06-Oct-2002 mike

o Move location of the fpos_t typedef to be closer to other typedefs.
o Add typedef for va_list.
o Add comment about missing restrict type-qualifiers.
o Move vscanf(), vsscanf() and vfscanf() to the C99-visible block.
o Add note about missing backing function for vfscanf().
o Restrict L_cuserid to only older versions of POSIX, and BSD
namespaces.
o Conditionalize some BSD-specific foo_unlock() macros.


# 103012 06-Sep-2002 tjr

Style: One space between "restrict" qualifier and "*".


# 102227 21-Aug-2002 mike

o Merge <machine/ansi.h> and <machine/types.h> into a new header
called <machine/_types.h>.
o <machine/ansi.h> will continue to live so it can define MD clock
macros, which are only MD because of gratuitous differences between
architectures.
o Change all headers to make use of this. This mainly involves
changing:
#ifdef _BSD_FOO_T_
typedef _BSD_FOO_T_ foo_t;
#undef _BSD_FOO_T_
#endif
to:
#ifndef _FOO_T_DECLARED
typedef __foo_t foo_t;
#define _FOO_T_DECLARED
#endif

Concept by: bde
Reviewed by: jake, obrien


# 101914 15-Aug-2002 robert

- For compliance with IEEE Std 1003.1-2001, add the 'restrict'
qualifier to function prototypes and definitions where
appropriate using the '__restrict' macro.
- Update the manual page.


# 101913 15-Aug-2002 robert

- Introduce the 'restrict' qualifier to function prototypes and
definitions to comply with IEEE Std 1003.1-2001.
- Update the manual pages.


# 101889 14-Aug-2002 robert

- Add the 'restrict' qualifier to the function definitions and
public prototypes of setbuf(3) and setvbuf(3) using the
'__restrict' macro from <sys/cdefs.h> to be compliant with
IEEE Std 1003.1-2001.
- Replace the K&R with ANSI-C function definitions.
- Bring the manual page up-to-date.


# 100133 15-Jul-2002 wollman

Clean up some of the rather strange structure and ordering of this
file. Correct visibility conditions and order blocks of declarations
in order of increasing inclusiveness. Note that [v]snprintf() is now
in ISO C and f{seek,tell}o() are now in POSIX. Deprecated getw() and
putw() are no longer visible in XSH6 namespace (and should probably
be removed from BSD namespace as well).


# 93032 23-Mar-2002 imp

Breath deep and take __P out of the system include files.

# This appears to not break X11, but I'm having problems compiling the
# glide part of the server with or without this patch, so I can't tell
# for sure.


# 87379 05-Dec-2001 obrien

An extra #ifdef crept in with rev 1.38.


# 87369 04-Dec-2001 obrien

Turn back on fmtcheck's attribute checks, guarded for non-GCC compilers.

Submitted by: bde


# 87319 03-Dec-2001 obrien

Remove the GCC'ism "__attribute__" from the 'fmtcheck' prototype.
I leave it up to someone else to fix this breakage properly.


# 83712 20-Sep-2001 peter

Now that the compat4x libc.so.4 binary has been updated, we can finally
switch over to using a future-proof stdin/out/err.

Note that if you run 4.x binaries on your system, you will certainly
want to update /usr/lib/compat/libc.so.4. The easiest way is to
add "COMPAT4X= yes" in your /etc/make.conf.


# 81600 13-Aug-2001 peter

Rip out the old __stdin/out/err stuff. It was completely 100% useless. :-(
It was foiled because of dynamic copy relocations that caused compile-time
space to be reserved in .bss and at run time a blob of data was copied to
that space and everything used the .bss version.. The problem is that
the space is reserved at compile time, not runtime... So we *still* could
not change the size of FILE. Sigh. :-(

Replace it with something that does actually work and really does let us
make 'FILE' extendable. It also happens to be the same as Linux does in
glibc, but has the slight cost of a pointer. Note that this is the
same cost that 'fp = fopen(), fprintf(fp, ...); fclose(fp);' has.
Fortunately, actual references to stdin/out/err are not all that common
since we have implicit stdin/out/err-using versions of functions
(printf() vs. fprintf()).


# 75818 21-Apr-2001 obrien

Style(9) fixes:
* get rid of space (0x20) before tab (^I)
* indent with ^I, not 0x20
* continuation line for prototypes is for 0x20's past function's name col.
* etc.


# 75621 17-Apr-2001 kris

I think this was supposed to be __const like in NetBSD: I have no idea
why I changed it to const.

Noticed by: David Wolfskill <david@catwhisker.org>


# 75578 17-Apr-2001 kris

Add fmtcheck(), a function for checking consistency of format string
arguments where the format string is obtained from user data, or
otherwise difficult to verify statically.

Example usage:

printf(fmtcheck(user_format, standard_format), arg1, arg2);

checks the format string user_format for consistency (same number/order/
type of format operators) with standard_format. If they differ,
standard_format is used instead to avoid potential crashes or security
violations.

Obtained from: NetBSD
Reviewed by: -arch


# 73254 01-Mar-2001 deischen

Hide the definition of struct __sFILEX and add the needed
lock definitions to it. flockfile state is now allocated
along with the rest of FILE. This eliminates the need for a
separate allocation of flockfile state as well as eliminating
the mutex/lock used to serialize its allocation.


# 72529 16-Feb-2001 imp

Fix the current libc breakage in current:
o Back out the __std* stuff. Can't figure out how to do this right now,
so we'll save it for late.
o use _up as a pointer for extra fields that we need to access.
o back out the libc major version bump.

Submitted by: green
reviewed by: peter, imp, green, obrien (to varying degrees).

We'll fix the "how do we stop encoding sizeof(FILE) in binaries" part
later.


# 72472 14-Feb-2001 peter

Commit a libc fix going by the current state of the version numbering
bikeshed in -arch. It isn't quite over, but it has been well established
that this can be adjusted or refined. But we do seem to have consensis
on a major bump of some sort. After this, it should reasonably safe
to build world again.

This change is to get rid of __sF[] and use seperate __stdin/out/err
handles. This means we can pad on extra bits onto the end of FILE
at will without going through this all over again. __sF[] was evil
because it compiled the sizeof(FILE) into every stdio using program.

Asbestos suit on: check!
Peril sensitive sunglasses on: check!
*gulp!*


# 72394 12-Feb-2001 peter

It sounded like a good idea at the time. The previous change breaks
FILE *buffer = stdout;
so back it out for now.


# 72391 12-Feb-2001 peter

Take advantage of the current libc sizeof(FILE) breakage (__sF[]) and
try a hopefully more robust stdin/stdout/stderr. This costs an indirect
pointer fetch, but saves us from changes in 'FILE'. The __stdin stuff
is there to not pollute application name space if the application does
not use <stdio.h> and also in case something depended on the current
behavior where stdin etc was a #define.

Reviewed by: eischen, dillon


# 72372 11-Feb-2001 deischen

libc MT-safety, part 2.

Add a lock to FILE and define an additional flag.


# 71580 24-Jan-2001 deischen

Add a lock to DIR to make telldir and friends MT-safe.

Clean up stdio.h a bit and remove _THREAD_SAFE. Some of the
usual macros getc, putc, getchar, putchar are no longer macros.

Approved by: -arch


# 55036 23-Dec-1999 bde

Fixed missing declaration of ctermid_r(3).


# 50473 27-Aug-1999 peter

$Id$ -> $FreeBSD$


# 43782 08-Feb-1999 dt

Added functions fseeko() and ftello() (from susv2).
Fixed fgetpos() and fsetpos() for offsets > 2GB.

PR: 8637
Submitted by: Dan Nelson <dnelson@emsphone.com> (adjusted by me a little)


# 41798 14-Dec-1998 dt

Make this protototype of mmap return void *, like two other copies.


# 37614 13-Jul-1998 bde

Added macros __printflike() and __scanflike() to <sys/cdefs.h>.
Use them to `make gcc -Wformat' check formats for all printf-like
and scanf-like functions in /usr/src except for the err()/warn()
family. err() isn't quite printf-like since its format arg can
legitimately be NULL. syslog() isn't quite printf-like, but gcc
already accepts %m, even for plain printf() when it shouldn't.


# 37489 07-Jul-1998 peter

New flag for internal stdio use to enable dynamic string allocation for
asprintf() implementation.

Obtained from: Todd Miller <Todd.Miller@courtesan.com> via OpenBSD


# 36981 14-Jun-1998 bde

Complete the switch to using gcc-2.4 features to declare fpos_t ,
as threatened in the 4-5 year old comment. Most of the change is
in <machine/ansi.h>; this commit just removes cruft for the strict
ANSI case. 64-bit types couldn't actually be defined using
__attribute__(()) in gcc-2.4, since attribute names in the
implementation namespace only became available in gcc-2.7. I've
probably just broken gcc-2.6 support by using the gcc-2.7 names
unconditionally.


# 35758 05-May-1998 jb

I have a long list of issues to address here, mostly related to
namespace and revision levels of ANSI and POSIX. This change only
removes the leading underscrore from the FILE locking functions
that POSIX defines.


# 35163 12-Apr-1998 jb

Format changes in an attempt to address some of Bruce's comments
about spaces and tabs.

The externs in the static inline functions remain 'cause (a) they're
required; and (b) I can't find any gcc -W* cases where they generate
warnings.


# 35127 11-Apr-1998 jb

Add *_unlocked() macros according to POSIX. In the _THREAD_SAFE case,
test for __isthreaded before calling the lock/unlock functions to
try to save some performance. The _THREAD_SAFE case should become the
default, but since it tests for a global variable in libc, people won't
be able to build -current on pre-3.0 systems unless the default leaves
it out. Such is life.


# 32166 01-Jan-1998 alex

Added missing caddr_t --> void * conversions for sys/mman.h functions.

Submitted by: bde


# 24897 13-Apr-1997 bde

Removed nonstandard #include of <sys/types.h>.

Use _BSD_OFF_T_ instead of off_t so that we're still self-sufficent.

Copied the ftruncate/lseek()/mmap()/truncate() redeclaration hacks
from <sys/types.h> so that things depending on them don't break.


# 23655 11-Mar-1997 peter

Merge Lite2 changes
(Just version number)


# 23260 02-Mar-1997 ache

increase L_cuserid because UT_NAMESIZE increased


# 23037 23-Feb-1997 peter

Revert $FreeBSD$ to $Id$


# 21673 14-Jan-1997 jkh

Make the long-awaited change from $Id$ to $FreeBSD$

This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore. This update would have been
insane otherwise.


# 19211 27-Oct-1996 wosch

improve comments for UT_NAMESIZE


# 16920 02-Jul-1996 wosch

remove zopen, zopen is not part of libc.


# 15931 27-May-1996 peter

Add an implementation of the gnu-ish asprintf() and vasprintf(). They are
not based on gpl'ed code, just prototype and usage. I'm not 100% certain
they behave the same while the system is in trouble (eg: malloc() failing)
but in those circumstances all bets would be off anyway.

These routines work like sprintf() and vsprintf(), except that instead of
using a fixed buffer, they allocate memory and return it to the user
and it's the user's responsibility to free() it. They have allocate as
much memory as they need (and can get), so the size of strings it can deal
with is limited only by the amount of memory it can malloc() on your
behalf.

There are a few gpl'ed programs starting to use this interface, and it's
becoming more common with the scares about security risks with sprintf().
I dont like the look of the code that the various programs (including
cvs, gdb, libg++, etc) provide if configure can't find it on the system.

It should be possible to modify the stdio core code to provide this
interface more efficiently, I was more worried about having something
that worked and was secure. :-) (I noticed that there was once intended
to be a smprintf() routine when our stdio was written for 4.4BSD, but it
looks pretty stillborn, and it's intended interface is not clear). Since
Linux and gnu libc have this interface, it seemed silly to bring yet
another one onto the scene.


# 14791 24-Mar-1996 paul

Fix incorrect parameter types for ftell and fgets.


# 13771 30-Jan-1996 mpp

Fix a bunch of spelling errors in the comment fields
of a bunch of system include files.


# 8858 30-May-1995 rgrimes

Remove trailing whitespace.


# 6895 04-Mar-1995 phk

make sys_nerr __const.

Reviewed by: phk
Submitted by: ollivier


# 1540 24-May-1994 rgrimes

This commit was generated by cvs2svn to compensate for changes in r1539,
which included commits to RCS files with non-trunk default branches.


# 1539 24-May-1994 rgrimes

BSD 4.4 Lite Include Sources