54 Commits

Author SHA1 Message Date
Aiden Grossman
605f652cba
[libc] Add struct_sched_param proxy header (#151722)
This enables cleaning up the remaining sched.h includes littered around
the code base.
2025-08-01 11:34:06 -07:00
Uzair Nawaz
a1aba84c2b
[libc] Reland #148948 "Implement barriers for pthreads" (#151021)
Fixed build dependencies for pthread_barrier_t (add __barrier_type to
cmake dependencies)
2025-07-29 16:39:40 +00:00
Uzair Nawaz
a4a0832899
Revert "[libc] Implement barriers for pthreads" (#151014)
Reverts llvm/llvm-project#148948
2025-07-28 11:37:23 -07:00
Uzair Nawaz
7ca23754c4
[libc] Implement barriers for pthreads (#148948)
Implemented barrier synchronization for pthreads
- Uses condition variables internally for platform independence
(platform-specific work is handled by the condition variable
implementation)
- Does NOT currently handle barrierattr pshared, this is a goal for a
future patch
2025-07-28 11:22:38 -07:00
William Huynh
becde6d62e
[libc] Fix issue with sigjmp_buf.h not being found (#150439)
When trying to use <setjmp.h>, it will try to include
llvm-libc-types/sigjmp_buf.h due to the way that headergen works. This
commit creates a dummy file, as the real implementation is found in
llvm-libc-types/jmp_buf.h.
2025-07-24 19:50:50 +01:00
lntue
66603dd1f1
[libc][NFC] Add stdint.h proxy header to fix dependency issue with <stdint.h> includes. (#150303)
https://github.com/llvm/llvm-project/issues/149993
2025-07-23 20:19:52 -04:00
lntue
023566ab38
[libc] Add missing full build dependency for mbstate. (#150030) 2025-07-22 10:39:03 -04:00
sribee8
4c97a91dc0
[libc] Added closing quote (#145101)
Error message was missing a closing quote, added it.

Co-authored-by: Sriya Pratipati <sriyap@google.com>
2025-06-20 21:00:56 +00:00
sribee8
d078ce7c98
[libc] mbrtowc implementation (#144760)
implemented the internal and public mbrtowc as well as tests for the
public function.

---------

Co-authored-by: Sriya Pratipati <sriyap@google.com>
2025-06-20 20:00:59 +00:00
Uzair Nawaz
38daa6d4ef
[libc] build fix: always use our char8_t headers even in overlay mode (#144433)
Build fix caused by certain platforms not providing char8_t when
expected
Temporary fix to just always use our own definition, even in overlay
mode.
2025-06-16 21:28:51 +00:00
Uzair Nawaz
6311f039b2
[libc] Build fixes for widechar characterconverter (#143805)
Build fixes for wchar CharacterConverter class
2025-06-12 17:34:45 +00:00
Uzair Nawaz
52583b3ed7
[libc] Character converter skeleton class (#143619)
Made CharacterConverter class skeleton
2025-06-11 13:11:31 -07:00
lntue
79e8e27bfe
[libc] Add proxy header for ACTION type. (#139796)
https://github.com/llvm/llvm-project/issues/139561
2025-05-13 17:50:02 -04:00
lntue
e581f1cc9a
[libc] Add proxy header for ENTRY type. (#139746)
https://github.com/llvm/llvm-project/issues/139561
2025-05-13 14:07:21 -04:00
Tsz Chan
f5c5f9f926
[libc] Implement getitimer and setitimer, add proxy headers for itimerval (#134773)
#133983
2025-04-14 13:39:42 -07:00
Krishna Pandey
bda87e0a09
[libc][sched] Implement CPU_ZERO, CPU_ISSET, CPU_SET macros (#131524)
This PR implements the following macros for `sched.h`:
- `CPU_ZERO`
- `CPU_ISSET`
- `CPU_SET`

Fixes #124642

---------

Signed-off-by: krishna2803 <kpandey81930@gmail.com>
2025-03-19 13:44:41 -04:00
Roland McGrath
123c0040d4
[libc] Define (stub) dl_iterate_phdr (#131436)
This fleshes out the <link.h> a little more, including the
`struct dl_phdr_info` type and declaring the dl_iterate_phdr
function.  There is only a no-op implementation without tests, as
for the existing dlfcn functions.
2025-03-18 11:38:33 -07:00
Nick Desaulniers
e566313a1f
[libc][signal] clean up usage of sighandler_t (#125745)
`man 3 signal`'s declaration has a face _only a mother could love_.

sighandler_t and __sighandler_t are not defined in the C standard, or POSIX.

They are helpful typedefs provided by glibc and the Linux kernel UAPI headers
respectively since working with function pointers' syntax can be painful. But
we should not rely on them; in C++ we have `auto*` and `using` statements.

Remove the proxy header, and only include a typedef for sighandler_t when
targeting Linux, for compatibility with glibc.

Fixes: #125598
2025-02-07 10:43:56 -08:00
Nick Desaulniers
8e35b3d29b
[libc][POSIX][poll.h] implement poll (#125118)
Simple syscall.

Fixes: #124647
2025-02-05 13:24:39 -08:00
Schrodinger ZHU Yifan
73dd730fb9
[libc] implement sys/uio/writev (#122233)
implement sys/uio/writev according to POSIX standard. This vectorized IO
API is needed by many logging libraries to achieve atomic logging
multiple strings.
2025-01-10 12:49:00 +08:00
Michael Jones
f9c2377fb6
[libc][NFC] Cleanup time.h (#122027)
While working on strftime I noticed some constants were being defined in
unexpected places. One thing led to another, and I ended up doing a
major cleanup of the time functions.

What's included:
All uses of <time.h> in /src and /test removed (except for LibcTest.cpp)
The various time constants have been moved to time_constants.h, and the
`time_constants` namespace.
struct tm gets its own type indirection header now.
2025-01-08 12:28:50 -08:00
Tristan Ross
7477b61b24
[libc] Add unistd overlay (#119312)
Reverts the revert #119295 of #118882 by expanding #118882 with
additional fixes which made CI unhappy.
2024-12-17 10:40:22 -08:00
Joseph Huber
bd40421ad9
[libc] Stop installing sys/types.h when not requested (#119765)
Summary:
This is installed unconditionally because of the dependency in the
`hdr/` directory. Remove this so it's only used on the systems that need
it.
2024-12-12 15:39:10 -06:00
lntue
44c645fcc9
[libc] Fix overlay mode inclusion for fcntl.h header. (#119159) 2024-12-08 22:14:32 -05:00
Schrodinger ZHU Yifan
e6cf5d2863
Reapply "[libc][windows] start time API implementation (#117775)" (#118886) 2024-12-05 18:21:03 -05:00
Joseph Huber
9fd052a122 Revert "[libc][windows] start time API implementation (#117775)"
This reverts commit 0adff0af20c7d9bae8bd8bdf402506c10369ead1.

Breaks the GPU build
2024-12-05 14:43:06 -06:00
Schrodinger ZHU Yifan
0adff0af20
[libc][windows] start time API implementation (#117775)
Add a `clock_gettime` emulation layer and use it to implement the `time`
entrypoint.

For windows, the monotonic clock is emulated using `QPC`.
The realtime clock is emulated using `GetSystemTimePreciseAsFileTime`.
2024-12-05 14:08:27 -05:00
Job Henandez Lara
915b910d80
[libc] Fix typos in proxy type headers (#114717) 2024-11-03 14:12:27 -08:00
Job Henandez Lara
33bdb53d86
[libc] Remove the #include <stdlib.h> header (#114453) 2024-11-01 21:49:57 -07:00
Michael Jones
0b2b87bf34
[libc] Fix path to fcntl_overlay in cmake (#114464)
The proxy header definition for mode_t was using an incorrect form for
its dependency on fcntl_overlay. The relative paths for dependencies can
only go down, not up so "../" doesn't work. This patch fixes it to be
absolute.
2024-10-31 14:03:02 -07:00
Job Henandez Lara
abc49cc194
[libc] remove #include <fcntl.h> and add proxy or type (#113836) 2024-10-28 13:29:16 -07:00
lntue
c63112a911
[libc][stdio] Use proxy headers of stdio.h in src and test folders. (#110067)
https://github.com/llvm/llvm-project/issues/60481
2024-10-01 11:48:07 -04:00
lntue
95d4c97a20
[libc][wchar] Move wchar's types to proxy headers. (#109334)
Also protect against extern inline function definitions added when
building with gcc: https://github.com/llvm/llvm-project/issues/60481.
2024-09-19 22:23:51 -04:00
Michael Jones
f6b4c34d4f
[libc] Add functions to send/recv messages (#106467)
This patch adds the necessary functions to send and receive messages
over a socket. Those functions are: recv, recvfrom, recvmsg, send,
sendto, sendmsg, and socketpair for testing.
2024-09-19 14:43:00 -07:00
wldfngrs
3d7af093f3
[libc] Add proxy header for the jmp_buf type (#107712)
Added proxy header for the jmp_buf type and changed all use instances
from __jmp_buf * to the typedef alias jmp_buf , fixed the link to LLVM
in stack_t.h description
2024-09-08 20:55:00 -04:00
wldfngrs
056a1676cb
[libc] Add proxy header for the stack_t type (#107559)
added proxy header for the stack_t type and modified the corresponding
CMakeLists.txt files
2024-09-07 10:01:33 -04:00
lntue
876b0e60fe
[libc] Fix signal's dependency on the proxy header sighandler_t. (#107605) 2024-09-06 16:23:53 -04:00
wldfngrs
73514f6831
[libc] Add proxy header for __sighandler_t type (#107354)
Added proxy headers for __sighandler_t type, modified the corresponding
CMakeLists.txt files and test files
2024-09-05 18:04:35 -04:00
Joseph Huber
78d8ab2ab9
[libc] Initial support for 'locale.h' in the LLVM libc (#102689)
Summary:
This patch adds the macros and entrypoints associated with the
`locale.h` entrypoints.  These are mostly stubs, as we (for now and the
forseeable future) only expect to support the C and maybe C.UTF-8
locales in the LLVM libc.
2024-08-22 12:58:46 -05:00
Joseph Huber
2f4232db0b Revert " [libc] Add ctype.h locale variants (#102711)"
This reverts commit 8f005f8306dc52577b3b9482d271fb463f0152a5.
2024-08-22 12:45:16 -05:00
Joseph Huber
8f005f8306
[libc] Add ctype.h locale variants (#102711)
Summary:
This patch adds all the libc ctype variants. These ignore the locale
ingormation completely, so they're pretty much just stubs. Because these
use locale information, which is system scope, we do not enable building
them outisde of full build mode.
2024-08-22 12:41:20 -05:00
Michael Jones
5aed6d67e3
Reland: [libc] Move off_t and stdio macros to proxy hdrs (#98384)
reland of https://github.com/llvm/llvm-project/pull/98215

Additionally adds proxy headers for FILE and the fopencookie types

The arm32 build has been failing due to redefinitions of the off_t type.
This patch fixes this by moving off_t to a proper proxy header. To do
this, it also moves stdio macros to a proxy header to hopefully avoid
including this proxy header alongside this public stdio.h.
2024-07-11 11:09:51 -07:00
Michael Jones
3a744283f4
Revert "[libc] Move off_t and stdio macros to proxy hdrs" (#98242)
Reverts llvm/llvm-project#98215

Breaks linux bots
2024-07-09 16:22:38 -07:00
Michael Jones
240ec5a375
[libc] Move off_t and stdio macros to proxy hdrs (#98215)
The arm32 build has been failing due to redefinitions of the off_t type.
This patch fixes this by moving off_t to a proper proxy header. To do
this, it also moves stdio macros to a proxy header to hopefully avoid
including this proxy header alongside this public stdio.h.
2024-07-09 16:17:02 -07:00
Schrodinger ZHU Yifan
133492fe18
[libc] add proxy header for struct_sigaction (#96224) 2024-06-26 12:46:15 -07:00
aaryanshukla
39d38d66ec
[libc] at_quick_exit function implemented (#94317)
- added at_quick_exit function 
- used helper file exit_handler which reuses code from atexit
- atexit now calls helper functions from exit_handler
- test cases and dependencies are added

---------

Co-authored-by: Aaryan Shukla <aaryanshukla@google.com>
2024-06-06 17:21:44 +00:00
Schrodinger ZHU Yifan
142afde0eb
[libc] rework mutex (#92168) 2024-05-31 18:57:18 -07:00
Schrodinger ZHU Yifan
d8e73752a5
Reland "[libc][NFC] adjust time related implementations"" (#91687)
Reverts llvm/llvm-project#91657 and Relands #91485
2024-05-10 15:32:04 -04:00
Schrodinger ZHU Yifan
5a0e0b659f
Revert "[libc][NFC] adjust time related implementations" (#91657)
Reverts llvm/llvm-project#91485. It breaks GPU and fuchisa.
2024-05-09 17:27:59 -04:00
Schrodinger ZHU Yifan
8ac928fea8
[libc][NFC] adjust time related implementations (#91485) 2024-05-09 16:34:45 -04:00