7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright (c) 1994, 2010, Oracle and/or its affiliates. All rights reserved.
  24  * Copyright 2012 DEY Storage Systems, Inc.  All rights reserved.
  25  */
  26 /*
  27  * Copyright (c) 2013 Joyent, Inc.  All Rights reserved.
  28  */
  29 
  30 #include <stdio.h>
  31 #include <stdlib.h>
  32 #include <unistd.h>
  33 #include <fcntl.h>
  34 #include <ctype.h>
  35 #include <string.h>
  36 #include <signal.h>
  37 #include <dirent.h>
  38 #include <limits.h>
  39 #include <door.h>
  40 #include <sys/types.h>
  41 #include <sys/socket.h>
  42 #include <sys/stat.h>
  43 #include <sys/mkdev.h>
  44 #include <sys/stropts.h>
  45 #include <sys/timod.h>
  46 #include <sys/un.h>
  47 #include <libproc.h>
 
 
 539         case AF_CHAOS:          p = "AF_CHAOS";         break;
 540         case AF_NS:             p = "AF_NS";            break;
 541         case AF_NBS:            p = "AF_NBS";           break;
 542         case AF_ECMA:           p = "AF_ECMA";          break;
 543         case AF_DATAKIT:        p = "AF_DATAKIT";       break;
 544         case AF_CCITT:          p = "AF_CCITT";         break;
 545         case AF_SNA:            p = "AF_SNA";           break;
 546         case AF_DECnet:         p = "AF_DECnet";        break;
 547         case AF_DLI:            p = "AF_DLI";           break;
 548         case AF_LAT:            p = "AF_LAT";           break;
 549         case AF_HYLINK:         p = "AF_HYLINK";        break;
 550         case AF_APPLETALK:      p = "AF_APPLETALK";     break;
 551         case AF_NIT:            p = "AF_NIT";           break;
 552         case AF_802:            p = "AF_802";           break;
 553         case AF_OSI:            p = "AF_OSI";           break;
 554         case AF_X25:            p = "AF_X25";           break;
 555         case AF_OSINET:         p = "AF_OSINET";        break;
 556         case AF_GOSIP:          p = "AF_GOSIP";         break;
 557         case AF_IPX:            p = "AF_IPX";           break;
 558         case AF_ROUTE:          p = "AF_ROUTE";         break;
 559         case AF_LINK:           p = "AF_LINK";          break;
 560         }
 561 
 562         (void) printf("\t%s: %s\n", str, p);
 563 }
 564 
 565 /*
 566  * Print out the process information for the other end of local sockets
 567  * and fifos
 568  */
 569 static void
 570 show_ucred(const char *str, ucred_t *cred)
 571 {
 572         pid_t upid = ucred_getpid(cred);
 573         zoneid_t uzid = ucred_getzoneid(cred);
 574         char zonename[ZONENAME_MAX];
 575 
 576         if ((upid != -1) || (uzid != -1)) {
 577                 (void) printf("\t%s:", str);
 578                 if (upid != -1) {
 
 | 
 
 
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright (c) 1994, 2010, Oracle and/or its affiliates. All rights reserved.
  24  * Copyright 2012 DEY Storage Systems, Inc.  All rights reserved.
  25  */
  26 /*
  27  * Copyright (c) 2017 Joyent, Inc.  All Rights reserved.
  28  */
  29 
  30 #include <stdio.h>
  31 #include <stdlib.h>
  32 #include <unistd.h>
  33 #include <fcntl.h>
  34 #include <ctype.h>
  35 #include <string.h>
  36 #include <signal.h>
  37 #include <dirent.h>
  38 #include <limits.h>
  39 #include <door.h>
  40 #include <sys/types.h>
  41 #include <sys/socket.h>
  42 #include <sys/stat.h>
  43 #include <sys/mkdev.h>
  44 #include <sys/stropts.h>
  45 #include <sys/timod.h>
  46 #include <sys/un.h>
  47 #include <libproc.h>
 
 
 539         case AF_CHAOS:          p = "AF_CHAOS";         break;
 540         case AF_NS:             p = "AF_NS";            break;
 541         case AF_NBS:            p = "AF_NBS";           break;
 542         case AF_ECMA:           p = "AF_ECMA";          break;
 543         case AF_DATAKIT:        p = "AF_DATAKIT";       break;
 544         case AF_CCITT:          p = "AF_CCITT";         break;
 545         case AF_SNA:            p = "AF_SNA";           break;
 546         case AF_DECnet:         p = "AF_DECnet";        break;
 547         case AF_DLI:            p = "AF_DLI";           break;
 548         case AF_LAT:            p = "AF_LAT";           break;
 549         case AF_HYLINK:         p = "AF_HYLINK";        break;
 550         case AF_APPLETALK:      p = "AF_APPLETALK";     break;
 551         case AF_NIT:            p = "AF_NIT";           break;
 552         case AF_802:            p = "AF_802";           break;
 553         case AF_OSI:            p = "AF_OSI";           break;
 554         case AF_X25:            p = "AF_X25";           break;
 555         case AF_OSINET:         p = "AF_OSINET";        break;
 556         case AF_GOSIP:          p = "AF_GOSIP";         break;
 557         case AF_IPX:            p = "AF_IPX";           break;
 558         case AF_ROUTE:          p = "AF_ROUTE";         break;
 559         case AF_KEY:            p = "AF_KEY";           break;
 560         case AF_POLICY:         p = "AF_POLICY";        break;
 561         case AF_LINK:           p = "AF_LINK";          break;
 562         }
 563 
 564         (void) printf("\t%s: %s\n", str, p);
 565 }
 566 
 567 /*
 568  * Print out the process information for the other end of local sockets
 569  * and fifos
 570  */
 571 static void
 572 show_ucred(const char *str, ucred_t *cred)
 573 {
 574         pid_t upid = ucred_getpid(cred);
 575         zoneid_t uzid = ucred_getzoneid(cred);
 576         char zonename[ZONENAME_MAX];
 577 
 578         if ((upid != -1) || (uzid != -1)) {
 579                 (void) printf("\t%s:", str);
 580                 if (upid != -1) {
 
 |