aboutsummaryrefslogtreecommitdiff
path: root/newlib/libc/include
AgeCommit message (Collapse)AuthorFilesLines
2026-02-12stdatomic.h: use latest FreeBSD file verbatimCorinna Vinschen1-27/+27
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2026-02-12features.h: define __ISO_C_VISIBLE as 2023 for ISO C23Corinna Vinschen2-4/+4
Aligned definition with FreeBSD to simplify porting FreeBSD headers. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2026-02-12machine/_default_types.h: define __ptrdiff_t and __wchar_tCorinna Vinschen1-0/+14
These are not strictly necessary, but POSIX headers can define other types based on them even if stddef.h isn't included. It also simplifies porting BSD headers. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2026-02-12stdint.h: move fast type evaluation to machine/_default_types.hCorinna Vinschen2-71/+92
Move the heavy machinery evaluating the fast types from stdint.h to machine/_default_types.h. Do not try to guess from INTMAX. In the unlikely case that __INT_FASTn_TYPE__ and __UINT_FASTn_TYPE__ are not defined, use the size-correct base types instead, just as with the least types. Nice side-effect: We don't need the "define fast as least" fallback code in stdint.h anymore, given that the definitions of least and fast types in machine/_default_types.h are now equivalent: If fast couldn't be defined, least couldn't have been defined either. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2026-02-09stdatomic.h: add atomic definitions for char8_t, char16_t and char32_tCorinna Vinschen1-3/+7
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2026-02-09machine/_default_types.h: add definitions for __char16_t / __char32_tCorinna Vinschen1-0/+14
These types are to be used from stdatomic.h and uchar.h. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2026-02-09libc/include/regex.h: Add include of <sys/_types.h> for off_tJoel Sherrill1-1/+2
The winsup/ version of regex.h already had this include. Without it, including <regex.h> by itself would not compile.
2025-12-04features.h: Fix -Wundef problemsStefan Tauner1-21/+28
-Wundef warns if an undefined identifier is evaluated in an #if directive. This would be valid as they are replaced with 0. However, it is often an early warning sign and not intentional. To allow for enabling -Wundef even outside system directories (where compilers ignore such problems unless -Wsystem-headers is enabled) this patch adds the required defined() checks. glibc also has been supporting this for 10 years now: https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=f248238cf43bd751db29e6f151d6da7645337ff5 I have not exhaustively tested this but you can see the effect with something like the following (+ using -stdc= and/or -D...): echo | gcc -include newlib/libc/include/sys/features.h -Inewlib/libc/include/ -E - -Wundef Signed-off-by: Stefan Tauner <stefan.tauner@gmx.at>
2025-11-19libc/features.h: Make code match documentationSimon Barth1-2/+2
The documentation states that _GNU_SOURCE enables "all of the above plus GNU extensions.". Furthermore the documentation states that _DEFAULT_SOURCE would enable POSIX-1.2008 with BSD and SVr4 extensions. The code did different things though: * For _GNU_SOURCE it only enabled POSIX.1-2008 but it should have been the highest available one, POSIX.1-2024. * For _DEFAULT_SOURCE it enabled POSIX.1-2024. Let's use the highest available POSIX standard possible and fix documentation where necessary.
2025-11-19libc: Make string.h POSIX.1-2024 compliantSimon Barth1-2/+4
POSIX.1-2024 added strlcpy, strlcat, and memmem to strings.h. Previously these functions were only available as parts of BSD or GNU extensions. Fix the header so that the symbol are visible for either the right extensions, or for POSIX.1-2024.
2025-11-04newlib/libc/include/sys/features.h: Update RTEMS sectionJoel Sherrill1-6/+9
The RTEMS section defined macros for features RTEMS does not have.
2025-11-04newlib/libc/include/setjmp.h: Add returns_twice attribute to setjmp()Joel Sherrill1-7/+3
The setjmp() function needs this attribute to help GCC avoid false positives for the -Wclobbered warning. The -Wclobbered warning is part of -Wextra.
2025-08-04sys/_default_fcntl.h: Define OFD lock operationsCorinna Vinschen1-0/+5
Linux and POSIX-1.2024 define operations to create OFD (Open File Description) locks. OFD locks are like POSIX record locks, but bound to the file descriptor, not bound to the process. As such, they are also inherited via fork(2) and dup(2), just like BSD flock(2) locks. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2025-08-04sys/_default_fcntl.h: fix whitespaceCorinna Vinschen1-11/+11
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2025-07-23sys/cdefs.h: Protect parameters to __builtin_is_aligned()Paul Cercueil1-1/+1
The macro was not protecting properly its first parameter, which caused it to silently return an invalid value when passing a composed parameter, ie. __builtin_is_aligned(src | dst | len, 32); Signed-off-by: Paul Cercueil <paul@crapouillou.net>
2025-07-17libc/include/sys/stat.h: Adjust for RTEMS MIPSJoel Sherrill1-2/+3
The commit cited below introduced changes which included conditionals strictly on __mips__. This ignored tailoring for any environment on MIPS except that targeted by the author of the change. This patch just fixes this code for RTEMS. commit 467a2bdf17ad376dafada9f1734784f4611fa6fd Author: Jovan Dmitrović <jovan.dmitrovic@htecgroup.com> Date: Wed Jun 11 10:11:33 2025 +0200 mips: Implement MIPS HAL and UHI Implement abstract interface for MIPS, including unified hosting interface (UHI). Signed-off-by: Jovan Dmitrović <jovan.dmitrovic@htecgroup.com>
2025-07-17nvptx: Change 'read' and 'write' to 'ssize_t' return typeArijit Kumar Das1-0/+5
This commit changes the return type of the read() and write() syscalls for nvptx to ssize_t. This would allow large files to be handled properly by these syscalls in situations where the read/write buffer length exceeds INT_MAX, for example. This also makes the syscall signatures fully complaint with their current POSIX specifications. We additionally define two macros: '_READ_WRITE_RETURN_TYPE' as _ssize_t and '_READ_WRITE_BUFSIZE_TYPE' as __size_t in libc/include/sys/config.h under __nvptx__ for consistency. Signed-off-by: Arijit Kumar Das <arijitkdgit.official@gmail.com>
2025-07-16libc/time: Add CLOCK_TAISebastian Huber1-0/+6
For _GNU_VISIBLE, provide the CLOCK_TAI clock identifier for the International Atomic Time. Use the value specified by glibc and Linux. Add _BSD_VISIBLE given FreeBSD also provides this clock identifier.
2025-07-04mips: Implement MIPS HAL and UHIJovan Dmitrović3-2/+22
Implement abstract interface for MIPS, including unified hosting interface (UHI). Signed-off-by: Jovan Dmitrović <jovan.dmitrovic@htecgroup.com>
2025-07-02newlib: increase jump buffer length to 25 to fit all non-volatile registers ↵Radek Bartoň1-1/+10
for aarch64-pc-cygwin Signed-off-by: Radek Bartoň <radek.barton@microsoft.com>
2025-06-24libc: Update the guard for quick_exit() and at_quick_exit() functionsMazen Adel Elmessady1-1/+4
Updated the guard for stdlib functions to use the POSIX Issue 8 guard added in 2024.
2025-06-24libc/../pthread.h: Updated the guard for Posix Issue 8 functionsMazen Adel Elmessady1-6/+6
Updated the guard for pthread functions added in POSIX Issue 8 to use the POSIX Issue 8 guard added in 2024. These functions are: pthread_mutex_clocklock() pthread_cond_clockwait() pthread_rwlock_clockrdlock() pthread_rwlock_clockwrlock()
2025-06-24libc: Added timespec_get() to time.hMazen Adel Elmessady1-0/+5
Added timespec_get() prototype to libc/include/time.h and removed the prototype from winsup/cygwin/include/cygwin/time.h
2025-06-18add value for _h_errno in _REENT_INIT(var) for struct, _reentJohannes Rosa1-1/+2
The define '_REENT_INIT' for the case '!_REENT_SMALL' was missing an initializing value for 'int _h_errno'. If code uses the _REENT_INIT() macro to preset a variable of type struct _reent, this led to an issue when compiling with -Wmissing-field-initializers.
2025-05-02Newlib: Update search.h functions for POSIX.1-2024Mark Geisert1-4/+6
Add type posix_tnode. Change certain uses of "void" to "posix_tnode" in both the prototypes and definitions of functions associated with <search.h>. (Necessary changes to Cygwin's /usr/include/search.h will follow in a separate patch to be sent to cygwin-patches.) Reported-by: Collin Funk <collin.funk1@gmail.com> Addresses: https://cygwin.com/pipermail/cygwin/2025-April/258032.html Signed-off-by: Mark Geisert <mark@maxrnd.com> Fixes: ec98d19a08c2 "* wininfo.h (wininfo::timer_active): Delete."
2025-04-11newlib: sys/unistd.h: Change inline to __inlineTakashi Yano1-1/+1
Addresses: https://sourceware.org/pipermail/cygwin-patches/2025q2/013644.html Fixes: 3e8a7eb1a868 ("sys/unistd.h: fix definition of setproctitle_init") Reported-by: Brian Inglis <Brian.Inglis@SystematicSW.ab.ca> Co-authored-by: Corinna Vinschen <corinna@vinschen.de> Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
2025-03-24getlocalename_l: allow LC_ALL categoryCorinna Vinschen1-2/+9
Following the changes from Austin Group bug https://www.austingroupbugs.net/view.php?id=1741, getlocalename_l() now allows to specify LC_ALL and returns a setlocale-conmpatible LC_ALL locale string. Consequentially we have to raise the size of _reent::_getlocalename_l_buf so there's enough space for the LC_ALL locale string. Guard all different definitions and usages of _getlocalename_l_buf in reent.h with _MB_CAPABLE. Link: https://www.austingroupbugs.net/view.php?id=1741 Fixes: 71511d4ac868 ("getlocalename_l: implement per SUS Base Specifications Issue 8 draft") Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2025-03-05sys/unistd.h: fix definition of setproctitle_initCorinna Vinschen1-1/+1
setproctitle_init is defined in c2x manner, omitting names for the unused parameters. This can result in warnings or errors on certain compiler versions: clang 8: error: parameter name omitted clang 15: warning: omitting the parameter name in a function definition is a C2x extension [-Wc2x-extensions] gcc -Wsystem-headers -pedantic -std=c17: warning: ISO C does not support omitting parameter names in function definitions before C2X [-Wpedantic] Add parameters to avoid above warning and errors. Fixes: 2e7f7b96e5f1 ("Cygwin: implement setproctitle") Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2025-02-14unistd.h: enable SEEK_DATA and SEEK_HOLE also for POSIX-1.2024Christian Franke1-1/+1
https://pubs.opengroup.org/onlinepubs/9799919799/functions/lseek.html Signed-off-by: Christian Franke <christian.franke@t-online.de>
2025-01-28unistd.h: declare posix_closeCorinna Vinschen1-0/+10
Declare posix_close, a new function defined by POSIX-1.2024, per https://pubs.opengroup.org/onlinepubs/9799919799/functions/posix_close.html Define POSIX_CLOSE_RESTART. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2025-01-23devctl.h: update for POSIX-1.2024Corinna Vinschen1-16/+0
posix_devctl is now part of POSIX-1.2024, thus the requirement to define _POSIX_26_C_SOURCE has been dropped. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2025-01-16Add posix_spawn_file_actions_add{f}chdirCorinna Vinschen1-2/+7
POSIX®.1-2024 now defines posix_spawn_file_actions_addchdir and posix_spawn_file_actions_addfchdir. Add these interfaces to spawn.h, guarded as POSIX 202405 symbols. Cygwin-only: Export them as aliases of the *_np counterparts. Bump API minor. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-12-12Cygwin: sched_setscheduler: accept SCHED_RESET_ON_FORK flagChristian Franke1-0/+3
Add SCHED_RESET_ON_FORK to <sys/sched.h>. If this flag is set, SCHED_FIFO and SCHED_RR are reset to SCHED_OTHER and negative nice values are reset to zero in each child process created with fork(2). Signed-off-by: Christian Franke <christian.franke@t-online.de>
2024-12-12Cygwin: sched_setscheduler: accept SCHED_BATCHChristian Franke1-0/+1
Add SCHED_BATCH to <sys/sched.h>. SCHED_BATCH is similar to SCHED_OTHER, except that the nice value is mapped to a one step lower Windows priority. Rework the mapping functions to ease the addition of this functionality. Signed-off-by: Christian Franke <christian.franke@t-online.de>
2024-12-04Cygwin: sched_setscheduler: accept SCHED_IDLEChristian Franke1-0/+4
Add SCHED_IDLE to <sys/sched.h>. If SCHED_IDLE is selected, preserve the nice value and set the Windows priority to IDLE_PRIORITY_CLASS. Signed-off-by: Christian Franke <christian.franke@t-online.de>
2024-11-20newlib/libc/include/time.h: Removed clock_id castsAaron Nyholm1-10/+10
The POSIX specification defines these as constants. The cast is unnecessary. This brings newlib inline with the equivalent FreeBSD defines.
2024-11-04sys/features.h: Use _ISOC23_SOURCE instead of _ISOC23_SOURCE and remap ↵Lenard Mollenkopf1-7/+14
_ISOC2x_SOURCE to _ISOC23_SOURCE Signed-off-by: Lenard Mollenkopf <newlib@lenardmollenkopf.de>
2024-10-28sys/features.h: Spelling _ISOC2x_SOURCE is not C11Lenard Mollenkopf1-1/+1
2024-09-02Replace __restrict with __restrict_arr in regex.hyang.zhang1-1/+1
when a C++ source file include this header file, it would build fail. Signed-off-by: yang.zhang <zhangyang01@kylinos.cn>
2024-08-21arc64: Add port for Synopsys DesignWare ARCv3 ISAYuriy Kolerov2-0/+14
Synopsys ARCv3 ISA includes 32-bit ARC HS5x targets and 64-bit ARC HS6x targets. Both CPU families are placed in "arc64" subdirectories as it done for GCC port. Target name arc64 is used for historical reasons and Synopsys ARCv3 baremetal toolchains contain multilib configurations both for 32-bit and 64-bit families. arc32 target name is reserved for 32-bit ARC HS5x targets in case of non-multilib 32-bit builds. Note that libgloss libraries for ARCv3 are compatible with libgloss for ARCv1/2. Thus, Makefile.inc for libgloss uses sources from libgloss/arc directory except crtX.S files. Co-authored-by: Shahab Vahedi <list@vahedi.org> Co-authored-by: Claudiu Zissulescu <claziss@gmail.com> Co-authored-by: Bruno Mauricio <brunoasmauricio@gmail.com> Co-authored-by: Luis Silva <luis.m.silva99@hotmail.com> Signed-off-by: Yuriy Kolerov <ykolerov@synopsys.com>
2024-08-20Fix glob() functionJordi Sanfeliu1-0/+1
Fixed glob() function to return GLOB_NOMATCH if pattern does not match any existing pathname (and GLOB_NOCHECK was not set in flags).
2024-08-19newlib/libc/include/sys/tree.h: Add deprecation warningJoel Sherrill1-0/+4
2024-08-19libc/include/sys/tree.h: Re-add sys/tree.hJoel Sherrill1-0/+864
Reverts 1339af44679aee0895fe311cfad89d38cfc2b919
2024-08-15stdlib.h: define __itoa/__utoa while building newlibCorinna Vinschen1-1/+1
This avoids a `__utoa undefined' warning when building newlib for Cygwin. We still need to export the symbols for backward compatibility. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-08-15Fix POSIX guards for POSIX.1-2024 extensionsCorinna Vinschen2-3/+3
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-08-15features.h: support POSIX.1-2024Corinna Vinschen1-3/+15
TBD: Align _GNU_SOURCE, too? Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-08-15features.h: fix whitespaceCorinna Vinschen1-44/+44
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-07-30stdatomic: make atomics compatible with GCC-14Alexey Lapshin1-1/+2
https://gcc.gnu.org/pipermail/gcc-patches/2023-September/631525.html brings c_atomic and cxx_atomic definitions into GCC. This patch makes atomics type detection correct for GCC. https://github.com/freebsd/freebsd-src/commit/680f40f38343de118d5b973129683804e496faaf
2024-07-09sys/tree.h: RemovedJoel Sherrill1-864/+0
This file was from a specific older FreeBSD version. There have been multiple changes to this file with FreeBSD 14 including breaking changes to the file. Including this file as part of newlib results in not always having the correct version of sys/tree.h for any specific software. RTEMS will manage its use of this file outside of newlib.
2024-07-09libc/include/sys/resource.h: Add RUSAGE_THREADJoel Sherrill1-0/+3