1 /*
2  * Copyright (C) 2017 Hangzhou C-SKY Microsystems co.,ltd.
3  *
4  * Licensed under the LGPL v2.1 or later, see the file COPYING.LIB
5  * in this tarball.
6  */
7 
8 /* Copyright (C) 1996, 1997, 1999, 2000, 2001 Free Software Foundation, Inc.
9    This file is part of the GNU C Library.
10 
11    The GNU C Library is free software; you can redistribute it and/or
12    modify it under the terms of the GNU Lesser General Public
13    License as published by the Free Software Foundation; either
14    version 2.1 of the License, or (at your option) any later version.
15 
16    The GNU C Library is distributed in the hope that it will be useful,
17    but WITHOUT ANY WARRANTY; without even the implied warranty of
18    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19    Lesser General Public License for more details.
20 
21    You should have received a copy of the GNU Lesser General Public
22    License along with the GNU C Library; if not, write to the Free
23    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
24    02111-1307 USA.  */
25 
26 #ifndef _SYS_PROCFS_H
27 #define _SYS_PROCFS_H	1
28 
29 /* This is somewhat modelled after the file of the same name on SVR4
30    systems.  It provides a definition of the core file format for ELF
31    used on Linux.  It doesn't have anything to do with the /proc file
32    system, even though Linux has one.
33 
34    Anyway, the whole purpose of this file is for GDB and GDB only.
35    Don't read too much into it.  Don't use it for anything other than
36    GDB unless you know what you are doing.  */
37 
38 #include <features.h>
39 #include <sys/time.h>
40 #include <sys/types.h>
41 #include <sys/user.h>
42 
43 __BEGIN_DECLS
44 
45 /* Type for a general-purpose register.  */
46 typedef unsigned long elf_greg_t;
47 
48 /* And the whole bunch of them.  We could have used `struct
49    user_regs' directly in the typedef, but tradition says that
50    the register set is an array, which does have some peculiar
51    semantics, so leave it that way.  */
52 #define ELF_NGREG (sizeof (struct user_regs) / sizeof(elf_greg_t))
53 typedef elf_greg_t elf_gregset_t[ELF_NGREG];
54 
55 /* Register set for the floating-point registers.  */
56 typedef struct user_fpregs elf_fpregset_t;
57 
58 
59 /* Signal info.  */
60 struct elf_siginfo
61   {
62     int si_signo;			/* Signal number.  */
63     int si_code;			/* Extra code.  */
64     int si_errno;			/* Errno.  */
65   };
66 
67 
68 /* Definitions to generate Intel SVR4-like core files.  These mostly
69    have the same names as the SVR4 types with "elf_" tacked on the
70    front to prevent clashes with Linux definitions, and the typedef
71    forms have been avoided.  This is mostly like the SVR4 structure,
72    but more Linuxy, with things that Linux does not support and which
73    GDB doesn't really use excluded.  */
74 
75 struct elf_prstatus
76   {
77     struct elf_siginfo pr_info;		/* Info associated with signal.  */
78     short int pr_cursig;		/* Current signal.  */
79     unsigned long int pr_sigpend;	/* Set of pending signals.  */
80     unsigned long int pr_sighold;	/* Set of held signals.  */
81     __pid_t pr_pid;
82     __pid_t pr_ppid;
83     __pid_t pr_pgrp;
84     __pid_t pr_sid;
85     struct timeval pr_utime;		/* User time.  */
86     struct timeval pr_stime;		/* System time.  */
87     struct timeval pr_cutime;		/* Cumulative user time.  */
88     struct timeval pr_cstime;		/* Cumulative system time.  */
89     elf_gregset_t pr_reg;		/* GP registers.  */
90     int pr_fpvalid;			/* True if math copro being used.  */
91   };
92 
93 
94 #define ELF_PRARGSZ     (80)    /* Number of chars for args.  */
95 
96 struct elf_prpsinfo
97   {
98     char pr_state;			/* Numeric process state.  */
99     char pr_sname;			/* Char for pr_state.  */
100     char pr_zomb;			/* Zombie.  */
101     char pr_nice;			/* Nice val.  */
102     unsigned long int pr_flag;		/* Flags.  */
103     unsigned short int pr_uid;
104     unsigned short int pr_gid;
105     int pr_pid, pr_ppid, pr_pgrp, pr_sid;
106     /* Lots missing */
107     char pr_fname[16];			/* Filename of executable.  */
108     char pr_psargs[ELF_PRARGSZ];	/* Initial part of arg list.  */
109   };
110 
111 
112 /* The rest of this file provides the types for emulation of the
113    Solaris <proc_service.h> interfaces that should be implemented by
114    users of libthread_db.  */
115 
116 /* Addresses.  */
117 typedef void *psaddr_t;
118 
119 /* Register sets.  Linux has different names.  */
120 typedef elf_gregset_t prgregset_t;
121 typedef elf_fpregset_t prfpregset_t;
122 
123 /* We don't have any differences between processes and threads,
124    therefore have only one PID type.  */
125 typedef __pid_t lwpid_t;
126 
127 /* Process status and info.  In the end we do provide typedefs for them.  */
128 typedef struct elf_prstatus prstatus_t;
129 typedef struct elf_prpsinfo prpsinfo_t;
130 
131 __END_DECLS
132 
133 #endif	/* sys/procfs.h */
134