summaryrefslogtreecommitdiff
path: root/lib/libc/stdlib
AgeCommit message (Collapse)Author
2021-12-05jemalloc.3: fix malformed CVS Idrillig
2021-12-05s/supress/suppress/msaitoh
2021-10-29Add "--" 'options end' parameter to the sh -c call that runs thekre
command, so that the command cannot appear to be more options (which always then fails, as there would be no arg for "-c" to treat as the command string in that case). For the full (LONG) explanation, see: http://mail-index.netbsd.org/current-users/2021/10/29/msg041629.html
2021-10-29reallocarr does not set errno.nia
2021-10-29radixsort(3): use reallocarr instead of malloc(x * y)nia
2021-08-30Remove lint workaroundschristos
2021-08-12fix typos in "environment" word.andvar
2021-04-20Instead of compiling files with -fcommon, create an include file and declarechristos
the 3 symbols that need to be common using an attribute. Put all the 3 symbol definitions in libc in one place (initfini.c). Reviewed by joerg@
2021-02-26arrange for tools buildchristos
2021-02-16Correct floating-point terminology.riastradh
Might want to harmonize the printf(3) and wprintf(3) descriptions of `%a'.
2020-05-15Hook up proper fork lock handling for malloc:joerg
- lock all relevant mutexes just before fork - unlock all mutexes just after fork in the parent - full reinit non-spinlocks in the child This is not using the normal pthread_atfork interface to ensure order of operation, malloc is used as implementation detail too often.
2020-05-03turn off TLS for mips on old jemalloc. it doesn't work.mrg
2020-04-22Use __mc68010__ to distinguish m68000 (sun2) from other m68k ports;rin
__mc68000__ is defined both for m68000 and m68k.
2020-04-22Fix previous for libhack, where _REENTRANT is not defined;rin
arenas_map_key is used only when NO_TLS && _REENTRANT.
2020-04-21Switch to using TLS in old jemalloc for everywhere but VAX and sun2.joerg
2020-02-23Change the previous cast from unsigned int to unsigned longkamil
This code produces the same result and is consistent with the previous lines. Only the least significant 16 bites (unsigned short) are meaningful.
2020-02-22Avoid undefined behavior in the rand48(3) implementationkamil
Instead of implicid promotion to signed int, explicitly cast the arguments to unsigned int. _rand48.c:53:27, signed integer overflow: 58989 * 58970 cannot be represented in type 'int' _rand48.c:53:38, signed integer overflow: -2093025904 + -1496809120 cannot be represented in type 'int' _rand48.c:53:57, signed integer overflow: 57068 * 42787 cannot be represented in type 'int' New and old code produce the same code as tested with: #include <stdio.h> #include <stdlib.h> #define COUNT 1000 * 1000 int main(void) { FILE *fp; int i; fp = fopen("numbers.txt", "w+"); if (!fp) abort(); for(i = 0; i < COUNT; i++) { fprintf(fp, "%f\n", drand48()); fprintf(fp, "%ld\n", lrand48()); fprintf(fp, "%ld\n", mrand48()); } fclose(fp); return 0; }
2020-02-22Reorder words to fix grammarkamil
Noted by <leot>
2020-02-22rand48: Document that short integers are unsignedkamil
2020-02-22Improve readability of __dorand48()kamil
Break long lines into shorter instructions per line. No Functional Change.
2020-02-22Avoid NULL pointer arithmetics on environkamil
_env.c:260:9, pointer expression with base 0 overflowed to 0 _env.c:260:9, load of null pointer of type 'char *'
2020-01-13Fix atfork malloc handling to include all the locks in old jemalloc.joerg
2020-01-13Fix aarch64 definition in old jemallocjoerg
There is no platform-specific reason for avoiding TLS. The tiny allocations should be aligned the same as small allocations for ABI reasons.
2019-12-06Fix manpage due to updated aligned_alloc behaviornros
Since aligned_alloc does not demand that size is to be multiple of alignment anymore, don't make that claim in the man page.
2019-09-01Document historysevan
https://www.bell-labs.com/usr/dmr/www/man21.pdf
2019-03-28fix compilation for non _REENTRANTchristos
2019-03-04Hook for jemallocchristos
2018-12-09fix grammar.christos
2018-12-06Correct handling of minval > maxval in strtonum(3)kamil
The original implementation in OpenBSD returns "invalid" and avoids reading the input string. The replaced behavior was interpreting the input string ignoring the invalid arguments.
2018-08-30Allow being compiled as a tool.christos
2018-08-15PR standards/53525: move getsubopt to stdlib.hmartin
2018-07-27it's C18, not C17.maya
2018-07-27Claim C17 (although I'm unsure), add a note about C11's requirements.maya
2018-07-27C17 conformance: aligned_alloc's size doesn't need to be a multiple ofmaya
alignment any more. Thanks Joseph Myers for the heads up.
2018-07-25Avoid undefined behavior in left bit shift in jemalloc(3)kamil
Change the type of shifted value to unsigned to prevent altering the signedness bit. jemalloc.c:1707:14, left shift of 1 by 31 places cannot be represented in type 'int' jemalloc.c:1724:15, left shift of 1 by 31 places cannot be represented in type 'int' jemalloc.c:1840:28, left shift of 1 by 31 places cannot be represented in type 'int' Detected with micro-UBSan in the user mode.
2018-06-13libc: remove explicit cast NULL in atoieadler
There isn't any reason to cast NULL so just remove it. A similar change was already made in DragonFly and FreeBSD (by me). ok fly@
2018-05-23Simplify to avoid pointless null pointer arithmetic.joerg
2018-02-07Fix typos, as reported by Eitan Adler. Update dates.pgoyette
2018-01-07Revert namespacing of atoi(3)kamil
Sanitizers can handle recursive interceptions in some / most cases, if they will cause damage the problem will be not workaroundable without libc changes - I will be back to it. Keep namespace of asctime() as this can be a cancellation point according to POSIX. Right now it's not implemented on NetBSD. Defer it for later. Keep weak symbols and namespace for wait6(2) as this could be a cancellation point as well. Defer this for later. Sanitizers's [recursive] interceptors are a hack and moving one way or another can cause new sets of problems. Recursive ones can be useful and cause problems (on Linux there are known with with signal handlers). Sponsored by <The NetBSD Foundation>
2018-01-05add strfmon_l man page linkssnj
2018-01-05Register new weak symbol in libc for internal usage: atoikamil
The NetBSD Standard C Library uses internally some of its functions with a mangled symbol name, usually "_symbol". The internal functions shall not use the global (public) symbols. Add atoi to namespace.h. Register a new __weak_alias() entry for atoi() in atoi.c. atoi() is used internally in getrpcent(), rresvport_af(), ftok(), err(), __llvm_profile_write_file(), llvm_gcda_start_file(), citrus_iconv_open(), getprotoent_r(), __rpc_uaddr2taddr_af(), __res_nopt_rdata() and servent_parseline(). This revision switches the internal usage to the internal symbol. Sponsored by <The NetBSD Foundation>
2018-01-04Add bunch of missing includes of namespace.h in libckamil
The NetBSD Standard C Library uses internally some of its functions with a mangled symbol name, usually "_symbol". The internal functions shall not use the global (public) symbols. This change eliminates usage of the global changes of the following symbols: - strlcat -> _strlcat - sysconf -> __sysconf - closedir -> _closedir - fparseln -> _fparseln - kill -> _kill - mkstemp -> _mkstemp - reallocarr -> _reallocarr - strcasecmp -> _strcasecmp - strncasecmp -> _strncasecmp - strptime -> _strptime - strtok_r -> _strtok_r - sysctl -> _sysctl - dlopen -> __dlopen - dlclose -> __dlclose - dlsym -> __dlsym Sponsored by <The NetBSD Foundation>
2017-12-07Fix obvious typo (cut&pasto or whatever) - there's only one value thatkre
specifies the number of digits after the decimal point (oh, sorry, the "radix character") the other specifies the number before... While here, add a little more info on the effects of using the #n value.
2017-12-01normalise some indentation. NFC.mrg
2017-11-27use calloc rather than malloc + memset 0maya
2017-11-27Fix various bugs with strfmon:christos
- Avoid out of bounds access for the currency_symbol[3] when the symbol is shorter (as it happens with the C locale where it is empty) - Don't compare pointers to NUL, it is not helpful. - Make the default sep_by_space 1 as suggested in: https://ftp.gnu.org/old-gnu/Manuals/glibc-2.2.3/html_node/libc_111.html - Use the correct number of bytes for memmove(3) XXX: pullup-8
2017-11-16The HPPA architectures (1.1 and 2.0) both define quadruple-word (128-bit)skrll
floating point types. Adjust alignment to match.
2017-11-06Assert that __cxa_atexit is not used with NULL as DSO. Don't usejoerg
__cxa_atexit directly from atexit, they have different behavior.
2017-11-02Revert previous on demand.kamil
Rationale: The DSO handle is a required part of the (external) __cxa_atexit interface. The atexit mapping is an implementation detail and not part of the public interface. Doing it directly creates UB as it involves casting function pointers between incompatible types. -- Joerg
2017-11-02Correct handling of __cxa_atexit(a,b,NULL) in libckamil
In the NetBSD implementation and suggested by Itanium C++ ABI, we wrap the atexit(x) call as __cxa_atexit(x,NULL,NULL). __cxa_atexit() is an internal function for the usage of C++. Correct a bug that __cxa_atexit(x,y,NULL) is handled in the same way as atexit(x) (which is simplified to __cxa_atexit(x,NULL,NULL). This misbehavior has been detected in the Thread Sanitizer port to NetBSD. Patch reviewed by <christos> Sponsored by <The NetBSD Foundation>