History log of /freebsd-head/include/stdio.h
Revision Date Author Comments
66a605b22a38094de00bac3b65cb8b6d5b68e633 02-Feb-2020 kevans <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
a508eb379bd6c7c9b97973a73b4e576acaead38e 30-Jan-2020 kevans <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
59c839996a728ab2369b2a9302747fde92c82a1f 09-Sep-2019 kib <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
878fd59d878b00f26df441ff2e88b83223c2651a 01-Sep-2019 emaste <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
10907fcacac3a9579032f3801a940e6d1a9c19aa 20-Aug-2019 dim <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
bd3d2f427b833e6bbd75dcf6be0613b21dcfdcfd 28-Jul-2018 dim <dim@FreeBSD.org> Vendor import of libc++ trunk r338150:
https://llvm.org/svn/llvm-project/libcxx/trunk@338150
de31a1ac8f151beec418c661770eb852b2155765 03-Apr-2018 cy <cy@FreeBSD.org> Remove redundant check.

Reported by: kib@
MFC after: 2 weeks
X-MFC with: r331936
Differential Revision: https://reviews.freebsd.org/D12785
cfd2b9ce963eeca198e3a942212ed8d73e028e23 03-Apr-2018 cy <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
6b22553e1683b7594412d6f219fed132f949c524 20-Nov-2017 pfg <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.
1e57a2a6fb9b6d88f1de62be7bbb2de45c6a14c7 01-Jun-2017 dim <dim@FreeBSD.org> Vendor import of libc++ trunk r304460:
https://llvm.org/svn/llvm-project/libcxx/trunk@304460
99a8da45370ca5853a2623f9e32ed445599a7f4a 23-May-2017 vangyzen <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
caee8aed6e832090173162284fdd1ffe26cc7444 16-May-2017 dim <dim@FreeBSD.org> Vendor import of libc++ trunk r303197:
https://llvm.org/svn/llvm-project/libcxx/trunk@303197
7bdd7f88d94b519b143d0474ddea5d4ba9eb6edd 29-Apr-2017 pfg <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)
74d3e29a11aacb8cceb45c4adbefb5f95eda6fc9 28-Jan-2017 pfg <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
ef243d74ac183f50c8d8f6a92bd574be9d3b6cfb 01-Oct-2016 vangyzen <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
1542a38e23c6bf41c2c65c819c7bff90af8bf24d 01-Oct-2016 vangyzen <vangyzen@FreeBSD.org> Add the __printflike attribute to the declaration of dprintf(3)

MFC after: 3 days
Sponsored by: Dell EMC
e925cab0ee2e047f120b11657db057bae953a69c 02-Aug-2016 imp <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.
44c8e812fde973304ebd75a2700f17f453c8d1ba 30-Jul-2016 bapt <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)
00d578928eca75be320b36d37543a7e2a4f9fbdb 27-May-2016 grehan <grehan@FreeBSD.org> Create branch for bhyve graphics import.
31330e2843519387b4c579f8bd23a6e0f00bcf26 12-May-2016 cem <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
c48291649931d01b589aa70cf23acf62522dc5e6 12-May-2016 cem <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
97a44a849e7f06367a2f6bcf955631c6747a1c2e 11-May-2016 cem <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
bb3c8968781c1af8bba177e16a3b9547f03d24b2 30-Dec-2015 dim <dim@FreeBSD.org> Vendor import of libc++ trunk r256633:
https://llvm.org/svn/llvm-project/libcxx/trunk@256633
f2f170ddd8d54aa95c75879e4e329feaf19ef119 01-Dec-2015 ngie <ngie@FreeBSD.org> MFC r285140:
r285140 (by oshogbo):

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
8a3e4a6db71e690b2b8bf5f3372f4f99a506fdd7 08-Nov-2015 ache <ache@FreeBSD.org> MFC: r289863,r289931,r290110,r290230,r290231,r290232

r290232:

Microoptimize.

r290231:

Addition to prev. commit.
In some edge cases fp->_p can be changed in _sseek(), recalculate.

r290230:

Don't seek to the end if write buffer is empty (in append modes).
PR: 204156

r290110:

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

r289931:

According to POSIX, a write operation shall start at the current size of
the stream (if mode had 'a' as the first character).

r289863:

