Print this page
OS-4937 lxbrand ptracer count updates can race
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Reviewed by: Joshua M. Clulow <jmc@joyent.com>
OS-2834 ship lx brand

@@ -19,10 +19,11 @@
  * CDDL HEADER END
  */
 
 /*
  * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2015 Joyent, Inc.
  */
 
 /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
 /*        All Rights Reserved   */
 

@@ -110,10 +111,22 @@
                 }
         }
         return (pidp);
 }
 
+struct pid *
+pid_find(pid_t pid)
+{
+        struct pid *pidp;
+
+        mutex_enter(&pidlinklock);
+        pidp = pid_lookup(pid);
+        mutex_exit(&pidlinklock);
+
+        return (pidp);
+}
+
 void
 pid_setmin(void)
 {
         if (jump_pid && jump_pid > mpid)
                 minpid = mpid = jump_pid;

@@ -519,10 +532,24 @@
         cv_signal(&pr_pid_cv[p->p_slot]);
         p->p_proc_flag &= ~P_PR_LOCK;
         mutex_exit(&p->p_lock);
         THREAD_KPRI_RELEASE();
 }
+
+/*
+ * Undo effects of sprlock but without dropping p->p_lock
+ */
+void
+sprunprlock(proc_t *p)
+{
+        ASSERT(p->p_proc_flag & P_PR_LOCK);
+        ASSERT(MUTEX_HELD(&p->p_lock));
+
+        cv_signal(&pr_pid_cv[p->p_slot]);
+        p->p_proc_flag &= ~P_PR_LOCK;
+        THREAD_KPRI_RELEASE();
+}
 
 void
 pid_init(void)
 {
         int i;