diff options
| author | Mingming Liu <mingmingl@google.com> | 2025-09-10 15:25:31 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-09-10 15:25:31 -0700 |
| commit | 1417dafa1db9cb1b2b09438aa9f53ea5ab6e36e2 (patch) | |
| tree | 57f4b1f313c8cf74eed8819870f39c36ea263c68 /libc/src/sys/time | |
| parent | 898b813bc8a6d0276bf0f4769f5f2f64b34e632d (diff) | |
| parent | b8cefcb601ddaa18482555c4ff363c01a270c2fe (diff) | |
Merge branch 'main' into users/mingmingl-llvm/samplefdo-profile-formatusers/mingmingl-llvm/samplefdo-profile-format
Diffstat (limited to 'libc/src/sys/time')
| -rw-r--r-- | libc/src/sys/time/linux/utimes.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/libc/src/sys/time/linux/utimes.cpp b/libc/src/sys/time/linux/utimes.cpp index 9c00ce9909f2..e740190bc819 100644 --- a/libc/src/sys/time/linux/utimes.cpp +++ b/libc/src/sys/time/linux/utimes.cpp @@ -21,24 +21,21 @@ namespace LIBC_NAMESPACE_DECL { -#ifdef SYS_utimes -constexpr auto UTIMES_SYSCALL_ID = SYS_utimes; -#elif defined(SYS_utimensat) -constexpr auto UTIMES_SYSCALL_ID = SYS_utimensat; -#elif defined(SYS_utimensat_time64) -constexpr auto UTIMES_SYSCALL_ID = SYS_utimensat_time64; -#else -#error "utimes, utimensat, utimensat_time64, syscalls not available." -#endif - LLVM_LIBC_FUNCTION(int, utimes, (const char *path, const struct timeval times[2])) { int ret; #ifdef SYS_utimes // No need to define a timespec struct, use the syscall directly. - ret = LIBC_NAMESPACE::syscall_impl<int>(UTIMES_SYSCALL_ID, path, times); + ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_utimes, path, times); #elif defined(SYS_utimensat) || defined(SYS_utimensat_time64) + +#if defined(SYS_utimensat) + constexpr auto UTIMES_SYSCALL_ID = SYS_utimensat; +#elif defined(SYS_utimensat_time64) + constexpr auto UTIMES_SYSCALL_ID = SYS_utimensat_time64; +#endif + // the utimensat syscall requires a timespec struct, not timeval. struct timespec ts[2]; struct timespec *ts_ptr = nullptr; // default value if times is nullptr @@ -74,6 +71,9 @@ LLVM_LIBC_FUNCTION(int, utimes, // flags=0 means don't follow symlinks (like utimes) ret = LIBC_NAMESPACE::syscall_impl<int>(UTIMES_SYSCALL_ID, AT_FDCWD, path, ts_ptr, 0); + +#else +#error "utimes, utimensat, utimensat_time64, syscalls not available." #endif // SYS_utimensat if (ret < 0) { |
