1 /*
2  * Copyright (C) 2013 Synopsys, Inc. (www.synopsys.com)
3  *
4  * Licensed under the LGPL v2.1 or later, see the file COPYING.LIB in this tarball.
5  */
6 
7 #ifndef _SYS_PROCFS_H
8 #define _SYS_PROCFS_H	1
9 
10 /* This is somewhat modelled after the file of the same name on SVR4
11    systems.  It provides a definition of the core file format for ELF
12    used on Linux.  It doesn't have anything to do with the /proc file
13    system, even though Linux has one.
14 
15    Anyway, the whole purpose of this file is for GDB and GDB only.
16    Don't read too much into it.  Don't use it for anything other than
17    GDB unless you know what you are doing.  */
18 
19 #include <features.h>
20 #include <sys/time.h>
21 #include <sys/types.h>
22 #include <sys/user.h>
23 #include <asm/ptrace.h>
24 
25 __BEGIN_DECLS
26 
27 /* Type for a general-purpose register.  */
28 typedef unsigned long elf_greg_t;
29 
30 #define ELF_NGREG (sizeof (struct user_regs_struct) / sizeof(elf_greg_t))
31 typedef elf_greg_t elf_gregset_t[ELF_NGREG];
32 typedef struct { } elf_fpregset_t;
33 
34 /* Signal info.  */
35 struct elf_siginfo
36   {
37     int si_signo;			/* Signal number.  */
38     int si_code;			/* Extra code.  */
39     int si_errno;			/* Errno.  */
40   };
41 
42 /* Definitions to generate Intel SVR4-like core files.  These mostly
43    have the same names as the SVR4 types with "elf_" tacked on the
44    front to prevent clashes with Linux definitions, and the typedef
45    forms have been avoided.  This is mostly like the SVR4 structure,
46    but more Linuxy, with things that Linux does not support and which
47    GDB doesn't really use excluded.  */
48 
49 struct elf_prstatus
50   {
51     struct elf_siginfo pr_info;		/* Info associated with signal.  */
52     short int pr_cursig;		/* Current signal.  */
53     unsigned long int pr_sigpend;	/* Set of pending signals.  */
54     unsigned long int pr_sighold;	/* Set of held signals.  */
55     __pid_t pr_pid;
56     __pid_t pr_ppid;
57     __pid_t pr_pgrp;
58     __pid_t pr_sid;
59     struct timeval pr_utime;		/* User time.  */
60     struct timeval pr_stime;		/* System time.  */
61     struct timeval pr_cutime;		/* Cumulative user time.  */
62     struct timeval pr_cstime;		/* Cumulative system time.  */
63     elf_gregset_t pr_reg;		/* GP registers.  */
64     int pr_fpvalid;			/* True if math copro being used.  */
65   };
66 
67 
68 #define ELF_PRARGSZ     (80)    /* Number of chars for args.  */
69 
70 struct elf_prpsinfo
71   {
72     char pr_state;			/* Numeric process state.  */
73     char pr_sname;			/* Char for pr_state.  */
74     char pr_zomb;			/* Zombie.  */
75     char pr_nice;			/* Nice val.  */
76     unsigned long int pr_flag;		/* Flags.  */
77     unsigned short int pr_uid;
78     unsigned short int pr_gid;
79     int pr_pid, pr_ppid, pr_pgrp, pr_sid;
80     /* Lots missing */
81     char pr_fname[16];			/* Filename of executable.  */
82     char pr_psargs[ELF_PRARGSZ];	/* Initial part of arg list.  */
83   };
84 
85 /* The rest of this file provides the types for emulation of the
86    Solaris <proc_service.h> interfaces that should be implemented by
87    users of libthread_db.  */
88 
89 /* Addresses.  */
90 typedef void *psaddr_t;
91 
92 /* Register sets.  Linux has different names.  */
93 typedef elf_gregset_t prgregset_t;
94 typedef elf_fpregset_t prfpregset_t;
95 
96 /* We don't have any differences between processes and threads,
97    therefore have only one PID type.  */
98 typedef __pid_t lwpid_t;
99 
100 /* Process status and info.  In the end we do provide typedefs for them.  */
101 typedef struct elf_prstatus prstatus_t;
102 typedef struct elf_prpsinfo prpsinfo_t;
103 
104 __END_DECLS
105 
106 #endif	/* sys/procfs.h */
107