Back to index

glibc  2.9
procfs.h
Go to the documentation of this file.
00001 /* Copyright (C) 1999, 2000, 2003 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 
00033 __BEGIN_DECLS
00034 
00035 struct elf_siginfo
00036   {
00037     int si_signo;                  /* Signal number.  */
00038     int si_code;                   /* Extra code.  */
00039     int si_errno;                  /* Errno.  */
00040   };
00041 
00042 /* We really need just 72 but let's leave some headroom...  */
00043 #define ELF_NGREG    128
00044 /* f0 and f1 could be omitted, but so what...  */
00045 #define ELF_NFPREG   128
00046 
00047 typedef unsigned long elf_greg_t;
00048 typedef elf_greg_t elf_gregset_t[ELF_NGREG];
00049 
00050 typedef struct ia64_fpreg elf_fpreg_t;
00051 typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
00052 
00053 typedef elf_greg_t greg_t;
00054 typedef elf_gregset_t gregset_t;
00055 typedef elf_fpregset_t fpregset_t;
00056 #define NGREG ELF_NGREG
00057 
00058 /* Definitions to generate Intel SVR4-like core files.  These mostly
00059    have the same names as the SVR4 types with "elf_" tacked on the
00060    front to prevent clashes with linux definitions, and the typedef
00061    forms have been avoided.  This is mostly like the SVR4 structure,
00062    but more Linuxy, with things that Linux does not support and which
00063    gdb doesn't really use excluded.  Fields present but not used are
00064    marked with "XXX".  */
00065 struct elf_prstatus
00066   {
00067 #if 0
00068     long int pr_flags;                    /* XXX Process flags.  */
00069     short int pr_why;                     /* XXX Reason for process halt.  */
00070     short int pr_what;                    /* XXX More detailed reason.  */
00071 #endif
00072     struct elf_siginfo pr_info;           /* Info associated with signal.  */
00073     short int pr_cursig;           /* Current signal.  */
00074     unsigned long int pr_sigpend;  /* Set of pending signals.  */
00075     unsigned long int pr_sighold;  /* Set of held signals.  */
00076 #if 0
00077     struct sigaltstack pr_altstack;       /* Alternate stack info.  */
00078     struct sigaction pr_action;           /* Signal action for current sig.  */
00079 #endif
00080     __pid_t pr_pid;
00081     __pid_t pr_ppid;
00082     __pid_t pr_pgrp;
00083     __pid_t pr_sid;
00084     struct timeval pr_utime;              /* User time.  */
00085     struct timeval pr_stime;              /* System time.  */
00086     struct timeval pr_cutime;             /* Cumulative user time.  */
00087     struct timeval pr_cstime;             /* Cumulative system time.  */
00088 #if 0
00089     long int pr_instr;                    /* Current instruction.  */
00090 #endif
00091     elf_gregset_t pr_reg;          /* GP registers.  */
00092     int pr_fpvalid;                /* True if math copro being used.  */
00093   };
00094 
00095 
00096 #define ELF_PRARGSZ     (80)    /* Number of chars for args */
00097 
00098 struct elf_prpsinfo
00099   {
00100     char pr_state;                 /* Numeric process state.  */
00101     char pr_sname;                 /* Char for pr_state.  */
00102     char pr_zomb;                  /* Zombie.  */
00103     char pr_nice;                  /* Nice val.  */
00104     unsigned long int pr_flag;            /* Flags.  */
00105     unsigned int pr_uid;
00106     unsigned int pr_gid;
00107     int pr_pid, pr_ppid, pr_pgrp, pr_sid;
00108     /* Lots missing */
00109     char pr_fname[16];                    /* Filename of executable.  */
00110     char pr_psargs[ELF_PRARGSZ];   /* Initial part of arg list.  */
00111   };
00112 
00113 /* Addresses.  */
00114 typedef void *psaddr_t;
00115 
00116 /* Register sets.  Linux has different names.  */
00117 typedef gregset_t prgregset_t;
00118 typedef fpregset_t prfpregset_t;
00119 
00120 /* We don't have any differences between processes and threads,
00121    therefore habe only ine PID type.  */
00122 typedef __pid_t lwpid_t;
00123 
00124 
00125 typedef struct elf_prstatus prstatus_t;
00126 typedef struct elf_prpsinfo prpsinfo_t;
00127 
00128 __END_DECLS
00129 
00130 #endif /* sys/procfs.h */