Update to psmisc-23.2 + mountinfo commit
OBS-URL: https://build.opensuse.org/package/show/Base:System/psmisc?expand=0&rev=107
This commit is contained in:
parent
db5abdfcfa
commit
07c0ab41a5
@ -1,6 +1,6 @@
|
||||
From 28805c3dda0ce9c78f046974454c0bb8dfee615b Mon Sep 17 00:00:00 2001
|
||||
From b2adb830fb54f1d4ae227008fc8894aa9b202f82 Mon Sep 17 00:00:00 2001
|
||||
From: Werner Fink <werner@suse.de>
|
||||
Date: Thu, 29 Jun 2017 15:18:28 +0200
|
||||
Date: Mon, 22 Oct 2018 12:02:50 +0200
|
||||
Subject: [PATCH] Use mountinfo to be able to use the mount identity
|
||||
|
||||
which allows to distinguish different mounts with the
|
||||
@ -14,11 +14,11 @@ get the real mount ID for each file
|
||||
Signed-off-by: Werner Fink <werner@suse.de>
|
||||
---
|
||||
configure.ac | 18 +-
|
||||
src/fuser.c | 540 +++++++++++++++++++++--------
|
||||
src/fuser.c | 532 +++++++++++++++++++++++++++----------
|
||||
src/fuser.h | 19 +-
|
||||
testsuite/Makefile.am | 3 +-
|
||||
testsuite/killall.test/killall.exp | 4 +
|
||||
5 files changed, 436 insertions(+), 148 deletions(-)
|
||||
5 files changed, 432 insertions(+), 144 deletions(-)
|
||||
|
||||
diff --git configure.ac configure.ac
|
||||
index 176a2fc..d8d3366 100644
|
||||
@ -64,7 +64,7 @@ index 176a2fc..d8d3366 100644
|
||||
dnl Checks for typedefs, structures, and compiler characteristics.
|
||||
AC_C_CONST
|
||||
diff --git src/fuser.c src/fuser.c
|
||||
index 31ef30c..e5337cd 100644
|
||||
index c44cee8..78d2683 100644
|
||||
--- src/fuser.c
|
||||
+++ src/fuser.c
|
||||
@@ -32,6 +32,10 @@
|
||||
@ -78,7 +78,7 @@ index 31ef30c..e5337cd 100644
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
@@ -78,7 +82,7 @@ static void check_map(const pid_t pid, const char *filename,
|
||||
@@ -79,7 +83,7 @@ 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);
|
||||
@ -87,7 +87,7 @@ index 31ef30c..e5337cd 100644
|
||||
static uid_t getpiduid(const pid_t pid);
|
||||
static int print_matches(struct names *names_head, const opt_type opts,
|
||||
const int sig_number);
|
||||
@@ -88,8 +92,8 @@ static int kill_matched_proc(struct procs *pptr, const opt_type opts,
|
||||
@@ -89,8 +93,8 @@ static int kill_matched_proc(struct procs *pptr, const opt_type opts,
|
||||
/*int parse_mount(struct names *this_name, struct device_list **dev_list);*/
|
||||
static void add_device(struct device_list **dev_list,
|
||||
struct names *this_name, dev_t device);
|
||||
@ -98,7 +98,7 @@ index 31ef30c..e5337cd 100644
|
||||
static void atexit_clear_unix_cache();
|
||||
static dev_t find_net_dev(void);
|
||||
static void scan_procs(struct names *names_head, struct inode_list *ino_head,
|
||||
@@ -108,9 +112,12 @@ static void debug_match_lists(struct names *names_head,
|
||||
@@ -109,9 +113,12 @@ static void debug_match_lists(struct names *names_head,
|
||||
struct device_list *dev_head);
|
||||
#endif
|
||||
|
||||
@ -112,7 +112,7 @@ index 31ef30c..e5337cd 100644
|
||||
static int mntstat(const char *path, struct stat *buf);
|
||||
#endif
|
||||
static stat_t thestat = stat;
|
||||
@@ -198,6 +205,7 @@ scan_procs(struct names *names_head, struct inode_list *ino_head,
|
||||
@@ -199,6 +206,7 @@ scan_procs(struct names *names_head, struct inode_list *ino_head,
|
||||
struct stat *cwd_stat = NULL;
|
||||
struct stat *exe_stat = NULL;
|
||||
struct stat *root_stat = NULL;
|
||||
@ -120,7 +120,7 @@ index 31ef30c..e5337cd 100644
|
||||
|
||||
if (topproc_dent->d_name[0] < '0' || topproc_dent->d_name[0] > '9') /* Not a process */
|
||||
continue;
|
||||
@@ -207,9 +215,9 @@ scan_procs(struct names *names_head, struct inode_list *ino_head,
|
||||
@@ -208,9 +216,9 @@ scan_procs(struct names *names_head, struct inode_list *ino_head,
|
||||
continue;
|
||||
uid = getpiduid(pid);
|
||||
|
||||
@ -133,7 +133,7 @@ index 31ef30c..e5337cd 100644
|
||||
cwd_dev = cwd_stat ? cwd_stat->st_dev : 0;
|
||||
exe_dev = exe_stat ? exe_stat->st_dev : 0;
|
||||
root_dev = root_stat ? root_stat->st_dev : 0;
|
||||
@@ -217,21 +225,21 @@ scan_procs(struct names *names_head, struct inode_list *ino_head,
|
||||
@@ -218,21 +226,21 @@ scan_procs(struct names *names_head, struct inode_list *ino_head,
|
||||
/* Scan the devices */
|
||||
for (dev_tmp = dev_head; dev_tmp != NULL;
|
||||
dev_tmp = dev_tmp->next) {
|
||||
@ -165,7 +165,7 @@ index 31ef30c..e5337cd 100644
|
||||
if (exe_stat
|
||||
&& exe_stat->st_dev == ino_tmp->device
|
||||
&& exe_stat->st_ino == ino_tmp->inode)
|
||||
@@ -240,7 +248,7 @@ scan_procs(struct names *names_head, struct inode_list *ino_head,
|
||||
@@ -241,7 +249,7 @@ scan_procs(struct names *names_head, struct inode_list *ino_head,
|
||||
}
|
||||
if (root_dev == ino_tmp->device) {
|
||||
if (!root_stat)
|
||||
@ -174,7 +174,7 @@ index 31ef30c..e5337cd 100644
|
||||
if (root_stat
|
||||
&& root_stat->st_dev == ino_tmp->device
|
||||
&& root_stat->st_ino == ino_tmp->inode)
|
||||
@@ -249,7 +257,7 @@ scan_procs(struct names *names_head, struct inode_list *ino_head,
|
||||
@@ -250,7 +258,7 @@ scan_procs(struct names *names_head, struct inode_list *ino_head,
|
||||
}
|
||||
if (cwd_dev == ino_tmp->device) {
|
||||
if (!cwd_stat)
|
||||
@ -183,7 +183,7 @@ index 31ef30c..e5337cd 100644
|
||||
if (cwd_stat
|
||||
&& cwd_stat->st_dev == ino_tmp->device
|
||||
&& cwd_stat->st_ino == ino_tmp->inode)
|
||||
@@ -290,6 +298,7 @@ add_inode(struct inode_list **ino_list, struct names *this_name,
|
||||
@@ -291,6 +299,7 @@ add_inode(struct inode_list **ino_list, struct names *this_name,
|
||||
ino_tmp->name = this_name;
|
||||
ino_tmp->device = device;
|
||||
ino_tmp->inode = inode;
|
||||
@ -191,7 +191,7 @@ index 31ef30c..e5337cd 100644
|
||||
ino_tmp->next = ino_head;
|
||||
*ino_list = ino_tmp;
|
||||
}
|
||||
@@ -309,6 +318,7 @@ add_device(struct device_list **dev_list, struct names *this_name, dev_t device)
|
||||
@@ -310,6 +319,7 @@ add_device(struct device_list **dev_list, struct names *this_name, dev_t device)
|
||||
dev_head = *dev_list;
|
||||
dev_tmp->name = this_name;
|
||||
dev_tmp->device = device;
|
||||
@ -199,7 +199,7 @@ index 31ef30c..e5337cd 100644
|
||||
dev_tmp->next = dev_head;
|
||||
*dev_list = dev_tmp;
|
||||
}
|
||||
@@ -450,13 +460,15 @@ add_special_proc(struct names *name_list, const char ptype, const uid_t uid,
|
||||
@@ -451,13 +461,15 @@ add_special_proc(struct names *name_list, const char ptype, const uid_t uid,
|
||||
int parse_file(struct names *this_name, struct inode_list **ino_list,
|
||||
const opt_type opts)
|
||||
{
|
||||
@ -216,7 +216,7 @@ index 31ef30c..e5337cd 100644
|
||||
if (errno == ENOENT)
|
||||
fprintf(stderr,
|
||||
_("Specified filename %s does not exist.\n"),
|
||||
@@ -466,10 +478,12 @@ int parse_file(struct names *this_name, struct inode_list **ino_list,
|
||||
@@ -467,10 +479,12 @@ int parse_file(struct names *this_name, struct inode_list **ino_list,
|
||||
this_name->filename, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
@ -231,7 +231,7 @@ index 31ef30c..e5337cd 100644
|
||||
#endif /* DEBUG */
|
||||
add_inode(ino_list, this_name, this_name->st.st_dev,
|
||||
this_name->st.st_ino);
|
||||
@@ -501,11 +515,51 @@ parse_mounts(struct names *this_name, struct device_list **dev_list,
|
||||
@@ -502,11 +516,51 @@ parse_mounts(struct names *this_name, struct device_list **dev_list,
|
||||
const opt_type opts)
|
||||
{
|
||||
dev_t match_device;
|
||||
@ -283,7 +283,7 @@ index 31ef30c..e5337cd 100644
|
||||
add_device(dev_list, this_name, match_device);
|
||||
return 0;
|
||||
}
|
||||
@@ -620,7 +674,7 @@ int parse_inet(struct names *this_name, struct ip_connections **ip_list)
|
||||
@@ -621,7 +675,7 @@ int parse_inet(struct names *this_name, struct ip_connections **ip_list)
|
||||
fprintf(stderr, _("Unknown local port AF %d\n"),
|
||||
res->ai_family);
|
||||
freeaddrinfo(res);
|
||||
@ -292,7 +292,7 @@ index 31ef30c..e5337cd 100644
|
||||
return -1;
|
||||
}
|
||||
freeaddrinfo(res);
|
||||
@@ -683,10 +737,12 @@ int parse_inet(struct names *this_name, struct ip_connections **ip_list)
|
||||
@@ -684,10 +738,12 @@ int parse_inet(struct names *this_name, struct ip_connections **ip_list)
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
@ -308,7 +308,7 @@ index 31ef30c..e5337cd 100644
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
@@ -1161,16 +1217,11 @@ int main(int argc, char *argv[])
|
||||
@@ -1162,16 +1218,11 @@ int main(int argc, char *argv[])
|
||||
skip_argv = 1;
|
||||
//while(option != '\0') option++;
|
||||
if (strcmp(argv[argc_cnt], "tcp") == 0)
|
||||
@ -330,7 +330,7 @@ index 31ef30c..e5337cd 100644
|
||||
else
|
||||
usage(_
|
||||
("Invalid namespace name"));
|
||||
@@ -1210,7 +1261,7 @@ int main(int argc, char *argv[])
|
||||
@@ -1211,7 +1262,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
#if defined(WITH_MOUNTINFO_LIST)
|
||||
@ -339,7 +339,7 @@ index 31ef30c..e5337cd 100644
|
||||
thestat = mntstat;
|
||||
#endif
|
||||
/* an option */
|
||||
@@ -1524,7 +1575,7 @@ print_matches(struct names *names_head, const opt_type opts,
|
||||
@@ -1525,7 +1576,7 @@ print_matches(struct names *names_head, const opt_type opts,
|
||||
|
||||
}
|
||||
|
||||
@ -348,7 +348,7 @@ index 31ef30c..e5337cd 100644
|
||||
{
|
||||
char pathname[256];
|
||||
struct stat *st;
|
||||
@@ -1536,6 +1587,15 @@ static struct stat *get_pidstat(const pid_t pid, const char *filename)
|
||||
@@ -1537,6 +1588,15 @@ static struct stat *get_pidstat(const pid_t pid, const char *filename)
|
||||
free(st);
|
||||
return NULL;
|
||||
}
|
||||
@ -364,32 +364,17 @@ index 31ef30c..e5337cd 100644
|
||||
return st;
|
||||
}
|
||||
|
||||
@@ -1550,18 +1610,19 @@ check_dir(const pid_t pid, const char *dirname, struct device_list *dev_head,
|
||||
@@ -1551,7 +1611,8 @@ check_dir(const pid_t pid, const char *dirname, struct device_list *dev_head,
|
||||
struct inode_list *ino_tmp;
|
||||
struct device_list *dev_tmp;
|
||||
struct unixsocket_list *sock_tmp;
|
||||
- struct stat st, lst;
|
||||
- char dirpath[MAX_PATHNAME];
|
||||
- char filepath[MAX_PATHNAME];
|
||||
+ struct fdinfo fd;
|
||||
+ struct stat st;
|
||||
+ char dirpath[PATH_MAX+1];
|
||||
+ char filepath[PATH_MAX+1];
|
||||
char *dirpath;
|
||||
char filepath[PATH_MAX];
|
||||
|
||||
- snprintf(dirpath, MAX_PATHNAME, "/proc/%d/%s", pid, dirname);
|
||||
+ snprintf(dirpath, PATH_MAX, "/proc/%d/%s", pid, dirname);
|
||||
if ((dirp = opendir(dirpath)) == NULL)
|
||||
return;
|
||||
while ((direntry = readdir(dirp)) != NULL) {
|
||||
if (direntry->d_name[0] < '0' || direntry->d_name[0] > '9')
|
||||
continue;
|
||||
|
||||
- snprintf(filepath, MAX_PATHNAME, "/proc/%d/%s/%s",
|
||||
+ snprintf(filepath, PATH_MAX, "/proc/%d/%s/%s",
|
||||
pid, dirname, direntry->d_name);
|
||||
|
||||
if (timeout(thestat, filepath, &st, 5) != 0) {
|
||||
@@ -1586,9 +1647,12 @@ check_dir(const pid_t pid, const char *dirname, struct device_list *dev_head,
|
||||
@@ -1592,9 +1653,12 @@ check_dir(const pid_t pid, const char *dirname, struct device_list *dev_head,
|
||||
dev_tmp = dev_tmp->next) {
|
||||
if (thedev != dev_tmp->device)
|
||||
continue;
|
||||
@ -404,7 +389,7 @@ index 31ef30c..e5337cd 100644
|
||||
add_matched_proc(dev_tmp->name,
|
||||
pid, uid,
|
||||
ACCESS_FILEWR |
|
||||
@@ -1610,9 +1674,10 @@ check_dir(const pid_t pid, const char *dirname, struct device_list *dev_head,
|
||||
@@ -1616,9 +1680,10 @@ check_dir(const pid_t pid, const char *dirname, struct device_list *dev_head,
|
||||
continue;
|
||||
}
|
||||
if (st.st_ino == ino_tmp->inode) {
|
||||
@ -417,15 +402,17 @@ index 31ef30c..e5337cd 100644
|
||||
add_matched_proc(ino_tmp->name,
|
||||
pid, uid,
|
||||
ACCESS_FILEWR |
|
||||
@@ -1641,18 +1706,30 @@ check_map(const pid_t pid, const char *filename,
|
||||
@@ -1647,7 +1712,6 @@ check_map(const pid_t pid, const char *filename,
|
||||
FILE *fp;
|
||||
unsigned long long tmp_inode;
|
||||
unsigned int tmp_maj, tmp_min;
|
||||
- dev_t tmp_device;
|
||||
|
||||
snprintf(pathname, MAX_PATHNAME, "/proc/%d/%s", pid, filename);
|
||||
if ((fp = fopen(pathname, "r")) == NULL)
|
||||
return;
|
||||
if (asprintf(&pathname, "/proc/%d/%s", pid, filename) < 0)
|
||||
return;
|
||||
@@ -1657,12 +1721,25 @@ check_map(const pid_t pid, const char *filename,
|
||||
}
|
||||
free(pathname);
|
||||
while (fgets(line, BUFSIZ, fp)) {
|
||||
- if (sscanf(line, "%*s %*s %*s %x:%x %lld",
|
||||
- &tmp_maj, &tmp_min, &tmp_inode) == 3) {
|
||||
@ -453,7 +440,7 @@ index 31ef30c..e5337cd 100644
|
||||
add_matched_proc(dev_tmp->name, pid,
|
||||
uid, access);
|
||||
for (ino_tmp = ino_head; ino_tmp != NULL;
|
||||
@@ -1661,7 +1738,8 @@ check_map(const pid_t pid, const char *filename,
|
||||
@@ -1671,7 +1748,8 @@ check_map(const pid_t pid, const char *filename,
|
||||
&& ino_tmp->inode == tmp_inode)
|
||||
add_matched_proc(ino_tmp->name, pid,
|
||||
uid, access);
|
||||
@ -463,7 +450,7 @@ index 31ef30c..e5337cd 100644
|
||||
}
|
||||
fclose(fp);
|
||||
}
|
||||
@@ -1682,6 +1760,7 @@ static uid_t getpiduid(const pid_t pid)
|
||||
@@ -1695,6 +1773,7 @@ static uid_t getpiduid(const pid_t pid)
|
||||
* fill_unix_cache : Create a list of Unix sockets
|
||||
* This list is used later for matching purposes
|
||||
*/
|
||||
@ -471,7 +458,7 @@ index 31ef30c..e5337cd 100644
|
||||
void fill_unix_cache(struct unixsocket_list **unixsocket_head)
|
||||
{
|
||||
FILE *fp;
|
||||
@@ -1698,6 +1777,8 @@ void fill_unix_cache(struct unixsocket_list **unixsocket_head)
|
||||
@@ -1711,6 +1790,8 @@ void fill_unix_cache(struct unixsocket_list **unixsocket_head)
|
||||
while (fgets(line, BUFSIZ, fp) != NULL) {
|
||||
char *path;
|
||||
char *scanned_path = NULL;
|
||||
@ -480,7 +467,7 @@ index 31ef30c..e5337cd 100644
|
||||
if (sscanf(line, "%*x: %*x %*x %*x %*x %*d %d %ms",
|
||||
&scanned_inode, &scanned_path) != 2) {
|
||||
if (scanned_path)
|
||||
@@ -1713,6 +1794,8 @@ void fill_unix_cache(struct unixsocket_list **unixsocket_head)
|
||||
@@ -1726,6 +1807,8 @@ void fill_unix_cache(struct unixsocket_list **unixsocket_head)
|
||||
free(path);
|
||||
continue;
|
||||
}
|
||||
@ -489,7 +476,7 @@ index 31ef30c..e5337cd 100644
|
||||
if ((newsocket = (struct unixsocket_list *)
|
||||
malloc(sizeof(struct unixsocket_list))) == NULL) {
|
||||
free(path);
|
||||
@@ -1721,6 +1804,7 @@ void fill_unix_cache(struct unixsocket_list **unixsocket_head)
|
||||
@@ -1734,6 +1817,7 @@ void fill_unix_cache(struct unixsocket_list **unixsocket_head)
|
||||
newsocket->sun_name = strdup(scanned_path);
|
||||
newsocket->inode = st.st_ino;
|
||||
newsocket->dev = st.st_dev;
|
||||
@ -497,7 +484,7 @@ index 31ef30c..e5337cd 100644
|
||||
newsocket->net_inode = scanned_inode;
|
||||
newsocket->next = *unixsocket_head;
|
||||
*unixsocket_head = newsocket;
|
||||
@@ -1733,6 +1817,7 @@ void fill_unix_cache(struct unixsocket_list **unixsocket_head)
|
||||
@@ -1746,6 +1830,7 @@ void fill_unix_cache(struct unixsocket_list **unixsocket_head)
|
||||
/*
|
||||
* Free up the list of Unix sockets
|
||||
*/
|
||||
@ -505,7 +492,7 @@ index 31ef30c..e5337cd 100644
|
||||
void clear_unix_cache(struct unixsocket_list **unixsocket_head)
|
||||
{
|
||||
while(*unixsocket_head != NULL) {
|
||||
@@ -1900,30 +1985,22 @@ scan_mounts(struct names *names_head, struct inode_list *ino_head,
|
||||
@@ -1913,30 +1998,22 @@ scan_mounts(struct names *names_head, struct inode_list *ino_head,
|
||||
{
|
||||
struct device_list *dev_tmp;
|
||||
struct inode_list *ino_tmp;
|
||||
@ -546,7 +533,7 @@ index 31ef30c..e5337cd 100644
|
||||
add_special_proc(dev_tmp->name, PTYPE_MOUNT, 0,
|
||||
find_mountp);
|
||||
}
|
||||
@@ -1935,7 +2012,6 @@ scan_mounts(struct names *names_head, struct inode_list *ino_head,
|
||||
@@ -1948,7 +2025,6 @@ scan_mounts(struct names *names_head, struct inode_list *ino_head,
|
||||
find_mountp);
|
||||
}
|
||||
}
|
||||
@ -554,7 +541,7 @@ index 31ef30c..e5337cd 100644
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1985,16 +2061,42 @@ scan_swaps(struct names *names_head, struct inode_list *ino_head,
|
||||
@@ -1998,16 +2074,42 @@ scan_swaps(struct names *names_head, struct inode_list *ino_head,
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
@ -600,7 +587,7 @@ index 31ef30c..e5337cd 100644
|
||||
{
|
||||
list_t *ptr, *tmp;
|
||||
|
||||
@@ -2005,72 +2107,232 @@ static void clear_mntinfo(void)
|
||||
@@ -2018,72 +2120,232 @@ static void clear_mntinfo(void)
|
||||
}
|
||||
}
|
||||
|
||||
@ -609,7 +596,7 @@ index 31ef30c..e5337cd 100644
|
||||
+init_mntinfo(void)
|
||||
{
|
||||
+ char type[256];
|
||||
char mpoint[PATH_MAX*4 + 1]; // octal escaping takes 4 chars per 1 char
|
||||
char mpoint[PATH_MAX *4 + 1]; // octal escaping takes 4 chars per 1 char
|
||||
- int mid, parid, max = 0;
|
||||
+ int mid, parid;
|
||||
+#if defined(HAS_MOUNTINFO)
|
||||
@ -669,7 +656,12 @@ index 31ef30c..e5337cd 100644
|
||||
+#endif
|
||||
fclose(mnt);
|
||||
+}
|
||||
+
|
||||
|
||||
- /* Sort mount points accordingly to the reverse mount order */
|
||||
- initial(&sort);
|
||||
- for (mid = 1; mid <= max; mid++) {
|
||||
- list_t *ptr, *tmp;
|
||||
- list_for_each_safe(ptr, tmp, &mntinfo) {
|
||||
+static int
|
||||
+get_fdinfo(const pid_t pid, const char *fd, struct fdinfo *info)
|
||||
+{
|
||||
@ -680,12 +672,7 @@ index 31ef30c..e5337cd 100644
|
||||
+ char line[BUFSIZ];
|
||||
+ FILE *fp;
|
||||
+ int mnt_id = 0, flags = 0;
|
||||
|
||||
- /* Sort mount points accordingly to the reverse mount order */
|
||||
- initial(&sort);
|
||||
- for (mid = 1; mid <= max; mid++) {
|
||||
- list_t *ptr, *tmp;
|
||||
- list_for_each_safe(ptr, tmp, &mntinfo) {
|
||||
+
|
||||
+ snprintf(pathname, 256, "/proc/%d/fdinfo/%s", pid, fd);
|
||||
+ if ((fp = fopen(pathname, "r")) == NULL)
|
||||
+ goto out;
|
||||
@ -877,7 +864,7 @@ index 31ef30c..e5337cd 100644
|
||||
/*
|
||||
* Determine device of links below /proc/
|
||||
*/
|
||||
@@ -2078,8 +2340,7 @@ static int mntstat(const char *path, struct stat *buf)
|
||||
@@ -2091,8 +2353,7 @@ static int mntstat(const char *path, struct stat *buf)
|
||||
{
|
||||
char name[PATH_MAX + 1];
|
||||
const char *use;
|
||||
@ -887,7 +874,7 @@ index 31ef30c..e5337cd 100644
|
||||
|
||||
if ((use = realpath(path, name)) == NULL || *use != '/')
|
||||
{
|
||||
@@ -2091,27 +2352,26 @@ static int mntstat(const char *path, struct stat *buf)
|
||||
@@ -2104,27 +2365,26 @@ static int mntstat(const char *path, struct stat *buf)
|
||||
errno = 0;
|
||||
return stat(path, buf);
|
||||
}
|
||||
@ -934,7 +921,7 @@ index 31ef30c..e5337cd 100644
|
||||
#endif /* WITH_MOUNTINFO_LIST */
|
||||
|
||||
diff --git src/fuser.h src/fuser.h
|
||||
index a4df711..4b9b1d6 100644
|
||||
index 93020d5..7886aa3 100644
|
||||
--- src/fuser.h
|
||||
+++ src/fuser.h
|
||||
@@ -37,10 +37,16 @@ struct procs {
|
||||
@ -999,8 +986,8 @@ index a4df711..4b9b1d6 100644
|
||||
|
||||
#define NAMESPACE_FILE 0
|
||||
#define NAMESPACE_TCP 1
|
||||
@@ -108,5 +114,6 @@ typedef struct mntinfo_s {
|
||||
#define MAX_CMDNAME 16
|
||||
@@ -109,5 +115,6 @@ typedef struct mntinfo_s {
|
||||
#endif /* PATH_MAX */
|
||||
|
||||
#define KNFSD_EXPORTS "/proc/fs/nfs/exports"
|
||||
+#define PROC_MOUNTINFO "/proc/self/mountinfo"
|
||||
@ -1026,7 +1013,7 @@ index 696a44a..739237e 100644
|
||||
-
|
||||
EXTRA_DIST =
|
||||
diff --git testsuite/killall.test/killall.exp testsuite/killall.test/killall.exp
|
||||
index b244893..1a10a1a 100644
|
||||
index 8bb3889..a345582 100644
|
||||
--- testsuite/killall.test/killall.exp
|
||||
+++ testsuite/killall.test/killall.exp
|
||||
@@ -7,7 +7,11 @@ set fake_proc_name "afakeprocname"
|
||||
@ -1042,5 +1029,5 @@ index b244893..1a10a1a 100644
|
||||
set test "killall list signals"
|
||||
spawn $killall -l
|
||||
--
|
||||
2.17.1
|
||||
2.16.4
|
||||
|
||||
|
@ -1,87 +0,0 @@
|
||||
--- src/killall.c 2017-07-06 16:23:15.693736411 +0200
|
||||
+++ src/killall.c 2017-09-18 12:00:46.506409019 +0200
|
||||
@@ -796,6 +796,18 @@ have_proc_self_stat (void)
|
||||
return stat(filename, &isproc) == 0;
|
||||
}
|
||||
|
||||
+typedef struct
|
||||
+{
|
||||
+ int number;
|
||||
+ const char *sig;
|
||||
+}
|
||||
+SIGNAME;
|
||||
+
|
||||
+static SIGNAME signals[] = {
|
||||
+#include "signames.h"
|
||||
+ {0, NULL}
|
||||
+};
|
||||
+
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
@@ -807,7 +819,7 @@ main (int argc, char **argv)
|
||||
char yt[16];
|
||||
char ot[16];
|
||||
|
||||
- //int optsig = 0;
|
||||
+ int optsig;
|
||||
|
||||
struct option options[] = {
|
||||
{"exact", 0, NULL, 'e'},
|
||||
@@ -828,6 +840,7 @@ main (int argc, char **argv)
|
||||
{"context", 1, NULL, 'Z'},
|
||||
#endif /*WITH_SELINUX*/
|
||||
{"version", 0, NULL, 'V'},
|
||||
+ {"dummy", 0, NULL, 'd'},
|
||||
{0,0,0,0 }};
|
||||
|
||||
opt_ns_pid = getpid();
|
||||
@@ -852,14 +865,46 @@ main (int argc, char **argv)
|
||||
name = *argv;
|
||||
sig_num = SIGTERM;
|
||||
|
||||
+ optsig = argc;
|
||||
+ while (--optsig) {
|
||||
+ char *sig;
|
||||
+ size_t len;
|
||||
+ if (*(argv[optsig]) != '-')
|
||||
+ continue;
|
||||
+ sig = argv[optsig]+1;
|
||||
+ len = strlen(sig);
|
||||
+ if (*sig >= '0' && *sig <= '9') {
|
||||
+ sig_num = atoi (sig);
|
||||
+ memset(sig, 0, strlen(sig));
|
||||
+ *sig = 'd';
|
||||
+ } else if (len >= 3 && *sig >= 'A' && *sig <= 'Z') {
|
||||
+ SIGNAME *walk;
|
||||
+ char *opt = sig;
|
||||
+ if (!strncmp("SIG", sig, 3))
|
||||
+ sig += 3;
|
||||
+ for (walk = signals; walk->sig; walk++) {
|
||||
+ if (!strcmp (walk->sig, sig))
|
||||
+ break;
|
||||
+ }
|
||||
+ if (walk->sig) {
|
||||
+ sig_num = walk->number;
|
||||
+ memset(opt, 0, strlen(opt));
|
||||
+ *opt = 'd';
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
|
||||
opterr = 0;
|
||||
+ unsetenv("POSIXLY_CORRECT");
|
||||
#ifdef WITH_SELINUX
|
||||
- while ( (optc = getopt_long_only(argc,argv,"egy:o:ilqrs:u:vwZ:VIn:",options,NULL)) != -1) {
|
||||
+ while ( (optc = getopt_long_only(argc,argv,"degy:o:ilqrs:u:vwZ:VIn:",options,NULL)) != -1) {
|
||||
#else
|
||||
- while ( (optc = getopt_long_only(argc,argv,"egy:o:ilqrs:u:vwVIn:",options,NULL)) != -1) {
|
||||
+ while ( (optc = getopt_long_only(argc,argv,"degy:o:ilqrs:u:vwVIn:",options,NULL)) != -1) {
|
||||
#endif
|
||||
switch (optc) {
|
||||
+ case 'd':
|
||||
+ break;
|
||||
case 'e':
|
||||
exact = 1;
|
||||
break;
|
@ -1,14 +0,0 @@
|
||||
---
|
||||
src/killall.c | 1 -
|
||||
1 file changed, 1 deletion(-)
|
||||
|
||||
--- src/killall.c
|
||||
+++ src/killall.c 2017-06-28 09:56:38.126984904 +0000
|
||||
@@ -972,7 +972,6 @@ main (int argc, char **argv)
|
||||
exit (1);
|
||||
}
|
||||
argv = argv + myoptind;
|
||||
- printf("sending signal %d to procs\n", sig_num);
|
||||
#ifdef WITH_SELINUX
|
||||
return kill_all(sig_num,argc - myoptind, argv, pwent,
|
||||
scontext ? &scontext_reg : NULL);
|
@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:215c6005c57e2b79606f602041f936f5e332ff1254a7d4c0bf15dd40e6c2b065
|
||||
size 156076
|
@ -1,11 +1,10 @@
|
||||
---
|
||||
configure.ac | 4 ++--
|
||||
doc/Makefile.am | 2 +-
|
||||
src/fuser.c | 5 ++++-
|
||||
3 files changed, 7 insertions(+), 4 deletions(-)
|
||||
configure.ac | 4 ++--
|
||||
src/fuser.c | 5 ++++-
|
||||
2 files changed, 6 insertions(+), 3 deletions(-)
|
||||
|
||||
--- configure.ac
|
||||
+++ configure.ac 2018-06-22 16:47:02.758993991 +0000
|
||||
+++ configure.ac 2018-10-22 10:48:51.847515299 +0000
|
||||
@@ -45,7 +45,7 @@ fi
|
||||
if test "$enable_timeout_stat" = "static"; then
|
||||
AC_DEFINE([WITH_TIMEOUT_STAT], [2], [Use timeout on stat calls])
|
||||
@ -24,18 +23,9 @@
|
||||
#include <sys/user.h>])
|
||||
AC_CHECK_MEMBERS([struct pt_regs.orig_gpr3,
|
||||
struct pt_regs.gpr], [],[], [#include <linux/ptrace.h>])
|
||||
--- doc/Makefile.am
|
||||
+++ doc/Makefile.am 2018-06-22 16:47:02.842992443 +0000
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
-man_MANS = killall.1 peekfd.1 prtstat.1 pstree.1
|
||||
+man_MANS = killall.1 peekfd.1 prtstat.1 pstree.1 pslog.1
|
||||
EXTRA_MANS =
|
||||
|
||||
if WANT_FUSER
|
||||
--- src/fuser.c
|
||||
+++ src/fuser.c 2018-06-22 16:47:02.926990894 +0000
|
||||
@@ -1097,6 +1097,7 @@ int main(int argc, char *argv[])
|
||||
+++ src/fuser.c 2018-10-22 10:48:51.867514927 +0000
|
||||
@@ -1098,6 +1098,7 @@ int main(int argc, char *argv[])
|
||||
struct option *optr;
|
||||
char *nsptr;
|
||||
int skip_argv;
|
||||
@ -43,7 +33,7 @@
|
||||
|
||||
struct option options[] = {
|
||||
{"all", 0, NULL, 'a'},
|
||||
@@ -1140,6 +1141,7 @@ int main(int argc, char *argv[])
|
||||
@@ -1141,6 +1142,7 @@ int main(int argc, char *argv[])
|
||||
#endif
|
||||
atexit(atexit_free_lists);
|
||||
|
||||
@ -51,7 +41,7 @@
|
||||
for (argc_cnt = 1; argc_cnt < argc; argc_cnt++) {
|
||||
current_argv = argv[argc_cnt];
|
||||
if (current_argv[0] == '-') { /* its an option */
|
||||
@@ -1285,6 +1287,7 @@ int main(int argc, char *argv[])
|
||||
@@ -1286,6 +1288,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
this_name->matched_procs = NULL;
|
||||
@ -59,7 +49,7 @@
|
||||
if (opts & (OPT_MOUNTS | OPT_ISMOUNTPOINT)
|
||||
&& this_name->name_space != NAMESPACE_FILE) {
|
||||
free(this_name);
|
||||
@@ -1338,7 +1341,7 @@ int main(int argc, char *argv[])
|
||||
@@ -1339,7 +1342,7 @@ int main(int argc, char *argv[])
|
||||
names_tail->next = this_name;
|
||||
names_tail = this_name;
|
||||
} /* for across the argvs */
|
3
psmisc-v23.2.tar.bz2
Normal file
3
psmisc-v23.2.tar.bz2
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:2f7807eb8bf8bac6835a81ef3740924755f1f3b8402d4e7b5ee1ab8a699c9679
|
||||
size 160432
|
@ -1,3 +1,22 @@
|
||||
-------------------------------------------------------------------
|
||||
Mon Oct 22 10:52:10 UTC 2018 - Dr. Werner Fink <werner@suse.de>
|
||||
|
||||
- Update to version 23.2
|
||||
* misc: Command names increased from 16 to 64 characters
|
||||
* buildsys: signals.c depends on signames.h !16
|
||||
* docs: Fix fuser.1 groff errors Debian #900225
|
||||
* killall: look at all namespaces by default
|
||||
* killall: Fix -INT option parsing #11
|
||||
* killall: ignore -n 0 #15
|
||||
* killall: another crack at fixing getopt #12 #13
|
||||
* peekfd: Attach to all threads option !15
|
||||
* pslog: Define PATH_MAX if required Debian:#905797
|
||||
- Modify patch 0001-Use-mountinfo-to-be-able-to-use-the-mount-identity.patch
|
||||
- Remove patches now upstream solved
|
||||
* psmisc-23.0-killall-signals.patch
|
||||
* psmisc-23.0-killall.patch
|
||||
- Modify and rename patch psmisc-23.0.dif which now becomes psmisc-v23.2.dif
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Sep 17 12:08:31 UTC 2018 - Dr. Werner Fink <werner@suse.de>
|
||||
|
||||
|
16
psmisc.spec
16
psmisc.spec
@ -26,24 +26,19 @@ BuildRequires: glibc-devel
|
||||
BuildRequires: libselinux-devel
|
||||
BuildRequires: ncurses-devel
|
||||
Url: https://gitlab.com/psmisc/psmisc/
|
||||
Version: 23.0
|
||||
Version: 23.2
|
||||
Release: 0
|
||||
Provides: ps:/usr/bin/killall
|
||||
Recommends: %{name}-lang
|
||||
Summary: Utilities for managing processes on your system
|
||||
License: GPL-2.0-or-later
|
||||
Group: System/Monitoring
|
||||
%define hash 67b1da268f4c0ce6859980e3dfcfaec5b2448e80
|
||||
Source: https://gitlab.com/%{name}/%{name}/repository/archive.tar.bz2?ref=v%{version}#/%{name}-%{version}.tar.bz2
|
||||
Patch0: %{name}-%{version}.dif
|
||||
Source: https://gitlab.com/%{name}/%{name}/-/archive/v%{version}/%{name}-v%{version}.tar.bz2
|
||||
Patch0: %{name}-v%{version}.dif
|
||||
Patch2: %{name}-22.21-pstree.patch
|
||||
# PATCH-ADD-SUSE boo#908068, boo#1046237, boo#1046237
|
||||
# https://gitlab.com/bitstreamout/psmisc/tree/mountinfo
|
||||
Patch3: 0001-Use-mountinfo-to-be-able-to-use-the-mount-identity.patch
|
||||
# PATCH-FIX-UPSTREAM boo#1046237 -- Debug output in killall from psmisc package
|
||||
Patch4: %{name}-%{version}-killall.patch
|
||||
# PATCH-FIX-SUSE boo#1058990 -- killall requires -s or --signal to specify signal on the command line
|
||||
Patch5: %{name}-%{version}-killall-signals.patch
|
||||
|
||||
%define have_peekfd %ix86 x86_64 ppc ppc64 ppc64le %arm mipsel m68k
|
||||
|
||||
@ -58,12 +53,9 @@ processes that are using specified files or filesystems.
|
||||
%lang_package
|
||||
|
||||
%prep
|
||||
ln -sf %{name}-v%{version}-%{hash} %{name}-%version
|
||||
%setup -q -D -n %{name}-%version
|
||||
%setup -q -D -n %{name}-v%{version}
|
||||
%patch2 -p0 -b .pstree
|
||||
%patch3 -p0 -b .mntinf
|
||||
%patch4 -p0 -b .ka
|
||||
%patch5 -p0 -b .ks
|
||||
%patch0 -p0 -b .p0
|
||||
|
||||
%build
|
||||
|
Loading…
Reference in New Issue
Block a user