Skip to contentSkip to conversation

Patches for kFreeBSD support from Debian

PATCH Applied Andreas Henriksson 2 participants 7 messages Aug 24, 2014 – Sep 17, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover Patches for kFreeBSD support from Debian

Hello!

This is the patch set that has been shipping since forever in Debian (minus the last one from me, which is new). The patches where against util-linux 2.20.x before I rebased them against current master.

I've failed to get the original patch authors to sign off and submit their own patches, but as discussed on irc I'm forwarding them to you 'as is'.

Andreas Henriksson (1):
kFreeBSD: add hacks in ipcrm to avoid FTBFS

Aurelien Jarno (1):
remaining kFreeBSD hackery for building.

Christoph Egger (1):
Fixing FTBFS on !linux (Debian util-linux 2.20.1-1.2)

Robert Millan (1):
Report correct disk size on GNU/kFreeBSD. Thanks Tuco.

 include/ttyutils.h       | 40 ++++++++++++++++++++++++++++++++++++++++
 lib/blkdev.c             |  4 ++++
 sys-utils/ipcrm.c        |  7 +++++++
 sys-utils/ipcs.c         |  2 ++
 term-utils/Makemodule.am |  1 +
 term-utils/agetty.c      | 16 ++++++++++++++++
 6 files changed, 70 insertions(+)
Signature · 1 line
2.1.0.rc1
#1 lore raw

PATCH 1/4 Report correct disk size on GNU/kFreeBSD. Thanks Tuco.

From: Robert Millan <[email protected]>

Addresses-Debian-Bug: 592292

---
 lib/blkdev.c | 4 ++++
 1 file changed, 4 insertions(+)
lib/blkdev.c +4 -0
index f8182c0..a293529 100644
@@ -25,6 +25,10 @@
 #include <sys/disk.h>
 #endif
 
+#ifdef __FreeBSD_kernel__
+#include <sys/disk.h>
+#endif
+
 #include "blkdev.h"
 #include "c.h"
 #include "linux_version.h"
Signature · 1 line
2.1.0.rc1
#2 lore raw

PATCH 2/4 remaining kFreeBSD hackery for building.

In reply to Andreas Henriksson

From: Aurelien Jarno <[email protected]>

Addresses-Debian-Bug: #527384

---
 sys-utils/ipcs.c | 2 ++
 1 file changed, 2 insertions(+)
sys-utils/ipcs.c +2 -0
index 8ed5698..9ce5366 100644
@@ -461,8 +461,10 @@ static void do_msg (char format, int unit)
 			return;
 		}
 		printf (_("------ Messages Status --------\n"));
+#ifndef __FreeBSD_kernel__
 		printf (_("allocated queues = %d\n"), msginfo.msgpool);
 		printf (_("used headers = %d\n"), msginfo.msgmap);
+#endif
 		ipc_print_size(unit, _("used space"), msginfo.msgtql,
 			       unit == IPC_UNIT_DEFAULT ? _(" bytes\n") : "\n", 0);
 		return;
Signature · 1 line
2.1.0.rc1
#3 lore raw

PATCH 3/4 Fixing FTBFS on !linux (Debian util-linux 2.20.1-1.2)

In reply to Andreas Henriksson

From: Christoph Egger <[email protected]>

Handle vc flags missing on FreeBSD
Fix tty creation on kFreeBSD taking patch from 2.19

Addresses-Debian-Bug: #650185

---
 include/ttyutils.h       | 40 ++++++++++++++++++++++++++++++++++++++++
 term-utils/Makemodule.am |  1 +
 term-utils/agetty.c      | 16 ++++++++++++++++
 3 files changed, 57 insertions(+)
include/ttyutils.h +40 -0
index 4f2fd88..e842f9f 100644
@@ -74,6 +74,46 @@ static inline void reset_virtual_console(struct termios *tp, int flags)
 	/* Sane setting, allow eight bit characters, no carriage return delay
 	 * the same result as `stty sane cr0 pass8'
 	 */
+#ifndef IUCLC
+# define IUCLC 0
+#endif
+#ifndef NL0
+# define NL0 0
+#endif
+#ifndef CR0
+# define CR0 0
+#endif
+#ifndef BS0
+# define BS0 0
+#endif
+#ifndef VT0
+# define VT0 0
+#endif
+#ifndef FF0
+# define FF0 0
+#endif
+#ifndef OLCUC
+# define OLCUC 0
+#endif
+#ifndef OFILL
+# define OFILL 0
+#endif
+#ifndef NLDLY
+# define NLDLY 0
+#endif
+#ifndef CRDLY
+# define CRDLY 0
+#endif
+#ifndef BSDLY
+# define BSDLY 0
+#endif
+#ifndef VTDLY
+# define VTDLY 0
+#endif
+#ifndef FFDLY
+# define FFDLY 0
+#endif
+
 	tp->c_iflag |=  (BRKINT | ICRNL | IMAXBEL);
 	tp->c_iflag &= ~(IGNBRK | INLCR | IGNCR | IXOFF | IUCLC | IXANY | ISTRIP);
 	tp->c_oflag |=  (OPOST | ONLCR | NL0 | CR0 | TAB0 | BS0 | VT0 | FF0);
term-utils/Makemodule.am +1 -0
index 5c73f3e..627aca0 100644
@@ -23,6 +23,7 @@ sbin_PROGRAMS += agetty
 dist_man_MANS += term-utils/agetty.8
 agetty_SOURCES = term-utils/agetty.c
 agetty_LDADD = $(LDADD) libcommon.la
+agetty_LDADD += -lutil
 endif # BUILD_AGETTY
 
 
