Browse Source

Add test alarm program that fails

This is a simple program that fails, badly, to use
an alarm. I suspect this is why we're seeing other issues
on things like ipconfig when they time out.

We can focus on fixing this and it may help on other code.

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Ronald G. Minnich 8 years ago
parent
commit
57cf34c409
4 changed files with 41 additions and 3 deletions
  1. 1 1
      BUILD
  2. 10 2
      BUILD.conf
  3. 1 0
      sys/src/9/k10/k8cpu
  4. 29 0
      sys/src/cmd/testalarm.c

+ 1 - 1
BUILD

@@ -220,7 +220,7 @@ compile_kernel()
 
 	## Rest of programs into ramfs ##
 
-	RAMFS_LIST="bind mount echo cat cp ls ip/ipconfig/ipconfig ip/ping ip/telnet ip/dhcpclient srv ps mkdir pwd chmod rio/rio date dd aux/vga/vga"
+	RAMFS_LIST="bind mount echo cat cp ls ip/ipconfig/ipconfig ip/ping ip/telnet ip/dhcpclient srv ps mkdir pwd chmod rio/rio date dd aux/vga/vga testalarm"
 
 	for elem in $RAMFS_LIST
 	do

+ 10 - 2
BUILD.conf

@@ -53,8 +53,7 @@ BUILD_LIBS="lib9p libString libauth libauthsrv libavl libbin libbio libcomplete
 BUILD_KLIBS="libc libip libdraw"
 
 ### CMD ###
-BUILD_CMD="rc bind mount cat cp echo ls ipconfig ps mkdir pwd chmod rio date dd vga ping telnet dhcpclient srv"
-
+BUILD_CMD="rc bind mount cat cp echo ls ipconfig ps mkdir pwd chmod rio date dd vga ping telnet dhcpclient srv testalarm"
 
 
 ### functions ###
@@ -229,6 +228,15 @@ cmd_echo()
 	LDFLAGS_EXTRA="-static -e_main"
 }
 
+cmd_testalarm()
+{
+	BUILD_IN="testalarm.c"
+	BUILD_OUT="testalarm.elf.out"
+	CLEAN_COM="rm -f *.o"
+	LIBS_TO_LINK="libc"
+	LDFLAGS_EXTRA="-static -e_main"
+}
+
 cmd_cat()
 {
 	BUILD_IN="cat.c"

+ 1 - 0
sys/src/9/k10/k8cpu

@@ -135,6 +135,7 @@ rootdir
 	/amd64/bin/date
 	/amd64/bin/dd
 	/amd64/bin/vga
+	/amd64/bin/testalarm
 #	../root/nvram nvram
 
 conf

+ 29 - 0
sys/src/cmd/testalarm.c

@@ -0,0 +1,29 @@
+/*
+ * This file is part of the UCB release of Plan 9. It is subject to the license
+ * terms in the LICENSE file found in the top-level directory of this
+ * distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
+ * part of the UCB release of Plan 9, including this file, may be copied,
+ * modified, propagated, or distributed except according to the terms contained
+ * in the LICENSE file.
+ */
+
+#include <u.h>
+#include <libc.h>
+
+static int
+catch(void *p, char *s)
+{
+	print("catch %p %s\n", p, s);
+}
+
+void
+main(int argc, char *argv[])
+{
+	notify(catch);
+
+	alarm(5);
+	while (1)
+		;
+	exits(0);
+}
+