musl: remove compat basename declaration and add RLIMIT_RTTIME define

This declaration was added to musl to avoid warnings for applications that
expect GNU basename() in string.h.

Pre-ansi style declarations were used to avoid causing errors due to
incompatibile declarations of basename().

In C23, just like in C++, function declarations with no arguments are treated
as having no arguments, instead of having unspecified arguments. As such,
this creates a conflicting declaration in C23.
This commit is contained in:
oreo639 2024-01-22 13:30:57 -08:00
parent b6a8e78ed5
commit 829d9d4983
3 changed files with 69 additions and 1 deletions

View file

@ -0,0 +1,24 @@
From 2507e7f5312e79620f6337935d0a6c9045ccba09 Mon Sep 17 00:00:00 2001
From: Leah Neukirchen <leah@vuxu.org>
Date: Sat, 11 Jan 2020 20:16:59 +0100
Subject: [PATCH] define RLIMIT_RTTIME, bump RLIMIT_NLIMITS
This macro exists since Linux 2.6.25 and is defined in glibc since 2011.
---
include/sys/resource.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/include/sys/resource.h b/include/sys/resource.h
index e0c86ae33..3068328d0 100644
--- a/include/sys/resource.h
+++ b/include/sys/resource.h
@@ -90,7 +90,8 @@ int prlimit(pid_t, int, const struct rlimit *, struct rlimit *);
#define RLIMIT_MSGQUEUE 12
#define RLIMIT_NICE 13
#define RLIMIT_RTPRIO 14
-#define RLIMIT_NLIMITS 15
+#define RLIMIT_RTTIME 15
+#define RLIMIT_NLIMITS 16
#define RLIM_NLIMITS RLIMIT_NLIMITS

View file

@ -0,0 +1,44 @@
From 725e17ed6dff4d0cd22487bb64470881e86a92e7 Mon Sep 17 00:00:00 2001
From: Rich Felker <dalias@aerifal.cx>
Date: Mon, 6 Nov 2023 08:26:19 -0500
Subject: [PATCH] remove non-prototype declaration of basename from string.h
commit 37bb3cce4598c19288628e675eaf1cda6e96958f suppressed the
declaration for C++, where it is wrongly interpreted as declaring the
function as taking no arguments. with C23 removing non-prototype
declarations, that problem is now also relevant to C.
the non-prototype declaration for basename originates with commit
06aec8d7152dfb8360cb7ed9b3d7215ca0b0b500, where it was designed to
avoid conflicts with programs which declare basename with the GNU
signature taking const char *. that change was probably misguided, as
it represents not only misaligned expectations with the caller, but
also undefined behavior (calling a function that's been declared with
the wrong type).
we could opt to fix the declaration, but since glibc, with the
gratuitously incompatible GNU-basename function, seems to be the only
implementation that declares it in string.h, it seems better to just
remove the declaration. this provides some warning if applications are
being built expecting the GNU behavior but not getting it. if we
declared it here, it would only produce a warning if the caller also
declares it themselves (rare) or if the caller attempts to pass a
const-qualified pointer.
---
include/string.h | 3 ---
1 file changed, 3 deletions(-)
diff --git a/include/string.h b/include/string.h
index db73d2a9..83e2b946 100644
--- a/include/string.h
+++ b/include/string.h
@@ -95,9 +95,6 @@ char *strchrnul(const char *, int);
char *strcasestr(const char *, const char *);
void *memrchr(const void *, int, size_t);
void *mempcpy(void *, const void *, size_t);
-#ifndef __cplusplus
-char *basename();
-#endif
#endif
#ifdef __cplusplus

View file

@ -2,7 +2,7 @@
pkgname=musl
reverts="1.2.0_1"
version=1.1.24
revision=19
revision=20
archs="*-musl"
bootstrap=yes
build_style=gnu-configure