X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/39236c6e673c41db228275375ab7fdb0f837b292..eee3565979933af707c711411001ba11fe406a3c:/libsyscall/wrappers/getiopolicy_np.c diff --git a/libsyscall/wrappers/getiopolicy_np.c b/libsyscall/wrappers/getiopolicy_np.c index 146fdac6d..583321622 100644 --- a/libsyscall/wrappers/getiopolicy_np.c +++ b/libsyscall/wrappers/getiopolicy_np.c @@ -22,8 +22,10 @@ */ #include #include +#include extern int __iopolicysys(int, struct _iopol_param_t *); +extern void _pthread_clear_qos_tsd(mach_port_t); int getiopolicy_np(int iotype, int scope) @@ -58,10 +60,17 @@ setiopolicy_np(int iotype, int scope, int policy) { /* kernel validates the indiv values, no need to repeat it */ struct _iopol_param_t iop_param; - + iop_param.iop_scope = scope; iop_param.iop_iotype = iotype; iop_param.iop_policy = policy; - return( __iopolicysys(IOPOL_CMD_SET, &iop_param)); + int rv = __iopolicysys(IOPOL_CMD_SET, &iop_param); + if (rv == -2) { + /* not an actual error but indication that __iopolicysys removed the thread QoS */ + _pthread_clear_qos_tsd(MACH_PORT_NULL); + rv = 0; + } + + return rv; }