summaryrefslogtreecommitdiff
path: root/libc/include/sys
AgeCommit message (Collapse)Author
2025-11-18[libc] Implement pkey_alloc/free/get/set/mprotect for x86_64 linux (#162362)Jackson Stogel
This patch provides definitions for `pkey_*` functions for linux x86_64. `pkey_alloc`, `pkey_free`, and `pkey_mprotect` are simple syscall wrappers. `pkey_set` and `pkey_get` modify architecture-specific registers. The logic for these live in architecture specific directories: * `libc/src/sys/mman/linux/x86_64/pkey_common.h` has a real implementation * `libc/src/sys/mman/linux/generic/pkey_common.h` contains stubs that just return `ENOSYS`.
2025-11-14Revert "[libc][test] split exit tests into two separate tests" (#168102)Schrodinger ZHU Yifan
Reverts llvm/llvm-project#166355
2025-11-14[libc][test] split exit tests into two separate tests (#166355)Shreeyash Pandey
_Exit(3) is a fairly simple syscall wrapper whereas exit(3) calls atexit-registered functions + whole lot of stuff that require support for sync primitives. Splitting the tests allows testing the former easily (especially for new port projects) --------- Signed-off-by: Shreeyash Pandey <shreeyash335@gmail.com>
2025-10-02[libc] Implement faccessat (#161065)Marcell Leleszi
#160404 - Implement POSIX function "faccessat" - Remove redundant param in facessat syscall in access implementation, faccessat syscall does not take a flags arg
2025-08-17[libc] Setup hdrgen for ioctl (#153976)Aiden Grossman
This patch adds some hdrgen yaml for ioctl(). Otherwise the function never actually ends up being available in a full build. This is the last thing that is needed to enable turning on LIBCXX_ENABLE_RANDOM_DEVICE.
2025-07-18[libc] Remove trivial .h.def files (#149466)Roland McGrath
Remove all the .h.def files that already express nothing whatsoever not already expressed in YAML. Clean up a few YAML files without materially changing any generated header output. Many more .h.def files remain that need a bit of conversion in YAML to express macro requirements and such.
2025-05-13[libc] Enable utimes function for riscv (#139181)Mikhail R. Gadelha
RV32 uses SYS_utimensat_time64 instead of SYS_utimensat but the call is the same.
2025-05-13[libc] Enable poll function for riscv (#139180)Mikhail R. Gadelha
RV32 uses SYS_ppoll_time64 instead of SYS_ppoll, but the call is the same.
2025-04-14[libc] Implement getitimer and setitimer, add proxy headers for itimerval ↵Tsz Chan
(#134773) #133983
2025-04-03[libc] Implemented utimes (Issue #133953) (#134167)Aditya Tejpaul
This pull request implements the `utimes` command in libc ([Issue #133953](https://github.com/llvm/llvm-project/issues/133953)). - [x] Add the implementation of `utimes` in `/src/sys/time`. - [x] Add tests for `utimes` in `/test/src/sys/time`. - [x] Add `utimes` to [entrypoints.txt](https://github.com/llvm/llvm-project/blob/main/libc/config/linux/x86_64/entrypoints.txt) for at least x86_64 and whatever you're building on - [x] Add `utimes` to [include/sys/time.yaml](https://github.com/llvm/llvm-project/blob/main/libc/include/sys/time.yaml)
2025-02-06[libc] implement `sys/uio/readv` (#124718)c8ef
Closes #124694. This patch adds the `sys/uio/readv` function. ref: https://pubs.opengroup.org/onlinepubs/009696699/functions/readv.html
2025-01-28[libc] clean up duplicated includes in generated headers (#124524)Alex Prabhat Bara
Fixes: #124149
2025-01-29[libc] Revise the definition of `{get, set}rlimit`. (#124701)c8ef
Closes #124633. Some parameter types in the definition of `{get, set}rlimit` currently do not match the standard. This patch resolves the issue. ref: https://man7.org/linux/man-pages/man2/getrlimit.2.html
2025-01-23[libc][NFC] Strip all training whitespace and missing newlines (#124163)Joseph Huber
2025-01-15[libc] implement unistd/getentropy (#122692)Schrodinger ZHU Yifan
Implement GNU extension getentropy. This function is used by many programs to acquire entropy without handling the loop of getrandom.
2025-01-10[libc] implement sys/uio/writev (#122233)Schrodinger ZHU Yifan
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-07[libc] Revamp hdrgen command line and build integration (#121522)Roland McGrath
This adds a new main command-line entry point for hdrgen, in the new main.py. This new interface is used for generating a header. The old ways of invoking yaml_to_classes.py for other purposes are left there for now, but `--e` is renamed to `--entry-point` for consistency with the new CLI. The YAML schema is expanded with the `header_template` key where the corresponding `.h.def` file's path is given relative to where the YAML file is found. The build integration no longer gives the `.h.def` path on the command line. Instead, the script now emits a depfile that's used by the cmake rules to track that. The output file is always explicit in the script command line rather than sometimes being derived from a directory path.
2025-01-01[libc] Move hdrgen yaml files into include/ (#121443)Roland McGrath
The .yaml files should live next to the corresponding .h.def files in libc/include/, rather than next to the implementation of the tool in libc/utils/hdrgen/. As with the .h.def files, there is no need for a yaml/ subdirectory under include/. This simpler layout is more natural for maintenance and also simplifies build integration outside the LLVM CMake build.
2024-12-05[libc] revert all process_mrelease changes (#118650)Schrodinger ZHU Yifan
Revert as its test is unstable. https://github.com/llvm/llvm-project/issues/118057
2024-11-27[libc] (reland #117503) Implement process_mrelease (#117851)Omar Hossam
This PR implements process_mrelease. A previous PR was merged #117503, but failed on merge due to an issue in the tests. Namely the failing tests were comparing against return type as opposed to errno. This is fixed in this PR.
2024-11-26Revert "[libc] Implement process_mrelease." (#117807)lntue
Reverts llvm/llvm-project#117503
2024-11-26[libc] Implement process_mrelease. (#117503)Omar Hossam
This PR addresses #110124.
2024-11-01[libc] Use relative inclusion for public headers. (#114324)lntue
We are finalizing the header inclusion policy, and for our public headers in the `libc/include` folder, they must use relative path in `"..."` when including each other. This PR does the cleanup making sure that all the public header inclusions in `libc/include` folder use relative paths. --------- Co-authored-by: Nick Desaulniers <nickdesaulniers@users.noreply.github.com>
2024-06-28[libc] remove include_file headergen usage (#96970)Michael Jones
Previously headergen had a mechanism to copy the contents of one file inot another. This wasn't ever used properly, and isn't supported by the new headergen design. We will investigate better ways to support different syscall definitions in future.
2024-04-11[libc] add remaining epoll functions, pipe (#84587)Michael Jones
The epoll_wait functions need the rest of the epoll functions (create, ctl) to be available to actually test them, as well as pipe to create a usable file descriptor. This patch adds epoll_create, epoll_create1, epoll_ctl, and pipe. These have tests, and the tests for epoll_wait, epoll_pwait, and epoll_pwait2 (currently disabled) are updated to use these newly available functions.
2024-03-25[libc] add statvfs/fstatvfs (#86169)Schrodinger ZHU Yifan
fixes #86449
2024-03-22[libc] fix up the use of angle includes in include/ (#86027)Nick Desaulniers
Performed en-masse via: $ grep -rn "#include <ll" libc/include -l | \ xargs perl -pi -e 's/#include <ll(.*)>/#include "ll$1"/' $ grep -rn "#include <__" libc/include -l | \ xargs perl -pi -e 's/#include <__(.*)>/#include "__$1"/' Link: #83463 Link: #83210
2024-02-28[libc] fix clang-tidy llvm-header-guard warnings (#82679)Nick Desaulniers
Towards the goal of getting `ninja libc-lint` back to green, fix the numerous instances of: warning: header guard does not follow preferred style [llvm-header-guard] This is because many of our header guards start with `__LLVM` rather than `LLVM`. To filter just these warnings: $ ninja -k2000 libc-lint 2>&1 | grep llvm-header-guard To automatically apply fixits: $ find libc/src libc/include libc/test -name \*.h | \ xargs -n1 -I {} clang-tidy {} -p build/compile_commands.json \ -checks='-*,llvm-header-guard' --fix --quiet Some manual cleanup is still necessary as headers that were missing header guards outright will have them inserted before the license block (we prefer them after).
2024-01-30[reland][libc] add epoll_wait functions (#79635)michaelrj-google
The epoll_wait functions are syscall wrappers that were requested by upstream users. This patch adds them, as well as their header and types. The tests are currently incomplete since they require epoll_create to properly test epoll_wait. That will be added in a followup patch since this one is already very large.
2024-01-25Revert "[libc] add epoll_wait functions" (#79534)michaelrj-google
Reverts llvm/llvm-project#79515 Some minor breakages. Will fix tomorrow.
2024-01-25[libc] add epoll_wait functions (#79515)michaelrj-google
The epoll_wait functions are syscall wrappers that were requested by upstream users. This patch adds them, as well as their header and types. The tests are currently incomplete since they require epoll_create to properly test epoll_wait. That will be added in a followup patch since this one is already very large.
2024-01-18[libc] Provide sys/queue.h (#78081)Petr Hosek
This header first appeared in 4.4BSD and is provided by a number of C libraries including Newlib. Several of our embedded projects use this header and so to make LLVM libc a drop-in replacement, we need to provide it as well. For the initial commit, we only implement singly linked variants (SLIST and STAILQ). The doubly linked variants (LIST, TAILQ and CIRCLEQ) can be implemented in the future as needed.
2023-12-05[libc] implement prctl (#74386)Schrodinger ZHU Yifan
Implement `prctl` as specified in https://man7.org/linux/man-pages/man2/prctl.2.html. This patch also includes test cases covering two simple use cases: 1. `PR_GET_NAME/PR_SET_NAME`: where userspace data is passed via arg2. 2. `PR_GET_THP_DISABLE`: where return value is passed via syscal retval.
2023-02-23[libc] Introduce sys/socket.hJeff Bailey
This adds sys/socket.h and some definitions on Linux. Reviewed By: sivachandra Differential Revision: https://reviews.llvm.org/D144415
2022-10-25[libc] Add the header sys/types.h.Siva Chandra Reddy
Reviewed By: michaelrj Differential Revision: https://reviews.llvm.org/D136642
2022-10-22[libc] Add select.h and the implementation of the select function for Linux.Siva Chandra Reddy
Reviewed By: michaelrj Differential Revision: https://reviews.llvm.org/D136375
2022-10-12[libc] add headers sys/auxv sys/prctl and sys/timeMichael Jones
These headers are uncommonly used, and from extensions, but some basic support is needed. Macros have been added where available. Reviewed By: sivachandra Differential Revision: https://reviews.llvm.org/D135731
2022-10-10[libc] add isattyMichael Jones
The isatty function uses the side effects of an ioctl call to determine if a specific file descriptor is a terminal. I chose TIOCGETD (get line discipline of terminal) because it didn't require any new structs. Reviewed By: sivachandra, lntue Differential Revision: https://reviews.llvm.org/D135618
2022-10-10Implement `getrandom` function for linux targets.Schrodinger ZHU Yifan
Reviewed By: michaelrj, sivachandra Differential Revision: https://reviews.llvm.org/D134665
2022-10-04[libc] Add a minimal implementation of the POSIX fork function.Siva Chandra Reddy
A very simple and minimal implementation of fork is added. Future changes will add more functionality to satisfy POSIX and Linux requirements. An implementation of wait and a few support macros in sys/wait.h have also been added to help with testing the fork function. Reviewed By: lntue, michaelrj Differential Revision: https://reviews.llvm.org/D135131
2022-09-23[libc] move sys/mman macros to /includeMichael Jones
Previously the mman macros were in api.td, but platform differences are easier to handle with preprocessor macros so they have been moved to include. Also I completed the list of macros (at least for what I need soon) and fixed some previously incorrect values. Reviewed By: sivachandra, lntue Differential Revision: https://reviews.llvm.org/D134491
2022-09-16[libc] Add implementation of POSIX "uname" function.Siva Chandra Reddy
Reviewed By: lntue Differential Revision: https://reviews.llvm.org/D134065
2022-09-16[libc] Add implementation of POSIX setrlimit and getrlimit functions.Siva Chandra Reddy
Reviewed By: lntue Differential Revision: https://reviews.llvm.org/D134016
2022-08-26[libc] Add Linux implementation of GNU extension function sendfile.Siva Chandra Reddy
Reviewed By: michaelrj Differential Revision: https://reviews.llvm.org/D132721
2022-08-22[libc][Obvious] Move some macros definitions to sys/stat.h.Siva Chandra Reddy
They were previously incorrectly listed in fcntl.h
2022-02-01[libc] Add implementations of POSIX mkdir, mkdirat, rmdir, unlink and unlinkat.Siva Chandra Reddy
Reviewed By: michaelrj Differential Revision: https://reviews.llvm.org/D118641
2021-11-19[libc][Obvious][NFC] A bunch of cosmetic cleanup.Siva Chandra Reddy
* Added missing header guards. * Fixed license header format in a few files. * Renamed files to more suitable names.
2020-04-08[libc][NFC] Make all top of file comments consistent.Paula Toth
Summary: Made all header files consistent based of this documentation: https://llvm.org/docs/CodingStandards.html#file-headers. And did the same for all source files top of file comments. Reviewers: sivachandra, abrachet Reviewed By: sivachandra, abrachet Subscribers: MaskRay, tschuett, libc-commits Tags: #libc-project Differential Revision: https://reviews.llvm.org/D77533
2019-12-23Add implementations of POSIX mmap and munmap functions.Siva Chandra Reddy
Summary: A set of of linux x86_64 internal syscall helpers have also been added. This change does not try to be perfect with respect to OS and machine abstractions. A TODO note has been added at places where such abstractions would help and make the arrangement scalable and cleaner. Addressing the TODOs and building such abstractions is not in the scope of this change. It is hoped that follow up changes cleaning up the problem areas and addressing the TODOs will better illustrate the need for the changes. This change also does not try to imitate mmap and munmap implementations of other libcs. The idea here is to put in the bare minimum required to obtain a working mmap and munmap, and then add the rest of the functionality on an as needed basis. Reviewers: abrachet, phosek, stanshebs, theraven Subscribers: mgorny, MaskRay, jfb, libc-commits Tags: #libc-project Differential Revision: https://reviews.llvm.org/D71634