xref: /minix/minix/usr.bin/trace/proto.h (revision 90b80121)
1 
2 /* call.c */
3 void put_endpoint(struct trace_proc *proc, const char *name, endpoint_t endpt);
4 void put_equals(struct trace_proc *proc);
5 void put_result(struct trace_proc *proc);
6 int default_out(struct trace_proc *proc, const message *m_out);
7 void default_in(struct trace_proc *proc, const message *m_out,
8 	const message *m_in, int failed);
9 int call_enter(struct trace_proc *proc, int show_stack);
10 void call_leave(struct trace_proc *proc, int skip);
11 void call_replay(struct trace_proc *proc);
12 const char *call_name(struct trace_proc *proc);
13 int call_errno(struct trace_proc *proc, int *err);
14 
15 /* error.c */
16 const char *get_error_name(int err);
17 
18 /* escape.c */
19 const char *get_escape(char c);
20 
21 /* format.c */
22 void format_reset(struct trace_proc *proc);
23 void format_set_sep(struct trace_proc *proc, const char *sep);
24 void format_push_sep(struct trace_proc *proc);
25 void put_field(struct trace_proc *proc, const char *name, const char *text);
26 void put_open(struct trace_proc *proc, const char *name, int flags,
27 	const char *string, const char *separator);
28 void put_close(struct trace_proc *proc, const char *string);
29 void put_fmt(struct trace_proc *proc, const char *fmt, ...)
30 	__attribute__((__format__(__printf__, 2, 3)));
31 void put_value(struct trace_proc *proc, const char *name, const char *fmt, ...)
32 	__attribute__((__format__(__printf__, 3, 4)));
33 int put_open_struct(struct trace_proc *proc, const char *name, int flags,
34 	vir_bytes addr, void *ptr, size_t size);
35 void put_close_struct(struct trace_proc *proc, int all);
36 void put_ptr(struct trace_proc *proc, const char *name, vir_bytes addr);
37 void put_buf(struct trace_proc *proc, const char *name, int flags,
38 	vir_bytes addr, ssize_t size);
39 void put_flags(struct trace_proc *proc, const char *name,
40 	const struct flags *fp, unsigned int num, const char *fmt,
41 	unsigned int value);
42 void put_tail(struct trace_proc * proc, unsigned int count,
43 	unsigned int printed);
44 
45 /* ioctl.c */
46 void put_ioctl_req(struct trace_proc *proc, const char *name,
47 	unsigned long req, int is_svrctl);
48 int put_ioctl_arg_out(struct trace_proc *proc, const char *name,
49 	unsigned long req, vir_bytes addr, int is_svrctl);
50 void put_ioctl_arg_in(struct trace_proc *proc, const char *name, int failed,
51 	unsigned long req, vir_bytes addr, int is_svrctl);
52 
53 /* kernel.c */
54 int kernel_check(pid_t pid);
55 int kernel_get_name(pid_t pid, char *name, size_t size);
56 int kernel_is_service(pid_t pid);
57 int kernel_get_syscall(pid_t pid, reg_t reg[3]);
58 int kernel_get_retreg(pid_t pid, reg_t *retreg);
59 vir_bytes kernel_get_stacktop(void);
60 int kernel_get_context(pid_t pid, reg_t *pc, reg_t *sp, reg_t *fp);
61 void kernel_put_stacktrace(struct trace_proc * proc);
62 
63 /* mem.c */
64 int mem_get_data(pid_t pid, vir_bytes addr, void *ptr, size_t len);
65 int mem_get_user(pid_t pid, vir_bytes addr, void *ptr, size_t len);
66 
67 /* pm.c */
68 void put_struct_timeval(struct trace_proc *proc, const char *name, int flags,
69 	vir_bytes addr);
70 void put_time(struct trace_proc *proc, const char *name, time_t time);
71 void put_groups(struct trace_proc * proc, const char * name, int flags,
72 	vir_bytes addr, int count);
73 
74 /* output.c */
75 int output_init(const char *file);
76 int output_error(void);
77 void output_flush(void);
78 void record_start(struct trace_proc *proc);
79 void record_stop(struct trace_proc *proc);
80 void record_clear(struct trace_proc *proc);
81 int record_replay(struct trace_proc *proc);
82 void put_newline(void);
83 void put_text(struct trace_proc *proc, const char *text);
84 void put_space(struct trace_proc *proc);
85 void put_align(struct trace_proc *proc);
86 
87 /* proc.c */
88 void proc_init(void);
89 struct trace_proc *proc_add(pid_t pid);
90 struct trace_proc *proc_get(pid_t pid);
91 void proc_del(struct trace_proc *proc);
92 struct trace_proc *proc_next(struct trace_proc *last);
93 unsigned int proc_count(void);
94 
95 /* signal.c */
96 const char *get_signal_name(int sig);
97 
98 /* trace.c */
99 extern int timestamps;
100 extern int allnames;
101 extern unsigned int verbose;
102 extern unsigned int valuesonly;
103 
104 /* service */
105 const struct calls pm_calls;
106 const struct calls vfs_calls;
107 const struct calls rs_calls;
108 const struct calls mib_calls;
109 const struct calls vm_calls;
110 const struct calls ipc_calls;
111 
112 /* service/vfs.c */
113 void put_fd(struct trace_proc *proc, const char *name, int fd);
114 void put_dev(struct trace_proc *proc, const char *name, dev_t dev);
115 void put_in_addr(struct trace_proc *proc, const char *name, struct in_addr in);
116 void put_socket_type(struct trace_proc *proc, const char *name, int type);
117 void put_socket_family(struct trace_proc *proc, const char *name, int family);
118 void put_cmsg_type(struct trace_proc *proc, const char *name, int type);
119 void put_shutdown_how(struct trace_proc *proc, const char *name, int how);
120 
121 /* ioctl/block.c */
122 const char *block_ioctl_name(unsigned long req);
123 int block_ioctl_arg(struct trace_proc *proc, unsigned long req, void *ptr,
124 	int dir);
125 
126 /* ioctl/char.c */
127 const char *char_ioctl_name(unsigned long req);
128 int char_ioctl_arg(struct trace_proc *proc, unsigned long req, void *ptr,
129 	int dir);
130 
131 /* ioctl/net.c */
132 const char *net_ioctl_name(unsigned long req);
133 int net_ioctl_arg(struct trace_proc *proc, unsigned long req, void *ptr,
134 	int dir);
135 
136 /* ioctl/svrctl.c */
137 const char *svrctl_name(unsigned long req);
138 int svrctl_arg(struct trace_proc *proc, unsigned long req, void *ptr, int dir);
139