aboutsummaryrefslogtreecommitdiff
path: root/lkm
diff options
context:
space:
mode:
authorKazutaka YOKOTA <yokota@FreeBSD.org>1997-06-24 12:43:18 +0000
committerKazutaka YOKOTA <yokota@FreeBSD.org>1997-06-24 12:43:18 +0000
commitf4863d1a23a74635ad1c56a4d725e1bb062839a4 (patch)
tree9990e26fc2f933deab4850fe05f540520a354210 /lkm
parent46b2c55966ceb21c21e82e857bd47a6654e3bb3f (diff)
downloadsrc-f4863d1a23a74635ad1c56a4d725e1bb062839a4.tar.gz
src-f4863d1a23a74635ad1c56a4d725e1bb062839a4.zip
Take the OS release string from the kernel variable `osrelease'
rather than hard-code it in the message text. Optinally include the host name in the message if SHOW_HOSTNAME is defined. The origianl idea and sample code submitted by Angelo Turetta <ATuretta@stylo.it>.
Notes
Notes: svn path=/head/; revision=26893
Diffstat (limited to 'lkm')
-rw-r--r--lkm/syscons/daemon/Makefile8
-rw-r--r--lkm/syscons/daemon/daemon_saver.c31
2 files changed, 34 insertions, 5 deletions
diff --git a/lkm/syscons/daemon/Makefile b/lkm/syscons/daemon/Makefile
index 57526c0b0c18..3c5a3205ded9 100644
--- a/lkm/syscons/daemon/Makefile
+++ b/lkm/syscons/daemon/Makefile
@@ -1,4 +1,4 @@
-# $Id$
+# $Id: Makefile,v 1.1 1997/05/21 14:18:26 yokota Exp $
KMOD= daemon_saver_mod
SRCS= daemon_saver.c
@@ -6,4 +6,10 @@ SRCS= daemon_saver.c
NOMAN=
CFLAGS+= -DLKM -I${.CURDIR}/.. -I${.CURDIR}/../../../sys
+# Omits the bouncing message text and shows only the daemon.
+#CFLAGS+= -DDAEMON_ONLY
+
+# Includes the host name in the message text.
+#CFLAGS+= -DSHOW_HOSTNAME
+
.include <bsd.kmod.mk>
diff --git a/lkm/syscons/daemon/daemon_saver.c b/lkm/syscons/daemon/daemon_saver.c
index 921044c44689..232f41689369 100644
--- a/lkm/syscons/daemon/daemon_saver.c
+++ b/lkm/syscons/daemon/daemon_saver.c
@@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: daemon_saver.c,v 1.2 1997/05/24 01:44:39 yokota Exp $
+ * $Id: daemon_saver.c,v 1.4 1997/05/26 01:02:41 yokota Exp $
*/
#include <sys/param.h>
@@ -35,6 +35,9 @@
#include <sys/sysent.h>
#include <sys/lkm.h>
#include <sys/errno.h>
+#include <sys/kernel.h>
+#include <sys/sysctl.h>
+#include <sys/malloc.h>
#include <machine/md_var.h>
@@ -150,6 +153,9 @@ draw_daemon(int xpos, int ypos, int dxdir)
}
#ifndef DAEMON_ONLY
+static char *message;
+static int messagelen;
+
static void
draw_string(int xpos, int ypos, char *s, int len)
{
@@ -165,7 +171,6 @@ static void
daemon_saver(int blank)
{
#ifndef DAEMON_ONLY
- static const char message[] = {"FreeBSD 3.0 CURRENT"};
static int txpos = 10, typos = 10;
static int txdir = -1, tydir = -1;
#endif
@@ -201,7 +206,7 @@ daemon_saver(int blank)
#ifndef DAEMON_ONLY
if (txdir > 0) {
- if (txpos == scp->xsize - sizeof(message)-1)
+ if (txpos == scp->xsize - messagelen)
txdir = -1;
} else {
if (txpos == 0) txdir = 1;
@@ -217,7 +222,7 @@ daemon_saver(int blank)
draw_daemon(dxpos, dypos, dxdir);
#ifndef DAEMON_ONLY
- draw_string(txpos, typos, (char *)message, sizeof(message)-1);
+ draw_string(txpos, typos, (char *)message, messagelen);
#endif
} else {
if (scrn_blanked) {
@@ -232,9 +237,25 @@ daemon_saver(int blank)
static int
daemon_saver_load(struct lkm_table *lkmtp, int cmd)
{
+#ifdef SHOW_HOSTNAME
+ static const char *freebsd = " - FreeBSD ";
+#else
+ static const char *freebsd = "FreeBSD ";
+#endif /* SHOW_HOSTNAME */
+
(*current_saver)(0);
old_saver = current_saver;
current_saver = daemon_saver;
+
+#ifdef SHOW_HOSTNAME
+ messagelen = strlen(hostname) + strlen(freebsd) + strlen(osrelease);
+ message = malloc(messagelen + 1, M_DEVBUF, M_NOWAIT);
+ sprintf(message, "%s%s%s", hostname, freebsd, osrelease);
+#else
+ messagelen = strlen(freebsd) + strlen(osrelease);
+ message = malloc(messagelen + 1, M_DEVBUF, M_NOWAIT);
+ sprintf(message, "%s%s", freebsd, osrelease);
+#endif /* SHOW_HOSTNAME */
return 0;
}
@@ -243,6 +264,8 @@ daemon_saver_unload(struct lkm_table *lkmtp, int cmd)
{
(*current_saver)(0);
current_saver = old_saver;
+
+ free(message, M_DEVBUF);
return 0;
}