Skip to content

Commit 481c8e9

Browse files
committed
Assume that we have utime() and <utime.h>.
These are required by POSIX since SUSv2, and no live platforms fail to provide them. On Windows, utime() exists and we bring our own <utime.h>, so we're good there too. So remove the configure probes and ad-hoc substitute code. We don't need to check for utimes() anymore either, since that was only used as a substitute. In passing, make the Windows build include <sys/utime.h> only where we need it, not everywhere. This is part of a series of commits to get rid of no-longer-relevant configure checks and dead src/port/ code. I'm committing them separately to make it easier to back out individual changes if they prove less portable than I expect. Discussion: https://postgr.es/m/15379.1582221614@sss.pgh.pa.us
1 parent f88a058 commit 481c8e9

File tree

8 files changed

+8
-59
lines changed

8 files changed

+8
-59
lines changed

configure

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12762,7 +12762,7 @@ $as_echo "#define HAVE_STDBOOL_H 1" >>confdefs.h
1276212762
fi
1276312763

1276412764

12765-
for ac_header in atomic.h copyfile.h execinfo.h getopt.h ifaddrs.h langinfo.h mbarrier.h poll.h sys/epoll.h sys/event.h sys/ipc.h sys/prctl.h sys/procctl.h sys/pstat.h sys/resource.h sys/select.h sys/sem.h sys/shm.h sys/sockio.h sys/tas.h sys/un.h termios.h ucred.h utime.h wchar.h wctype.h
12765+
for ac_header in atomic.h copyfile.h execinfo.h getopt.h ifaddrs.h langinfo.h mbarrier.h poll.h sys/epoll.h sys/event.h sys/ipc.h sys/prctl.h sys/procctl.h sys/pstat.h sys/resource.h sys/select.h sys/sem.h sys/shm.h sys/sockio.h sys/tas.h sys/un.h termios.h ucred.h wchar.h wctype.h
1276612766
do :
1276712767
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
1276812768
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
@@ -14925,7 +14925,7 @@ fi
1492514925
LIBS_including_readline="$LIBS"
1492614926
LIBS=`echo "$LIBS" | sed -e 's/-ledit//g' -e 's/-lreadline//g'`
1492714927

14928-
for ac_func in backtrace_symbols clock_gettime copyfile fdatasync getifaddrs getpeerucred getrlimit kqueue mbstowcs_l memset_s poll posix_fallocate ppoll pstat pthread_is_threaded_np readlink setproctitle setproctitle_fast setsid shm_open strchrnul strsignal symlink sync_file_range uselocale utime utimes wcstombs_l
14928+
for ac_func in backtrace_symbols clock_gettime copyfile fdatasync getifaddrs getpeerucred getrlimit kqueue mbstowcs_l memset_s poll posix_fallocate ppoll pstat pthread_is_threaded_np readlink setproctitle setproctitle_fast setsid shm_open strchrnul strsignal symlink sync_file_range uselocale wcstombs_l
1492914929
do :
1493014930
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
1493114931
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"

configure.in

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1300,7 +1300,6 @@ AC_CHECK_HEADERS(m4_normalize([
13001300
sys/un.h
13011301
termios.h
13021302
ucred.h
1303-
utime.h
13041303
wchar.h
13051304
wctype.h
13061305
]))
@@ -1642,8 +1641,6 @@ AC_CHECK_FUNCS(m4_normalize([
16421641
symlink
16431642
sync_file_range
16441643
uselocale
1645-
utime
1646-
utimes
16471644
wcstombs_l
16481645
]))
16491646

