diff options
author | Jonathan Pryor <jpryor@novell.com> | 2005-12-30 04:35:40 +0300 |
---|---|---|
committer | Jonathan Pryor <jpryor@novell.com> | 2005-12-30 04:35:40 +0300 |
commit | af7de2864c02e32f97d510623aa39f7c56f03f01 (patch) | |
tree | fbdddfd1b2f90c4337e640fd4171a87408fc785c /support | |
parent | b3e61ff320165a8d5eb78b3e88a62579fbb49f54 (diff) |
* map-icalls.h: Flush (add utimes_bad, lutimes, futimes).
* sys-time.c: Add lutimes(2) and futimes(2) wrapper.
svn path=/trunk/mono/; revision=54922
Diffstat (limited to 'support')
-rw-r--r-- | support/ChangeLog | 5 | ||||
-rw-r--r-- | support/map-icalls.h | 3 | ||||
-rw-r--r-- | support/sys-time.c | 50 |
3 files changed, 57 insertions, 1 deletions
diff --git a/support/ChangeLog b/support/ChangeLog index e03d0c821b6..9ad9b5a5867 100644 --- a/support/ChangeLog +++ b/support/ChangeLog @@ -1,3 +1,8 @@ +2005-12-28 Jonathan Pryor <jonpryor@vt.edu> + + * map-icalls.h: Flush (add utimes_bad, lutimes, futimes). + * sys-time.c: Add lutimes(2) and futimes(2) wrapper. + 2005-12-27 Jonathan Pryor <jonpryor@vt.edu> * map.c: Include <sys/mman.h>. Fixes #77091. Thanks to Ben Gamari. diff --git a/support/map-icalls.h b/support/map-icalls.h index 4b5e80d8bb9..aa43985fbdb 100644 --- a/support/map-icalls.h +++ b/support/map-icalls.h @@ -129,6 +129,7 @@ int Mono_Posix_Syscall_fsetxattr (int fd, const char* name, void* value, guint64 int Mono_Posix_Syscall_fstat (int filedes, struct Mono_Posix_Stat* buf); int Mono_Posix_Syscall_fstatvfs (int fd, struct Mono_Posix_Statvfs* buf); int Mono_Posix_Syscall_ftruncate (int fd, gint64 length); +int Mono_Posix_Syscall_futimes (int fd, struct Mono_Posix_Timeval* tvp); void* Mono_Posix_Syscall_getcwd (char* buf, guint64 size); int Mono_Posix_Syscall_getdomainname (char* name, guint64 len); int Mono_Posix_Syscall_getfsent (struct Mono_Posix_Syscall__Fstab* fs); @@ -157,6 +158,7 @@ int Mono_Posix_Syscall_lremovexattr (const char* path, const char* name); gint64 Mono_Posix_Syscall_lseek (int fd, gint64 offset, int whence); int Mono_Posix_Syscall_lsetxattr (const char* path, const char* name, void* value, guint64 size, int flags); int Mono_Posix_Syscall_lstat (const char* file_name, struct Mono_Posix_Stat* buf); +int Mono_Posix_Syscall_lutimes (const char* filename, struct Mono_Posix_Timeval* tvp); int Mono_Posix_Syscall_mincore (void* start, guint64 length, void* vec); int Mono_Posix_Syscall_mknod (const char* pathname, unsigned int mode, guint64 dev); int Mono_Posix_Syscall_mlock (void* start, guint64 len); @@ -211,6 +213,7 @@ int Mono_Posix_Syscall_truncate (const char* path, gint64 length); int Mono_Posix_Syscall_ttyname_r (int fd, char* buf, guint64 buflen); int Mono_Posix_Syscall_utime (const char* filename, struct Mono_Posix_Utimbuf* buf, int use_buf); int Mono_Posix_Syscall_utimes (const char* filename, struct Mono_Posix_Timeval* tvp); +int Mono_Posix_Syscall_utimes_bad (const char* filename, struct Mono_Posix_Timeval* tvp); gint64 Mono_Posix_Syscall_write (int fd, void* buf, guint64 count); int Mono_Posix_ToAccessMode (int value, int* rval); int Mono_Posix_ToAccessModes (int value, int* rval); diff --git a/support/sys-time.c b/support/sys-time.c index b81f4657ebd..d9a2e0f6e51 100644 --- a/support/sys-time.c +++ b/support/sys-time.c @@ -79,8 +79,9 @@ Mono_Posix_Syscall_settimeofday ( return r; } +/* Remove this at some point in the future */ gint32 -Mono_Posix_Syscall_utimes (const char *filename, +Mono_Posix_Syscall_utimes_bad (const char *filename, struct Mono_Posix_Timeval *tv) { struct timeval _tv; @@ -95,6 +96,53 @@ Mono_Posix_Syscall_utimes (const char *filename, return utimes (filename, ptv); } +static inline struct timeval* +copy_utimes (struct timeval* to, struct Mono_Posix_Timeval *from) +{ + if (from) { + to[0].tv_sec = from->tv_sec; + to[0].tv_usec = from->tv_usec; + to[1].tv_sec = from->tv_sec; + to[1].tv_usec = from->tv_usec; + return to; + } + + return NULL; +} + +gint32 +Mono_Posix_Syscall_utimes(const char *filename, struct Mono_Posix_Timeval *tv) +{ + struct timeval _tv[2]; + struct timeval *ptv; + + ptv = copy_utimes (_tv, tv); + + return utimes (filename, ptv); +} + +gint32 +Mono_Posix_Syscall_lutimes(const char *filename, struct Mono_Posix_Timeval *tv) +{ + struct timeval _tv[2]; + struct timeval *ptv; + + ptv = copy_utimes (_tv, tv); + + return lutimes (filename, ptv); +} + +gint32 +Mono_Posix_Syscall_futimes(int fd, struct Mono_Posix_Timeval *tv) +{ + struct timeval _tv[2]; + struct timeval *ptv; + + ptv = copy_utimes (_tv, tv); + + return futimes (fd, ptv); +} + G_END_DECLS /* |