Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

errno: print stringified errors from errno #54

Merged
merged 1 commit into from
Jun 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions inotify-info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ struct statx mystatx(const char* filename, unsigned int mask = 0)
int flags = AT_NO_AUTOMOUNT | AT_SYMLINK_NOFOLLOW | AT_STATX_DONT_SYNC;

if (statx(0, filename, flags, mask, &statxbuf) == -1) {
printf("ERROR: statx-ino( %s ) failed. Errno: %d\n", filename, errno);
printf("ERROR: statx-ino( %s ) failed. Errno: %d (%s)\n", filename, errno, strerror(errno));
memset(&statxbuf, 0, sizeof(statxbuf));
}

Expand Down Expand Up @@ -418,7 +418,7 @@ static dev_t stat_get_dev_t(const char* filename)

int ret = stat(filename, &statbuf);
if (ret == -1) {
printf("ERROR: stat-dev_t( %s ) failed. Errno: %d\n", filename, errno);
printf("ERROR: stat-dev_t( %s ) failed. Errno: %d (%s)\n", filename, errno, strerror(errno));
return 0;
}
return statbuf.st_dev;
Expand All @@ -430,7 +430,7 @@ static uint64_t stat_get_ino(const char* filename)

int ret = stat(filename, &statbuf);
if (ret == -1) {
printf("ERROR: stat-ino( %s ) failed. Errno: %d\n", filename, errno);
printf("ERROR: stat-ino( %s ) failed. Errno: %d (%s)\n", filename, errno, strerror(errno));
return 0;
}

Expand Down Expand Up @@ -543,7 +543,7 @@ int thread_info_t::parse_dirqueue_entry()
}

if (spew_error) {
printf("ERROR: sys_getdents64 failed on '%s': %d errno:%d\n", path, ret, errno);
printf("ERROR: sys_getdents64 failed on '%s': %d errno: %d (%s)\n", path, ret, errno, strerror(errno));
}
break;
}
Expand Down Expand Up @@ -631,7 +631,7 @@ static bool init_inotify_proclist(std::vector<procinfo_t>& inotify_proclist)
DIR* dir_proc = opendir("/proc");

if (!dir_proc) {
printf("ERROR: opendir /proc failed: %d\n", errno);
printf("ERROR: opendir /proc failed: %d (%s)\n", errno, strerror(errno));
return false;
}

Expand Down