History log of /freebsd-14.2/lib/libc/stdio/vfprintf.c (Results 1 – 25 of 108)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: release/13.4.0-p5, release/13.5.0-p1, release/14.2.0-p3, release/13.5.0, release/14.2.0-p2, release/14.1.0-p8, release/13.4.0-p4, release/14.1.0-p7, release/14.2.0-p1, release/13.4.0-p3, release/14.2.0
# 2403e6d5 20-Sep-2024 Dag-Erling Smørgrav <[email protected]>

printf(): Save errno earlier.

The manual page says %m is replaced with “the string representation of
the error code stored in the errno variable at the beginning of the
call”. However, we don't act

printf(): Save errno earlier.

The manual page says %m is replaced with “the string representation of
the error code stored in the errno variable at the beginning of the
call”. However, we don't actually save `errno` until fairly late in
`__vfprintf()`. Make sure it is saved before we do anything that
might perturb `errno`.

MFC after: 1 week
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D46718

(cherry picked from commit 74f1007fcc838501c74a633792c3f01833bf65e1)

show more ...


Revision tags: release/13.4.0, release/14.1.0
# ade62d40 23-Apr-2024 Konstantin Belousov <[email protected]>

__vprintf(): switch from strerror() to strerror_rl()

PR: 278556

(cherry picked from commit f887667694632c829b0599b54ff86a072e93df87)


Revision tags: release/13.3.0, release/14.0.0
# 4025b5b5 01-Nov-2023 Warner Losh <[email protected]>

libc: Purge unneeded cdefs.h

These sys/cdefs.h are not needed. Purge them. They are mostly left-over
from the $FreeBSD$ removal. A few in libc are still required for macros
that cdefs.h defines. Kee

libc: Purge unneeded cdefs.h

These sys/cdefs.h are not needed. Purge them. They are mostly left-over
from the $FreeBSD$ removal. A few in libc are still required for macros
that cdefs.h defines. Keep those.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D42385

(cherry picked from commit 559a218c9b257775fb249b67945fe4a05b7a6b9f)

show more ...


# 3c96ab9f 07-Sep-2023 Dag-Erling Smørgrav <[email protected]>

libc: Implement N2680.

This adds specific width length modifiers in the form of wN and wfN (where N is 8, 16, 32, or 64) which allow printing intN_t and int_fastN_t without resorting to casts or PRI

libc: Implement N2680.

This adds specific width length modifiers in the form of wN and wfN (where N is 8, 16, 32, or 64) which allow printing intN_t and int_fastN_t without resorting to casts or PRI macros.

Reviewed by: imp, emaste
Differential Revision: https://reviews.freebsd.org/D41725

(cherry picked from commit bce0bef3c6abab92c7ac8cc23b7cc632a382721e)

libc: Add test cases for N2680.

This adds test cases for %wN and %wfN to the printf(3) and scanf(3) tests.

While here, fix a few nits in the N2630 test cases.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D41743

(cherry picked from commit 12b1c1e3fb446021a881d9815465137843fca50b)

Approved by: re (gjb)

show more ...


# bae93299 28-Aug-2023 Dag-Erling Smørgrav <[email protected]>

libc: Implement N2630.

This adds formatted input/output of binary integer numbers to the printf(), scanf(), and strtol() families, including their wide-character counterparts.

Reviewed by: imp, ema

libc: Implement N2630.

This adds formatted input/output of binary integer numbers to the printf(), scanf(), and strtol() families, including their wide-character counterparts.

Reviewed by: imp, emaste
Differential Revision: https://reviews.freebsd.org/D41511

(cherry picked from commit d9dc1603d6e48cca84cad3ebe859129131b8387c)

libc: Add unit tests for N2630 and possible collateral damage.

Reviewed by: imp, emaste
Differential Revision: https://reviews.freebsd.org/D41512

(cherry picked from commit b9385720f34b536ef2568a642e8b1fad0450056f)

libc: Document support for binary integers.

Reviewed by: debdrup, emaste
Differential Revision: https://reviews.freebsd.org/D41522

(cherry picked from commit 76edfabbecdec686a570b8e009d5ea4112f943e0)

libc: Fix fixed-width case in the new integer parser.

Fixes: d9dc1603d6e4
Differential Revision: https://reviews.freebsd.org/D41622

(cherry picked from commit aca3bd1602577591e5cd237c4bb0bb71b3be0c75)

libc: Add a wide version of snprintf_test.

Reviewed by: imp, emaste
Differential Revision: https://reviews.freebsd.org/D41726

(cherry picked from commit 4ec9ee9912765ac4ca57353999caa92a23283d8e)

libc: Suppress format checks on printf() / scanf() tests.

Reviewed by: jrtc27, markj, emaste
Differential Revision: https://reviews.freebsd.org/D41727

(cherry picked from commit 294bd2827e61a78041f6613f4b82235fcc454157)

Approved by: re (gjb)

show more ...


# 1d386b48 16-Aug-2023 Warner Losh <[email protected]>

Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


