From ccd777c8faa71a4deafba72339fe69825be503d8 Mon Sep 17 00:00:00 2001 From: pooka Date: Mon, 10 Sep 2007 19:11:44 +0000 Subject: [PATCH] Provide errno from rumpuser_{gettimeofday,close}() to be consistent. --- sys/rump/librump/rumpkern/emul.c | 14 +++++++++----- sys/rump/librump/rumpkern/specfs.c | 9 ++++++--- sys/rump/librump/rumpuser/rumpuser.c | 12 ++++++------ sys/rump/librump/rumpuser/rumpuser.h | 6 +++--- 4 files changed, 24 insertions(+), 17 deletions(-) diff --git a/sys/rump/librump/rumpkern/emul.c b/sys/rump/librump/rumpkern/emul.c index 103d55f677ed..f1f7e1eaed0f 100644 --- a/sys/rump/librump/rumpkern/emul.c +++ b/sys/rump/librump/rumpkern/emul.c @@ -1,4 +1,4 @@ -/* $NetBSD: emul.c,v 1.11 2007/08/26 23:51:08 pooka Exp $ */ +/* $NetBSD: emul.c,v 1.12 2007/09/10 19:11:44 pooka Exp $ */ /* * Copyright (c) 2007 Antti Kantee. All Rights Reserved. @@ -212,8 +212,9 @@ device_class(device_t dev) void getmicrouptime(struct timeval *tvp) { + int error; - rumpuser_gettimeofday(tvp); + rumpuser_gettimeofday(tvp, &error); } int @@ -261,8 +262,9 @@ void nanotime(struct timespec *ts) { struct timeval tv; + int error; - rumpuser_gettimeofday(&tv); + rumpuser_gettimeofday(&tv, &error); TIMEVAL_TO_TIMESPEC(&tv, ts); } @@ -277,15 +279,17 @@ getnanotime(struct timespec *ts) void microtime(struct timeval *tv) { + int error; - rumpuser_gettimeofday(tv); + rumpuser_gettimeofday(tv, &error); } void getmicrotime(struct timeval *tv) { + int error; - rumpuser_gettimeofday(tv); + rumpuser_gettimeofday(tv, &error); } void diff --git a/sys/rump/librump/rumpkern/specfs.c b/sys/rump/librump/rumpkern/specfs.c index 5b10e8127d2b..1c8c3f23821f 100644 --- a/sys/rump/librump/rumpkern/specfs.c +++ b/sys/rump/librump/rumpkern/specfs.c @@ -1,4 +1,4 @@ -/* $NetBSD: specfs.c,v 1.6 2007/08/20 15:58:14 pooka Exp $ */ +/* $NetBSD: specfs.c,v 1.7 2007/09/10 19:11:44 pooka Exp $ */ /* * Copyright (c) 2007 Antti Kantee. All Rights Reserved. @@ -89,7 +89,9 @@ rump_specopen(void *v) memset(&sp->rsp_dl, 0, sizeof(sp->rsp_dl)); if (rumpuser_stat(sp->rsp_path, &sb, &error) == -1) { - rumpuser_close(fd); + int dummy; + + rumpuser_close(fd, &dummy); return error; } sp->rsp_pi.p_size = sb.st_size >> DEV_BSHIFT; @@ -145,8 +147,9 @@ rump_specclose(void *v) } */ *ap = v; struct vnode *vp = ap->a_vp; struct rump_specpriv *sp = vp->v_data; + int error; - rumpuser_close(sp->rsp_fd); + rumpuser_close(sp->rsp_fd, &error); return 0; } diff --git a/sys/rump/librump/rumpuser/rumpuser.c b/sys/rump/librump/rumpuser/rumpuser.c index a3dbbd996ef7..0189a2a82b35 100644 --- a/sys/rump/librump/rumpuser/rumpuser.c +++ b/sys/rump/librump/rumpuser/rumpuser.c @@ -1,4 +1,4 @@ -/* $NetBSD: rumpuser.c,v 1.6 2007/08/20 15:58:14 pooka Exp $ */ +/* $NetBSD: rumpuser.c,v 1.7 2007/09/10 19:11:45 pooka Exp $ */ /* * Copyright (c) 2007 Antti Kantee. All Rights Reserved. @@ -138,11 +138,11 @@ rumpuser_ioctl(int fd, u_long cmd, void *data, int *error) DOCALL(int, (ioctl(fd, cmd, data))); } -void -rumpuser_close(int fd) +int +rumpuser_close(int fd, int *error) { - close(fd); + DOCALL(int, close(fd)); } ssize_t @@ -160,10 +160,10 @@ rumpuser_pwrite(int fd, const void *data, size_t size, off_t offset, int *error) } int -rumpuser_gettimeofday(struct timeval *tv) +rumpuser_gettimeofday(struct timeval *tv, int *error) { - return gettimeofday(tv, NULL); + DOCALL(int, gettimeofday(tv, NULL)); } int diff --git a/sys/rump/librump/rumpuser/rumpuser.h b/sys/rump/librump/rumpuser/rumpuser.h index 78e8e5d0501c..64fc7793bca2 100644 --- a/sys/rump/librump/rumpuser/rumpuser.h +++ b/sys/rump/librump/rumpuser/rumpuser.h @@ -1,4 +1,4 @@ -/* $NetBSD: rumpuser.h,v 1.4 2007/08/20 15:58:14 pooka Exp $ */ +/* $NetBSD: rumpuser.h,v 1.5 2007/09/10 19:11:45 pooka Exp $ */ /* * Copyright (c) 2007 Antti Kantee. All Rights Reserved. @@ -45,12 +45,12 @@ void rumpuser_free(void *); int rumpuser_open(const char *, int, int *); int rumpuser_ioctl(int, u_long, void *, int *); -void rumpuser_close(int); +int rumpuser_close(int, int *); ssize_t rumpuser_pread(int, void *, size_t, off_t, int *); ssize_t rumpuser_pwrite(int, const void *, size_t, off_t, int *); -int rumpuser_gettimeofday(struct timeval *); +int rumpuser_gettimeofday(struct timeval *, int *); uint16_t rumpuser_bswap16(uint16_t); uint32_t rumpuser_bswap32(uint32_t);