| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: rumpcomp_user.c,v 1.13 2013/07/04 17:46:14 pooka Exp $ */ | | 1 | /* $NetBSD: rumpcomp_user.c,v 1.14 2014/01/08 11:06:33 pooka Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2009, 2010 Antti Kantee. All Rights Reserved. | | 4 | * Copyright (c) 2009, 2010 Antti Kantee. All Rights Reserved. |
5 | * | | 5 | * |
6 | * Redistribution and use in source and binary forms, with or without | | 6 | * Redistribution and use in source and binary forms, with or without |
7 | * modification, are permitted provided that the following conditions | | 7 | * modification, are permitted provided that the following conditions |
8 | * are met: | | 8 | * are met: |
9 | * 1. Redistributions of source code must retain the above copyright | | 9 | * 1. Redistributions of source code must retain the above copyright |
10 | * notice, this list of conditions and the following disclaimer. | | 10 | * notice, this list of conditions and the following disclaimer. |
11 | * 2. Redistributions in binary form must reproduce the above copyright | | 11 | * 2. Redistributions in binary form must reproduce the above copyright |
12 | * notice, this list of conditions and the following disclaimer in the | | 12 | * notice, this list of conditions and the following disclaimer in the |
13 | * documentation and/or other materials provided with the distribution. | | 13 | * documentation and/or other materials provided with the distribution. |
14 | * | | 14 | * |
| @@ -32,27 +32,28 @@ | | | @@ -32,27 +32,28 @@ |
32 | | | 32 | |
33 | #include <rump/rumpuser_component.h> | | 33 | #include <rump/rumpuser_component.h> |
34 | | | 34 | |
35 | #include "rumpcomp_user.h" | | 35 | #include "rumpcomp_user.h" |
36 | | | 36 | |
37 | #define seterr(_v_) if ((_v_) == -1) *error = errno; else *error = 0; | | 37 | #define seterr(_v_) if ((_v_) == -1) *error = errno; else *error = 0; |
38 | | | 38 | |
39 | /* | | 39 | /* |
40 | * On BSD we use kqueue, on Linux we use inotify. The underlying | | 40 | * On BSD we use kqueue, on Linux we use inotify. The underlying |
41 | * interface requirements aren't quite the same, but we have a very | | 41 | * interface requirements aren't quite the same, but we have a very |
42 | * good chance of doing the fd->path mapping on Linux thanks to dcache, | | 42 | * good chance of doing the fd->path mapping on Linux thanks to dcache, |
43 | * so just keep the existing interfaces for now. | | 43 | * so just keep the existing interfaces for now. |
44 | */ | | 44 | */ |
45 | #if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__DragonFly__) | | 45 | #if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__DragonFly__) \ |
| | | 46 | || defined(__OpenBSD__) |
46 | #include <sys/event.h> | | 47 | #include <sys/event.h> |
47 | | | 48 | |
48 | #include <stdlib.h> | | 49 | #include <stdlib.h> |
49 | | | 50 | |
50 | int | | 51 | int |
51 | rumpcomp_shmif_watchsetup(int *kqp, int fd) | | 52 | rumpcomp_shmif_watchsetup(int *kqp, int fd) |
52 | { | | 53 | { |
53 | struct kevent kev; | | 54 | struct kevent kev; |
54 | int rv, kq; | | 55 | int rv, kq; |
55 | | | 56 | |
56 | kq = *kqp; | | 57 | kq = *kqp; |
57 | if (kq == -1) { | | 58 | if (kq == -1) { |
58 | kq = kqueue(); | | 59 | kq = kqueue(); |