Add NetBSD 5 compat wrapping for *utimes()

This commit is contained in:
pooka 2011-01-04 17:00:19 +00:00
parent 6bbd1c4558
commit 4b258054be
2 changed files with 69 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: rump_syscalls_compat.h,v 1.4 2010/08/30 10:08:39 pooka Exp $ */
/* $NetBSD: rump_syscalls_compat.h,v 1.5 2011/01/04 17:00:19 pooka Exp $ */
/*-
* Copyright (c) 2010 Antti Kantee. All Rights Reserved.
@ -45,6 +45,9 @@
#define rump_sys_fstat(a,b) rump_sys_nb5_fstat(a,b)
#define rump_sys_pollts(a,b,c,d) rump_sys_nb5_pollts(a,b,c,d)
#define rump_sys_select(a,b,c,d,e) rump_sys_nb5_select(a,b,c,d,e)
#define rump_sys_utimes(a,b) rump_sys_nb5_utimes(a,b)
#define rump_sys_lutimes(a,b) rump_sys_nb5_lutimes(a,b)
#define rump_sys_futimes(a,b) rump_sys_nb5_futimes(a,b)
#endif /* __NetBSD_Prereq */
#endif /* __NetBSD__ */
#endif /* _KERNEL */
@ -62,6 +65,9 @@ int rump_sys_nb5_fstat(int, struct stat *);
int rump_sys_nb5_pollts(struct pollfd *, size_t,
const struct timespec *, const void *);
int rump_sys_nb5_select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
int rump_sys_nb5_utimes(const char *, const struct timeval *);
int rump_sys_nb5_lutimes(const char *, const struct timeval *);
int rump_sys_nb5_futimes(int, const struct timeval *);
#ifdef _END_DECLS
_END_DECLS

View File

@ -1,4 +1,4 @@
/* $NetBSD: compat.c,v 1.7 2010/08/30 10:08:39 pooka Exp $ */
/* $NetBSD: compat.c,v 1.8 2011/01/04 17:00:19 pooka Exp $ */
/*
* Copyright (c) 2009 Antti Kantee. All Rights Reserved.
@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: compat.c,v 1.7 2010/08/30 10:08:39 pooka Exp $");
__KERNEL_RCSID(0, "$NetBSD: compat.c,v 1.8 2011/01/04 17:00:19 pooka Exp $");
#include <sys/param.h>
#include <sys/kmem.h>
@ -140,6 +140,66 @@ rump_sys_nb5_fstat(int fd, struct stat *sb)
return retval;
}
int
rump_sys_nb5_utimes(const char *path, const struct timeval times[2])
{
struct compat_50_sys_utimes_args args;
register_t retval = 0;
int error = 0;
SPARG(&args, path) = path;
SPARG(&args, tptr) = (const struct timeval50 *)times;
rump_schedule();
error = compat_50_sys_utimes(curlwp, &args, &retval);
if (error) {
retval = -1;
rumpuser_seterrno(error);
}
rump_unschedule();
return retval;
}
int
rump_sys_nb5_lutimes(const char *path, const struct timeval times[2])
{
struct compat_50_sys_lutimes_args args;
register_t retval = 0;
int error = 0;
SPARG(&args, path) = path;
SPARG(&args, tptr) = (const struct timeval50 *)times;
rump_schedule();
error = compat_50_sys_lutimes(curlwp, &args, &retval);
if (error) {
retval = -1;
rumpuser_seterrno(error);
}
rump_unschedule();
return retval;
}
int
rump_sys_nb5_futimes(int fd, const struct timeval times[2])
{
struct compat_50_sys_futimes_args args;
register_t retval = 0;
int error = 0;
SPARG(&args, fd) = fd;
SPARG(&args, tptr) = (const struct timeval50 *)times;
rump_schedule();
error = compat_50_sys_futimes(curlwp, &args, &retval);
if (error) {
retval = -1;
rumpuser_seterrno(error);
}
rump_unschedule();
return retval;
}
/*
* XXX: types. But I don't want to start playing compat games in
* the userspace namespace too