Print this page
8158 Want named threads API
9857 proc manpages should have LIBRARY section


   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 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  */
  29 
  30 #ifndef _SYS_PROCFS_H
  31 #define _SYS_PROCFS_H
  32 
  33 #ifdef  __cplusplus
  34 extern "C" {
  35 #endif
  36 
  37 /*
  38  * This definition is temporary.  Structured proc is the preferred API,
  39  * and the older ioctl-based interface will be removed in a future version
  40  * of Solaris.  Until then, by default, including <sys/procfs.h> will
  41  * provide the older ioctl-based /proc definitions.  To get the structured
  42  * /proc definitions, either include <procfs.h> or define _STRUCTURED_PROC
  43  * to be 1 before including <sys/procfs.h>.
  44  */
  45 #ifndef _STRUCTURED_PROC
  46 #define _STRUCTURED_PROC        0
  47 #endif
  48 
  49 #if !defined(_KERNEL) && _STRUCTURED_PROC == 0
  50 
  51 #include <sys/old_procfs.h>
  52 
  53 #else   /* !defined(_KERNEL) && _STRUCTURED_PROC == 0 */
  54 
  55 #include <sys/feature_tests.h>
  56 #include <sys/types.h>
  57 #include <sys/time_impl.h>
  58 #include <sys/signal.h>
  59 #include <sys/siginfo.h>
  60 #include <sys/fault.h>
  61 #include <sys/syscall.h>
  62 #include <sys/pset.h>
  63 #include <sys/procfs_isa.h>
  64 #include <sys/priv.h>
  65 #include <sys/stat.h>
  66 #include <sys/param.h>
  67 #include <sys/secflags.h>

  68 
  69 /*
  70  * System call interfaces for /proc.
  71  */
  72 
  73 /*
  74  * Control codes (long values) for messages written to ctl and lwpctl files.
  75  */
  76 #define PCNULL   0L     /* null request, advance to next message */
  77 #define PCSTOP   1L     /* direct process or lwp to stop and wait for stop */
  78 #define PCDSTOP  2L     /* direct process or lwp to stop */
  79 #define PCWSTOP  3L     /* wait for process or lwp to stop, no timeout */
  80 #define PCTWSTOP 4L     /* wait for stop, with long millisecond timeout arg */
  81 #define PCRUN    5L     /* make process/lwp runnable, w/ long flags argument */
  82 #define PCCSIG   6L     /* clear current signal from lwp */
  83 #define PCCFAULT 7L     /* clear current fault from lwp */
  84 #define PCSSIG   8L     /* set current signal from siginfo_t argument */
  85 #define PCKILL   9L     /* post a signal to process/lwp, long argument */
  86 #define PCUNKILL 10L    /* delete a pending signal from process/lwp, long arg */
  87 #define PCSHOLD  11L    /* set lwp signal mask from sigset_t argument */


 518         uid_t           pr_uid;
 519         gid_t           pr_gid;
 520 
 521         major_t         pr_major;       /* think stat.st_dev */
 522         minor_t         pr_minor;
 523 
 524         major_t         pr_rmajor;      /* think stat.st_rdev */
 525         minor_t         pr_rminor;
 526 
 527         ino64_t         pr_ino;
 528         off64_t         pr_offset;
 529         off64_t         pr_size;
 530 
 531         int             pr_fileflags;   /* fcntl(F_GETXFL), etc */
 532         int             pr_fdflags;     /* fcntl(F_GETFD), etc. */
 533 
 534         char            pr_path[MAXPATHLEN];
 535 } prfdinfo_t;
 536 
 537 /*










 538  * Header for /proc/<pid>/lstatus /proc/<pid>/lpsinfo /proc/<pid>/lusage
 539  */
 540 typedef struct prheader {
 541         long    pr_nent;        /* number of entries */
 542         long    pr_entsize;     /* size of each entry, in bytes */
 543 } prheader_t;
 544 
 545 /*
 546  * Macros for manipulating sets of flags.
 547  * sp must be a pointer to one of sigset_t, fltset_t, or sysset_t.
 548  * flag must be a member of the enumeration corresponding to *sp.
 549  */
 550 
 551 /* turn on all flags in set */
 552 #define prfillset(sp) \
 553         { register int _i_ = sizeof (*(sp))/sizeof (uint32_t); \
 554                 while (_i_) ((uint32_t *)(sp))[--_i_] = (uint32_t)0xFFFFFFFF; }
 555 
 556 /* turn off all flags in set */
 557 #define premptyset(sp) \




   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 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
  49 
  50 #if !defined(_KERNEL) && _STRUCTURED_PROC == 0
  51 
  52 #include <sys/old_procfs.h>
  53 
  54 #else   /* !defined(_KERNEL) && _STRUCTURED_PROC == 0 */
  55 
  56 #include <sys/feature_tests.h>
  57 #include <sys/types.h>
  58 #include <sys/time_impl.h>
  59 #include <sys/signal.h>
  60 #include <sys/siginfo.h>
  61 #include <sys/fault.h>
  62 #include <sys/syscall.h>
  63 #include <sys/pset.h>
  64 #include <sys/procfs_isa.h>
  65 #include <sys/priv.h>
  66 #include <sys/stat.h>
  67 #include <sys/param.h>
  68 #include <sys/secflags.h>
  69 #include <sys/thread.h>
  70 
  71 /*
  72  * System call interfaces for /proc.
  73  */
  74 
  75 /*
  76  * Control codes (long values) for messages written to ctl and lwpctl files.
  77  */
  78 #define PCNULL   0L     /* null request, advance to next message */
  79 #define PCSTOP   1L     /* direct process or lwp to stop and wait for stop */
  80 #define PCDSTOP  2L     /* direct process or lwp to stop */
  81 #define PCWSTOP  3L     /* wait for process or lwp to stop, no timeout */
  82 #define PCTWSTOP 4L     /* wait for stop, with long millisecond timeout arg */
  83 #define PCRUN    5L     /* make process/lwp runnable, w/ long flags argument */
  84 #define PCCSIG   6L     /* clear current signal from lwp */
  85 #define PCCFAULT 7L     /* clear current fault from lwp */
  86 #define PCSSIG   8L     /* set current signal from siginfo_t argument */
  87 #define PCKILL   9L     /* post a signal to process/lwp, long argument */
  88 #define PCUNKILL 10L    /* delete a pending signal from process/lwp, long arg */
  89 #define PCSHOLD  11L    /* set lwp signal mask from sigset_t argument */


 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.
 559  * sp must be a pointer to one of sigset_t, fltset_t, or sysset_t.
 560  * flag must be a member of the enumeration corresponding to *sp.
 561  */
 562 
 563 /* turn on all flags in set */
 564 #define prfillset(sp) \
 565         { register int _i_ = sizeof (*(sp))/sizeof (uint32_t); \
 566                 while (_i_) ((uint32_t *)(sp))[--_i_] = (uint32_t)0xFFFFFFFF; }
 567 
 568 /* turn off all flags in set */
 569 #define premptyset(sp) \