This commit is contained in:
parent
807b59883b
commit
8ab9fb9952
@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:61efeeb78f3e39fc6c7bb91be6638c61d3033d4e43e078e951fb9c6db9657904
|
|
||||||
size 214357
|
|
433
psmisc-22.5-nfs4fuser.patch
Normal file
433
psmisc-22.5-nfs4fuser.patch
Normal file
@ -0,0 +1,433 @@
|
|||||||
|
--- src/fuser.h
|
||||||
|
+++ src/fuser.h 2007-04-26 11:28:06.922891992 +0200
|
||||||
|
@@ -80,6 +80,12 @@ struct unixsocket_list {
|
||||||
|
struct unixsocket_list *next;
|
||||||
|
};
|
||||||
|
|
||||||
|
+struct nfs_points {
|
||||||
|
+ struct nfs_points *next, *prev;
|
||||||
|
+ char * name;
|
||||||
|
+ size_t nlen;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
#define NAMESPACE_FILE 0
|
||||||
|
#define NAMESPACE_TCP 1
|
||||||
|
#define NAMESPACE_UDP 2
|
||||||
|
--- src/fuser.c
|
||||||
|
+++ src/fuser.c 2007-04-26 15:12:59.747963078 +0200
|
||||||
|
@@ -32,6 +32,7 @@
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <errno.h>
|
||||||
|
+#include <sys/param.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
|
@@ -62,7 +63,7 @@
|
||||||
|
static void add_matched_proc(struct names *name_list, const pid_t pid, const uid_t uid, const char access);
|
||||||
|
static void check_dir(const pid_t pid, const char *dirname, struct device_list *dev_head, struct inode_list *ino_head, const uid_t uid, const char access);
|
||||||
|
static void check_map(const pid_t pid, const char *filename, struct device_list *dev_head, struct inode_list *ino_head, const uid_t uid, const char access);
|
||||||
|
-static struct stat *get_pidstat(const pid_t pid, const char *filename);
|
||||||
|
+static struct stat *get_pidstat(const opt_type opts, const pid_t pid, const char *filename, char *real);
|
||||||
|
static uid_t getpiduid(const pid_t pid);
|
||||||
|
static int print_matches(struct names *names_head, const opt_type opts, const int sig_number);
|
||||||
|
static void kill_matched_proc(struct procs *pptr, const opt_type opts, const int sig_number);
|
||||||
|
@@ -72,13 +73,16 @@ static void add_device(struct device_lis
|
||||||
|
void scan_mount_devices(const opt_type opts, struct mountdev_list **mount_devices);
|
||||||
|
void fill_unix_cache(struct unixsocket_list **unixsocket_head);
|
||||||
|
static dev_t find_net_dev(void);
|
||||||
|
-static void scan_procs(struct names *names_head, struct inode_list *ino_head, struct device_list *dev_head);
|
||||||
|
+static void scan_procs(const opt_type opts, struct names *names_head, struct inode_list *ino_head, struct device_list *dev_head);
|
||||||
|
#ifdef NFS_CHECKS
|
||||||
|
static void scan_knfsd(struct names *names_head, struct device_list *dev_head);
|
||||||
|
#endif /* NFS_CHECKS */
|
||||||
|
#ifdef DEBUG
|
||||||
|
static void debug_match_lists(struct names *names_head, struct inode_list *ino_head, struct device_list *dev_head);
|
||||||
|
#endif
|
||||||
|
+static struct nfs_points *mnts;
|
||||||
|
+static void init_nfs(void);
|
||||||
|
+static int check4nfs(const char * path, char * real);
|
||||||
|
|
||||||
|
static void usage (const char *errormsg)
|
||||||
|
{
|
||||||
|
@@ -125,7 +129,7 @@ void print_version()
|
||||||
|
"For more information about these matters, see the files named COPYING.\n"));
|
||||||
|
}
|
||||||
|
|
||||||
|
-static void scan_procs(struct names *names_head, struct inode_list *ino_head, struct device_list *dev_head)
|
||||||
|
+static void scan_procs(const opt_type opts, struct names *names_head, struct inode_list *ino_head, struct device_list *dev_head)
|
||||||
|
{
|
||||||
|
DIR *topproc_dir;
|
||||||
|
struct dirent *topproc_dent;
|
||||||
|
@@ -135,6 +139,9 @@ static void scan_procs(struct names *nam
|
||||||
|
pid_t pid, my_pid;
|
||||||
|
uid_t uid;
|
||||||
|
struct stat *cwd_stat, *exe_stat, *root_stat;
|
||||||
|
+ char root_real[PATH_MAX+1];
|
||||||
|
+ char cwd_real[PATH_MAX+1];
|
||||||
|
+ char exe_real[PATH_MAX+1];
|
||||||
|
|
||||||
|
if ( (fd_dirpath = malloc(MAX_PATHNAME)) == NULL)
|
||||||
|
return;
|
||||||
|
@@ -155,19 +162,30 @@ static void scan_procs(struct names *nam
|
||||||
|
continue;
|
||||||
|
uid = getpiduid(pid);
|
||||||
|
|
||||||
|
- root_stat = get_pidstat(pid, "root");
|
||||||
|
- cwd_stat = get_pidstat(pid, "cwd");
|
||||||
|
- exe_stat = get_pidstat(pid, "exe");
|
||||||
|
+ root_real[0] = cwd_real[0] = exe_real[0] = '\0';
|
||||||
|
+ root_stat = get_pidstat(opts, pid, "root", root_real);
|
||||||
|
+ cwd_stat = get_pidstat(opts, pid, "cwd", cwd_real);
|
||||||
|
+ exe_stat = get_pidstat(opts, pid, "exe", exe_real);
|
||||||
|
/* Scan the devices */
|
||||||
|
for (dev_tmp = dev_head ; dev_tmp != NULL ; dev_tmp = dev_tmp->next) {
|
||||||
|
+ const char* filename = dev_tmp->name->filename;
|
||||||
|
+ size_t len = strlen(filename);
|
||||||
|
if (exe_stat != NULL && exe_stat->st_dev == dev_tmp->device)
|
||||||
|
add_matched_proc(dev_tmp->name, pid, uid, ACCESS_EXE);
|
||||||
|
if (root_stat != NULL && root_stat->st_dev == dev_tmp->device)
|
||||||
|
add_matched_proc(dev_tmp->name, pid, uid, ACCESS_ROOT);
|
||||||
|
if (cwd_stat != NULL && cwd_stat->st_dev == dev_tmp->device)
|
||||||
|
add_matched_proc(dev_tmp->name, pid, uid, ACCESS_CWD);
|
||||||
|
+ if (exe_real[0] != '\0' && !strncmp(&exe_real[0], filename, len))
|
||||||
|
+ add_matched_proc(dev_tmp->name, pid, uid, ACCESS_EXE);
|
||||||
|
+ if (root_real[0] != '\0' && !strncmp(&root_real[0], filename, len))
|
||||||
|
+ add_matched_proc(dev_tmp->name, pid, uid, ACCESS_ROOT);
|
||||||
|
+ if (cwd_real[0] != '\0' && !strncmp(&cwd_real[0], filename, len))
|
||||||
|
+ add_matched_proc(dev_tmp->name, pid, uid, ACCESS_CWD);
|
||||||
|
}
|
||||||
|
for (ino_tmp = ino_head ; ino_tmp != NULL ; ino_tmp = ino_tmp->next) {
|
||||||
|
+ const char* filename = ino_tmp->name->filename;
|
||||||
|
+ size_t len = strlen(filename);
|
||||||
|
if (exe_stat != NULL) {
|
||||||
|
if (exe_stat->st_dev == ino_tmp->device && exe_stat->st_ino == ino_tmp->inode) {
|
||||||
|
add_matched_proc(ino_tmp->name, pid, uid, ACCESS_EXE);
|
||||||
|
@@ -184,6 +202,21 @@ static void scan_procs(struct names *nam
|
||||||
|
add_matched_proc(ino_tmp->name, pid, uid, ACCESS_CWD);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
+ if (exe_real[0] != '\0') {
|
||||||
|
+ if (!strncmp(&exe_real[0], filename, len)) {
|
||||||
|
+ add_matched_proc(ino_tmp->name, pid, uid, ACCESS_EXE);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ if (root_real[0] != '\0') {
|
||||||
|
+ if (!strncmp(&root_real[0], filename, len)) {
|
||||||
|
+ add_matched_proc(ino_tmp->name, pid, uid, ACCESS_ROOT);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ if (cwd_real[0] != '\0') {
|
||||||
|
+ if (!strncmp(&cwd_real[0], filename, len)) {
|
||||||
|
+ add_matched_proc(ino_tmp->name, pid, uid, ACCESS_CWD);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
check_dir(pid, "lib", dev_head, ino_head, uid, ACCESS_MMAP);
|
||||||
|
check_dir(pid, "mmap", dev_head, ino_head, uid, ACCESS_MMAP);
|
||||||
|
@@ -323,10 +356,25 @@ int parse_mount(struct names *this_name,
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
-int parse_file(struct names *this_name, struct inode_list **ino_list)
|
||||||
|
+int parse_file(struct names *this_name, struct inode_list **ino_list, const opt_type opts)
|
||||||
|
{
|
||||||
|
+ char real[PATH_MAX+1] = "";
|
||||||
|
struct stat st;
|
||||||
|
|
||||||
|
+ real[0] = '\0';
|
||||||
|
+ if (check4nfs(this_name->filename, real)) {
|
||||||
|
+ if ((opts & (OPT_MOUNTPOINT|OPT_MOUNTS)) == 0) {
|
||||||
|
+ free(this_name->filename);
|
||||||
|
+ this_name->filename = strdup(real);
|
||||||
|
+ add_inode(ino_list, this_name, st.st_dev, st.st_ino);
|
||||||
|
+ return 0;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ if (real[0] != '\0') {
|
||||||
|
+ free(this_name->filename);
|
||||||
|
+ this_name->filename = strdup(real);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
if (stat(this_name->filename, &st) != 0) {
|
||||||
|
fprintf(stderr,_("Cannot stat %s: %s\n"), this_name->filename,
|
||||||
|
strerror(errno));
|
||||||
|
@@ -340,30 +388,31 @@ int parse_file(struct names *this_name,
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
-int parse_unixsockets(struct names *this_name, struct inode_list **ino_list, struct unixsocket_list *sun_head)
|
||||||
|
+int parse_unixsockets(struct names *this_name, struct inode_list **ino_list, struct unixsocket_list *sun_head, dev_t net_dev, const opt_type opts)
|
||||||
|
{
|
||||||
|
struct unixsocket_list *sun_tmp;
|
||||||
|
struct stat st;
|
||||||
|
- dev_t net_dev;
|
||||||
|
-
|
||||||
|
+
|
||||||
|
+ if (check4nfs(this_name->filename, NULL))
|
||||||
|
+ return 0;
|
||||||
|
+
|
||||||
|
if (stat(this_name->filename, &st) != 0) {
|
||||||
|
fprintf(stderr,_("Cannot stat %s: %s\n"), this_name->filename,
|
||||||
|
strerror(errno));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
- net_dev = find_net_dev();
|
||||||
|
|
||||||
|
for (sun_tmp = sun_head; sun_tmp != NULL ; sun_tmp = sun_tmp->next)
|
||||||
|
{
|
||||||
|
- if (sun_tmp->dev == st.st_dev && sun_tmp->inode == st.st_ino) {
|
||||||
|
+ if (sun_tmp->dev == st.st_dev && sun_tmp->inode == st.st_ino) {
|
||||||
|
add_inode(ino_list, this_name, net_dev, sun_tmp->net_inode);
|
||||||
|
- return 0;
|
||||||
|
+ return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
-int parse_mounts(struct names *this_name, struct mountdev_list *mounts, struct device_list **dev_list, const char opts)
|
||||||
|
+int parse_mounts(struct names *this_name, struct mountdev_list *mounts, struct device_list **dev_list, const opt_type opts)
|
||||||
|
{
|
||||||
|
struct stat st;
|
||||||
|
struct mountdev_list *mountptr;
|
||||||
|
@@ -650,6 +699,117 @@ void find_net6_sockets(struct inode_list
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
+/*
|
||||||
|
+ * Remember all NFS typed partitions.
|
||||||
|
+ */
|
||||||
|
+static void init_nfs(void)
|
||||||
|
+{
|
||||||
|
+ struct stat st;
|
||||||
|
+ struct mntent * ent;
|
||||||
|
+ FILE * mnt;
|
||||||
|
+
|
||||||
|
+ mnts = (struct nfs_points*)0;
|
||||||
|
+
|
||||||
|
+ if (stat("/proc/version", &st) < 0)
|
||||||
|
+ return;
|
||||||
|
+ if ((mnt = setmntent("/proc/mounts", "r")) == (FILE*)0)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ while ((ent = getmntent(mnt))) {
|
||||||
|
+ if (!strcasecmp(MNTTYPE_NFS, ent->mnt_type)) {
|
||||||
|
+ struct nfs_points * p = (struct nfs_points*)malloc(sizeof(struct nfs_points));
|
||||||
|
+ if (!p)
|
||||||
|
+ goto out;
|
||||||
|
+ p->name = (char*)malloc(strlen(ent->mnt_dir)+1);
|
||||||
|
+ if (!p->name)
|
||||||
|
+ goto out;
|
||||||
|
+ strcpy(p->name, ent->mnt_dir);
|
||||||
|
+ p->nlen = strlen(p->name);
|
||||||
|
+ if (mnts)
|
||||||
|
+ mnts->prev = p;
|
||||||
|
+ p->next = mnts;
|
||||||
|
+ p->prev = (struct nfs_points*)0;
|
||||||
|
+ mnts = p;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+out:
|
||||||
|
+ endmntent(mnt);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+/*
|
||||||
|
+ * Check path is located on a NFS partition.
|
||||||
|
+ */
|
||||||
|
+static int check4nfs(const char * path, char * real)
|
||||||
|
+{
|
||||||
|
+ char buf[PATH_MAX+1];
|
||||||
|
+ const char *curr;
|
||||||
|
+ int deep = MAXSYMLINKS;
|
||||||
|
+
|
||||||
|
+ if (!mnts) return 0;
|
||||||
|
+
|
||||||
|
+ curr = path;
|
||||||
|
+ do {
|
||||||
|
+ const char *prev;
|
||||||
|
+ int len;
|
||||||
|
+
|
||||||
|
+ if ((prev = strdupa(curr)) == NULL)
|
||||||
|
+ return 0;
|
||||||
|
+
|
||||||
|
+ errno = 0;
|
||||||
|
+ if ((len = readlink(curr, buf, PATH_MAX)) < 0)
|
||||||
|
+ break;
|
||||||
|
+ buf[len] = '\0'; /* Don't be fooled by readlink(2) */
|
||||||
|
+
|
||||||
|
+ if (strncmp(prev, "/proc/", 6) == 0) {
|
||||||
|
+ curr = &buf[0];
|
||||||
|
+ break; /* /proc/ provides the real path! */
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (len > 10) {
|
||||||
|
+ char *const ptr = &buf[len - 10];
|
||||||
|
+ if (strcmp(ptr, " (deleted)") == 0) {
|
||||||
|
+ *ptr = '\0';
|
||||||
|
+ curr = &buf[0];
|
||||||
|
+ break; /* Path is deleted from VFS cache */
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (buf[0] != '/') {
|
||||||
|
+ const char *slash;
|
||||||
|
+
|
||||||
|
+ if ((slash = strrchr(prev, '/'))) {
|
||||||
|
+ size_t off = slash - prev + 1;
|
||||||
|
+
|
||||||
|
+ if (off + len > PATH_MAX)
|
||||||
|
+ len = PATH_MAX - off;
|
||||||
|
+
|
||||||
|
+ memmove(&buf[off], &buf[0], len + 1);
|
||||||
|
+ memcpy(&buf[0], prev, off);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ curr = &buf[0];
|
||||||
|
+
|
||||||
|
+ if (deep-- <= 0) return 0;
|
||||||
|
+
|
||||||
|
+ } while (1);
|
||||||
|
+
|
||||||
|
+ if (real) strcpy(real, curr);
|
||||||
|
+
|
||||||
|
+ if (errno == EINVAL) {
|
||||||
|
+ struct nfs_points *p, *n, *l;
|
||||||
|
+ n = mnts;
|
||||||
|
+ l = (struct nfs_points*)0;
|
||||||
|
+ for (p = mnts; n; p = n) {
|
||||||
|
+ l = p->prev;
|
||||||
|
+ n = p->next;
|
||||||
|
+ if (!strncmp(curr, p->name, p->nlen))
|
||||||
|
+ return 1;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
opt_type opts;
|
||||||
|
@@ -662,7 +822,7 @@ int main(int argc, char *argv[])
|
||||||
|
struct device_list *match_devices = NULL;
|
||||||
|
struct unixsocket_list *unixsockets = NULL;
|
||||||
|
|
||||||
|
- dev_t netdev;
|
||||||
|
+ dev_t netdev = find_net_dev();
|
||||||
|
struct ip_connections *tcp_connection_list = NULL;
|
||||||
|
struct ip_connections *udp_connection_list = NULL;
|
||||||
|
#ifdef WITH_IPV6
|
||||||
|
@@ -682,10 +842,6 @@ int main(int argc, char *argv[])
|
||||||
|
opts = 0;
|
||||||
|
sig_number = SIGKILL;
|
||||||
|
|
||||||
|
- netdev = find_net_dev();
|
||||||
|
- scan_mount_devices(opts, &mount_devices);
|
||||||
|
- fill_unix_cache(&unixsockets);
|
||||||
|
-
|
||||||
|
/* getopt doesnt like things like -SIGBLAH */
|
||||||
|
for(optc = 1; optc < argc; optc++) {
|
||||||
|
if (argv[optc][0] == '-') { /* its an option */
|
||||||
|
@@ -773,6 +929,11 @@ int main(int argc, char *argv[])
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+ init_nfs();
|
||||||
|
+ scan_mount_devices(opts, &mount_devices);
|
||||||
|
+ fill_unix_cache(&unixsockets);
|
||||||
|
+
|
||||||
|
/* File specifications */
|
||||||
|
if ( (this_name = malloc(sizeof(struct names))) == NULL)
|
||||||
|
continue;
|
||||||
|
@@ -819,8 +980,8 @@ int main(int argc, char *argv[])
|
||||||
|
break;
|
||||||
|
default: /* FILE */
|
||||||
|
this_name->filename = strdup(argv[optc]);
|
||||||
|
- parse_file(this_name, &match_inodes);
|
||||||
|
- parse_unixsockets(this_name, &match_inodes, unixsockets);
|
||||||
|
+ parse_file(this_name, &match_inodes, opts);
|
||||||
|
+ parse_unixsockets(this_name, &match_inodes, unixsockets, netdev, opts);
|
||||||
|
if (opts & OPT_MOUNTPOINT || opts & OPT_MOUNTS)
|
||||||
|
parse_mounts(this_name, mount_devices, &match_devices, opts);
|
||||||
|
break;
|
||||||
|
@@ -848,22 +1009,22 @@ int main(int argc, char *argv[])
|
||||||
|
if (!ipv4_only) {
|
||||||
|
#endif
|
||||||
|
if (tcp_connection_list != NULL)
|
||||||
|
- find_net_sockets(&match_inodes, tcp_connection_list, "tcp",netdev);
|
||||||
|
+ find_net_sockets(&match_inodes, tcp_connection_list, "tcp", netdev);
|
||||||
|
if (udp_connection_list != NULL)
|
||||||
|
- find_net_sockets(&match_inodes, udp_connection_list, "udp",netdev);
|
||||||
|
+ find_net_sockets(&match_inodes, udp_connection_list, "udp", netdev);
|
||||||
|
#ifdef WITH_IPV6
|
||||||
|
}
|
||||||
|
if (!ipv6_only) {
|
||||||
|
if (tcp6_connection_list != NULL)
|
||||||
|
- find_net6_sockets(&match_inodes, tcp6_connection_list, "tcp",netdev);
|
||||||
|
+ find_net6_sockets(&match_inodes, tcp6_connection_list, "tcp", netdev);
|
||||||
|
if (udp6_connection_list != NULL)
|
||||||
|
- find_net6_sockets(&match_inodes, udp6_connection_list, "udp",netdev);
|
||||||
|
+ find_net6_sockets(&match_inodes, udp6_connection_list, "udp", netdev);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#ifdef DEBUG
|
||||||
|
debug_match_lists(names_head, match_inodes, match_devices);
|
||||||
|
#endif
|
||||||
|
- scan_procs(names_head, match_inodes, match_devices);
|
||||||
|
+ scan_procs(opts, names_head, match_inodes, match_devices);
|
||||||
|
#ifdef NFS_CHECKS
|
||||||
|
scan_knfsd(names_head, match_devices);
|
||||||
|
#endif /* NFS_CHECKS */
|
||||||
|
@@ -969,7 +1130,7 @@ static int print_matches(struct names *n
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
-static struct stat *get_pidstat(const pid_t pid, const char *filename)
|
||||||
|
+static struct stat *get_pidstat(const opt_type opts, const pid_t pid, const char *filename, char *real)
|
||||||
|
{
|
||||||
|
char pathname[256];
|
||||||
|
struct stat *st;
|
||||||
|
@@ -977,6 +1138,10 @@ static struct stat *get_pidstat(const pi
|
||||||
|
if ( (st = malloc(sizeof(struct stat))) == NULL)
|
||||||
|
return NULL;
|
||||||
|
snprintf(pathname, 256, "/proc/%d/%s", pid, filename);
|
||||||
|
+ if (check4nfs(pathname, real)) {
|
||||||
|
+ if ((opts & (OPT_MOUNTPOINT|OPT_MOUNTS)) == 0)
|
||||||
|
+ return NULL;
|
||||||
|
+ }
|
||||||
|
if (stat(pathname, st) != 0)
|
||||||
|
return NULL;
|
||||||
|
else
|
||||||
|
@@ -1135,6 +1300,7 @@ void scan_mount_devices(const opt_type o
|
||||||
|
FILE *mntfp;
|
||||||
|
struct mntent *mnt_ptr;
|
||||||
|
struct stat st;
|
||||||
|
+ char real[PATH_MAX+1] = "";
|
||||||
|
|
||||||
|
if ( (mntfp = setmntent("/etc/mtab","r")) == NULL) {
|
||||||
|
fprintf(stderr, _("Cannot open /etc/mtab: %s\n"),
|
||||||
|
@@ -1142,10 +1308,22 @@ void scan_mount_devices(const opt_type o
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
while ( (mnt_ptr = getmntent(mntfp)) != NULL) {
|
||||||
|
+ real[0] = '\0';
|
||||||
|
+ if (check4nfs(mnt_ptr->mnt_dir, real)) {
|
||||||
|
+ if ((opts & (OPT_MOUNTPOINT|OPT_MOUNTS)) == 0) {
|
||||||
|
+ add_mount_device(mount_devices, mnt_ptr->mnt_fsname, real, (dev_t)0);
|
||||||
|
+ continue;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ if ((real[0] != '\0') && (stat(real, &st) == 0)) {
|
||||||
|
+ add_mount_device(mount_devices, mnt_ptr->mnt_fsname, real, st.st_dev);
|
||||||
|
+ continue;
|
||||||
|
+ }
|
||||||
|
if (stat(mnt_ptr->mnt_dir, &st) == 0) {
|
||||||
|
add_mount_device(mount_devices, mnt_ptr->mnt_fsname, mnt_ptr->mnt_dir, st.st_dev);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
+ endmntent(mntfp);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
@ -1,18 +1,6 @@
|
|||||||
Index: psmisc-21.5/src/pstree.c
|
--- src/pstree.c
|
||||||
================================================================================
|
+++ src/pstree.c 2007-04-25 00:00:00.000000000 +0200
|
||||||
--- psmisc-21.7/po/Makefile.in.in
|
@@ -63,6 +63,7 @@ extern const char *__progname;
|
||||||
+++ psmisc-21.7/po/Makefile.in.in
|
|
||||||
@@ -29,7 +29,6 @@
|
|
||||||
INSTALL = @INSTALL@
|
|
||||||
INSTALL_DATA = @INSTALL_DATA@
|
|
||||||
MKINSTALLDIRS = @MKINSTALLDIRS@
|
|
||||||
-mkinstalldirs = $(SHELL) $(MKINSTALLDIRS)
|
|
||||||
|
|
||||||
GMSGFMT = @GMSGFMT@
|
|
||||||
MSGFMT = @MSGFMT@
|
|
||||||
--- psmisc-21.7/src/pstree.c
|
|
||||||
+++ psmisc-21.7/src/pstree.c
|
|
||||||
@@ -63,6 +63,7 @@
|
|
||||||
#define UTF_HD "\342\224\254" /* U+252C, Horizontal and down */
|
#define UTF_HD "\342\224\254" /* U+252C, Horizontal and down */
|
||||||
|
|
||||||
#define VT_BEG "\033(0\017" /* use graphic chars */
|
#define VT_BEG "\033(0\017" /* use graphic chars */
|
||||||
@ -20,7 +8,7 @@ Index: psmisc-21.5/src/pstree.c
|
|||||||
#define VT_END "\033(B" /* back to normal char set */
|
#define VT_END "\033(B" /* back to normal char set */
|
||||||
#define VT_V "x" /* see UTF definitions above */
|
#define VT_V "x" /* see UTF definitions above */
|
||||||
#define VT_VR "t"
|
#define VT_VR "t"
|
||||||
@@ -113,13 +114,21 @@
|
@@ -113,13 +114,21 @@ sym_ascii =
|
||||||
UTF_VR UTF_H,
|
UTF_VR UTF_H,
|
||||||
|
|
||||||
UTF_V " ",
|
UTF_V " ",
|
||||||
@ -47,7 +35,7 @@ Index: psmisc-21.5/src/pstree.c
|
|||||||
|
|
||||||
, *sym = &sym_ascii;
|
, *sym = &sym_ascii;
|
||||||
|
|
||||||
@@ -144,9 +153,13 @@
|
@@ -144,9 +153,13 @@ out_char (char c)
|
||||||
putchar (c);
|
putchar (c);
|
||||||
if (cur_x == output_width + 1 && trunc && ((c & 0xc0) != 0x80))
|
if (cur_x == output_width + 1 && trunc && ((c & 0xc0) != 0x80))
|
||||||
{
|
{
|
||||||
@ -63,7 +51,7 @@ Index: psmisc-21.5/src/pstree.c
|
|||||||
{
|
{
|
||||||
last_char = c;
|
last_char = c;
|
||||||
cur_x--;
|
cur_x--;
|
||||||
@@ -163,6 +176,26 @@
|
@@ -163,6 +176,26 @@ out_string (const char *str)
|
||||||
out_char (*str++);
|
out_char (*str++);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -90,7 +78,7 @@ Index: psmisc-21.5/src/pstree.c
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
out_int (int x) /* non-negative integers only */
|
out_int (int x) /* non-negative integers only */
|
||||||
@@ -379,7 +412,11 @@
|
@@ -379,7 +412,11 @@ dump_tree (PROC * current, int level, in
|
||||||
{
|
{
|
||||||
for (i = width[lvl] + 1; i; i--)
|
for (i = width[lvl] + 1; i; i--)
|
||||||
out_char (' ');
|
out_char (' ');
|
||||||
@ -103,7 +91,7 @@ Index: psmisc-21.5/src/pstree.c
|
|||||||
more[lvl + 1] ? sym->vert_2 : sym->empty_2);
|
more[lvl + 1] ? sym->vert_2 : sym->empty_2);
|
||||||
}
|
}
|
||||||
if (rep < 2)
|
if (rep < 2)
|
||||||
@@ -489,7 +526,7 @@
|
@@ -489,7 +526,7 @@ dump_tree (PROC * current, int level, in
|
||||||
width[level] = comm_len + cur_x - offset + add;
|
width[level] = comm_len + cur_x - offset + add;
|
||||||
if (cur_x >= output_width && trunc)
|
if (cur_x >= output_width && trunc)
|
||||||
{
|
{
|
||||||
@ -112,7 +100,7 @@ Index: psmisc-21.5/src/pstree.c
|
|||||||
out_string ("+");
|
out_string ("+");
|
||||||
out_newline ();
|
out_newline ();
|
||||||
}
|
}
|
||||||
@@ -516,7 +553,7 @@
|
@@ -516,7 +553,7 @@ dump_tree (PROC * current, int level, in
|
||||||
}
|
}
|
||||||
if (first)
|
if (first)
|
||||||
{
|
{
|
24
psmisc-22.5.dif
Normal file
24
psmisc-22.5.dif
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
--- configure.ac
|
||||||
|
+++ configure.ac 2007-04-25 16:58:08.888830481 +0200
|
||||||
|
@@ -1,10 +1,10 @@
|
||||||
|
dnl Process this file with autoconf to produce a configure script.
|
||||||
|
-AC_PREREQ(2.61)
|
||||||
|
+AC_PREREQ(2.60)
|
||||||
|
AC_INIT([psmisc],[22.5])
|
||||||
|
AC_CONFIG_SRCDIR([src/comm.h])
|
||||||
|
AC_CONFIG_HEADER([config.h])
|
||||||
|
AC_CONFIG_AUX_DIR([config])
|
||||||
|
-AM_INIT_AUTOMAKE([1.10])
|
||||||
|
+AM_INIT_AUTOMAKE([1.9.6])
|
||||||
|
|
||||||
|
dnl Checks for programs.
|
||||||
|
AC_PROG_CXX
|
||||||
|
@@ -68,7 +68,7 @@
|
||||||
|
|
||||||
|
dnl Check for language stuff
|
||||||
|
AM_GNU_GETTEXT([external])
|
||||||
|
-AM_GNU_GETTEXT_VERSION([0.16.1])
|
||||||
|
+AM_GNU_GETTEXT_VERSION([0.15])
|
||||||
|
|
||||||
|
dnl Checks for library functions.
|
||||||
|
AC_FUNC_CLOSEDIR_VOID
|
3
psmisc-22.5.tar.bz2
Normal file
3
psmisc-22.5.tar.bz2
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:57c9c29b54487cb8613a7a7d6509868b6c62001f3d589335dbcb7cb00b9f2b27
|
||||||
|
size 226753
|
@ -1,3 +1,13 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Thu Apr 26 15:36:37 CEST 2007 - werner@suse.de
|
||||||
|
|
||||||
|
- Update to psmisc-22.5
|
||||||
|
* fuser tcp works on 64bit
|
||||||
|
* Added new tool peekfd
|
||||||
|
* killall uses /proc/<pid>/exe if inode comparision fails
|
||||||
|
* fuser correctly parses remote tcp ports
|
||||||
|
- Patched fuser to avoid to be locked on stalled NFS (bug #166912)
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Thu Mar 29 12:24:57 CEST 2007 - rguenther@suse.de
|
Thu Mar 29 12:24:57 CEST 2007 - rguenther@suse.de
|
||||||
|
|
||||||
|
31
psmisc.spec
31
psmisc.spec
@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# spec file for package psmisc (Version 22.3)
|
# spec file for package psmisc (Version 22.5)
|
||||||
#
|
#
|
||||||
# Copyright (c) 2007 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
# Copyright (c) 2007 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
||||||
# This file and all modifications and additions to the pristine
|
# This file and all modifications and additions to the pristine
|
||||||
@ -11,18 +11,20 @@
|
|||||||
# norootforbuild
|
# norootforbuild
|
||||||
|
|
||||||
Name: psmisc
|
Name: psmisc
|
||||||
BuildRequires: ncurses-devel
|
BuildRequires: gcc-c++ ncurses-devel
|
||||||
URL: http://switch.dl.sourceforge.net/sourceforge/psmisc/
|
URL: http://switch.dl.sourceforge.net/sourceforge/psmisc/
|
||||||
License: GNU General Public License (GPL)
|
License: GNU General Public License (GPL)
|
||||||
Group: System/Monitoring
|
Group: System/Monitoring
|
||||||
PreReq: %fillup_prereq %insserv_prereq
|
PreReq: %fillup_prereq %insserv_prereq
|
||||||
Autoreqprov: on
|
Autoreqprov: on
|
||||||
Version: 22.3
|
Version: 22.5
|
||||||
Release: 27
|
Release: 1
|
||||||
Provides: ps:/usr/bin/killall
|
Provides: ps:/usr/bin/killall
|
||||||
Summary: Utilities for managing processes on your system
|
Summary: Utilities for managing processes on your system
|
||||||
Source: http://switch.dl.sourceforge.net/sourceforge/psmisc/psmisc-%{version}.tar.bz2
|
Source: http://switch.dl.sourceforge.net/sourceforge/psmisc/psmisc-%{version}.tar.bz2
|
||||||
Patch0: %name-21.5.diff
|
Patch0: %name-%version.dif
|
||||||
|
Patch1: %name-%version-pstree.patch
|
||||||
|
Patch2: %name-%version-nfs4fuser.patch
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||||
|
|
||||||
%description
|
%description
|
||||||
@ -41,15 +43,19 @@ Authors:
|
|||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q
|
%setup -q
|
||||||
%patch0 -p1
|
%patch1 -p0 -b .pstree
|
||||||
|
%patch2 -p0 -b .nfs4fuser
|
||||||
|
%patch0 -p0
|
||||||
|
|
||||||
%build
|
%build
|
||||||
autoreconf -fi
|
autoreconf -fi
|
||||||
CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 ${RPM_OPT_FLAGS} -pipe"
|
CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 ${RPM_OPT_FLAGS} -pipe"
|
||||||
|
CXXFLAGS="$CFLAGS"
|
||||||
CC=gcc
|
CC=gcc
|
||||||
export CFLAGS CC
|
CXX=g++
|
||||||
|
export CFLAGS CXXFLAGS CC CXX
|
||||||
sh ./configure --prefix=%{_prefix} --mandir=%{_mandir}
|
sh ./configure --prefix=%{_prefix} --mandir=%{_mandir}
|
||||||
make CFLAGS="$CFLAGS -DLOCALEDIR=\\\"/usr/share/locale\\\"" "CC=$CC"
|
make CFLAGS="$CFLAGS" "CC=$CC"
|
||||||
|
|
||||||
%install
|
%install
|
||||||
make DESTDIR=$RPM_BUILD_ROOT install
|
make DESTDIR=$RPM_BUILD_ROOT install
|
||||||
@ -65,13 +71,22 @@ rm -rf $RPM_BUILD_ROOT
|
|||||||
/bin/fuser
|
/bin/fuser
|
||||||
%{_bindir}/oldfuser
|
%{_bindir}/oldfuser
|
||||||
%{_bindir}/killall
|
%{_bindir}/killall
|
||||||
|
%{_bindir}/peekfd
|
||||||
%{_bindir}/pstree
|
%{_bindir}/pstree
|
||||||
%{_bindir}/pstree.x11
|
%{_bindir}/pstree.x11
|
||||||
%{_mandir}/man1/fuser.1*
|
%{_mandir}/man1/fuser.1*
|
||||||
%{_mandir}/man1/killall.1*
|
%{_mandir}/man1/killall.1*
|
||||||
|
%{_mandir}/man1/peekfd.1*
|
||||||
%{_mandir}/man1/pstree.1*
|
%{_mandir}/man1/pstree.1*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Thu Apr 26 2007 - werner@suse.de
|
||||||
|
- Update to psmisc-22.5
|
||||||
|
* fuser tcp works on 64bit
|
||||||
|
* Added new tool peekfd
|
||||||
|
* killall uses /proc/<pid>/exe if inode comparision fails
|
||||||
|
* fuser correctly parses remote tcp ports
|
||||||
|
- Patched fuser to avoid to be locked on stalled NFS (bug #166912)
|
||||||
* Thu Mar 29 2007 - rguenther@suse.de
|
* Thu Mar 29 2007 - rguenther@suse.de
|
||||||
- Add ncurses-devel BuildRequires
|
- Add ncurses-devel BuildRequires
|
||||||
* Fri Sep 15 2006 - werner@suse.de
|
* Fri Sep 15 2006 - werner@suse.de
|
||||||
|
Loading…
Reference in New Issue
Block a user