From 67bc7fe640bed8b8fa8006c9152442023928b756 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Sat, 26 Nov 2022 00:48:54 +0100 Subject: Clean out Platform_getInodeFilename 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 --- darwin/Platform.c | 6 ------ darwin/Platform.h | 2 -- dragonflybsd/Platform.c | 6 ------ dragonflybsd/Platform.h | 2 -- freebsd/Platform.c | 6 ------ freebsd/Platform.h | 2 -- linux/Platform.c | 55 ------------------------------------------------- linux/Platform.h | 2 -- netbsd/Platform.c | 6 ------ netbsd/Platform.h | 2 -- openbsd/Platform.c | 6 ------ openbsd/Platform.h | 2 -- pcp/Platform.c | 6 ------ pcp/Platform.h | 2 -- solaris/Platform.c | 6 ------ solaris/Platform.h | 2 -- unsupported/Platform.c | 6 ------ unsupported/Platform.h | 2 -- 18 files changed, 121 deletions(-) diff --git a/darwin/Platform.c b/darwin/Platform.c index 963d526d..e9d6caab 100644 --- a/darwin/Platform.c +++ b/darwin/Platform.c @@ -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; diff --git a/darwin/Platform.h b/darwin/Platform.h index 3fd46add..66362072 100644 --- a/darwin/Platform.h +++ b/darwin/Platform.h @@ -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); diff --git a/dragonflybsd/Platform.c b/dragonflybsd/Platform.c index b3a82bf3..944df990 100644 --- a/dragonflybsd/Platform.c +++ b/dragonflybsd/Platform.c @@ -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; diff --git a/dragonflybsd/Platform.h b/dragonflybsd/Platform.h index 3de87718..cf693562 100644 --- a/dragonflybsd/Platform.h +++ b/dragonflybsd/Platform.h @@ -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); diff --git a/freebsd/Platform.c b/freebsd/Platform.c index 3e8faaea..3f69d207 100644 --- a/freebsd/Platform.c +++ b/freebsd/Platform.c @@ -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; diff --git a/freebsd/Platform.h b/freebsd/Platform.h index 555ab902..51269c09 100644 --- a/freebsd/Platform.h +++ b/freebsd/Platform.h @@ -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); diff --git a/linux/Platform.c b/linux/Platform.c index 38f9854d..d4972d41 100644 --- a/linux/Platform.c +++ b/linux/Platform.c @@ -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; diff --git a/linux/Platform.h b/linux/Platform.h index c8849684..f6ac1880 100644 --- a/linux/Platform.h +++ b/linux/Platform.h @@ -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); diff --git a/netbsd/Platform.c b/netbsd/Platform.c index 326458f0..e2f8c880 100644 --- a/netbsd/Platform.c +++ b/netbsd/Platform.c @@ -338,12 +338,6 @@ end: 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; diff --git a/netbsd/Platform.h b/netbsd/Platform.h index f2e5823d..0e53b457 100644 --- a/netbsd/Platform.h +++ b/netbsd/Platform.h @@ -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); diff --git a/openbsd/Platform.c b/openbsd/Platform.c index 6e9d6cdf..74247484 100644 --- a/openbsd/Platform.c +++ b/openbsd/Platform.c @@ -296,12 +296,6 @@ end: 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; diff --git a/openbsd/Platform.h b/openbsd/Platform.h index 19818ff9..27d792e0 100644 --- a/openbsd/Platform.h +++ b/openbsd/Platform.h @@ -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); diff --git a/pcp/Platform.c b/pcp/Platform.c index 521e5f11..d1bd0bc4 100644 --- a/pcp/Platform.c +++ b/pcp/Platform.c @@ -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; diff --git a/pcp/Platform.h b/pcp/Platform.h index dc51c736..f06f2266 100644 --- a/pcp/Platform.h +++ b/pcp/Platform.h @@ -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); diff --git a/solaris/Platform.c b/solaris/Platform.c index 4d1b2487..a99052c3 100644 --- a/solaris/Platform.c +++ b/solaris/Platform.c @@ -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; diff --git a/solaris/Platform.h b/solaris/Platform.h index 136db197..14431e35 100644 --- a/solaris/Platform.h +++ b/solaris/Platform.h @@ -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); diff --git a/unsupported/Platform.c b/unsupported/Platform.c index 33d7c415..fcccb21a 100644 --- a/unsupported/Platform.c +++ b/unsupported/Platform.c @@ -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; diff --git a/unsupported/Platform.h b/unsupported/Platform.h index 69191e35..f475dda4 100644 --- a/unsupported/Platform.h +++ b/unsupported/Platform.h @@ -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); -- cgit v1.2.3