Commit | Line | Data |
---|---|---|
5b4d72dd MM |
1 | /* |
2 | * Copyright (C) 1991 Gordon Irlam. All rights reserved. | |
3 | */ | |
4 | ||
5 | /* | |
6 | * Declaration of system calls for sparc trace generator. | |
7 | */ | |
8 | ||
9 | ||
10 | #if !defined(SYSCALLS_H) | |
11 | #define SYSCALLS_H 1 | |
12 | ||
13 | /* | |
14 | * Imported declarations. | |
15 | */ | |
16 | ||
17 | #include "agent_msg.h" | |
18 | ||
19 | ||
20 | /* | |
21 | * Declaration of table containing system calls, and their parameter profile. | |
22 | */ | |
23 | ||
24 | /* | |
25 | * Words, such as the parameters and results of system calls, are capable of | |
26 | * being displayed in a number of different formats. | |
27 | * | |
28 | * fmt_none - indicates the absense of further arguments, functions that don't | |
29 | * return a value, etc. | |
30 | * | |
31 | * The function format_value(..) can be used to display a word in one of the | |
32 | * following formats. | |
33 | * | |
34 | * fmt_dec - a signed decimal number : 0, 21, -1 | |
35 | * fmt_hex - a unsigned hex number : 0x0, 0x15, 0xffffffff | |
36 | * fmt_ptr - a pointer : NULL, 0x00000015, 0xffffffff | |
37 | * fmt_fd - a file descriptor : fd0, fd15, fd-1 | |
38 | * fmt_signal - the name of a signal : 0, SIGTTIN, -1 | |
39 | * fmt_error - the name of an error : 0, EISDIR, -1 | |
40 | * fmt_open_flags - the flags to open : O_RDONLY, O_WRONLY|0x14, 0xffffffff | |
41 | * fmt_unknown - representation unknown : .., .., .. | |
42 | * fmt_string - if the null termintated string at word is printable displays | |
43 | * the string within quotes, otherwise displays like fmt_ptr | |
44 | * fmt_post_string - displays like fmt_ptr, value of word is also saved, | |
45 | * following the system call a printable string exists at | |
46 | * address word the address and the string will be displayed | |
47 | * fmt_data - only permitted in argument lists, next argument must be | |
48 | * format_data_size, if printable data exists at word having length | |
49 | * specified by the next argument it is printed, otherwise displays | |
50 | * like fmt_ptr | |
51 | * fmt_data_size - displays like FMT_SIZE | |
52 | * fmt_post_data - displays like fmt_ptr, value of word is also saved, | |
53 | * following call if a printable length delimited string exists | |
54 | * it will be displayed | |
55 | * fmt_post_data_size - displays like FMT_SIZE, value is saved for use as | |
56 | * length for fmt_post_data display format | |
57 | * fmt_string_array - word is the address of a null terminted array of strings | |
58 | * to be printed if possible | |
59 | * | |
60 | * Unlike the string formats which typically represent filenames it is not so | |
61 | * important that length delimited data be fully displayed. When printable, | |
62 | * it will be truncate much more harshly than the string formats. | |
63 | * | |
64 | * Only one item can be pending for display at the end of a system call. | |
65 | * | |
66 | * At a later date this program may be extended to display length delimited | |
67 | * data as a hex dump if it is not printable. | |
68 | * | |
69 | * The following macros are employed to make it easy to alter how a whole | |
70 | * class of values is displayed by changing their definition. | |
71 | * | |
72 | * FMT_STATUS - function calls that return 0 on success and -1 on error | |
73 | * FMT_FLAGS - bit field objects | |
74 | * FMT_SIZE - length of an object in bytes | |
75 | */ | |
76 | typedef enum fmt_type {fmt_none = 0, fmt_dec, fmt_hex, fmt_ptr, fmt_fd, | |
77 | fmt_signal, fmt_error, fmt_open_flags, fmt_unknown, fmt_string, | |
78 | fmt_post_string, fmt_data, fmt_post_data, fmt_data_size, | |
79 | fmt_post_data_size, fmt_string_array} fmt_type; | |
80 | ||
81 | #define FMT_STATUS fmt_none | |
82 | #define FMT_FLAGS fmt_hex | |
83 | #define FMT_SIZE fmt_dec | |
84 | ||
85 | typedef struct _spa_call_desc { | |
86 | char *name; | |
87 | fmt_type arg[NO_PARAMS]; | |
88 | fmt_type result; | |
89 | } spa_call_desc; | |
90 | ||
91 | extern spa_call_desc spa_system_calls[]; | |
92 | ||
93 | extern int no_system_calls; | |
94 | ||
95 | extern spa_call_desc spa_system_call_open_simple; | |
96 | ||
97 | #define SPA_DATA_SIZE_LIMIT 20 | |
98 | #define SPA_STRING_SIZE_LIMIT 201 | |
99 | #define SPA_ARRAY_SIZE_LIMIT 21 | |
100 | ||
101 | ||
102 | /* | |
103 | * Declaration of table containing signal names. | |
104 | */ | |
105 | ||
106 | extern char *spa_signal_names[]; | |
107 | ||
108 | extern int spa_no_signal_names; | |
109 | ||
110 | ||
111 | /* | |
112 | * Declaration of table containing error messages. | |
113 | */ | |
114 | ||
115 | char *spa_error_names[]; | |
116 | ||
117 | extern int spa_no_error_names; | |
118 | ||
119 | #endif |