Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 31 Oct 2008 17:46:23 +0100
From:      Thierry Herbelot <thierry.herbelot@free.fr>
To:        hackers@freebsd.org
Cc:        current ML <current@freebsd.org>
Subject:   strange behaviour with /sbin/init and serial console
Message-ID:  <200810311746.23743.thierry.herbelot@free.fr>

next in thread | raw e-mail | index | archive | help
Hello,

with the following patch on /sbin/init, I have two different behaviours 
depending on the console type (on a i386/32 PC) :
- on a video console, I see the expected two messages,
- on a serial console, the messages are not displayed (init silently finishes 
its job and gets to start /etc/rc and everything)

I assume that the writev system call is implemented in 
src/sys/kern/tty_cons.c::cnwrite(), but I could not parse the code to find an 
explanation.

	any taker ?

	TfH

PS : this is initially for a RELENG_6 machine, but the code is quite similar 
under RELENG_7 or Current

--- usr/src/sbin/init/init.c.ori    2008-10-31 14:20:48.294794898 +0100
+++ usr/src/sbin/init/init.c        2008-10-31 14:12:16.168062031 +0100
@@ -44,6 +44,8 @@
   "$FreeBSD: src/sbin/init/init.c,v 1.60.2.2 2006/07/08 15:34:27 kib Exp $";
 #endif /* not lint */

+#include <sys/types.h>
+
 #include <sys/param.h>
 #include <sys/ioctl.h>
 #include <sys/mount.h>
@@ -239,6 +241,23 @@
         */
        openlog("init", LOG_CONS|LOG_ODELAY, LOG_AUTH);

+       warning("warning after openlog");
+{
+int fd;
+          if ((fd = open("/dev/console", O_WRONLY|O_NONBLOCK, 0)) >= 0) {
+               struct iovec iov[2];
+               struct iovec *v = iov;
+
+               v->iov_base = (void *)"iov direct write test";
+               v->iov_len = 21;
+               ++v;
+               v->iov_base = (void *)"\r\n";
+               v->iov_len = 2;
+               (void)writev(fd, iov, 2);
+               (void)close(fd);
+       }
+
+}
        /*
         * Create an initial session.
         */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200810311746.23743.thierry.herbelot>