mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-28 05:43:11 +00:00
Eliminate UVAR_FILE_SET_MTIME_HACK checks
This was previously limited to Linux predicated on the existence of certain headers, but Rust just exposes those functions unconditionally. So remove the check and just perform the mtime hack on Linux and Android.
This commit is contained in:
parent
70ed4806b4
commit
9747ab19d1
5 changed files with 5 additions and 29 deletions
|
@ -44,15 +44,6 @@ include(CheckCXXSymbolExists)
|
||||||
include(CheckCXXSourceCompiles)
|
include(CheckCXXSourceCompiles)
|
||||||
include(CheckTypeSize)
|
include(CheckTypeSize)
|
||||||
|
|
||||||
# workaround for lousy mtime precision on a Linux kernel
|
|
||||||
if (CMAKE_SYSTEM_NAME MATCHES "Linux|Android")
|
|
||||||
check_cxx_symbol_exists(clock_gettime time.h HAVE_CLOCK_GETTIME)
|
|
||||||
check_cxx_symbol_exists(futimens sys/stat.h HAVE_FUTIMENS)
|
|
||||||
if ((HAVE_CLOCK_GETTIME) AND (HAVE_FUTIMENS))
|
|
||||||
set(UVAR_FILE_SET_MTIME_HACK 1)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
check_cxx_symbol_exists(gettext libintl.h HAVE_GETTEXT)
|
check_cxx_symbol_exists(gettext libintl.h HAVE_GETTEXT)
|
||||||
|
|
||||||
check_type_size("wchar_t[8]" WCHAR_T_BITS LANGUAGE CXX)
|
check_type_size("wchar_t[8]" WCHAR_T_BITS LANGUAGE CXX)
|
||||||
|
|
|
@ -7,9 +7,6 @@
|
||||||
/* Define to 1 if the _nl_msg_cat_cntr symbol is exported. */
|
/* Define to 1 if the _nl_msg_cat_cntr symbol is exported. */
|
||||||
#cmakedefine HAVE__NL_MSG_CAT_CNTR 1
|
#cmakedefine HAVE__NL_MSG_CAT_CNTR 1
|
||||||
|
|
||||||
/* Define to use clock_gettime and futimens to hack around Linux mtime issue */
|
|
||||||
#cmakedefine UVAR_FILE_SET_MTIME_HACK 1
|
|
||||||
|
|
||||||
/* Define to the address where bug reports for this package should be sent. */
|
/* Define to the address where bug reports for this package should be sent. */
|
||||||
#define PACKAGE_BUGREPORT "https://github.com/fish-shell/fish-shell/issues"
|
#define PACKAGE_BUGREPORT "https://github.com/fish-shell/fish-shell/issues"
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,6 @@ use crate::fallback::fish_mkstemp_cloexec;
|
||||||
use crate::fds::AutoCloseFd;
|
use crate::fds::AutoCloseFd;
|
||||||
use crate::fds::{open_cloexec, wopen_cloexec};
|
use crate::fds::{open_cloexec, wopen_cloexec};
|
||||||
use crate::flog::{FLOG, FLOGF};
|
use crate::flog::{FLOG, FLOGF};
|
||||||
use crate::libc::UVAR_FILE_SET_MTIME_HACK;
|
|
||||||
use crate::path::path_get_config;
|
use crate::path::path_get_config;
|
||||||
use crate::path::{path_get_config_remoteness, DirRemoteness};
|
use crate::path::{path_get_config_remoteness, DirRemoteness};
|
||||||
use crate::wchar::prelude::*;
|
use crate::wchar::prelude::*;
|
||||||
|
@ -20,9 +19,7 @@ use crate::wutil::{
|
||||||
wunlink, FileId, INVALID_FILE_ID,
|
wunlink, FileId, INVALID_FILE_ID,
|
||||||
};
|
};
|
||||||
use errno::{errno, Errno};
|
use errno::{errno, Errno};
|
||||||
use libc::{
|
use libc::{EINTR, ENOTSUP, EOPNOTSUPP, LOCK_EX, O_CREAT, O_RDONLY, O_RDWR};
|
||||||
CLOCK_REALTIME, EINTR, ENOTSUP, EOPNOTSUPP, LOCK_EX, O_CREAT, O_RDONLY, O_RDWR, UTIME_OMIT,
|
|
||||||
};
|
|
||||||
use std::collections::hash_map::Entry;
|
use std::collections::hash_map::Entry;
|
||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
use std::ffi::CString;
|
use std::ffi::CString;
|
||||||
|
@ -800,10 +797,11 @@ impl EnvUniversal {
|
||||||
//
|
//
|
||||||
// It's probably worth finding a simpler solution to this. The tests ran into this, but it's
|
// It's probably worth finding a simpler solution to this. The tests ran into this, but it's
|
||||||
// unlikely to affect users.
|
// unlikely to affect users.
|
||||||
if unsafe { UVAR_FILE_SET_MTIME_HACK() } {
|
#[cfg(any(target_os = "linux", target_os = "android"))]
|
||||||
|
{
|
||||||
let mut times: [libc::timespec; 2] = unsafe { std::mem::zeroed() };
|
let mut times: [libc::timespec; 2] = unsafe { std::mem::zeroed() };
|
||||||
times[0].tv_nsec = UTIME_OMIT; // don't change ctime
|
times[0].tv_nsec = libc::UTIME_OMIT; // don't change ctime
|
||||||
if unsafe { libc::clock_gettime(CLOCK_REALTIME, &mut times[1]) } != 0 {
|
if unsafe { libc::clock_gettime(libc::CLOCK_REALTIME, &mut times[1]) } != 0 {
|
||||||
unsafe {
|
unsafe {
|
||||||
libc::futimens(private_fd.fd(), ×[0]);
|
libc::futimens(private_fd.fd(), ×[0]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,15 +64,6 @@ int C_PC_CASE_SENSITIVE() {
|
||||||
|
|
||||||
FILE* stdout_stream() { return stdout; }
|
FILE* stdout_stream() { return stdout; }
|
||||||
|
|
||||||
static const bool uvar_file_set_mtime_hack =
|
|
||||||
#ifdef UVAR_FILE_SET_MTIME_HACK
|
|
||||||
true;
|
|
||||||
#else
|
|
||||||
false;
|
|
||||||
#endif
|
|
||||||
#undef UVAR_FILE_SET_MTIME_HACK
|
|
||||||
bool UVAR_FILE_SET_MTIME_HACK() { return uvar_file_set_mtime_hack; }
|
|
||||||
|
|
||||||
int C_RLIMIT_CORE() { return RLIMIT_CORE; }
|
int C_RLIMIT_CORE() { return RLIMIT_CORE; }
|
||||||
int C_RLIMIT_DATA() { return RLIMIT_DATA; }
|
int C_RLIMIT_DATA() { return RLIMIT_DATA; }
|
||||||
int C_RLIMIT_FSIZE() { return RLIMIT_FSIZE; }
|
int C_RLIMIT_FSIZE() { return RLIMIT_FSIZE; }
|
||||||
|
|
|
@ -48,7 +48,6 @@ extern "C" {
|
||||||
len: libc::size_t,
|
len: libc::size_t,
|
||||||
) -> libc::size_t;
|
) -> libc::size_t;
|
||||||
pub fn stdout_stream() -> *mut libc::FILE;
|
pub fn stdout_stream() -> *mut libc::FILE;
|
||||||
pub fn UVAR_FILE_SET_MTIME_HACK() -> bool;
|
|
||||||
pub fn setlinebuf(stream: *mut libc::FILE);
|
pub fn setlinebuf(stream: *mut libc::FILE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue