Commit Graph

122 Commits

Author SHA1 Message Date
joerg
5262cf8ca3 Avoid depending on namespace pollution in stdlib.h. 2020-05-26 21:49:29 +00:00
maya
b3991c8820 We can make a stronger guarantee than __pure.
abs/labs don't read global memory.

Make GCC 9 happier.
2019-01-05 09:16:46 +00:00
martin
a9fb6a0f33 PR standards/53525: move getsubopt() to stdlib.h 2018-08-15 10:21:42 +00:00
christos
96a83291ba remove recallocarray 2017-10-07 21:15:48 +00:00
christos
345c694682 add recallocarray (used by openssh-7.6) 2017-10-07 19:38:09 +00:00
christos
d32f1d2f0f add hmac(3) 2016-07-01 22:42:01 +00:00
nros
b16a5c9dec Add the C11 function aligned_alloc to libc. 2015-11-07 16:21:42 +00:00
joerg
9b5f3d5723 Move reallocarray under _OPENBSD_SOURCE where it belongs. 2015-02-17 20:33:40 +00:00
joerg
c9baa5968d Introduce reallocarr(3) for easy (re)allocation of memory with overflow
checks. Compared to OpenBSD's reallocarray, makes it easier to avoid memory
leaks on allocation failures and it doesn't depend on malloc(0) != NULL
for correct error checking. Compared to plain realloc, it also avoids
the problem of intermediate integer overflows. The trade-off is the use
of void * to side step C type system with regard to generic pointer to
pointer.
2015-02-17 20:29:20 +00:00
christos
7f04eb91cf add reallocarray 2015-02-05 16:05:46 +00:00
christos
f1e6017cdd remove restrict to match with OpenBSD prototype (Kamil Rytarowski) 2015-01-18 17:56:09 +00:00
christos
5bdc27618e Add strtonum protected with _OPENBSD_SOURCE 2015-01-16 18:40:16 +00:00
christos
e00a3615cf add mkostemp{s,} mkstemps from FreeBSD 2014-06-18 17:48:22 +00:00
christos
b27e135433 rename to 60 2014-06-12 18:49:37 +00:00
christos
1eb0dcbb1d fix srandom and initstate signatures (from enh at google) 2014-06-12 18:44:36 +00:00
christos
eabc0dd171 add ptsname_r 2014-01-08 02:15:42 +00:00
christos
c4c409af9e add at_quick_exit and quick_exit 2013-04-26 18:07:43 +00:00
joerg
2e24f90028 Provide the long long routines for C++11 code. 2013-04-26 17:36:24 +00:00
joerg
3c1c8515c7 Add MB_CUR_MAX_L. 2013-04-19 14:35:31 +00:00
joerg
ceb51ddcad Add mblen_l, mbstowcs_l, wctomb_l, mbtowc_l and wcstombs_l. 2013-04-18 22:22:20 +00:00
joerg
c99aac45e5 Add strtof_l, strtod_l and strtold_l. 2013-04-18 21:54:10 +00:00
joerg
a67fde0356 Add strtol_l and friends. Switch _citrus_bcs_strtol to use plain
strtol_l unless in tools mode. Add note to retire the BCS code on the
next libc major bump.
2013-04-16 21:44:06 +00:00
christos
6ddff5efba sprinkle restrict in realpath(3) 2012-06-21 21:13:29 +00:00
joerg
1907ec3a61 Switch device database to cdb(5). Rework ttyname(3) and ttyname_r(3) to
depend on new devname_r(3) as heart. Add /dev/pts magic directly to
devname(3). While it can lead to returning non-existing paths, the
behavior is more consistent that way. Drop caching layer in devname(3),
it doesn't buy anything for the common case of having access to the
database. Teach devname(3) proper fallback behavior of scanning /dev.
Create both old-style and new-style database for now in /etc/rc.d/sysdb.
2012-06-03 21:42:44 +00:00
christos
0bcf0d6f44 PR/46360: YAMAMOTO Takashi: Restore NetBSD-5 compatibility with putenv()
copying the passed string (which is not ToG compliant), instead of using
it directly in the environment arrat as it should. Needs to be pulled up
to NetBSd-6.
2012-04-20 17:31:29 +00:00
christos
a66aa579a5 remove commaize_number. 2011-03-16 00:48:34 +00:00
pooka
bfbab30192 put in a proto for commaize_number()
(nb. doing this purely as the minimum work solution to get a working build)
2011-03-15 12:21:08 +00:00
christos
a52c04784a add arc4random_{buf,uniform}, from OpenBSD. 2011-02-04 22:07:07 +00:00
jruoho
5b557140cd Use __constfunc(3) instead of __attribute__((const)) directly. 2010-12-22 19:47:56 +00:00
christos
7acc3301d8 make putenv POSIX compliant. 2010-10-01 20:11:32 +00:00
plunky
bdbcfb0d2d later versions of pcc may define __GNUC__ for compatibility reasons, so
having a system definition for alloca is counter productive as it seems
fairly common to use

    #ifdef __GNUC__
    #define alloca ..
    #endif

