diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2010-09-23 10:03:17 +1000 |
---|---|---|
committer | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2010-09-23 10:03:17 +1000 |
commit | f4f8fa6f4a41df8f9e41ad562bbff7d18032de07 (patch) | |
tree | 3fc22c27e6bd593785a6e4b32df6ec1b727b616e | |
parent | 5c4eb803c62b9199eeab3bd2c72bd931eab10960 (diff) | |
parent | d97eff825f421d201538754e16d0a1d2db9d35e5 (diff) | |
download | busybox-w32-f4f8fa6f4a41df8f9e41ad562bbff7d18032de07.tar.gz busybox-w32-f4f8fa6f4a41df8f9e41ad562bbff7d18032de07.tar.bz2 busybox-w32-f4f8fa6f4a41df8f9e41ad562bbff7d18032de07.zip |
Merge commit 'master~11^2' into ash
-rw-r--r-- | BUGS | 15 | ||||
-rw-r--r-- | coreutils/date.c | 13 | ||||
-rw-r--r-- | coreutils/whoami.c | 10 | ||||
-rw-r--r-- | include/libbb.h | 3 | ||||
-rw-r--r-- | include/mingw.h | 6 | ||||
-rw-r--r-- | libbb/appletlib.c | 10 | ||||
-rw-r--r-- | libbb/find_pid_by_name.c | 4 | ||||
-rw-r--r-- | libbb/procps.c | 3 | ||||
-rw-r--r-- | procps/kill.c | 2 | ||||
-rw-r--r-- | procps/ps.c | 10 | ||||
-rw-r--r-- | scripts/defconfig.mingw32 | 42 | ||||
-rw-r--r-- | win32/process.c | 50 |
12 files changed, 143 insertions, 25 deletions
@@ -0,0 +1,15 @@ | |||
1 | -*- mode: org; mode: auto-fill -*- | ||
2 | |||
3 | * general | ||
4 | |||
5 | ** code page issue | ||
6 | |||
7 | * ash | ||
8 | |||
9 | ** ^C, ^D do not work | ||
10 | |||
11 | ^Z can be used while ^D does not work | ||
12 | |||
13 | ** $HOME not set | ||
14 | |||
15 | $HOMEPATH should probably be used | ||
diff --git a/coreutils/date.c b/coreutils/date.c index c9dfedf81..881dcc429 100644 --- a/coreutils/date.c +++ b/coreutils/date.c | |||
@@ -242,9 +242,14 @@ int date_main(int argc UNUSED_PARAM, char **argv) | |||
242 | maybe_set_utc(opt); | 242 | maybe_set_utc(opt); |
243 | 243 | ||
244 | /* if setting time, set it */ | 244 | /* if setting time, set it */ |
245 | #if ENABLE_PLATFORM_MINGW32 | ||
246 | if (opt & OPT_SET) | ||
247 | bb_error_msg_and_die("Setting date is not supported"); | ||
248 | #else | ||
245 | if ((opt & OPT_SET) && stime(&ts.tv_sec) < 0) { | 249 | if ((opt & OPT_SET) && stime(&ts.tv_sec) < 0) { |
246 | bb_perror_msg("can't set date"); | 250 | bb_perror_msg("can't set date"); |
247 | } | 251 | } |
252 | #endif | ||
248 | } | 253 | } |
249 | 254 | ||
250 | /* Display output */ | 255 | /* Display output */ |
@@ -272,7 +277,11 @@ int date_main(int argc UNUSED_PARAM, char **argv) | |||
272 | i = sizeof("%a, %d %b %Y %H:%M:%S ")-1; | 277 | i = sizeof("%a, %d %b %Y %H:%M:%S ")-1; |
273 | goto format_utc; | 278 | goto format_utc; |
274 | } else { /* default case */ | 279 | } else { /* default case */ |
280 | #if ENABLE_PLATFORM_MINGW32 | ||
281 | fmt_dt2str = (char*)"%a %b %d %H:%M:%S %Z %Y"; | ||
282 | #else | ||
275 | fmt_dt2str = (char*)"%a %b %e %H:%M:%S %Z %Y"; | 283 | fmt_dt2str = (char*)"%a %b %e %H:%M:%S %Z %Y"; |
284 | #endif | ||
276 | } | 285 | } |
277 | } | 286 | } |
278 | #if ENABLE_FEATURE_DATE_NANO | 287 | #if ENABLE_FEATURE_DATE_NANO |
@@ -325,6 +334,10 @@ int date_main(int argc UNUSED_PARAM, char **argv) | |||
325 | if (strncmp(fmt_dt2str, "%f", 2) == 0) { | 334 | if (strncmp(fmt_dt2str, "%f", 2) == 0) { |
326 | fmt_dt2str = (char*)"%Y.%m.%d-%H:%M:%S"; | 335 | fmt_dt2str = (char*)"%Y.%m.%d-%H:%M:%S"; |
327 | } | 336 | } |
337 | #if ENABLE_PLATFORM_MINGW32 | ||
338 | if (strstr(fmt_dt2str, "%e")) | ||
339 | bb_error_msg_and_die("%%e is not supported by Windows strftime"); | ||
340 | #endif | ||
328 | /* Generate output string */ | 341 | /* Generate output string */ |
329 | strftime(date_buf, sizeof(date_buf), fmt_dt2str, &tm_time); | 342 | strftime(date_buf, sizeof(date_buf), fmt_dt2str, &tm_time); |
330 | } | 343 | } |
diff --git a/coreutils/whoami.c b/coreutils/whoami.c index 78d20db14..f7ac7aa6d 100644 --- a/coreutils/whoami.c +++ b/coreutils/whoami.c | |||
@@ -16,11 +16,21 @@ | |||
16 | int whoami_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | 16 | int whoami_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
17 | int whoami_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM) | 17 | int whoami_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM) |
18 | { | 18 | { |
19 | #if ENABLE_PLATFORM_MINGW32 | ||
20 | char buf[64]; | ||
21 | DWORD len = 64; | ||
22 | #endif | ||
23 | |||
19 | if (argv[1]) | 24 | if (argv[1]) |
20 | bb_show_usage(); | 25 | bb_show_usage(); |
21 | 26 | ||
27 | #if ENABLE_PLATFORM_MINGW32 | ||
28 | GetUserName(buf, &len); | ||
29 | puts(buf); | ||
30 | #else | ||
22 | /* Will complain and die if username not found */ | 31 | /* Will complain and die if username not found */ |
23 | puts(xuid2uname(geteuid())); | 32 | puts(xuid2uname(geteuid())); |
33 | #endif | ||
24 | 34 | ||
25 | return fflush_all(); | 35 | return fflush_all(); |
26 | } | 36 | } |
diff --git a/include/libbb.h b/include/libbb.h index 31e733d77..e82954fd0 100644 --- a/include/libbb.h +++ b/include/libbb.h | |||
@@ -1466,6 +1466,9 @@ typedef struct procps_status_t { | |||
1466 | #if ENABLE_FEATURE_TOP_SMP_PROCESS | 1466 | #if ENABLE_FEATURE_TOP_SMP_PROCESS |
1467 | int last_seen_on_cpu; | 1467 | int last_seen_on_cpu; |
1468 | #endif | 1468 | #endif |
1469 | #if ENABLE_PLATFORM_MINGW32 | ||
1470 | HANDLE snapshot; | ||
1471 | #endif | ||
1469 | } procps_status_t; | 1472 | } procps_status_t; |
1470 | /* flag bits for procps_scan(xx, flags) calls */ | 1473 | /* flag bits for procps_scan(xx, flags) calls */ |
1471 | enum { | 1474 | enum { |
diff --git a/include/mingw.h b/include/mingw.h index 53a0a0d67..85c97b702 100644 --- a/include/mingw.h +++ b/include/mingw.h | |||
@@ -235,6 +235,10 @@ int mingw_fstat(int fd, struct stat *buf); | |||
235 | /* | 235 | /* |
236 | * sys/time.h | 236 | * sys/time.h |
237 | */ | 237 | */ |
238 | struct timespec { | ||
239 | time_t tv_sec; | ||
240 | long int tv_nsec; | ||
241 | }; | ||
238 | struct itimerval { | 242 | struct itimerval { |
239 | struct timeval it_value, it_interval; | 243 | struct timeval it_value, it_interval; |
240 | }; | 244 | }; |
@@ -285,7 +289,7 @@ IMPL(getuid,int,1,void); | |||
285 | int fcntl(int fd, int cmd, ...); | 289 | int fcntl(int fd, int cmd, ...); |
286 | #define fork() -1 | 290 | #define fork() -1 |
287 | IMPL(fsync,int,0,int fd UNUSED_PARAM); | 291 | IMPL(fsync,int,0,int fd UNUSED_PARAM); |
288 | NOIMPL(kill,pid_t pid UNUSED_PARAM, int sig UNUSED_PARAM); | 292 | int kill(pid_t pid, int sig); |
289 | int link(const char *oldpath, const char *newpath); | 293 | int link(const char *oldpath, const char *newpath); |
290 | NOIMPL(mknod,const char *name UNUSED_PARAM, mode_t mode UNUSED_PARAM, dev_t device UNUSED_PARAM); | 294 | NOIMPL(mknod,const char *name UNUSED_PARAM, mode_t mode UNUSED_PARAM, dev_t device UNUSED_PARAM); |
291 | int mingw_open (const char *filename, int oflags, ...); | 295 | int mingw_open (const char *filename, int oflags, ...); |
diff --git a/libbb/appletlib.c b/libbb/appletlib.c index 6a304ded3..ab1d48c31 100644 --- a/libbb/appletlib.c +++ b/libbb/appletlib.c | |||
@@ -827,9 +827,13 @@ int main(int argc UNUSED_PARAM, char **argv) | |||
827 | unsetenv("BUSYBOX_APPLET_NAME"); | 827 | unsetenv("BUSYBOX_APPLET_NAME"); |
828 | } | 828 | } |
829 | else { | 829 | else { |
830 | int len = strlen(applet_name); | 830 | int i, len = strlen(applet_name); |
831 | if (len > 4 && !strcmp(applet_name+len-4, ".exe")) | 831 | if (len > 4 && !strcmp(applet_name+len-4, ".exe")) { |
832 | argv[0][applet_name-argv[0]+len-4] = '\0'; | 832 | len -= 4; |
833 | argv[0][applet_name-argv[0]+len] = '\0'; | ||
834 | } | ||
835 | for (i = 0; i < len; i++) | ||
836 | argv[0][applet_name-argv[0]+i] = tolower(applet_name[i]); | ||
833 | } | 837 | } |
834 | } | 838 | } |
835 | applet_name = bb_basename(applet_name); | 839 | applet_name = bb_basename(applet_name); |
diff --git a/libbb/find_pid_by_name.c b/libbb/find_pid_by_name.c index db823d05b..d4bea8ab5 100644 --- a/libbb/find_pid_by_name.c +++ b/libbb/find_pid_by_name.c | |||
@@ -56,6 +56,7 @@ static int comm_match(procps_status_t *p, const char *procName) | |||
56 | * This can be crazily_long_script_name.sh! | 56 | * This can be crazily_long_script_name.sh! |
57 | * The telltale sign is basename(argv[1]) == procName */ | 57 | * The telltale sign is basename(argv[1]) == procName */ |
58 | 58 | ||
59 | #if !ENABLE_PLATFORM_MINGW32 | ||
59 | if (!p->argv0) | 60 | if (!p->argv0) |
60 | return 0; | 61 | return 0; |
61 | 62 | ||
@@ -66,6 +67,7 @@ static int comm_match(procps_status_t *p, const char *procName) | |||
66 | 67 | ||
67 | if (strcmp(bb_basename(argv1), procName) != 0) | 68 | if (strcmp(bb_basename(argv1), procName) != 0) |
68 | return 0; | 69 | return 0; |
70 | #endif | ||
69 | 71 | ||
70 | return 1; | 72 | return 1; |
71 | } | 73 | } |
@@ -88,10 +90,12 @@ pid_t* FAST_FUNC find_pid_by_name(const char *procName) | |||
88 | pidList = xzalloc(sizeof(*pidList)); | 90 | pidList = xzalloc(sizeof(*pidList)); |
89 | while ((p = procps_scan(p, PSSCAN_PID|PSSCAN_COMM|PSSCAN_ARGVN|PSSCAN_EXE))) { | 91 | while ((p = procps_scan(p, PSSCAN_PID|PSSCAN_COMM|PSSCAN_ARGVN|PSSCAN_EXE))) { |
90 | if (comm_match(p, procName) | 92 | if (comm_match(p, procName) |
93 | #if !ENABLE_PLATFORM_MINGW32 | ||
91 | /* or we require argv0 to match (essential for matching reexeced /proc/self/exe)*/ | 94 | /* or we require argv0 to match (essential for matching reexeced /proc/self/exe)*/ |
92 | || (p->argv0 && strcmp(bb_basename(p->argv0), procName) == 0) | 95 | || (p->argv0 && strcmp(bb_basename(p->argv0), procName) == 0) |
93 | /* or we require /proc/PID/exe link to match */ | 96 | /* or we require /proc/PID/exe link to match */ |
94 | || (p->exe && strcmp(bb_basename(p->exe), procName) == 0) | 97 | || (p->exe && strcmp(bb_basename(p->exe), procName) == 0) |
98 | #endif | ||
95 | ) { | 99 | ) { |
96 | pidList = xrealloc_vector(pidList, 2, i); | 100 | pidList = xrealloc_vector(pidList, 2, i); |
97 | pidList[i++] = p->pid; | 101 | pidList[i++] = p->pid; |
diff --git a/libbb/procps.c b/libbb/procps.c index 14d4481bd..7ffcd8dbc 100644 --- a/libbb/procps.c +++ b/libbb/procps.c | |||
@@ -75,6 +75,7 @@ const char* FAST_FUNC get_cached_groupname(gid_t gid) | |||
75 | return get_cached(&groupname, gid, gid2group_utoa); | 75 | return get_cached(&groupname, gid, gid2group_utoa); |
76 | } | 76 | } |
77 | 77 | ||
78 | #if !ENABLE_PLATFORM_MINGW32 | ||
78 | 79 | ||
79 | #define PROCPS_BUFSIZE 1024 | 80 | #define PROCPS_BUFSIZE 1024 |
80 | 81 | ||
@@ -552,6 +553,8 @@ procps_status_t* FAST_FUNC procps_scan(procps_status_t* sp, int flags) | |||
552 | return sp; | 553 | return sp; |
553 | } | 554 | } |
554 | 555 | ||
556 | #endif /* ENABLE_PLATFORM_MINGW32 */ | ||
557 | |||
555 | void FAST_FUNC read_cmdline(char *buf, int col, unsigned pid, const char *comm) | 558 | void FAST_FUNC read_cmdline(char *buf, int col, unsigned pid, const char *comm) |
556 | { | 559 | { |
557 | int sz; | 560 | int sz; |
diff --git a/procps/kill.c b/procps/kill.c index b51d44a70..3da39f030 100644 --- a/procps/kill.c +++ b/procps/kill.c | |||
@@ -50,6 +50,7 @@ int kill_main(int argc, char **argv) | |||
50 | goto do_it_now; | 50 | goto do_it_now; |
51 | } | 51 | } |
52 | 52 | ||
53 | #if !ENABLE_PLATFORM_MINGW32 | ||
53 | /* The -l option, which prints out signal names. | 54 | /* The -l option, which prints out signal names. |
54 | * Intended usage in shell: | 55 | * Intended usage in shell: |
55 | * echo "Died of SIG`kill -l $?`" | 56 | * echo "Died of SIG`kill -l $?`" |
@@ -115,6 +116,7 @@ int kill_main(int argc, char **argv) | |||
115 | } | 116 | } |
116 | arg = *++argv; | 117 | arg = *++argv; |
117 | argc--; | 118 | argc--; |
119 | #endif /* ENABLE_PLATFORM_MINGW32 */ | ||
118 | 120 | ||
119 | do_it_now: | 121 | do_it_now: |
120 | pid = getpid(); | 122 | pid = getpid(); |
diff --git a/procps/ps.c b/procps/ps.c index 48b55a785..3f7437b38 100644 --- a/procps/ps.c +++ b/procps/ps.c | |||
@@ -25,6 +25,8 @@ enum { MAX_WIDTH = 2*1024 }; | |||
25 | #if ENABLE_SELINUX | 25 | #if ENABLE_SELINUX |
26 | #define SELINUX_O_PREFIX "label," | 26 | #define SELINUX_O_PREFIX "label," |
27 | #define DEFAULT_O_STR (SELINUX_O_PREFIX "pid,user" IF_FEATURE_PS_TIME(",time") ",args") | 27 | #define DEFAULT_O_STR (SELINUX_O_PREFIX "pid,user" IF_FEATURE_PS_TIME(",time") ",args") |
28 | #elif ENABLE_PLATFORM_MINGW32 | ||
29 | #define DEFAULT_O_STR ("pid,comm") | ||
28 | #else | 30 | #else |
29 | #define DEFAULT_O_STR ("pid,user" IF_FEATURE_PS_TIME(",time") ",args") | 31 | #define DEFAULT_O_STR ("pid,user" IF_FEATURE_PS_TIME(",time") ",args") |
30 | #endif | 32 | #endif |
@@ -301,13 +303,19 @@ static void func_pcpu(char *buf, int size, const procps_status_t *ps) | |||
301 | 303 | ||
302 | static const ps_out_t out_spec[] = { | 304 | static const ps_out_t out_spec[] = { |
303 | // Mandated by POSIX: | 305 | // Mandated by POSIX: |
306 | #if !ENABLE_PLATFORM_MINGW32 | ||
304 | { 8 , "user" ,"USER" ,func_user ,PSSCAN_UIDGID }, | 307 | { 8 , "user" ,"USER" ,func_user ,PSSCAN_UIDGID }, |
305 | { 8 , "group" ,"GROUP" ,func_group ,PSSCAN_UIDGID }, | 308 | { 8 , "group" ,"GROUP" ,func_group ,PSSCAN_UIDGID }, |
309 | #endif | ||
306 | { 16 , "comm" ,"COMMAND",func_comm ,PSSCAN_COMM }, | 310 | { 16 , "comm" ,"COMMAND",func_comm ,PSSCAN_COMM }, |
311 | #if !ENABLE_PLATFORM_MINGW32 | ||
307 | { MAX_WIDTH , "args" ,"COMMAND",func_args ,PSSCAN_COMM }, | 312 | { MAX_WIDTH , "args" ,"COMMAND",func_args ,PSSCAN_COMM }, |
313 | #endif | ||
308 | { 5 , "pid" ,"PID" ,func_pid ,PSSCAN_PID }, | 314 | { 5 , "pid" ,"PID" ,func_pid ,PSSCAN_PID }, |
315 | #if !ENABLE_PLATFORM_MINGW32 | ||
309 | { 5 , "ppid" ,"PPID" ,func_ppid ,PSSCAN_PPID }, | 316 | { 5 , "ppid" ,"PPID" ,func_ppid ,PSSCAN_PPID }, |
310 | { 5 , "pgid" ,"PGID" ,func_pgid ,PSSCAN_PGID }, | 317 | { 5 , "pgid" ,"PGID" ,func_pgid ,PSSCAN_PGID }, |
318 | #endif | ||
311 | #if ENABLE_FEATURE_PS_TIME | 319 | #if ENABLE_FEATURE_PS_TIME |
312 | { sizeof("ELAPSED")-1, "etime" ,"ELAPSED",func_etime ,PSSCAN_START_TIME }, | 320 | { sizeof("ELAPSED")-1, "etime" ,"ELAPSED",func_etime ,PSSCAN_START_TIME }, |
313 | #endif | 321 | #endif |
@@ -320,10 +328,12 @@ static const ps_out_t out_spec[] = { | |||
320 | #if ENABLE_FEATURE_PS_TIME | 328 | #if ENABLE_FEATURE_PS_TIME |
321 | { 6 , "time" ,"TIME" ,func_time ,PSSCAN_STIME | PSSCAN_UTIME }, | 329 | { 6 , "time" ,"TIME" ,func_time ,PSSCAN_STIME | PSSCAN_UTIME }, |
322 | #endif | 330 | #endif |
331 | #if !ENABLE_PLATFORM_MINGW32 | ||
323 | { 6 , "tty" ,"TT" ,func_tty ,PSSCAN_TTY }, | 332 | { 6 , "tty" ,"TT" ,func_tty ,PSSCAN_TTY }, |
324 | { 4 , "vsz" ,"VSZ" ,func_vsz ,PSSCAN_VSZ }, | 333 | { 4 , "vsz" ,"VSZ" ,func_vsz ,PSSCAN_VSZ }, |
325 | // Not mandated by POSIX, but useful: | 334 | // Not mandated by POSIX, but useful: |
326 | { 4 , "rss" ,"RSS" ,func_rss ,PSSCAN_RSS }, | 335 | { 4 , "rss" ,"RSS" ,func_rss ,PSSCAN_RSS }, |
336 | #endif | ||
327 | #if ENABLE_SELINUX | 337 | #if ENABLE_SELINUX |
328 | { 35 , "label" ,"LABEL" ,func_label ,PSSCAN_CONTEXT }, | 338 | { 35 , "label" ,"LABEL" ,func_label ,PSSCAN_CONTEXT }, |
329 | #endif | 339 | #endif |
diff --git a/scripts/defconfig.mingw32 b/scripts/defconfig.mingw32 index 1d931503c..ff4b006cb 100644 --- a/scripts/defconfig.mingw32 +++ b/scripts/defconfig.mingw32 | |||
@@ -169,10 +169,10 @@ CONFIG_UNZIP=y | |||
169 | # | 169 | # |
170 | CONFIG_BASENAME=y | 170 | CONFIG_BASENAME=y |
171 | CONFIG_CAT=y | 171 | CONFIG_CAT=y |
172 | # CONFIG_DATE is not set | 172 | CONFIG_DATE=y |
173 | # CONFIG_FEATURE_DATE_ISOFMT is not set | 173 | CONFIG_FEATURE_DATE_ISOFMT=y |
174 | # CONFIG_FEATURE_DATE_NANO is not set | 174 | # CONFIG_FEATURE_DATE_NANO is not set |
175 | # CONFIG_FEATURE_DATE_COMPAT is not set | 175 | CONFIG_FEATURE_DATE_COMPAT=y |
176 | CONFIG_TEST=y | 176 | CONFIG_TEST=y |
177 | CONFIG_FEATURE_TEST_64=y | 177 | CONFIG_FEATURE_TEST_64=y |
178 | CONFIG_TR=y | 178 | CONFIG_TR=y |
@@ -278,13 +278,13 @@ CONFIG_TRUE=y | |||
278 | CONFIG_UNEXPAND=y | 278 | CONFIG_UNEXPAND=y |
279 | CONFIG_FEATURE_UNEXPAND_LONG_OPTIONS=y | 279 | CONFIG_FEATURE_UNEXPAND_LONG_OPTIONS=y |
280 | CONFIG_UNIQ=y | 280 | CONFIG_UNIQ=y |
281 | # CONFIG_USLEEP is not set | 281 | CONFIG_USLEEP=y |
282 | CONFIG_UUDECODE=y | 282 | CONFIG_UUDECODE=y |
283 | CONFIG_UUENCODE=y | 283 | CONFIG_UUENCODE=y |
284 | CONFIG_WC=y | 284 | CONFIG_WC=y |
285 | CONFIG_FEATURE_WC_LARGE=y | 285 | CONFIG_FEATURE_WC_LARGE=y |
286 | # CONFIG_WHO is not set | 286 | # CONFIG_WHO is not set |
287 | # CONFIG_WHOAMI is not set | 287 | CONFIG_WHOAMI=y |
288 | CONFIG_YES=y | 288 | CONFIG_YES=y |
289 | 289 | ||
290 | # | 290 | # |
@@ -344,7 +344,7 @@ CONFIG_DEFAULT_SETFONT_DIR="" | |||
344 | # CONFIG_START_STOP_DAEMON is not set | 344 | # CONFIG_START_STOP_DAEMON is not set |
345 | # CONFIG_FEATURE_START_STOP_DAEMON_FANCY is not set | 345 | # CONFIG_FEATURE_START_STOP_DAEMON_FANCY is not set |
346 | # CONFIG_FEATURE_START_STOP_DAEMON_LONG_OPTIONS is not set | 346 | # CONFIG_FEATURE_START_STOP_DAEMON_LONG_OPTIONS is not set |
347 | # CONFIG_WHICH is not set | 347 | CONFIG_WHICH=y |
348 | 348 | ||
349 | # | 349 | # |
350 | # Editors | 350 | # Editors |
@@ -529,11 +529,11 @@ CONFIG_DEFAULT_DEPMOD_FILE="" | |||
529 | # CONFIG_FEATURE_MINIX2 is not set | 529 | # CONFIG_FEATURE_MINIX2 is not set |
530 | # CONFIG_MKFS_REISER is not set | 530 | # CONFIG_MKFS_REISER is not set |
531 | # CONFIG_MKFS_VFAT is not set | 531 | # CONFIG_MKFS_VFAT is not set |
532 | # CONFIG_GETOPT is not set | 532 | CONFIG_GETOPT=y |
533 | # CONFIG_FEATURE_GETOPT_LONG is not set | 533 | CONFIG_FEATURE_GETOPT_LONG=y |
534 | # CONFIG_HEXDUMP is not set | 534 | CONFIG_HEXDUMP=y |
535 | # CONFIG_FEATURE_HEXDUMP_REVERSE is not set | 535 | CONFIG_FEATURE_HEXDUMP_REVERSE=y |
536 | # CONFIG_HD is not set | 536 | CONFIG_HD=y |
537 | # CONFIG_HWCLOCK is not set | 537 | # CONFIG_HWCLOCK is not set |
538 | # CONFIG_FEATURE_HWCLOCK_LONG_OPTIONS is not set | 538 | # CONFIG_FEATURE_HWCLOCK_LONG_OPTIONS is not set |
539 | # CONFIG_FEATURE_HWCLOCK_ADJTIME_FHS is not set | 539 | # CONFIG_FEATURE_HWCLOCK_ADJTIME_FHS is not set |
@@ -604,8 +604,8 @@ CONFIG_DEFAULT_DEPMOD_FILE="" | |||
604 | # CONFIG_UBIATTACH is not set | 604 | # CONFIG_UBIATTACH is not set |
605 | # CONFIG_UBIDETACH is not set | 605 | # CONFIG_UBIDETACH is not set |
606 | # CONFIG_ADJTIMEX is not set | 606 | # CONFIG_ADJTIMEX is not set |
607 | # CONFIG_BBCONFIG is not set | 607 | CONFIG_BBCONFIG=y |
608 | # CONFIG_FEATURE_COMPRESS_BBCONFIG is not set | 608 | CONFIG_FEATURE_COMPRESS_BBCONFIG=y |
609 | # CONFIG_BEEP is not set | 609 | # CONFIG_BEEP is not set |
610 | CONFIG_FEATURE_BEEP_FREQ=0 | 610 | CONFIG_FEATURE_BEEP_FREQ=0 |
611 | CONFIG_FEATURE_BEEP_LENGTH_MS=0 | 611 | CONFIG_FEATURE_BEEP_LENGTH_MS=0 |
@@ -672,7 +672,7 @@ CONFIG_FEATURE_LESS_MAXLINES=0 | |||
672 | # CONFIG_RUNLEVEL is not set | 672 | # CONFIG_RUNLEVEL is not set |
673 | # CONFIG_RX is not set | 673 | # CONFIG_RX is not set |
674 | # CONFIG_SETSID is not set | 674 | # CONFIG_SETSID is not set |
675 | # CONFIG_STRINGS is not set | 675 | CONFIG_STRINGS=y |
676 | # CONFIG_TASKSET is not set | 676 | # CONFIG_TASKSET is not set |
677 | # CONFIG_FEATURE_TASKSET_FANCY is not set | 677 | # CONFIG_FEATURE_TASKSET_FANCY is not set |
678 | # CONFIG_TIME is not set | 678 | # CONFIG_TIME is not set |
@@ -845,16 +845,16 @@ CONFIG_FEATURE_MIME_CHARSET="" | |||
845 | # CONFIG_SMEMCAP is not set | 845 | # CONFIG_SMEMCAP is not set |
846 | # CONFIG_FREE is not set | 846 | # CONFIG_FREE is not set |
847 | # CONFIG_FUSER is not set | 847 | # CONFIG_FUSER is not set |
848 | # CONFIG_KILL is not set | 848 | CONFIG_KILL=y |
849 | # CONFIG_KILLALL is not set | 849 | CONFIG_KILLALL=y |
850 | # CONFIG_KILLALL5 is not set | 850 | # CONFIG_KILLALL5 is not set |
851 | # CONFIG_NMETER is not set | 851 | # CONFIG_NMETER is not set |
852 | # CONFIG_PGREP is not set | 852 | CONFIG_PGREP=y |
853 | # CONFIG_PIDOF is not set | 853 | CONFIG_PIDOF=y |
854 | # CONFIG_FEATURE_PIDOF_SINGLE is not set | 854 | CONFIG_FEATURE_PIDOF_SINGLE=y |
855 | # CONFIG_FEATURE_PIDOF_OMIT is not set | 855 | CONFIG_FEATURE_PIDOF_OMIT=y |
856 | # CONFIG_PKILL is not set | 856 | # CONFIG_PKILL is not set |
857 | # CONFIG_PS is not set | 857 | CONFIG_PS=y |
858 | # CONFIG_FEATURE_PS_WIDE is not set | 858 | # CONFIG_FEATURE_PS_WIDE is not set |
859 | # CONFIG_FEATURE_PS_TIME is not set | 859 | # CONFIG_FEATURE_PS_TIME is not set |
860 | # CONFIG_FEATURE_PS_ADDITIONAL_COLUMNS is not set | 860 | # CONFIG_FEATURE_PS_ADDITIONAL_COLUMNS is not set |
diff --git a/win32/process.c b/win32/process.c index 13bf81797..cdd71182b 100644 --- a/win32/process.c +++ b/win32/process.c | |||
@@ -1,4 +1,5 @@ | |||
1 | #include "libbb.h" | 1 | #include "libbb.h" |
2 | #include <tlhelp32.h> | ||
2 | 3 | ||
3 | int waitpid(pid_t pid, int *status, unsigned options) | 4 | int waitpid(pid_t pid, int *status, unsigned options) |
4 | { | 5 | { |
@@ -284,3 +285,52 @@ mingw_execv(const char *cmd, const char *const *argv) | |||
284 | { | 285 | { |
285 | return mingw_execve(cmd, argv, (const char *const *)environ); | 286 | return mingw_execve(cmd, argv, (const char *const *)environ); |
286 | } | 287 | } |
288 | |||
289 | /* POSIX version in libbb/procps.c */ | ||
290 | procps_status_t* FAST_FUNC procps_scan(procps_status_t* sp, int flags) | ||
291 | { | ||
292 | PROCESSENTRY32 pe; | ||
293 | |||
294 | pe.dwSize = sizeof(pe); | ||
295 | if (!sp) { | ||
296 | sp = xzalloc(sizeof(struct procps_status_t)); | ||
297 | sp->snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); | ||
298 | if (sp->snapshot == INVALID_HANDLE_VALUE) { | ||
299 | free(sp); | ||
300 | return NULL; | ||
301 | } | ||
302 | if (!Process32First(sp->snapshot, &pe)) { | ||
303 | CloseHandle(sp->snapshot); | ||
304 | free(sp); | ||
305 | return NULL; | ||
306 | } | ||
307 | } | ||
308 | else { | ||
309 | if (!Process32Next(sp->snapshot, &pe)) { | ||
310 | CloseHandle(sp->snapshot); | ||
311 | free(sp); | ||
312 | return NULL; | ||
313 | } | ||
314 | } | ||
315 | |||
316 | sp->pid = pe.th32ProcessID; | ||
317 | strncpy(sp->comm, pe.szExeFile, COMM_LEN); | ||
318 | return sp; | ||
319 | } | ||
320 | |||
321 | int kill(pid_t pid, int sig) | ||
322 | { | ||
323 | HANDLE h; | ||
324 | |||
325 | if (sig != SIGTERM) { | ||
326 | bb_error_msg("kill only supports SIGTERM"); | ||
327 | errno = ENOSYS; | ||
328 | return -1; | ||
329 | } | ||
330 | h = OpenProcess(PROCESS_TERMINATE, FALSE, pid); | ||
331 | if (h == NULL) | ||
332 | return -1; | ||
333 | if (TerminateProcess(h, 0) == 0) | ||
334 | return -1; | ||
335 | return 0; | ||
336 | } | ||