package sysvinit-utils
severity 576443 important
tags 576443 +kfreebsd
thanks
The GNU/Linux form of the TIOCCONS call using ioctl()
is incompatible to the form mandated by all BSD systems,
therefore bootlogd(8) fails at startup with kfreebsd-any.
The following patch partially mends this, so far as to
capture only messages from "ifupdown" in "/var/log/boot"
on a kfreebsd-amd64 system, which is already an substantial
improvement.
Booting said system still leaves a message on the console:
pid 133(bootlogd) is using legacy pty devices - not logging anymore
I do not understand the origin of this, but I suspect strongly
that it is a linuxism in the sysvinit source code. The collective
knowledge of the debian-bsd list will surely provide more insight.
Best regards,
Mats Erik Andersson, DM
(Still convinced that "bootlogd" should __not__ be kept "optional"!)
Description: Adapt TIOCCONS call to kfreebsd.
Isolate Linux-only forms of ioctl call with
TIOCCONS. The BSD form of this needs a pointer
to an integer, and its fails with a NULL pointer.
Author: Mats Erik Andersson
Last-Update: 2012-04-03
--- sysvinit-2.88dsf.debian/src/bootlogd.c
+++ sysvinit-2.88dsf/src/bootlogd.c
@@ -482,6 +482,9 @@
int realfd;
int n, m, i;
int todo;
+#ifndef __linux__ /* BSD-style ioctl needs an argument. */
+ int on = 1;
+#endif
fp = NULL;
logfile = LOGFILE;
@@ -554,15 +557,20 @@
return 1;
}
+#ifdef __linux__
(void)ioctl(0, TIOCCONS, NULL);
-#if 1
/* Work around bug in 2.1/2.2 kernels. Fixed in 2.2.13 and 2.3.18 */
if ((n = open("/dev/tty0", O_RDWR)) >= 0) {
(void)ioctl(n, TIOCCONS, NULL);
close(n);
}
#endif
- if (ioctl(pts, TIOCCONS, NULL) < 0) {
+#ifdef __linux__
+ if (ioctl(pts, TIOCCONS, NULL) < 0)
+#else /* BSD usage of ioctl TIOCCONS. */
+ if (ioctl(pts, TIOCCONS, &on) < 0)
+#endif
+ {
fprintf(stderr, "bootlogd: ioctl(%s, TIOCCONS): %s\n",
buf, strerror(errno));
return 1;