From patchwork Tue May 16 18:25:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Kuhls X-Patchwork-Id: 91884 Received: from [127.0.0.1] by www.linuxtv.org with esmtp (Exim 4.92) (envelope-from ) id 1pyzMT-005FQf-59; Tue, 16 May 2023 18:25:25 +0000 Received: from mailout07.t-online.de ([194.25.134.83]) by www.linuxtv.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pyzMP-005FOV-PQ for vdr@linuxtv.org; Tue, 16 May 2023 18:25:23 +0000 Received: from fwd88.dcpf.telekom.de (fwd88.aul.t-online.de [10.223.144.114]) by mailout07.t-online.de (Postfix) with SMTP id C4C8C487C5; Tue, 16 May 2023 20:25:20 +0200 (CEST) Received: from fli4l.lan.fli4l ([91.58.6.127]) by fwd88.t-online.de with (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384 encrypted) esmtp id 1pyzMO-129tUf0; Tue, 16 May 2023 20:25:20 +0200 Received: from bruckner.lan.fli4l ([192.168.1.1]:53826) by fli4l.lan.fli4l with esmtp (Exim 4.96) (envelope-from ) id 1pyzMO-0007vP-0o; Tue, 16 May 2023 20:25:20 +0200 From: Bernd Kuhls To: vdr@linuxtv.org Date: Tue, 16 May 2023 20:25:14 +0200 Message-Id: <20230516182517.999918-1-bernd.kuhls@t-online.de> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-Spam-Score: -2.5 (--) X-TOI-EXPURGATEID: 150726::1684261520-13FFFE62-9D7B0CBF/0/0 CLEAN NORMAL X-TOI-MSGID: f040b21b-40a9-4979-b9b2-83ba7e665490 X-LSpam-Score: -2.6 (--) X-LSpam-Report: No, score=-2.6 required=5.0 tests=BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001 autolearn=ham autolearn_force=no Subject: [vdr] [PATCH 1/4] Fix musl build X-BeenThere: vdr@linuxtv.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: VDR Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: VDR Mailing List Cc: Carlo Landmeter Errors-To: vdr-bounces@linuxtv.org Sender: "vdr" From: Carlo Landmeter Downloaded from https://git.alpinelinux.org/aports/tree/community/vdr/musl-compat.patch Initial commit: https://git.alpinelinux.org/aports/commit/?id=140248605cee4a0160f80b47ce77a823be2f740a Signed-off-by: Bernd Kuhls --- i18n.h | 2 +- osd.c | 2 +- thread.c | 4 +++- tools.c | 4 ++-- tools.h | 14 ++++++++++++-- vdr.c | 6 ++++++ 6 files changed, 25 insertions(+), 7 deletions(-) diff --git a/i18n.h b/i18n.h index 03deb6f2..85ce4077 100644 --- a/i18n.h +++ b/i18n.h @@ -46,7 +46,7 @@ const cStringList *I18nLanguages(void); ///< have an actual locale installed. The rest are just dummy entries ///< to allow having three letter language codes for other languages ///< that have no actual locale on this system. -const char *I18nTranslate(const char *s, const char *Plugin = NULL) __attribute_format_arg__(1); +const char *I18nTranslate(const char *s, const char *Plugin = NULL) __attribute__((__format_arg__ (1))); ///< Translates the given string (with optional Plugin context) into ///< the current language. If no translation is available, the original ///< string will be returned. diff --git a/osd.c b/osd.c index 47bda686..0d360c81 100644 --- a/osd.c +++ b/osd.c @@ -12,7 +12,7 @@ #include #include #include -#include +#include #include "device.h" #include "tools.h" diff --git a/thread.c b/thread.c index 93eb8c0d..6e854541 100644 --- a/thread.c +++ b/thread.c @@ -160,7 +160,9 @@ cRwLock::cRwLock(bool PreferWriter) writeLockThreadId = 0; pthread_rwlockattr_t attr; pthread_rwlockattr_init(&attr); +#if defined(__GLIBC__) pthread_rwlockattr_setkind_np(&attr, PreferWriter ? PTHREAD_RWLOCK_PREFER_WRITER_NP : PTHREAD_RWLOCK_PREFER_READER_NP); +#endif pthread_rwlock_init(&rwlock, &attr); } @@ -210,7 +212,7 @@ cMutex::cMutex(void) locked = 0; pthread_mutexattr_t attr; pthread_mutexattr_init(&attr); - pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK_NP); + pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK); pthread_mutex_init(&mutex, &attr); } diff --git a/tools.c b/tools.c index d04033b1..8b161eec 100644 --- a/tools.c +++ b/tools.c @@ -672,7 +672,7 @@ char *ReadLink(const char *FileName) { if (!FileName) return NULL; - char *TargetName = canonicalize_file_name(FileName); + char *TargetName = realpath(FileName, NULL); if (!TargetName) { if (errno == ENOENT) // file doesn't exist TargetName = strdup(FileName); @@ -1562,7 +1562,7 @@ cReadDir::~cReadDir() struct dirent *cReadDir::Next(void) { if (directory) { -#if !__GLIBC_PREREQ(2, 24) // readdir_r() is deprecated as of GLIBC 2.24 +#if __GLIBC__ while (readdir_r(directory, &u.d, &result) == 0 && result) { #else while ((result = readdir(directory)) != NULL) { diff --git a/tools.h b/tools.h index ff6169ee..60eda179 100644 --- a/tools.h +++ b/tools.h @@ -28,6 +28,16 @@ #include #include "thread.h" +#ifndef ACCESSPERMS +# define ACCESSPERMS (S_IRWXU|S_IRWXG|S_IRWXO) /* 0777 */ +#endif +#ifndef ALLPERMS +# define ALLPERMS (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO)/* 07777 */ +#endif +#ifndef DEFFILEMODE +# define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)/* 0666*/ +#endif + typedef unsigned char uchar; extern int SysLogLevel; @@ -444,7 +454,7 @@ class cReadDir { private: DIR *directory; struct dirent *result; -#if !__GLIBC_PREREQ(2, 24) // readdir_r() is deprecated as of GLIBC 2.24 +#if __GLIBC__ union { // according to "The GNU C Library Reference Manual" struct dirent d; char b[offsetof(struct dirent, d_name) + NAME_MAX + 1]; @@ -818,7 +828,7 @@ public: data[i] = T(0); size = 0; } - void Sort(__compar_fn_t Compare) + void Sort(int (*Compare)(const void *, const void *)) { qsort(data, size, sizeof(T), Compare); } diff --git a/vdr.c b/vdr.c index 1bdc51ab..0f426e61 100644 --- a/vdr.c +++ b/vdr.c @@ -661,12 +661,18 @@ int main(int argc, char *argv[]) } } else if (Terminal) { +#ifdef __GLIBC__ // Claim new controlling terminal stdin = freopen(Terminal, "r", stdin); stdout = freopen(Terminal, "w", stdout); stderr = freopen(Terminal, "w", stderr); HasStdin = true; tcgetattr(STDIN_FILENO, &savedTm); +#else + // stdin, stdout, stderr are declared FILE const* by musl C library + fprintf(stderr, "Option '-t' is only supported if VDR has been built against glibc.\n"); + return 2; +#endif } // Set user id in case we were started as root: From patchwork Tue May 16 18:25:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Kuhls X-Patchwork-Id: 91883 Received: from [127.0.0.1] by www.linuxtv.org with esmtp (Exim 4.92) (envelope-from ) id 1pyzMS-005FPe-HW; Tue, 16 May 2023 18:25:24 +0000 Received: from mailout12.t-online.de ([194.25.134.22]) by www.linuxtv.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pyzMP-005FOX-Vh for vdr@linuxtv.org; Tue, 16 May 2023 18:25:23 +0000 Received: from fwd84.dcpf.telekom.de (fwd84.aul.t-online.de [10.223.144.110]) by mailout12.t-online.de (Postfix) with SMTP id E5FC81A4CB; Tue, 16 May 2023 20:25:20 +0200 (CEST) Received: from fli4l.lan.fli4l ([91.58.6.127]) by fwd84.t-online.de with (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384 encrypted) esmtp id 1pyzMO-3zSupt0; Tue, 16 May 2023 20:25:20 +0200 Received: from bruckner.lan.fli4l ([192.168.1.1]:53826) by fli4l.lan.fli4l with esmtp (Exim 4.96) (envelope-from ) id 1pyzMO-0007vP-1B; Tue, 16 May 2023 20:25:20 +0200 From: Bernd Kuhls To: vdr@linuxtv.org Date: Tue, 16 May 2023 20:25:15 +0200 Message-Id: <20230516182517.999918-2-bernd.kuhls@t-online.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230516182517.999918-1-bernd.kuhls@t-online.de> References: <20230516182517.999918-1-bernd.kuhls@t-online.de> MIME-Version: 1.0 X-Spam-Score: -2.5 (--) X-TOI-EXPURGATEID: 150726::1684261520-5AE6F570-7A21839A/0/0 CLEAN NORMAL X-TOI-MSGID: 9f2be6fc-7309-4d7d-af49-988bb3291ee5 X-LSpam-Score: -1.9 (-) X-LSpam-Report: No, score=-1.9 required=5.0 tests=BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001 autolearn=ham autolearn_force=no Subject: [vdr] [PATCH 2/4] Include limits.h X-BeenThere: vdr@linuxtv.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: VDR Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: VDR Mailing List Cc: Roberto Oliveira Errors-To: vdr-bounces@linuxtv.org Sender: "vdr" From: Roberto Oliveira vdr package uses some macros like HOST_NAME_MAX, NAME_MAX, which are defined in limits.h. Needs to be explicitly included on ppc64le and for all archs for debug build. Downloaded from https://git.alpinelinux.org/aports/tree/community/vdr/include-missing-limits.patch Initial commits: https://git.alpinelinux.org/aports/commit/?id=c9d8942ccf4825fd734b5f37157a49fc4f0b4339 https://git.alpinelinux.org/aports/commit/?id=47965644c390b1be1117769b1e08b31858267e9a Signed-off-by: Bernd Kuhls --- config.h | 1 + tools.c | 1 + 2 files changed, 2 insertions(+) diff --git a/config.h b/config.h index 72dd3d2a..b9ea769f 100644 --- a/config.h +++ b/config.h @@ -19,6 +19,7 @@ #include "i18n.h" #include "font.h" #include "tools.h" +#include // VDR's own version number: diff --git a/tools.c b/tools.c index 8b161eec..56a2e0dd 100644 --- a/tools.c +++ b/tools.c @@ -27,6 +27,7 @@ extern "C" { #include #include "i18n.h" #include "thread.h" +#include int SysLogLevel = 3; From patchwork Tue May 16 18:25:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Kuhls X-Patchwork-Id: 91885 Received: from [127.0.0.1] by www.linuxtv.org with esmtp (Exim 4.92) (envelope-from ) id 1pyzNJ-005GYt-Tf; Tue, 16 May 2023 18:26:17 +0000 Received: from mailout04.t-online.de ([194.25.134.18]) by www.linuxtv.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pyzNH-005GYd-Ge for vdr@linuxtv.org; Tue, 16 May 2023 18:26:15 +0000 Received: from fwd81.dcpf.telekom.de (fwd81.aul.t-online.de [10.223.144.107]) by mailout04.t-online.de (Postfix) with SMTP id B4D06E6A9; Tue, 16 May 2023 20:25:21 +0200 (CEST) Received: from fli4l.lan.fli4l ([91.58.6.127]) by fwd81.t-online.de with (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384 encrypted) esmtp id 1pyzMO-4GWDsv0; Tue, 16 May 2023 20:25:20 +0200 Received: from bruckner.lan.fli4l ([192.168.1.1]:53826) by fli4l.lan.fli4l with esmtp (Exim 4.96) (envelope-from ) id 1pyzMO-0007vP-1U; Tue, 16 May 2023 20:25:20 +0200 From: Bernd Kuhls To: vdr@linuxtv.org Date: Tue, 16 May 2023 20:25:16 +0200 Message-Id: <20230516182517.999918-3-bernd.kuhls@t-online.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230516182517.999918-1-bernd.kuhls@t-online.de> References: <20230516182517.999918-1-bernd.kuhls@t-online.de> MIME-Version: 1.0 X-Spam-Score: -2.5 (--) X-TOI-EXPURGATEID: 150726::1684261520-D97F8DA8-FCF5E2FE/0/0 CLEAN NORMAL X-TOI-MSGID: 13452b36-1c67-4ce4-bcf4-10579f4a7d56 X-LSpam-Score: -2.6 (--) X-LSpam-Report: No, score=-2.6 required=5.0 tests=BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001 autolearn=ham autolearn_force=no Subject: [vdr] [PATCH 3/4] i18n.c: _nl_msg_cat_cntr is an internal symbol of some intl implementation X-BeenThere: vdr@linuxtv.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: VDR Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: VDR Mailing List Cc: Thomas Petazzoni Errors-To: vdr-bounces@linuxtv.org Sender: "vdr" From: Thomas Petazzoni It is supported by glibc and uClibc (which both define __GLIBC__) but not musl (which doesn't define __GLIBC__). On musl, it doesn't do anything because musl has a basic NLS implementation. Even gettext-tiny defines _nl_msg_cat_cntr as a dummy symbol in its stub libintl-musl implementation. Signed-off-by: Thomas Petazzoni Signed-off-by: Bernd Kuhls --- i18n.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/i18n.c b/i18n.c index d77e82c1..e4bc54f2 100644 --- a/i18n.c +++ b/i18n.c @@ -124,8 +124,10 @@ static const char *SkipContext(const char *s) static void SetEnvLanguage(const char *Locale) { setenv("LANGUAGE", Locale, 1); +#if defined(__GLIBC__) extern int _nl_msg_cat_cntr; ++_nl_msg_cat_cntr; +#endif } static void SetLanguageNames(void) From patchwork Tue May 16 18:25:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Kuhls X-Patchwork-Id: 91882 Received: from [127.0.0.1] by www.linuxtv.org with esmtp (Exim 4.92) (envelope-from ) id 1pyzMS-005FOt-1N; Tue, 16 May 2023 18:25:24 +0000 Received: from mailout07.t-online.de ([194.25.134.83]) by www.linuxtv.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pyzMP-005FOW-UE for vdr@linuxtv.org; Tue, 16 May 2023 18:25:22 +0000 Received: from fwd88.dcpf.telekom.de (fwd88.aul.t-online.de [10.223.144.114]) by mailout07.t-online.de (Postfix) with SMTP id EC741487C7 for ; Tue, 16 May 2023 20:25:20 +0200 (CEST) Received: from fli4l.lan.fli4l ([91.58.6.127]) by fwd88.t-online.de with (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384 encrypted) esmtp id 1pyzMO-129tUg0; Tue, 16 May 2023 20:25:20 +0200 Received: from bruckner.lan.fli4l ([192.168.1.1]:53826) by fli4l.lan.fli4l with esmtp (Exim 4.96) (envelope-from ) id 1pyzMO-0007vP-1l for vdr@linuxtv.org; Tue, 16 May 2023 20:25:20 +0200 From: Bernd Kuhls To: vdr@linuxtv.org Date: Tue, 16 May 2023 20:25:17 +0200 Message-Id: <20230516182517.999918-4-bernd.kuhls@t-online.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230516182517.999918-1-bernd.kuhls@t-online.de> References: <20230516182517.999918-1-bernd.kuhls@t-online.de> MIME-Version: 1.0 X-Spam-Score: -2.5 (--) X-TOI-EXPURGATEID: 150726::1684261520-13FFFE62-AFFDF6C4/0/0 CLEAN NORMAL X-TOI-MSGID: 1de54197-3b1e-418e-9a68-f2a1cb175b3e X-LSpam-Score: -2.6 (--) X-LSpam-Report: No, score=-2.6 required=5.0 tests=BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001 autolearn=ham autolearn_force=no Subject: [vdr] [PATCH 4/4] Fix musl build X-BeenThere: vdr@linuxtv.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: VDR Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: VDR Mailing List Errors-To: vdr-bounces@linuxtv.org Sender: "vdr" malloc_trim is a GNU extension and therefore not present in non-glibc C libraries such as musl. Wrapping this in an ifdef fixes musl builds. Signed-off-by: Bernd Kuhls --- vdr.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/vdr.c b/vdr.c index 0f426e61..bc4902de 100644 --- a/vdr.c +++ b/vdr.c @@ -1588,12 +1588,14 @@ int main(int argc, char *argv[]) cSchedules::Cleanup(); // Plugins housekeeping: PluginManager.Housekeeping(); +#if defined(__GLIBC__) // Memory cleanup: static time_t LastMemoryCleanup = 0; if ((Now - LastMemoryCleanup) > MEMCLEANUPDELTA) { malloc_trim(0); LastMemoryCleanup = Now; } +#endif } }