Back to index

glibc  2.9
procfs.h
Go to the documentation of this file.
00001 /* Copyright (C) 2000, 2001, 2002 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 somewhat modelled after the file of the same name on SVR4
00023    systems.  It provides a definition of the core file format for ELF
00024    used on Linux.  It doesn't have anything to do with the /proc file
00025    system, even though Linux has one.
00026 
00027    Anyway, the whole purpose of this file is for GDB and GDB only.
00028    Don't read too much into it.  Don't use it for anything other than
00029    GDB unless you know what you are doing.  */
00030 
00031 #include <features.h>
00032 #include <sys/time.h>
00033 #include <sys/types.h>
00034 #include <sys/user.h>
00035 #include <sys/ucontext.h>
00036 
00037 __BEGIN_DECLS
00038 
00039 typedef greg_t elf_greg_t;
00040 #define ELF_NGREG NGREG
00041 typedef gregset_t elf_gregset_t;
00042 typedef fpreg_t   elf_fpreg_t;
00043 typedef fpregset_t elf_fpregset_t;
00044 
00045 /* Signal info.  */
00046 struct elf_siginfo
00047   {
00048     int si_signo;                  /* Signal number.  */
00049     int si_code;                   /* Extra code.  */
00050     int si_errno;                  /* Errno.  */
00051   };
00052 
00053 
00054 /* Definitions to generate Intel SVR4-like core files.  These mostly
00055    have the same names as the SVR4 types with "elf_" tacked on the
00056    front to prevent clashes with Linux definitions, and the typedef
00057    forms have been avoided.  This is mostly like the SVR4 structure,
00058    but more Linuxy, with things that Linux does not support and which
00059    GDB doesn't really use excluded.  */
00060 
00061 struct elf_prstatus
00062   {
00063     struct elf_siginfo pr_info;           /* Info associated with signal.  */
00064     short int pr_cursig;           /* Current signal.  */
00065     unsigned long int pr_sigpend;  /* Set of pending signals.  */
00066     unsigned long int pr_sighold;  /* Set of held signals.  */
00067     __pid_t pr_pid;
00068     __pid_t pr_ppid;
00069     __pid_t pr_pgrp;
00070     __pid_t pr_sid;
00071     struct timeval pr_utime;              /* User time.  */
00072     struct timeval pr_stime;              /* System time.  */
00073     struct timeval pr_cutime;             /* Cumulative user time.  */
00074     struct timeval pr_cstime;             /* Cumulative system time.  */
00075     elf_gregset_t pr_reg;          /* GP registers.  */
00076     int pr_fpvalid;                /* True if math copro being used.  */
00077   };
00078 
00079 
00080 #define ELF_PRARGSZ     (80)    /* Number of chars for args.  */
00081 
00082 struct elf_prpsinfo
00083   {
00084     char pr_state;                 /* Numeric process state.  */
00085     char pr_sname;                 /* Char for pr_state.  */
00086     char pr_zomb;                  /* Zombie.  */
00087     char pr_nice;                  /* Nice val.  */
00088     unsigned long int pr_flag;            /* Flags.  */
00089 #if __WORDSIZE == 64
00090     unsigned int pr_uid;
00091     unsigned int pr_gid;
00092 #else
00093     unsigned short int pr_uid;
00094     unsigned short int pr_gid;
00095 #endif
00096     int pr_pid, pr_ppid, pr_pgrp, pr_sid;
00097     /* Lots missing */
00098     char pr_fname[16];                    /* Filename of executable.  */
00099     char pr_psargs[ELF_PRARGSZ];   /* Initial part of arg list.  */
00100   };
00101 
00102 /* The rest of this file provides the types for emulation of the
00103    Solaris <proc_service.h> interfaces that should be implemented by
00104    users of libthread_db.  */
00105 
00106 /* Addresses.  */
00107 typedef void *psaddr_t;
00108 
00109 /* Register sets.  Linux has different names.  */
00110 typedef elf_gregset_t prgregset_t;
00111 typedef elf_fpregset_t prfpregset_t;
00112 
00113 /* We don't have any differences between processes and threads,
00114    therefore have only one PID type.  */
00115 typedef __pid_t lwpid_t;
00116 
00117 /* Process status and info.  In the end we do provide typedefs for them.  */
00118 typedef struct elf_prstatus prstatus_t;
00119 typedef struct elf_prpsinfo prpsinfo_t;
00120 
00121 #if __WORDSIZE == 64
00122 
00123 /* Provide 32-bit variants so that BFD can read 32-bit
00124    core files.  */
00125 #define ELF_NGREG32  36
00126 typedef unsigned int elf_greg_t32;
00127 typedef elf_greg_t32 elf_gregset_t32[ELF_NGREG32];
00128 typedef elf_fpregset_t elf_fpregset_t32;
00129 
00130 struct elf_prstatus32
00131   {
00132     struct elf_siginfo pr_info;           /* Info associated with signal.  */
00133     short int pr_cursig;           /* Current signal.  */
00134     unsigned int pr_sigpend;       /* Set of pending signals.  */
00135     unsigned int pr_sighold;       /* Set of held signals.  */
00136     __pid_t pr_pid;
00137     __pid_t pr_ppid;
00138     __pid_t pr_pgrp;
00139     __pid_t pr_sid;
00140     struct
00141       {
00142        int tv_sec, tv_usec;
00143       } pr_utime,                  /* User time.  */
00144         pr_stime,                  /* System time.  */
00145         pr_cutime,                 /* Cumulative user time.  */
00146         pr_cstime;                 /* Cumulative system time.  */
00147     elf_gregset_t32 pr_reg;        /* GP registers.  */
00148     int pr_fpvalid;                /* True if math copro being used.  */
00149   };
00150 
00151 struct elf_prpsinfo32
00152   {
00153     char pr_state;                 /* Numeric process state.  */
00154     char pr_sname;                 /* Char for pr_state.  */
00155     char pr_zomb;                  /* Zombie.  */
00156     char pr_nice;                  /* Nice val.  */
00157     unsigned int pr_flag;          /* Flags.  */
00158     unsigned short int pr_uid;
00159     unsigned short int pr_gid;
00160     int pr_pid, pr_ppid, pr_pgrp, pr_sid;
00161     /* Lots missing */
00162     char pr_fname[16];                    /* Filename of executable.  */
00163     char pr_psargs[ELF_PRARGSZ];   /* Initial part of arg list.  */
00164   };
00165 
00166 typedef elf_gregset_t32 prgregset32_t;
00167 typedef elf_fpregset_t32 prfpregset32_t;
00168 
00169 typedef struct elf_prstatus32 prstatus32_t;
00170 typedef struct elf_prpsinfo32 prpsinfo32_t;
00171 
00172 #endif
00173 
00174 __END_DECLS
00175 
00176 #endif /* sys/procfs.h */