Revision tags: release/13.2.0, release/12.4.0
# 5b5fa75a 04-Aug-2022 Ed Maste <[email protected]>

libc: drop "All rights reserved" from Foundation copyrights

This has already been done for most files that have the Foundation as
the only listed copyright holder. Do it now for files that list
mul

libc: drop "All rights reserved" from Foundation copyrights

This has already been done for most files that have the Foundation as
the only listed copyright holder. Do it now for files that list
multiple copyright holders, but have the Foundation copyright in its own
section.

Sponsored by: The FreeBSD Foundation

show more ...


Revision tags: release/13.1.0, release/12.3.0, release/13.0.0, release/12.2.0, release/11.4.0, release/12.1.0, release/11.3.0, release/12.0.0, release/11.2.0
# e95725fe 22-May-2018 Konstantin Belousov <[email protected]>

Implement printf(3) family %m format string extension.

Reviewed by: ed, dim (code only)
Sponsored by: Mellanox Technologies
MFC after: 1 week


# 8a16b7a1 20-Nov-2017 Pedro F. Giffuni <[email protected]>

General 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 f

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

show more ...


Revision tags: release/10.4.0, release/11.1.0
# fda0a14f 29-Jun-2017 Konstantin Belousov <[email protected]>

Make stdio deferred cancel-safe.

If used with fopen(3)/fdopen(3)-ed FILEs, stdio accurately uses
non-cancellable internal versions of the functions, i.e. it seems to
be fine with regard to cancellat

Make stdio deferred cancel-safe.

If used with fopen(3)/fdopen(3)-ed FILEs, stdio accurately uses
non-cancellable internal versions of the functions, i.e. it seems to
be fine with regard to cancellation. But if the funopen(3) and
f{r,w}open(3) functions were used to open the FILE, and corresponding
user functions create cancellation points (they typically have no
other choice), then stdio code at least leaks FILE' lock.

The change installs cleanup handler which unlocks FILE. Some minimal
restructuring of the code was required to make it use common return
place to satisfy hand-rolled pthread_cleanup_pop() requirements.

Noted by: eugen
Reviewed by: eugen, vangyzen
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D11246

show more ...


# 7c39dd2e 22-Dec-2016 Enji Cooper <[email protected]>

Revert r310138

Adding %b support to vfprintf for parity with kernel space requires
more discussion/review.

In particular, many parties were concerned over introducing a
non-standard format qualifie

Revert r310138

Adding %b support to vfprintf for parity with kernel space requires
more discussion/review.

In particular, many parties were concerned over introducing a
non-standard format qualifier to *printf(3) which didn't already
exist in other OSes, e.g. Linux, thus making code which used %b
harder to port to other operating systems.

Requested by: many

show more ...


# ec055aef 16-Dec-2016 Conrad Meyer <[email protected]>

vfprintf(3): Add support for kernel %b format

This is a direct port of the kernel %b format.

I'm unclear on if (more) non-portable printf extensions will be a
problem. I think it's desirable to hav

vfprintf(3): Add support for kernel %b format

This is a direct port of the kernel %b format.

I'm unclear on if (more) non-portable printf extensions will be a
problem. I think it's desirable to have userspace formats include all
kernel formats, but there may be competing goals I'm not aware of.

Reviewed by: no one, unfortunately
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D8426

show more ...


Revision tags: release/11.0.1, release/11.0.0
# 1bf6c5f1 25-Aug-2016 Andrey A. Chernov <[email protected]>

Don't check for __SERR which may stick from one of any previous stdio
functions.
__SERR is for user and the rest of stdio code do not check it
for error sensing internally, only set it.
In vf(w)print

Don't check for __SERR which may stick from one of any previous stdio
functions.
__SERR is for user and the rest of stdio code do not check it
for error sensing internally, only set it.
In vf(w)printf.c here it is more easy to save __SERR, clear and restore it.

show more ...


Revision tags: release/10.3.0, release/10.2.0, release/10.1.0
# 450ead86 20-Jul-2014 Pedro F. Giffuni <[email protected]>

Adjust errno on failed prepwrite.

Obtained from: Apple Inc. (Libc 997.90.3)
Phabric: D442
MFC after: 1 week


Revision tags: release/9.3.0, release/10.0.0, release/9.2.0, release/8.4.0
# 1d8053c5 23-Apr-2013 Ed Maste <[email protected]>

Renumber clauses to reduce diffs to other versions

NetBSD, OpenBSD, and Android's Bionic all number the clauses 1 through 3,
so follow suit to make comparison easier.

Acked-by: imp@


Revision tags: release/9.1.0
# 666d00d3 21-Apr-2012 David Schultz <[email protected]>

If the size passed to {,v}s{w,n}printf is larger than INT_MAX+1
(i.e., the return value would overflow), set errno to EOVERFLOW
and return an error. This improves the chances that buggy
applications

If the size passed to {,v}s{w,n}printf is larger than INT_MAX+1
(i.e., the return value would overflow), set errno to EOVERFLOW
and return an error. This improves the chances that buggy
applications -- for instance, ones that pass in a negative integer
as the size due to a bogus calculation -- will fail in safe ways.
Returning an error in these situations is specified by POSIX, but
POSIX appears to have an off-by-one error that isn't duplicated in
this change.