term-utils/agetty.c +16 -0
index 3c30a5f..a7044f0 100644
@@ -10,6 +10,7 @@
  *
  * This program is freely distributable.
  */
+
 #include <stdio.h>
 #include <unistd.h>
 #include <stdlib.h>
@@ -44,6 +45,12 @@
 #include "widechar.h"
 #include "ttyutils.h"
 
+#if defined(__FreeBSD_kernel__)
+#include <pty.h>
+#include <sys/param.h>
+#endif
+
+
 #ifdef __linux__
 #  include <sys/kd.h>
 #  include <sys/param.h>
@@ -76,6 +83,10 @@
 #  endif
 #endif
 
+#ifdef __FreeBSD_kernel__
+#define USE_SYSLOG
+#endif
+
 /* If USE_SYSLOG is undefined all diagnostics go to /dev/console. */
 #ifdef	USE_SYSLOG
 #  include <syslog.h>
@@ -1110,6 +1121,11 @@ static void open_tty(char *tty, struct termios *tp, struct options *op)
 			op->term = DEFAULT_TTYS1;
 	}
 #endif
+
+#if defined(__FreeBSD_kernel__)
+	login_tty (0);
+#endif
+
 	/*
 	 * Detect if this is a virtual console or serial/modem line.
 	 * In case of a virtual console the ioctl KDGKBMODE succeeds
Signature · 1 line
2.1.0.rc1
#4 lore raw

PATCH 4/4 kFreeBSD: add hacks in ipcrm to avoid FTBFS

In reply to Andreas Henriksson
---
 sys-utils/ipcrm.c | 7 +++++++
 1 file changed, 7 insertions(+)
sys-utils/ipcrm.c +7 -0
index aa58172..6443f48 100644
@@ -271,6 +271,13 @@ static int remove_all(type_id type)
 			ret |= remove_id(SEM, 0, rm_me);
 		}
 	}
+/* kFreeBSD hackery -- ah 20140723 */
+#ifndef MSG_STAT
+#define MSG_STAT 11
+#endif
+#ifndef MSG_INFO
+#define MSG_INFO 12
+#endif
 	if (type == MSG || type == ALL) {
 		maxid =
 		    msgctl(0, MSG_INFO, (struct msqid_ds *)(void *)&msginfo);
Signature · 1 line
2.1.0.rc1
maintainer Applied
#5 lore raw
In reply to Andreas Henriksson
Quoted 2 lines · Andreas Henriksson

This is the patch set that has been shipping since forever in Debian (minus the last one from me, which is new).

Applied, thanks.

Quoted 2 lines

Christoph Egger (1):
Fixing FTBFS on !linux (Debian util-linux 2.20.1-1.2)

-lutil everywhere seems like overkill as login_tty() is probably necessary for BSD only, so I have applied the patch below too.

Karel

commit 8026fa9bc7525c4cef02c17099e2db79284078f8

Author: Karel Zak <[email protected]>
Date:   Wed Sep 17 10:56:46 2014 +0200

build-sys: use -lutil for BSD only

configure.ac +9 -1
index 5b558ec..387372f 100644
@@ -136,9 +136,17 @@ PKG_PROG_PKG_CONFIG
 GTK_DOC_CHECK([1.10])
 AC_PATH_PROG([XSLTPROC], [xsltproc])
 
+
 linux_os=no
-AS_CASE([${host_os}], [*linux*], [linux_os=yes])
+bsd_os=no
+AS_CASE([${host_os}],
+  [*linux*],
+     [linux_os=yes],
+  [*bsd*],
+     [bsd_os=yes])
 AM_CONDITIONAL([LINUX], [test "x$linux_os" = xyes])
+AM_CONDITIONAL([BSD], [test "x$bsd_os" = xyes])
+
 
 dnl define ARCH_<NAME> conditionals
 UL_SET_ARCH([I86], [i?86-*])
term-utils/Makemodule.am +2 -0
index 627aca0..e7ac707 100644
@@ -23,7 +23,9 @@ sbin_PROGRAMS += agetty
 dist_man_MANS += term-utils/agetty.8
 agetty_SOURCES = term-utils/agetty.c
 agetty_LDADD = $(LDADD) libcommon.la
+if BSD
 agetty_LDADD += -lutil
+endif
 endif # BUILD_AGETTY
 
 
Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com
#6 lore raw

Hello Karel Zak!

Thanks for reviewing/merging these. I'll try to find time to do a test-build on a kfreebsd machine and also forward you the libmount/fsck related patches soon.

On Wed, Sep 17, 2014 at 11:00:10AM +0200, Karel Zak wrote:
[...]

Quoted 7 lines
Quoted 2 lines

Christoph Egger (1):
Fixing FTBFS on !linux (Debian util-linux 2.20.1-1.2)

-lutil everywhere seems like overkill as login_tty() is probably necessary for BSD only, so I have applied the patch below too.

Karel

You are probably right! This is from the i386 build logs in Debian:

[...]
dh_shlibdeps -a
dpkg-shlibdeps: warning: package could avoid a useless dependency if debian/util-linux/sbin/agetty was not linked against libutil.so.1 (it uses none of the library's symbols)
dpkg-shlibdeps: warning: package could avoid a useless dependency if debian/bsdutils/usr/bin/logger was not linked against libsystemd-id128.so.0 (it uses none of the library's symbols)
dh_installdeb -a
[...]

Full log at:
https://buildd.debian.org/status/fetch.php?pkg=util-linux&arch=i386&ver=2.25.1-1&stamp=1410137520

Regards,
Andreas Henriksson