ObjFW  Diff

Differences From Artifact [70736e006a]:

To Artifact [dab6fa946c]:


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) {