1
0
mirror of https://github.com/openbsd/src.git synced 2025-01-04 23:35:36 -08:00
Commit Graph

56 Commits

Author SHA1 Message Date
guenther
bcac9d59b1 asprintf() and vasprintf() are in POSIX-2024. Update #include
visibility and manpages and add restrict qualifiers in all the
specified places to the *printf family.

ok millert@
2024-08-07 05:15:28 +00:00
millert
6a97098401 funopen(): change seekfn argument to use off_t, not fpos_t
On BSD, fpos_t is typedef'd to off_t but some systems use a struct.
This means fpos_t is not a portable function argument or return value.
Both FreeBSD and the Linux libbsd funopen() have switched to off_t
for this--we should too.  From Joe Nelson.  OK deraadt@
2022-01-05 20:57:27 +00:00
naddy
464c6a2fbf add format string checking annotations for dprintf(3) and vdprintf(3)
ok millert@ deraadt@
2020-09-11 17:56:41 +00:00
millert
6ecde746de Move the 10 (!) defintions of NULL to their own mini header file and
update the NULL definition for C++11.  OK deraadt@ guenther@ kettenis@
2016-09-09 18:12:37 +00:00
deraadt
c6c30f45cd remove cpp version of __sputc, since the inline version is all we have
ever used.
ok jsg
2016-03-16 04:56:08 +00:00
millert
abd93d17ae Expose snprintf() and vsnprintf() for XPG 5. It predates C99 but
still specified snprintf() and vsnprintf() based on earlier drafts.
Allows snprintf() and vsnprintf() to be used when _XOPEN_SOURCE is
defined as 500.  OK guenther@
2016-03-14 20:43:03 +00:00
tedu
7a4e5fc41a increase TMP_MAX to the equivalent of INT_MAX. it's actually more,
but safer not to wraparound by accident.
ok deraadt millert miod
2015-01-20 22:09:50 +00:00
tedu
d8e2f36e09 safe to remove gets, now that's gone from cstdio too 2014-03-27 15:28:16 +00:00
tedu
62c9c9a7ee try to put the pin back in.
removing gets means removing it from libstdc++ and guenther tells me
that will require changing version numbers.
2014-03-25 15:55:15 +00:00
tedu
c792825af2 no gets 2014-03-25 15:23:27 +00:00
guenther
acf82b0a9d lint is dead (long live the lint!), so stop using it as a cpp conditional
(namespace pollution!) or talking about its opinion on code.

ok krw@
2014-03-16 18:38:30 +00:00
deraadt
6c13836a7e express final disapproval of the interfaces in libcompat, such as
them ftime(), gtty(), stty(), re_comp(), cuserid() and others.
Discussion and ongoing work to fix the ports tree from many, especially
naddy.
ok naddy
[There is a bit more cleanup possible after that, but this is considered
the current safe step]
2013-12-04 22:58:24 +00:00
eric
236998c6ac Enable fmemopen(3) and open_{w,}memstream(3)
commiting on behalf of mpi@
2013-03-28 16:37:13 +00:00
brad
f2c0f4ac02 Add support for POSIX.1-2008 functions dprintf(3) and vdprintf(3).
Feedback from millert@ guenther@
OK guenther@ man page bits OK jmc@
2013-01-30 00:08:13 +00:00
fgsch
dc89375155 Implement getdelim(3) and getline(3).
Prompted in a mail to tech@ by Jan Klemkow (j-dot-klemkow-at-wemelug-dot-de)
but this is based on NetBSD's implementation instead with some tweaks by me.
Further improvements would happen in tree.

ok millert@; discussed with many others
ports cleanup by naddy@, sthen@. Antti Harri, Gonzalo L. R. and myself.
2012-03-21 23:44:35 +00:00
matthew
f02fac78d1 Expose a bunch of new functionality from POSIX 2008: openat(2),
fchmodat(2), fstatat(2), mkdirat(2), mkfifoat(2), mknodat(2),
faccessat(2), fchownat(2), linkat(2), readlinkat(2), renameat(2),
symlinkat(2), unlinkat(2), utimensat(2), futimens(2), and
fdopendir(3).