Since no room left in the _flags, reuse __SALC for O_APPEND.
It helps to remove _fcntl() call from _ftello() and optimize seek position
calculation in _swrite().
64dac23af83b727e5f33d41dc5ecb1444c8c0c30 28-Oct-2015 ache <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
e1ffe0f912feb756dc9cddef6953a09a9e9d6605 04-Jul-2015 oshogbo <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
be53554302863e788a6f23eaa9bc79c5884bdaa8 03-Apr-2015 bdrewery <bdrewery@FreeBSD.org> MFC r278600:

Correct and clarify comment for __SMBF.
778a613385d4d693e0f957d07e5ba5f995795500 11-Feb-2015 bdrewery <bdrewery@FreeBSD.org> Correct and clarify comment for __SMBF.

MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division
6fa4f734bd36cf377c96a7b5dbdfbe8de05ccfdc 11-May-2014 jilles <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.
e47308fc84d8eb2e6e15bb12fafc0792d878a58d 11-May-2014 jilles <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.
eb1a5f8de9f7ea602c373a710f531abbf81141c4 21-Feb-2014 gjb <gjb@FreeBSD.org> Move ^/user/gjb/hacking/release-embedded up one directory, and remove
^/user/gjb/hacking since this is likely to be merged to head/ soon.

Sponsored by: The FreeBSD Foundation
6b01bbf146ab195243a8e7d43bb11f8835c76af8 27-Dec-2013 gjb <gjb@FreeBSD.org> Copy head@r259933 -> user/gjb/hacking/release-embedded for initial
inclusion of (at least) arm builds with the release.

Sponsored by: The FreeBSD Foundation
2b2e6341820f4bf973e758ae57713a8e6d356a3a 27-Feb-2013 jhb <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
e7ca48d15b0d2114430b38f3d1cd793d3e50a3ae 30-Jan-2013 gahr <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
de5013d7b6efb58c86955f3cb79b7715ecc992f5 28-Mar-2012 theraven <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)
41d91b4c7bafe88f7a31de5b7f896a4fd93552cc 28-Dec-2011 delphij <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
31d1910e85e83de7c8f8c1473440cfa1968dec9d 25-Dec-2011 theraven <theraven@FreeBSD.org> Restore __is_threaded in C++ mode. Some Google stuff needs it apparently.

Reported by: swills
Approved by: dim (mentor)
0bcfe62162c6317108fed5c0aabb5ce3d4a9a2aa 13-Dec-2011 ed <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.
dd1ce6fd6c2c0f0c70f3c78a4959185bb93eb1c3 13-Nov-2011 theraven <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)
09f9c897d33c41618ada06fbbcf1a9b3812dee53 19-Oct-2010 jamie <jamie@FreeBSD.org> A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.
933d2e8e14eb1f2362851f6c4d3e606ece9632ba 06-Aug-2010 ed <ed@FreeBSD.org> Remove stale reference to UT_NAMESIZE from <stdio.h>.

Spotted by: bde@
f1216d1f0ade038907195fc114b7e630623b402c 19-Mar-2010 delphij <delphij@FreeBSD.org> Create a custom branch where I will be able to do the merge.
7d79e30fb25e3bdb34df41c8c7b09487154b66ac 16-Feb-2010 imp <imp@FreeBSD.org> Remove the Berkeley clause 3's.
Add a few $FreeBSD$
38c7b9f9de732b5ded56249d7ec8e4482366a9a0 23-Jun-2009 delphij <delphij@FreeBSD.org> Merge fmtcheck() prototype change.

