ReactOS  0.4.15-dev-3451-gf606fec
futime.c File Reference
#include <precomp.h>
#include <time.h>
#include <sys/utime.h>
#include "bitsfixup.h"
#include <internal/wine/msvcrt.h>
Include dependency graph for futime.c:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define RC_INVOKED   1
 

Functions

ioinfoget_ioinfo (int fd)
 
void release_ioinfo (ioinfo *info)
 
int _futime (int fd, struct _utimbuf *filetime)
 

Macro Definition Documentation

◆ RC_INVOKED

#define RC_INVOKED   1

Definition at line 38 of file futime.c.

Function Documentation

◆ _futime()

int _futime ( int  fd,
struct _utimbuf filetime 
)

Definition at line 55 of file futime.c.

56 {
58  FILETIME at, wt;
59 
60  if (info->handle == INVALID_HANDLE_VALUE)
61  {
63  return -1;
64  }
65 
66  if (!filetime)
67  {
68  time_t currTime;
69  _time(&currTime);
71  (LARGE_INTEGER *)&at);
72  wt = at;
73  }
74  else
75  {
77  (LARGE_INTEGER *)&at);
78  if (filetime->actime == filetime->modtime)
79  {
80  wt = at;
81  }
82  else
83  {
85  (LARGE_INTEGER *)&wt);
86  }
87  }
88 
89  if (!SetFileTime(info->handle, NULL, &at, &wt))
90  {
93  return -1 ;
94  }
96  return 0;
97 }
Definition: file.c:40
NTSYSAPI VOID NTAPI RtlSecondsSince1970ToTime(_In_ ULONG SecondsSince1970, _Out_ PLARGE_INTEGER Time)
#define INVALID_HANDLE_VALUE
Definition: compat.h:590
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
time_t _time(time_t *ptime)
Definition: time.c:12
static int fd
Definition: io.c:51
BOOL WINAPI SetFileTime(IN HANDLE hFile, CONST FILETIME *lpCreationTime OPTIONAL, CONST FILETIME *lpLastAccessTime OPTIONAL, CONST FILETIME *lpLastWriteTime OPTIONAL)
Definition: fileinfo.c:948
void release_ioinfo(ioinfo *info)
Definition: file.c:263
ioinfo * get_ioinfo(int fd)
Definition: file.c:181
void _dosmaperr(unsigned long oserrcode)
Definition: errno.c:81
__kernel_time_t time_t
Definition: linux.h:252
#define NULL
Definition: types.h:112
unsigned int ULONG
Definition: retypes.h:1

◆ get_ioinfo()

ioinfo* get_ioinfo ( int  fd)

Definition at line 181 of file file.c.

182 {
184  if(ret == &__badioinfo)
185  return ret;
187  EnterCriticalSection(&ret->crit);
188  return ret;
189 }
static ioinfo * get_ioinfo_nolock(int fd)
Definition: file.c:158
static void init_ioinfo_cs(ioinfo *info)
Definition: file.c:169
Definition: file.c:40
ioinfo __badioinfo
Definition: file.c:126
static int fd
Definition: io.c:51
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
int ret

Referenced by _chsize_s(), _close(), _commit(), _dup2(), _eof(), _futime(), _locking(), _lseeki64(), _read(), _setmode(), _write(), get_ioinfo_alloc_fd(), and msvcrt_free_fd().

◆ release_ioinfo()

void release_ioinfo ( ioinfo info)

Definition at line 263 of file file.c.

264 {
265  if(info!=&__badioinfo && info->exflag & EF_CRIT_INIT)
266  LeaveCriticalSection(&info->crit);
267 }
ioinfo __badioinfo
Definition: file.c:126
#define EF_CRIT_INIT
Definition: file.c:105
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)

Referenced by _chsize_s(), _close(), _commit(), _dup(), _dup2(), _eof(), _futime(), _locking(), _lseeki64(), _read(), _setmode(), _write(), msvcrt_alloc_fd(), msvcrt_free_fd(), and msvcrt_init_io().