git: 7723e73e5ee5 - main - irc/irc: remove unneeded sbrk use
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 08 Dec 2023 23:30:59 UTC
The branch main has been updated by brooks:
URL: https://cgit.FreeBSD.org/ports/commit/?id=7723e73e5ee58e3afbb05cb4423729914d04491d
commit 7723e73e5ee58e3afbb05cb4423729914d04491d
Author: Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2023-12-06 19:41:25 +0000
Commit: Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2023-12-08 23:24:17 +0000
irc/irc: remove unneeded sbrk use
It's use to print heap use, but it's often not correct for modern
allocators.
This should permit builds on aarch64 and riscv.
---
irc/irc/Makefile | 4 +---
irc/irc/files/patch-ircd_ircd.c | 42 ++++++++++++++++++++++++++++++++++++
irc/irc/files/patch-ircd_ircd__ext.h | 10 +++++++++
irc/irc/files/patch-ircd_s__debug.c | 14 ++++++++++++
4 files changed, 67 insertions(+), 3 deletions(-)
diff --git a/irc/irc/Makefile b/irc/irc/Makefile
index 3aaea6194111..a7963f4d4b9a 100644
--- a/irc/irc/Makefile
+++ b/irc/irc/Makefile
@@ -1,5 +1,6 @@
PORTNAME= irc
PORTVERSION= 2.11.2p3
+PORTREVISION= 1
CATEGORIES= irc
MASTER_SITES= http://ftp.irc.org/ftp/irc/server/ \
ftp://ftp.archive.de.uu.net/pub/mirrors/ftp.irc.org/server/ \
@@ -9,9 +10,6 @@ DISTNAME= ${PORTNAME}${PORTVERSION}
MAINTAINER= ports@FreeBSD.org
COMMENT= The "Internet Relay Chat" Server
-BROKEN_aarch64= Fails to link: missing sbrk
-BROKEN_riscv64= Fails to link: missing sbrk
-
CONFLICTS_INSTALL= charybdis ircd-hybrid Nefarious \
ru-ircd-hybrid ircd-ru
diff --git a/irc/irc/files/patch-ircd_ircd.c b/irc/irc/files/patch-ircd_ircd.c
new file mode 100644
index 000000000000..659cd6f62620
--- /dev/null
+++ b/irc/irc/files/patch-ircd_ircd.c
@@ -0,0 +1,42 @@
+--- ircd/ircd.c.orig 2023-12-06 19:33:28 UTC
++++ ircd/ircd.c
+@@ -49,7 +49,6 @@ char *debugmode = ""; /* -"- -"- -"- -"- */
+ int firstrejoindone = 0; /* Server rejoined the network after
+ start */
+ char *debugmode = ""; /* -"- -"- -"- -"- */
+-char *sbrk0; /* initial sbrk(0) */
+ char *tunefile = IRCDTUNE_PATH;
+ volatile static int dorehash = 0,
+ dorestart = 0,
+@@ -140,11 +139,9 @@ void restart(char *mesg)
+ void restart(char *mesg)
+ {
+ #ifdef USE_SYSLOG
+- (void)syslog(LOG_WARNING, "Restarting Server because: %s (%u)", mesg,
+- (u_int)((char *)sbrk((size_t)0)-sbrk0));
++ (void)syslog(LOG_WARNING, "Restarting Server because: %s", mesg);
+ #endif
+- sendto_flag(SCH_NOTICE, "Restarting server because: %s (%u)", mesg,
+- (u_int)((char *)sbrk((size_t)0)-sbrk0));
++ sendto_flag(SCH_NOTICE, "Restarting server because: %s (%u)");
+ server_reboot();
+ }
+
+@@ -175,8 +172,7 @@ void server_reboot(void)
+ {
+ Reg int i;
+
+- sendto_flag(SCH_NOTICE, "Aieeeee!!! Restarting server... (%u)",
+- (u_int)((char *)sbrk((size_t)0)-sbrk0));
++ sendto_flag(SCH_NOTICE, "Aieeeee!!! Restarting server...");
+
+ Debug((DEBUG_NOTICE,"Restarting server..."));
+ flush_connections(me.fd);
+@@ -768,7 +764,6 @@ int main(int argc, char *argv[])
+ {
+ uid_t uid, euid;
+
+- sbrk0 = (char *)sbrk((size_t)0);
+ uid = getuid();
+ euid = geteuid();
+
diff --git a/irc/irc/files/patch-ircd_ircd__ext.h b/irc/irc/files/patch-ircd_ircd__ext.h
new file mode 100644
index 000000000000..8ac5180f60aa
--- /dev/null
+++ b/irc/irc/files/patch-ircd_ircd__ext.h
@@ -0,0 +1,10 @@
+--- ircd/ircd_ext.h.orig 2023-12-06 19:35:50 UTC
++++ ircd/ircd_ext.h
+@@ -37,7 +37,6 @@ extern char *debugmode;
+ extern int debuglevel;
+ extern int bootopt;
+ extern char *debugmode;
+-extern char *sbrk0;
+ extern char *tunefile;
+ #ifdef DELAY_CLOSE
+ extern time_t nextdelayclose;
diff --git a/irc/irc/files/patch-ircd_s__debug.c b/irc/irc/files/patch-ircd_s__debug.c
new file mode 100644
index 000000000000..a25e1cd64749
--- /dev/null
+++ b/irc/irc/files/patch-ircd_s__debug.c
@@ -0,0 +1,14 @@
+--- ircd/s_debug.c.orig 2023-12-06 19:34:45 UTC
++++ ircd/s_debug.c
+@@ -687,9 +687,8 @@ void count_memory(aClient *cptr, char *nick, int debug
+ sendto_one(cptr, ":%s %d %s :TOTAL: %lu [REAL]",
+ me.name, RPL_STATSDEBUG, nick, d_tot);
+ }
+- sendto_one(cptr, ":%s %d %s :TOTAL: %d sbrk(0)-etext: %u",
+- me.name, RPL_STATSDEBUG, nick, tot,
+- (u_long)sbrk((size_t)0)-(u_long)sbrk0);
++ sendto_one(cptr, ":%s %d %s :TOTAL: %d",
++ me.name, RPL_STATSDEBUG, nick, tot);
+ return;
+ }
+