Also includes a serialization overhaul to be more object-oriented (each XPC object class worries about its own (de)serialization). The new serialization code also includes Mach port serialization (which we didn't have before).
The "test" service is not really a test; it's more of a sample. You have to test it out manually.
This commit is the first in the rewrite of libxpc. It implements the basic API (that is, the XPC object system and the most basic objects and collections). It also adds some tests for the basic API.
The current test suite uses ctest as the testing framework, but for future tests (such as for connections), it may be necessary to find something a little more robust (or roll our own).
Future commits will implement the rewritten connection system based on top of libdispatch's private Mach API, which is made specifically for this purpose (it even has certain methods marked as `4libxpc`).
This commit reorganizes the project to be a little more... organized ;)
It's a matter of preference, but I personally think separating sources and headers is more orderly. Various unnecessary sources that we inherited from NextBSD have also been removed.
We now use an exported symbols list to make our exported symbols match Apple's official libxpc (with the exception of those that we haven't stubbed/defined yet).
And finally, the {de,}serialization logic has been completely rewritten to match Apple's serialization format. The only possible issue there are doubles, which like the old code, we assume the double format is identical between the source machine and the receiving machine (which is probably a safe assumption, but should be avoided if possible).
Oh, and it also various little fixes, the most important of which is that creating a non-empty dictionary now works properly (we were previously doubling the entry count).
aslmanager uses libxpc, and using syslog causes a sort of deadlock because syslogd is waiting for aslmanager to respond, but aslmanager (via libxpc) is trying to talk to syslogd.
Unfortunately, syslogd still doesn't work as expected.
This fixes an error in libnotify that was making syslogd crash. `notify_client.c` was including `xpc/private.h` and trying to use `xpc_copy_entitlement_for_token`, which is declared in `launchd.h` and the compiler assumed a default return type of `int`, leading to the pointer returned by it being truncated and causing segfaults when it was used.
XPC bools and nulls were made into global to match their behavior in Apple's libxpc; users are allowed to compare XPC object pointers with the global XPC_BOOL_{TRUE,FALSE} constants, which are pointers to global variables, so this now allows that to work as expected.
xpc_pointer isn't documented *anywhere*, but it's used in Security. My best guess is that's it's just a pretty container for a pointer, which is fine for now, but I'll have to check the exact semantics later.
Unlike x86, there isn't an ARM specific implementation. Therefore, we need to rely on the generic implementation of OSAtomic. Since I have decided to rely on `libkern/OSAtomicDeprecated.h` for the time being, this header must be exposed to any function that uses (directly on indirectly) OSAtomic functions.
In particular:
* `xpc_string_create` needs to copy its input
* `xpc_data_create` needs to do the same
* `xpc_object_destroy` needs to free the memory copied into `xpc_string`s and `xpc_data`s
* `xpc_dictionary_set_value` needs to copy the key given to it
* `xpc_dictionary_destroy` needs to free the keys it copied
There's probably a few more, but these are the ones that popped up when I was fixing another library