Back to index

glibc  2.9
procfs.h
Go to the documentation of this file.
00001 /* Copyright (C) 1996, 1997, 1999, 2000 Free Software Foundation, Inc.
00002    This file is part of the GNU C Library.
00003 
00004    The GNU C Library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Lesser General Public
00006    License as published by the Free Software Foundation; either
00007    version 2.1 of the License, or (at your option) any later version.
00008 
00009    The GNU C Library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Lesser General Public License for more details.
00013 
00014    You should have received a copy of the GNU Lesser General Public
00015    License along with the GNU C Library; if not, write to the Free
00016    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00017    02111-1307 USA.  */
00018 
00019 #ifndef _SYS_PROCFS_H
00020 #define _SYS_PROCFS_H       1
00021 
00022 /* This is somehow modelled after the file of the same name on SysVr4
00023    systems.  It provides a definition of the core file format for ELF
00024    used on Linux.  */
00025 
00026 #include <features.h>
00027 #include <signal.h>
00028 #include <sys/time.h>
00029 #include <sys/types.h>
00030 #include <sys/ucontext.h>
00031 #include <sys/user.h>
00032 #include <bits/wordsize.h>
00033 
00034 __BEGIN_DECLS
00035 
00036 #if __WORDSIZE == 64
00037 
00038 #define ELF_NGREG           36
00039 
00040 typedef struct
00041   {
00042     unsigned long    pr_regs[32];
00043     unsigned long    pr_fsr;
00044     unsigned long    pr_gsr;
00045     unsigned long    pr_fprs;
00046   } elf_fpregset_t;
00047 
00048 #else /* sparc32 */
00049 
00050 #define ELF_NGREG           38
00051 
00052 typedef struct
00053   {
00054     union
00055       {
00056        unsigned long pr_regs[32];
00057        double        pr_dregs[16];
00058       }                     pr_fr;
00059     unsigned long    __unused;
00060     unsigned long    pr_fsr;
00061     unsigned char    pr_qcnt;
00062     unsigned char    pr_q_entrysize;
00063     unsigned char    pr_en;
00064     unsigned int     pr_q[64];
00065   } elf_fpregset_t;
00066 
00067 #endif /* sparc32 */
00068 
00069 typedef unsigned long elf_greg_t;
00070 typedef elf_greg_t elf_gregset_t[ELF_NGREG];
00071 
00072 struct elf_siginfo
00073   {
00074     int si_signo;                  /* Signal number.  */
00075     int si_code;                   /* Extra code.  */
00076     int si_errno;                  /* Errno.  */
00077   };
00078 
00079 /* Definitions to generate Intel SVR4-like core files.  These mostly
00080    have the same names as the SVR4 types with "elf_" tacked on the
00081    front to prevent clashes with linux definitions, and the typedef
00082    forms have been avoided.  This is mostly like the SVR4 structure,
00083    but more Linuxy, with things that Linux does not support and which
00084    gdb doesn't really use excluded.  Fields present but not used are
00085    marked with "XXX".  */
00086 struct elf_prstatus
00087   {
00088     struct elf_siginfo pr_info;           /* Info associated with signal.  */
00089     short int pr_cursig;           /* Current signal.  */
00090     unsigned long int pr_sigpend;  /* Set of pending signals.  */
00091     unsigned long int pr_sighold;  /* Set of held signals.  */
00092     __pid_t pr_pid;
00093     __pid_t pr_ppid;
00094     __pid_t pr_pgrp;
00095     __pid_t pr_sid;
00096     struct timeval pr_utime;              /* User time.  */
00097     struct timeval pr_stime;              /* System time.  */
00098     struct timeval pr_cutime;             /* Cumulative user time.  */
00099     struct timeval pr_cstime;             /* Cumulative system time.  */
00100     elf_gregset_t pr_reg;          /* GP registers.  */
00101     int pr_fpvalid;                /* True if math copro being used.  */
00102   };
00103 
00104 
00105 #define ELF_PRARGSZ     (80)    /* Number of chars for args */
00106 
00107 struct elf_prpsinfo
00108   {
00109     char pr_state;                 /* Numeric process state.  */
00110     char pr_sname;                 /* Char for pr_state.  */
00111     char pr_zomb;                  /* Zombie.  */
00112     char pr_nice;                  /* Nice val.  */
00113     unsigned long int pr_flag;            /* Flags.  */
00114 #if __WORDSIZE == 64
00115     unsigned int pr_uid;
00116     unsigned int pr_gid;
00117 #else
00118     unsigned short int pr_uid;
00119     unsigned short int pr_gid;
00120 #endif
00121     int pr_pid, pr_ppid, pr_pgrp, pr_sid;
00122     /* Lots missing */
00123     char pr_fname[16];                    /* Filename of executable.  */
00124     char pr_psargs[ELF_PRARGSZ];   /* Initial part of arg list.  */
00125   };
00126 
00127 /* Addresses.  */
00128 typedef void *psaddr_t;
00129 
00130 /* Register sets.  Linux has different names.  */
00131 typedef elf_gregset_t prgregset_t;
00132 typedef elf_fpregset_t prfpregset_t;
00133 
00134 /* We don't have any differences between processes and threads,
00135    therefore have only one PID type.  */
00136 typedef __pid_t lwpid_t;
00137 
00138 
00139 typedef struct elf_prstatus prstatus_t;
00140 typedef struct elf_prpsinfo prpsinfo_t;
00141 
00142 #if __WORDSIZE == 64
00143 
00144 /* Provide 32-bit variants so that BFD can read 32-bit
00145    core files.  */
00146 #define ELF_NGREG32         38
00147 typedef struct
00148   {
00149     union
00150       {
00151        unsigned int  pr_regs[32];
00152        double        pr_dregs[16];
00153       }                     pr_fr;
00154     unsigned int     __unused;
00155     unsigned int     pr_fsr;
00156     unsigned char    pr_qcnt;
00157     unsigned char    pr_q_entrysize;
00158     unsigned char    pr_en;
00159     unsigned int     pr_q[64];
00160   } elf_fpregset_t32;
00161 
00162 typedef unsigned int elf_greg_t32;
00163 typedef elf_greg_t32 elf_gregset_t32[ELF_NGREG32];
00164 
00165 struct elf_prstatus32
00166   {
00167     struct elf_siginfo pr_info;           /* Info associated with signal.  */
00168     short int pr_cursig;           /* Current signal.  */
00169     unsigned int pr_sigpend;       /* Set of pending signals.  */
00170     unsigned int pr_sighold;       /* Set of held signals.  */
00171     __pid_t pr_pid;
00172     __pid_t pr_ppid;
00173     __pid_t pr_pgrp;
00174     __pid_t pr_sid;
00175     struct
00176       {
00177        int tv_sec, tv_usec;
00178       } pr_utime,                  /* User time.  */
00179         pr_stime,                  /* System time.  */
00180         pr_cutime,                 /* Cumulative user time.  */
00181         pr_cstime;                 /* Cumulative system time.  */
00182     elf_gregset_t32 pr_reg;        /* GP registers.  */
00183     int pr_fpvalid;                /* True if math copro being used.  */
00184   };
00185 
00186 struct elf_prpsinfo32
00187   {
00188     char pr_state;                 /* Numeric process state.  */
00189     char pr_sname;                 /* Char for pr_state.  */
00190     char pr_zomb;                  /* Zombie.  */
00191     char pr_nice;                  /* Nice val.  */
00192     unsigned int pr_flag;          /* Flags.  */
00193     unsigned short int pr_uid;
00194     unsigned short int pr_gid;
00195     int pr_pid, pr_ppid, pr_pgrp, pr_sid;
00196     /* Lots missing */
00197     char pr_fname[16];                    /* Filename of executable.  */
00198     char pr_psargs[ELF_PRARGSZ];   /* Initial part of arg list.  */
00199   };
00200 
00201 typedef elf_gregset_t32 prgregset32_t;
00202 typedef elf_fpregset_t32 prfpregset32_t;
00203 
00204 typedef struct elf_prstatus32 prstatus32_t;
00205 typedef struct elf_prpsinfo32 prpsinfo32_t;
00206 
00207 #endif  /* sparc64 */
00208 
00209 __END_DECLS
00210 
00211 #endif /* sys/procfs.h */