]> jfr.im git - irc/weechat/weechat.git/commitdiff
core: add number of processes in command `/sys waitpid`
authorSébastien Helleu <redacted>
Sun, 22 Oct 2023 19:02:41 +0000 (21:02 +0200)
committerSébastien Helleu <redacted>
Sun, 22 Oct 2023 19:02:41 +0000 (21:02 +0200)
19 files changed:
ChangeLog.adoc
po/cs.po
po/de.po
po/es.po
po/fr.po
po/hu.po
po/it.po
po/ja.po
po/pl.po
po/pt.po
po/pt_BR.po
po/ru.po
po/sr.po
po/tr.po
po/weechat.pot
src/core/wee-command.c
src/core/wee-sys.c
src/core/wee-sys.h
src/plugins/xfer/xfer-network.c

index a4865a1e5448d2c74f63f96bea09e3874e26f9c6..71c02f5cbcff0c6ae4550f2b7d739bf15c18240f 100644 (file)
@@ -15,6 +15,7 @@ For a list of important changes that require manual actions, please look at rele
 
 New features::
 
+  * core: add number of processes in command `/sys waitpid`
   * core, alias, trigger: allow wildcard in commands `/bar`, `/item`, `/proxy`, `/alias` and `/trigger` (issue #1956)
   * irc: add option irc.look.ignore_tag_messages (issue #989)
 
index dc681553db85799b5903872bda626756253a9d14..9c06109182789a7a19a191b56f60ae6d51a4daef 100644 (file)
--- a/po/cs.po
+++ b/po/cs.po
@@ -21,7 +21,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: WeeChat\n"
 "Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2023-10-20 11:17+0200\n"
+"POT-Creation-Date: 2023-10-20 21:02+0200\n"
 "PO-Revision-Date: 2023-10-20 13:09+0200\n"
 "Last-Translator: Ondřej Súkup <mimi.vx@gmail.com>\n"
 "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -3114,6 +3114,9 @@ msgstr ""
 msgid "system actions"
 msgstr "seznam konfiguračních možností"
 
+msgid "get rlimit|rusage || suspend || waitpid <number>"
+msgstr ""
+
 msgid "raw[get]: display system info"
 msgstr ""
 
@@ -3137,6 +3140,9 @@ msgid ""
 "\"zombie\" processes)"
 msgstr ""
 
+msgid "number: number of processes to clean"
+msgstr ""
+
 #, fuzzy
 #| msgid "values for a configuration option"
 msgid "toggle value of a config option"
index 85091612d73a9594df9f5cd2c26766ee72e75ede..d8bd7940666b9bdc70e0e5ccff33e044dd090029 100644 (file)
--- a/po/de.po
+++ b/po/de.po
@@ -26,7 +26,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: WeeChat\n"
 "Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2023-10-20 11:17+0200\n"
+"POT-Creation-Date: 2023-10-20 21:02+0200\n"
 "PO-Revision-Date: 2023-10-20 13:09+0200\n"
 "Last-Translator: Nils Görs <weechatter@arcor.de>\n"
 "Language-Team: German <kde-i18n-de@kde.org>\n"
@@ -3274,6 +3274,9 @@ msgstr ""
 msgid "system actions"
 msgstr "Systemaktionen"
 
+msgid "get rlimit|rusage || suspend || waitpid <number>"
+msgstr ""
+
 msgid "raw[get]: display system info"
 msgstr ""
 
@@ -3302,6 +3305,9 @@ msgid ""
 "\"zombie\" processes)"
 msgstr ""
 
+msgid "number: number of processes to clean"
+msgstr ""
+
 msgid "toggle value of a config option"
 msgstr "den Wert einer Konfigurationsoption umschalten"
 
index a13ed065bb6a2b9af496072763772008b42ba6ec..7c5a85f041f4d39c29eae3f3196a166402a2b8a4 100644 (file)
--- a/po/es.po
+++ b/po/es.po
@@ -22,7 +22,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: WeeChat\n"
 "Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2023-10-20 11:17+0200\n"
+"POT-Creation-Date: 2023-10-20 21:02+0200\n"
 "PO-Revision-Date: 2023-10-20 13:09+0200\n"
 "Last-Translator: Santiago Forero <santiago@forero.xyz>\n"
 "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -3217,6 +3217,9 @@ msgstr ""
 msgid "system actions"
 msgstr "lista de opciones"
 
+msgid "get rlimit|rusage || suspend || waitpid <number>"
+msgstr ""
+
 msgid "raw[get]: display system info"
 msgstr ""
 
@@ -3240,6 +3243,9 @@ msgid ""
 "\"zombie\" processes)"
 msgstr ""
 
+msgid "number: number of processes to clean"
+msgstr ""
+
 #, fuzzy
 #| msgid "values for a configuration option"
 msgid "toggle value of a config option"
index 81041fe8331f8a16d6074c5a15fdc02cccf42b41..a6a66bc9279c3a34b0a40269301e564b8f2822f9 100644 (file)
--- a/po/fr.po
+++ b/po/fr.po
@@ -21,8 +21,8 @@ msgid ""
 msgstr ""
 "Project-Id-Version: WeeChat\n"
 "Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2023-10-20 11:17+0200\n"
-"PO-Revision-Date: 2023-10-20 13:09+0200\n"
+"POT-Creation-Date: 2023-10-20 21:02+0200\n"
+"PO-Revision-Date: 2023-10-20 21:02+0200\n"
 "Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n"
 "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
 "Language: fr\n"
@@ -3355,6 +3355,9 @@ msgstr ""
 msgid "system actions"
 msgstr "actions système"
 
+msgid "get rlimit|rusage || suspend || waitpid <number>"
+msgstr "get rlimit|rusage || suspend || waitpid <nombre>"
+
 msgid "raw[get]: display system info"
 msgstr "raw[get] : afficher des informations système"
 
@@ -3383,6 +3386,9 @@ msgstr ""
 "raw[waitpid] : prendre connaissance des processus fils qui sont terminés "
 "(pour éviter les processus \"zombies\")"
 
+msgid "number: number of processes to clean"
+msgstr "nombre : nombre de processus à nettoyer"
+
 msgid "toggle value of a config option"
 msgstr "basculer la valeur d'une option de configuration"
 
index dfc174c243874ec99886aa223fd9e5f589fd238e..a36e753bc6888e49538eb131b0276b952a687887 100644 (file)
--- a/po/hu.po
+++ b/po/hu.po
@@ -20,7 +20,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: WeeChat\n"
 "Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2023-10-20 11:17+0200\n"
+"POT-Creation-Date: 2023-10-20 21:02+0200\n"
 "PO-Revision-Date: 2023-10-20 13:09+0200\n"
 "Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n"
 "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -2974,6 +2974,9 @@ msgstr ""
 msgid "system actions"
 msgstr "konfigurációs paraméterek beállítása"
 
+msgid "get rlimit|rusage || suspend || waitpid <number>"
+msgstr ""
+
 msgid "raw[get]: display system info"
 msgstr ""
 
@@ -2995,6 +2998,9 @@ msgid ""
 "\"zombie\" processes)"
 msgstr ""
 
+msgid "number: number of processes to clean"
+msgstr ""
+
 #, fuzzy
 msgid "toggle value of a config option"
 msgstr "Nem található az opció\n"
index 1dd0e5a41a5c730494887da2884adb7df8b11f41..6e43ac0ab61860d444fc25e0764290cf3fdd4cf8 100644 (file)
--- a/po/it.po
+++ b/po/it.po
@@ -20,7 +20,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: WeeChat\n"
 "Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2023-10-20 11:17+0200\n"
+"POT-Creation-Date: 2023-10-20 21:02+0200\n"
 "PO-Revision-Date: 2023-10-20 13:10+0200\n"
 "Last-Translator: Esteban I. Ruiz Moreno <exio4.com@gmail.com>\n"
 "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -3107,6 +3107,9 @@ msgstr ""
 msgid "system actions"
 msgstr "elenco delle opzioni"
 
+msgid "get rlimit|rusage || suspend || waitpid <number>"
+msgstr ""
+
 msgid "raw[get]: display system info"
 msgstr ""
 
@@ -3133,6 +3136,9 @@ msgid ""
 "\"zombie\" processes)"
 msgstr ""
 
+msgid "number: number of processes to clean"
+msgstr ""
+
 #, fuzzy
 #| msgid "values for a configuration option"
 msgid "toggle value of a config option"
index f8f18b4f34c7d69fa1de0f13c4a427ce45553225..dace59d66d73332bd8d855fbe59024e3d2e7ff5e 100644 (file)
--- a/po/ja.po
+++ b/po/ja.po
@@ -20,7 +20,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: WeeChat\n"
 "Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2023-10-20 11:17+0200\n"
+"POT-Creation-Date: 2023-10-20 21:02+0200\n"
 "PO-Revision-Date: 2023-10-20 13:10+0200\n"
 "Last-Translator: AYANOKOUZI, Ryuunosuke <i38w7i3@yahoo.co.jp>\n"
 "Language-Team: Japanese <https://github.com/l/weechat/tree/master/"
@@ -3215,6 +3215,9 @@ msgstr ""
 msgid "system actions"
 msgstr "fset オプション"
 
+msgid "get rlimit|rusage || suspend || waitpid <number>"
+msgstr ""
+
 msgid "raw[get]: display system info"
 msgstr ""
 
@@ -3241,6 +3244,9 @@ msgid ""
 "\"zombie\" processes)"
 msgstr ""
 
+msgid "number: number of processes to clean"
+msgstr ""
+
 #, fuzzy
 #| msgid "values for a configuration option"
 msgid "toggle value of a config option"
index 89f938932dc798384ab097a97285c1879ff75906..2230abf4208b3945a44d8167c9e12c6d980ecb5a 100644 (file)
--- a/po/pl.po
+++ b/po/pl.po
@@ -22,7 +22,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: WeeChat\n"
 "Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2023-10-20 11:17+0200\n"
+"POT-Creation-Date: 2023-10-20 21:02+0200\n"
 "PO-Revision-Date: 2023-10-20 13:10+0200\n"
 "Last-Translator: Krzysztof Korościk <soltys@soltys.info>\n"
 "Language-Team: Polish <kde-i18n-doc@kde.org>\n"
@@ -3311,6 +3311,9 @@ msgstr ""
 msgid "system actions"
 msgstr "opcje fset"
 
+msgid "get rlimit|rusage || suspend || waitpid <number>"
+msgstr ""
+
 msgid "raw[get]: display system info"
 msgstr ""
 
@@ -3338,6 +3341,9 @@ msgid ""
 "\"zombie\" processes)"
 msgstr ""
 
+msgid "number: number of processes to clean"
+msgstr ""
+
 msgid "toggle value of a config option"
 msgstr "przełącza wartość opcji konfiguracyjnej"
 
index db299d51465def1653ea0f9a45cdcfaa717ed5f6..68fd9d4d46aec3e80bbf81fa402fc557bf8aabdf 100644 (file)
--- a/po/pt.po
+++ b/po/pt.po
@@ -20,7 +20,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: WeeChat\n"
 "Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2023-10-20 11:17+0200\n"
+"POT-Creation-Date: 2023-10-20 21:02+0200\n"
 "PO-Revision-Date: 2023-10-20 13:10+0200\n"
 "Last-Translator: Vasco Almeida <vascomalmeida@sapo.pt>\n"
 "Language-Team: Portuguese <>\n"
@@ -3217,6 +3217,9 @@ msgstr ""
 msgid "system actions"
 msgstr "lista de opções"
 
+msgid "get rlimit|rusage || suspend || waitpid <number>"
+msgstr ""
+
 msgid "raw[get]: display system info"
 msgstr ""
 
@@ -3243,6 +3246,9 @@ msgid ""
 "\"zombie\" processes)"
 msgstr ""
 
+msgid "number: number of processes to clean"
+msgstr ""
+
 #, fuzzy
 #| msgid "values for a configuration option"
 msgid "toggle value of a config option"
index f7af79fe07ee40962d04085f73dd64e92b31eaf1..ec2d90976f16265d52f68910bf47b90245ae52ca 100644 (file)
@@ -21,7 +21,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: WeeChat\n"
 "Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2023-10-20 11:17+0200\n"
+"POT-Creation-Date: 2023-10-20 21:02+0200\n"
 "PO-Revision-Date: 2023-10-20 13:11+0200\n"
 "Last-Translator: Érico Nogueira <ericonr@disroot.org>\n"
 "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -3136,6 +3136,9 @@ msgstr ""
 msgid "system actions"
 msgstr "lista de opções"
 
+msgid "get rlimit|rusage || suspend || waitpid <number>"
+msgstr ""
+
 msgid "raw[get]: display system info"
 msgstr ""
 
@@ -3159,6 +3162,9 @@ msgid ""
 "\"zombie\" processes)"
 msgstr ""
 
+msgid "number: number of processes to clean"
+msgstr ""
+
 #, fuzzy
 #| msgid "values for a configuration option"
 msgid "toggle value of a config option"
index 212152f74e46f043f29eaae4074786677705a350..f56b09e877eeedd88001a12ea9eff4bd0772b629 100644 (file)
--- a/po/ru.po
+++ b/po/ru.po
@@ -21,7 +21,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: WeeChat\n"
 "Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2023-10-20 11:17+0200\n"
+"POT-Creation-Date: 2023-10-20 21:02+0200\n"
 "PO-Revision-Date: 2023-10-20 13:11+0200\n"
 "Last-Translator: Aleksey V Zapparov AKA ixti <ixti@member.fsf.org>\n"
 "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -2997,6 +2997,9 @@ msgstr ""
 msgid "system actions"
 msgstr "настроить параметры конфигурации"
 
+msgid "get rlimit|rusage || suspend || waitpid <number>"
+msgstr ""
+
 msgid "raw[get]: display system info"
 msgstr ""
 
@@ -3018,6 +3021,9 @@ msgid ""
 "\"zombie\" processes)"
 msgstr ""
 
+msgid "number: number of processes to clean"
+msgstr ""
+
 #, fuzzy
 msgid "toggle value of a config option"
 msgstr "Не найден параметр\n"
index 57eea813a823d671b0fc33a9ed38d748833e4145..569a87ad0f13cea96d251702131e6b00680d8554 100644 (file)
--- a/po/sr.po
+++ b/po/sr.po
@@ -20,7 +20,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: WeeChat\n"
 "Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2023-10-20 11:17+0200\n"
+"POT-Creation-Date: 2023-10-20 21:02+0200\n"
 "PO-Revision-Date: 2023-10-20 13:11+0200\n"
 "Last-Translator: Ivan Pešić <ivan.pesic@gmail.com>\n"
 "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -3237,6 +3237,9 @@ msgstr ""
 msgid "system actions"
 msgstr "системске акције"
 
+msgid "get rlimit|rusage || suspend || waitpid <number>"
+msgstr ""
+
 msgid "raw[get]: display system info"
 msgstr ""
 
@@ -3265,6 +3268,9 @@ msgid ""
 "\"zombie\" processes)"
 msgstr ""
 
+msgid "number: number of processes to clean"
+msgstr ""
+
 msgid "toggle value of a config option"
 msgstr "пребацује вредност опције конфигурације"
 
index e8bc0159e4b076d4021b53269f51a9e4e1fb227d..2084162243d7112fb74a2e46c38c3b9c7aa758a1 100644 (file)
--- a/po/tr.po
+++ b/po/tr.po
@@ -20,7 +20,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: WeeChat\n"
 "Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2023-10-20 11:17+0200\n"
+"POT-Creation-Date: 2023-10-20 21:02+0200\n"
 "PO-Revision-Date: 2023-10-20 13:11+0200\n"
 "Last-Translator: Emir SARI <emir_sari@icloud.com>\n"
 "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -3249,6 +3249,9 @@ msgstr ""
 msgid "system actions"
 msgstr "fset seçenekleri"
 
+msgid "get rlimit|rusage || suspend || waitpid <number>"
+msgstr ""
+
 msgid "raw[get]: display system info"
 msgstr ""
 
@@ -3276,6 +3279,9 @@ msgid ""
 "\"zombie\" processes)"
 msgstr ""
 
+msgid "number: number of processes to clean"
+msgstr ""
+
 msgid "toggle value of a config option"
 msgstr "bir yapılandırma seçeneğinin değerini aç/kapat"
 
index 9c066ad57f5c3dc2b420c395a4695cfde4c45d8f..688f02ea9f56fac33954ca29586a039cc50a00ed 100644 (file)
@@ -21,7 +21,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: WeeChat\n"
 "Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2023-10-20 11:17+0200\n"
+"POT-Creation-Date: 2023-10-20 21:02+0200\n"
 "PO-Revision-Date: 2014-08-16 10:27+0200\n"
 "Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n"
 "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -2786,6 +2786,9 @@ msgstr ""
 msgid "system actions"
 msgstr ""
 
+msgid "get rlimit|rusage || suspend || waitpid <number>"
+msgstr ""
+
 msgid "raw[get]: display system info"
 msgstr ""
 
@@ -2807,6 +2810,9 @@ msgid ""
 "\"zombie\" processes)"
 msgstr ""
 
+msgid "number: number of processes to clean"
+msgstr ""
+
 msgid "toggle value of a config option"
 msgstr ""
 
index b777f6b51d32db0f3eafafbccb3e0814a4878931..f15390afa368c5ba66a68a762ddc24fd704d1233 100644 (file)
@@ -6723,6 +6723,9 @@ COMMAND_CALLBACK(set)
 
 COMMAND_CALLBACK(sys)
 {
+    long value;
+    char *error;
+
     /* make C compiler happy */
     (void) pointer;
     (void) data;
@@ -6732,8 +6735,7 @@ COMMAND_CALLBACK(sys)
 
     if (string_strcmp (argv[1], "get") == 0)
     {
-        COMMAND_MIN_ARGS(2, "get");
-
+        COMMAND_MIN_ARGS(3, "get");
         if (string_strcmp (argv[2], "rlimit") == 0)
             sys_display_rlimit ();
         else if (string_strcmp (argv[2], "rusage") == 0)
@@ -6751,7 +6753,12 @@ COMMAND_CALLBACK(sys)
 
     if (string_strcmp (argv[1], "waitpid") == 0)
     {
-        sys_waitpid ();
+        COMMAND_MIN_ARGS(3, "waitpid");
+        error = NULL;
+        value = strtol (argv[2], &error, 10);
+        if (!error || error[0])
+            COMMAND_ERROR;
+        sys_waitpid ((int)value);
         return WEECHAT_RC_OK;
     }
 
@@ -9094,9 +9101,9 @@ command_init ()
     hook_command (
         NULL, "sys",
         N_("system actions"),
-        "get rlimit|rusage"
-        " || suspend"
-        " || waitpid",
+        N_("get rlimit|rusage"
+           " || suspend"
+           " || waitpid <number>"),
         CMD_ARGS_DESC(
             N_("raw[get]: display system info"),
             N_("raw[rlimit]: display resource limits "
@@ -9105,10 +9112,11 @@ command_init ()
             N_("raw[suspend]: suspend WeeChat and go back to the shell, by sending "
                "signal SIGTSTP to the WeeChat process") ,
             N_("raw[waitpid]: acknowledge the end of children processes "
-               "(to prevent \"zombie\" processes)")),
+               "(to prevent \"zombie\" processes)"),
+            N_("number: number of processes to clean")),
         "get rlimit|rusage"
         " || suspend"
-        " || waitpid",
+        " || waitpid 1|10|100|1000",
         &command_sys, NULL, NULL);
     hook_command (
         NULL, "toggle",
index 7560b80aa4d3895e503800e0d35480e84e38e49f..0a6fd8ec6bd257f73e10d3562bb8b88c5a8c439b 100644 (file)
@@ -349,13 +349,16 @@ sys_display_rusage ()
  */
 
 void
-sys_waitpid ()
+sys_waitpid (int number_processes)
 {
     int i;
 
+    if (number_processes < 1)
+        return;
+
     /* acknowledge the end of up to 42 forked processes */
     i = 0;
-    while ((i < 42) && (waitpid (-1, NULL, WNOHANG) > 0))
+    while ((i < number_processes) && (waitpid (-1, NULL, WNOHANG) > 0))
     {
         i++;
     }
index eb4e7bcb942273cddd63fcd3776e7517a3a2c052..d264d5f208e6c0fbba2340ef5c140a9620852ba8 100644 (file)
@@ -31,6 +31,6 @@ struct t_rlimit_resource
 extern void sys_setrlimit ();
 extern void sys_display_rlimit ();
 extern void sys_display_rusage ();
-extern void sys_waitpid ();
+extern void sys_waitpid (int number_processes);
 
 #endif /* WEECHAT_SYS_H */
index 3c7b63338e62170ddcba617e4e45d61a8f12aaee..9eeabf904b6c03ee23b47d264ce18d25b5538284 100644 (file)
@@ -484,7 +484,7 @@ xfer_network_child_kill (struct t_xfer *xfer)
     {
         kill (xfer->child_pid, SIGKILL);
         weechat_command (weechat_buffer_search_main (),
-                         "/mute /wait 100ms /sys waitpid");
+                         "/mute /wait 100ms /sys waitpid 10");
         xfer->child_pid = 0;
     }