summaryrefslogtreecommitdiff
path: root/libc/src/stdio/fopencookie.cpp
AgeCommit message (Collapse)Author
2025-06-11[libc] Move libc_errno.h to libc/src/__support and make ↵lntue
LIBC_ERRNO_MODE_SYSTEM to be header-only. (#143187) This is the first step in preparation for: https://discourse.llvm.org/t/rfc-make-clang-builtin-math-functions-constexpr-with-llvm-libc-to-support-c-23-constexpr-math-functions/86450
2024-07-20[libc] Added static casts to fix implicit conversion warnings in 32-bit systemsMikhail R. Gadelha
This patch fixes: randomness.h and getauxval.cpp were passing ssize_t as size_t kernel_statx.h was assigning an uint64_t to uintptr_t fopencookie.cpp was trying to create a FileIOResult using ssize_t but the constructor expected a size_t thread.h was trying to call free_stack (which takes a size_t) with an unsigned long long. free_stack does the calculations using uintptr_t, so I changed the passing values to size_t
2024-07-12[libc] Migrate to using LIBC_NAMESPACE_DECL for namespace declaration (#98597)Petr Hosek
This is a part of #97655.
2024-07-12Revert "[libc] Migrate to using LIBC_NAMESPACE_DECL for namespace ↵Mehdi Amini
declaration" (#98593) Reverts llvm/llvm-project#98075 bots are broken
2024-07-11[libc] Migrate to using LIBC_NAMESPACE_DECL for namespace declaration (#98075)Petr Hosek
This is a part of #97655.
2024-07-11Reland: [libc] Move off_t and stdio macros to proxy hdrs (#98384)Michael Jones
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-09Revert "[libc] Move off_t and stdio macros to proxy hdrs" (#98242)Michael Jones
Reverts llvm/llvm-project#98215 Breaks linux bots
2024-07-09[libc] Move off_t and stdio macros to proxy hdrs (#98215)Michael Jones
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-08[libc][NFC] Adjust use of off_t internally (#68269)Mikhail R. Gadelha
This patch includes changes related to the use of off_t in libc, targeted at 32-bit systems: in several places, the offset is used either as a long or an off_t (64-bit signed int), but in 32-bit systems a long type is only 32 bits long. Fix a warning in mmap where a long offset is expected, but we were passing an off_t. A static_cast and a comment were added to explain that we know we are ignoring the upper 32-bit of the off_t in 32-bit systems. The code in pread and pwrite was slightly improved to remove a #ifdef LIBC_TARGET_ARCH_IS_RISCV32; we are using an if constexpr now. The Linux file operations were changed to use off_t instead of a long where applicable. No changes were made to the standard API, e.g., ftell returns the offset as an int so we added a static_cast and a comment explaining that this will cause a loss of integer precision in 32-bit systems.
2023-09-26[libc] Mass replace enclosing namespace (#67032)Guillaume Chatelet
This is step 4 of https://discourse.llvm.org/t/rfc-customizable-namespace-to-allow-testing-the-libc-when-the-system-libc-is-also-llvms-libc/73079
2023-06-21[libc] Make close function of the internal File class cleanup the file object.Siva Chandra Reddy
Before this change, a separate static method named cleanup was used to cleanup the file. Instead, now the close method cleans up the full file object using the platform's close function. Reviewed By: lntue Differential Revision: https://reviews.llvm.org/D153377
2023-06-19[libc] Remove the requirement of a platform-flush operation in File abstraction.Siva Chandra Reddy
The libc flush operation is not supposed to trigger a platform level flush operation. See "Notes" on this Linux man page: https://man7.org/linux/man-pages/man3/fflush.3.html Reviewed By: michaelrj Differential Revision: https://reviews.llvm.org/D153182
2023-03-03[libc] move stdlib and stdio to new errno patternMichael Jones
Fixes https://github.com/llvm/llvm-project/issues/61071 Reviewed By: sivachandra Differential Revision: https://reviews.llvm.org/D145191
2022-12-22[libc][NFC] Use operator delete to cleanup a File object.Siva Chandra Reddy
The File API has been refactored to allow cleanup using operator delete. Reviewed By: lntue Differential Revision: https://reviews.llvm.org/D140574
2022-12-22[libc] Handle allocation failures gracefully in FILE related API.Siva Chandra Reddy
Few uses of free have not yet been replaced by the custom operator delete yet. They will be done in a follow up patch. Reviewed By: lntue, michaelrj Differential Revision: https://reviews.llvm.org/D140526
2022-12-12[libc] move errno out of file internalsMichael Jones
Now errno is only set by the terminal entrypoints, and not the internal implementations. This patch is part of the larger effort to not set errno in libc internal code: https://github.com/llvm/llvm-project/issues/59278 Reviewed By: sivachandra Differential Revision: https://reviews.llvm.org/D139576
2022-11-07[libc] Add implementations of ftell.Siva Chandra Reddy
Reviewed By: michaelrj, lntue Differential Revision: https://reviews.llvm.org/D137395
2022-08-04[libc][NFC] Add a few compiler warning flags.Siva Chandra Reddy
A bunch of cleanup to supress the new warnings is also done. Reviewed By: abrachet Differential Revision: https://reviews.llvm.org/D130723
2022-04-22[libc] Add the implementation of the GNU extension function fopencookie.Siva Chandra Reddy
Reviewed By: lntue, michaelrj Differential Revision: https://reviews.llvm.org/D124141