2 * <sys/stat.h> wrapper functions.
5 * Jonathan Pryor (jonpryor@vt.edu)
7 * Copyright (C) 2004-2006 Jonathan Pryor
10 #include <sys/types.h>
20 Mono_Posix_Syscall_gettimeofday (
21 struct Mono_Posix_Timeval
*tv
,
28 r
= gettimeofday (&_tv
, &_tz
);
32 tv
->tv_sec
= _tv
.tv_sec
;
33 tv
->tv_usec
= _tv
.tv_usec
;
36 struct Mono_Posix_Timezone
*tz_
= (struct Mono_Posix_Timezone
*) tz
;
37 tz_
->tz_minuteswest
= _tz
.tz_minuteswest
;
46 Mono_Posix_Syscall_settimeofday (
47 struct Mono_Posix_Timeval
*tv
,
48 struct Mono_Posix_Timezone
*tz
)
50 struct timeval _tv
= {0};
51 struct timeval
*ptv
= NULL
;
52 struct timezone _tz
= {0};
53 struct timezone
*ptz
= NULL
;
57 _tv
.tv_sec
= tv
->tv_sec
;
58 _tv
.tv_usec
= tv
->tv_usec
;
62 _tz
.tz_minuteswest
= tz
->tz_minuteswest
;
67 r
= settimeofday (ptv
, ptz
);
72 static inline struct timeval
*
73 copy_utimes (struct timeval
* to
, struct Mono_Posix_Timeval
*from
)
76 to
[0].tv_sec
= from
[0].tv_sec
;
77 to
[0].tv_usec
= from
[0].tv_usec
;
78 to
[1].tv_sec
= from
[1].tv_sec
;
79 to
[1].tv_usec
= from
[1].tv_usec
;
87 Mono_Posix_Syscall_utimes(const char *filename
, struct Mono_Posix_Timeval
*tv
)
89 struct timeval _tv
[2];
92 ptv
= copy_utimes (_tv
, tv
);
94 return utimes (filename
, ptv
);
99 Mono_Posix_Syscall_lutimes(const char *filename
, struct Mono_Posix_Timeval
*tv
)
101 struct timeval _tv
[2];
104 ptv
= copy_utimes (_tv
, tv
);
106 return lutimes (filename
, ptv
);
108 #endif /* def HAVE_LUTIMES */
112 Mono_Posix_Syscall_futimes(int fd
, struct Mono_Posix_Timeval
*tv
)
114 struct timeval _tv
[2];
117 ptv
= copy_utimes (_tv
, tv
);
119 return futimes (fd
, ptv
);
121 #endif /* def HAVE_FUTIMES */