diff options
author | Edward Thomson <ethomson@edwardthomson.com> | 2021-11-14 16:43:53 -0500 |
---|---|---|
committer | Edward Thomson <ethomson@edwardthomson.com> | 2022-02-22 22:07:44 -0500 |
commit | c3b7ace9cf3216928a31886b32c264e0cd3cde75 (patch) | |
tree | d7575e38bef62714b99f4b2dd8bbb44ec7bb6534 /src/util/win32/win32-compat.h | |
parent | ef4ab2988320005cbcb3db920e6b41f10b3c60cf (diff) | |
download | libgit2-c3b7ace9cf3216928a31886b32c264e0cd3cde75.tar.gz |
refactor: make util an object library
Instead of simply including the utility files directly, make them a
cmake object library for easy reusability between other projects within
libgit2.
Now the top-level `src` is responsible for platform selection, while the
next-level `libgit2` and `util` configurations are responsible for
identifying what objects they include.
Diffstat (limited to 'src/util/win32/win32-compat.h')
-rw-r--r-- | src/util/win32/win32-compat.h | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/src/util/win32/win32-compat.h b/src/util/win32/win32-compat.h new file mode 100644 index 000000000..dee40a438 --- /dev/null +++ b/src/util/win32/win32-compat.h @@ -0,0 +1,52 @@ +/* + * Copyright (C) the libgit2 contributors. All rights reserved. + * + * This file is part of libgit2, distributed under the GNU GPL v2 with + * a Linking Exception. For full terms see the included COPYING file. + */ +#ifndef INCLUDE_win32_win32_compat_h__ +#define INCLUDE_win32_win32_compat_h__ + +#include <stdint.h> +#include <time.h> +#include <wchar.h> +#include <sys/stat.h> +#include <sys/types.h> + +typedef long suseconds_t; + +struct p_timeval { + time_t tv_sec; + suseconds_t tv_usec; +}; + +struct p_timespec { + time_t tv_sec; + long tv_nsec; +}; + +#define timespec p_timespec + +struct p_stat { + _dev_t st_dev; + _ino_t st_ino; + mode_t st_mode; + short st_nlink; + short st_uid; + short st_gid; + _dev_t st_rdev; + __int64 st_size; + struct timespec st_atim; + struct timespec st_mtim; + struct timespec st_ctim; +#define st_atime st_atim.tv_sec +#define st_mtime st_mtim.tv_sec +#define st_ctime st_ctim.tv_sec +#define st_atime_nsec st_atim.tv_nsec +#define st_mtime_nsec st_mtim.tv_nsec +#define st_ctime_nsec st_ctim.tv_nsec +}; + +#define stat p_stat + +#endif |