OBS User unknown 2009-05-15 19:46:50 +00:00 committed by Git OBS Bridge
parent f8bc3d2cba
commit a6297978bf
13 changed files with 218 additions and 238 deletions

View File

@ -1,111 +0,0 @@
--- src/pstree.c
+++ src/pstree.c 2007-04-25 00:00:00.000000000 +0200
@@ -63,6 +63,7 @@ extern const char *__progname;
#define UTF_HD "\342\224\254" /* U+252C, Horizontal and down */
#define VT_BEG "\033(0\017" /* use graphic chars */
+#define VT_BEG_LEN 4
#define VT_END "\033(B" /* back to normal char set */
#define VT_V "x" /* see UTF definitions above */
#define VT_VR "t"
@@ -113,13 +114,21 @@ sym_ascii =
UTF_VR UTF_H,
UTF_V " ",
- UTF_UR UTF_H, UTF_H UTF_H UTF_H, UTF_H UTF_HD UTF_H}, sym_vt100 =
+ UTF_UR UTF_H, UTF_H UTF_H UTF_H, UTF_H UTF_HD UTF_H}
+
+, sym_vt100 =
+/*
+ * For the vt100 line drawing fix: Do not append VT_END here
+ * because we may need to end the line drawing prematurely and
+ * we have to turn off line drawing mode by sending VT_END
+ * then anyway. That's why VT_END is sent by out_sym().
+ */
{
" ",
- VT_BEG VT_VR VT_H VT_END,
- VT_BEG VT_V VT_END " ",
- VT_BEG VT_UR VT_H VT_END,
- VT_BEG VT_H VT_H VT_H VT_END, VT_BEG VT_H VT_HD VT_H VT_END}
+ VT_BEG VT_VR VT_H,
+ VT_BEG VT_V " ",
+ VT_BEG VT_UR VT_H,
+ VT_BEG VT_H VT_H VT_H, VT_BEG VT_H VT_HD VT_H}
, *sym = &sym_ascii;
@@ -144,9 +153,13 @@ out_char (char c)
putchar (c);
if (cur_x == output_width + 1 && trunc && ((c & 0xc0) != 0x80))
{
- if (last_char || (c & 0x80))
+ if (last_char || (c & 0x80)) {
+/*
+ * pstree: UTF-8: never draw >1 '+' at end of line(no change for ASCII):
+ */
+ cur_x++;
putchar ('+');
- else
+ } else
{
last_char = c;
cur_x--;
@@ -163,6 +176,26 @@ out_string (const char *str)
out_char (*str++);
}
+/*
+ * Only affects vt100 line drawing mode: Do not count the strlen of
+ * VT_BEG to prevent doing end-of-line way too early:
+ */
+static void
+out_sym (const char *str)
+{
+ int seq = 0;
+ if (sym == &sym_vt100 && *str == '\033') {
+ seq = 1;
+ if (cur_x <= output_width || !trunc)
+ cur_x -= VT_BEG_LEN;
+ }
+ out_string(str);
+ if (seq) {
+ str = VT_END;
+ while (*str)
+ putchar (*str++);
+ }
+}
static int
out_int (int x) /* non-negative integers only */
@@ -379,7 +412,11 @@ dump_tree (PROC * current, int level, in
{
for (i = width[lvl] + 1; i; i--)
out_char (' ');
- out_string (lvl == level - 1 ? last ? sym->last_2 : sym->branch_2 :
+ /*
+ * Replace all three symbol-drawing calls with calls to out_sym()
+ * to handle VT100 line drawing sequences if VT100 mode is active:
+ */
+ out_sym (lvl == level - 1 ? last ? sym->last_2 : sym->branch_2 :
more[lvl + 1] ? sym->vert_2 : sym->empty_2);
}
if (rep < 2)
@@ -489,7 +526,7 @@ dump_tree (PROC * current, int level, in
width[level] = comm_len + cur_x - offset + add;
if (cur_x >= output_width && trunc)
{
- out_string (sym->first_3);
+ out_sym (sym->first_3);
out_string ("+");
out_newline ();
}
@@ -516,7 +553,7 @@ dump_tree (PROC * current, int level, in
}
if (first)
{
- out_string (next ? sym->first_3 : sym->single_3);
+ out_sym (next ? sym->first_3 : sym->single_3);
first = 0;
}
dump_tree (walk->child, level + 1, count + 1,

View File

@ -1,10 +1,10 @@
--- src/fuser.c
+++ src/fuser.c 2008-09-01 15:03:05.054239318 +0200
@@ -1306,6 +1308,7 @@ void fill_unix_cache(struct unixsocket_l
+++ src/fuser.c 2008-09-01 15:03:05.000000000 +0200
@@ -1404,6 +1404,7 @@ void fill_unix_cache(struct unixsocket_l
*unixsocket_head = newsocket;
} /* while */
+ fclose(fp);
}
/*
static inline int isnetfs(const char * type)

View File

@ -1,4 +1,3 @@
Files src/fuser and src/fuser differ
--- src/fuser.c
+++ src/fuser.c 2008-05-16 14:58:07.906452331 +0200
@@ -1310,12 +1310,21 @@ void fill_unix_cache(struct unixsocket_l

View File

@ -1,6 +1,6 @@
--- src/pstree.c
+++ src/pstree.c 2008-10-09 16:24:23.278874191 +0200
@@ -861,7 +861,7 @@ main (int argc, char **argv)
+++ src/pstree.c 2008-10-09 16:24:23.000000000 +0200
@@ -912,7 +912,7 @@ main (int argc, char **argv)
} else if (isatty (1) && (termname = getenv ("TERM")) && \
(strlen (termname) > 0) && \
(setupterm (NULL, 1 /* stdout */, NULL) == OK) && \

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d4a3f58fe7a968634741376469129ec935c692d07ab2468d2d875c6eb096ccbe
size 229476

View File

@ -1,6 +1,6 @@
--- src/fuser.c
+++ src/fuser.c 2009-03-27 16:02:11.032550210 +0100
@@ -218,6 +218,9 @@ static void scan_procs(const opt_type op
+++ src/fuser.c 2009-05-11 13:55:56.314402075 +0200
@@ -225,6 +225,9 @@ static void scan_procs(const opt_type op
if (islocatedon(&cwd_real[0], ino_tmp->name->filename))
add_matched_proc(ino_tmp->name, pid, uid, ACCESS_CWD);
}
@ -8,9 +8,9 @@
+ if (cwd_stat) free(cwd_stat);
+ if (exe_stat) free(exe_stat);
#ifndef __linux__
check_dir(pid, "lib", dev_head, ino_head, uid, ACCESS_MMAP);
check_dir(pid, "mmap", dev_head, ino_head, uid, ACCESS_MMAP);
@@ -232,10 +235,9 @@ static void add_inode(struct inode_list
check_dir(pid, "lib", dev_head, ino_head, uid, ACCESS_MMAP, sockets, netdev);
check_dir(pid, "mmap", dev_head, ino_head, uid, ACCESS_MMAP, sockets, netdev);
@@ -239,10 +242,9 @@ static void add_inode(struct inode_list
{
struct inode_list *ino_tmp, *ino_head;
@ -23,7 +23,7 @@
ino_tmp->name = this_name;
ino_tmp->device = device;
ino_tmp->inode = inode;
@@ -243,15 +245,15 @@ static void add_inode(struct inode_list
@@ -250,15 +252,15 @@ static void add_inode(struct inode_list
*ino_list = ino_tmp;
}
@ -42,7 +42,7 @@
dev_tmp->name = this_name;
dev_tmp->device = device;
dev_tmp->next = dev_head;
@@ -262,16 +264,14 @@ static void add_ip_conn(struct ip_connec
@@ -269,16 +271,14 @@ static void add_ip_conn(struct ip_connec
{
struct ip_connections *ip_tmp, *ip_head;
@ -60,7 +60,7 @@
*ip_list = ip_tmp;
}
@@ -280,10 +280,9 @@ static void add_ip6_conn(struct ip6_conn
@@ -287,10 +287,9 @@ static void add_ip6_conn(struct ip6_conn
{
struct ip6_connections *ip_tmp, *ip_head;
@ -72,7 +72,7 @@
ip_tmp->name = this_name;
ip_tmp->lcl_port = lcl_port;
ip_tmp->rmt_port = rmt_port;
@@ -312,7 +311,7 @@ static void add_matched_proc(struct name
@@ -319,7 +318,7 @@ static void add_matched_proc(struct name
}
}
/* Not found */
@ -81,7 +81,7 @@
fprintf(stderr,_("Cannot allocate memory for matched proc: %s\n"), strerror(errno));
return;
}
@@ -322,10 +321,13 @@ static void add_matched_proc(struct name
@@ -329,10 +328,13 @@ static void add_matched_proc(struct name
pptr->next = NULL;
/* set command name */
pptr->command = NULL;
@ -96,7 +96,7 @@
cmdlen = 0;
for (cptr = cmdname; cmdlen < MAX_CMDNAME && *cptr ; cptr++) {
if (isprint(*cptr))
@@ -339,6 +341,10 @@ static void add_matched_proc(struct name
@@ -346,6 +348,10 @@ static void add_matched_proc(struct name
name_list->matched_procs = pptr;
else
last_proc->next = pptr;
@ -107,7 +107,7 @@
}
int parse_mount(struct names *this_name, struct device_list **dev_list)
@@ -365,16 +371,16 @@ int parse_file(struct names *this_name,
@@ -372,16 +378,16 @@ int parse_file(struct names *this_name,
real[0] = '\0';
if (check4nfs(this_name->filename, real)) {
@ -131,7 +131,7 @@
this_name->filename = strdup(real);
}
@@ -1211,22 +1217,26 @@ static struct stat *get_pidstat(const op
@@ -1218,23 +1224,25 @@ static struct stat *get_pidstat(const op
char pathname[256];
struct stat *st;
@ -140,33 +140,30 @@
return NULL;
snprintf(pathname, 256, "/proc/%d/%s", pid, filename);
if (check4nfs(pathname, real)) {
- if ((opts & (OPT_MOUNTPOINT|OPT_MOUNTS)) == 0)
if ((opts & (OPT_MOUNTPOINT|OPT_MOUNTS)) == 0)
- return NULL;
+ if ((opts & (OPT_MOUNTPOINT|OPT_MOUNTS)) == 0) {
+ goto out;
+ }
}
- if (stat(pathname, st) != 0)
if (stat(pathname, st) != 0)
- return NULL;
- else
- return st;
+ if (stat(pathname, st) != 0) {
+ goto out;
+ }
+ return st;
+out:
+ free(st);
+ return NULL;
}
static void check_dir(const pid_t pid, const char *dirname, struct device_list *dev_head, struct inode_list *ino_head, const uid_t uid, const char access)
static void check_dir(const pid_t pid, const char *dirname, struct device_list *dev_head, struct inode_list *ino_head, const uid_t uid, const char access,
struct unixsocket_list *sockets, dev_t netdev)
{
- char *dirpath, *filepath;
+ char *dirpath = NULL, *filepath = NULL;
DIR *dirp;
struct dirent *direntry;
struct inode_list *ino_tmp;
@@ -1234,13 +1244,13 @@ static void check_dir(const pid_t pid, c
@@ -1243,13 +1251,13 @@ static void check_dir(const pid_t pid, c
struct stat st, lst;
if ( (dirpath = malloc(MAX_PATHNAME)) == NULL)
@ -183,7 +180,7 @@
while ( (direntry = readdir(dirp)) != NULL) {
if (direntry->d_name[0] < '0' || direntry->d_name[0] > '9')
continue;
@@ -1274,8 +1284,11 @@ static void check_dir(const pid_t pid, c
@@ -1293,8 +1301,11 @@ static void check_dir(const pid_t pid, c
}
} /* while fd_dent */
closedir(dirp);
@ -197,7 +194,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)
@@ -1330,7 +1343,7 @@ void add_mount_device(struct mountdev_li
@@ -1349,7 +1360,7 @@ void add_mount_device(struct mountdev_li
struct mountdev_list *newmount;
/*printf("Adding mount Path: %s Dir:%s dev:%0x\n",dir, fsname, device);*/
@ -206,7 +203,7 @@
return;
newmount->fsname = strdup(fsname);
newmount->dir = strdup(dir);
@@ -1375,14 +1388,17 @@ void fill_unix_cache(struct unixsocket_l
@@ -1394,14 +1405,17 @@ void fill_unix_cache(struct unixsocket_l
free(path);
continue;
}

View File

@ -33,7 +33,7 @@
cannot report on any processes that it doesn't have permission to look at
the file descriptor table for. The most common time this problem occurs
--- src/fuser.c
+++ src/fuser.c 2009-03-27 14:06:48.860001275 +0100
+++ src/fuser.c 2009-05-11 13:45:16.565902120 +0200
@@ -32,9 +32,11 @@
#include <stdlib.h>
#include <string.h>
@ -54,21 +54,21 @@
#include "fuser.h"
#include "signals.h"
@@ -62,7 +65,7 @@
static void add_matched_proc(struct names *name_list, const pid_t pid, const uid_t uid, const char access);
static void check_dir(const pid_t pid, const char *dirname, struct device_list *dev_head, struct inode_list *ino_head, const uid_t uid, const char access);
@@ -63,7 +66,7 @@ static void add_matched_proc(struct name
static void check_dir(const pid_t pid, const char *dirname, struct device_list *dev_head, struct inode_list *ino_head, const uid_t uid, const char access,
struct unixsocket_list *sockets, dev_t netdev);
static void check_map(const pid_t pid, const char *filename, struct device_list *dev_head, struct inode_list *ino_head, const uid_t uid, const char access);
-static struct stat *get_pidstat(const pid_t pid, const char *filename);
+static struct stat *get_pidstat(const opt_type opts, const pid_t pid, const char *filename, char *real);
static uid_t getpiduid(const pid_t pid);
static int print_matches(struct names *names_head, const opt_type opts, const int sig_number);
static void kill_matched_proc(struct procs *pptr, const opt_type opts, const int sig_number);
@@ -72,13 +75,19 @@ static void add_device(struct device_lis
@@ -73,13 +76,20 @@ static void add_device(struct device_lis
void scan_mount_devices(const opt_type opts, struct mountdev_list **mount_devices);
void fill_unix_cache(struct unixsocket_list **unixsocket_head);
static dev_t find_net_dev(void);
-static void scan_procs(struct names *names_head, struct inode_list *ino_head, struct device_list *dev_head);
+static void scan_procs(const opt_type opts, struct names *names_head, struct inode_list *ino_head, struct device_list *dev_head);
-static void scan_procs(struct names *names_head, struct inode_list *ino_head, struct device_list *dev_head, struct unixsocket_list *sockets, dev_t netdev);
+static void scan_procs(const opt_type opts, struct names *names_head, struct inode_list *ino_head, struct device_list *dev_head, struct unixsocket_list *sockets, dev_t netdev);
#ifdef NFS_CHECKS
static void scan_knfsd(struct names *names_head, struct device_list *dev_head);
#endif /* NFS_CHECKS */
@ -81,14 +81,15 @@
+
+typedef int (*stat_t)(const char*, struct stat*);
+static int nfssafe(stat_t func, const char *path, struct stat *buf);
+
static void usage (const char *errormsg)
{
@@ -127,7 +136,14 @@ void print_version()
@@ -127,7 +137,14 @@ void print_version()
"For more information about these matters, see the files named COPYING.\n"));
}
-static void scan_procs(struct names *names_head, struct inode_list *ino_head, struct device_list *dev_head)
-static void scan_procs(struct names *names_head, struct inode_list *ino_head, struct device_list *dev_head, struct unixsocket_list *sockets, dev_t netdev)
+static int islocatedon(const char * path, const char * loc)
+{
+ if (!path || *path == '\0')
@ -96,11 +97,11 @@
+ return (strstr(path, loc) == path);
+}
+
+static void scan_procs(const opt_type opts, struct names *names_head, struct inode_list *ino_head, struct device_list *dev_head)
+static void scan_procs(const opt_type opts, struct names *names_head, struct inode_list *ino_head, struct device_list *dev_head, struct unixsocket_list *sockets, dev_t netdev)
{
DIR *topproc_dir;
struct dirent *topproc_dent;
@@ -137,6 +153,9 @@ static void scan_procs(struct names *nam
@@ -137,6 +154,9 @@ static void scan_procs(struct names *nam
pid_t pid, my_pid;
uid_t uid;
struct stat *cwd_stat, *exe_stat, *root_stat;
@ -110,7 +111,7 @@
if ( (fd_dirpath = malloc(MAX_PATHNAME)) == NULL)
return;
@@ -157,9 +176,10 @@ static void scan_procs(struct names *nam
@@ -157,9 +177,10 @@ static void scan_procs(struct names *nam
continue;
uid = getpiduid(pid);
@ -124,7 +125,7 @@
/* Scan the devices */
for (dev_tmp = dev_head ; dev_tmp != NULL ; dev_tmp = dev_tmp->next) {
if (exe_stat != NULL && exe_stat->st_dev == dev_tmp->device)
@@ -168,6 +188,14 @@ static void scan_procs(struct names *nam
@@ -168,6 +189,14 @@ static void scan_procs(struct names *nam
add_matched_proc(dev_tmp->name, pid, uid, ACCESS_ROOT);
if (cwd_stat != NULL && cwd_stat->st_dev == dev_tmp->device)
add_matched_proc(dev_tmp->name, pid, uid, ACCESS_CWD);
@ -139,7 +140,7 @@
}
for (ino_tmp = ino_head ; ino_tmp != NULL ; ino_tmp = ino_tmp->next) {
if (exe_stat != NULL) {
@@ -186,9 +214,19 @@ static void scan_procs(struct names *nam
@@ -186,9 +215,19 @@ static void scan_procs(struct names *nam
add_matched_proc(ino_tmp->name, pid, uid, ACCESS_CWD);
}
}
@ -153,13 +154,13 @@
+ add_matched_proc(ino_tmp->name, pid, uid, ACCESS_CWD);
}
+#ifndef __linux__
check_dir(pid, "lib", dev_head, ino_head, uid, ACCESS_MMAP);
check_dir(pid, "mmap", dev_head, ino_head, uid, ACCESS_MMAP);
check_dir(pid, "lib", dev_head, ino_head, uid, ACCESS_MMAP, sockets, netdev);
check_dir(pid, "mmap", dev_head, ino_head, uid, ACCESS_MMAP, sockets, netdev);
+#endif
check_dir(pid, "fd", dev_head, ino_head, uid, ACCESS_FILE);
check_dir(pid, "fd", dev_head, ino_head, uid, ACCESS_FILE, sockets, netdev);
check_map(pid, "maps", dev_head, ino_head, uid, ACCESS_MMAP);
@@ -325,10 +363,26 @@ int parse_mount(struct names *this_name,
@@ -325,10 +364,26 @@ int parse_mount(struct names *this_name,
return 0;
}
@ -187,7 +188,7 @@
if (stat(this_name->filename, &st) != 0) {
fprintf(stderr,_("Cannot stat %s: %s\n"), this_name->filename,
strerror(errno));
@@ -342,34 +396,44 @@ int parse_file(struct names *this_name,
@@ -342,34 +397,44 @@ int parse_file(struct names *this_name,
return 0;
}
@ -239,7 +240,7 @@
if (stat(this_name->filename, &st) != 0) {
fprintf(stderr,_("Cannot stat %s: %s\n"), this_name->filename,
@@ -388,6 +452,16 @@ int parse_mounts(struct names *this_name
@@ -388,6 +453,16 @@ int parse_mounts(struct names *this_name
}
}
return 0;
@ -256,7 +257,7 @@
}
#ifdef WITH_IPV6
@@ -652,6 +726,150 @@ void find_net6_sockets(struct inode_list
@@ -652,6 +727,150 @@ void find_net6_sockets(struct inode_list
}
#endif
@ -407,7 +408,7 @@
int main(int argc, char *argv[])
{
opt_type opts;
@@ -676,6 +894,7 @@ int main(int argc, char *argv[])
@@ -676,6 +895,7 @@ int main(int argc, char *argv[])
int optc;
char *option;
char *nsptr;
@ -415,7 +416,7 @@
#ifdef WITH_IPV6
ipv4_only = ipv6_only = 0;
@@ -692,7 +911,6 @@ int main(int argc, char *argv[])
@@ -692,7 +912,6 @@ int main(int argc, char *argv[])
#endif
netdev = find_net_dev();
@ -423,7 +424,7 @@
fill_unix_cache(&unixsockets);
/* getopt doesnt like things like -SIGBLAH */
@@ -782,6 +1000,10 @@ int main(int argc, char *argv[])
@@ -782,6 +1001,10 @@ int main(int argc, char *argv[])
}
continue;
}
@ -434,7 +435,7 @@
/* File specifications */
if ( (this_name = malloc(sizeof(struct names))) == NULL)
continue;
@@ -828,10 +1050,14 @@ int main(int argc, char *argv[])
@@ -828,10 +1051,14 @@ int main(int argc, char *argv[])
break;
default: /* FILE */
this_name->filename = strdup(argv[optc]);
@ -452,31 +453,12 @@
break;
}
@@ -857,25 +1083,26 @@ int main(int argc, char *argv[])
if (!ipv4_only) {
#endif
if (tcp_connection_list != NULL)
- find_net_sockets(&match_inodes, tcp_connection_list, "tcp",netdev);
+ find_net_sockets(&match_inodes, tcp_connection_list, "tcp", netdev);
if (udp_connection_list != NULL)
- find_net_sockets(&match_inodes, udp_connection_list, "udp",netdev);
+ find_net_sockets(&match_inodes, udp_connection_list, "udp", netdev);
#ifdef WITH_IPV6
}
if (!ipv6_only) {
if (tcp6_connection_list != NULL)
- find_net6_sockets(&match_inodes, tcp6_connection_list, "tcp",netdev);
+ find_net6_sockets(&match_inodes, tcp6_connection_list, "tcp", netdev);
if (udp6_connection_list != NULL)
- find_net6_sockets(&match_inodes, udp6_connection_list, "udp",netdev);
+ find_net6_sockets(&match_inodes, udp6_connection_list, "udp", netdev);
}
#endif
@@ -872,10 +1099,11 @@ int main(int argc, char *argv[])
#ifdef DEBUG
debug_match_lists(names_head, match_inodes, match_devices);
#endif
- scan_procs(names_head, match_inodes, match_devices);
+ scan_procs(opts, names_head, match_inodes, match_devices);
- scan_procs(names_head, match_inodes, match_devices, unixsockets, netdev);
+ scan_procs(opts, names_head, match_inodes, match_devices, unixsockets, netdev);
#ifdef NFS_CHECKS
scan_knfsd(names_head, match_devices);
#endif /* NFS_CHECKS */
@ -484,7 +466,7 @@
return print_matches(names_head,opts, sig_number);
}
@@ -978,7 +1205,7 @@ static int print_matches(struct names *n
@@ -978,7 +1206,7 @@ static int print_matches(struct names *n
}
@ -493,7 +475,7 @@
{
char pathname[256];
struct stat *st;
@@ -986,6 +1213,10 @@ static struct stat *get_pidstat(const pi
@@ -986,6 +1214,10 @@ static struct stat *get_pidstat(const pi
if ( (st = malloc(sizeof(struct stat))) == NULL)
return NULL;
snprintf(pathname, 256, "/proc/%d/%s", pid, filename);
@ -504,23 +486,16 @@
if (stat(pathname, st) != 0)
return NULL;
else
@@ -1012,13 +1243,14 @@ static void check_dir(const pid_t pid, c
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",
pid, dirname, direntry->d_name);
if (stat(filepath, &st) != 0) {
fprintf(stderr, _("Cannot stat file %s: %s\n"),filepath, strerror(errno));
} else {
@@ -1030,6 +1262,8 @@ static void check_dir(const pid_t pid, c
}
}
for (dev_tmp = dev_head ; dev_tmp != NULL ; dev_tmp = dev_tmp->next) {
+ if (dev_tmp->name->name_space & NAMESPACE_NFS)
+ continue;
if (st.st_dev == dev_tmp->device) {
if (access == ACCESS_FILE && (lstat(filepath, &lst)==0) && (lst.st_mode & S_IWUSR)) {
add_matched_proc(dev_tmp->name, pid,uid, ACCESS_FILEWR|access);
@@ -1028,6 +1260,8 @@ static void check_dir(const pid_t pid, c
@@ -1039,6 +1273,8 @@ static void check_dir(const pid_t pid, c
}
}
for (ino_tmp = ino_head ; ino_tmp != NULL ; ino_tmp = ino_tmp->next) {
@ -529,7 +504,7 @@
if (st.st_dev == ino_tmp->device && st.st_ino == ino_tmp->inode) {
if (access == ACCESS_FILE && (lstat(filepath, &lst)==0) && (lst.st_mode & S_IWUSR)) {
add_matched_proc(ino_tmp->name, pid,uid, ACCESS_FILEWR|access);
@@ -1039,6 +1273,8 @@ static void check_dir(const pid_t pid, c
@@ -1050,6 +1286,8 @@ static void check_dir(const pid_t pid, c
}
} /* while fd_dent */
closedir(dirp);
@ -538,7 +513,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)
@@ -1059,12 +1295,18 @@ static void check_map(const pid_t pid, c
@@ -1070,12 +1308,18 @@ static void check_map(const pid_t pid, c
if (sscanf(line, "%*s %*s %*s %x:%x %lld",
&tmp_maj, &tmp_min, &tmp_inode) == 3) {
tmp_device = tmp_maj * 256 + tmp_min;
@ -559,7 +534,7 @@
}
}
fclose(fp);
@@ -1135,6 +1377,16 @@ void fill_unix_cache(struct unixsocket_l
@@ -1146,6 +1390,16 @@ void fill_unix_cache(struct unixsocket_l
}
@ -576,7 +551,7 @@
/*
* scan_mount_devices : Create a list of mount points and devices
* This list is used later for matching purposes
@@ -1144,17 +1396,94 @@ void scan_mount_devices(const opt_type o
@@ -1155,17 +1409,94 @@ void scan_mount_devices(const opt_type o
FILE *mntfp;
struct mntent *mnt_ptr;
struct stat st;
@ -673,7 +648,7 @@
}
#ifdef DEBUG
@@ -1280,3 +1609,56 @@ static void scan_knfsd(struct names *nam
@@ -1291,3 +1622,56 @@ static void scan_knfsd(struct names *nam
}
}
#endif /* NFSCHECKS */
@ -731,7 +706,7 @@
+ return -1;
+}
--- src/fuser.h
+++ src/fuser.h 2009-03-27 13:23:36.136000974 +0100
+++ src/fuser.h 2009-03-27 13:23:36.000000000 +0100
@@ -80,9 +80,33 @@ struct unixsocket_list {
struct unixsocket_list *next;
};

69
psmisc-22.7-pstree.patch Normal file
View File

@ -0,0 +1,69 @@
--- src/pstree.c
+++ src/pstree.c 2009-05-11 13:32:34.749902293 +0200
@@ -60,6 +60,7 @@ extern const char *__progname;
#define UTF_HD "\342\224\254" /* U+252C, Horizontal and down */
#define VT_BEG "\033(0\017" /* use graphic chars */
+#define VT_LEN 4
#define VT_END "\033(B" /* back to normal char set */
#define VT_V "x" /* see UTF definitions above */
#define VT_VR "t"
@@ -220,6 +221,27 @@ out_string (const char *str)
out_char (*str++);
}
+/*
+ * Only affects vt100 line drawing mode: Do not count the strlen of
+ * VT_BEG to prevent doing end-of-line way too early:
+ */
+static void
+out_sym (const char *str)
+{
+ int seq = 0;
+ if (sym == &sym_vt100 && *str == '\033') {
+ seq = 1;
+ if (cur_x <= output_width || !trunc)
+ cur_x -= VT_LEN;
+ }
+ out_string(str);
+ if (seq) {
+ str = VT_END;
+ while (*str)
+ putchar (*str++);
+ }
+}
+
static int
out_int (int x) /* non-negative integers only */
@@ -431,7 +453,11 @@ dump_tree (PROC * current, int level, in
{
for (i = width[lvl] + 1; i; i--)
out_char (' ');
- out_string (lvl == level - 1 ? last ? sym->last_2 : sym->branch_2 :
+ /*
+ * Replace all three symbol-drawing calls with calls to out_sym()
+ * to handle VT100 line drawing sequences if VT100 mode is active:
+ */
+ out_sym (lvl == level - 1 ? last ? sym->last_2 : sym->branch_2 :
more[lvl + 1] ? sym->vert_2 : sym->empty_2);
}
if (rep < 2)
@@ -543,7 +569,7 @@ dump_tree (PROC * current, int level, in
width[level] = comm_len + cur_x - offset + add;
if (cur_x >= output_width && trunc)
{
- out_string (sym->first_3);
+ out_sym (sym->first_3);
out_string ("+");
out_newline ();
}
@@ -570,7 +596,7 @@ dump_tree (PROC * current, int level, in
}
if (first)
{
- out_string (next ? sym->first_3 : sym->single_3);
+ out_sym (next ? sym->first_3 : sym->single_3);
first = 0;
}
dump_tree (walk->child, level + 1, count + 1,

View File

@ -1,13 +1,13 @@
--- doc/fuser.1
+++ doc/fuser.1 2008-08-07 14:51:18.000000000 +0200
@@ -10,6 +10,7 @@ fuser \- identify processes using files
+++ doc/fuser.1 2009-05-11 13:49:21.894401999 +0200
@@ -11,6 +11,7 @@ fuser \- identify processes using files
.IR space\ ]
.RB [ \-k
.RB [ \-i ]
+.RB [ \-w ]
.RB [ \- \fIsignal
.RB [ \- \fISIGNAL
] ]
.RB [ \-muvf ]
.IR name " ..."
@@ -74,6 +75,9 @@ other \fBfuser\fP processes. The effecti
.IP \fB\-i\fP
Ask the user for confirmation before killing a process. This option is
@ -19,8 +19,8 @@
List all known signal names.
.IP \fB\-m\fP
--- src/fuser.c
+++ src/fuser.c 2008-08-07 15:49:28.714368021 +0200
@@ -66,7 +66,7 @@ static void check_map(const pid_t pid, c
+++ src/fuser.c 2009-05-11 13:50:26.796428307 +0200
@@ -69,7 +69,7 @@ static void check_map(const pid_t pid, c
static struct stat *get_pidstat(const opt_type opts, const pid_t pid, const char *filename, char *real);
static uid_t getpiduid(const pid_t pid);
static int print_matches(struct names *names_head, const opt_type opts, const int sig_number);
@ -29,16 +29,16 @@
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);
@@ -89,7 +89,7 @@ static void usage (const char *errormsg)
@@ -97,7 +97,7 @@ static void usage (const char *errormsg)
fprintf(stderr, "%s\n", errormsg);
fprintf (stderr, _(
- "Usage: fuser [ -a | -s | -c ] [ -n SPACE ] [ -SIGNAL ] [ -kimuv ] NAME...\n"
+ "Usage: fuser [ -a | -s | -c ] [ -n SPACE ] [ -SIGNAL ] [ -kimuvw ] NAME...\n"
" [ - ] [ -n SPACE ] [ -SIGNAL ] [ -kimuv ] NAME...\n"
- "Usage: fuser [ -fuv ] [ -a | -s ] [ -4 | -6 ] [ -c | -m | -n SPACE ] [ -k [ -i ] [ -SIGNAL ]] NAME...\n"
+ "Usage: fuser [ -fuv ] [ -a | -s ] [ -4 | -6 ] [ -c | -m | -n SPACE ] [ -k [ -i ] [ -w ] [ -SIGNAL ]] NAME...\n"
" fuser -l\n"
" fuser -V\n"
@@ -106,6 +106,7 @@ static void usage (const char *errormsg)
"Show which processes use the named files, sockets, or filesystems.\n\n"
@@ -113,6 +113,7 @@ static void usage (const char *errormsg)
" -SIGNAL send this signal instead of SIGKILL\n"
" -u display user IDs\n"
" -v verbose output\n"
@ -46,7 +46,7 @@
" -V display version information\n"));
#ifdef WITH_IPV6
fprintf (stderr, _(
@@ -901,6 +902,9 @@ int main(int argc, char *argv[])
@@ -982,6 +983,9 @@ int main(int argc, char *argv[])
case 'v':
opts |= OPT_VERBOSE;
break;
@ -56,7 +56,7 @@
case 'V':
print_version();
return 0;
@@ -1033,6 +1037,7 @@ static int print_matches(struct names *n
@@ -1119,6 +1123,7 @@ static int print_matches(struct names *n
int len = 0;
struct passwd *pwent = NULL;
int have_match = 0;
@ -64,7 +64,7 @@
for (nptr = names_head; nptr != NULL ; nptr = nptr->next) {
if (opts & OPT_SILENT) {
@@ -1103,21 +1108,23 @@ static int print_matches(struct names *n
@@ -1189,21 +1194,23 @@ static int print_matches(struct names *n
len = 0;
first = 0;
}
@ -99,7 +99,7 @@
}
static struct stat *get_pidstat(const opt_type opts, const pid_t pid, const char *filename, char *real)
@@ -1403,21 +1410,26 @@ static int ask(const pid_t pid)
@@ -1562,21 +1569,26 @@ static int ask(const pid_t pid)
} /* while */
}

View File

@ -1,10 +1,10 @@
--- configure.ac
+++ configure.ac 2007-12-14 15:01:53.293387939 +0100
+++ configure.ac 2009-05-11 13:59:05.145901759 +0200
@@ -1,10 +1,10 @@
dnl Process this file with autoconf to produce a configure script.
-AC_PREREQ(2.61)
+AC_PREREQ(2.60)
AC_INIT([psmisc],[22.6])
AC_INIT([psmisc],[22.7])
AC_CONFIG_SRCDIR([src/comm.h])
AC_CONFIG_HEADER([config.h])
AC_CONFIG_AUX_DIR([config])
@ -33,8 +33,8 @@
dnl Checks for library functions.
AC_FUNC_CLOSEDIR_VOID
--- src/fuser.c
+++ src/fuser.c 2008-10-01 18:02:08.469114183 +0200
@@ -147,7 +147,6 @@ static void scan_procs(const opt_type op
+++ src/fuser.c 2008-10-01 18:02:08.000000000 +0200
@@ -149,7 +149,6 @@ static void scan_procs(const opt_type op
{
DIR *topproc_dir;
struct dirent *topproc_dent;
@ -42,7 +42,7 @@
struct inode_list *ino_tmp;
struct device_list *dev_tmp;
pid_t pid, my_pid;
@@ -157,11 +156,6 @@ static void scan_procs(const opt_type op
@@ -159,11 +158,6 @@ static void scan_procs(const opt_type op
char cwd_real[PATH_MAX+1];
char exe_real[PATH_MAX+1];

3
psmisc-22.7.tar.bz2 Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2b9581bb21ec92d70653240069d4c1dd088c6a7f381dfc6d6590175d8988e823
size 249141

View File

@ -1,3 +1,30 @@
-------------------------------------------------------------------
Mon May 11 14:04:09 CEST 2009 - werner@suse.de
- Update to psmisc-22.7
* Updated Polish, Russian, Swedish and Indonesian PO files
* Changed fuser.1 so signal is SIGNAL to reduce confusion about wether
or not it is a parameter Debian #517413
* fuser.1 references pkill(1) Debian #517414
* Added Chinese (traditional) PO file
* Updated Russian PO file
* Clarified -m and -c for fuser Debian #467289
* Patch from Arnaud Giersch to fix udp ports in fuser Debian #502208
* pstree man page mentions -Z may not be available Debian #478327
* pstree handles UTF-8 lengths much better Debian #413503
* killall says no process found when process not found Debian #500097
* pstree makes a bigger buffer for -al flags Debian #352603
* Dynamically reallocate buffer for fuser patch from Don Armstrong
* Updated Indonesian PO file
* peekfd off by one problem in fds Debian #460530
* Patch from Marcus Watts for better comm handling in pstree
* Updated Hungarian po file
* Updated French and German po files
* Fuser -m detects more open sockets SF patch #1728412 Thnks marienz
* Updated Italian, Chinese simplified, Dutch, Swedish and Polish po files
* Removed old fuser
- Adapt our patches
-------------------------------------------------------------------
Fri Mar 27 16:56:24 CET 2009 - werner@suse.de

View File

@ -1,5 +1,5 @@
#
# spec file for package psmisc (Version 22.6)
# spec file for package psmisc (Version 22.7)
#
# Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
@ -26,19 +26,19 @@ License: GPL v2 or later
Group: System/Monitoring
PreReq: %fillup_prereq %insserv_prereq
AutoReqProv: on
Version: 22.6
Release: 64
Version: 22.7
Release: 1
Provides: ps:/usr/bin/killall
Summary: Utilities for managing processes on your system
Source: http://switch.dl.sourceforge.net/sourceforge/psmisc/psmisc-%{version}.tar.bz2
Patch0: %name-%version.dif
Patch1: %name-22.5-pstree.patch
Patch2: %name-22.6-nfs4fuser.patch
Patch0: %name-22.7.dif
Patch1: %name-22.7-pstree.patch
Patch2: %name-22.7-nfs4fuser.patch
Patch3: %name-22.6-netunix.patch
Patch4: %name-22.6-writeonly.patch
Patch4: %name-22.7-writeonly.patch
Patch5: %name-22.6-fdleak.patch
Patch6: %name-22.6-tigetstr.patch
Patch7: %name-22.6-memleaks.patch
Patch7: %name-22.7-memleaks.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%define nopeek s390 s390x ia64
@ -107,6 +107,30 @@ rm -rf $RPM_BUILD_ROOT
%{_mandir}/man1/pstree.1*
%changelog
* Mon May 11 2009 werner@suse.de
- Update to psmisc-22.7
* Updated Polish, Russian, Swedish and Indonesian PO files
* Changed fuser.1 so signal is SIGNAL to reduce confusion about wether
or not it is a parameter Debian #517413
* fuser.1 references pkill(1) Debian #517414
* Added Chinese (traditional) PO file
* Updated Russian PO file
* Clarified -m and -c for fuser Debian #467289
* Patch from Arnaud Giersch to fix udp ports in fuser Debian #502208
* pstree man page mentions -Z may not be available Debian #478327
* pstree handles UTF-8 lengths much better Debian #413503
* killall says no process found when process not found Debian #500097
* pstree makes a bigger buffer for -al flags Debian #352603
* Dynamically reallocate buffer for fuser patch from Don Armstrong
* Updated Indonesian PO file
* peekfd off by one problem in fds Debian #460530
* Patch from Marcus Watts for better comm handling in pstree
* Updated Hungarian po file
* Updated French and German po files
* Fuser -m detects more open sockets SF patch #1728412 Thnks marienz
* Updated Italian, Chinese simplified, Dutch, Swedish and Polish po files
* Removed old fuser
- Adapt our patches
* Fri Mar 27 2009 werner@suse.de
- nfs4fuser: do not match on shadow mounts
- resolve some memory leaks in fuser