Back to index

glibc  2.9
procfs.h
Go to the documentation of this file.
00001 /* Copyright (C) 2001, 2004 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 
00036 __BEGIN_DECLS
00037 
00038 /* Type for a general-purpose register.  */
00039 typedef unsigned long elf_greg_t;
00040 
00041 /* And the whole bunch of them.  We could have used `struct
00042    user_regs_struct' directly in the typedef, but tradition says that
00043    the register set is an array, which does have some peculiar
00044    semantics, so leave it that way.  */
00045 #define ELF_NGREG (sizeof (struct user_regs_struct) / sizeof(elf_greg_t))
00046 typedef elf_greg_t elf_gregset_t[ELF_NGREG];
00047 
00048 #if __WORDSIZE == 32
00049 /* Register set for the floating-point registers.  */
00050 typedef struct user_fpregs_struct elf_fpregset_t;
00051 
00052 /* Register set for the extended floating-point registers.  Includes
00053    the Pentium III SSE registers in addition to the classic
00054    floating-point stuff.  */
00055 typedef struct user_fpxregs_struct elf_fpxregset_t;
00056 #else
00057 /* Register set for the extended floating-point registers.  Includes
00058    the Pentium III SSE registers in addition to the classic
00059    floating-point stuff.  */
00060 typedef struct user_fpregs_struct elf_fpregset_t;
00061 #endif
00062 
00063 /* Signal info.  */
00064 struct elf_siginfo
00065   {
00066     int si_signo;                  /* Signal number.  */
00067     int si_code;                   /* Extra code.  */
00068     int si_errno;                  /* Errno.  */
00069   };
00070 
00071 
00072 /* Definitions to generate Intel SVR4-like core files.  These mostly
00073    have the same names as the SVR4 types with "elf_" tacked on the
00074    front to prevent clashes with Linux definitions, and the typedef
00075    forms have been avoided.  This is mostly like the SVR4 structure,
00076    but more Linuxy, with things that Linux does not support and which
00077    GDB doesn't really use excluded.  */
00078 
00079 struct elf_prstatus
00080   {
00081     struct elf_siginfo pr_info;           /* Info associated with signal.  */
00082     short int pr_cursig;           /* Current signal.  */
00083     unsigned long int pr_sigpend;  /* Set of pending signals.  */
00084     unsigned long int pr_sighold;  /* Set of held signals.  */
00085     __pid_t pr_pid;
00086     __pid_t pr_ppid;
00087     __pid_t pr_pgrp;
00088     __pid_t pr_sid;
00089     struct timeval pr_utime;              /* User time.  */
00090     struct timeval pr_stime;              /* System time.  */
00091     struct timeval pr_cutime;             /* Cumulative user time.  */
00092     struct timeval pr_cstime;             /* Cumulative system time.  */
00093     elf_gregset_t pr_reg;          /* GP registers.  */
00094     int pr_fpvalid;                /* True if math copro being used.  */
00095   };
00096 
00097 
00098 #define ELF_PRARGSZ     (80)    /* Number of chars for args.  */
00099 
00100 struct elf_prpsinfo
00101   {
00102     char pr_state;                 /* Numeric process state.  */
00103     char pr_sname;                 /* Char for pr_state.  */
00104     char pr_zomb;                  /* Zombie.  */
00105     char pr_nice;                  /* Nice val.  */
00106     unsigned long int pr_flag;            /* Flags.  */
00107 #if __WORDSIZE == 32
00108     unsigned short int pr_uid;
00109     unsigned short int pr_gid;
00110 #else
00111     unsigned int pr_uid;
00112     unsigned int pr_gid;
00113 #endif
00114     int pr_pid, pr_ppid, pr_pgrp, pr_sid;
00115     /* Lots missing */
00116     char pr_fname[16];                    /* Filename of executable.  */
00117     char pr_psargs[ELF_PRARGSZ];   /* Initial part of arg list.  */
00118   };
00119 
00120 
00121 /* The rest of this file provides the types for emulation of the
00122    Solaris <proc_service.h> interfaces that should be implemented by
00123    users of libthread_db.  */
00124 
00125 /* Addresses.  */
00126 typedef void *psaddr_t;
00127 
00128 /* Register sets.  Linux has different names.  */
00129 typedef elf_gregset_t prgregset_t;
00130 typedef elf_fpregset_t prfpregset_t;
00131 
00132 /* We don't have any differences between processes and threads,
00133    therefore have only one PID type.  */
00134 typedef __pid_t lwpid_t;
00135 
00136 /* Process status and info.  In the end we do provide typedefs for them.  */
00137 typedef struct elf_prstatus prstatus_t;
00138 typedef struct elf_prpsinfo prpsinfo_t;
00139 
00140 __END_DECLS
00141 
00142 #endif /* sys/procfs.h */