Updated bootlogd and init to better compile and run on GNU/kFreeBSD.

This commit is contained in:
Jesse Smith 2018-02-20 19:30:46 -04:00
parent 80dbcf3de3
commit f52d703c8e
2 changed files with 12 additions and 4 deletions

View File

@ -489,6 +489,9 @@ int main(int argc, char **argv)
int realfd; int realfd;
int n, m, i; int n, m, i;
int todo; int todo;
#ifndef __linux__ /* BSD-style ioctl needs an argument. */
int on = 1;
#endif
fp = NULL; fp = NULL;
logfile = LOGFILE; logfile = LOGFILE;
@ -561,15 +564,20 @@ int main(int argc, char **argv)
return 1; return 1;
} }
#ifdef __linux__
(void)ioctl(0, TIOCCONS, NULL); (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 */ /* 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) { if ((n = open("/dev/tty0", O_RDWR)) >= 0) {
(void)ioctl(n, TIOCCONS, NULL); (void)ioctl(n, TIOCCONS, NULL);
close(n); close(n);
} }
#endif #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", fprintf(stderr, "bootlogd: ioctl(%s, TIOCCONS): %s\n",
buf, strerror(errno)); buf, strerror(errno));
return 1; return 1;

View File

@ -753,11 +753,11 @@ void console_stty(void)
#ifdef __FreeBSD_kernel__ #ifdef __FreeBSD_kernel__
/* /*
* The kernel of FreeBSD expects userland to set TERM. Usually, we want * The kernel of FreeBSD expects userland to set TERM. Usually, we want
* "cons25". Later, gettys might disagree on this (i.e. we're not using * "xterm". Later, gettys might disagree on this (i.e. we're not using
* syscons) but some boot scripts, like /etc/init.d/xserver-xorg, still * syscons) but some boot scripts, like /etc/init.d/xserver-xorg, still
* need a non-dumb terminal. * need a non-dumb terminal.
*/ */
putenv ("TERM=cons25"); putenv ("TERM=xterm");
#endif #endif
(void) tcgetattr(fd, &tty); (void) tcgetattr(fd, &tty);