Print this page
XXXX adding PID information to netstat output

@@ -121,10 +121,12 @@
         flag &= ~FCREAT;                /* paranoia */
         mutex_enter(&so->so_lock);
         so->so_count++;
         mutex_exit(&so->so_lock);
 
+        sonode_insert_pid(so, curproc);
+
         ASSERT(so->so_count != 0);      /* wraparound */
         ASSERT(vp->v_type == VSOCK);
 
         return (0);
 }

@@ -207,10 +209,26 @@
 {
         struct sonode *so = VTOSO(vp);
 
         ASSERT(vp->v_type == VSOCK);
 
+        switch (cmd) {
+                case F_FORKED: {
+                        if (cr != kcred)
+                                return (-1);
+                        sonode_insert_pid(so, (proc_t *)arg);
+                        return (0);
+                }
+
+                case F_CLOSED: {
+                        if (cr != kcred)
+                                return (-1);
+                        sonode_remove_pid(so, (proc_t *)arg);
+                        return (0);
+                }
+        }
+
         return (socket_ioctl(so, cmd, arg, mode, cr, rvalp));
 }
 
 /*
  * Allow any flags. Record FNDELAY and FNONBLOCK so that they can be inherited