2 * <sys/stat.h> wrapper functions.
5 * Jonathan Pryor (jonpryor@vt.edu)
7 * Copyright (C) 2004-2006 Jonathan Pryor
10 #include <sys/types.h>
14 #include <os/kernel/OS.h>
23 Mono_Posix_Syscall_gettimeofday (
24 struct Mono_Posix_Timeval
*tv
,
31 r
= gettimeofday (&_tv
, &_tz
);
35 tv
->tv_sec
= _tv
.tv_sec
;
36 tv
->tv_usec
= _tv
.tv_usec
;
39 struct Mono_Posix_Timezone
*tz_
= (struct Mono_Posix_Timezone
*) tz
;
40 tz_
->tz_minuteswest
= _tz
.tz_minuteswest
;
49 Mono_Posix_Syscall_settimeofday (
50 struct Mono_Posix_Timeval
*tv
,
51 struct Mono_Posix_Timezone
*tz
)
53 struct timeval _tv
= {0};
54 struct timeval
*ptv
= NULL
;
55 struct timezone _tz
= {0};
56 struct timezone
*ptz
= NULL
;
60 _tv
.tv_sec
= tv
->tv_sec
;
61 _tv
.tv_usec
= tv
->tv_usec
;
65 _tz
.tz_minuteswest
= tz
->tz_minuteswest
;
71 set_real_time_clock(ptv
->tv_sec
);
74 r
= settimeofday (ptv
, ptz
);
80 static inline struct timeval
*
81 copy_utimes (struct timeval
* to
, struct Mono_Posix_Timeval
*from
)
84 to
[0].tv_sec
= from
[0].tv_sec
;
85 to
[0].tv_usec
= from
[0].tv_usec
;
86 to
[1].tv_sec
= from
[1].tv_sec
;
87 to
[1].tv_usec
= from
[1].tv_usec
;
95 Mono_Posix_Syscall_utimes(const char *filename
, struct Mono_Posix_Timeval
*tv
)
97 struct timeval _tv
[2];
100 ptv
= copy_utimes (_tv
, tv
);
102 return utimes (filename
, ptv
);
107 Mono_Posix_Syscall_lutimes(const char *filename
, struct Mono_Posix_Timeval
*tv
)
109 struct timeval _tv
[2];
112 ptv
= copy_utimes (_tv
, tv
);
114 return lutimes (filename
, ptv
);
116 #endif /* def HAVE_LUTIMES */
120 Mono_Posix_Syscall_futimes(int fd
, struct Mono_Posix_Timeval
*tv
)
122 struct timeval _tv
[2];
125 ptv
= copy_utimes (_tv
, tv
);
127 return futimes (fd
, ptv
);
129 #endif /* def HAVE_FUTIMES */