[PATCH 3/3] compat/posix: drop legacy <utime.h> header and shims
From: Alexey Samsonov via GitGitGadget <hidden>
Date: 2026-08-21 14:23:29
Subsystem:
the rest · Maintainer:
Linus Torvalds
From: Alexey Samsonov <redacted> With all callers across the codebase now converted to utimensat(2), we no longer need to include the legacy <utime.h> header in `compat/posix.h`. Remove `#include <utime.h>` from `compat/posix.h` and test fixtures, remove `mingw_utime()` from `compat/mingw.c`, and delete the legacy header shims in `compat/vcbuild/include/`. Signed-off-by: Alexey Samsonov <redacted> --- compat/mingw-posix.h | 2 -- compat/mingw.c | 16 -------------- compat/posix.h | 1 - compat/vcbuild/include/sys/utime.h | 34 ------------------------------ compat/vcbuild/include/utime.h | 1 - t/helper/test-chmtime.c | 1 - t/t4051/includes.c | 1 - 7 files changed, 56 deletions(-) delete mode 100644 compat/vcbuild/include/sys/utime.h delete mode 100644 compat/vcbuild/include/utime.h
diff --git a/compat/mingw-posix.h b/compat/mingw-posix.h
index aab91d76db..286ca24002 100644
--- a/compat/mingw-posix.h
+++ b/compat/mingw-posix.h@@ -384,8 +384,6 @@ int mingw_fstat(int fd, struct stat *buf); #define lstat mingw_lstat -int mingw_utime(const char *file_name, const struct utimbuf *times); -#define utime mingw_utime int mingw_utimensat(int fd, const char *path, const struct timespec times[2], int flag); #define utimensat mingw_utimensat size_t mingw_strftime(char *s, size_t max,
diff --git a/compat/mingw.c b/compat/mingw.c
index d09a976191..e2ec44fdd2 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c@@ -1480,22 +1480,6 @@ revert_attrs: return rc; } -int mingw_utime(const char *file_name, const struct utimbuf *times) -{ - struct timespec ts[2]; - struct timespec *tsp = NULL; - - if (times) { - ts[0].tv_sec = times->actime; - ts[0].tv_nsec = 0; - ts[1].tv_sec = times->modtime; - ts[1].tv_nsec = 0; - tsp = ts; - } - - return mingw_utimensat(AT_FDCWD, file_name, tsp, 0); -} - #undef strftime size_t mingw_strftime(char *s, size_t max, const char *format, const struct tm *tm)
diff --git a/compat/posix.h b/compat/posix.h
index 3cac1751aa..435ed90f56 100644
--- a/compat/posix.h
+++ b/compat/posix.h@@ -123,7 +123,6 @@ #include <signal.h> #include <assert.h> #include <regex.h> -#include <utime.h> #include <syslog.h> #if !defined(NO_POLL_H) #include <poll.h>
diff --git a/compat/vcbuild/include/sys/utime.h b/compat/vcbuild/include/sys/utime.h
deleted file mode 100644
index 582589c70a..0000000000
--- a/compat/vcbuild/include/sys/utime.h
+++ /dev/null@@ -1,34 +0,0 @@ -#ifndef _UTIME_H_ -#define _UTIME_H_ -/* - * UTIME.H - * This file has no copyright assigned and is placed in the Public Domain. - * This file is a part of the mingw-runtime package. - * - * The mingw-runtime package and its code is distributed in the hope that it - * will be useful but WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESSED OR - * IMPLIED ARE HEREBY DISCLAIMED. This includes but is not limited to - * warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * You are free to use this package and its code without limitation. - */ - -/* - * Structure used by _utime function. - */ -struct _utimbuf -{ - time_t actime; /* Access time */ - time_t modtime; /* Modification time */ -}; - -#ifndef _NO_OLDNAMES -/* NOTE: Must be the same as _utimbuf above. */ -struct utimbuf -{ - time_t actime; - time_t modtime; -}; -#endif /* Not _NO_OLDNAMES */ - -#endif
diff --git a/compat/vcbuild/include/utime.h b/compat/vcbuild/include/utime.h
deleted file mode 100644
index 8285f38fde..0000000000
--- a/compat/vcbuild/include/utime.h
+++ /dev/null@@ -1 +0,0 @@ -#include <sys/utime.h>
diff --git a/t/helper/test-chmtime.c b/t/helper/test-chmtime.c
index a9e6eb78b8..295f55cf47 100644
--- a/t/helper/test-chmtime.c
+++ b/t/helper/test-chmtime.c@@ -38,7 +38,6 @@ */ #include "test-tool.h" #include "git-compat-util.h" -#include <utime.h> static const char usage_str[] = "(-v|--verbose|-g|--get) (+|=|=+|=-|-)<seconds> <file>...";
diff --git a/t/t4051/includes.c b/t/t4051/includes.c
index efc68f8bf6..4861f6657b 100644
--- a/t/t4051/includes.c
+++ b/t/t4051/includes.c@@ -15,6 +15,5 @@ #include <signal.h> #include <assert.h> #include <regex.h> -#include <utime.h> #include <syslog.h> #include <End.h>
--
gitgitgadget