Accepting request 859586 from home:polslinux:branches:Base:System
- Update to 23.3: * killall: check also truncated 16 char comm names Debian * fuser: Return early if have nulls * peekfd: Add support for ARM64 * pstree: Add color by age * fuser: Use larger inode sizes - Rebase 0001-Use-mountinfo-to-be-able-to-use-the-mount-identity.patch - Rebase 0002-Use-new-statx-2-system-call-to-avoid-hangs-on-NFS.patch - Rebase psmisc-22.21-pstree.patch OBS-URL: https://build.opensuse.org/request/show/859586 OBS-URL: https://build.opensuse.org/package/show/Base:System/psmisc?expand=0&rev=125
This commit is contained in:
parent
406c87b021
commit
7391e6ffe4
@ -1,35 +1,7 @@
|
|||||||
From 63d402a35e29106828f59b0b5b42a277136460c0 Mon Sep 17 00:00:00 2001
|
diff -ru old/configure.ac new/configure.ac
|
||||||
From: Werner Fink <werner@suse.de>
|
--- old/configure.ac 2019-11-12 11:23:38.000000000 +0100
|
||||||
Date: Mon, 27 Apr 2020 14:41:03 +0200
|
+++ new/configure.ac 2020-12-31 10:49:48.159279790 +0100
|
||||||
Subject: [PATCH] Use mountinfo to be able to use the mount identity
|
@@ -27,6 +27,9 @@
|
||||||
|
|
||||||
which allows to distinguish different mounts with the
|
|
||||||
same device number as it happens with NFS shares.
|
|
||||||
Smaller cleanup as support of chroot environments
|
|
||||||
and older systems.
|
|
||||||
|
|
||||||
Add support for name_to_handle_at() system call to
|
|
||||||
get the real mount ID for each file
|
|
||||||
|
|
||||||
Support also BtrFS with its various subvolumes
|
|
||||||
On BtrFS stat(2) on binary does not see subvol dev
|
|
||||||
|
|
||||||
Allow not unique mounts as well as not unique mountpoint
|
|
||||||
|
|
||||||
Signed-off-by: Werner Fink <werner@suse.de>
|
|
||||||
---
|
|
||||||
configure.ac | 18 +-
|
|
||||||
src/fuser.c | 638 ++++++++++++++++++++++-------
|
|
||||||
src/fuser.h | 27 +-
|
|
||||||
testsuite/Makefile.am | 3 +-
|
|
||||||
testsuite/killall.test/killall.exp | 4 +
|
|
||||||
5 files changed, 537 insertions(+), 153 deletions(-)
|
|
||||||
|
|
||||||
diff --git configure.ac configure.ac
|
|
||||||
index 176a2fc..d8d3366 100644
|
|
||||||
--- configure.ac
|
|
||||||
+++ configure.ac
|
|
||||||
@@ -27,6 +27,9 @@ if test "$enable_selinux" = "yes"; then
|
|
||||||
AC_DEFINE([WITH_SELINUX], [1], [Use Security-Enhanced Linux features])
|
AC_DEFINE([WITH_SELINUX], [1], [Use Security-Enhanced Linux features])
|
||||||
AC_CHECK_LIB([selinux], [getfilecon], [SELINUX_LIB=-lselinux], [
|
AC_CHECK_LIB([selinux], [getfilecon], [SELINUX_LIB=-lselinux], [
|
||||||
AC_MSG_ERROR([Cannot find selinux static library]) ])
|
AC_MSG_ERROR([Cannot find selinux static library]) ])
|
||||||
@ -39,7 +11,7 @@ index 176a2fc..d8d3366 100644
|
|||||||
fi
|
fi
|
||||||
AC_SUBST([SELINUX_LIB])
|
AC_SUBST([SELINUX_LIB])
|
||||||
|
|
||||||
@@ -44,6 +47,19 @@ if test "$enable_timeout_stat" = "static"; then
|
@@ -44,6 +47,19 @@
|
||||||
fi
|
fi
|
||||||
AM_CONDITIONAL([WANT_TIMEOUT_STAT], [test "$enable_timeout_stat" = "static"])
|
AM_CONDITIONAL([WANT_TIMEOUT_STAT], [test "$enable_timeout_stat" = "static"])
|
||||||
|
|
||||||
@ -59,7 +31,7 @@ index 176a2fc..d8d3366 100644
|
|||||||
# Use string search for network based file systems but only if the system
|
# Use string search for network based file systems but only if the system
|
||||||
# has /proc/self/mountinfo
|
# has /proc/self/mountinfo
|
||||||
AC_SUBST([WITH_MOUNTINFO_LIST])
|
AC_SUBST([WITH_MOUNTINFO_LIST])
|
||||||
@@ -85,7 +101,7 @@ dnl Checks for header files.
|
@@ -85,7 +101,7 @@
|
||||||
AC_HEADER_DIRENT
|
AC_HEADER_DIRENT
|
||||||
AC_HEADER_STDC
|
AC_HEADER_STDC
|
||||||
AC_HEADER_SYS_WAIT
|
AC_HEADER_SYS_WAIT
|
||||||
@ -68,10 +40,10 @@ index 176a2fc..d8d3366 100644
|
|||||||
|
|
||||||
dnl Checks for typedefs, structures, and compiler characteristics.
|
dnl Checks for typedefs, structures, and compiler characteristics.
|
||||||
AC_C_CONST
|
AC_C_CONST
|
||||||
diff --git src/fuser.c src/fuser.c
|
Only in new: .idea
|
||||||
index c44cee8..1b58374 100644
|
diff -ru old/src/fuser.c new/src/fuser.c
|
||||||
--- src/fuser.c
|
--- old/src/fuser.c 2019-11-12 11:23:38.000000000 +0100
|
||||||
+++ src/fuser.c
|
+++ new/src/fuser.c 2020-12-31 11:02:04.273256080 +0100
|
||||||
@@ -32,6 +32,10 @@
|
@@ -32,6 +32,10 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -83,7 +55,7 @@ index c44cee8..1b58374 100644
|
|||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
@@ -79,7 +83,7 @@ static void check_map(const pid_t pid, const char *filename,
|
@@ -79,7 +83,7 @@
|
||||||
struct device_list *dev_head,
|
struct device_list *dev_head,
|
||||||
struct inode_list *ino_head, const uid_t uid,
|
struct inode_list *ino_head, const uid_t uid,
|
||||||
const char access);
|
const char access);
|
||||||
@ -92,7 +64,7 @@ index c44cee8..1b58374 100644
|
|||||||
static uid_t getpiduid(const pid_t pid);
|
static uid_t getpiduid(const pid_t pid);
|
||||||
static int print_matches(struct names *names_head, const opt_type opts,
|
static int print_matches(struct names *names_head, const opt_type opts,
|
||||||
const int sig_number);
|
const int sig_number);
|
||||||
@@ -88,9 +92,9 @@ static int kill_matched_proc(struct procs *pptr, const opt_type opts,
|
@@ -88,9 +92,9 @@
|
||||||
|
|
||||||
/*int parse_mount(struct names *this_name, struct device_list **dev_list);*/
|
/*int parse_mount(struct names *this_name, struct device_list **dev_list);*/
|
||||||
static void add_device(struct device_list **dev_list,
|
static void add_device(struct device_list **dev_list,
|
||||||
@ -105,7 +77,7 @@ index c44cee8..1b58374 100644
|
|||||||
static void atexit_clear_unix_cache();
|
static void atexit_clear_unix_cache();
|
||||||
static dev_t find_net_dev(void);
|
static dev_t find_net_dev(void);
|
||||||
static void scan_procs(struct names *names_head, struct inode_list *ino_head,
|
static void scan_procs(struct names *names_head, struct inode_list *ino_head,
|
||||||
@@ -109,9 +113,12 @@ static void debug_match_lists(struct names *names_head,
|
@@ -109,9 +113,12 @@
|
||||||
struct device_list *dev_head);
|
struct device_list *dev_head);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -119,7 +91,7 @@ index c44cee8..1b58374 100644
|
|||||||
static int mntstat(const char *path, struct stat *buf);
|
static int mntstat(const char *path, struct stat *buf);
|
||||||
#endif
|
#endif
|
||||||
static stat_t thestat = stat;
|
static stat_t thestat = stat;
|
||||||
@@ -199,6 +206,7 @@ scan_procs(struct names *names_head, struct inode_list *ino_head,
|
@@ -202,6 +209,7 @@
|
||||||
struct stat *cwd_stat = NULL;
|
struct stat *cwd_stat = NULL;
|
||||||
struct stat *exe_stat = NULL;
|
struct stat *exe_stat = NULL;
|
||||||
struct stat *root_stat = NULL;
|
struct stat *root_stat = NULL;
|
||||||
@ -127,7 +99,7 @@ index c44cee8..1b58374 100644
|
|||||||
|
|
||||||
if (topproc_dent->d_name[0] < '0' || topproc_dent->d_name[0] > '9') /* Not a process */
|
if (topproc_dent->d_name[0] < '0' || topproc_dent->d_name[0] > '9') /* Not a process */
|
||||||
continue;
|
continue;
|
||||||
@@ -208,9 +216,9 @@ scan_procs(struct names *names_head, struct inode_list *ino_head,
|
@@ -211,9 +219,9 @@
|
||||||
continue;
|
continue;
|
||||||
uid = getpiduid(pid);
|
uid = getpiduid(pid);
|
||||||
|
|
||||||
@ -140,7 +112,7 @@ index c44cee8..1b58374 100644
|
|||||||
cwd_dev = cwd_stat ? cwd_stat->st_dev : 0;
|
cwd_dev = cwd_stat ? cwd_stat->st_dev : 0;
|
||||||
exe_dev = exe_stat ? exe_stat->st_dev : 0;
|
exe_dev = exe_stat ? exe_stat->st_dev : 0;
|
||||||
root_dev = root_stat ? root_stat->st_dev : 0;
|
root_dev = root_stat ? root_stat->st_dev : 0;
|
||||||
@@ -218,21 +226,33 @@ scan_procs(struct names *names_head, struct inode_list *ino_head,
|
@@ -221,21 +229,33 @@
|
||||||
/* Scan the devices */
|
/* Scan the devices */
|
||||||
for (dev_tmp = dev_head; dev_tmp != NULL;
|
for (dev_tmp = dev_head; dev_tmp != NULL;
|
||||||
dev_tmp = dev_tmp->next) {
|
dev_tmp = dev_tmp->next) {
|
||||||
@ -184,7 +156,7 @@ index c44cee8..1b58374 100644
|
|||||||
if (exe_stat
|
if (exe_stat
|
||||||
&& exe_stat->st_dev == ino_tmp->device
|
&& exe_stat->st_dev == ino_tmp->device
|
||||||
&& exe_stat->st_ino == ino_tmp->inode)
|
&& exe_stat->st_ino == ino_tmp->inode)
|
||||||
@@ -241,7 +261,7 @@ scan_procs(struct names *names_head, struct inode_list *ino_head,
|
@@ -244,7 +264,7 @@
|
||||||
}
|
}
|
||||||
if (root_dev == ino_tmp->device) {
|
if (root_dev == ino_tmp->device) {
|
||||||
if (!root_stat)
|
if (!root_stat)
|
||||||
@ -193,7 +165,7 @@ index c44cee8..1b58374 100644
|
|||||||
if (root_stat
|
if (root_stat
|
||||||
&& root_stat->st_dev == ino_tmp->device
|
&& root_stat->st_dev == ino_tmp->device
|
||||||
&& root_stat->st_ino == ino_tmp->inode)
|
&& root_stat->st_ino == ino_tmp->inode)
|
||||||
@@ -250,7 +270,7 @@ scan_procs(struct names *names_head, struct inode_list *ino_head,
|
@@ -253,7 +273,7 @@
|
||||||
}
|
}
|
||||||
if (cwd_dev == ino_tmp->device) {
|
if (cwd_dev == ino_tmp->device) {
|
||||||
if (!cwd_stat)
|
if (!cwd_stat)
|
||||||
@ -202,7 +174,7 @@ index c44cee8..1b58374 100644
|
|||||||
if (cwd_stat
|
if (cwd_stat
|
||||||
&& cwd_stat->st_dev == ino_tmp->device
|
&& cwd_stat->st_dev == ino_tmp->device
|
||||||
&& cwd_stat->st_ino == ino_tmp->inode)
|
&& cwd_stat->st_ino == ino_tmp->inode)
|
||||||
@@ -291,18 +311,42 @@ add_inode(struct inode_list **ino_list, struct names *this_name,
|
@@ -294,18 +314,42 @@
|
||||||
ino_tmp->name = this_name;
|
ino_tmp->name = this_name;
|
||||||
ino_tmp->device = device;
|
ino_tmp->device = device;
|
||||||
ino_tmp->inode = inode;
|
ino_tmp->inode = inode;
|
||||||
@ -246,7 +218,7 @@ index c44cee8..1b58374 100644
|
|||||||
|
|
||||||
if ((dev_tmp =
|
if ((dev_tmp =
|
||||||
(struct device_list *)malloc(sizeof(struct device_list))) == NULL)
|
(struct device_list *)malloc(sizeof(struct device_list))) == NULL)
|
||||||
@@ -310,6 +354,10 @@ add_device(struct device_list **dev_list, struct names *this_name, dev_t device)
|
@@ -313,6 +357,10 @@
|
||||||
dev_head = *dev_list;
|
dev_head = *dev_list;
|
||||||
dev_tmp->name = this_name;
|
dev_tmp->name = this_name;
|
||||||
dev_tmp->device = device;
|
dev_tmp->device = device;
|
||||||
@ -257,7 +229,7 @@ index c44cee8..1b58374 100644
|
|||||||
dev_tmp->next = dev_head;
|
dev_tmp->next = dev_head;
|
||||||
*dev_list = dev_tmp;
|
*dev_list = dev_tmp;
|
||||||
}
|
}
|
||||||
@@ -451,13 +499,15 @@ add_special_proc(struct names *name_list, const char ptype, const uid_t uid,
|
@@ -454,13 +502,15 @@
|
||||||
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)
|
const opt_type opts)
|
||||||
{
|
{
|
||||||
@ -274,7 +246,7 @@ index c44cee8..1b58374 100644
|
|||||||
if (errno == ENOENT)
|
if (errno == ENOENT)
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
_("Specified filename %s does not exist.\n"),
|
_("Specified filename %s does not exist.\n"),
|
||||||
@@ -467,10 +517,12 @@ int parse_file(struct names *this_name, struct inode_list **ino_list,
|
@@ -470,10 +520,12 @@
|
||||||
this_name->filename, strerror(errno));
|
this_name->filename, strerror(errno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -289,7 +261,7 @@ index c44cee8..1b58374 100644
|
|||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
add_inode(ino_list, this_name, this_name->st.st_dev,
|
add_inode(ino_list, this_name, this_name->st.st_dev,
|
||||||
this_name->st.st_ino);
|
this_name->st.st_ino);
|
||||||
@@ -502,12 +554,45 @@ parse_mounts(struct names *this_name, struct device_list **dev_list,
|
@@ -505,12 +557,45 @@
|
||||||
const opt_type opts)
|
const opt_type opts)
|
||||||
{
|
{
|
||||||
dev_t match_device;
|
dev_t match_device;
|
||||||
@ -336,7 +308,7 @@ index c44cee8..1b58374 100644
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -621,7 +706,7 @@ int parse_inet(struct names *this_name, struct ip_connections **ip_list)
|
@@ -624,7 +709,7 @@
|
||||||
fprintf(stderr, _("Unknown local port AF %d\n"),
|
fprintf(stderr, _("Unknown local port AF %d\n"),
|
||||||
res->ai_family);
|
res->ai_family);
|
||||||
freeaddrinfo(res);
|
freeaddrinfo(res);
|
||||||
@ -345,7 +317,7 @@ index c44cee8..1b58374 100644
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
freeaddrinfo(res);
|
freeaddrinfo(res);
|
||||||
@@ -684,10 +769,12 @@ int parse_inet(struct names *this_name, struct ip_connections **ip_list)
|
@@ -687,10 +772,12 @@
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -361,7 +333,7 @@ index c44cee8..1b58374 100644
|
|||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -953,6 +1040,21 @@ free_inodes(struct inode_list **match_inodes)
|
@@ -957,6 +1044,21 @@
|
||||||
/*
|
/*
|
||||||
* Free up structures allocated in add_device
|
* Free up structures allocated in add_device
|
||||||
*/
|
*/
|
||||||
@ -383,7 +355,7 @@ index c44cee8..1b58374 100644
|
|||||||
static void
|
static void
|
||||||
free_devices(struct device_list **match_devices)
|
free_devices(struct device_list **match_devices)
|
||||||
{
|
{
|
||||||
@@ -960,6 +1062,8 @@ free_devices(struct device_list **match_devices)
|
@@ -964,6 +1066,8 @@
|
||||||
|
|
||||||
device_tmp = *match_devices;
|
device_tmp = *match_devices;
|
||||||
while(device_tmp != NULL) {
|
while(device_tmp != NULL) {
|
||||||
@ -392,7 +364,7 @@ index c44cee8..1b58374 100644
|
|||||||
device_next = device_tmp->next;
|
device_next = device_tmp->next;
|
||||||
free(device_tmp);
|
free(device_tmp);
|
||||||
device_tmp = device_next;
|
device_tmp = device_next;
|
||||||
@@ -1162,16 +1266,11 @@ int main(int argc, char *argv[])
|
@@ -1166,16 +1270,11 @@
|
||||||
skip_argv = 1;
|
skip_argv = 1;
|
||||||
//while(option != '\0') option++;
|
//while(option != '\0') option++;
|
||||||
if (strcmp(argv[argc_cnt], "tcp") == 0)
|
if (strcmp(argv[argc_cnt], "tcp") == 0)
|
||||||
@ -414,7 +386,7 @@ index c44cee8..1b58374 100644
|
|||||||
else
|
else
|
||||||
usage(_
|
usage(_
|
||||||
("Invalid namespace name"));
|
("Invalid namespace name"));
|
||||||
@@ -1211,7 +1310,7 @@ int main(int argc, char *argv[])
|
@@ -1215,7 +1314,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(WITH_MOUNTINFO_LIST)
|
#if defined(WITH_MOUNTINFO_LIST)
|
||||||
@ -423,7 +395,7 @@ index c44cee8..1b58374 100644
|
|||||||
thestat = mntstat;
|
thestat = mntstat;
|
||||||
#endif
|
#endif
|
||||||
/* an option */
|
/* an option */
|
||||||
@@ -1525,7 +1624,7 @@ print_matches(struct names *names_head, const opt_type opts,
|
@@ -1529,7 +1628,7 @@
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -432,7 +404,7 @@ index c44cee8..1b58374 100644
|
|||||||
{
|
{
|
||||||
char pathname[256];
|
char pathname[256];
|
||||||
struct stat *st;
|
struct stat *st;
|
||||||
@@ -1537,6 +1636,15 @@ static struct stat *get_pidstat(const pid_t pid, const char *filename)
|
@@ -1541,6 +1640,15 @@
|
||||||
free(st);
|
free(st);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -448,7 +420,7 @@ index c44cee8..1b58374 100644
|
|||||||
return st;
|
return st;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1551,7 +1659,8 @@ check_dir(const pid_t pid, const char *dirname, struct device_list *dev_head,
|
@@ -1555,7 +1663,8 @@
|
||||||
struct inode_list *ino_tmp;
|
struct inode_list *ino_tmp;
|
||||||
struct device_list *dev_tmp;
|
struct device_list *dev_tmp;
|
||||||
struct unixsocket_list *sock_tmp;
|
struct unixsocket_list *sock_tmp;
|
||||||
@ -458,7 +430,7 @@ index c44cee8..1b58374 100644
|
|||||||
char *dirpath;
|
char *dirpath;
|
||||||
char filepath[PATH_MAX];
|
char filepath[PATH_MAX];
|
||||||
|
|
||||||
@@ -1590,11 +1699,27 @@ check_dir(const pid_t pid, const char *dirname, struct device_list *dev_head,
|
@@ -1594,11 +1703,27 @@
|
||||||
}
|
}
|
||||||
for (dev_tmp = dev_head; dev_tmp != NULL;
|
for (dev_tmp = dev_head; dev_tmp != NULL;
|
||||||
dev_tmp = dev_tmp->next) {
|
dev_tmp = dev_tmp->next) {
|
||||||
@ -489,7 +461,7 @@ index c44cee8..1b58374 100644
|
|||||||
add_matched_proc(dev_tmp->name,
|
add_matched_proc(dev_tmp->name,
|
||||||
pid, uid,
|
pid, uid,
|
||||||
ACCESS_FILEWR |
|
ACCESS_FILEWR |
|
||||||
@@ -1616,9 +1741,10 @@ check_dir(const pid_t pid, const char *dirname, struct device_list *dev_head,
|
@@ -1620,9 +1745,10 @@
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (st.st_ino == ino_tmp->inode) {
|
if (st.st_ino == ino_tmp->inode) {
|
||||||
@ -502,7 +474,7 @@ index c44cee8..1b58374 100644
|
|||||||
add_matched_proc(ino_tmp->name,
|
add_matched_proc(ino_tmp->name,
|
||||||
pid, uid,
|
pid, uid,
|
||||||
ACCESS_FILEWR |
|
ACCESS_FILEWR |
|
||||||
@@ -1647,31 +1773,54 @@ check_map(const pid_t pid, const char *filename,
|
@@ -1651,31 +1777,54 @@
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
unsigned long long tmp_inode;
|
unsigned long long tmp_inode;
|
||||||
unsigned int tmp_maj, tmp_min;
|
unsigned int tmp_maj, tmp_min;
|
||||||
@ -567,7 +539,7 @@ index c44cee8..1b58374 100644
|
|||||||
}
|
}
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
@@ -1695,6 +1844,7 @@ static uid_t getpiduid(const pid_t pid)
|
@@ -1699,6 +1848,7 @@
|
||||||
* fill_unix_cache : Create a list of Unix sockets
|
* fill_unix_cache : Create a list of Unix sockets
|
||||||
* This list is used later for matching purposes
|
* This list is used later for matching purposes
|
||||||
*/
|
*/
|
||||||
@ -575,16 +547,16 @@ index c44cee8..1b58374 100644
|
|||||||
void fill_unix_cache(struct unixsocket_list **unixsocket_head)
|
void fill_unix_cache(struct unixsocket_list **unixsocket_head)
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
@@ -1711,6 +1861,8 @@ void fill_unix_cache(struct unixsocket_list **unixsocket_head)
|
@@ -1715,6 +1865,8 @@
|
||||||
while (fgets(line, BUFSIZ, fp) != NULL) {
|
while (fgets(line, BUFSIZ, fp) != NULL) {
|
||||||
char *path;
|
char *path;
|
||||||
char *scanned_path = NULL;
|
char *scanned_path = NULL;
|
||||||
+ int mnt_id = -1;
|
+ int mnt_id = -1;
|
||||||
+ mntinfo_t *mountinfo;
|
+ mntinfo_t *mountinfo;
|
||||||
if (sscanf(line, "%*x: %*x %*x %*x %*x %*d %d %ms",
|
if (sscanf(line, "%*x: %*x %*x %*x %*x %*d %llu %ms",
|
||||||
&scanned_inode, &scanned_path) != 2) {
|
&scanned_inode, &scanned_path) != 2) {
|
||||||
if (scanned_path)
|
if (scanned_path)
|
||||||
@@ -1726,6 +1878,8 @@ void fill_unix_cache(struct unixsocket_list **unixsocket_head)
|
@@ -1730,6 +1882,8 @@
|
||||||
free(path);
|
free(path);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -593,7 +565,7 @@ index c44cee8..1b58374 100644
|
|||||||
if ((newsocket = (struct unixsocket_list *)
|
if ((newsocket = (struct unixsocket_list *)
|
||||||
malloc(sizeof(struct unixsocket_list))) == NULL) {
|
malloc(sizeof(struct unixsocket_list))) == NULL) {
|
||||||
free(path);
|
free(path);
|
||||||
@@ -1734,6 +1888,7 @@ void fill_unix_cache(struct unixsocket_list **unixsocket_head)
|
@@ -1738,6 +1892,7 @@
|
||||||
newsocket->sun_name = strdup(scanned_path);
|
newsocket->sun_name = strdup(scanned_path);
|
||||||
newsocket->inode = st.st_ino;
|
newsocket->inode = st.st_ino;
|
||||||
newsocket->dev = st.st_dev;
|
newsocket->dev = st.st_dev;
|
||||||
@ -601,7 +573,7 @@ index c44cee8..1b58374 100644
|
|||||||
newsocket->net_inode = scanned_inode;
|
newsocket->net_inode = scanned_inode;
|
||||||
newsocket->next = *unixsocket_head;
|
newsocket->next = *unixsocket_head;
|
||||||
*unixsocket_head = newsocket;
|
*unixsocket_head = newsocket;
|
||||||
@@ -1746,6 +1901,7 @@ void fill_unix_cache(struct unixsocket_list **unixsocket_head)
|
@@ -1750,6 +1905,7 @@
|
||||||
/*
|
/*
|
||||||
* Free up the list of Unix sockets
|
* Free up the list of Unix sockets
|
||||||
*/
|
*/
|
||||||
@ -609,7 +581,7 @@ index c44cee8..1b58374 100644
|
|||||||
void clear_unix_cache(struct unixsocket_list **unixsocket_head)
|
void clear_unix_cache(struct unixsocket_list **unixsocket_head)
|
||||||
{
|
{
|
||||||
while(*unixsocket_head != NULL) {
|
while(*unixsocket_head != NULL) {
|
||||||
@@ -1913,30 +2069,22 @@ scan_mounts(struct names *names_head, struct inode_list *ino_head,
|
@@ -1921,34 +2077,24 @@
|
||||||
{
|
{
|
||||||
struct device_list *dev_tmp;
|
struct device_list *dev_tmp;
|
||||||
struct inode_list *ino_tmp;
|
struct inode_list *ino_tmp;
|
||||||
@ -619,38 +591,40 @@ index c44cee8..1b58374 100644
|
|||||||
- char *find_space;
|
- char *find_space;
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
|
||||||
|
if ( (ino_head == NULL) && (dev_head == NULL) )
|
||||||
|
return;
|
||||||
|
|
||||||
|
+ list_t *ptr;
|
||||||
|
+ list_for_each(ptr, &mntinfo) {
|
||||||
|
+ mntinfo_t *mnt = list_entry(ptr, mntinfo_t);
|
||||||
|
+ const char *find_mountp = mnt->mpoint;
|
||||||
|
|
||||||
- if ((fp = fopen(PROC_MOUNTS, "r")) == NULL) {
|
- if ((fp = fopen(PROC_MOUNTS, "r")) == NULL) {
|
||||||
- fprintf(stderr, "Cannot open %s\n", PROC_MOUNTS);
|
- fprintf(stderr, "Cannot open %s\n", PROC_MOUNTS);
|
||||||
- return;
|
- return;
|
||||||
- }
|
- }
|
||||||
- while (fgets(line, BUFSIZ, fp) != NULL) {
|
- while (fgets(line, BUFSIZ, fp) != NULL) {
|
||||||
- if ((find_mountp = strchr(line, ' ')) == NULL)
|
- if ((find_mountp = strchr(line, ' ')) == NULL)
|
||||||
- continue;
|
+ if (timeout(thestat, find_mountp, &st, 5) != 0)
|
||||||
|
continue;
|
||||||
- find_mountp++;
|
- find_mountp++;
|
||||||
- if ((find_space = strchr(find_mountp, ' ')) == NULL)
|
- if ((find_space = strchr(find_mountp, ' ')) == NULL)
|
||||||
- continue;
|
- continue;
|
||||||
- *find_space = '\0';
|
- *find_space = '\0';
|
||||||
- if (timeout(thestat, find_mountp, &st, 5) != 0) {
|
- if (timeout(thestat, find_mountp, &st, 5) != 0) {
|
||||||
+ list_t *ptr;
|
- continue;
|
||||||
+
|
|
||||||
+ list_for_each(ptr, &mntinfo) {
|
|
||||||
+ mntinfo_t *mnt = list_entry(ptr, mntinfo_t);
|
|
||||||
+ const char *find_mountp = mnt->mpoint;
|
|
||||||
+
|
|
||||||
+ if (timeout(thestat, find_mountp, &st, 5) != 0)
|
|
||||||
continue;
|
|
||||||
- }
|
- }
|
||||||
+
|
+
|
||||||
/* Scan the devices */
|
/* Scan the devices */
|
||||||
for (dev_tmp = dev_head; dev_tmp != NULL;
|
for (dev_tmp = dev_head; dev_tmp != NULL;
|
||||||
dev_tmp = dev_tmp->next) {
|
dev_tmp = dev_tmp->next) {
|
||||||
- if (st.st_dev == dev_tmp->device)
|
- if (st.st_dev == dev_tmp->device)
|
||||||
+ if (st.st_dev == dev_tmp->device &&
|
+ if (st.st_dev == dev_tmp->device &&
|
||||||
+ mnt->id == dev_tmp->mnt_id)
|
+ mnt->id == dev_tmp->mnt_id)
|
||||||
add_special_proc(dev_tmp->name, PTYPE_MOUNT, 0,
|
add_special_proc(dev_tmp->name, PTYPE_MOUNT, 0,
|
||||||
find_mountp);
|
find_mountp);
|
||||||
}
|
}
|
||||||
@@ -1948,7 +2096,6 @@ scan_mounts(struct names *names_head, struct inode_list *ino_head,
|
@@ -1960,7 +2106,6 @@
|
||||||
find_mountp);
|
find_mountp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -658,7 +632,7 @@ index c44cee8..1b58374 100644
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -1998,16 +2145,44 @@ scan_swaps(struct names *names_head, struct inode_list *ino_head,
|
@@ -2013,16 +2158,44 @@
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -707,7 +681,7 @@ index c44cee8..1b58374 100644
|
|||||||
{
|
{
|
||||||
list_t *ptr, *tmp;
|
list_t *ptr, *tmp;
|
||||||
|
|
||||||
@@ -2018,72 +2193,247 @@ static void clear_mntinfo(void)
|
@@ -2033,72 +2206,247 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -746,6 +720,16 @@ index c44cee8..1b58374 100644
|
|||||||
- ("Cannot allocate memory for matched proc: %s\n"),
|
- ("Cannot allocate memory for matched proc: %s\n"),
|
||||||
- strerror(errno));
|
- strerror(errno));
|
||||||
- exit(1);
|
- exit(1);
|
||||||
|
- }
|
||||||
|
- append(mnt, mntinfo);
|
||||||
|
- mnt->mpoint = ((char *)mnt) + alignof(mntinfo_t);
|
||||||
|
- strcpy(mnt->mpoint, mpoint);
|
||||||
|
- mnt->nlen = nlen;
|
||||||
|
- mnt->parid = parid;
|
||||||
|
- mnt->dev = makedev(maj, min);
|
||||||
|
- mnt->id = mid;
|
||||||
|
- if (mid > max)
|
||||||
|
- max = mid;
|
||||||
+ (mnt, "%i %i %u:%u %*s %s %*[^-] - %s %s %*[^\n]",
|
+ (mnt, "%i %i %u:%u %*s %s %*[^-] - %s %s %*[^\n]",
|
||||||
+ &mid, &parid, &maj, &min, &mpoint[0], &type[0], &devname[0]) == 7) {
|
+ &mid, &parid, &maj, &min, &mpoint[0], &type[0], &devname[0]) == 7) {
|
||||||
+ struct stat st;
|
+ struct stat st;
|
||||||
@ -757,7 +741,7 @@ index c44cee8..1b58374 100644
|
|||||||
+ mntinf->dev = st.st_dev; /* stat(2) on binary does not see subvol dev */
|
+ mntinf->dev = st.st_dev; /* stat(2) on binary does not see subvol dev */
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+ }
|
}
|
||||||
+#else
|
+#else
|
||||||
+ if ((mnt = fopen(PROC_MOUNTS, "r")) == (FILE *) 0)
|
+ if ((mnt = fopen(PROC_MOUNTS, "r")) == (FILE *) 0)
|
||||||
+ return;
|
+ return;
|
||||||
@ -777,26 +761,12 @@ index c44cee8..1b58374 100644
|
|||||||
+ if (mntinf && strncmp(devname, "/dev/", 5) == 0 && stat(devname, &st) == 0) {
|
+ if (mntinf && strncmp(devname, "/dev/", 5) == 0 && stat(devname, &st) == 0) {
|
||||||
+ if (st.st_rdev != 0 && mntinf->dev != st.st_rdev)
|
+ if (st.st_rdev != 0 && mntinf->dev != st.st_rdev)
|
||||||
+ mntinf->vol = st.st_rdev;
|
+ mntinf->vol = st.st_rdev;
|
||||||
}
|
+ }
|
||||||
- append(mnt, mntinfo);
|
+ }
|
||||||
- mnt->mpoint = ((char *)mnt) + alignof(mntinfo_t);
|
|
||||||
- strcpy(mnt->mpoint, mpoint);
|
|
||||||
- mnt->nlen = nlen;
|
|
||||||
- mnt->parid = parid;
|
|
||||||
- mnt->dev = makedev(maj, min);
|
|
||||||
- mnt->id = mid;
|
|
||||||
- if (mid > max)
|
|
||||||
- max = mid;
|
|
||||||
}
|
|
||||||
+#endif
|
+#endif
|
||||||
fclose(mnt);
|
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
|
+static int
|
||||||
+get_fdinfo(const pid_t pid, const char *fd, struct fdinfo *info)
|
+get_fdinfo(const pid_t pid, const char *fd, struct fdinfo *info)
|
||||||
+{
|
+{
|
||||||
@ -886,7 +856,12 @@ index c44cee8..1b58374 100644
|
|||||||
+ int ret = -1;
|
+ int ret = -1;
|
||||||
+
|
+
|
||||||
+ *mountinfo = NULL;
|
+ *mountinfo = NULL;
|
||||||
+
|
|
||||||
|
- /* 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) {
|
||||||
+#if defined(HAS_NAME_TO_HANDLE_AT)
|
+#if defined(HAS_NAME_TO_HANDLE_AT)
|
||||||
+ if (mnt_id >= 0) {
|
+ if (mnt_id >= 0) {
|
||||||
+ list_t *ptr;
|
+ list_t *ptr;
|
||||||
@ -968,12 +943,12 @@ index c44cee8..1b58374 100644
|
|||||||
- if (mid != mnt->parid)
|
- if (mid != mnt->parid)
|
||||||
+
|
+
|
||||||
+ if (nlen != mnt->nlen)
|
+ if (nlen != mnt->nlen)
|
||||||
+ continue;
|
|
||||||
+
|
|
||||||
+ if (strcmp(use, mnt->mpoint))
|
|
||||||
continue;
|
continue;
|
||||||
- move_head(ptr, &sort);
|
- move_head(ptr, &sort);
|
||||||
+
|
+
|
||||||
|
+ if (strcmp(use, mnt->mpoint))
|
||||||
|
+ continue;
|
||||||
|
+
|
||||||
+ ret = 0;
|
+ ret = 0;
|
||||||
+ errno = 0;
|
+ errno = 0;
|
||||||
+ *mountinfo = mnt;
|
+ *mountinfo = mnt;
|
||||||
@ -999,7 +974,7 @@ index c44cee8..1b58374 100644
|
|||||||
/*
|
/*
|
||||||
* Determine device of links below /proc/
|
* Determine device of links below /proc/
|
||||||
*/
|
*/
|
||||||
@@ -2091,8 +2441,7 @@ static int mntstat(const char *path, struct stat *buf)
|
@@ -2106,8 +2454,7 @@
|
||||||
{
|
{
|
||||||
char name[PATH_MAX + 1];
|
char name[PATH_MAX + 1];
|
||||||
const char *use;
|
const char *use;
|
||||||
@ -1009,7 +984,7 @@ index c44cee8..1b58374 100644
|
|||||||
|
|
||||||
if ((use = realpath(path, name)) == NULL || *use != '/')
|
if ((use = realpath(path, name)) == NULL || *use != '/')
|
||||||
{
|
{
|
||||||
@@ -2104,27 +2453,26 @@ static int mntstat(const char *path, struct stat *buf)
|
@@ -2119,27 +2466,26 @@
|
||||||
errno = 0;
|
errno = 0;
|
||||||
return stat(path, buf);
|
return stat(path, buf);
|
||||||
}
|
}
|
||||||
@ -1055,11 +1030,10 @@ index c44cee8..1b58374 100644
|
|||||||
}
|
}
|
||||||
#endif /* WITH_MOUNTINFO_LIST */
|
#endif /* WITH_MOUNTINFO_LIST */
|
||||||
|
|
||||||
diff --git src/fuser.h src/fuser.h
|
diff -ru old/src/fuser.h new/src/fuser.h
|
||||||
index 93020d5..ca20081 100644
|
--- old/src/fuser.h 2019-11-12 11:23:38.000000000 +0100
|
||||||
--- src/fuser.h
|
+++ new/src/fuser.h 2020-12-31 10:49:48.159279790 +0100
|
||||||
+++ src/fuser.h
|
@@ -37,10 +37,16 @@
|
||||||
@@ -37,10 +37,16 @@ struct procs {
|
|
||||||
#define PTYPE_KNFSD 2
|
#define PTYPE_KNFSD 2
|
||||||
#define PTYPE_SWAP 3
|
#define PTYPE_SWAP 3
|
||||||
|
|
||||||
@ -1077,7 +1051,7 @@ index 93020d5..ca20081 100644
|
|||||||
struct procs *matched_procs;
|
struct procs *matched_procs;
|
||||||
struct names *next;
|
struct names *next;
|
||||||
};
|
};
|
||||||
@@ -65,12 +71,21 @@ struct inode_list {
|
@@ -65,12 +71,21 @@
|
||||||
struct names *name;
|
struct names *name;
|
||||||
dev_t device;
|
dev_t device;
|
||||||
ino_t inode;
|
ino_t inode;
|
||||||
@ -1099,7 +1073,7 @@ index 93020d5..ca20081 100644
|
|||||||
struct device_list *next;
|
struct device_list *next;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -79,6 +94,7 @@ struct unixsocket_list {
|
@@ -79,6 +94,7 @@
|
||||||
ino_t inode;
|
ino_t inode;
|
||||||
ino_t net_inode;
|
ino_t net_inode;
|
||||||
dev_t dev;
|
dev_t dev;
|
||||||
@ -1107,7 +1081,7 @@ index 93020d5..ca20081 100644
|
|||||||
struct unixsocket_list *next;
|
struct unixsocket_list *next;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -87,18 +103,16 @@ struct mount_list {
|
@@ -87,18 +103,16 @@
|
||||||
struct mount_list *next;
|
struct mount_list *next;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1129,37 +1103,17 @@ index 93020d5..ca20081 100644
|
|||||||
|
|
||||||
#define NAMESPACE_FILE 0
|
#define NAMESPACE_FILE 0
|
||||||
#define NAMESPACE_TCP 1
|
#define NAMESPACE_TCP 1
|
||||||
@@ -109,5 +123,6 @@ typedef struct mntinfo_s {
|
@@ -109,5 +123,6 @@
|
||||||
#endif /* PATH_MAX */
|
#endif /* PATH_MAX */
|
||||||
|
|
||||||
#define KNFSD_EXPORTS "/proc/fs/nfs/exports"
|
#define KNFSD_EXPORTS "/proc/fs/nfs/exports"
|
||||||
+#define PROC_MOUNTINFO "/proc/self/mountinfo"
|
+#define PROC_MOUNTINFO "/proc/self/mountinfo"
|
||||||
#define PROC_MOUNTS "/proc/mounts"
|
#define PROC_MOUNTS "/proc/mounts"
|
||||||
#define PROC_SWAPS "/proc/swaps"
|
#define PROC_SWAPS "/proc/swaps"
|
||||||
diff --git testsuite/Makefile.am testsuite/Makefile.am
|
diff -ru old/testsuite/killall.test/killall.exp new/testsuite/killall.test/killall.exp
|
||||||
index 696a44a..739237e 100644
|
--- old/testsuite/killall.test/killall.exp 2019-11-12 11:23:38.000000000 +0100
|
||||||
--- testsuite/Makefile.am
|
+++ new/testsuite/killall.test/killall.exp 2020-12-31 10:49:48.159279790 +0100
|
||||||
+++ testsuite/Makefile.am
|
@@ -7,7 +7,11 @@
|
||||||
@@ -1,6 +1,8 @@
|
|
||||||
AUTOMAKE_OPTIONS = dejagnu
|
|
||||||
export DEJAGNU
|
|
||||||
|
|
||||||
+EXTRA_DEJAGNU_SITE_CONFIG=$(srcdir)/selinux.exp
|
|
||||||
+
|
|
||||||
# Programs that are expected across the board.
|
|
||||||
DEJATOOL = killall
|
|
||||||
DEJATOOL += pslog
|
|
||||||
@@ -9,5 +11,4 @@ if WANT_FUSER
|
|
||||||
DEJATOOL += fuser
|
|
||||||
endif
|
|
||||||
|
|
||||||
-
|
|
||||||
EXTRA_DIST =
|
|
||||||
diff --git testsuite/killall.test/killall.exp testsuite/killall.test/killall.exp
|
|
||||||
index 8bb3889..a345582 100644
|
|
||||||
--- testsuite/killall.test/killall.exp
|
|
||||||
+++ testsuite/killall.test/killall.exp
|
|
||||||
@@ -7,7 +7,11 @@ set fake_proc_name "afakeprocname"
|
|
||||||
|
|
||||||
set test "killall with no arguments"
|
set test "killall with no arguments"
|
||||||
spawn $killall
|
spawn $killall
|
||||||
@ -1171,6 +1125,21 @@ index 8bb3889..a345582 100644
|
|||||||
|
|
||||||
set test "killall list signals"
|
set test "killall list signals"
|
||||||
spawn $killall -l
|
spawn $killall -l
|
||||||
--
|
diff -ru old/testsuite/Makefile.am new/testsuite/Makefile.am
|
||||||
2.25.0
|
--- old/testsuite/Makefile.am 2019-11-12 11:23:38.000000000 +0100
|
||||||
|
+++ new/testsuite/Makefile.am 2020-12-31 10:49:48.159279790 +0100
|
||||||
|
@@ -1,6 +1,8 @@
|
||||||
|
AUTOMAKE_OPTIONS = dejagnu
|
||||||
|
export DEJAGNU
|
||||||
|
|
||||||
|
+EXTRA_DEJAGNU_SITE_CONFIG=$(srcdir)/selinux.exp
|
||||||
|
+
|
||||||
|
# Programs that are expected across the board.
|
||||||
|
DEJATOOL = killall
|
||||||
|
DEJATOOL += pslog
|
||||||
|
@@ -9,5 +11,4 @@
|
||||||
|
DEJATOOL += fuser
|
||||||
|
endif
|
||||||
|
|
||||||
|
-
|
||||||
|
EXTRA_DIST =
|
||||||
|
@ -1,43 +1,7 @@
|
|||||||
From 59144ef25a4bf0ecceb27e1c2dd2276de54555fe Mon Sep 17 00:00:00 2001
|
diff -ruN old/configure.ac new/configure.ac
|
||||||
From: Werner Fink <werner@suse.de>
|
--- old/configure.ac 2020-12-31 11:08:34.654310080 +0100
|
||||||
Date: Mon, 27 Apr 2020 16:44:17 +0200
|
+++ new/configure.ac 2020-12-31 11:07:25.506123358 +0100
|
||||||
Subject: [PATCH] Use new statx(2) system call to avoid hangs on NFS
|
@@ -33,20 +33,6 @@
|
||||||
|
|
||||||
Signed-off-by: Werner Fink <werner@suse.de>
|
|
||||||
---
|
|
||||||
Makefile.am | 4 +-
|
|
||||||
configure.ac | 38 ++----
|
|
||||||
src/fuser.c | 98 ++++---------
|
|
||||||
src/statx.c | 149 ++++++++++++++++++++
|
|
||||||
src/statx.h | 68 +++++++++
|
|
||||||
src/timeout.c | 372 --------------------------------------------------
|
|
||||||
src/timeout.h | 45 ------
|
|
||||||
7 files changed, 258 insertions(+), 516 deletions(-)
|
|
||||||
create mode 100644 src/statx.c
|
|
||||||
create mode 100644 src/statx.h
|
|
||||||
delete mode 100644 src/timeout.c
|
|
||||||
delete mode 100644 src/timeout.h
|
|
||||||
|
|
||||||
diff --git Makefile.am Makefile.am
|
|
||||||
index d8c4619..a76799c 100644
|
|
||||||
--- Makefile.am
|
|
||||||
+++ Makefile.am
|
|
||||||
@@ -58,8 +58,8 @@ src_fuser_SOURCES = \
|
|
||||||
src/fuser.h \
|
|
||||||
src/lists.h
|
|
||||||
|
|
||||||
-if WANT_TIMEOUT_STAT
|
|
||||||
-src_fuser_SOURCES += src/timeout.c src/timeout.h
|
|
||||||
+if HAVE_SYSCALL_STATX
|
|
||||||
+src_fuser_SOURCES += src/statx.c src/statx.h
|
|
||||||
endif
|
|
||||||
src_fuser_LDADD = @LIBINTL@
|
|
||||||
src_killall_SOURCES = src/killall.c src/comm.h src/signals.c src/signals.h src/i18n.h
|
|
||||||
diff --git configure.ac configure.ac
|
|
||||||
index d8d3366..81d3674 100644
|
|
||||||
--- configure.ac
|
|
||||||
+++ configure.ac
|
|
||||||
@@ -33,20 +33,6 @@ else
|
|
||||||
fi
|
fi
|
||||||
AC_SUBST([SELINUX_LIB])
|
AC_SUBST([SELINUX_LIB])
|
||||||
|
|
||||||
@ -58,7 +22,7 @@ index d8d3366..81d3674 100644
|
|||||||
# Use /proc/self/mountinfo if available
|
# Use /proc/self/mountinfo if available
|
||||||
if test -e /proc/self/mountinfo ; then
|
if test -e /proc/self/mountinfo ; then
|
||||||
AC_DEFINE([HAS_MOUNTINFO], [1], [System has /proc/self/mountinfo which can used instead /proc(/self)/mounts])
|
AC_DEFINE([HAS_MOUNTINFO], [1], [System has /proc/self/mountinfo which can used instead /proc(/self)/mounts])
|
||||||
@@ -60,16 +46,20 @@ fi
|
@@ -60,16 +46,20 @@
|
||||||
AC_CHECK_FUNC([name_to_handle_at],[
|
AC_CHECK_FUNC([name_to_handle_at],[
|
||||||
AC_DEFINE([HAS_NAME_TO_HANDLE_AT], [1], [System has name_to_handle_at(2) system call])])
|
AC_DEFINE([HAS_NAME_TO_HANDLE_AT], [1], [System has name_to_handle_at(2) system call])])
|
||||||
|
|
||||||
@ -89,10 +53,181 @@ index d8d3366..81d3674 100644
|
|||||||
|
|
||||||
# Enable hardened compile and link flags
|
# Enable hardened compile and link flags
|
||||||
AC_ARG_ENABLE([harden_flags],
|
AC_ARG_ENABLE([harden_flags],
|
||||||
diff --git src/fuser.c src/fuser.c
|
diff -ruN old/.idea/workspace.xml new/.idea/workspace.xml
|
||||||
index 1b58374..fc98790 100644
|
--- old/.idea/workspace.xml 1970-01-01 01:00:00.000000000 +0100
|
||||||
--- src/fuser.c
|
+++ new/.idea/workspace.xml 2020-12-31 11:08:03.610226251 +0100
|
||||||
+++ src/fuser.c
|
@@ -0,0 +1,43 @@
|
||||||
|
+<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
+<project version="4">
|
||||||
|
+ <component name="CMakeSettings">
|
||||||
|
+ <configurations>
|
||||||
|
+ <configuration PROFILE_NAME="Debug" CONFIG_NAME="Debug" ENABLED="true" />
|
||||||
|
+ </configurations>
|
||||||
|
+ </component>
|
||||||
|
+ <component name="ChangeListManager">
|
||||||
|
+ <list default="true" id="32bb1d9d-012c-4ff2-a826-575cbff55a80" name="Default Changelist" comment="" />
|
||||||
|
+ <option name="SHOW_DIALOG" value="false" />
|
||||||
|
+ <option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
|
+ <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||||
|
+ <option name="LAST_RESOLUTION" value="IGNORE" />
|
||||||
|
+ </component>
|
||||||
|
+ <component name="ClangdSettings">
|
||||||
|
+ <option name="formatViaClangd" value="false" />
|
||||||
|
+ </component>
|
||||||
|
+ <component name="MacroExpansionManager">
|
||||||
|
+ <option name="directoryName" value="831eyv37" />
|
||||||
|
+ </component>
|
||||||
|
+ <component name="ProjectId" id="1mPxeVlOc4KkNnRmLJwHTLvU8lE" />
|
||||||
|
+ <component name="ProjectViewState">
|
||||||
|
+ <option name="hideEmptyMiddlePackages" value="true" />
|
||||||
|
+ <option name="showLibraryContents" value="true" />
|
||||||
|
+ </component>
|
||||||
|
+ <component name="PropertiesComponent">
|
||||||
|
+ <property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
|
||||||
|
+ <property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
|
||||||
|
+ <property name="cf.first.check.clang-format" value="false" />
|
||||||
|
+ </component>
|
||||||
|
+ <component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
|
||||||
|
+ <component name="TaskManager">
|
||||||
|
+ <task active="true" id="Default" summary="Default task">
|
||||||
|
+ <changelist id="32bb1d9d-012c-4ff2-a826-575cbff55a80" name="Default Changelist" comment="" />
|
||||||
|
+ <created>1609409125494</created>
|
||||||
|
+ <option name="number" value="Default" />
|
||||||
|
+ <option name="presentableId" value="Default" />
|
||||||
|
+ <updated>1609409125494</updated>
|
||||||
|
+ <workItem from="1609409128547" duration="155000" />
|
||||||
|
+ </task>
|
||||||
|
+ <servers />
|
||||||
|
+ </component>
|
||||||
|
+</project>
|
||||||
|
\ No newline at end of file
|
||||||
|
diff -ruN old/Makefile.am new/Makefile.am
|
||||||
|
--- old/Makefile.am 2019-11-12 11:23:38.000000000 +0100
|
||||||
|
+++ new/Makefile.am 2020-12-31 11:07:25.506123358 +0100
|
||||||
|
@@ -64,8 +64,8 @@
|
||||||
|
src/fuser.h \
|
||||||
|
src/lists.h
|
||||||
|
|
||||||
|
-if WANT_TIMEOUT_STAT
|
||||||
|
-src_fuser_SOURCES += src/timeout.c src/timeout.h
|
||||||
|
+if HAVE_SYSCALL_STATX
|
||||||
|
+src_fuser_SOURCES += src/statx.c src/statx.h
|
||||||
|
endif
|
||||||
|
src_fuser_LDADD = @LIBINTL@
|
||||||
|
src_killall_SOURCES = src/killall.c src/comm.h src/signals.c src/signals.h src/i18n.h
|
||||||
|
diff -ruN old/Makefile.am.orig new/Makefile.am.orig
|
||||||
|
--- old/Makefile.am.orig 1970-01-01 01:00:00.000000000 +0100
|
||||||
|
+++ new/Makefile.am.orig 2019-11-12 11:23:38.000000000 +0100
|
||||||
|
@@ -0,0 +1,106 @@
|
||||||
|
+
|
||||||
|
+AM_CPPFLAGS = \
|
||||||
|
+ -Wall \
|
||||||
|
+ -DLOCALEDIR=\"$(localedir)\" \
|
||||||
|
+ -I$(top_builddir)/src \
|
||||||
|
+ @HARDEN_CFLAGS@
|
||||||
|
+
|
||||||
|
+AM_LDFLAGS = @HARDEN_LDFLAGS@
|
||||||
|
+
|
||||||
|
+ACLOCAL_AMFLAGS = -I m4
|
||||||
|
+
|
||||||
|
+SUBDIRS = \
|
||||||
|
+ doc \
|
||||||
|
+ po \
|
||||||
|
+ icons \
|
||||||
|
+ testsuite
|
||||||
|
+
|
||||||
|
+bin_PROGRAMS = \
|
||||||
|
+ src/killall \
|
||||||
|
+ src/pslog \
|
||||||
|
+ src/prtstat \
|
||||||
|
+ src/pstree
|
||||||
|
+
|
||||||
|
+if WANT_FUSER
|
||||||
|
+ bin_PROGRAMS += src/fuser
|
||||||
|
+endif
|
||||||
|
+if WANT_PEEKFD_I386
|
||||||
|
+ bin_PROGRAMS += src/peekfd
|
||||||
|
+ AM_CPPFLAGS += -DI386
|
||||||
|
+endif
|
||||||
|
+if WANT_PEEKFD_X86_64
|
||||||
|
+ bin_PROGRAMS += src/peekfd
|
||||||
|
+ AM_CPPFLAGS += -DX86_64
|
||||||
|
+endif
|
||||||
|
+if WANT_PEEKFD_PPC
|
||||||
|
+ bin_PROGRAMS += src/peekfd
|
||||||
|
+ AM_CPPFLAGS += -DPPC
|
||||||
|
+endif
|
||||||
|
+if WANT_PEEKFD_ARM
|
||||||
|
+ bin_PROGRAMS += src/peekfd
|
||||||
|
+ AM_CPPFLAGS += -DARM
|
||||||
|
+endif
|
||||||
|
+
|
||||||
|
+if WANT_PEEKFD_ARM64
|
||||||
|
+ bin_PROGRAMS += src/peekfd
|
||||||
|
+ AM_CPPFLAGS += -DARM64
|
||||||
|
+endif
|
||||||
|
+
|
||||||
|
+if WANT_PEEKFD_MIPS
|
||||||
|
+ bin_PROGRAMS += src/peekfd
|
||||||
|
+ AM_CPPFLAGS += -DMIPS
|
||||||
|
+endif
|
||||||
|
+if WANT_PEEKFD_M68K
|
||||||
|
+ bin_PROGRAMS += src/peekfd
|
||||||
|
+ AM_CPPFLAGS += -DM68K
|
||||||
|
+endif
|
||||||
|
+
|
||||||
|
+src_fuser_SOURCES = \
|
||||||
|
+ src/fuser.c \
|
||||||
|
+ src/comm.h \
|
||||||
|
+ src/signals.c \
|
||||||
|
+ src/signals.h \
|
||||||
|
+ src/i18n.h \
|
||||||
|
+ src/fuser.h \
|
||||||
|
+ src/lists.h
|
||||||
|
+
|
||||||
|
+if WANT_TIMEOUT_STAT
|
||||||
|
+src_fuser_SOURCES += src/timeout.c src/timeout.h
|
||||||
|
+endif
|
||||||
|
+src_fuser_LDADD = @LIBINTL@
|
||||||
|
+src_killall_SOURCES = src/killall.c src/comm.h src/signals.c src/signals.h src/i18n.h
|
||||||
|
+src_killall_LDADD = @LIBINTL@ @SELINUX_LIB@
|
||||||
|
+src_peekfd_SOURCES = src/peekfd.c
|
||||||
|
+src_peekfd_LDADD = @LIBINTL@
|
||||||
|
+src_pslog_SOURCES = src/pslog.c
|
||||||
|
+src_pstree_SOURCES = src/pstree.c src/comm.h src/i18n.h
|
||||||
|
+src_pstree_LDADD = @LIBINTL@ @TERMCAP_LIB@ @SELINUX_LIB@
|
||||||
|
+src_prtstat_SOURCES = src/prtstat.c src/prtstat.h
|
||||||
|
+src_prtstat_LDADD = @LIBINTL@
|
||||||
|
+nodist_src_killall_SOURCES = signames.h
|
||||||
|
+
|
||||||
|
+BUILT_SOURCES = src/signames.h
|
||||||
|
+
|
||||||
|
+EXTRA_DIST = src/signames.c README.md misc/git-version-gen
|
||||||
|
+
|
||||||
|
+CLEANFILES = src/signames.h
|
||||||
|
+
|
||||||
|
+src/signames.h: src/signames.c Makefile src/$(am__dirstamp)
|
||||||
|
+ export LC_ALL=C ; \
|
||||||
|
+ @CPP@ -dM $< |\
|
||||||
|
+ tr -s '\t ' ' ' | sort -n -k 3 | sed \
|
||||||
|
+ 's:#define SIG\([A-Z][A-Z]*[0-9]*\) \([0-9][0-9]*\).*$\:{\ \2,"\1" },:p;d' | \
|
||||||
|
+ grep -v '[0-9][0-9][0-9]' >$@ || \
|
||||||
|
+ { rm -f $@; exit 1; }
|
||||||
|
+ grep '^{ 1,"HUP" },$$' $@ >/dev/null || \
|
||||||
|
+ { rm -f $@; exit 1; }
|
||||||
|
+
|
||||||
|
+src/signals.c: src/signames.h
|
||||||
|
+
|
||||||
|
+install-exec-hook:
|
||||||
|
+ cd $(DESTDIR)$(bindir) && \
|
||||||
|
+ ( [ -h pstree.x11 ] || $(LN_S) pstree pstree.x11)
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+get-trans:
|
||||||
|
+ rsync -Lrtvz translationproject.org::tp/latest/psmisc/ po
|
||||||
|
diff -ruN old/src/fuser.c new/src/fuser.c
|
||||||
|
--- old/src/fuser.c 2020-12-31 11:08:34.658310092 +0100
|
||||||
|
+++ new/src/fuser.c 2020-12-31 11:07:57.282209163 +0100
|
||||||
@@ -63,7 +63,7 @@
|
@@ -63,7 +63,7 @@
|
||||||
#include "fuser.h"
|
#include "fuser.h"
|
||||||
#include "signals.h"
|
#include "signals.h"
|
||||||
@ -102,7 +237,7 @@ index 1b58374..fc98790 100644
|
|||||||
#include "comm.h"
|
#include "comm.h"
|
||||||
|
|
||||||
//#define DEBUG 1
|
//#define DEBUG 1
|
||||||
@@ -118,10 +118,6 @@ static void clear_mntinfo(void) __attribute__ ((__destructor__));
|
@@ -118,10 +118,6 @@
|
||||||
static void init_mntinfo(void) __attribute__ ((__constructor__));
|
static void init_mntinfo(void) __attribute__ ((__constructor__));
|
||||||
static int get_fdinfo(const pid_t pid, const char *fd, struct fdinfo *info);
|
static int get_fdinfo(const pid_t pid, const char *fd, struct fdinfo *info);
|
||||||
static int find_mountpoint(const char *path, mntinfo_t **mountinfo);
|
static int find_mountpoint(const char *path, mntinfo_t **mountinfo);
|
||||||
@ -113,7 +248,7 @@ index 1b58374..fc98790 100644
|
|||||||
static char *expandpath(const char *path);
|
static char *expandpath(const char *path);
|
||||||
static struct unixsocket_list *unixsockets = NULL;
|
static struct unixsocket_list *unixsockets = NULL;
|
||||||
static struct names *names_head = NULL, *names_tail = NULL;
|
static struct names *names_head = NULL, *names_tail = NULL;
|
||||||
@@ -506,7 +502,7 @@ int parse_file(struct names *this_name, struct inode_list **ino_list,
|
@@ -509,7 +505,7 @@
|
||||||
free(this_name->filename);
|
free(this_name->filename);
|
||||||
this_name->filename = strdup(new);
|
this_name->filename = strdup(new);
|
||||||
}
|
}
|
||||||
@ -122,7 +257,7 @@ index 1b58374..fc98790 100644
|
|||||||
find_mountpoint(this_name->filename, &mountinfo) != 0) {
|
find_mountpoint(this_name->filename, &mountinfo) != 0) {
|
||||||
if (errno == ENOENT)
|
if (errno == ENOENT)
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
@@ -1241,9 +1237,7 @@ int main(int argc, char *argv[])
|
@@ -1245,9 +1241,7 @@
|
||||||
opts |= OPT_INTERACTIVE;
|
opts |= OPT_INTERACTIVE;
|
||||||
break;
|
break;
|
||||||
case 'I':
|
case 'I':
|
||||||
@ -132,7 +267,7 @@ index 1b58374..fc98790 100644
|
|||||||
break;
|
break;
|
||||||
case 'k':
|
case 'k':
|
||||||
opts |= OPT_KILL;
|
opts |= OPT_KILL;
|
||||||
@@ -1309,10 +1303,11 @@ int main(int argc, char *argv[])
|
@@ -1313,10 +1307,11 @@
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -147,7 +282,7 @@ index 1b58374..fc98790 100644
|
|||||||
/* an option */
|
/* an option */
|
||||||
/* Not an option, must be a file specification */
|
/* Not an option, must be a file specification */
|
||||||
if ((this_name = malloc(sizeof(struct names))) == NULL)
|
if ((this_name = malloc(sizeof(struct names))) == NULL)
|
||||||
@@ -1632,7 +1627,7 @@ static struct stat *get_pidstat(const pid_t pid, const char *filename, int *id)
|
@@ -1636,7 +1631,7 @@
|
||||||
if ((st = (struct stat *)malloc(sizeof(struct stat))) == NULL)
|
if ((st = (struct stat *)malloc(sizeof(struct stat))) == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
snprintf(pathname, 256, "/proc/%d/%s", pid, filename);
|
snprintf(pathname, 256, "/proc/%d/%s", pid, filename);
|
||||||
@ -156,7 +291,7 @@ index 1b58374..fc98790 100644
|
|||||||
free(st);
|
free(st);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -1679,7 +1674,7 @@ check_dir(const pid_t pid, const char *dirname, struct device_list *dev_head,
|
@@ -1683,7 +1678,7 @@
|
||||||
snprintf(filepath, sizeof filepath - 1, "/proc/%d/%s/%s",
|
snprintf(filepath, sizeof filepath - 1, "/proc/%d/%s/%s",
|
||||||
pid, dirname, direntry->d_name);
|
pid, dirname, direntry->d_name);
|
||||||
|
|
||||||
@ -165,7 +300,7 @@ index 1b58374..fc98790 100644
|
|||||||
if (errno != ENOENT && errno != ENOTDIR) {
|
if (errno != ENOENT && errno != ENOTDIR) {
|
||||||
fprintf(stderr, _("Cannot stat file %s: %s\n"),
|
fprintf(stderr, _("Cannot stat file %s: %s\n"),
|
||||||
filepath, strerror(errno));
|
filepath, strerror(errno));
|
||||||
@@ -1734,7 +1729,7 @@ check_dir(const pid_t pid, const char *dirname, struct device_list *dev_head,
|
@@ -1738,7 +1733,7 @@
|
||||||
if (thedev != ino_tmp->device)
|
if (thedev != ino_tmp->device)
|
||||||
continue;
|
continue;
|
||||||
if (!st.st_ino
|
if (!st.st_ino
|
||||||
@ -174,7 +309,7 @@ index 1b58374..fc98790 100644
|
|||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
_("Cannot stat file %s: %s\n"),
|
_("Cannot stat file %s: %s\n"),
|
||||||
filepath, strerror(errno));
|
filepath, strerror(errno));
|
||||||
@@ -1832,11 +1827,11 @@ static uid_t getpiduid(const pid_t pid)
|
@@ -1836,11 +1831,11 @@
|
||||||
|
|
||||||
if (asprintf(&pathname, "/proc/%d", pid) < 0)
|
if (asprintf(&pathname, "/proc/%d", pid) < 0)
|
||||||
return 0;
|
return 0;
|
||||||
@ -190,7 +325,7 @@ index 1b58374..fc98790 100644
|
|||||||
return st.st_uid;
|
return st.st_uid;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1874,7 +1869,7 @@ void fill_unix_cache(struct unixsocket_list **unixsocket_head)
|
@@ -1878,7 +1873,7 @@
|
||||||
path = scanned_path;
|
path = scanned_path;
|
||||||
if (*scanned_path == '@')
|
if (*scanned_path == '@')
|
||||||
scanned_path++;
|
scanned_path++;
|
||||||
@ -199,7 +334,7 @@ index 1b58374..fc98790 100644
|
|||||||
free(path);
|
free(path);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -2009,7 +2004,7 @@ static dev_t find_net_dev(void)
|
@@ -2013,7 +2008,7 @@
|
||||||
fprintf(stderr, _("Cannot open a network socket.\n"));
|
fprintf(stderr, _("Cannot open a network socket.\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -208,7 +343,7 @@ index 1b58374..fc98790 100644
|
|||||||
fprintf(stderr, _("Cannot find socket's device number.\n"));
|
fprintf(stderr, _("Cannot find socket's device number.\n"));
|
||||||
close(skt);
|
close(skt);
|
||||||
return -1;
|
return -1;
|
||||||
@@ -2042,7 +2037,7 @@ scan_knfsd(struct names *names_head, struct inode_list *ino_head,
|
@@ -2050,7 +2045,7 @@
|
||||||
if ((find_space = strpbrk(line, " \t")) == NULL)
|
if ((find_space = strpbrk(line, " \t")) == NULL)
|
||||||
continue;
|
continue;
|
||||||
*find_space = '\0';
|
*find_space = '\0';
|
||||||
@ -217,16 +352,16 @@ index 1b58374..fc98790 100644
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
/* Scan the devices */
|
/* Scan the devices */
|
||||||
@@ -2077,7 +2072,7 @@ scan_mounts(struct names *names_head, struct inode_list *ino_head,
|
@@ -2087,7 +2082,7 @@
|
||||||
mntinfo_t *mnt = list_entry(ptr, mntinfo_t);
|
mntinfo_t *mnt = list_entry(ptr, mntinfo_t);
|
||||||
const char *find_mountp = mnt->mpoint;
|
const char *find_mountp = mnt->mpoint;
|
||||||
|
|
||||||
- if (timeout(thestat, find_mountp, &st, 5) != 0)
|
- if (timeout(thestat, find_mountp, &st, 5) != 0)
|
||||||
+ if (statn(find_mountp, STATX_INO, &st) != 0)
|
+ if (statn(find_mountp, STATX_INO, &st) != 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* Scan the devices */
|
/* Scan the devices */
|
||||||
@@ -2124,7 +2119,7 @@ scan_swaps(struct names *names_head, struct inode_list *ino_head,
|
@@ -2137,7 +2132,7 @@
|
||||||
if (*find_space == '\0')
|
if (*find_space == '\0')
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -235,7 +370,7 @@ index 1b58374..fc98790 100644
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
/* Scan the devices */
|
/* Scan the devices */
|
||||||
@@ -2216,10 +2211,10 @@ init_mntinfo(void)
|
@@ -2229,10 +2224,10 @@
|
||||||
&mid, &parid, &maj, &min, &mpoint[0], &type[0], &devname[0]) == 7) {
|
&mid, &parid, &maj, &min, &mpoint[0], &type[0], &devname[0]) == 7) {
|
||||||
struct stat st;
|
struct stat st;
|
||||||
mntinf = add_mntinfo(mpoint, type, mid, parid, makedev(maj, min));
|
mntinf = add_mntinfo(mpoint, type, mid, parid, makedev(maj, min));
|
||||||
@ -248,7 +383,7 @@ index 1b58374..fc98790 100644
|
|||||||
mntinf->dev = st.st_dev; /* stat(2) on binary does not see subvol dev */
|
mntinf->dev = st.st_dev; /* stat(2) on binary does not see subvol dev */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2231,7 +2226,7 @@ init_mntinfo(void)
|
@@ -2244,7 +2239,7 @@
|
||||||
parid = -1;
|
parid = -1;
|
||||||
while (fscanf (mnt, "%s %s %s %*[^\n]", &devname[0], &mpoint[0], &type[0]) == 3) {
|
while (fscanf (mnt, "%s %s %s %*[^\n]", &devname[0], &mpoint[0], &type[0]) == 3) {
|
||||||
struct stat st;
|
struct stat st;
|
||||||
@ -257,7 +392,7 @@ index 1b58374..fc98790 100644
|
|||||||
if (errno != EACCES) {
|
if (errno != EACCES) {
|
||||||
fprintf(stderr, _("Cannot stat %s: %s\n"),
|
fprintf(stderr, _("Cannot stat %s: %s\n"),
|
||||||
mnt->mpoint, strerror(errno));
|
mnt->mpoint, strerror(errno));
|
||||||
@@ -2240,7 +2235,7 @@ init_mntinfo(void)
|
@@ -2253,7 +2248,7 @@
|
||||||
st.st_dev = (dev_t)-1;
|
st.st_dev = (dev_t)-1;
|
||||||
}
|
}
|
||||||
mntinf = add_mntinfo(mpoint, type, mid++, parid, st.st_dev);
|
mntinf = add_mntinfo(mpoint, type, mid++, parid, st.st_dev);
|
||||||
@ -266,7 +401,7 @@ index 1b58374..fc98790 100644
|
|||||||
if (st.st_rdev != 0 && mntinf->dev != st.st_rdev)
|
if (st.st_rdev != 0 && mntinf->dev != st.st_rdev)
|
||||||
mntinf->vol = st.st_rdev;
|
mntinf->vol = st.st_rdev;
|
||||||
}
|
}
|
||||||
@@ -2290,7 +2285,7 @@ out:
|
@@ -2303,7 +2298,7 @@
|
||||||
struct stat lst;
|
struct stat lst;
|
||||||
|
|
||||||
snprintf(pathname, 256, "/proc/%d/fd/%s", pid, fd);
|
snprintf(pathname, 256, "/proc/%d/fd/%s", pid, fd);
|
||||||
@ -275,7 +410,7 @@ index 1b58374..fc98790 100644
|
|||||||
if (lst.st_mode & S_IWUSR)
|
if (lst.st_mode & S_IWUSR)
|
||||||
info->flags |= O_WRONLY;
|
info->flags |= O_WRONLY;
|
||||||
ret++;
|
ret++;
|
||||||
@@ -2363,7 +2358,7 @@ find_mountpoint(const char *path, mntinfo_t **mountinfo)
|
@@ -2376,7 +2371,7 @@
|
||||||
|
|
||||||
/* could be a chroot or a container */
|
/* could be a chroot or a container */
|
||||||
|
|
||||||
@ -284,7 +419,7 @@ index 1b58374..fc98790 100644
|
|||||||
if (errno != EACCES) {
|
if (errno != EACCES) {
|
||||||
fprintf(stderr, _("Cannot stat %s: %s\n"),
|
fprintf(stderr, _("Cannot stat %s: %s\n"),
|
||||||
path, strerror(errno));
|
path, strerror(errno));
|
||||||
@@ -2395,7 +2390,7 @@ find_mountpoint(const char *path, mntinfo_t **mountinfo)
|
@@ -2408,7 +2403,7 @@
|
||||||
|
|
||||||
/* could be a chroot or a container */
|
/* could be a chroot or a container */
|
||||||
|
|
||||||
@ -293,7 +428,7 @@ index 1b58374..fc98790 100644
|
|||||||
if (errno != EACCES) {
|
if (errno != EACCES) {
|
||||||
fprintf(stderr, _("Cannot stat %s: %s\n"),
|
fprintf(stderr, _("Cannot stat %s: %s\n"),
|
||||||
use, strerror(errno));
|
use, strerror(errno));
|
||||||
@@ -2433,49 +2428,6 @@ out:
|
@@ -2446,49 +2441,6 @@
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -343,11 +478,9 @@ index 1b58374..fc98790 100644
|
|||||||
/*
|
/*
|
||||||
* Somehow the realpath(3) glibc function call, nevertheless
|
* Somehow the realpath(3) glibc function call, nevertheless
|
||||||
* it avoids lstat(2) system calls.
|
* it avoids lstat(2) system calls.
|
||||||
diff --git src/statx.c src/statx.c
|
diff -ruN old/src/statx.c new/src/statx.c
|
||||||
new file mode 100644
|
--- old/src/statx.c 1970-01-01 01:00:00.000000000 +0100
|
||||||
index 0000000..a598c89
|
+++ new/src/statx.c 2020-12-31 11:07:25.506123358 +0100
|
||||||
--- /dev/null
|
|
||||||
+++ src/statx.c
|
|
||||||
@@ -0,0 +1,149 @@
|
@@ -0,0 +1,149 @@
|
||||||
+/*
|
+/*
|
||||||
+ * statx.c - Map modern statx(2) system call to older stat(2), lstat(2),
|
+ * statx.c - Map modern statx(2) system call to older stat(2), lstat(2),
|
||||||
@ -498,11 +631,9 @@ index 0000000..a598c89
|
|||||||
+ }
|
+ }
|
||||||
+ return ret;
|
+ return ret;
|
||||||
+}
|
+}
|
||||||
diff --git src/statx.h src/statx.h
|
diff -ruN old/src/statx.h new/src/statx.h
|
||||||
new file mode 100644
|
--- old/src/statx.h 1970-01-01 01:00:00.000000000 +0100
|
||||||
index 0000000..fdd0137
|
+++ new/src/statx.h 2020-12-31 11:07:25.506123358 +0100
|
||||||
--- /dev/null
|
|
||||||
+++ src/statx.h
|
|
||||||
@@ -0,0 +1,68 @@
|
@@ -0,0 +1,68 @@
|
||||||
+/*
|
+/*
|
||||||
+ * statx.h - Map modern statx(2) system call to older stat(2), lstat(2),
|
+ * statx.h - Map modern statx(2) system call to older stat(2), lstat(2),
|
||||||
@ -572,11 +703,9 @@ index 0000000..fdd0137
|
|||||||
+#define STATX_ALL 0
|
+#define STATX_ALL 0
|
||||||
+#endif
|
+#endif
|
||||||
+#endif
|
+#endif
|
||||||
diff --git src/timeout.c src/timeout.c
|
diff -ruN old/src/timeout.c new/src/timeout.c
|
||||||
deleted file mode 100644
|
--- old/src/timeout.c 2019-11-12 11:23:38.000000000 +0100
|
||||||
index ca4a7cd..0000000
|
+++ new/src/timeout.c 1970-01-01 01:00:00.000000000 +0100
|
||||||
--- src/timeout.c
|
|
||||||
+++ /dev/null
|
|
||||||
@@ -1,372 +0,0 @@
|
@@ -1,372 +0,0 @@
|
||||||
-/*
|
-/*
|
||||||
- * timout.c Advanced timeout handling for file system calls
|
- * timout.c Advanced timeout handling for file system calls
|
||||||
@ -950,11 +1079,9 @@ index ca4a7cd..0000000
|
|||||||
-/*
|
-/*
|
||||||
- * End of timeout.c
|
- * End of timeout.c
|
||||||
- */
|
- */
|
||||||
diff --git src/timeout.h src/timeout.h
|
diff -ruN old/src/timeout.h new/src/timeout.h
|
||||||
deleted file mode 100644
|
--- old/src/timeout.h 2019-11-12 11:23:38.000000000 +0100
|
||||||
index f372297..0000000
|
+++ new/src/timeout.h 1970-01-01 01:00:00.000000000 +0100
|
||||||
--- src/timeout.h
|
|
||||||
+++ /dev/null
|
|
||||||
@@ -1,45 +0,0 @@
|
@@ -1,45 +0,0 @@
|
||||||
-/*
|
-/*
|
||||||
- * timout.h Advanced timeout handling for file system calls
|
- * timout.h Advanced timeout handling for file system calls
|
||||||
@ -1001,6 +1128,3 @@ index f372297..0000000
|
|||||||
-#endif
|
-#endif
|
||||||
-
|
-
|
||||||
-#endif
|
-#endif
|
||||||
--
|
|
||||||
2.25.0
|
|
||||||
|
|
||||||
|
@ -1,18 +1,14 @@
|
|||||||
---
|
--- src/pstree.c.orig 2019-11-12 11:23:38.000000000 +0100
|
||||||
src/pstree.c | 37 ++++++++++++++++++++++++++++++-------
|
+++ src/pstree.c 2020-12-31 10:43:59.650348130 +0100
|
||||||
1 file changed, 30 insertions(+), 7 deletions(-)
|
@@ -71,6 +71,7 @@
|
||||||
|
|
||||||
--- src/pstree.c
|
|
||||||
+++ src/pstree.c 2017-06-20 14:24:15.670691071 +0000
|
|
||||||
@@ -70,6 +70,7 @@ extern const char *__progname;
|
|
||||||
#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 */
|
||||||
+#define VT_LEN 4
|
+#define VT_LEN 4
|
||||||
#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"
|
||||||
@@ -450,6 +451,27 @@ static void out_scontext(security_contex
|
@@ -470,6 +471,27 @@
|
||||||
out_string("'");
|
out_string("'");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,7 +36,7 @@
|
|||||||
static void out_newline(void)
|
static void out_newline(void)
|
||||||
{
|
{
|
||||||
if (last_char && cur_x == output_width)
|
if (last_char && cur_x == output_width)
|
||||||
@@ -662,11 +684,12 @@ dump_tree(PROC * current, int level, int
|
@@ -705,11 +727,12 @@
|
||||||
for (lvl = 0; lvl < level; lvl++) {
|
for (lvl = 0; lvl < level; lvl++) {
|
||||||
for (i = width[lvl] + 1; i; i--)
|
for (i = width[lvl] + 1; i; i--)
|
||||||
out_char(' ');
|
out_char(' ');
|
||||||
@ -49,16 +45,16 @@
|
|||||||
- 1 ? last ? sym->last_2 : sym->branch_2 : more[lvl +
|
- 1 ? last ? sym->last_2 : sym->branch_2 : more[lvl +
|
||||||
- 1] ?
|
- 1] ?
|
||||||
- sym->vert_2 : sym->empty_2);
|
- sym->vert_2 : sym->empty_2);
|
||||||
+ /*
|
+ /*
|
||||||
+ * Replace all three symbol-drawing calls with calls to out_sym()
|
+ * Replace all three symbol-drawing calls with calls to out_sym()
|
||||||
+ * to handle VT100 line drawing sequences if VT100 mode is active:
|
+ * to handle VT100 line drawing sequences if VT100 mode is active:
|
||||||
+ */
|
+ */
|
||||||
+ out_sym(lvl == level - 1 ? last ? sym->last_2 : sym->branch_2 :
|
+ out_sym(lvl == level - 1 ? last ? sym->last_2 : sym->branch_2 :
|
||||||
+ more[lvl + 1] ? sym->vert_2 : sym->empty_2);
|
+ more[lvl + 1] ? sym->vert_2 : sym->empty_2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rep < 2)
|
if (rep < 2)
|
||||||
add = 0;
|
@@ -819,7 +842,7 @@
|
||||||
@@ -773,7 +796,7 @@ dump_tree(PROC * current, int level, int
|
|
||||||
}
|
}
|
||||||
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) {
|
||||||
@ -67,7 +63,7 @@
|
|||||||
out_string("+");
|
out_string("+");
|
||||||
out_newline();
|
out_newline();
|
||||||
return;
|
return;
|
||||||
@@ -797,7 +820,7 @@ dump_tree(PROC * current, int level, int
|
@@ -843,7 +866,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (first) {
|
if (first) {
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:2f7807eb8bf8bac6835a81ef3740924755f1f3b8402d4e7b5ee1ab8a699c9679
|
|
||||||
size 160432
|
|
3
psmisc-v23.3.tar.bz2
Normal file
3
psmisc-v23.3.tar.bz2
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:fe530b0a29902f8660481248fc19f6994927282b4fe0cd992121016144b95fa6
|
||||||
|
size 168796
|
@ -1,3 +1,16 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Thu Dec 31 09:40:07 UTC 2020 - Paolo Stivanin <info@paolostivanin.com>
|
||||||
|
|
||||||
|
- Update to 23.3:
|
||||||
|
* killall: check also truncated 16 char comm names Debian
|
||||||
|
* fuser: Return early if have nulls
|
||||||
|
* peekfd: Add support for ARM64
|
||||||
|
* pstree: Add color by age
|
||||||
|
* fuser: Use larger inode sizes
|
||||||
|
- Rebase 0001-Use-mountinfo-to-be-able-to-use-the-mount-identity.patch
|
||||||
|
- Rebase 0002-Use-new-statx-2-system-call-to-avoid-hangs-on-NFS.patch
|
||||||
|
- Rebase psmisc-22.21-pstree.patch
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Fri Oct 16 10:18:52 UTC 2020 - Ludwig Nussel <lnussel@suse.de>
|
Fri Oct 16 10:18:52 UTC 2020 - Ludwig Nussel <lnussel@suse.de>
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ BuildRequires: libselinux-devel
|
|||||||
BuildRequires: linux-glibc-devel >= 4.12
|
BuildRequires: linux-glibc-devel >= 4.12
|
||||||
BuildRequires: ncurses-devel
|
BuildRequires: ncurses-devel
|
||||||
URL: https://gitlab.com/psmisc/psmisc/
|
URL: https://gitlab.com/psmisc/psmisc/
|
||||||
Version: 23.2
|
Version: 23.3
|
||||||
Release: 0
|
Release: 0
|
||||||
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
|
||||||
@ -56,8 +56,8 @@ processes that are using specified files or filesystems.
|
|||||||
%prep
|
%prep
|
||||||
%setup -q -n %{name}-v%{version}
|
%setup -q -n %{name}-v%{version}
|
||||||
%patch2 -p0 -b .pstree
|
%patch2 -p0 -b .pstree
|
||||||
%patch3 -p0 -b .mntinf
|
%patch3 -p1 -b .mntinf
|
||||||
%patch4 -p0 -b .statx
|
%patch4 -p1 -b .statx
|
||||||
%patch0 -p0 -b .p0
|
%patch0 -p0 -b .p0
|
||||||
|
|
||||||
%build
|
%build
|
||||||
|
Loading…
Reference in New Issue
Block a user