···11+#include "csops.h"
22+#include <stdint.h>
33+#include <sys/codesign.h>
44+#include "../duct_errno.h"
55+#include <strings.h>
66+77+// TODO: actually implement this
88+// this is just a dummy implementation for now that returns no actual data for any operation
99+long sys_csops(int pid, unsigned int ops, void* useraddr, size_t usersize) {
1010+ int ret = 0;
1111+1212+ switch (ops) {
1313+ case CS_OPS_STATUS: {
1414+ *(uint32_t*)useraddr = CS_VALID;
1515+ } break;
1616+1717+ case CS_OPS_BLOB:
1818+ case CS_OPS_ENTITLEMENTS_BLOB:
1919+ case CS_OPS_IDENTITY: {
2020+ memset(useraddr, 0, usersize);
2121+ } break;
2222+2323+ // all other operations are completely unsupported
2424+ default: {
2525+ ret = -1;
2626+ errno = ENOSYS;
2727+ } break;
2828+ }
2929+3030+ return ret;
3131+};