diff options
| author | Eli Zaretskii | 2012-06-23 13:22:59 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2012-06-23 13:22:59 +0300 |
| commit | 388cdec072a52e1b647dec159433fd0ffe240be4 (patch) | |
| tree | efd6a04f97a631114fd093b4414a9242486e04a5 /src/w32.c | |
| parent | f199cab1a97da8c46b719bb73af58acdcb6243c1 (diff) | |
| download | emacs-388cdec072a52e1b647dec159433fd0ffe240be4.tar.gz emacs-388cdec072a52e1b647dec159433fd0ffe240be4.zip | |
Fix the MS-Windows build broken by 2012-06-22T21:17:42Z!eggert@cs.ucla.edu.
nt/inc/sys/time.h (struct timespec): Define.
lib/makefile.w32-in (GNULIBOBJS): Add $(BLD)/dtotimespec.$(O),
$(BLD)/gettime.$(O), $(BLD)/timespec-add.$(O), and
$(BLD)/timespec-sub.$(O).
($(BLD)/dtotimespec.$(O)):
($(BLD)/gettime.$(O)):
($(BLD)/timespec-add.$(O)):
($(BLD)/timespec-sub.$(O)): New dependencies.
lib/stat-time.h:
lib/timespec.h:
lib/utimens.h: Include sys/time.h
src/w32.c (fdutimens): New function.
src/w32proc.c (sys_select): Adapt to change in the EMACS_TIME type.
src/s/ms-w32.h (pselect): Redirect to sys_select.
src/sysselect.h [WINDOWSNT]: Don't include sys/select.h.
Fixes: debbugs:9000
Diffstat (limited to 'src/w32.c')
| -rw-r--r-- | src/w32.c | 35 |
1 files changed, 35 insertions, 0 deletions
| @@ -1996,6 +1996,41 @@ gettimeofday (struct timeval *tv, struct timezone *tz) | |||
| 1996 | } | 1996 | } |
| 1997 | } | 1997 | } |
| 1998 | 1998 | ||
| 1999 | /* Emulate fdutimens. */ | ||
| 2000 | |||
| 2001 | /* Set the access and modification time stamps of FD (a.k.a. FILE) to be | ||
| 2002 | TIMESPEC[0] and TIMESPEC[1], respectively. | ||
| 2003 | FD must be either negative -- in which case it is ignored -- | ||
| 2004 | or a file descriptor that is open on FILE. | ||
| 2005 | If FD is nonnegative, then FILE can be NULL, which means | ||
| 2006 | use just futimes instead of utimes. | ||
| 2007 | If TIMESPEC is null, FAIL. | ||
| 2008 | Return 0 on success, -1 (setting errno) on failure. */ | ||
| 2009 | |||
| 2010 | int | ||
| 2011 | fdutimens (int fd, char const *file, struct timespec const timespec[2]) | ||
| 2012 | { | ||
| 2013 | struct _utimbuf ut; | ||
| 2014 | |||
| 2015 | if (!timespec) | ||
| 2016 | { | ||
| 2017 | errno = ENOSYS; | ||
| 2018 | return -1; | ||
| 2019 | } | ||
| 2020 | if (fd < 0 && !file) | ||
| 2021 | { | ||
| 2022 | errno = EBADF; | ||
| 2023 | return -1; | ||
| 2024 | } | ||
| 2025 | ut.actime = timespec[0].tv_sec; | ||
| 2026 | ut.modtime = timespec[1].tv_sec; | ||
| 2027 | if (fd >= 0) | ||
| 2028 | return _futime (fd, &ut); | ||
| 2029 | else | ||
| 2030 | return _utime (file, &ut); | ||
| 2031 | } | ||
| 2032 | |||
| 2033 | |||
| 1999 | /* ------------------------------------------------------------------------- */ | 2034 | /* ------------------------------------------------------------------------- */ |
| 2000 | /* IO support and wrapper functions for W32 API. */ | 2035 | /* IO support and wrapper functions for W32 API. */ |
| 2001 | /* ------------------------------------------------------------------------- */ | 2036 | /* ------------------------------------------------------------------------- */ |