111
112 {
113 kvm_p = kvm_open(namelist, dumpfile, NULL, O_RDONLY, program_name);
114 if (kvm_p == NULL) {
115 /* kvm_open prints an error message */
116 exit(1);
117 }
118 if (kvm_nlist(kvm_p, kvm_syms) != 0) {
119 (void) fprintf(stderr, gettext(
120 "Symbol lookup error in %s\n"), namelist);
121 exit(1);
122 }
123 if (kvm_read(kvm_p, kvm_syms[0].n_value, (char *) &dump_bufaddr,
124 sizeof (dump_bufaddr)) != sizeof (dump_bufaddr) ||
125 kvm_read(kvm_p, kvm_syms[1].n_value, (char *) &tnf_bufsize,
126 sizeof (tnf_bufsize)) != sizeof (tnf_bufsize)) {
127 (void) fprintf(stderr, gettext(
128 "kvm_read error in %s\n"), dumpfile);
129 exit(1);
130 }
131 if (dump_bufaddr == NULL || tnf_bufsize == 0) {
132 (void) fprintf(stderr, gettext(
133 "No trace data available in the kernel.\n"));
134 exit(1);
135 }
136 }
137
138 static void
139 live_kernel_init()
140
141 {
142 tifiocstate_t tstate;
143
144 if ((input_fd = open(TNFDEV, O_RDWR)) < 0) {
145 perror(TNFDEV);
146 exit(1);
147 }
148 if (ioctl(input_fd, TIFIOCGSTATE, &tstate) < 0) {
149 perror(gettext("Error getting trace system state"));
150 exit(1);
151 }
|
111
112 {
113 kvm_p = kvm_open(namelist, dumpfile, NULL, O_RDONLY, program_name);
114 if (kvm_p == NULL) {
115 /* kvm_open prints an error message */
116 exit(1);
117 }
118 if (kvm_nlist(kvm_p, kvm_syms) != 0) {
119 (void) fprintf(stderr, gettext(
120 "Symbol lookup error in %s\n"), namelist);
121 exit(1);
122 }
123 if (kvm_read(kvm_p, kvm_syms[0].n_value, (char *) &dump_bufaddr,
124 sizeof (dump_bufaddr)) != sizeof (dump_bufaddr) ||
125 kvm_read(kvm_p, kvm_syms[1].n_value, (char *) &tnf_bufsize,
126 sizeof (tnf_bufsize)) != sizeof (tnf_bufsize)) {
127 (void) fprintf(stderr, gettext(
128 "kvm_read error in %s\n"), dumpfile);
129 exit(1);
130 }
131 if (dump_bufaddr == (uintptr_t)NULL || tnf_bufsize == 0) {
132 (void) fprintf(stderr, gettext(
133 "No trace data available in the kernel.\n"));
134 exit(1);
135 }
136 }
137
138 static void
139 live_kernel_init()
140
141 {
142 tifiocstate_t tstate;
143
144 if ((input_fd = open(TNFDEV, O_RDWR)) < 0) {
145 perror(TNFDEV);
146 exit(1);
147 }
148 if (ioctl(input_fd, TIFIOCGSTATE, &tstate) < 0) {
149 perror(gettext("Error getting trace system state"));
150 exit(1);
151 }
|