mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-29 13:52:17 +00:00
Detect stat's structure
This commit is contained in:
parent
69d1494873
commit
eb11fac629
@ -86,9 +86,20 @@ IF (NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
|||||||
OPTION( USE_OPENSSL "Link with and use openssl library" ON )
|
OPTION( USE_OPENSSL "Link with and use openssl library" ON )
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
CHECK_STRUCT_HAS_MEMBER("struct stat" st_mtim.tv_nsec sys/stat.h
|
CHECK_STRUCT_HAS_MEMBER ("struct stat" st_atim "sys/types.h;sys/stat.h"
|
||||||
HAVE_STRUCT_STAT_NSEC LANGUAGE C)
|
HAVE_STRUCT_STAT_ST_ATIM LANGUAGE C)
|
||||||
IF(HAVE_STRUCT_STAT_NSEC OR WIN32)
|
CHECK_STRUCT_HAS_MEMBER ("struct stat" st_atimespec "sys/types.h;sys/stat.h"
|
||||||
|
HAVE_STRUCT_STAT_ST_ATIMESPEC LANGUAGE C)
|
||||||
|
|
||||||
|
IF (HAVE_STRUCT_STAT_ST_ATIM)
|
||||||
|
CHECK_STRUCT_HAS_MEMBER("struct stat" st_mtim.tv_nsec sys/stat.h
|
||||||
|
HAVE_STRUCT_STAT_NSEC LANGUAGE C)
|
||||||
|
ELSEIF (HAVE_STRUCT_STAT_ST_ATIMESPEC)
|
||||||
|
CHECK_STRUCT_HAS_MEMBER("struct stat" st_mtimespec.tv_nsec sys/stat.h
|
||||||
|
HAVE_STRUCT_STAT_NSEC LANGUAGE C)
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
IF (HAVE_STRUCT_STAT_NSEC OR WIN32)
|
||||||
OPTION( USE_NSEC "Care about sub-second file mtimes and ctimes" OFF )
|
OPTION( USE_NSEC "Care about sub-second file mtimes and ctimes" OFF )
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
@ -527,6 +538,10 @@ IF (USE_NSEC)
|
|||||||
ADD_DEFINITIONS(-DGIT_USE_NSEC)
|
ADD_DEFINITIONS(-DGIT_USE_NSEC)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
|
IF (HAVE_STRUCT_STAT_ST_ATIMESPEC)
|
||||||
|
ADD_DEFINITIONS(-DGIT_USE_STAT_ATIMESPEC)
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
ADD_DEFINITIONS(-D_FILE_OFFSET_BITS=64)
|
ADD_DEFINITIONS(-D_FILE_OFFSET_BITS=64)
|
||||||
|
|
||||||
# Collect sourcefiles
|
# Collect sourcefiles
|
||||||
|
@ -13,6 +13,12 @@
|
|||||||
#include "win32/findfile.h"
|
#include "win32/findfile.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef GIT_USE_STAT_ATIMESPEC
|
||||||
|
#define st_atim st_atimespec
|
||||||
|
#define st_ctim st_ctimespec
|
||||||
|
#define st_mtim st_mtimespec
|
||||||
|
#endif
|
||||||
|
|
||||||
GIT__USE_STRMAP
|
GIT__USE_STRMAP
|
||||||
|
|
||||||
int git_futils_mkpath2file(const char *file_path, const mode_t mode)
|
int git_futils_mkpath2file(const char *file_path, const mode_t mode)
|
||||||
@ -1034,11 +1040,7 @@ int git_futils_filestamp_check(
|
|||||||
git_futils_filestamp *stamp, const char *path)
|
git_futils_filestamp *stamp, const char *path)
|
||||||
{
|
{
|
||||||
struct stat st;
|
struct stat st;
|
||||||
#if defined(__APPLE__)
|
|
||||||
const struct timespec *statmtime = &st.st_mtimespec;
|
|
||||||
#else
|
|
||||||
const struct timespec *statmtime = &st.st_mtim;
|
const struct timespec *statmtime = &st.st_mtim;
|
||||||
#endif
|
|
||||||
|
|
||||||
/* if the stamp is NULL, then always reload */
|
/* if the stamp is NULL, then always reload */
|
||||||
if (stamp == NULL)
|
if (stamp == NULL)
|
||||||
@ -1080,11 +1082,7 @@ void git_futils_filestamp_set(
|
|||||||
void git_futils_filestamp_set_from_stat(
|
void git_futils_filestamp_set_from_stat(
|
||||||
git_futils_filestamp *stamp, struct stat *st)
|
git_futils_filestamp *stamp, struct stat *st)
|
||||||
{
|
{
|
||||||
#if defined(__APPLE__)
|
|
||||||
const struct timespec *statmtime = &st->st_mtimespec;
|
|
||||||
#else
|
|
||||||
const struct timespec *statmtime = &st->st_mtim;
|
const struct timespec *statmtime = &st->st_mtim;
|
||||||
#endif
|
|
||||||
|
|
||||||
if (st) {
|
if (st) {
|
||||||
stamp->mtime = *statmtime;
|
stamp->mtime = *statmtime;
|
||||||
|
Loading…
Reference in New Issue
Block a user