Hello community, here is the log from the commit of package psmisc for openSUSE:Factory checked in at 2018-11-06 14:01:50 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/psmisc (Old) and /work/SRC/openSUSE:Factory/.psmisc.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "psmisc" Tue Nov 6 14:01:50 2018 rev:70 rq:646331 version:23.2 Changes: -------- --- /work/SRC/openSUSE:Factory/psmisc/psmisc.changes 2018-10-01 09:06:36.203831587 +0200 +++ /work/SRC/openSUSE:Factory/.psmisc.new/psmisc.changes 2018-11-06 14:02:26.163605553 +0100 @@ -1,0 +2,41 @@ +Mon Nov 5 07:48:25 UTC 2018 - Dr. Werner Fink <[email protected]> + +- Modify patch 0002-Use-new-statx-2-system-call-to-avoid-hangs-on-NFS.patch + to support older systems with statx kernel support + +------------------------------------------------------------------- +Fri Nov 2 13:37:49 UTC 2018 - Dr. Werner Fink <[email protected]> + +- Modify patch 0001-Use-mountinfo-to-be-able-to-use-the-mount-identity.patch + to respect autofs as well as afs file system +- Add patch 0002-Use-new-statx-2-system-call-to-avoid-hangs-on-NFS.patch + to use statx(2) system call since kernel 4.12. Now it is possible + to avoid sync with remote file servers as well as trigger autofs + mounts due stat(x) calls. + +------------------------------------------------------------------- +Tue Oct 23 10:10:12 UTC 2018 - Dr. Werner Fink <[email protected]> + +- Support also btrFS entries in mountinfo, that is use stat(2) to + determine the device of the mounted subvolume (bsc#1098697, bsc#1112780) + +------------------------------------------------------------------- +Mon Oct 22 10:52:10 UTC 2018 - Dr. Werner Fink <[email protected]> + +- 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 + +------------------------------------------------------------------- Old: ---- psmisc-23.0-killall-signals.patch psmisc-23.0-killall.patch psmisc-23.0.dif psmisc-23.0.tar.bz2 New: ---- 0002-Use-new-statx-2-system-call-to-avoid-hangs-on-NFS.patch psmisc-v23.2.dif psmisc-v23.2.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ psmisc.spec ++++++ --- /var/tmp/diff_new_pack.VKML87/_old 2018-11-06 14:02:29.195601609 +0100 +++ /var/tmp/diff_new_pack.VKML87/_new 2018-11-06 14:02:29.199601603 +0100 @@ -12,7 +12,7 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# Please submit bugfixes or comments via https://bugs.opensuse.org/ # @@ -24,26 +24,23 @@ BuildRequires: gettext-devel BuildRequires: glibc-devel BuildRequires: libselinux-devel +BuildRequires: linux-glibc-devel >= 4.12 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 +Patch4: 0002-Use-new-statx-2-system-call-to-avoid-hangs-on-NFS.patch %define have_peekfd %ix86 x86_64 ppc ppc64 ppc64le %arm mipsel m68k @@ -58,12 +55,10 @@ %lang_package %prep -ln -sf %{name}-v%{version}-%{hash} %{name}-%version -%setup -q -D -n %{name}-%version +%setup -q -n %{name}-v%{version} %patch2 -p0 -b .pstree %patch3 -p0 -b .mntinf -%patch4 -p0 -b .ka -%patch5 -p0 -b .ks +%patch4 -p0 -b .statx %patch0 -p0 -b .p0 %build ++++++ 0001-Use-mountinfo-to-be-able-to-use-the-mount-identity.patch ++++++ --- /var/tmp/diff_new_pack.VKML87/_old 2018-11-06 14:02:29.223601572 +0100 +++ /var/tmp/diff_new_pack.VKML87/_new 2018-11-06 14:02:29.223601572 +0100 @@ -1,6 +1,6 @@ -From 28805c3dda0ce9c78f046974454c0bb8dfee615b Mon Sep 17 00:00:00 2001 +From d220bd127a595287be2893e5808c4d53505e65af Mon Sep 17 00:00:00 2001 From: Werner Fink <[email protected]> -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 @@ -11,14 +11,16 @@ Add support for name_to_handle_at() system call to get the real mount ID for each file +Support also btrfs with its subvolumes + Signed-off-by: Werner Fink <[email protected]> --- configure.ac | 18 +- - src/fuser.c | 540 +++++++++++++++++++++-------- + src/fuser.c | 541 +++++++++++++++++++++++++++---------- src/fuser.h | 19 +- testsuite/Makefile.am | 3 +- testsuite/killall.test/killall.exp | 4 + - 5 files changed, 436 insertions(+), 148 deletions(-) + 5 files changed, 440 insertions(+), 145 deletions(-) diff --git configure.ac configure.ac index 176a2fc..d8d3366 100644 @@ -64,7 +66,7 @@ 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..2681f74 100644 --- src/fuser.c +++ src/fuser.c @@ -32,6 +32,10 @@ @@ -78,7 +80,7 @@ #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 +89,7 @@ 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 +100,7 @@ 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 +114,7 @@ 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 +122,7 @@ 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 +135,7 @@ 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 +167,7 @@ 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 +176,7 @@ 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 +185,7 @@ 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 +193,7 @@ 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 +201,7 @@ 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 +218,7 @@ 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; } @@ -227,11 +229,11 @@ (unsigned long)this_name->st.st_dev, - (unsigned long)this_name->st.st_ino); + (unsigned long)this_name->st.st_ino, -+ mountinfo->id, mountinfo->isnfs ? "yes" : "no"); ++ mountinfo->id, mountinfo->isremote ? "yes" : "no"); #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 +285,7 @@ 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 +294,7 @@ 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 +310,7 @@ } 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 +332,7 @@ 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 +341,7 @@ 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 +350,7 @@ { 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 +366,17 @@ 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]; - -- 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); + char *dirpath; + char filepath[PATH_MAX]; - 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 +391,7 @@ 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 +404,17 @@ 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 +442,7 @@ 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 +452,7 @@ } 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 +460,7 @@ 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 +469,7 @@ 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 +478,7 @@ 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 +486,7 @@ 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 +494,7 @@ 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 +535,7 @@ 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 +543,7 @@ } static void -@@ -1985,16 +2061,42 @@ scan_swaps(struct names *names_head, struct inode_list *ino_head, +@@ -1998,16 +2074,49 @@ scan_swaps(struct names *names_head, struct inode_list *ino_head, fclose(fp); } @@ -562,7 +551,8 @@ /* * Use /proc/self/mountinfo of modern linux system to determine * the device numbers of the mount points. Use this to avoid the - * stat(2) system call wherever possible. +- * stat(2) system call wherever possible. ++ * stat(2) system call for remote file system. */ -static list_t mntinfo = { &mntinfo, &mntinfo }; @@ -587,9 +577,16 @@ + mnt->parid = parid; + mnt->dev = dev; + mnt->id = mid; -+ if (strncmp("nfs", type, 3) == 0) -+ mnt->isnfs = 1; -+ else mnt->isnfs = 0; ++ if (strncmp("nfs", type, 3) == 0 || strncmp("afs", type, 3) == 0 || strncmp("autofs", type, 6)) ++ mnt->isremote = 1; ++ else mnt->isremote = 0; ++ if (!mnt->isremote) { ++ /* E.g. sub volumes of BtrFS do not show correct device ++ * numbers in /proc/self/mountinfo */ ++ struct stat st; ++ if (stat(mpoint, &st) >= 0) ++ mnt->dev = st.st_dev; ++ } + + return mnt; +} @@ -600,7 +597,7 @@ { list_t *ptr, *tmp; -@@ -2005,72 +2107,232 @@ static void clear_mntinfo(void) +@@ -2018,72 +2127,232 @@ static void clear_mntinfo(void) } } @@ -609,7 +606,7 @@ +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 +666,12 @@ +#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 +682,7 @@ + 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 +874,7 @@ /* * Determine device of links below /proc/ */ -@@ -2078,8 +2340,7 @@ static int mntstat(const char *path, struct stat *buf) +@@ -2091,8 +2360,7 @@ static int mntstat(const char *path, struct stat *buf) { char name[PATH_MAX + 1]; const char *use; @@ -887,7 +884,7 @@ if ((use = realpath(path, name)) == NULL || *use != '/') { -@@ -2091,27 +2352,26 @@ static int mntstat(const char *path, struct stat *buf) +@@ -2104,27 +2372,26 @@ static int mntstat(const char *path, struct stat *buf) errno = 0; return stat(path, buf); } @@ -923,7 +920,7 @@ - errno = ENOENT; - return -1; + -+ if (mnt->isnfs) { ++ if (mnt->isremote) { + buf->st_dev = mnt->dev; + buf->st_ino = mnt->id; /* inode substitute */ + return 0; /* found on NFS */ @@ -934,7 +931,7 @@ #endif /* WITH_MOUNTINFO_LIST */ diff --git src/fuser.h src/fuser.h -index a4df711..4b9b1d6 100644 +index 93020d5..51c6770 100644 --- src/fuser.h +++ src/fuser.h @@ -37,10 +37,16 @@ struct procs { @@ -988,7 +985,7 @@ typedef struct mntinfo_s { list_t this; int id, parid; -+ char isnfs; ++ char isremote; dev_t dev; size_t nlen; char *mpoint; @@ -999,8 +996,8 @@ #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 +1023,7 @@ - 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 +1039,5 @@ set test "killall list signals" spawn $killall -l -- -2.17.1 +2.16.4 ++++++ 0002-Use-new-statx-2-system-call-to-avoid-hangs-on-NFS.patch ++++++ ++++ 952 lines (skipped) ++++++ psmisc-v23.2.dif ++++++ --- configure.ac | 2 +- src/fuser.c | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) --- configure.ac +++ configure.ac 2018-11-02 13:34:07.811373984 +0000 @@ -132,7 +132,7 @@ AC_CHECK_MEMBERS([struct user_regs_struc struct user_regs_struct.rdi, struct user_regs_struct.rsi, struct user_regs_struct.rdx], [],[], - [#include <bits/types.h> + [#include <sys/types.h> #include <sys/user.h>]) AC_CHECK_MEMBERS([struct pt_regs.orig_gpr3, struct pt_regs.gpr], [],[], [#include <linux/ptrace.h>]) --- src/fuser.c +++ src/fuser.c 2018-11-02 13:34:07.811373984 +0000 @@ -1094,6 +1094,7 @@ int main(int argc, char *argv[]) struct option *optr; char *nsptr; int skip_argv; + int seen_file; struct option options[] = { {"all", 0, NULL, 'a'}, @@ -1137,6 +1138,7 @@ int main(int argc, char *argv[]) #endif atexit(atexit_free_lists); + seen_file = 0; for (argc_cnt = 1; argc_cnt < argc; argc_cnt++) { current_argv = argv[argc_cnt]; if (current_argv[0] == '-') { /* its an option */ @@ -1279,6 +1281,7 @@ int main(int argc, char *argv[]) } } this_name->matched_procs = NULL; + seen_file = 1; if (opts & (OPT_MOUNTS | OPT_ISMOUNTPOINT) && this_name->name_space != NAMESPACE_FILE) { free(this_name); @@ -1332,7 +1335,7 @@ int main(int argc, char *argv[]) names_tail->next = this_name; names_tail = this_name; } /* for across the argvs */ - if (names_head == NULL) + if (names_head == NULL && !seen_file) usage(_("No process specification given")); /* Check if -M flag was used and if so check mounts */
