kqueue disable on delivery...
Igor Sysoev
is at rambler-co.ru
Wed Sep 27 14:00:40 PDT 2006
On Wed, 27 Sep 2006, Igor Sysoev wrote:
> On Wed, 27 Sep 2006, Igor Sysoev wrote:
>
>> Here is patch and test program. The patch is against 6.2-PRERELEASE.
>> On 7.0 the EVFILT_LIO should be taked into account.
>>
>> test program should show oneshot user event:
>>> ./t
>> n: 1, id: 0x55, filt: -10, fl: 0x0010, ff:0, data:0x0, udata: 0x5678
>> n: 0, id: 0x0, filt: 0, fl: 0x0000, ff:0, data:0x0, udata: 0x0
>
> Sorry, I missed to attach the test program.
Sorry, the pine ignored my attach again.
Igor Sysoev
http://sysoev.ru/en/
-------------- next part --------------
#include <sys/types.h>
#include <sys/event.h>
#include <sys/time.h>
#include <unistd.h>
#include <errno.h>
int
main()
{
int kq, n;
struct kevent kev;
struct timespec to;
kq = kqueue();
if (kq == -1) {
printf("kqueue() failed: (%d)%s\n", errno, strerror(errno));
exit(1);
}
EV_SET(&kev, 0x55, EVFILT_USER, EV_ADD, 0, 0x1234, (void *) 0x5678);
to.tv_sec = 0;
to.tv_nsec = 0;
if (kevent(kq, &kev, 1, NULL, 0, &to) == -1) {
printf("1st kevent() failed: (%d)%s\n", errno, strerror(errno));
exit(1);
}
memset(&kev, 0, sizeof(struct kevent));
if ((n = kevent(kq, NULL, 0, &kev, 1, &to)) == -1) {
printf("2nd kevent() failed: (%d)%s\n", errno, strerror(errno));
exit(1);
}
printf("n: %d, id: %p, filt: %d, fl: 0x%04X, ff:%u, data:%p, udata: %p\n",
n, kev.ident, kev.filter, kev.flags, kev.fflags, kev.data, kev.udata);
memset(&kev, 0, sizeof(struct kevent));
if ((n = kevent(kq, NULL, 0, &kev, 1, &to)) == -1) {
printf("3rd kevent() failed: (%d)%s\n", errno, strerror(errno));
exit(1);
}
printf("n: %d, id: %p, filt: %d, fl: 0x%04X, ff:%u, data:%p, udata: %p\n",
n, kev.ident, kev.filter, kev.flags, kev.fflags, kev.data, kev.udata);
return 0;
}
More information about the freebsd-arch
mailing list