Skip to content

Commit

Permalink
Clean out Platform_getInodeFilename
Browse files Browse the repository at this point in the history
It's an artefact of the previous implementation of
Platform_getProcessLocks for Linux, and is never used;
there's no reason for it to have ever been exported
  • Loading branch information
nabijaczleweli authored and BenBE committed Jan 8, 2023
1 parent aa48120 commit 67bc7fe
Show file tree
Hide file tree
Showing 18 changed files with 0 additions and 121 deletions.
6 changes: 0 additions & 6 deletions darwin/Platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -344,12 +344,6 @@ char* Platform_getProcessEnv(pid_t pid) {
return env;
}

char* Platform_getInodeFilename(pid_t pid, ino_t inode) {
(void)pid;
(void)inode;
return NULL;
}

FileLocks_ProcessData* Platform_getProcessLocks(pid_t pid) {
(void)pid;
return NULL;
Expand Down
2 changes: 0 additions & 2 deletions darwin/Platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,6 @@ void Platform_setZfsCompressedArcValues(Meter* this);

char* Platform_getProcessEnv(pid_t pid);

char* Platform_getInodeFilename(pid_t pid, ino_t inode);

FileLocks_ProcessData* Platform_getProcessLocks(pid_t pid);

bool Platform_getDiskIO(DiskIOData* data);
Expand Down
6 changes: 0 additions & 6 deletions dragonflybsd/Platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,12 +228,6 @@ char* Platform_getProcessEnv(pid_t pid) {
return NULL;
}

char* Platform_getInodeFilename(pid_t pid, ino_t inode) {
(void)pid;
(void)inode;
return NULL;
}

FileLocks_ProcessData* Platform_getProcessLocks(pid_t pid) {
(void)pid;
return NULL;
Expand Down
2 changes: 0 additions & 2 deletions dragonflybsd/Platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ void Platform_setSwapValues(Meter* this);

char* Platform_getProcessEnv(pid_t pid);

char* Platform_getInodeFilename(pid_t pid, ino_t inode);

FileLocks_ProcessData* Platform_getProcessLocks(pid_t pid);

bool Platform_getDiskIO(DiskIOData* data);
Expand Down
6 changes: 0 additions & 6 deletions freebsd/Platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -287,12 +287,6 @@ char* Platform_getProcessEnv(pid_t pid) {
return env;
}

char* Platform_getInodeFilename(pid_t pid, ino_t inode) {
(void)pid;
(void)inode;
return NULL;
}

FileLocks_ProcessData* Platform_getProcessLocks(pid_t pid) {
(void)pid;
return NULL;
Expand Down
2 changes: 0 additions & 2 deletions freebsd/Platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ void Platform_setZfsCompressedArcValues(Meter* this);

char* Platform_getProcessEnv(pid_t pid);

char* Platform_getInodeFilename(pid_t pid, ino_t inode);

FileLocks_ProcessData* Platform_getProcessLocks(pid_t pid);

bool Platform_getDiskIO(DiskIOData* data);
Expand Down
55 changes: 0 additions & 55 deletions linux/Platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -431,61 +431,6 @@ char* Platform_getProcessEnv(pid_t pid) {
return env;
}

/*
* Return the absolute path of a file given its pid&inode number
*
* Based on implementation of lslocks from util-linux:
* https://sources.debian.org/src/util-linux/2.36-3/misc-utils/lslocks.c/#L162
*/
char* Platform_getInodeFilename(pid_t pid, ino_t inode) {
struct stat sb;
const struct dirent* de;
DIR* dirp;
ssize_t len;
int fd;

char path[PATH_MAX];
char sym[PATH_MAX];
char* ret = NULL;

memset(path, 0, sizeof(path));
memset(sym, 0, sizeof(sym));

xSnprintf(path, sizeof(path), "%s/%d/fd/", PROCDIR, pid);
if (strlen(path) >= (sizeof(path) - 2))
return NULL;

if (!(dirp = opendir(path)))
return NULL;

if ((fd = dirfd(dirp)) < 0 )
goto out;

while ((de = readdir(dirp))) {
if (String_eq(de->d_name, ".") || String_eq(de->d_name, ".."))
continue;

/* care only for numerical descriptors */
if (!strtoull(de->d_name, (char **) NULL, 10))
continue;

if (!Compat_fstatat(fd, path, de->d_name, &sb, 0) && inode != sb.st_ino)
continue;

if ((len = Compat_readlinkat(fd, path, de->d_name, sym, sizeof(sym) - 1)) < 1)
goto out;

sym[len] = '\0';

ret = xStrdup(sym);
break;
}

out:
closedir(dirp);
return ret;
}

FileLocks_ProcessData* Platform_getProcessLocks(pid_t pid) {
FileLocks_ProcessData* pdata = xCalloc(1, sizeof(FileLocks_ProcessData));
DIR* dirp;
Expand Down
2 changes: 0 additions & 2 deletions linux/Platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ void Platform_setZfsCompressedArcValues(Meter* this);

char* Platform_getProcessEnv(pid_t pid);

char* Platform_getInodeFilename(pid_t pid, ino_t inode);

FileLocks_ProcessData* Platform_getProcessLocks(pid_t pid);

void Platform_getPressureStall(const char* file, bool some, double* ten, double* sixty, double* threehundred);
Expand Down
6 changes: 0 additions & 6 deletions netbsd/Platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -338,12 +338,6 @@ char* Platform_getProcessEnv(pid_t pid) {
return env;
}

char* Platform_getInodeFilename(pid_t pid, ino_t inode) {
(void)pid;
(void)inode;
return NULL;
}

FileLocks_ProcessData* Platform_getProcessLocks(pid_t pid) {
(void)pid;
return NULL;
Expand Down
2 changes: 0 additions & 2 deletions netbsd/Platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,6 @@ void Platform_setSwapValues(Meter* this);

char* Platform_getProcessEnv(pid_t pid);

char* Platform_getInodeFilename(pid_t pid, ino_t inode);

FileLocks_ProcessData* Platform_getProcessLocks(pid_t pid);

bool Platform_getDiskIO(DiskIOData* data);
Expand Down
6 changes: 0 additions & 6 deletions openbsd/Platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -296,12 +296,6 @@ char* Platform_getProcessEnv(pid_t pid) {
return env;
}

char* Platform_getInodeFilename(pid_t pid, ino_t inode) {
(void)pid;
(void)inode;
return NULL;
}

FileLocks_ProcessData* Platform_getProcessLocks(pid_t pid) {
(void)pid;
return NULL;
Expand Down
2 changes: 0 additions & 2 deletions openbsd/Platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ void Platform_setSwapValues(Meter* this);

char* Platform_getProcessEnv(pid_t pid);

char* Platform_getInodeFilename(pid_t pid, ino_t inode);

FileLocks_ProcessData* Platform_getProcessLocks(pid_t pid);

bool Platform_getDiskIO(DiskIOData* data);
Expand Down
6 changes: 0 additions & 6 deletions pcp/Platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -669,12 +669,6 @@ char* Platform_getProcessEnv(pid_t pid) {
return value.cp;
}

char* Platform_getInodeFilename(pid_t pid, ino_t inode) {
(void)pid;
(void)inode;
return NULL;
}

FileLocks_ProcessData* Platform_getProcessLocks(pid_t pid) {
(void)pid;
return NULL;
Expand Down
2 changes: 0 additions & 2 deletions pcp/Platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,6 @@ void Platform_setZfsCompressedArcValues(Meter* this);

char* Platform_getProcessEnv(pid_t pid);

char* Platform_getInodeFilename(pid_t pid, ino_t inode);

FileLocks_ProcessData* Platform_getProcessLocks(pid_t pid);

void Platform_getPressureStall(const char* file, bool some, double* ten, double* sixty, double* threehundred);
Expand Down
6 changes: 0 additions & 6 deletions solaris/Platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -308,12 +308,6 @@ char* Platform_getProcessEnv(pid_t pid) {
return xRealloc(envBuilder.env, envBuilder.size + 1);
}

char* Platform_getInodeFilename(pid_t pid, ino_t inode) {
(void)pid;
(void)inode;
return NULL;
}

FileLocks_ProcessData* Platform_getProcessLocks(pid_t pid) {
(void)pid;
return NULL;
Expand Down
2 changes: 0 additions & 2 deletions solaris/Platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,6 @@ void Platform_setZfsCompressedArcValues(Meter* this);

char* Platform_getProcessEnv(pid_t pid);

char* Platform_getInodeFilename(pid_t pid, ino_t inode);

FileLocks_ProcessData* Platform_getProcessLocks(pid_t pid);

bool Platform_getDiskIO(DiskIOData* data);
Expand Down
6 changes: 0 additions & 6 deletions unsupported/Platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,6 @@ char* Platform_getProcessEnv(pid_t pid) {
return NULL;
}

char* Platform_getInodeFilename(pid_t pid, ino_t inode) {
(void)pid;
(void)inode;
return NULL;
}

FileLocks_ProcessData* Platform_getProcessLocks(pid_t pid) {
(void)pid;
return NULL;
Expand Down
2 changes: 0 additions & 2 deletions unsupported/Platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ void Platform_setSwapValues(Meter* this);

char* Platform_getProcessEnv(pid_t pid);

char* Platform_getInodeFilename(pid_t pid, ino_t inode);

FileLocks_ProcessData* Platform_getProcessLocks(pid_t pid);

bool Platform_getDiskIO(DiskIOData* data);
Expand Down

0 comments on commit 67bc7fe

Please sign in to comment.