History log of /freebsd-current/include/stdio.h
Revision Date Author Comments
# 5af6fbd7 14-May-2024 Kyle Evans <kevans@FreeBSD.org>

ssp: appease -Wgnu-statement-expression-from-macro-expansion

It's a stupid warning, but some ports enable it by default and were
already defining _FORTIFY_SOURCE, thus exposing the new macros
immediately. This at least fixes the libfido2 build, perhaps others as
well.

While we're here, fix a fresh build of stand w/ FORTIFY_SOURCE enabled
by not pulling in the ssp headers if _STANDALONE is defined. We do not
have runtime support in libsa as of the time of writing.

Reported by: netchild
Sponsored by: Stormshield
Sponsored by: Klara, Inc.


# 9bfd3b40 12-May-2024 Kyle Evans <kevans@FreeBSD.org>

Add a build knob for _FORTIFY_SOURCE

In the future, we will Default to _FORTIFY_SOURCE=2 if SSP is enabled,
otherwise default to _FORTIFY_SOURCE=0. For now we default it to 0
unconditionally to ease bisect across older versions without the new
symbols, and we'll put out a call for testing.

include/*.h include their ssp/*.h equivalents as needed based on the
knob. Programs and users are allowed to override FORTIFY_SOURCE in their
Makefiles or src.conf/make.conf to force it off.

Reviewed by: des, markj
Relnotes: yes
Sponsored by: Stormshield
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D32308


# 5a1d1441 23-Nov-2023 Warner Losh <imp@FreeBSD.org>

include: Remove ancient SCCS tags.

Remove ancient SCCS tags from the tree, automated scripting, with two
minor fixup to keep things compiling. All the common forms in the tree
were removed with a perl script.

Sponsored by: Netflix


# 5d518624 15-Sep-2023 Warner Losh <imp@FreeBSD.org>

Restrict the glibc compat cookie open functions to __BSD_VISIBLE

Sponsored by: Netflix


# 42b38843 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: one-line .h pattern

Remove /^\s*\*+\s*\$FreeBSD\$.*$\n/


# b85ea809 02-Feb-2020 Kyle Evans <kevans@FreeBSD.org>

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


# 12fe218f 29-Jan-2020 Kyle Evans <kevans@FreeBSD.org>

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


# 7f3ea0ab 09-Sep-2019 Konstantin Belousov <kib@FreeBSD.org>

Make snprintf(3) and vscanf(3) definitions available under appropriate
POSIX visibility.

Reported by: jbeich
Reviewed by: jilles
PR: 207287
MFC after: 1 week


# 7381dcc9 01-Sep-2019 Ed Maste <emaste@FreeBSD.org>

libc: remove gets

gets is unsafe and shouldn't be used (for many years now). Leave it in
the existing symbol version so anything that previously linked aginst it
still runs, but do not allow new software to link against it.

(The compatability/legacy implementation must not be static so that
the symbol and in particular the compat sym gets@FBSD_1.0 make it
into libc.)

PR: 222796 (exp-run)
Reported by: Paul Vixie
Reviewed by: allanjude, cy, eadler, gnn, jhb, kib, ngie (some earlier)
Relnotes: Yes
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D12298


# 11478453 20-Aug-2019 Dimitry Andric <dim@FreeBSD.org>

Vendor import of stripped libc++ trunk r366426 (just before the release_90 branch
point):

https://llvm.org/svn/llvm-project/libcxx/trunk@366426


# f3620262 28-Jul-2018 Dimitry Andric <dim@FreeBSD.org>

Vendor import of libc++ trunk r338150:
https://llvm.org/svn/llvm-project/libcxx/trunk@338150


# dc711d6d 03-Apr-2018 Cy Schubert <cy@FreeBSD.org>

Remove redundant check.

Reported by: kib@
MFC after: 2 weeks
X-MFC with: r331936
Differential Revision: https://reviews.freebsd.org/D12785


# c13559d3 03-Apr-2018 Cy Schubert <cy@FreeBSD.org>

Include update to stdio.h missed in r331936.

In my attempt to limit the commit in r331936 to only the gets_s()
commit and not include unrelated patches in my tree, this patch
was missed.

Reported by: pfg
MFC after: 2 weeks
X-MFC with: r331936
Differential Revision: https://reviews.freebsd.org/D12785


# 2321c474 20-Nov-2017 Pedro F. Giffuni <pfg@FreeBSD.org>

include: further adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 3-Clause license.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.


# edb11085 01-Jun-2017 Dimitry Andric <dim@FreeBSD.org>

Vendor import of libc++ trunk r304460:
https://llvm.org/svn/llvm-project/libcxx/trunk@304460


# 5a6d7b72 23-May-2017 Eric van Gyzen <vangyzen@FreeBSD.org>

libthr: fix warnings from GCC when WARNS=6

Fix warnings about:
- redundant declarations
- a local variable shadowing a global function (dlinfo)
- an old-style function definition (with an empty parameter list)
- a variable that is possibly used uninitialized

"make tinderbox" passes this time, except for a few unrelated
kernel failures.

Reviewed by: kib
MFC after: 3 days
Sponsored by: Dell EMC
Differential Revision: https://reviews.freebsd.org/D10870


# 7582e393 16-May-2017 Dimitry Andric <dim@FreeBSD.org>

Vendor import of libc++ trunk r303197:
https://llvm.org/svn/llvm-project/libcxx/trunk@303197


# 0558617b 29-Apr-2017 Pedro F. Giffuni <pfg@FreeBSD.org>

<stdio.h>: ftello() and fseeko() were in SUSv2, so extend visibility.

See:

http://pubs.opengroup.org/onlinepubs/007908799/xsh/fseek.html
http://pubs.opengroup.org/onlinepubs/007908799/xsh/ftell.html

Hinted from: DragonFlyBSD (git 58696e28)


# 649702c5 28-Jan-2017 Pedro F. Giffuni <pfg@FreeBSD.org>

Make use of clang nullability attributes.

Replace uses of the GCC __nonnull__ attribute with the clang nullability
qualifiers. The replacement should be transparent for clang developers as
the new qualifiers will produce the same warnings and will be useful for
static checkers but will not cause aggressive optimizations.

GCC will not produce such warnings and developers will have to use
upgraded GCC ports built with the system headers from r312538.

Hinted by: Apple's Libc-1158.20.4, Bionic libc
MFC after: 11.1 Release

Differential Revision: https://reviews.freebsd.org/D9004


# d6744932 01-Oct-2016 Eric van Gyzen <vangyzen@FreeBSD.org>

Add the __printflike attribute to the declaration of vdprintf(3)

I intended to add this in r306568.

MFC after: 3 days
Sponsored by: Dell EMC


# 21ac7a7f 01-Oct-2016 Eric van Gyzen <vangyzen@FreeBSD.org>

Add the __printflike attribute to the declaration of dprintf(3)

MFC after: 3 days
Sponsored by: Dell EMC


# 08ed5b80 02-Aug-2016 Warner Losh <imp@FreeBSD.org>

tools/build looks for _WITH_GETLINE in /usr/include/stdio.h to see if
we need to include it in -legacy or not. Since the ifdef was removed,
this broke building 10.x and older source trees on -current. Restore
just enough of _WITH_GETLINE to allow these older source trees to
still build and properly omit getline() from their -legacy library.


# dd47921e 29-Jul-2016 Baptiste Daroussin <bapt@FreeBSD.org>

Remove _WITH_GETLINE and _WITH_DPRINTF guards

When adding getline(3) and dprintf(3) into libc, those guards were added
to prevent breaking too many ports.

7 years later the ports tree have been fixed, it is time to remove this
FreeBSDism

While here remove the extra parenthesis surrounding dprintf(3)


# 9183be81 12-May-2016 Conrad Meyer <cem@FreeBSD.org>

stdio.h: Fix function-type typedef style and use _types.h __ssize_t

I'm still not sure why only Pypy runs into the error with the function
typedefs. Fix it anyway.

Use __ssize_t instead of ssize_t for the types; it's possible for the size_t
type to not be visible if at the wrong POSIX_VISIBLE level.

A final (crossing my fingers) follow-up to r299456.

Sponsored by: EMC / Isilon Storage Division


# 6710d21d 12-May-2016 Conrad Meyer <cem@FreeBSD.org>

Pollute more places with off64_t and add __off64_t

Despite the private namespace, several broken ports depend on the __off64_t
name for the type. Export it exactly the same way off_t and __off_t are
exported.

A follow-up to r299456.

Suggested by: php56
Sponsored by: EMC / Isilon Storage Division


# 877a840c 11-May-2016 Conrad Meyer <cem@FreeBSD.org>

libc: Add fopencookie(3) wrapper around funopen(3)

Reviewed by: jhb, oshogbo
Sponsored by: EMC / Isilon Storage Division
Differential Revision: https://reviews.freebsd.org/D6282


# b4c64ad9 30-Dec-2015 Dimitry Andric <dim@FreeBSD.org>

Vendor import of libc++ trunk r256633:
https://llvm.org/svn/llvm-project/libcxx/trunk@256633


# 8b63538d 28-Oct-2015 Andrey A. Chernov <ache@FreeBSD.org>

Add _flags2 per jhb@ suggestion since no room left in _flags.
Rewrite O_APPEND flag checking using new __S2OAP flag.

MFC after: 3 weeks


# fd109954 04-Jul-2015 Mariusz Zaborski <oshogbo@FreeBSD.org>

Add fdclose(3) function.

This function is equivalent to fclose(3) function except that it
does not close the underlying file descriptor.
fdclose(3) is step forward to make FILE structure private.

Reviewed by: wblock, jilles, jhb, pjd
Approved by: pjd (mentor)
Differential Revision: https://reviews.freebsd.org/D2697


# addf3409 11-Feb-2015 Bryan Drewery <bdrewery@FreeBSD.org>

Correct and clarify comment for __SMBF.

MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division


# 76902266 11-May-2014 Jilles Tjoelker <jilles@FreeBSD.org>

include: Don't expose L_cuserid in strict C standard compliance mode.

L_cuserid is supposed to be exposed only for old POSIX, or in the default
(expose everything) environment.


# 448f5f73 11-May-2014 Jilles Tjoelker <jilles@FreeBSD.org>

include: Remove checks for __BSD_VISIBLE where redundant with __XSI_VISIBLE
or __POSIX_VISIBLE.

Whenever <sys/cdefs.h> sets __BSD_VISIBLE to non-zero, it also sets
__POSIX_VISIBLE and __XSI_VISIBLE to the newest version supported.

No functional change is intended.


# 9240031a 27-Feb-2013 John Baldwin <jhb@FreeBSD.org>

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


# 96c95412 30-Jan-2013 Pietro Cerutti <gahr@FreeBSD.org>

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


# 3ac9d659 27-Mar-2012 David Chisnall <theraven@FreeBSD.org>

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

Approved by: dim (mentor)


# c8fb747d 27-Dec-2011 Xin LI <delphij@FreeBSD.org>

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


# eb1f614b 25-Dec-2011 David Chisnall <theraven@FreeBSD.org>

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

Reported by: swills
Approved by: dim (mentor)


# f6ab8089 13-Dec-2011 Ed Schouten <ed@FreeBSD.org>

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.


# c9e7ce2f 13-Nov-2011 David Chisnall <theraven@FreeBSD.org>

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)


# a7d5f7eb 19-Oct-2010 Jamie Gritton <jamie@FreeBSD.org>

A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.


# cdd337c2 06-Aug-2010 Ed Schouten <ed@FreeBSD.org>

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

Spotted by: bde@


# fe0506d7 09-Mar-2010 Marcel Moolenaar <marcel@FreeBSD.org>

Create the altix project branch. The altix project will add support
for the SGI Altix 350 to FreeBSD/ia64. The hardware used for porting
is a two-module system, consisting of a base compute module and a
CPU expansion module. SGI's NUMAFlex architecture can be an excellent
platform to test CPU affinity and NUMA-aware features in FreeBSD.


# f2556687 16-Feb-2010 Warner Losh <imp@FreeBSD.org>

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


# efa952cd 23-Jun-2009 Xin LI <delphij@FreeBSD.org>

Merge fmtcheck() prototype change.

Obtained from: NetBSD


# bccfb078 25-Mar-2009 David Schultz <das@FreeBSD.org>

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


# 44bf9512 14-Mar-2009 David Schultz <das@FreeBSD.org>

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


# ad760e6f 03-Mar-2009 David Schultz <das@FreeBSD.org>

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.


# 38953375 03-Mar-2009 David Schultz <das@FreeBSD.org>

Add renameat to the POSIX.1-2008 namespace.


# 69099ba2 27-Feb-2009 David Schultz <das@FreeBSD.org>

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


# d7f03759 19-Oct-2008 Ulf Lilleengen <lulf@FreeBSD.org>

- Import the HEAD csup code which is the basis for the cvsmode work.


# 41a5b871 07-May-2008 John Baldwin <jhb@FreeBSD.org>

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


# 143b9461 05-May-2008 John Baldwin <jhb@FreeBSD.org>

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


# a1b482ad 05-May-2008 John Baldwin <jhb@FreeBSD.org>

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


# 19e03ca8 05-May-2008 John Baldwin <jhb@FreeBSD.org>

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 *.


# 0aca787a 03-May-2008 Marcel Moolenaar <marcel@FreeBSD.org>

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


# 430f2c87 03-May-2008 Marcel Moolenaar <marcel@FreeBSD.org>

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


# e15fdac7 02-May-2008 John Baldwin <jhb@FreeBSD.org>

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

Reported by: kib
Pointy hat: jhb


# 163b945a 02-May-2008 John Baldwin <jhb@FreeBSD.org>

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

MFC after: 1 month


# c17bf9a9 02-May-2008 John Baldwin <jhb@FreeBSD.org>

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


# 1e98f887 17-Apr-2008 John Baldwin <jhb@FreeBSD.org>

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


# 7266fe16 17-Apr-2008 John Baldwin <jhb@FreeBSD.org>

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


# ba2983e5 30-Mar-2008 Konstantin Belousov <kib@FreeBSD.org>

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


# 2c2f4a60 26-Mar-2008 John Birrell <jb@FreeBSD.org>

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


# f3fdfb67 07-Apr-2007 Pawel Jakub Dawidek <pjd@FreeBSD.org>

- 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


# f6521d1c 05-Apr-2007 Pawel Jakub Dawidek <pjd@FreeBSD.org>

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


# 28c94ec4 22-Apr-2006 Daniel Eischen <deischen@FreeBSD.org>

Add a prototype for fcloseall().


# 3acb8d3f 26-Jan-2006 Stefan Farfeleder <stefanf@FreeBSD.org>

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.


# 8995b231 20-Jun-2004 Tim J. Robbins <tjr@FreeBSD.org>

Remove outdated comments.


# 84bb9aaa 27-May-2004 Tim J. Robbins <tjr@FreeBSD.org>

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>.


# 257982eb 20-Mar-2004 Tim J. Robbins <tjr@FreeBSD.org>

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


# 567d74a5 16-Mar-2004 Tim J. Robbins <tjr@FreeBSD.org>

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.


# 12eb46c8 07-Dec-2003 Marcel Moolenaar <marcel@FreeBSD.org>

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...


# e8065dc4 13-Jan-2003 Tim J. Robbins <tjr@FreeBSD.org>

Add prototypes for the non-standard _unlocked functions.


# af1c9c0e 14-Oct-2002 Tim J. Robbins <tjr@FreeBSD.org>

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


# 54e4e385 12-Oct-2002 Mike Barcroft <mike@FreeBSD.org>

Add restrict type-qualifier.


# 74a4ba21 11-Oct-2002 Peter Wemm <peter@FreeBSD.org>

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.


# 5dfca833 06-Oct-2002 Mike Barcroft <mike@FreeBSD.org>

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.


# 58d38e25 06-Sep-2002 Tim J. Robbins <tjr@FreeBSD.org>

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


# abbd8902 21-Aug-2002 Mike Barcroft <mike@FreeBSD.org>

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


# f8418db7 15-Aug-2002 Robert Drehmel <robert@FreeBSD.org>

- 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.


# 71a00a44 15-Aug-2002 Robert Drehmel <robert@FreeBSD.org>

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


# 3248d0a5 14-Aug-2002 Robert Drehmel <robert@FreeBSD.org>

- 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.


# 702b2a72 15-Jul-2002 Garrett Wollman <wollman@FreeBSD.org>

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).


# bb28f3c2 23-Mar-2002 Warner Losh <imp@FreeBSD.org>

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.


# 3d7f57bc 04-Dec-2001 David E. O'Brien <obrien@FreeBSD.org>

An extra #ifdef crept in with rev 1.38.


# 1bd68733 04-Dec-2001 David E. O'Brien <obrien@FreeBSD.org>

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

Submitted by: bde


# 38f54953 03-Dec-2001 David E. O'Brien <obrien@FreeBSD.org>

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


# d02cf26a 20-Sep-2001 Peter Wemm <peter@FreeBSD.org>

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.


# 2b618987 13-Aug-2001 Peter Wemm <peter@FreeBSD.org>

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()).


# ea88c01d 21-Apr-2001 David E. O'Brien <obrien@FreeBSD.org>

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.


# 2b77cdea 17-Apr-2001 Kris Kennaway <kris@FreeBSD.org>

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>


# 3d090549 17-Apr-2001 Kris Kennaway <kris@FreeBSD.org>

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


# 45d80087 28-Feb-2001 Daniel Eischen <deischen@FreeBSD.org>

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.


# 91e1be28 15-Feb-2001 Warner Losh <imp@FreeBSD.org>

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.


# ff9dc074 13-Feb-2001 Peter Wemm <peter@FreeBSD.org>

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!*


# 56f98998 11-Feb-2001 Peter Wemm <peter@FreeBSD.org>

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


# 9b8ff47f 11-Feb-2001 Peter Wemm <peter@FreeBSD.org>

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


# 5b62961a 11-Feb-2001 Daniel Eischen <deischen@FreeBSD.org>

libc MT-safety, part 2.

Add a lock to FILE and define an additional flag.


# f9447cd1 24-Jan-2001 Daniel Eischen <deischen@FreeBSD.org>

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


# de7067ac 23-Dec-1999 Bruce Evans <bde@FreeBSD.org>

Fixed missing declaration of ctermid_r(3).


# a4add9a9 27-Aug-1999 Peter Wemm <peter@FreeBSD.org>

$Id$ -> $FreeBSD$


# 7307d07d 08-Feb-1999 Dmitrij Tejblum <dt@FreeBSD.org>

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)


# c1b7af8a 14-Dec-1998 Dmitrij Tejblum <dt@FreeBSD.org>

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


# 748993b8 13-Jul-1998 Bruce Evans <bde@FreeBSD.org>

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.


# b5fe8fab 07-Jul-1998 Peter Wemm <peter@FreeBSD.org>

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

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


# ed9c0390 14-Jun-1998 Bruce Evans <bde@FreeBSD.org>

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.


# 351c800a 05-May-1998 John Birrell <jb@FreeBSD.org>

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.


# 297263b0 12-Apr-1998 John Birrell <jb@FreeBSD.org>

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.


# 7d0026cd 11-Apr-1998 John Birrell <jb@FreeBSD.org>

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.


# de17eb59 01-Jan-1998 Alexander Langer <alex@FreeBSD.org>

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

Submitted by: bde


# 15aa51b0 13-Apr-1997 Bruce Evans <bde@FreeBSD.org>

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.


# 161f948d 11-Mar-1997 Peter Wemm <peter@FreeBSD.org>

Merge Lite2 changes
(Just version number)


# dee7a427 11-Mar-1997 Peter Wemm <peter@FreeBSD.org>

Import CSRG 4.4BSD-Lite2 includes onto vendor branch


# 3b96d4d9 02-Mar-1997 Andrey A. Chernov <ache@FreeBSD.org>

increase L_cuserid because UT_NAMESIZE increased


# 79403fe3 23-Feb-1997 Peter Wemm <peter@FreeBSD.org>

Revert $FreeBSD$ to $Id$


# 1130b656 14-Jan-1997 Jordan K. Hubbard <jkh@FreeBSD.org>

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.


# 8c372bd8 27-Oct-1996 Wolfram Schneider <wosch@FreeBSD.org>

improve comments for UT_NAMESIZE


# ad7076c9 02-Jul-1996 Wolfram Schneider <wosch@FreeBSD.org>

remove zopen, zopen is not part of libc.


# 15aa00d5 27-May-1996 Peter Wemm <peter@FreeBSD.org>

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.


# 65bfae76 24-Mar-1996 Paul Richards <paul@FreeBSD.org>

Fix incorrect parameter types for ftell and fgets.


# 71d9c781 30-Jan-1996 Mike Pritchard <mpp@FreeBSD.org>

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


# 4399be3c 29-May-1995 Rodney W. Grimes <rgrimes@FreeBSD.org>

Remove trailing whitespace.


# dd8723c2 04-Mar-1995 Poul-Henning Kamp <phk@FreeBSD.org>

make sys_nerr __const.

Reviewed by: phk
Submitted by: ollivier


# 59deaec5 24-May-1994 Rodney W. Grimes <rgrimes@FreeBSD.org>

BSD 4.4 Lite Include Sources