in user-headers (eg see usr.sbin/gspa/gspa/gspa_ass.h)

So, defang this definition as we don't otherwise provide alloca on NetBSD
2010-06-01 08:42:56 +00:00
joerg
8a601553bc Consistently use __printflike and __scanflike. 2010-02-25 18:37:12 +00:00
christos
db576bf322 Don't define wchar_t for c++; it is native in the language. From Alexander
Nasonov
2009-11-15 22:21:03 +00:00
joerg
d6e219476b Add a fast, platform independent hash function to libc.
The algorithm used is the Jenkins hash.  The name (mi_vector_hash)
reflects the nature of the hash function.
Add glue for libc ATF tests and include a test case to make sure that
(mis)alignment and endianess are handled correctly.

Bump libc minor to 169.
2009-07-20 17:03:36 +00:00
drochner
ad965be01b cleanup after devmajor_t:
-since getdevmajor(3) is now binary compatible again with <=5.0
 there is no need to rename, I've just left a __getdevmajor50 symbol
 temporarily for those who track -current
-update manpage
2009-01-20 20:08:12 +00:00
drochner
d767912be3 Change major()/minor() to return 32-bit types again, called
devmajor_t/devminor_t, as proposed on tech-kern.
This avoids 64-bit arithmetics and 64-bit printf formats in parts
of the kernel where it is not really useful, and helps clarity.
2009-01-20 18:20:47 +00:00
christos
50728e7823 merge christos-time_t 2009-01-11 02:57:17 +00:00
gmcgarry
79ae39b7d3 Use __builtin_alloc() with pcc. 2008-06-21 00:58:00 +00:00
yamt
e3372d31c3 RANDOM_MAX: don't rely on integer overflow. 2008-04-07 12:24:52 +00:00
drochner
7cc98087b6 everyone else assumes that defining "_XOPEN_SOURCE" means XPG4.2,
so remove comparisions against the numerical values "3" or "4"
2008-04-01 19:23:28 +00:00
christos
c75e135b85 add RANDOM_MAX define from anon ymous 2008-02-28 16:13:35 +00:00
christos
0d149bc5fe Add csetexpandtc() 2008-02-02 20:56:46 +00:00
perry
fc883a791d change some __attribute__s to __keywords 2007-12-24 17:26:09 +00:00
christos
03dcf031ab humanize_number was the only function in <util.h> that is not in libutil.
Move it to stdlib.h and add dehumanize_number.
2007-12-14 16:36:19 +00:00
ad
95182011ed Enable posix_memalign(). 2007-11-19 14:48:41 +00:00
ragge
98e922db67 The alloca() arg type check is broken (cpp do not do string comparisions)
so make it marginally less broken so that it works with other compilers
than gcc.
Probably the check can be removed, I doubt anyone will try to use gcc1
anymore.
2007-04-22 08:21:50 +00:00
kleink
bc89c06cbf Add strtof(3) and strtold(3); welcome libc 12.137. 2006-03-15 17:35:17 +00:00
perry
5f65228b74 u_intN_t -> uintN_t 2005-12-26 19:01:47 +00:00
perry
971a8b8cc7 __const__ -> const
This is in an __attribute__ so it isn't really necessary, but it gets
it out of the listing of __keyword__s...
2005-12-24 23:04:05 +00:00
kleink
ffff20ba60 Move getenv_r() to the local section. 2005-09-26 12:51:34 +00:00