* The mailing list was moved to strace-devel@lists.strace.io.
* Changes in behaviour
- * Closing angle bracket is now printed as an octal number escape sequence
+ * Angle brackets are now printed as octal number escape sequences
in the output of paths associated with file descriptors.
* Improvements
* Enhanced NETLINK_ROUTE protocol decoding.
* Updated lists of signal codes.
* Updated lists of INET_DIAG_BC_*, POLL*, RWF_*, and SCHED_FLAG_* constants.
+ * Implemented block/character device number printing in -yy mode.
* Bug fixes
* Fixed build on m68k.
} checks[] = {
{ ARG_STR("\1\0020\v\0047\f\58\t\79\n\10\0171\r\0167\218\37 \\\'\"<<0::0>>1~\177\200\377"),
"\\1\\0020\\v\\0047\\f\\58\\t\\79\\n\\10\\0171\\r\\0167"
- "\\218\\37 \\\\\'\\\"<<0::0\\76\\0761~\\177\\200\\377" },
+ "\\218\\37 \\\\\'\\\"\\74\\0740::0\\76\\0761~\\177\\200\\377" },
};
if (!getcwd(dir, sizeof(dir)))
int rc = fsync(fd);
printf("fsync(%ld<", fd);
- print_quoted_string_ex(dir, false, ">");
+ print_quoted_string_ex(dir, false, ">:");
printf("/%s>) = %s\n", checks[i].fdstr, sprintrc(rc));
close(fd);
#include <limits.h>
#include <fcntl.h>
#include <stdarg.h>
+#include <sys/stat.h>
+#include <sys/sysmacros.h>
#ifdef HAVE_SYS_XATTR_H
# include <sys/xattr.h>
#endif
#include <sys/uio.h>
+
+#include "largefile_wrappers.h"
#include "xstring.h"
int
return 0;
}
+static bool
+printsocket(struct tcb *tcp, int fd, const char *path)
+{
+ const char *str = STR_STRIP_PREFIX(path, "socket:[");
+ size_t len;
+ unsigned long inode;
+
+ return (str != path)
+ && (len = strlen(str))
+ && (str[len - 1] == ']')
+ && (inode = strtoul(str, NULL, 10))
+ && print_sockaddr_by_inode(tcp, fd, inode);
+}
+
+static bool
+printdev(struct tcb *tcp, int fd, const char *path)
+{
+ struct_stat st;
+
+ if (path[0] != '/')
+ return false;
+
+ if (stat_file(path, &st)) {
+ debug_func_perror_msg("stat(\"%s\")", path);
+ return false;
+ }
+
+ switch (st.st_mode & S_IFMT) {
+ case S_IFBLK:
+ case S_IFCHR:
+ print_quoted_string_ex(path, strlen(path),
+ QUOTE_OMIT_LEADING_TRAILING_QUOTES,
+ "<>");
+ tprintf("<%s %u:%u>",
+ S_ISBLK(st.st_mode)? "block" : "char",
+ major(st.st_rdev), minor(st.st_rdev));
+ return true;
+ }
+
+ return false;
+}
+
void
printfd(struct tcb *tcp, int fd)
{
char path[PATH_MAX + 1];
if (show_fd_path && getfdpath(tcp, fd, path, sizeof(path)) >= 0) {
- const char *str;
- size_t len;
- unsigned long inode;
-
tprintf("%d<", fd);
if (show_fd_path <= 1
- || (str = STR_STRIP_PREFIX(path, "socket:[")) == path
- || !(len = strlen(str))
- || str[len - 1] != ']'
- || !(inode = strtoul(str, NULL, 10))
- || !print_sockaddr_by_inode(tcp, fd, inode)) {
+ || (!printsocket(tcp, fd, path)
+ && !printdev(tcp, fd, path))) {
print_quoted_string_ex(path, strlen(path),
- QUOTE_OMIT_LEADING_TRAILING_QUOTES, ">");
+ QUOTE_OMIT_LEADING_TRAILING_QUOTES, "<>");
}
tprints(">");
} else