summaryrefslogtreecommitdiff
path: root/microkernel/mach/gnumach/interface
diff options
context:
space:
mode:
Diffstat (limited to 'microkernel/mach/gnumach/interface')
-rw-r--r--microkernel/mach/gnumach/interface/syscall/mach_print.mdwn8
-rw-r--r--microkernel/mach/gnumach/interface/syscall/mach_print/Makefile9
-rw-r--r--microkernel/mach/gnumach/interface/syscall/mach_print/mach_print.S3
-rw-r--r--microkernel/mach/gnumach/interface/syscall/mach_print/main.c21
4 files changed, 41 insertions, 0 deletions
diff --git a/microkernel/mach/gnumach/interface/syscall/mach_print.mdwn b/microkernel/mach/gnumach/interface/syscall/mach_print.mdwn
index c0b0d0b3..ca52dca5 100644
--- a/microkernel/mach/gnumach/interface/syscall/mach_print.mdwn
+++ b/microkernel/mach/gnumach/interface/syscall/mach_print.mdwn
@@ -51,3 +51,11 @@ License|/fdl]]."]]"""]]
<youpi> k
<braunr> if it's fine with you, i'll commit it too
<youpi> I'm fine
+
+
+## IRC, freenode, #hurd, 2013-04-07
+
+ <braunr> see http://www.sceen.net/~rbraun/mach_print/ for an example to use
+ it
+
+[[Makefile]], [[mach_print.S]], [[main.c]].
diff --git a/microkernel/mach/gnumach/interface/syscall/mach_print/Makefile b/microkernel/mach/gnumach/interface/syscall/mach_print/Makefile
new file mode 100644
index 00000000..8590ef7f
--- /dev/null
+++ b/microkernel/mach/gnumach/interface/syscall/mach_print/Makefile
@@ -0,0 +1,9 @@
+CFLAGS = -O0 -g3
+
+mach_print: main.o mach_print.o
+ gcc -o mach_print main.o mach_print.o
+
+clean:
+ rm -f mach_print *.o
+
+.PHONY: clean
diff --git a/microkernel/mach/gnumach/interface/syscall/mach_print/mach_print.S b/microkernel/mach/gnumach/interface/syscall/mach_print/mach_print.S
new file mode 100644
index 00000000..606a66e6
--- /dev/null
+++ b/microkernel/mach/gnumach/interface/syscall/mach_print/mach_print.S
@@ -0,0 +1,3 @@
+#include <mach/machine/syscall_sw.h>
+
+kernel_trap(mach_print,-30,1)
diff --git a/microkernel/mach/gnumach/interface/syscall/mach_print/main.c b/microkernel/mach/gnumach/interface/syscall/mach_print/main.c
new file mode 100644
index 00000000..23b9fc88
--- /dev/null
+++ b/microkernel/mach/gnumach/interface/syscall/mach_print/main.c
@@ -0,0 +1,21 @@
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+void mach_print(char *);
+
+int
+main(int argc, char *argv[])
+{
+ int size;
+ char *s;
+
+ size = snprintf(NULL, 0, "%s\n", argv[1]);
+ assert(size > 0);
+ s = malloc(size);
+ assert(s != NULL);
+ sprintf(s, "%s\n", argv[1]);
+ mach_print(s);
+ free(s);
+ return EXIT_SUCCESS;
+}