Back to index

glibc  2.9
procfs.h
Go to the documentation of this file.
00001 /* Copyright (C) 1996, 1997, 1999, 2002, 2006 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 /* These definitions are normally provided by ucontext.h via 
00036    asm/sigcontext.h, asm/ptrace.h, and asm/elf.h.  Otherwise we define 
00037    them here.  */ 
00038 #if !defined __PPC64_ELF_H && !defined _ASM_POWERPC_ELF_H
00039 #define ELF_NGREG       48      /* includes nip, msr, lr, etc. */
00040 #define ELF_NFPREG      33      /* includes fpscr */
00041 #if __WORDSIZE == 32
00042 # define ELF_NVRREG      33      /* includes vscr */
00043 #else
00044 # define ELF_NVRREG      34      /* includes vscr */
00045 #endif
00046 
00047 typedef unsigned long elf_greg_t;
00048 typedef elf_greg_t elf_gregset_t[ELF_NGREG];
00049 
00050 typedef double elf_fpreg_t;
00051 typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
00052 
00053 /* Altivec registers */
00054 typedef struct {
00055   unsigned int u[4];
00056 } __attribute__ ((aligned (16))) elf_vrreg_t;
00057 typedef elf_vrreg_t elf_vrregset_t[ELF_NVRREG];
00058 #endif
00059 
00060 struct elf_siginfo
00061   {
00062     int si_signo;                  /* Signal number.  */
00063     int si_code;                   /* Extra code.  */
00064     int si_errno;                  /* Errno.  */
00065   };
00066 
00067 
00068 /* Definitions to generate Intel SVR4-like core files.  These mostly
00069    have the same names as the SVR4 types with "elf_" tacked on the
00070    front to prevent clashes with linux definitions, and the typedef
00071    forms have been avoided.  This is mostly like the SVR4 structure,
00072    but more Linuxy, with things that Linux does not support and which
00073    gdb doesn't really use excluded.  Fields present but not used are
00074    marked with "XXX".  */
00075 struct elf_prstatus
00076   {
00077 #if 0
00078     long int pr_flags;                    /* XXX Process flags.  */
00079     short int pr_why;                     /* XXX Reason for process halt.  */
00080     short int pr_what;                    /* XXX More detailed reason.  */
00081 #endif
00082     struct elf_siginfo pr_info;           /* Info associated with signal.  */
00083     short int pr_cursig;           /* Current signal.  */
00084     unsigned long int pr_sigpend;  /* Set of pending signals.  */
00085     unsigned long int pr_sighold;  /* Set of held signals.  */
00086 #if 0
00087     struct sigaltstack pr_altstack;       /* Alternate stack info.  */
00088     struct sigaction pr_action;           /* Signal action for current sig.  */
00089 #endif
00090     __pid_t pr_pid;
00091     __pid_t pr_ppid;
00092     __pid_t pr_pgrp;
00093     __pid_t pr_sid;
00094     struct timeval pr_utime;              /* User time.  */
00095     struct timeval pr_stime;              /* System time.  */
00096     struct timeval pr_cutime;             /* Cumulative user time.  */
00097     struct timeval pr_cstime;             /* Cumulative system time.  */
00098 #if 0
00099     long int pr_instr;                    /* Current instruction.  */
00100 #endif
00101     elf_gregset_t pr_reg;          /* GP registers.  */
00102     int pr_fpvalid;                /* True if math copro being used.  */
00103   };
00104 
00105 
00106 #define ELF_PRARGSZ     (80)    /* Number of chars for args */
00107 
00108 struct elf_prpsinfo
00109   {
00110     char pr_state;                 /* Numeric process state.  */
00111     char pr_sname;                 /* Char for pr_state.  */
00112     char pr_zomb;                  /* Zombie.  */
00113     char pr_nice;                  /* Nice val.  */
00114     unsigned long int pr_flag;            /* Flags.  */
00115     __uid_t pr_uid;
00116     __gid_t pr_gid;
00117     __pid_t pr_pid, pr_ppid, pr_pgrp, pr_sid;
00118     /* Lots missing */
00119     char pr_fname[16];                    /* Filename of executable.  */
00120     char pr_psargs[ELF_PRARGSZ];   /* Initial part of arg list.  */
00121   };
00122 
00123 /* Addresses.  */
00124 typedef void *psaddr_t;
00125 
00126 /* Register sets.  Linux has different names.  */
00127 typedef elf_gregset_t prgregset_t;
00128 typedef elf_fpregset_t prfpregset_t;
00129 
00130 /* We don't have any differences between processes and threads,
00131    therefore habe only ine PID type.  */
00132 typedef __pid_t lwpid_t;
00133 
00134 
00135 typedef struct elf_prstatus prstatus_t;
00136 typedef struct elf_prpsinfo prpsinfo_t;
00137 
00138 __END_DECLS
00139 
00140 #endif /* sys/procfs.h */