- /* Convert physical block number to string */
- snprintf (blknum_str, sizeof(blknum_str), "%lld", buf_blkno(bp));
-
- /* Convert logical block number to string */
- snprintf (lblknum_str, sizeof(lblknum_str), "%lld", buf_lblkno(bp));
-
- msg_id = fslog_err(FSLOG_MSG_FIRST,
- FSLOG_KEY_ERR_TYPE, FSLOG_VAL_ERR_TYPE_IO,
- FSLOG_KEY_ERRNO, errno_str,
- FSLOG_KEY_IOTYPE, iotype,
- FSLOG_KEY_PHYS_BLKNUM, blknum_str,
- FSLOG_KEY_LOG_BLKNUM, lblknum_str,
- NULL);
-
- /* Access the vnode for this buffer */
- vp = buf_vnode(bp);
- if (vp) {
- struct vfsstatfs *sp;
- mount_t mp;
- char *path;
- int len;
- struct vfs_context context;
-
- mp = vnode_mount(vp);
- /* mp should be NULL only for bdevvp during boot */
- if (mp == NULL) {
- goto out;
- }
- sp = vfs_statfs(mp);
-
- /* Access the file path */
- MALLOC(path, char *, MAXPATHLEN, M_TEMP, M_WAITOK);
- if (path) {
- len = MAXPATHLEN;
- context.vc_thread = current_thread();
- context.vc_ucred = kauth_cred_get();
- /* Find path without entering file system */
- err = build_path(vp, path, len, &len, BUILDPATH_NO_FS_ENTER,
- &context);
- if (!err) {
- err = escape_str(path, len, MAXPATHLEN);
- if (!err) {
- /* Print device node, mount point, path */
- msg_id = fslog_err(msg_id | FSLOG_MSG_LAST,
- FSLOG_KEY_DEVNODE, sp->f_mntfromname,
- FSLOG_KEY_MNTPT, sp->f_mntonname,
- FSLOG_KEY_PATH, path,
- NULL);
- print_last = 1;
- }
- }
- FREE(path, M_TEMP);
- }
-
- if (print_last == 0) {
- /* Print device node and mount point */
- msg_id = fslog_err(msg_id | FSLOG_MSG_LAST,
- FSLOG_KEY_DEVNODE, sp->f_mntfromname,
- FSLOG_KEY_MNTPT, sp->f_mntonname,
- NULL);
- print_last = 1;
- }
- }
+ const size_t nmlen = 2 * MAXCOMLEN + 1;
+ char nm[nmlen] = {};
+ proc_selfname(nm, nmlen);
+ if (escape_str(nm, strlen(nm) + 1, nmlen))
+ snprintf(nm, nmlen, "(a.out)");
+
+ const size_t slen = 8 + 1 + 8 + 1;
+ char xcptstr[slen], csrstr[slen];
+
+ snprintf(xcptstr, slen, "%x.%x", code, xcpt);
+ if (ctrl == stat)
+ snprintf(csrstr, slen, "%x", ctrl);
+ else
+ snprintf(csrstr, slen, "%x.%x", ctrl, stat);
+
+#if DEVELOPMENT || DEBUG
+ printf("%s[%d]: com.apple.kernel.fpx: %s, %s\n",
+ nm, proc_pid(p), xcptstr, csrstr);
+#endif
+ kern_asl_msg(LOG_DEBUG, "messagetracer", 5,
+ /* 0 */ "com.apple.message.domain", "com.apple.kernel.fpx",
+ /* 1 */ "com.apple.message.signature", nm,
+ /* 2 */ "com.apple.message.signature2", xcptstr,
+ /* 3 */ "com.apple.message.value", csrstr,
+ /* 4 */ "com.apple.message.summarize", "YES",
+ NULL);
+}