main.c (192025) | main.c (192153) |
---|---|
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. --- 16 unchanged lines hidden (view full) --- 25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 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#include <sys/cdefs.h> | 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. --- 16 unchanged lines hidden (view full) --- 25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 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#include <sys/cdefs.h> |
33__FBSDID("$FreeBSD: head/usr.bin/truss/main.c 192025 2009-05-12 20:42:12Z dds $"); | 33__FBSDID("$FreeBSD: head/usr.bin/truss/main.c 192153 2009-05-15 19:41:10Z delphij $"); |
34 35/* 36 * The main module for truss. Suprisingly simple, but, then, the other 37 * files handle the bulk of the work. And, of course, the kernel has to 38 * do a lot of the work :). 39 */ 40 41#include <sys/param.h> --- 132 unchanged lines hidden (view full) --- 174 char *fname; 175 struct trussinfo *trussinfo; 176 char *signame; 177 178 fname = NULL; 179 initial_open = 1; 180 181 /* Initialize the trussinfo struct */ | 34 35/* 36 * The main module for truss. Suprisingly simple, but, then, the other 37 * files handle the bulk of the work. And, of course, the kernel has to 38 * do a lot of the work :). 39 */ 40 41#include <sys/param.h> --- 132 unchanged lines hidden (view full) --- 174 char *fname; 175 struct trussinfo *trussinfo; 176 char *signame; 177 178 fname = NULL; 179 initial_open = 1; 180 181 /* Initialize the trussinfo struct */ |
182 trussinfo = (struct trussinfo *)malloc(sizeof(struct trussinfo)); | 182 trussinfo = (struct trussinfo *)calloc(1, sizeof(struct trussinfo)); |
183 if (trussinfo == NULL) | 183 if (trussinfo == NULL) |
184 errx(1, "malloc() failed"); 185 bzero(trussinfo, sizeof(struct trussinfo)); 186 | 184 errx(1, "calloc() failed"); 185 |
187 trussinfo->outfile = stderr; 188 trussinfo->strsize = 32; 189 trussinfo->pr_why = S_NONE; 190 trussinfo->curthread = NULL; 191 SLIST_INIT(&trussinfo->threadlist); 192 while ((c = getopt(ac, av, "p:o:facedDs:S")) != -1) { 193 switch (c) { 194 case 'p': /* specified pid */ --- 187 unchanged lines hidden --- | 186 trussinfo->outfile = stderr; 187 trussinfo->strsize = 32; 188 trussinfo->pr_why = S_NONE; 189 trussinfo->curthread = NULL; 190 SLIST_INIT(&trussinfo->threadlist); 191 while ((c = getopt(ac, av, "p:o:facedDs:S")) != -1) { 192 switch (c) { 193 case 'p': /* specified pid */ --- 187 unchanged lines hidden --- |