Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756811AbYACN2S (ORCPT ); Thu, 3 Jan 2008 08:28:18 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752955AbYACN2A (ORCPT ); Thu, 3 Jan 2008 08:28:00 -0500 Received: from sovereign.computergmbh.de ([85.214.69.204]:34063 "EHLO sovereign.computergmbh.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752269AbYACN17 (ORCPT ); Thu, 3 Jan 2008 08:27:59 -0500 Date: Thu, 3 Jan 2008 14:27:57 +0100 (CET) From: Jan Engelhardt To: devzero@web.de cc: linux-kernel@vger.kernel.org Subject: Re: serial console _after_ boot ? - was: Redirect kernel console In-Reply-To: <83531397@web.de> Message-ID: References: <83531397@web.de> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1079 Lines: 33 On Jan 3 2008 13:43, devzero@web.de wrote: > >hi ! > >i was wondering how to make kernel messages appear on /dev/ttyS0 without a reboot, i.e. kernelparam "console=ttyS0" The solution is simple... the following piece of code is inside opensuse-10.3/src/sysvinit-2.86-115.src.rpm#showconsole-1.08.tar.bz2#showconsole-1.08/blogd.c (void)ioctl(0, TIOCCONS, NULL); /* Undo any current map if any */ if (ioctl(pts, TIOCCONS, NULL) < 0) error("can not set console device to %s: %s\n", ptsname, strerror(errno)); so I suppose that's it. Write up a new program that calls the ioctl on a tty, and you should be done. IOW: #include #include #include #include int main(void) { int fd = open("/dev/ttyS0", O_RDWR); ioctl(0, TIOCCONS, NULL); ioctl(fd, TIOCCONS, NULL); } -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/