···11+/*
22+ This file is part of Darling.
33+44+ Copyright (C) 2019 Lubos Dolezel
55+66+ Darling is free software: you can redistribute it and/or modify
77+ it under the terms of the GNU General Public License as published by
88+ the Free Software Foundation, either version 3 of the License, or
99+ (at your option) any later version.
1010+1111+ Darling is distributed in the hope that it will be useful,
1212+ but WITHOUT ANY WARRANTY; without even the implied warranty of
1313+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1414+ GNU General Public License for more details.
1515+1616+ You should have received a copy of the GNU General Public License
1717+ along with Darling. If not, see <http://www.gnu.org/licenses/>.
1818+*/
1919+2020+#include <CoreFoundation/CoreFoundation.h>
2121+#include <sys/types.h>
2222+#include <Availability.h>
2323+2424+typedef struct __FSEventStream* FSEventStreamRef;
2525+typedef const struct __FSEventStream* ConstFSEventStreamRef;
2626+2727+typedef UInt32 FSEventStreamCreateFlags;
2828+typedef UInt64 FSEventStreamEventId;
2929+typedef UInt32 FSEventStreamEventFlags;
3030+3131+typedef CALLBACK_API_C(void, FSEventStreamCallback)(
3232+ ConstFSEventStreamRef streamRef,
3333+ void *clientCallBackInfo,
3434+ size_t numEvents,
3535+ void *eventPaths,
3636+ const FSEventStreamEventFlags *eventFlags,
3737+ const FSEventStreamEventId *eventIds);
3838+3939+struct FSEventStreamContext {
4040+ CFIndex version;
4141+ void *info;
4242+ CFAllocatorRetainCallBack retain;
4343+ CFAllocatorReleaseCallBack release;
4444+ CFAllocatorCopyDescriptionCallBack copyDesc;
4545+};
4646+typedef struct FSEventStreamContext FSEventStreamContext;
4747+4848+extern FSEventStreamRef FSEventStreamCreate(
4949+ CFAllocatorRef allocator,
5050+ FSEventStreamCallback callback,
5151+ FSEventStreamContext *context,
5252+ CFArrayRef pathsToWatch,
5353+ FSEventStreamEventId sinceWhen,
5454+ CFTimeInterval latency,
5555+ FSEventStreamCreateFlags flags);
5656+5757+extern CF_RETURNS_RETAINED CFArrayRef FSEventStreamCopyPathsBeingWatched(ConstFSEventStreamRef streamRef);
+53
src/CoreServices/src/FSEvents.c
···11+/*
22+ This file is part of Darling.
33+44+ Copyright (C) 2019 Lubos Dolezel
55+66+ Darling is free software: you can redistribute it and/or modify
77+ it under the terms of the GNU General Public License as published by
88+ the Free Software Foundation, either version 3 of the License, or
99+ (at your option) any later version.
1010+1111+ Darling is distributed in the hope that it will be useful,
1212+ but WITHOUT ANY WARRANTY; without even the implied warranty of
1313+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1414+ GNU General Public License for more details.
1515+1616+ You should have received a copy of the GNU General Public License
1717+ along with Darling. If not, see <http://www.gnu.org/licenses/>.
1818+*/
1919+2020+#include <FSEvents/FSEvents.h>
2121+#include <stdio.h>
2222+#include <stdlib.h>
2323+2424+struct __FSEventStream {
2525+ CFAllocatorRef allocator;
2626+ CFArrayRef pathsToWatch;
2727+};
2828+2929+FSEventStreamRef FSEventStreamCreate(
3030+ CFAllocatorRef allocator,
3131+ FSEventStreamCallback callback,
3232+ FSEventStreamContext *context,
3333+ CFArrayRef pathsToWatch,
3434+ FSEventStreamEventId sinceWhen,
3535+ CFTimeInterval latency,
3636+ FSEventStreamCreateFlags flags)
3737+{
3838+ FSEventStreamRef stream = NULL;
3939+ printf("STUB %s\n", __PRETTY_FUNCTION__);
4040+ stream = CFAllocatorAllocate(allocator, sizeof(struct __FSEventStream), 0);
4141+ stream->allocator = allocator;
4242+ stream->pathsToWatch = pathsToWatch;
4343+ return stream;
4444+}
4545+4646+CFArrayRef FSEventStreamCopyPathsBeingWatched(ConstFSEventStreamRef streamRef)
4747+{
4848+ CFArrayRef copy;
4949+ printf("STUB %s\n", __PRETTY_FUNCTION__);
5050+ copy = CFArrayCreateCopy(streamRef->allocator, streamRef->pathsToWatch);
5151+ copy = CFRetain(copy);
5252+ return copy;
5353+}