Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/rump/net/lib/libshmif be a bit less sloppy with errno
details: https://anonhg.NetBSD.org/src/rev/a1cf2a309682
branches: trunk
changeset: 786428:a1cf2a309682
user: pooka <pooka%NetBSD.org@localhost>
date: Sun Apr 28 11:03:25 2013 +0000
description:
be a bit less sloppy with errno
diffstat:
sys/rump/net/lib/libshmif/rumpcomp_user.c | 13 ++++++++-----
1 files changed, 8 insertions(+), 5 deletions(-)
diffs (56 lines):
diff -r 7eaf3d0ecd7a -r a1cf2a309682 sys/rump/net/lib/libshmif/rumpcomp_user.c
--- a/sys/rump/net/lib/libshmif/rumpcomp_user.c Sun Apr 28 10:53:21 2013 +0000
+++ b/sys/rump/net/lib/libshmif/rumpcomp_user.c Sun Apr 28 11:03:25 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rumpcomp_user.c,v 1.2 2013/04/28 10:53:22 pooka Exp $ */
+/* $NetBSD: rumpcomp_user.c,v 1.3 2013/04/28 11:03:25 pooka Exp $ */
/*-
* Copyright (c) 2009, 2010 Antti Kantee. All Rights Reserved.
@@ -34,6 +34,8 @@
#include "rumpcomp_user.h"
+#define seterr(_v_) if ((_v_) == -1) *error = errno; else *error = 0;
+
/*
* On NetBSD we use kqueue, on Linux we use inotify. The underlying
* interface requirements aren't quite the same, but we have a very
@@ -58,7 +60,7 @@
EV_SET(&kev, fd, EVFILT_VNODE, EV_ADD|EV_ENABLE|EV_CLEAR,
NOTE_WRITE, 0, 0);
rv = kevent(kq, &kev, 1, NULL, 0, NULL);
- *error = errno;
+ seterr(rv);
if (rv == -1)
return -1;
return kq;
@@ -75,9 +77,9 @@
do {
rv = kevent(kq, NULL, 0, &kev, 1, NULL);
} while (rv == -1 && errno == EINTR);
- *error = errno;
+ seterr(rv);
+ rumpuser_component_schedule(cookie);
- rumpuser_component_schedule(cookie);
return rv;
}
@@ -117,6 +119,7 @@
close(inotify);
return -1;
}
+ *error = 0;
return inotify;
}
@@ -132,7 +135,7 @@
do {
nn = read(kq, &iev, sizeof(iev));
} while (errno == EINTR);
- *error = errno;
+ seterr(nn);
rumpuser_component_schedule(cookie);
if (nn == -1) {
Home |
Main Index |
Thread Index |
Old Index