Differences From Artifact [70736e006a]:
- File
src/OFKernelEventObserver_kqueue.m
— part of check-in
[1dbe9a4e4e]
at
2014-08-22 19:09:34
on branch trunk
— Retain sockets until after removal from observer
Not retaining them caused kevent() to be called on an invalid fd. (user: js, size: 4137) [annotate] [blame] [check-ins using]
To Artifact [dab6fa946c]:
- File src/OFKernelEventObserver_kqueue.m — part of check-in [aebd220efc] at 2014-12-13 17:50:05 on branch trunk — Use CLOEXEC for kqueue (user: js, size: 4427) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | @implementation OFKernelEventObserver_kqueue - init { self = [super init]; @try { if ((_kernelQueue = kqueue()) == -1) @throw [OFInitializationFailedException exceptionWithClass: [self class]]; _changeList = [[OFDataArray alloc] initWithItemSize: sizeof(struct kevent)]; _removedArray = [[OFMutableArray alloc] init]; [self OF_addFileDescriptorForReading: _cancelFD[0]]; } @catch (id e) { | > > > > > > > > > > > | 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | @implementation OFKernelEventObserver_kqueue - init { self = [super init]; @try { #ifdef HAVE_KQUEUE1 if ((_kernelQueue = kqueue1(O_CLOEXEC)) == -1) @throw [OFInitializationFailedException exceptionWithClass: [self class]]; #else int flags; if ((_kernelQueue = kqueue()) == -1) @throw [OFInitializationFailedException exceptionWithClass: [self class]]; if ((flags = fcntl(_kernelQueue, F_GETFD, 0)) != -1) fcntl(_kernelQueue, F_SETFD, flags | FD_CLOEXEC); #endif _changeList = [[OFDataArray alloc] initWithItemSize: sizeof(struct kevent)]; _removedArray = [[OFMutableArray alloc] init]; [self OF_addFileDescriptorForReading: _cancelFD[0]]; } @catch (id e) { |
︙ | ︙ |