]> git.saurik.com Git - apple/xnu.git/blobdiff - libsyscall/wrappers/work_interval.c
xnu-7195.81.3.tar.gz
[apple/xnu.git] / libsyscall / wrappers / work_interval.c
index 643c68173073518b00577da49c5e9bca640dbcdc..89d2d0cce907c0321fbbfa3e21a4f00c597906f3 100644 (file)
@@ -78,6 +78,26 @@ work_interval_create(work_interval_t *interval_handle, uint32_t create_flags)
        return 0;
 }
 
+int
+work_interval_get_flags_from_port(mach_port_t port, uint32_t *flags)
+{
+       if (!MACH_PORT_VALID(port) || flags == NULL) {
+               errno = EINVAL;
+               return -1;
+       }
+
+       struct work_interval_create_params create_params = { 0 };
+
+       int ret = __work_interval_ctl(WORK_INTERVAL_OPERATION_GET_FLAGS, port,
+           &create_params, sizeof(create_params));
+       if (ret == -1) {
+               return ret;
+       }
+
+       *flags = create_params.wicp_create_flags;
+       return 0;
+}
+
 int
 work_interval_notify(work_interval_t interval_handle, uint64_t start,
     uint64_t finish, uint64_t deadline, uint64_t next_start,
@@ -98,6 +118,10 @@ work_interval_notify(work_interval_t interval_handle, uint64_t start,
                return -1;
        }
 
+       if (interval_handle->create_flags & WORK_INTERVAL_FLAG_IGNORED) {
+               return 0;
+       }
+
        notification.create_flags = interval_handle->create_flags;
        work_interval_id = interval_handle->work_interval_id;