Previously, some of these functions would silently cap the size at
INT_MAX+1, and others would exit with an error after writing more
than INT_MAX characters.

PR: 39256
MFC after: 2 weeks

show more ...


Revision tags: release/8.3.0_cvs, release/8.3.0, release/9.0.0
# 3c87aa1d 20-Nov-2011 David Chisnall <[email protected]>

Implement xlocale APIs from Darwin, mainly for use by libc++. This adds a
load of _l suffixed versions of various standard library functions that use
the global locale, making them take an explicit

Implement xlocale APIs from Darwin, mainly for use by libc++. This adds a
load of _l suffixed versions of various standard library functions that use
the global locale, making them take an explicit locale parameter. Also
adds support for per-thread locales. This work was funded by the FreeBSD
Foundation.

Please test any code you have that uses the C standard locale functions!

Reviewed by: das (gdtoa changes)
Approved by: dim (mentor)

show more ...


Revision tags: release/7.4.0_cvs, release/8.2.0_cvs, release/7.4.0, release/8.2.0, release/8.1.0_cvs, release/8.1.0, release/7.3.0_cvs, release/7.3.0
# 1b0181df 11-Mar-2010 John Baldwin <[email protected]>

- Use an initializer macro to initialize fields in 'fake' FILE objects used
by *sprintf(), etc.
- Explicitly initialize _fl_mutex to PTHREAD_MUTEX_INITIALIZER for all FILE
objects. This is curre

- Use an initializer macro to initialize fields in 'fake' FILE objects used
by *sprintf(), etc.
- Explicitly initialize _fl_mutex to PTHREAD_MUTEX_INITIALIZER for all FILE
objects. This is currently a nop on FreeBSD, but is import for other
platforms (or in the future) where PTHREAD_MUTEX_INITIALIZER is not simply
zero.

PR: threads/141198
Reported by: Jeremy Huddleston @ Apple
MFC after: 2 weeks

show more ...


Revision tags: release/8.0.0_cvs, release/8.0.0, release/7.2.0_cvs, release/7.2.0
# 353ce11c 28-Feb-2009 David Schultz <[email protected]>

Replace a dozen lines of code with a call to strnlen() / wcsnlen().


# 0881683b 28-Feb-2009 David Schultz <[email protected]>

Make sure %zd treats negative arguments properly on 32-bit platforms.
Fix harmless but related bugs in %_$zd and %_$tu.

PR: 131880
MFC after: 1 week


# 21ca178e 22-Jan-2009 David Schultz <[email protected]>

Add support for multibyte thousands_sep encodings, e.g., U+066C.
The integer thousands' separator code is rewritten in order to
avoid having to preallocate a buffer for the largest possible
digit str

Add support for multibyte thousands_sep encodings, e.g., U+066C.
The integer thousands' separator code is rewritten in order to
avoid having to preallocate a buffer for the largest possible
digit string with the most possible instances of the longest
possible multibyte thousands' separator. The new version inserts
thousands' separators for integers using the same code as floating point.

show more ...


# 5004a238 19-Jan-2009 David Schultz <[email protected]>

Add support for multibyte decimal_point encodings, e.g., U+066B.


# a1805f7b 17-Jan-2009 David Schultz <[email protected]>

When f[w]printf() is called on an unbuffered file like stdout, it
sets up a fake buffered FILE and then effectively calls itself
recursively. Unfortunately, gcc doesn't know how to do tail call
elimi

When f[w]printf() is called on an unbuffered file like stdout, it
sets up a fake buffered FILE and then effectively calls itself
recursively. Unfortunately, gcc doesn't know how to do tail call
elimination in this case, and actually makes things worse by
inlining __sbprintf(). This means that f[w]printf() to stderr was
allocating about 5k of stack on 64-bit platforms, much of which was
never used.

I've reorganized things to eliminate the waste. In addition to saving
some stack space, this improves performance in my tests by anywhere
from 5% to 17% (depending on the test) when -fstack-protector is
enabled. I found no statistically significant performance difference
when stack protection is turned off. (The tests redirected stderr to
/dev/null.)

show more ...


# 0a492640 15-Jan-2009 David Schultz <[email protected]>

Reduce code duplication by moving functions that are identical in both
vfprintf.c and vfwprintf.c (except for char/wchar_t differences) to a
common header file.


# 814d1bc9 15-Jan-2009 David Schultz <[email protected]>

Convert the insidious macros that handle printf()'s buffering into
slightly less evil inline functions, and move the buffering state into
a struct. This will make it possible for helper routines to p

Convert the insidious macros that handle printf()'s buffering into
slightly less evil inline functions, and move the buffering state into
a struct. This will make it possible for helper routines to produce
output for printf() directly, making it possible to untangle the code
somewhat.

In wprintf(), use the same buffering mechanism to reduce diffs to
printf(). This has the side-effect of causing wprintf() to catch write
errors that it previously ignored.

show more ...


12345