diff --git a/ChangeLog b/ChangeLog index 048e2c96d..65eba3fec 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,12 +1,14 @@ WeeChat ChangeLog ================= Sébastien Helleu -v0.3.9-dev, 2012-07-30 +v0.3.9-dev, 2012-08-01 Version 0.3.9 (under dev!) -------------------------- +* core: add option weechat.startup.sys_rlimit to set system resource limits for + WeeChat process * core: add option "swap" for command /buffer (task #11373) * core: fix names of cache variables in configure.in (bug #36971) * core: scroll to bottom of window after reaching first or last highlight with diff --git a/config.h.cmake b/config.h.cmake index ea8047e80..293ae803d 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -15,6 +15,7 @@ #cmakedefine HAVE_REGEX_H #cmakedefine HAVE_WCHAR_H #cmakedefine HAVE_SYS_FILE_H +#cmakedefine HAVE_SYS_RESOURCE_H #cmakedefine HAVE_FLOCK #cmakedefine HAVE_LANGINFO_CODESET #cmakedefine HAVE_STRNDUP diff --git a/configure.in b/configure.in index a74e1efb0..e71c71bbe 100644 --- a/configure.in +++ b/configure.in @@ -68,7 +68,7 @@ AC_CHECK_LIB(ncursesw, initscr, LIBNCURSESW_FOUND=1, LIBNCURSESW_FOUND=0) # Checks for header files AC_HEADER_STDC -AC_CHECK_HEADERS([arpa/inet.h libintl.h limits.h locale.h netdb.h netinet/in.h stdlib.h string.h sys/socket.h sys/time.h sys/types.h unistd.h pwd.h errno.h regex.h wchar.h sys/file.h]) +AC_CHECK_HEADERS([arpa/inet.h libintl.h limits.h locale.h netdb.h netinet/in.h stdlib.h string.h sys/socket.h sys/time.h sys/types.h unistd.h pwd.h errno.h regex.h wchar.h sys/file.h sys/resource.h]) # Checks for typedefs, structures, and compiler characteristics AC_HEADER_TIME diff --git a/doc/de/autogen/user/weechat_options.txt b/doc/de/autogen/user/weechat_options.txt index d40633d0c..4668cf2a1 100644 --- a/doc/de/autogen/user/weechat_options.txt +++ b/doc/de/autogen/user/weechat_options.txt @@ -823,3 +823,8 @@ ** Typ: boolesch ** Werte: on, off (Standardwert: `on`) +* [[option_weechat.startup.sys_rlimit]] *weechat.startup.sys_rlimit* +** Beschreibung: `set resource limits for WeeChat process, format is: "res1:limit1,res2:limit2"; resource name is the end of constant (RLIMIT_XXX) in lower case (see man setrlimit for values); limit -1 means "unlimited"; example: set unlimited size for core file and max 1GB of virtual memory: "core:-1,as:1000000000"` +** Typ: Zeichenkette +** Werte: beliebige Zeichenkette (Standardwert: `""`) + diff --git a/doc/de/weechat_user.de.txt b/doc/de/weechat_user.de.txt index 88973fc17..15f01f832 100644 --- a/doc/de/weechat_user.de.txt +++ b/doc/de/weechat_user.de.txt @@ -207,7 +207,17 @@ Wird ein Binärpaket genutzt dann muss zusätzlich das Paket 'weechat-dbg' insta Core Dateien ^^^^^^^^^^^^ -Um 'core' Dateien zu aktivieren muss der `ulimit` Befehl genutzt werden. +// TRANSLATION MISSING +To enable 'core' files, you can use option +<>: + +---------------------------------------- +/set weechat.startup.sys_rlimit "core:-1" +---------------------------------------- + +// TRANSLATION MISSING +For WeeChat ≤ 0.3.8 or if you want to enable core files even before WeeChat +starts, you can use `ulimit` command. Zum Beispiel muss unter Linux in einer 'bash' Shell folgender Befehl in die `~/.bashrc` Datei eingetragen werden: diff --git a/doc/en/autogen/user/weechat_options.txt b/doc/en/autogen/user/weechat_options.txt index dccfcd596..e39431950 100644 --- a/doc/en/autogen/user/weechat_options.txt +++ b/doc/en/autogen/user/weechat_options.txt @@ -823,3 +823,8 @@ ** type: boolean ** values: on, off (default value: `on`) +* [[option_weechat.startup.sys_rlimit]] *weechat.startup.sys_rlimit* +** description: `set resource limits for WeeChat process, format is: "res1:limit1,res2:limit2"; resource name is the end of constant (RLIMIT_XXX) in lower case (see man setrlimit for values); limit -1 means "unlimited"; example: set unlimited size for core file and max 1GB of virtual memory: "core:-1,as:1000000000"` +** type: string +** values: any string (default value: `""`) + diff --git a/doc/en/weechat_user.en.txt b/doc/en/weechat_user.en.txt index 5e4eaaf85..ec2120d83 100644 --- a/doc/en/weechat_user.en.txt +++ b/doc/en/weechat_user.en.txt @@ -209,7 +209,15 @@ If you installed a binary package, then install package 'weechat-dbg'. Core files ^^^^^^^^^^ -To enable 'core' files, you have to use `ulimit` command. +To enable 'core' files, you can use option +<>: + +---------------------------------------- +/set weechat.startup.sys_rlimit "core:-1" +---------------------------------------- + +For WeeChat ≤ 0.3.8 or if you want to enable core files even before WeeChat +starts, you can use `ulimit` command. For example under Linux with 'bash' shell, add this line to your `~/.bashrc`: diff --git a/doc/fr/autogen/user/weechat_options.txt b/doc/fr/autogen/user/weechat_options.txt index 0c28fb41c..248d08387 100644 --- a/doc/fr/autogen/user/weechat_options.txt +++ b/doc/fr/autogen/user/weechat_options.txt @@ -823,3 +823,8 @@ ** type: booléen ** valeurs: on, off (valeur par défaut: `on`) +* [[option_weechat.startup.sys_rlimit]] *weechat.startup.sys_rlimit* +** description: `définir les limites de ressource pour le processus WeeChat, le format est: "res1:limite1,res2:limite2"; le nom de ressource est la fin de la constante (RLIMIT_XXX) en minuscules (voir man setrlimit pour les valeurs); une limite de -1 siginifie "illimitée"; exemple: définir une taille illimitée pour le fichier core et max 1 Go de mémoire virtuelle: "core:-1,as:1000000000"` +** type: chaîne +** valeurs: toute chaîne (valeur par défaut: `""`) + diff --git a/doc/fr/weechat_user.fr.txt b/doc/fr/weechat_user.fr.txt index f262dac29..f96413803 100644 --- a/doc/fr/weechat_user.fr.txt +++ b/doc/fr/weechat_user.fr.txt @@ -213,7 +213,15 @@ Si vous avez installé un paquet binaire, alors installez le paquet Fichiers core ^^^^^^^^^^^^^ -Pour activer les fichiers 'core', vous devez utiliser la commande `ulimit`. +Pour activer les fichiers 'core', vous pouvez utiliser l'option +<>: + +---------------------------------------- +/set weechat.startup.sys_rlimit "core:-1" +---------------------------------------- + +Pour WeeChat ≤ 0.3.8 ou si vous voulez activer les fichiers core avant que +WeeChat ne démarre, vous pouvez utiliser la commande `ulimit`. Par exemple sous Linux avec le shell 'bash', ajoutez cette ligne dans votre `~/.bashrc`: diff --git a/doc/it/autogen/user/weechat_options.txt b/doc/it/autogen/user/weechat_options.txt index eeb8b1f8c..fc6dd9093 100644 --- a/doc/it/autogen/user/weechat_options.txt +++ b/doc/it/autogen/user/weechat_options.txt @@ -823,3 +823,8 @@ ** tipo: bool ** valori: on, off (valore predefinito: `on`) +* [[option_weechat.startup.sys_rlimit]] *weechat.startup.sys_rlimit* +** descrizione: `set resource limits for WeeChat process, format is: "res1:limit1,res2:limit2"; resource name is the end of constant (RLIMIT_XXX) in lower case (see man setrlimit for values); limit -1 means "unlimited"; example: set unlimited size for core file and max 1GB of virtual memory: "core:-1,as:1000000000"` +** tipo: stringa +** valori: qualsiasi stringa (valore predefinito: `""`) + diff --git a/doc/it/weechat_user.it.txt b/doc/it/weechat_user.it.txt index b1b5917d7..93ac6d631 100644 --- a/doc/it/weechat_user.it.txt +++ b/doc/it/weechat_user.it.txt @@ -214,7 +214,17 @@ Se è stato installato il pacchetto binario, installare il pacchetto 'weechat-gd File core ^^^^^^^^^ -Per abilitare i file 'core', è necessario usare il comando `ulimit`. +// TRANSLATION MISSING +To enable 'core' files, you can use option +<>: + +---------------------------------------- +/set weechat.startup.sys_rlimit "core:-1" +---------------------------------------- + +// TRANSLATION MISSING +For WeeChat ≤ 0.3.8 or if you want to enable core files even before WeeChat +starts, you can use `ulimit` command. Ad esempio su Linux con la shell 'bash', aggiungere questa riga al proprio `~/.bashrc`: diff --git a/po/cs.po b/po/cs.po index 6bd47a41b..4c5606789 100644 --- a/po/cs.po +++ b/po/cs.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.9-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2012-07-29 20:00+0200\n" +"POT-Creation-Date: 2012-08-01 08:57+0200\n" "PO-Revision-Date: 2012-06-03 09:49+0200\n" "Last-Translator: Jiri Golembiovsky \n" "Language-Team: weechat-dev \n" @@ -2223,6 +2223,14 @@ msgstr "zobrazí WeeChat logo při spuštění" msgid "display WeeChat version at startup" msgstr "zobrazí verzi WeeChat při spuštění" +msgid "" +"set resource limits for WeeChat process, format is: \"res1:limit1,res2:" +"limit2\"; resource name is the end of constant (RLIMIT_XXX) in lower case " +"(see man setrlimit for values); limit -1 means \"unlimited\"; example: set " +"unlimited size for core file and max 1GB of virtual memory: \"core:-1," +"as:1000000000\"" +msgstr "" + msgid "" "alignment for end of lines (all lines after the first): they are starting " "under this data (time, buffer, prefix, suffix, message (default))" @@ -3236,6 +3244,23 @@ msgstr "" "čtení - špatný podpis (formát aktualizačního souboru se mohl změnit od " "poslední verze)" +#, c-format +msgid "%sError: invalid limit for resource \"%s\": %s (must be >= -1)" +msgstr "" + +#, c-format +msgid "Limit for resource \"%s\" has been set to %s" +msgstr "" + +#, fuzzy, c-format +msgid "%sError: unable to set resource limit \"%s\" to %s: error %d %s" +msgstr "%sChyba: nemohu nastavit volbu \"%s\" pro proxy \"%s\"" + +#, c-format +msgid "" +"%sError: unknown resource limit \"%s\" (see /help weechat.startup.sys_rlimit)" +msgstr "" + #, c-format msgid "" "Warning: the %d color pairs are used, do \"/color reset\" to remove unused " diff --git a/po/de.po b/po/de.po index b86f16c85..3c1637f3d 100644 --- a/po/de.po +++ b/po/de.po @@ -23,7 +23,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.7-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2012-07-29 20:00+0200\n" +"POT-Creation-Date: 2012-08-01 08:57+0200\n" "PO-Revision-Date: 2012-07-22 23:37+0100\n" "Last-Translator: Nils Görs \n" "Language-Team: German \n" @@ -2419,6 +2419,14 @@ msgstr "WeeChat-Logo beim Start anzeigen" msgid "display WeeChat version at startup" msgstr "WeeChat-Version beim Start anzeigen" +msgid "" +"set resource limits for WeeChat process, format is: \"res1:limit1,res2:" +"limit2\"; resource name is the end of constant (RLIMIT_XXX) in lower case " +"(see man setrlimit for values); limit -1 means \"unlimited\"; example: set " +"unlimited size for core file and max 1GB of virtual memory: \"core:-1," +"as:1000000000\"" +msgstr "" + msgid "" "alignment for end of lines (all lines after the first): they are starting " "under this data (time, buffer, prefix, suffix, message (default))" @@ -3571,6 +3579,23 @@ msgstr "" "lese - falsche Signatur (das Dateiformat wurde vermutlich seit der letzten " "Version verändern)" +#, c-format +msgid "%sError: invalid limit for resource \"%s\": %s (must be >= -1)" +msgstr "" + +#, c-format +msgid "Limit for resource \"%s\" has been set to %s" +msgstr "" + +#, fuzzy, c-format +msgid "%sError: unable to set resource limit \"%s\" to %s: error %d %s" +msgstr "%sFehler: Option \"%s\" kann für den Proxy \"%s\" nicht setzt werden" + +#, c-format +msgid "" +"%sError: unknown resource limit \"%s\" (see /help weechat.startup.sys_rlimit)" +msgstr "" + #, c-format msgid "" "Warning: the %d color pairs are used, do \"/color reset\" to remove unused " diff --git a/po/es.po b/po/es.po index 0ec32ab7c..098aa56c0 100644 --- a/po/es.po +++ b/po/es.po @@ -22,7 +22,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.9-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2012-07-29 20:00+0200\n" +"POT-Creation-Date: 2012-08-01 08:57+0200\n" "PO-Revision-Date: 2012-07-27 12:16+0200\n" "Last-Translator: Elián Hanisch \n" "Language-Team: weechat-dev \n" @@ -2336,6 +2336,14 @@ msgstr "mostrar el logotipo de WeeChat en el arranque" msgid "display WeeChat version at startup" msgstr "mostrar la versión de WeeChat en el arranque" +msgid "" +"set resource limits for WeeChat process, format is: \"res1:limit1,res2:" +"limit2\"; resource name is the end of constant (RLIMIT_XXX) in lower case " +"(see man setrlimit for values); limit -1 means \"unlimited\"; example: set " +"unlimited size for core file and max 1GB of virtual memory: \"core:-1," +"as:1000000000\"" +msgstr "" + msgid "" "alignment for end of lines (all lines after the first): they are starting " "under this data (time, buffer, prefix, suffix, message (default))" @@ -3423,6 +3431,23 @@ msgstr "" "lectura - firma incorrecta (el formato del archivo de actualización puede " "haber cambiado desde la última versión)" +#, c-format +msgid "%sError: invalid limit for resource \"%s\": %s (must be >= -1)" +msgstr "" + +#, c-format +msgid "Limit for resource \"%s\" has been set to %s" +msgstr "" + +#, fuzzy, c-format +msgid "%sError: unable to set resource limit \"%s\" to %s: error %d %s" +msgstr "%sError: no se pudo configurar la opción \"%s\" para el proxy \"%s\"" + +#, c-format +msgid "" +"%sError: unknown resource limit \"%s\" (see /help weechat.startup.sys_rlimit)" +msgstr "" + #, c-format msgid "" "Warning: the %d color pairs are used, do \"/color reset\" to remove unused " diff --git a/po/fr.po b/po/fr.po index 7a7530047..638a8e5d6 100644 --- a/po/fr.po +++ b/po/fr.po @@ -21,8 +21,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.9-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2012-07-29 20:00+0200\n" -"PO-Revision-Date: 2012-07-29 20:00+0200\n" +"POT-Creation-Date: 2012-08-01 08:57+0200\n" +"PO-Revision-Date: 2012-08-01 09:02+0200\n" "Last-Translator: Sebastien Helleu \n" "Language-Team: weechat-dev \n" "Language: French\n" @@ -2351,6 +2351,20 @@ msgstr "afficher le logo WeeChat au démarrage" msgid "display WeeChat version at startup" msgstr "afficher la version de WeeChat au démarrage" +msgid "" +"set resource limits for WeeChat process, format is: \"res1:limit1,res2:" +"limit2\"; resource name is the end of constant (RLIMIT_XXX) in lower case " +"(see man setrlimit for values); limit -1 means \"unlimited\"; example: set " +"unlimited size for core file and max 1GB of virtual memory: \"core:-1," +"as:1000000000\"" +msgstr "" +"définir les limites de ressource pour le processus WeeChat, le format est: " +"\"res1:limite1,res2:limite2\"; le nom de ressource est la fin de la " +"constante (RLIMIT_XXX) en minuscules (voir man setrlimit pour les valeurs); " +"une limite de -1 siginifie \"illimitée\"; exemple: définir une taille " +"illimitée pour le fichier core et max 1 Go de mémoire virtuelle: \"core:-1," +"as:1000000000\"" + msgid "" "alignment for end of lines (all lines after the first): they are starting " "under this data (time, buffer, prefix, suffix, message (default))" @@ -3460,6 +3474,27 @@ msgstr "" "lecture - mauvaise signature (le format de fichier upgrade a peut-être " "changé depuis la dernière version)" +#, c-format +msgid "%sError: invalid limit for resource \"%s\": %s (must be >= -1)" +msgstr "%sErreur: limite de ressource \"%s\" invalide: %s (doit être >= 1)" + +#, c-format +msgid "Limit for resource \"%s\" has been set to %s" +msgstr "La limite de ressource \"%s\" a été modifiée en %s" + +#, c-format +msgid "%sError: unable to set resource limit \"%s\" to %s: error %d %s" +msgstr "" +"%sErreur: impossible de définir la limite de ressource \"%s\" à %s: erreur " +"%d %s" + +#, c-format +msgid "" +"%sError: unknown resource limit \"%s\" (see /help weechat.startup.sys_rlimit)" +msgstr "" +"%sErreur: limite de ressource \"%s\" inconnue (voir /help weechat.startup." +"sys_rlimit)" + #, c-format msgid "" "Warning: the %d color pairs are used, do \"/color reset\" to remove unused " @@ -8884,27 +8919,3 @@ msgstr "Type" msgid "Constants" msgstr "Constantes" - -#~ msgid "smart completion for nicks (completes first with last speakers)" -#~ msgstr "" -#~ "complétion intelligente pour les pseudos (complète d'abord avec les " -#~ "personnes qui ont parlé récemment)" - -#~ msgid "ended on: " -#~ msgstr "terminé le: " - -#~ msgid "%s%-26s id: %d, protocol: %s, received: %s, sent: %s" -#~ msgstr "%s%-26s id: %d, protocole: %s, reçu: %s, envoyé: %s" - -#~ msgid "%s: new client from %s%s%s on port %d (id: %d, relaying: %s%s%s%s)" -#~ msgstr "" -#~ "%s: nouveau client de %s%s%s sur le port %d (id: %d, relai: %s%s%s%s)" - -#~ msgid "text color" -#~ msgstr "couleur du texte" - -#~ msgid "background color" -#~ msgstr "couleur du fond" - -#~ msgid "text color of selected xfer line" -#~ msgstr "couleur du texte pour la ligne xfer sélectionnée" diff --git a/po/hu.po b/po/hu.po index 866004ca6..2c2d06d27 100644 --- a/po/hu.po +++ b/po/hu.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.9-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2012-07-29 20:00+0200\n" +"POT-Creation-Date: 2012-08-01 08:57+0200\n" "PO-Revision-Date: 2012-06-03 09:49+0200\n" "Last-Translator: Andras Voroskoi \n" "Language-Team: weechat-dev \n" @@ -1920,6 +1920,14 @@ msgstr "WeeChat logo mutatása induláskor" msgid "display WeeChat version at startup" msgstr "WeeChat verziójának mutatása induláskor" +msgid "" +"set resource limits for WeeChat process, format is: \"res1:limit1,res2:" +"limit2\"; resource name is the end of constant (RLIMIT_XXX) in lower case " +"(see man setrlimit for values); limit -1 means \"unlimited\"; example: set " +"unlimited size for core file and max 1GB of virtual memory: \"core:-1," +"as:1000000000\"" +msgstr "" + msgid "" "alignment for end of lines (all lines after the first): they are starting " "under this data (time, buffer, prefix, suffix, message (default))" @@ -2898,6 +2906,23 @@ msgid "" "version)" msgstr "" +#, c-format +msgid "%sError: invalid limit for resource \"%s\": %s (must be >= -1)" +msgstr "" + +#, c-format +msgid "Limit for resource \"%s\" has been set to %s" +msgstr "" + +#, fuzzy, c-format +msgid "%sError: unable to set resource limit \"%s\" to %s: error %d %s" +msgstr "%s ismeretlen opció a \"%s\" parancsnak\n" + +#, c-format +msgid "" +"%sError: unknown resource limit \"%s\" (see /help weechat.startup.sys_rlimit)" +msgstr "" + #, c-format msgid "" "Warning: the %d color pairs are used, do \"/color reset\" to remove unused " diff --git a/po/it.po b/po/it.po index 0a8c19c21..9ac54ef64 100644 --- a/po/it.po +++ b/po/it.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.9-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2012-07-30 16:49+0200\n" +"POT-Creation-Date: 2012-08-01 08:57+0200\n" "PO-Revision-Date: 2012-07-30 15:38+0200\n" "Last-Translator: Marco Paolone \n" "Language-Team: weechat-dev \n" @@ -2332,6 +2332,14 @@ msgstr "mostra il logo di WeeChat all'avvio" msgid "display WeeChat version at startup" msgstr "mostra la versione di WeeChat all'avvio" +msgid "" +"set resource limits for WeeChat process, format is: \"res1:limit1,res2:" +"limit2\"; resource name is the end of constant (RLIMIT_XXX) in lower case " +"(see man setrlimit for values); limit -1 means \"unlimited\"; example: set " +"unlimited size for core file and max 1GB of virtual memory: \"core:-1," +"as:1000000000\"" +msgstr "" + msgid "" "alignment for end of lines (all lines after the first): they are starting " "under this data (time, buffer, prefix, suffix, message (default))" @@ -3411,6 +3419,23 @@ msgstr "" "lettura - firma errata (l'aggiornamento del formato del file potrebbe essere " "cambiato dall'ultima versione)" +#, c-format +msgid "%sError: invalid limit for resource \"%s\": %s (must be >= -1)" +msgstr "" + +#, c-format +msgid "Limit for resource \"%s\" has been set to %s" +msgstr "" + +#, fuzzy, c-format +msgid "%sError: unable to set resource limit \"%s\" to %s: error %d %s" +msgstr "%sErrore: impossibile impostare l'opzione \"%s\" per il proxy \"%s\"" + +#, c-format +msgid "" +"%sError: unknown resource limit \"%s\" (see /help weechat.startup.sys_rlimit)" +msgstr "" + #, c-format msgid "" "Warning: the %d color pairs are used, do \"/color reset\" to remove unused " diff --git a/po/ja.po b/po/ja.po index a1f8926d8..5e3785d87 100644 --- a/po/ja.po +++ b/po/ja.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.9-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2012-07-29 20:00+0200\n" +"POT-Creation-Date: 2012-08-01 08:57+0200\n" "PO-Revision-Date: 2012-07-27 12:16+0200\n" "Last-Translator: AYANOKOUZI, Ryuunosuke \n" "Language-Team: Japanese \n" @@ -2294,6 +2294,14 @@ msgstr "WeeChat ロゴを開始時に表示" msgid "display WeeChat version at startup" msgstr "WeeChat バージョンを開始時に表示" +msgid "" +"set resource limits for WeeChat process, format is: \"res1:limit1,res2:" +"limit2\"; resource name is the end of constant (RLIMIT_XXX) in lower case " +"(see man setrlimit for values); limit -1 means \"unlimited\"; example: set " +"unlimited size for core file and max 1GB of virtual memory: \"core:-1," +"as:1000000000\"" +msgstr "" + msgid "" "alignment for end of lines (all lines after the first): they are starting " "under this data (time, buffer, prefix, suffix, message (default))" @@ -3329,6 +3337,24 @@ msgstr "" "読み込み - 不正な署名 (ファイルフォーマットのアップグレードが最新バージョンか" "ら変更された可能性があります)" +#, c-format +msgid "%sError: invalid limit for resource \"%s\": %s (must be >= -1)" +msgstr "" + +#, c-format +msgid "Limit for resource \"%s\" has been set to %s" +msgstr "" + +#, fuzzy, c-format +msgid "%sError: unable to set resource limit \"%s\" to %s: error %d %s" +msgstr "" +"%1$sエラー: プロキシ \"%3$s\" に対するオプション \"%2$s\" を設定できません" + +#, c-format +msgid "" +"%sError: unknown resource limit \"%s\" (see /help weechat.startup.sys_rlimit)" +msgstr "" + #, c-format msgid "" "Warning: the %d color pairs are used, do \"/color reset\" to remove unused " diff --git a/po/pl.po b/po/pl.po index 6723d6ddf..31da9027f 100644 --- a/po/pl.po +++ b/po/pl.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.9-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2012-07-29 20:00+0200\n" +"POT-Creation-Date: 2012-08-01 08:57+0200\n" "PO-Revision-Date: 2012-07-27 12:16+0200\n" "Last-Translator: Krzysztof Korościk \n" "Language-Team: weechat-dev \n" @@ -2340,6 +2340,14 @@ msgstr "wyświetl logo WeeChat podczas uruchamiania" msgid "display WeeChat version at startup" msgstr "wyświetl wersję WeeChat podczas uruchamiania" +msgid "" +"set resource limits for WeeChat process, format is: \"res1:limit1,res2:" +"limit2\"; resource name is the end of constant (RLIMIT_XXX) in lower case " +"(see man setrlimit for values); limit -1 means \"unlimited\"; example: set " +"unlimited size for core file and max 1GB of virtual memory: \"core:-1," +"as:1000000000\"" +msgstr "" + msgid "" "alignment for end of lines (all lines after the first): they are starting " "under this data (time, buffer, prefix, suffix, message (default))" @@ -3405,6 +3413,23 @@ msgid "" msgstr "" "odczyt - zła sygnatura (format pliku mógł ulec zmianie od poprzedniej wersji)" +#, c-format +msgid "%sError: invalid limit for resource \"%s\": %s (must be >= -1)" +msgstr "" + +#, c-format +msgid "Limit for resource \"%s\" has been set to %s" +msgstr "" + +#, fuzzy, c-format +msgid "%sError: unable to set resource limit \"%s\" to %s: error %d %s" +msgstr "%sBłąd: nie można ustawić opcji \"%s\" dla proxy \"%s\"" + +#, c-format +msgid "" +"%sError: unknown resource limit \"%s\" (see /help weechat.startup.sys_rlimit)" +msgstr "" + #, c-format msgid "" "Warning: the %d color pairs are used, do \"/color reset\" to remove unused " diff --git a/po/pt_BR.po b/po/pt_BR.po index 1905c39de..9d43be3a5 100644 --- a/po/pt_BR.po +++ b/po/pt_BR.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.9-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2012-07-29 20:00+0200\n" +"POT-Creation-Date: 2012-08-01 08:57+0200\n" "PO-Revision-Date: 2012-06-03 09:49+0200\n" "Last-Translator: Sergio Durigan Junior \n" "Language-Team: weechat-dev \n" @@ -2299,6 +2299,14 @@ msgstr "mosta o logo do WeeChat na inicialização" msgid "display WeeChat version at startup" msgstr "mosta a versão do WeeChat na inicialização" +msgid "" +"set resource limits for WeeChat process, format is: \"res1:limit1,res2:" +"limit2\"; resource name is the end of constant (RLIMIT_XXX) in lower case " +"(see man setrlimit for values); limit -1 means \"unlimited\"; example: set " +"unlimited size for core file and max 1GB of virtual memory: \"core:-1," +"as:1000000000\"" +msgstr "" + msgid "" "alignment for end of lines (all lines after the first): they are starting " "under this data (time, buffer, prefix, suffix, message (default))" @@ -3324,6 +3332,23 @@ msgid "" "version)" msgstr "" +#, c-format +msgid "%sError: invalid limit for resource \"%s\": %s (must be >= -1)" +msgstr "" + +#, c-format +msgid "Limit for resource \"%s\" has been set to %s" +msgstr "" + +#, fuzzy, c-format +msgid "%sError: unable to set resource limit \"%s\" to %s: error %d %s" +msgstr "%sErro : incapaz de configurar a opção \"%s\" para o proxy \"%s\"" + +#, c-format +msgid "" +"%sError: unknown resource limit \"%s\" (see /help weechat.startup.sys_rlimit)" +msgstr "" + #, c-format msgid "" "Warning: the %d color pairs are used, do \"/color reset\" to remove unused " diff --git a/po/ru.po b/po/ru.po index be1b50654..b41d9f796 100644 --- a/po/ru.po +++ b/po/ru.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.9-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2012-07-29 20:00+0200\n" +"POT-Creation-Date: 2012-08-01 08:57+0200\n" "PO-Revision-Date: 2012-06-03 09:49+0200\n" "Last-Translator: Aleksey V Zapparov AKA ixti \n" "Language-Team: weechat-dev \n" @@ -1939,6 +1939,14 @@ msgstr "отображать логотип WeeChat при запуске" msgid "display WeeChat version at startup" msgstr "отображать версию WeeChat при запуске" +msgid "" +"set resource limits for WeeChat process, format is: \"res1:limit1,res2:" +"limit2\"; resource name is the end of constant (RLIMIT_XXX) in lower case " +"(see man setrlimit for values); limit -1 means \"unlimited\"; example: set " +"unlimited size for core file and max 1GB of virtual memory: \"core:-1," +"as:1000000000\"" +msgstr "" + msgid "" "alignment for end of lines (all lines after the first): they are starting " "under this data (time, buffer, prefix, suffix, message (default))" @@ -2923,6 +2931,23 @@ msgid "" "version)" msgstr "" +#, c-format +msgid "%sError: invalid limit for resource \"%s\": %s (must be >= -1)" +msgstr "" + +#, c-format +msgid "Limit for resource \"%s\" has been set to %s" +msgstr "" + +#, fuzzy, c-format +msgid "%sError: unable to set resource limit \"%s\" to %s: error %d %s" +msgstr "%s неизвестный параметр для команды \"%s\"\n" + +#, c-format +msgid "" +"%sError: unknown resource limit \"%s\" (see /help weechat.startup.sys_rlimit)" +msgstr "" + #, c-format msgid "" "Warning: the %d color pairs are used, do \"/color reset\" to remove unused " diff --git a/po/weechat.pot b/po/weechat.pot index f13e0d085..6060a97c8 100644 --- a/po/weechat.pot +++ b/po/weechat.pot @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2012-07-29 20:00+0200\n" +"POT-Creation-Date: 2012-08-01 08:57+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -1683,6 +1683,14 @@ msgstr "" msgid "display WeeChat version at startup" msgstr "" +msgid "" +"set resource limits for WeeChat process, format is: \"res1:limit1,res2:" +"limit2\"; resource name is the end of constant (RLIMIT_XXX) in lower case " +"(see man setrlimit for values); limit -1 means \"unlimited\"; example: set " +"unlimited size for core file and max 1GB of virtual memory: \"core:-1," +"as:1000000000\"" +msgstr "" + msgid "" "alignment for end of lines (all lines after the first): they are starting " "under this data (time, buffer, prefix, suffix, message (default))" @@ -2542,6 +2550,23 @@ msgid "" "version)" msgstr "" +#, c-format +msgid "%sError: invalid limit for resource \"%s\": %s (must be >= -1)" +msgstr "" + +#, c-format +msgid "Limit for resource \"%s\" has been set to %s" +msgstr "" + +#, c-format +msgid "%sError: unable to set resource limit \"%s\" to %s: error %d %s" +msgstr "" + +#, c-format +msgid "" +"%sError: unknown resource limit \"%s\" (see /help weechat.startup.sys_rlimit)" +msgstr "" + #, c-format msgid "" "Warning: the %d color pairs are used, do \"/color reset\" to remove unused " diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e6cc903c3..503737b09 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -46,6 +46,7 @@ CHECK_INCLUDE_FILES("pwd.h" HAVE_PWD_H) CHECK_INCLUDE_FILES("errno.h" HAVE_ERRNO_H) CHECK_INCLUDE_FILES("wchar.h" HAVE_WCHAR_H) CHECK_INCLUDE_FILES("langinfo.h" HAVE_LANGINFO_CODESET) +CHECK_INCLUDE_FILES("sys/resource.h" HAVE_SYS_RESOURCE_H) CHECK_FUNCTION_EXISTS(gethostbyname HAVE_GETHOSTBYNAME) CHECK_FUNCTION_EXISTS(gethostname HAVE_GETHOSTNAME) diff --git a/src/core/wee-config.c b/src/core/wee-config.c index cccdcca36..502af8c99 100644 --- a/src/core/wee-config.c +++ b/src/core/wee-config.c @@ -76,6 +76,7 @@ struct t_config_option *config_startup_command_after_plugins; struct t_config_option *config_startup_command_before_plugins; struct t_config_option *config_startup_display_logo; struct t_config_option *config_startup_display_version; +struct t_config_option *config_startup_sys_rlimit; /* config, look & feel section */ @@ -260,6 +261,21 @@ char **config_plugin_extensions = NULL; int config_num_plugin_extensions = 0; +/* + * config_change_sys_rlimit: called when the system resource limits is changed + */ + +void +config_change_sys_rlimit (void *data, struct t_config_option *option) +{ + /* make C compiler happy */ + (void) data; + (void) option; + + if (gui_init_ok) + util_setrlimit (); +} + /* * config_change_save_config_on_exit: called when "save_config_on_exit" flag is changed */ @@ -747,6 +763,8 @@ config_weechat_init_after_read () { int i; + util_setrlimit (); + gui_buffer_notify_set_all (); proxy_use_temp_proxies (); @@ -1729,6 +1747,16 @@ config_weechat_init_options () "display_version", "boolean", N_("display WeeChat version at startup"), NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); + config_startup_sys_rlimit = config_file_new_option ( + weechat_config_file, ptr_section, + "sys_rlimit", "string", + N_("set resource limits for WeeChat process, format is: " + "\"res1:limit1,res2:limit2\"; resource name is the end of constant " + "(RLIMIT_XXX) in lower case (see man setrlimit for values); limit " + "-1 means \"unlimited\"; example: set unlimited size for core file " + "and max 1GB of virtual memory: \"core:-1,as:1000000000\""), + NULL, 0, 0, "", NULL, 0, NULL, NULL, + &config_change_sys_rlimit, NULL, NULL, NULL); /* look */ ptr_section = config_file_new_section (weechat_config_file, "look", diff --git a/src/core/wee-config.h b/src/core/wee-config.h index 53ee5f6fc..efb399b99 100644 --- a/src/core/wee-config.h +++ b/src/core/wee-config.h @@ -102,6 +102,7 @@ extern struct t_config_option *config_startup_command_after_plugins; extern struct t_config_option *config_startup_command_before_plugins; extern struct t_config_option *config_startup_display_logo; extern struct t_config_option *config_startup_display_version; +extern struct t_config_option *config_startup_sys_rlimit; extern struct t_config_option *config_look_align_end_of_lines; extern struct t_config_option *config_look_bar_more_left; diff --git a/src/core/wee-util.c b/src/core/wee-util.c index 292d7859d..f2e668c50 100644 --- a/src/core/wee-util.c +++ b/src/core/wee-util.c @@ -30,6 +30,10 @@ #include #include #include +#include +#ifdef HAVE_SYS_RESOURCE_H +#include +#endif #include #include #include @@ -39,10 +43,181 @@ #include "weechat.h" #include "wee-util.h" #include "wee-config.h" +#include "wee-log.h" #include "wee-string.h" #include "wee-utf8.h" +#include "../gui/gui-chat.h" +#include "../gui/gui-window.h" +#ifdef HAVE_SYS_RESOURCE_H +struct t_rlimit_resource rlimit_resource[] = +{ +#ifdef RLIMIT_AS + { "as", RLIMIT_AS }, +#endif +#ifdef RLIMIT_CORE + { "core", RLIMIT_CORE }, +#endif +#ifdef RLIMIT_CPU + { "cpu", RLIMIT_CPU }, +#endif +#ifdef RLIMIT_DATA + { "data", RLIMIT_DATA }, +#endif +#ifdef RLIMIT_FSIZE + { "fsize", RLIMIT_FSIZE }, +#endif +#ifdef RLIMIT_LOCKS + { "locks", RLIMIT_LOCKS }, +#endif +#ifdef RLIMIT_MEMLOCK + { "memlock", RLIMIT_MEMLOCK }, +#endif +#ifdef RLIMIT_MSGQUEUE + { "msgqueue", RLIMIT_MSGQUEUE }, +#endif +#ifdef RLIMIT_NICE + { "nice", RLIMIT_NICE }, +#endif +#ifdef RLIMIT_NOFILE + { "nofile", RLIMIT_NOFILE }, +#endif +#ifdef RLIMIT_NPROC + { "nproc", RLIMIT_NPROC }, +#endif +#ifdef RLIMIT_RSS + { "rss", RLIMIT_RSS }, +#endif +#ifdef RLIMIT_RTPRIO + { "rtprio", RLIMIT_RTPRIO }, +#endif +#ifdef RLIMIT_RTTIME + { "rttime", RLIMIT_RTTIME }, +#endif +#ifdef RLIMIT_SIGPENDING + { "sigpending", RLIMIT_SIGPENDING }, +#endif +#ifdef RLIMIT_STACK + { "stack", RLIMIT_STACK }, +#endif + { NULL, 0 }, +}; +#endif /* HAVE_SYS_RESOURCE_H */ + + +/* + * util_setrlimit_resource: set resource limit + */ + +#ifdef HAVE_SYS_RESOURCE_H +void +util_setrlimit_resource (const char *resource_name, long limit) +{ + int i; + struct rlimit rlim; + char str_limit[64]; + + if (!resource_name) + return; + + if (limit == -1) + snprintf (str_limit, sizeof (str_limit), "unlimited"); + else + snprintf (str_limit, sizeof (str_limit), "%ld", limit); + + for (i = 0; rlimit_resource[i].name; i++) + { + if (strcmp (rlimit_resource[i].name, resource_name) == 0) + { + if (limit < -1) + { + gui_chat_printf (NULL, + _("%sError: invalid limit for resource \"%s\": " + "%s (must be >= -1)"), + gui_chat_prefix[GUI_CHAT_PREFIX_ERROR], + resource_name, str_limit); + return; + } + rlim.rlim_cur = (limit >= 0) ? (rlim_t)limit : RLIM_INFINITY; + rlim.rlim_max = rlim.rlim_cur; + if (setrlimit (rlimit_resource[i].resource, &rlim) == 0) + { + log_printf (_("Limit for resource \"%s\" has been set to %s"), + resource_name, str_limit); + if (gui_init_ok) + { + gui_chat_printf (NULL, + _("Limit for resource \"%s\" has been set " + "to %s"), + resource_name, str_limit); + } + } + else + { + gui_chat_printf (NULL, + _("%sError: unable to set resource limit " + "\"%s\" to %s: error %d %s"), + gui_chat_prefix[GUI_CHAT_PREFIX_ERROR], + resource_name, str_limit, + errno, strerror (errno)); + } + return; + } + } + + gui_chat_printf (NULL, + _("%sError: unknown resource limit \"%s\" (see /help " + "weechat.startup.sys_rlimit)"), + gui_chat_prefix[GUI_CHAT_PREFIX_ERROR], + resource_name); +} +#endif + +/* + * util_setrlimit: set resource limits using value of option + * "weechat.startup.sys_rlimit" + */ + +void +util_setrlimit () +{ +#ifdef HAVE_SYS_RESOURCE_H + char **items, *pos, *error; + int num_items, i; + long number; + + items = string_split (CONFIG_STRING(config_startup_sys_rlimit), ",", 0, 0, + &num_items); + if (items) + { + for (i = 0; i < num_items; i++) + { + pos = strchr (items[i], ':'); + if (pos) + { + pos[0] = '\0'; + error = NULL; + number = strtol (pos + 1, &error, 10); + if (error && !error[0]) + { + util_setrlimit_resource (items[i], number); + } + else + { + gui_chat_printf (NULL, + _("%sError: invalid limit for resource " + "\"%s\": %s (must be >= -1)"), + gui_chat_prefix[GUI_CHAT_PREFIX_ERROR], + items[i], pos + 1); + } + } + } + string_free_split (items); + } +#endif +} + /* * util_timeval_cmp: compare two timeval structures * return: -1 if tv1 < tv2 diff --git a/src/core/wee-util.h b/src/core/wee-util.h index e444f18ef..de40fa6d2 100644 --- a/src/core/wee-util.h +++ b/src/core/wee-util.h @@ -20,6 +20,15 @@ #ifndef __WEECHAT_UTIL_H #define __WEECHAT_UTIL_H 1 +#ifdef HAVE_SYS_RESOURCE_H +struct t_rlimit_resource +{ + char *name; /* name of resource */ + int resource; /* value of resource */ +}; +#endif /* HAVE_SYS_RESOURCE_H */ + +extern void util_setrlimit (); extern int util_timeval_cmp (struct timeval *tv1, struct timeval *tv2); extern long util_timeval_diff (struct timeval *tv1, struct timeval *tv2); extern void util_timeval_add (struct timeval *tv, long interval);