[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    Re: signaling SIGRTMIN+1 and SIGRTMIN+2 using pkill busybox applet.
From:       Sameer Naik <sameer.subscriptions () damagehead ! com>
Date:       2010-12-31 17:42:13
Message-ID: AANLkTim6w8i5wjxV0bzrtVBKAjiZTC_t_Fr-rrUrjmN1 () mail ! gmail ! com
[Download RAW message or body]

attached is the patch for 1.15.2 with the changeset mentioned in this threa=
d.

On Fri, Dec 31, 2010 at 9:15 AM, Sameer Naik
<sameer.subscriptions@damagehead.com> wrote:
> ok... was not aware.
>
> On Fri, Dec 31, 2010 at 4:30 AM, Denys Vlasenko
> <vda.linux@googlemail.com> wrote:
>> On Thursday 30 December 2010 18:52, Sameer Naik wrote:
>>> I think you may have missed out on adding
>>>
>>> config FEATURE_RTMINMAX
>>>
>>> in one of the config files.
>>
>> In current version, it can be embedded in .c file like this
>> in libbb/u_signal_names.c:
>>
>> //config:config FEATURE_RTMINMAX
>> //config: =A0 =A0 =A0bool "Support RTMIN[+n] and RTMAX[-n] signal names"
>> //config: =A0 =A0 =A0default y
>> //config: =A0 =A0 =A0help
>> //config: =A0 =A0 =A0 =A0Support RTMIN[+n] and RTMAX[-n] signal names
>> //config: =A0 =A0 =A0 =A0in kill, killall etc. This costs ~250 bytes.
>>
>> --
>> vda
>>
>

["busybox_1_15_2_rtmin_rtmax_support.patch" (text/x-patch)]

diff --git a/libbb/Config.in b/libbb/Config.in
index bdb6dfa..39b3108 100644
--- a/libbb/Config.in
+++ b/libbb/Config.in
@@ -122,7 +122,14 @@ config FEATURE_NON_POSIX_CP
 	  and create a regular file. This does not conform to POSIX,
 	  but prevents a symlink attack.
 	  Similarly, "cp file device" will not send file's data
-	  to the device.
+	  to the device. (To do that, use "cat file >device")
+
+config FEATURE_RTMINMAX
+	bool "Support RTMIN[+n] and RTMAX[-n] signal names"
+	default y
+	help
+	  Support RTMIN[+n] and RTMAX[-n] signal names
+	  in kill, killall etc. This costs ~250 bytes.
 
 config FEATURE_VERBOSE_CP_MESSAGE
 	bool "Give more precise messages when copy fails (cp, mv etc)"
diff --git a/libbb/u_signal_names.c b/libbb/u_signal_names.c
index 915eea5..a8ba32f 100644
--- a/libbb/u_signal_names.c
+++ b/libbb/u_signal_names.c
@@ -134,22 +134,46 @@ int FAST_FUNC get_signum(const char *name)
 		if (strcasecmp(name, signals[i]) == 0)
 			return i;
 
-#if ENABLE_DESKTOP && (defined(SIGIOT) || defined(SIGIO))
+#if ENABLE_DESKTOP 
+# if defined(SIGIOT) || defined(SIGIO)
 	/* SIGIO[T] are aliased to other names,
 	 * thus cannot be stored in the signals[] array.
 	 * Need special code to recognize them */
 	if ((name[0] | 0x20) == 'i' && (name[1] | 0x20) == 'o') {
-#ifdef SIGIO
+#  ifdef SIGIO
 		if (!name[2])
 			return SIGIO;
-#endif
-#ifdef SIGIOT
+#  endif
+#  ifdef SIGIOT
 		if ((name[2] | 0x20) == 't' && !name[3])
 			return SIGIOT;
-#endif
+#  endif
+	}
+# endif
+#endif
+
+#if ENABLE_FEATURE_RTMINMAX
+# if defined(SIGRTMIN) && defined(SIGRTMAX)
+	if (strncasecmp(name, "RTMAX", 5) == 0) {
+		if (!name[5])
+			return SIGRTMAX;
+		if (name[5] == '-') {
+			i = bb_strtou(name + 6, NULL, 10);
+			if (!errno && i <= SIGRTMAX - SIGRTMIN)
+				return SIGRTMAX - i;
+		}
 	}
+	if (strncasecmp(name, "RTMIN", 5) == 0) {
+		if (!name[5])
+			return SIGRTMIN;
+		if (name[5] == '+') {
+			i = bb_strtou(name + 6, NULL, 10);
+			if (!errno && i <= SIGRTMAX - SIGRTMIN)
+				return SIGRTMIN + i;
+		}
+	}
+# endif
 #endif
-
 	return -1;
 }
 


_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic