main.c (37453) | main.c (38520) |
---|---|
1/* 2 * Copryight 1997 Sean Eric Fagan 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 1. Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. --- 17 unchanged lines hidden (view full) --- 26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29 * SUCH DAMAGE. 30 */ 31 32#ifndef lint 33static const char rcsid[] = | 1/* 2 * Copryight 1997 Sean Eric Fagan 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 1. Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. --- 17 unchanged lines hidden (view full) --- 26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29 * SUCH DAMAGE. 30 */ 31 32#ifndef lint 33static const char rcsid[] = |
34 "$Id: main.c,v 1.8 1998/01/07 06:19:50 jmg Exp $"; | 34 "$Id: main.c,v 1.9 1998/07/06 21:01:47 bde Exp $"; |
35#endif /* not lint */ 36 37/* 38 * The main module for truss. Suprisingly simple, but, then, the other 39 * files handle the bulk of the work. And, of course, the kernel has to 40 * do a lot of the work :). 41 */ 42 --- 79 unchanged lines hidden (view full) --- 122main(int ac, char **av) { 123 int c; 124 int i; 125 char **command; 126 struct procfs_status pfs; 127 struct ex_types *funcs; 128 int in_exec = 0; 129 char *fname = NULL; | 35#endif /* not lint */ 36 37/* 38 * The main module for truss. Suprisingly simple, but, then, the other 39 * files handle the bulk of the work. And, of course, the kernel has to 40 * do a lot of the work :). 41 */ 42 --- 79 unchanged lines hidden (view full) --- 122main(int ac, char **av) { 123 int c; 124 int i; 125 char **command; 126 struct procfs_status pfs; 127 struct ex_types *funcs; 128 int in_exec = 0; 129 char *fname = NULL; |
130 int sigexit = 0; |
|
130 131 while ((c = getopt(ac, av, "p:o:S")) != -1) { 132 switch (c) { 133 case 'p': /* specified pid */ 134 pid = atoi(optarg); 135 break; 136 case 'o': /* Specified output file */ 137 fname = optarg; --- 73 unchanged lines hidden (view full) --- 211 if (in_exec) { 212 in_exec = 0; 213 break; 214 } 215 funcs->exit_syscall(pid, pfs.val); 216 break; 217 case S_SIG: 218 fprintf(outfile, "SIGNAL %lu\n", pfs.val); | 131 132 while ((c = getopt(ac, av, "p:o:S")) != -1) { 133 switch (c) { 134 case 'p': /* specified pid */ 135 pid = atoi(optarg); 136 break; 137 case 'o': /* Specified output file */ 138 fname = optarg; --- 73 unchanged lines hidden (view full) --- 212 if (in_exec) { 213 in_exec = 0; 214 break; 215 } 216 funcs->exit_syscall(pid, pfs.val); 217 break; 218 case S_SIG: 219 fprintf(outfile, "SIGNAL %lu\n", pfs.val); |
220 sigexit = pfs.val; |
|
219 break; 220 case S_EXIT: 221 fprintf (outfile, "process exit, rval = %lu\n", pfs.val); 222 break; 223 case S_EXEC: 224 funcs = set_etype(); 225 in_exec = 1; 226 break; 227 default: 228 fprintf (outfile, "Process stopped because of: %d\n", i); 229 break; 230 } 231 } 232 if (ioctl(Procfd, PIOCCONT, val) == -1) 233 warn("PIOCCONT"); 234 } while (pfs.why != S_EXIT); | 221 break; 222 case S_EXIT: 223 fprintf (outfile, "process exit, rval = %lu\n", pfs.val); 224 break; 225 case S_EXEC: 226 funcs = set_etype(); 227 in_exec = 1; 228 break; 229 default: 230 fprintf (outfile, "Process stopped because of: %d\n", i); 231 break; 232 } 233 } 234 if (ioctl(Procfd, PIOCCONT, val) == -1) 235 warn("PIOCCONT"); 236 } while (pfs.why != S_EXIT); |
237 if (sigexit) { 238 if (sigexit == SIGQUIT) 239 exit(sigexit); 240 (void) signal(sigexit, SIG_DFL); 241 (void) kill(getpid(), sigexit); 242 } |
|
235 return 0; 236} | 243 return 0; 244} |