"Minor" libc bump.

Tested in a bulk build by naddy@
Much help from guenther@, thib@, tedu@, oga@, and others.
ok deraadt@, naddy@
2011-07-18 17:29:49 +00:00
jsg
c4ff7bee63 As pointed out by Richard Guenther our definition
of NULL was incorrect for c++ compilers that aren't
gcc (or pretend to be gcc like clang).

ok miod@
2011-07-03 18:51:01 +00:00
miod
0c2a5da7f0 Define NULL as a void * instead of a long integer, as required by Single Unix.
Kernel and bootblocks still use the old 0L value until all the NULL abuses
in the code are fixed.
2011-04-06 11:39:42 +00:00
kurt
c5acf43a35 Fix the handle locking in stdio to use flockfile/funlockfile
internally when and where required.  Macros in <stdio.h> are updated
to automatically call the underlying functions when the process is
threaded to obtain the necessary locking.  A private mutex is added
to protect __sglue, the internal list of FILE handles, and another
to protect the one-time initialization.  Some routines in libc that
use getc() change to use getc_unlocked() as they're either protected
by their own lock or aren't thread-safe routines anyway.

committing on behalf of and okay guenther@ now that we have install
media space available.
2009-11-09 00:18:27 +00:00
guenther
7ff09c5c6c Back out previous commit, as it caused too much growth for the install
media to fit
2009-10-22 01:23:16 +00:00
guenther
9962e7fd03 Fix the handle locking in stdio to use flockfile/funlockfile
internally when and where required.  Macros in <stdio.h> are updated
to automatically call the underlying functions when the process is
threaded to obtain the necessary locking.  A private mutex is added
to protect __sglue, the internal list of FILE handles, and another
to protect the one-time initialization.  Some routines in libc that
use getc() change to use getc_unlocked() as they're either protected
by their own lock or aren't thread-safe routines anyway.

ok kurt@, earlier version tested by sthen@ and jj@
2009-10-21 16:04:23 +00:00
miod
25fa1fc0ab Remove neither documented nor found in any spec ctermid_r() function - ctermid()
is reentrant in its current implementation anyway.
Surfing on the recent major version bump, ok millert@ deraadt@
2006-01-13 18:10:09 +00:00
millert
c916d9484c Adapt things to use __type_t instead of _BSD_TYPE_T_
Add new sys/_types.h header
Include machine/_types.h or sys/_types.h where applicable
2006-01-06 18:53:04 +00:00
millert
52a0e6034e First step in include files overhaul. Use __FOO_VISIBLE (as defined
in sys/cdefs.h) instead of _FOO_SOURCE.  Also fix several namespace
pollution issues, including the byte order defines.  OK deraadt@
2005-12-13 00:35:22 +00:00
espie
57bf79d243 let vfscanf be a real function. Use a weak_alias on systems where this
is feasible.

Okay millert@

There's a major libc bump coming that is going to cover this as well...
2005-05-11 18:39:19 +00:00
espie
685aea3ce6 Change internals of FILE: reuse the unget buffer field to access an
extended attribute data structure (pimpl idiom). Idea taken from citrus.
Much discussion with deraadt@, otto@, millert@...

This is the least disruptive way to extend FILE, since its size can't really
change without this being a flag day. So the size doesn't change.

Actual additions to the structure will come in separate steps, since this
change is nasty enough on its own.

Tests by otto@ and others, careful reading of code by otto@ and millert@.

