#define BSC_rmdir 0x040C0224
#define BSC_utimes 0x040C0228
#define BSC_futimes 0x040C022C
+#define BSC_pread 0x040C0264
+#define BSC_pread_extended 0x040E0264
+#define BSC_pwrite 0x040C0268
+#define BSC_pwrite_extended 0x040E0268
#define BSC_statfs 0x040C0274
#define BSC_fstatfs 0x040C0278
#define BSC_stat 0x040C02F0
struct diskio *dio;
void enter_syscall();
void exit_syscall();
+ void extend_syscall();
void kill_thread_map();
thread = kd[i].arg5 & KDBG_THREAD_MASK;
enter_syscall(thread, type, &kd[i], p, (double)now);
continue;
}
+
switch (type) {
+
+ case BSC_pread_extended:
+ case BSC_pwrite_extended:
+ extend_syscall(thread, type, &kd[i], (double)now);
case MACH_pageout:
if (kd[i].arg2)
exit_syscall("writev", thread, type, kd[i].arg1, kd[i].arg2, 1, 1, (double)now);
break;
+ case BSC_pread:
+ exit_syscall("pread", thread, type, kd[i].arg1, kd[i].arg2, 1, 9, (double)now);
+ break;
+
+ case BSC_pwrite:
+ exit_syscall("pwrite", thread, type, kd[i].arg1, kd[i].arg2, 1, 9, (double)now);
+ break;
+
case BSC_fchown:
exit_syscall("fchown", thread, type, kd[i].arg1, kd[i].arg2, 1, 0, (double)now);
break;
case BSC_fsync:
case BSC_readv:
case BSC_writev:
+ case BSC_pread:
+ case BSC_pwrite:
case BSC_fchown:
case BSC_fchmod:
case BSC_rename:
}
/* Print timestamp column */
- printf(buf);
+ printf("%s", buf);
map = find_thread_map(thread);
if (map) {
sprintf(buf, " %-25.25s ", name);
nmclen = strlen(buf);
- printf(buf);
+ printf("%s", buf);
sprintf(buf, "(%d, 0x%x, 0x%x, 0x%x)", (short)kd->arg1, kd->arg2, kd->arg3, kd->arg4);
argsclen = strlen(buf);
if(clen > 0)
{
- printf(buf); /* print the kdargs */
+ printf("%s", buf); /* print the kdargs */
memset(buf, ' ', clen);
buf[clen] = '\0';
- printf(buf);
+ printf("%s", buf);
}
else if ((argsclen + clen) > 0)
{
/* no room so wipe out the kdargs */
memset(buf, ' ', (argsclen + clen));
buf[argsclen + clen] = '\0';
- printf(buf);
+ printf("%s", buf);
}
if (columns > MAXCOLS || wideflag)
fflush (0);
}
+/*
+ * Handle system call extended trace data.
+ * pread and pwrite:
+ * Wipe out the kd args that were collected upon syscall_entry
+ * because it is the extended info that we really want, and it
+ * is all we really need.
+*/
+
+void
+extend_syscall(int thread, int type, kd_buf *kd, char *name, double now)
+{
+ struct th_info *ti;
+
+ switch (type) {
+ case BSC_pread_extended:
+ if ((ti = find_thread(thread, BSC_pread)) == (struct th_info *)0)
+ return;
+ ti->arg1 = kd->arg1; /* the fd */
+ ti->arg2 = kd->arg2; /* nbytes */
+ ti->arg3 = kd->arg3; /* top half offset */
+ ti->arg4 = kd->arg4; /* bottom half offset */
+ break;
+ case BSC_pwrite_extended:
+ if ((ti = find_thread(thread, BSC_pwrite)) == (struct th_info *)0)
+ return;
+ ti->arg1 = kd->arg1; /* the fd */
+ ti->arg2 = kd->arg2; /* nbytes */
+ ti->arg3 = kd->arg3; /* top half offset */
+ ti->arg4 = kd->arg4; /* bottom half offset */
+ break;
+ default:
+ return;
+ }
+}
void
exit_syscall(char *sc_name, int thread, int type, int error, int retval,
else
sprintf(&buf[clen], " B=0x%-6x /dev/%s", dio->iosize, find_disk_name(dio->dev));
} else {
-
+
+ off_t offset_reassembled = 0LL;
+
if (has_fd == 2 && error == 0)
sprintf(&buf[clen], " F=%-3d", retval);
else if (has_fd == 1)
sprintf(&buf[clen], "B=0x%-8x", retval);
else if (has_ret == 8) /* BSC_select */
sprintf(&buf[clen], " S=%-3d ", retval);
+ else if (has_ret == 9) /* BSC_pread, BSC_pwrite */
+ {
+ sprintf(&buf[clen], "B=0x%-8x", retval);
+ clen = strlen(buf);
+ offset_reassembled = (((off_t)(unsigned int)(ti->arg3)) << 32) | (unsigned int)(ti->arg4);
+ if ((offset_reassembled >> 32) != 0)
+ sprintf(&buf[clen], "O=0x%16.16qx", (off_t)offset_reassembled);
+ else
+ sprintf(&buf[clen], "O=0x%8.8qx", (off_t)offset_reassembled);
+ }
else
sprintf(&buf[clen], " ");
}
clen = strlen(buf);
}
- printf(buf);
+ printf("%s", buf);
/*
Calculate space available to print pathname
*/
memset(&buf[len], ' ', clen - len);
buf[clen] = '\0';
- printf(buf);
+ printf("%s", buf);
}
else if (clen == len)
{
- printf(buf);
+ printf("%s", buf);
}
else if ((clen > 0) && (clen < len))
{
/* This prints the tail end of the pathname */
buf[len-clen] = ' ';
- printf(&buf[len - clen]);
+ printf("%s", &buf[len - clen]);
}
usecs = (unsigned long)((now - stime) / divisor);