Obtained from: NetBSD
545ea1bd73ca8ed98e6a356d5491a470345402fc 25-Mar-2009 das <das@FreeBSD.org> Make programs that define a macro called `dprintf' more likely to work.
bd350bd6508faaebf0a0a264871f2112964b90ee 14-Mar-2009 das <das@FreeBSD.org> Namespace: dprintf() and getline() are in P1003.1-2008.
d92111a8dc86baa72bb5660ebba5ad3f2665dca9 04-Mar-2009 das <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.
ee4adcf1a9a52bc4415201969e0fbc0451c46b47 04-Mar-2009 das <das@FreeBSD.org> Add renameat to the POSIX.1-2008 namespace.
a67fbaa46cbdf18a03eefb3f83e2f74f68918753 28-Feb-2009 das <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@
19b6af98ec71398e77874582eb84ec5310c7156f 22-Nov-2008 dfr <dfr@FreeBSD.org> Clone Kip's Xen on stable/6 tree so that I can work on improving FreeBSD/amd64
performance in Xen's HVM mode.
cf5320822f93810742e3d4a1ac8202db8482e633 19-Oct-2008 lulf <lulf@FreeBSD.org> - Import the HEAD csup code which is the basis for the cvsmode work.
c6ca1bf6ca45ce766fb6924e5cb825f6e2d6e28f 07-May-2008 jhb <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.
3597d738f6ecde73707452e5fb7bc363a8d9801f 05-May-2008 jhb <jhb@FreeBSD.org> Retire the __fgetcookie(), __fgetpendout(), and __fsetfileno() accessors
as we aren't hiding FILE's internals anymore.
f0ddfb88fd0197c9357568fb4b2c9b989a483ffa 05-May-2008 jhb <jhb@FreeBSD.org> Note that FILE's __cookie is also part of the public ABI.
d878a4042ee00c110e698fce1c1d59253fc0387b 05-May-2008 jhb <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 *.
0e04be019638f430a0a5aebb9f28cd5a7d615c12 03-May-2008 marcel <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
86d85f532d68124813974634067dd896ce9ff724 03-May-2008 marcel <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
b0120d71fa5dce268c8356d96efa04301e119b04 02-May-2008 jhb <jhb@FreeBSD.org> Axe now-empty __BSD_VISIBLE block that held renameat().

Reported by: kib
Pointy hat: jhb
69b799264e95500c42ff3af0b161dc7c3f1826d2 02-May-2008 jhb <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
809ddff4fd01ab65b99be2f04070d17450509b93 02-May-2008 jhb <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
ab875ea72654fac71cb13470c85b43412c2e2391 17-Apr-2008 jhb <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
29daa50d475a056ec6901b73e7befbdc90e2bb90 17-Apr-2008 jhb <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
2ad0eb2d91aa816f59ca8be579d30e4b4a5dc788 31-Mar-2008 kib <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
0e3dba47492f57f3cc6f704a20775e39f9fe7a0c 29-Mar-2008 jb <jb@FreeBSD.org> MFC

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

awk/Makefile: 1.17
Allow awk to handle 64 files instead of just 20.
0a735e0d07509a7266789a132da6ee024ec2f29e 26-Mar-2008 jb <jb@FreeBSD.org> Allow an application to define FOPEN_MAX (like we allow for OPEN_MAX
in sys/syslimits.h).
13f0f1e64ffdc32926fa93e6c4a6f8b9da36e7ff 07-Apr-2007 pjd <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
4718e01f98485788a9f7b2defc77a984780db526 05-Apr-2007 pjd <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
cdbf06756521f8013884db0dd688cfad822cafd6 22-Apr-2006 deischen <deischen@FreeBSD.org> Add a prototype for fcloseall().
b1424e33b52eca772aaaf84873bf0d1db32e6190 31-Jan-2006 stefanf <stefanf@FreeBSD.org> MFC: Add the macro __format_arg which expands to the format_arg attribute if
supported.
8d30a9e919676913a7c5c33b7bff8a00c70cecbf 26-Jan-2006 stefanf <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.
bca8950dd2c6b9695ba632bc9cc44a1a1a464065 20-Jun-2004 tjr <tjr@FreeBSD.org> Remove outdated comments.
e1421e9ba08c75e30ba679dde39a3a3113753134 27-May-2004 tjr <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>.
369227864b96b27ba13dee72d49f4c3b8405fe5e 20-Mar-2004 tjr <tjr@FreeBSD.org> Parenthesize function names in masking macros for getc() etc. for the
benefit of obsolete C preprocessors.
b4d98c68558acbe9782e24963999f922d52ccf28 17-Mar-2004 tjr <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.
89b1ef2eaa8f8599da1b52f5e9393dda6fcbd8e8 07-Dec-2003 marcel <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...
a8ca4b7688e2ca3f6dd12cb22e4299854c407118 13-Jan-2003 tjr <tjr@FreeBSD.org> Add prototypes for the non-standard _unlocked functions.
83b297f2f002d92fe29b8b6c4466b58491c60cd9 14-Oct-2002 tjr <tjr@FreeBSD.org> Use a weak reference instead of a macro to make vfscanf an alias
for __vfscanf.
4d6bf1c3fb0816347ba09c47c02f040d71c13679 12-Oct-2002 mike <mike@FreeBSD.org> Add restrict type-qualifier.
9d7b7c1465ab07f0f838a08be1b198ddfa1e9bcb 11-Oct-2002 peter <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.
6b78701b611235c18074ae990299062d9ce5de2e 06-Oct-2002 mike <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.
cd5ca96599d24e7c9375719e86b16b5d3165e931 06-Sep-2002 tjr <tjr@FreeBSD.org> Style: One space between "restrict" qualifier and "*".
9e6f796b0d2083dcc48c062853660f96db0a3c8d 21-Aug-2002 mike <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
eef3b2f04b44c29988bf983329b47c006d27c63d 15-Aug-2002 robert <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.
4accb821f18b52fbbaf0d1e140d9ad40d85a1b97 15-Aug-2002 robert <robert@FreeBSD.org> - Introduce the 'restrict' qualifier to function prototypes and
definitions to comply with IEEE Std 1003.1-2001.
- Update the manual pages.
4b64f84a432f94425359802d506816872f43c5d7 14-Aug-2002 robert <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.
c559b8902789e64b5a4b1e482f230e933cda7198 15-Jul-2002 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).
300518c0a10b4f5030e23380da07c906a3ee80dc 23-Mar-2002 imp <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.
b85e71a82bb6817aa48780b4e06b7479385d1534 05-Dec-2001 obrien <obrien@FreeBSD.org> An extra #ifdef crept in with rev 1.38.
298e21dbadbaf696e542be97bcf62cef5d687545 04-Dec-2001 obrien <obrien@FreeBSD.org> Turn back on fmtcheck's attribute checks, guarded for non-GCC compilers.

Submitted by: bde
d2081fa90946526cc94520c49812817fdc5488c6 04-Dec-2001 obrien <obrien@FreeBSD.org> Remove the GCC'ism "__attribute__" from the 'fmtcheck' prototype.
I leave it up to someone else to fix this breakage properly.
1bfa117a36f2956ef8e4e334888d26520eeb6f37 20-Sep-2001 peter <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.
3e5894fd23a47dea1c37133433e493126bb1cd21 13-Aug-2001 peter <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()).
9cc16de19ff39d117c0561748bb672dde1f8edac 22-Apr-2001 obrien <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.
3c551921435dd3e187661319883071da1e66f4e6 17-Apr-2001 kris <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>
0f958ee7467ce3cd3eaedbef81be48790d0b6b1a 17-Apr-2001 kris <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
2d1163e370d4fb97297838d1fe7872a653dce6bb 01-Mar-2001 deischen <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.
51cffb6bac86b91ac5ec606a7c085d25242b8a7e 16-Feb-2001 imp <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.
1c970ba5b314cd2286a5a889bb69df2bc58ed73c 14-Feb-2001 peter <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!*
21629372f842d8268cfd5b6ab5e709a022ed1089 12-Feb-2001 peter <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.
06fa9251928cf6d03b94f299b9da94f0b504fbee 12-Feb-2001 peter <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
d5657ce8b69e343a4dda07786bb158c464f9b4d6 11-Feb-2001 deischen <deischen@FreeBSD.org> libc MT-safety, part 2.

Add a lock to FILE and define an additional flag.
274959d59337555267567d4bde9a5a841c47d84f 24-Jan-2001 deischen <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
b42951578188c5aab5c9f8cbcde4a743f8092cdc 02-Apr-2000 cvs2svn <cvs2svn@FreeBSD.org> This commit was manufactured by cvs2svn to create branch 'ALSA'.
0fcd581c550ebbdfac21d50d4bc6e1bef1576750 23-Dec-1999 bde <bde@FreeBSD.org> Fixed missing declaration of ctermid_r(3).
d4e3ebaf0a81e32bf7a10fb0f649ec6f060bc1fb 27-Aug-1999 peter <peter@FreeBSD.org> $Id$ -> $FreeBSD$
dd5f24e20cdd683adbb5885bb01814ac81fbc90b 08-Feb-1999 dt <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)
cf4547cfadfb4c1f51df3ddc23d1a2b1f61063dd 14-Dec-1998 dt <dt@FreeBSD.org> Make this protototype of mmap return void *, like two other copies.
bf1a9b4c37da22da57d630c9aa1c79e91d310760 13-Jul-1998 bde <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.
d306217e883e7f102fce3e41810679494964038c 08-Jul-1998 peter <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
69e29925cd5a259c1bc33744d63ef6db4317b22f 14-Jun-1998 bde <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.
954e81147d8b728eda4693b583b50ff36a84e0ce 05-May-1998 jb <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.
ef5ac44e8012f4129993a380c02492dbf35d2dc3 12-Apr-1998 jb <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.
37905ca3346db0b12db77b4f125b8e230f82c22e 11-Apr-1998 jb <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.
0506343883d62f6649f7bbaf1a436133cef6261d 11-Jan-1998 cvs2svn <cvs2svn@FreeBSD.org> This commit was manufactured by cvs2svn to create branch 'jb'.
7c6e96080c4fb49bf912942804477d202a53396c 10-Jan-1998 cvs2svn <cvs2svn@FreeBSD.org> This commit was manufactured by cvs2svn to create branch 'JB'.
017d9a924293d9d5920b1bc1f37a5203fb6e1d28 01-Jan-1998 alex <alex@FreeBSD.org> Added missing caddr_t --> void * conversions for sys/mman.h functions.

Submitted by: bde
3db3e02ae705c5cab18045e8ec5ce26fdea862aa 13-Apr-1997 bde <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.
9eaf75f7d002f77d3fdcfb660e84805f29c75199 11-Mar-1997 peter <peter@FreeBSD.org> Merge Lite2 changes
(Just version number)
53b81178e2d0aa56f51f680543678a3d7ef8aecd 11-Mar-1997 peter <peter@FreeBSD.org> Import CSRG 4.4BSD-Lite2 includes onto vendor branch
56a4d1b13d3e25f568af21419fdc208f5a688e80 02-Mar-1997 ache <ache@FreeBSD.org> increase L_cuserid because UT_NAMESIZE increased
f173325ac850b1859902fe746462676d9c731e7a 23-Feb-1997 peter <peter@FreeBSD.org> Revert $FreeBSD$ to $Id$
808a36ef658c1810327b5d329469bcf5dad24b28 14-Jan-1997 jkh <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.
86907d3e57b7292b7628f44459a0b521163899f5 27-Oct-1996 wosch <wosch@FreeBSD.org> improve comments for UT_NAMESIZE
ce5be255785e84b66cc6ba78a07194e076b74ec4 02-Jul-1996 wosch <wosch@FreeBSD.org> remove zopen, zopen is not part of libc.
fbe63391875b9762cc438066b5f20fce1ab43a26 27-May-1996 peter <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.
4f2da6c6e432a586e31d4261f9c4110e109e428a 24-Mar-1996 paul <paul@FreeBSD.org> Fix incorrect parameter types for ftell and fgets.
d6779c281f3ea678ab1320b1bfd796b3815b2c35 30-Jan-1996 mpp <mpp@FreeBSD.org> Fix a bunch of spelling errors in the comment fields
of a bunch of system include files.
86f1bc4514fdcfd255f37f3218fe234bdc3664fc 05-Nov-1995 cvs2svn <cvs2svn@FreeBSD.org> This commit was manufactured by cvs2svn to create branch 'LINUX'.
2ad6f3dee6bc54535003f4ab26bbc587b7efa38c 30-May-1995 rgrimes <rgrimes@FreeBSD.org> Remove trailing whitespace.
2e14d9ebc3d3592c67bdf625af9ebe0dfc386653 14-Mar-1995 cvs2svn <cvs2svn@FreeBSD.org> This commit was manufactured by cvs2svn to create branch 'MATT_THOMAS'.
a09fe2d23732f9ec6f4b73851ce89fae4346eb2d 04-Mar-1995 phk <phk@FreeBSD.org> make sys_nerr __const.

Reviewed by: phk
Submitted by: ollivier
34cd81d75f398ee455e61969b118639dacbfd7a6 23-Sep-1994 cvs2svn <cvs2svn@FreeBSD.org> This commit was manufactured by cvs2svn to create branch 'MACKERRAS'.
e16baf7a5fe7ac1453381d0017ed1dcdeefbc995 07-Aug-1994 cvs2svn <cvs2svn@FreeBSD.org> This commit was manufactured by cvs2svn to create branch 'SUNRPC'.
a6ce65d368e623088a4c1a29865889f431b15420 24-May-1994 rgrimes <rgrimes@FreeBSD.org> BSD 4.4 Lite Include Sources