This is definitely a major bump, and has been checked to not impact a
full ports build.
2005-04-30 09:25:17 +00:00
marc
f91de67f29 major bump to libc and libpthread to break the dependency of a
particular implementation of libpthread for libc.  libc no longer
needs pthread.h to compile.
OK millert@, brad@, tedu@
2004-06-07 21:11:23 +00:00
avsm
89b95c1c6c add __bounded__ attributes for userland headers; enabled with -Wbounded
ok deraadt@
2003-08-01 17:38:33 +00:00
avsm
3e87668a71 backout the __bounded__ attributes for a while; requested by deraadt@ 2003-06-26 19:34:17 +00:00
avsm
585be00bb5 Mark various standard library functions with the __bounded__ attribute.
You must have an up-to-date gcc for this!
deraadt@ ok
2003-06-26 18:35:13 +00:00
millert
e33d3bd3b8 Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999.  Proofed by myself and Theo.
2003-06-02 19:34:12 +00:00
millert
da2317ca16 Back out __EOF stuff and just use -1 in ctype.h. This is OK since
we don't want any user defines to change how the inlined ctype
functions behave.
2002-12-30 21:36:05 +00:00
millert
5d8e0bc20f Don't define EOF In ctype.h, some 3rd party code checks whether or
not EOF is defined to determine if stdio.h has been included.
Instead, use __EOF which should be OK wrt namespace safety.
2002-12-29 03:02:34 +00:00
millert
8248c2b451 NULL is now 0L so it is the same size as a pointer.
OK mickey@ and discussed with deraadt@
2002-10-25 21:55:28 +00:00
millert
e7beb4a7d5 We live in an ANSI C world. Remove lots of gratuitous #ifdef __STDC__ cruft. 2002-02-19 19:39:35 +00:00
millert
f3c3a9c6df Manual cleanup of remaining userland __P use (excluding packages maintained outside the tree) 2002-02-17 19:42:18 +00:00
millert
c72b5b24e1 Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically. 2002-02-16 21:27:05 +00:00
espie
5118ef4149 attribute(format) no longer implies nonnull...
ok millert@ miod@
2001-11-02 00:19:10 +00:00
fgsch
76255b28fc put changes back, this time ALL the files. 2001-09-04 22:17:44 +00:00
todd
cd74a012b8 Back out fgsch@'s tree breaking commits.
Test next time, ok?
2001-08-30 17:47:57 +00:00
fgsch
271c380dbf fix some const warnings 2001-08-30 07:38:27 +00:00
deraadt
fee2a480b3 use __x__ formats for __attribute__ arguments; guenther@gac.edu 2000-12-06 17:18:41 +00:00
millert
5eac0c9518 Make P_tmpdir point to /tmp/ not /var/tmp
Really, there should be a way to make configurable by the admin
at runtime (say, a gettmpdir() function).
2000-03-04 17:16:02 +00:00
millert
04204a0765 Use an _BSD_FOO_T_ type declaration for off_t in machine/ansi.h to allow
off_t to be visible in stdio.h even in strict ansi mode.  This is needed
for ftello()/fseeko() and it allows us to remove the horrible fpos_t hack.
2000-02-22 17:29:12 +00:00
millert
8b74247033 Add fseeko() and ftello() -- versions of fseek() and ftell() that use off_t.
Also make fsetpos() and fgetpos() use fseeko() and ftello() respectively
since fpos_t is actually a 64bit type.
2000-02-21 22:11:20 +00:00
espie
ad7ac144d1 Be thorough about NULL as __null for C++. 1999-09-17 13:13:46 +00:00
d
92efb73507 Add thread-safety to libc, so that libc_r will build (on i386 at least).
All POSIX libc api now there (to P1003.1c/D10)
  (more md stuff is needed for other libc/arch/*)
  (setlogin is no longer a special syscall)
Add -pthread option to gcc (that makes it use -lc_r and -D_POSIX_THREADS).
Doc some re-entrant routines
Add libc_r to intro(3)
dig() uses some libc srcs and an extra -I was needed there.
Add more md stuff to libc_r.
Update includes for the pthreads api
Update libc_r TODO
1998-11-20 11:18:22 +00:00
millert
30b1b93ba6 Add __attribute__ for asprintf. 1997-11-29 20:01:03 +00:00
millert
78f54e551c Implement asprintf(3) and vasprintf(3) functions similar to the
ones in the glibc.  Some man pages changes from FreeBSD
(asprintf.c/vasprintf.c are not based on GNU or FreeBSD code).
1997-11-29 19:54:47 +00:00
tholo
ca472fa23a Do not enable putc() macro implementation if _POSIX_SOURCE is defined;
it is not fully compliant
1996-10-28 06:51:05 +00:00