aboutsummaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2002-12-05 07:24:08 +0000
committerEric Andersen <andersen@codepoet.org>2002-12-05 07:24:08 +0000
commitdeca106b6dad70ad0a1312a82d762aa8d8ad52ba (patch)
treef11db23c430298ac9da2f3de80ec6c86cc75be70 /libbb
parent6f9b45b9eff22c664b93ace82d20669340a762f8 (diff)
downloadbusybox-w32-deca106b6dad70ad0a1312a82d762aa8d8ad52ba.tar.gz
busybox-w32-deca106b6dad70ad0a1312a82d762aa8d8ad52ba.tar.bz2
busybox-w32-deca106b6dad70ad0a1312a82d762aa8d8ad52ba.zip
Kill CONFIG_FEATURE_USE_DEVPS_PATCH and the devps patch. I'm not
maintaining it anymore, and it is now terribly out of date. -Erik
Diffstat (limited to 'libbb')
-rw-r--r--libbb/find_pid_by_name.c83
-rw-r--r--libbb/mtab_file.c8
-rw-r--r--libbb/procps.c3
3 files changed, 2 insertions, 92 deletions
diff --git a/libbb/find_pid_by_name.c b/libbb/find_pid_by_name.c
index a648137e1..b9c06d724 100644
--- a/libbb/find_pid_by_name.c
+++ b/libbb/find_pid_by_name.c
@@ -27,88 +27,6 @@
27 27
28#define READ_BUF_SIZE 50 28#define READ_BUF_SIZE 50
29 29
30
31/* For Erik's nifty devps device driver */
32#ifdef CONFIG_FEATURE_USE_DEVPS_PATCH
33#include <linux/devps.h>
34
35/* find_pid_by_name()
36 *
37 * This finds the pid of the specified process,
38 * by using the /dev/ps device driver.
39 *
40 * Returns a list of all matching PIDs
41 */
42extern long* find_pid_by_name( const char* pidName)
43{
44 int fd, i, j;
45 char device[] = "/dev/ps";
46 pid_t num_pids;
47 pid_t* pid_array = NULL;
48 long* pidList=NULL;
49
50 /* open device */
51 fd = open(device, O_RDONLY);
52 if (fd < 0)
53 perror_msg_and_die("open failed for `%s'", device);
54
55 /* Find out how many processes there are */
56 if (ioctl (fd, DEVPS_GET_NUM_PIDS, &num_pids)<0)
57 perror_msg_and_die("\nDEVPS_GET_PID_LIST");
58
59 /* Allocate some memory -- grab a few extras just in case
60 * some new processes start up while we wait. The kernel will
61 * just ignore any extras if we give it too many, and will trunc.
62 * the list if we give it too few. */
63 pid_array = (pid_t*) xcalloc( num_pids+10, sizeof(pid_t));
64 pid_array[0] = num_pids+10;
65
66 /* Now grab the pid list */
67 if (ioctl (fd, DEVPS_GET_PID_LIST, pid_array)<0)
68 perror_msg_and_die("\nDEVPS_GET_PID_LIST");
69
70 /* Now search for a match */
71 for (i=1, j=0; i<pid_array[0] ; i++) {
72 char* p;
73 struct pid_info info;
74
75 info.pid = pid_array[i];
76 if (ioctl (fd, DEVPS_GET_PID_INFO, &info)<0)
77 perror_msg_and_die("\nDEVPS_GET_PID_INFO");
78
79 /* Make sure we only match on the process name */
80 p=info.command_line+1;
81 while ((*p != 0) && !isspace(*(p)) && (*(p-1) != '\\')) {
82 (p)++;
83 }
84 if (isspace(*(p)))
85 *p='\0';
86
87 if ((strstr(info.command_line, pidName) != NULL)
88 && (strlen(pidName) == strlen(info.command_line))) {
89 pidList=xrealloc( pidList, sizeof(long) * (j+2));
90 pidList[j++]=info.pid;
91 }
92 }
93 if (pidList) {
94 pidList[j]=0;
95 } else {
96 pidList=xrealloc( pidList, sizeof(long));
97 pidList[0]=-1;
98 }
99
100 /* Free memory */
101 free( pid_array);
102
103 /* close device */
104 if (close (fd) != 0)
105 perror_msg_and_die("close failed for `%s'", device);
106
107 return pidList;
108}
109
110#else /* CONFIG_FEATURE_USE_DEVPS_PATCH */
111
112/* find_pid_by_name() 30/* find_pid_by_name()
113 * 31 *
114 * Modified by Vladimir Oleynik for use with libbb/procps.c 32 * Modified by Vladimir Oleynik for use with libbb/procps.c
@@ -135,7 +53,6 @@ extern long* find_pid_by_name( const char* pidName)
135 pidList[i] = i==0 ? -1 : 0; 53 pidList[i] = i==0 ? -1 : 0;
136 return pidList; 54 return pidList;
137} 55}
138#endif /* CONFIG_FEATURE_USE_DEVPS_PATCH */
139 56
140/* END CODE */ 57/* END CODE */
141/* 58/*
diff --git a/libbb/mtab_file.c b/libbb/mtab_file.c
index 267a13720..3d5729026 100644
--- a/libbb/mtab_file.c
+++ b/libbb/mtab_file.c
@@ -23,16 +23,12 @@
23#include "libbb.h" 23#include "libbb.h"
24 24
25 25
26/* Busybox mount uses either /proc/mounts or /dev/mtab to 26/* Busybox mount uses either /proc/mounts or /etc/mtab to
27 * get the list of currently mounted filesystems */ 27 * get the list of currently mounted filesystems */
28#if defined CONFIG_FEATURE_MTAB_SUPPORT 28#if defined CONFIG_FEATURE_MTAB_SUPPORT
29const char mtab_file[] = "/etc/mtab"; 29const char mtab_file[] = "/etc/mtab";
30#else 30#else
31# if defined CONFIG_FEATURE_USE_DEVPS_PATCH 31const char mtab_file[] = "/proc/mounts";
32 const char mtab_file[] = "/dev/mtab";
33# else
34 const char mtab_file[] = "/proc/mounts";
35# endif
36#endif 32#endif
37 33
38 34
diff --git a/libbb/procps.c b/libbb/procps.c
index 2d2a9665f..fcc9c2d3a 100644
--- a/libbb/procps.c
+++ b/libbb/procps.c
@@ -8,7 +8,6 @@
8 * 8 *
9 */ 9 */
10 10
11#if ! defined CONFIG_FEATURE_USE_DEVPS_PATCH
12#include <dirent.h> 11#include <dirent.h>
13#include <string.h> 12#include <string.h>
14#include <stdlib.h> 13#include <stdlib.h>
@@ -131,8 +130,6 @@ extern procps_status_t * procps_scan(int save_user_arg0)
131 } 130 }
132} 131}
133 132
134#endif /* CONFIG_FEATURE_USE_DEVPS_PATCH. Else this file is empty */
135
136/* END CODE */ 133/* END CODE */
137/* 134/*
138Local Variables: 135Local Variables: