]> git.saurik.com Git - apple/xnu.git/blobdiff - bsd/kern/sys_generic.c
xnu-3789.51.2.tar.gz
[apple/xnu.git] / bsd / kern / sys_generic.c
index bd8fd7c2291d3fe0593e30e02c5b85bb0e5b9c0b..2d1431763c7c23d2bce4e28d18f4f9386c3641a3 100644 (file)
@@ -1789,6 +1789,14 @@ poll_nocancel(struct proc *p, struct poll_nocancel_args *uap, int32_t *retval)
        if (nfds && (rfds == nfds))
                goto done;
 
+       /*
+        * If any events have trouble registering, an event has fired and we
+        * shouldn't wait for events in kqueue_scan -- use the current time as
+        * the deadline.
+        */
+       if (rfds)
+               getmicrouptime(&atv);
+
        /* scan for, and possibly wait for, the kevents to trigger */
        cont->pca_fds = uap->fds;
        cont->pca_nfds = nfds;
@@ -3164,9 +3172,11 @@ ledger(struct proc *p, struct ledger_args *args, __unused int32_t *retval)
                error = copyin(args->arg3, (char *)&len, sizeof (len));
        else if (args->cmd == LEDGER_TEMPLATE_INFO)
                error = copyin(args->arg2, (char *)&len, sizeof (len));
-#ifdef LEDGER_DEBUG
        else if (args->cmd == LEDGER_LIMIT)
+#ifdef LEDGER_DEBUG
                error = copyin(args->arg2, (char *)&lla, sizeof (lla));
+#else
+               return (EINVAL);
 #endif
        else if ((args->cmd < 0) || (args->cmd > LEDGER_MAX_CMD))
                return (EINVAL);