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 2006 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26 /*
27 * Copyright 2012 DEY Storage Systems, Inc. All rights reserved.
28 * Copyright 2018 Joyent, Inc.
29 */
30
31 #ifndef _SYS_PROCFS_H
32 #define _SYS_PROCFS_H
33
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37
38 /*
39 * This definition is temporary. Structured proc is the preferred API,
40 * and the older ioctl-based interface will be removed in a future version
41 * of Solaris. Until then, by default, including <sys/procfs.h> will
42 * provide the older ioctl-based /proc definitions. To get the structured
43 * /proc definitions, either include <procfs.h> or define _STRUCTURED_PROC
44 * to be 1 before including <sys/procfs.h>.
45 */
46 #ifndef _STRUCTURED_PROC
47 #define _STRUCTURED_PROC 0
48 #endif
496 int pr_filler[1]; /* filler for future expansion */
497 } prasmap_t;
498
499 /*
500 * pr_npage bytes (plus 0-7 null bytes to round up to an 8-byte boundary)
501 * follow each mapping header, each containing zero or more of these flags.
502 */
503 #define PG_REFERENCED 0x02 /* page referenced since last read */
504 #define PG_MODIFIED 0x01 /* page modified since last read */
505 #define PG_HWMAPPED 0x04 /* page is present and mapped */
506
507 /*
508 * Open files. Only in core files (for now). Note that we'd like to use
509 * the stat or stat64 structure, but both of these structures are unfortunately
510 * not consistent between 32 and 64 bit modes. To keep our lives simpler, we
511 * just define our own structure with types that are not sensitive to this
512 * difference. Also, it turns out that pfiles omits a lot of info from the
513 * struct stat (e.g. times, device sizes, etc.) so we don't bother adding those
514 * here.
515 */
516 typedef struct prfdinfo {
517 int pr_fd;
518 mode_t pr_mode;
519
520 uid_t pr_uid;
521 gid_t pr_gid;
522
523 major_t pr_major; /* think stat.st_dev */
524 minor_t pr_minor;
525
526 major_t pr_rmajor; /* think stat.st_rdev */
527 minor_t pr_rminor;
528
529 ino64_t pr_ino;
530 off64_t pr_offset;
531 off64_t pr_size;
532
533 int pr_fileflags; /* fcntl(F_GETXFL), etc */
534 int pr_fdflags; /* fcntl(F_GETFD), etc. */
535
536 char pr_path[MAXPATHLEN];
537 } prfdinfo_t;
538
539 /*
540 * Representation of LWP name in core files. In /proc, we use a simple char
541 * array, but in core files we need to make it easy to correlate the note back
542 * to the right LWP. For simplicity, we'll use 32/64 consistent types.
543 */
544 typedef struct prlwpname {
545 uint64_t pr_lwpid;
546 char pr_lwpname[THREAD_NAME_MAX];
547 } prlwpname_t;
548
549 /*
550 * Header for /proc/<pid>/lstatus /proc/<pid>/lpsinfo /proc/<pid>/lusage
551 */
552 typedef struct prheader {
553 long pr_nent; /* number of entries */
554 long pr_entsize; /* size of each entry, in bytes */
555 } prheader_t;
556
557 /*
558 * Macros for manipulating sets of flags.
|
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 2006 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26 /*
27 * Copyright 2012 DEY Storage Systems, Inc. All rights reserved.
28 * Copyright 2018 Joyent, Inc.
29 * Copyright 2019 OmniOS Community Edition (OmniOSce) Association.
30 */
31
32 #ifndef _SYS_PROCFS_H
33 #define _SYS_PROCFS_H
34
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38
39 /*
40 * This definition is temporary. Structured proc is the preferred API,
41 * and the older ioctl-based interface will be removed in a future version
42 * of Solaris. Until then, by default, including <sys/procfs.h> will
43 * provide the older ioctl-based /proc definitions. To get the structured
44 * /proc definitions, either include <procfs.h> or define _STRUCTURED_PROC
45 * to be 1 before including <sys/procfs.h>.
46 */
47 #ifndef _STRUCTURED_PROC
48 #define _STRUCTURED_PROC 0
49 #endif
497 int pr_filler[1]; /* filler for future expansion */
498 } prasmap_t;
499
500 /*
501 * pr_npage bytes (plus 0-7 null bytes to round up to an 8-byte boundary)
502 * follow each mapping header, each containing zero or more of these flags.
503 */
504 #define PG_REFERENCED 0x02 /* page referenced since last read */
505 #define PG_MODIFIED 0x01 /* page modified since last read */
506 #define PG_HWMAPPED 0x04 /* page is present and mapped */
507
508 /*
509 * Open files. Only in core files (for now). Note that we'd like to use
510 * the stat or stat64 structure, but both of these structures are unfortunately
511 * not consistent between 32 and 64 bit modes. To keep our lives simpler, we
512 * just define our own structure with types that are not sensitive to this
513 * difference. Also, it turns out that pfiles omits a lot of info from the
514 * struct stat (e.g. times, device sizes, etc.) so we don't bother adding those
515 * here.
516 */
517 typedef struct prfdinfov1 {
518 int pr_fd;
519 mode_t pr_mode;
520
521 uid_t pr_uid;
522 gid_t pr_gid;
523
524 major_t pr_major; /* think stat.st_dev */
525 minor_t pr_minor;
526
527 major_t pr_rmajor; /* think stat.st_rdev */
528 minor_t pr_rminor;
529
530 ino64_t pr_ino;
531 off64_t pr_offset;
532 off64_t pr_size;
533
534 int pr_fileflags; /* fcntl(F_GETXFL), etc */
535 int pr_fdflags; /* fcntl(F_GETFD), etc. */
536
537 char pr_path[MAXPATHLEN];
538 } prfdinfov1_t;
539
540 typedef prfdinfov1_t prfdinfo_t;
541
542 typedef struct prfdinfov2 {
543 int pr_fd; /* file descriptor number */
544 mode_t pr_mode; /* (see st_mode in stat(2)) */
545 ino64_t pr_ino; /* inode number */
546 off64_t pr_size; /* file size */
547 off64_t pr_offset; /* current offset of file descriptor */
548 uid_t pr_uid; /* owner's user id */
549 gid_t pr_gid; /* owner's group id */
550 major_t pr_major; /* major number of device */
551 minor_t pr_minor; /* minor number of device */
552 major_t pr_rmajor; /* major number (if special file) */
553 minor_t pr_rminor; /* minor number (if special file) */
554 int pr_fileflags; /* (see F_GETXFL in fcntl(2)) */
555 int pr_fdflags; /* (see F_GETFD in fcntl(2)) */
556 short pr_locktype; /* (see F_GETLK in fcntl(2)) */
557 pid_t pr_lockpid; /* process holding file lock */
558 /* (see F_GETLK) */
559 int pr_locksysid; /* sysid of locking process */
560 /* (see F_GETLK) */
561 pid_t pr_peerpid; /* peer process (socket, door) */
562 int pr_filler[25]; /* reserved for future use */
563 char pr_peername[PRFNSZ]; /* peer process name */
564 #if __STDC_VERSION__ >= 199901L
565 char pr_misc[]; /* self describing structures */
566 #else
567 char pr_misc[1];
568 #endif
569 } prfdinfov2_t;
570
571 typedef struct pr_misc_header {
572 uint_t pr_misc_size;
573 uint_t pr_misc_type;
574 } pr_misc_header_t;
575
576 enum PR_MISC_TYPES
577 {
578 PR_PATHNAME,
579 PR_SOCKETNAME,
580 PR_PEERSOCKNAME,
581 PR_SOCKOPTS_BOOL_OPTS,
582 PR_SOCKOPT_LINGER,
583 PR_SOCKOPT_SNDBUF,
584 PR_SOCKOPT_RCVBUF,
585 PR_SOCKOPT_IP_NEXTHOP,
586 PR_SOCKOPT_IPV6_NEXTHOP,
587 PR_SOCKOPT_TYPE,
588 __UNIMPL_PR_SOCKOPT_LISTENQLIMIT,
589 PR_SOCKOPT_TCP_CONGESTION,
590 __UNIMPL_PR_SOCKOPT_FLOW_NAME,
591 __UNIMPL_PR_SOCKOPTS_PRIV,
592 PR_SOCKFILTERS_PRIV,
593 PR_MISC_TYPES_MAX
594 };
595
596 typedef struct prsockopts_bool_opts {
597 unsigned int prsock_bool_opts;
598 } prsockopts_bool_opts_t;
599
600 #define PR_SO_DEBUG (1 << 0)
601 #define PR_SO_REUSEADDR (1 << 1)
602 #define PR_SO_REUSEPORT (1 << 2)
603 #define PR_SO_KEEPALIVE (1 << 3)
604 #define PR_SO_DONTROUTE (1 << 4)
605 #define PR_SO_BROADCAST (1 << 5)
606 #define PR_SO_OOBINLINE (1 << 7)
607 #define PR_SO_DGRAM_ERRIND (1 << 8)
608 #define PR_SO_ALLZONES (1 << 9)
609 #define PR_SO_MAC_EXEMPT (1 << 10)
610 #define PR_SO_EXCLBIND (1 << 11)
611 #define PR_SO_PASSIVE_CONNECT (1 << 12)
612 #define PR_SO_ACCEPTCONN (1 << 13)
613 #define PR_UDP_NAT_T_ENDPOINT (1 << 14)
614 #define PR_SO_VRRP (1 << 15)
615 #define PR_SO_MAC_IMPLICIT (1 << 16)
616
617 /*
618 * Representation of LWP name in core files. In /proc, we use a simple char
619 * array, but in core files we need to make it easy to correlate the note back
620 * to the right LWP. For simplicity, we'll use 32/64 consistent types.
621 */
622 typedef struct prlwpname {
623 uint64_t pr_lwpid;
624 char pr_lwpname[THREAD_NAME_MAX];
625 } prlwpname_t;
626
627 /*
628 * Header for /proc/<pid>/lstatus /proc/<pid>/lpsinfo /proc/<pid>/lusage
629 */
630 typedef struct prheader {
631 long pr_nent; /* number of entries */
632 long pr_entsize; /* size of each entry, in bytes */
633 } prheader_t;
634
635 /*
636 * Macros for manipulating sets of flags.
|