src/backend/libpq/pqcomm.c

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,7 @@
8181
#ifdef HAVE_NETINET_TCP_H
8282
#include <netinet/tcp.h>
8383
#endif
84-
#ifdef HAVE_UTIME_H
8584
#include <utime.h>
86-
#endif
8785
#ifdef _MSC_VER /* mstcpip.h is missing on mingw */
8886
#include <mstcpip.h>
8987
#endif
@@ -866,20 +864,8 @@ TouchSocketFiles(void)
866864
{
867865
char *sock_path = (char *) lfirst(l);
868866

869-
/*
870-
* utime() is POSIX standard, utimes() is a common alternative. If we
871-
* have neither, there's no way to affect the mod or access time of
872-
* the socket :-(
873-
*
874-
* In either path, we ignore errors; there's no point in complaining.
875-
*/
876-
#ifdef HAVE_UTIME
877-
utime(sock_path, NULL);
878-
#else /* !HAVE_UTIME */
879-
#ifdef HAVE_UTIMES
880-
utimes(sock_path, NULL);
881-
#endif /* HAVE_UTIMES */
882-
#endif /* HAVE_UTIME */
867+
/* Ignore errors; there's no point in complaining */
868+
(void) utime(sock_path, NULL);
883869
}
884870
}
885871

src/backend/utils/init/miscinit.c

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@
2626
#include <pwd.h>
2727
#include <netinet/in.h>
2828
#include <arpa/inet.h>
29-
#ifdef HAVE_UTIME_H
3029
#include <utime.h>
31-
#endif
3230

3331
#include "access/htup_details.h"
3432
#include "catalog/pg_authid.h"
@@ -1213,29 +1211,8 @@ TouchSocketLockFiles(void)
12131211
if (strcmp(socketLockFile, DIRECTORY_LOCK_FILE) == 0)
12141212
continue;
12151213

1216-
/*
1217-
* utime() is POSIX standard, utimes() is a common alternative; if we
1218-
* have neither, fall back to actually reading the file (which only
1219-
* sets the access time not mod time, but that should be enough in
1220-
* most cases). In all paths, we ignore errors.
1221-
*/
1222-
#ifdef HAVE_UTIME
1223-
utime(socketLockFile, NULL);
1224-
#else /* !HAVE_UTIME */
1225-
#ifdef HAVE_UTIMES
1226-
utimes(socketLockFile, NULL);
1227-
#else /* !HAVE_UTIMES */
1228-
int fd;
1229-
char buffer[1];
1230-
1231-
fd = open(socketLockFile, O_RDONLY | PG_BINARY, 0);
1232-
if (fd >= 0)
1233-
{
1234-
read(fd, buffer, sizeof(buffer));
1235-
close(fd);
1236-
}
1237-
#endif /* HAVE_UTIMES */
1238-
#endif /* HAVE_UTIME */
1214+
/* we just ignore any error here */
1215+
(void) utime(socketLockFile, NULL);
12391216
}
12401217
}
12411218

src/include/pg_config.h.in

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -662,15 +662,6 @@
662662
/* Define to 1 if you have the `uselocale' function. */
663663
#undef HAVE_USELOCALE
664664

665-
/* Define to 1 if you have the `utime' function. */
666-
#undef HAVE_UTIME
667-
668-
/* Define to 1 if you have the `utimes' function. */
669-
#undef HAVE_UTIMES
670-
671-
/* Define to 1 if you have the <utime.h> header file. */
672-
#undef HAVE_UTIME_H
673-
674665
/* Define to 1 if you have BSD UUID support. */
675666
#undef HAVE_UUID_BSD
676667

src/include/port/win32_msvc/utime.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
/* src/include/port/win32_msvc/utime.h */
2+
3+
#include <sys/utime.h> /* for non-unicode version */

src/include/port/win32_port.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@
5050
#include <process.h>
5151
#include <signal.h>
5252
#include <direct.h>
53-
#include <sys/utime.h> /* for non-unicode version */
5453
#undef near
5554
#include <sys/stat.h> /* needed before sys/stat hacking below */
5655

src/tools/msvc/Solution.pm

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -390,9 +390,6 @@ sub GenerateFiles
390390
HAVE_UNIX_SOCKETS => undef,
391391
HAVE_UNSETENV => undef,
392392
HAVE_USELOCALE => undef,
393-
HAVE_UTIME => 1,
394-
HAVE_UTIMES => undef,
395-
HAVE_UTIME_H => 1,
396393
HAVE_UUID_BSD => undef,
397394
HAVE_UUID_E2FS => undef,
398395
HAVE_UUID_OSSP => undef,

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy