summary refs log tree commit diff
path: root/hurd/intr-rpc.awk
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1995-02-18 01:27:10 +0000
committerRoland McGrath <roland@gnu.org>1995-02-18 01:27:10 +0000
commit28f540f45bbacd939bfd07f213bcad2bf730b1bf (patch)
tree15f07c4c43d635959c6afee96bde71fb1b3614ee /hurd/intr-rpc.awk
downloadglibc-28f540f45bbacd939bfd07f213bcad2bf730b1bf.tar.gz
glibc-28f540f45bbacd939bfd07f213bcad2bf730b1bf.tar.xz
glibc-28f540f45bbacd939bfd07f213bcad2bf730b1bf.zip
initial import
Diffstat (limited to 'hurd/intr-rpc.awk')
-rw-r--r--hurd/intr-rpc.awk45
1 files changed, 45 insertions, 0 deletions
diff --git a/hurd/intr-rpc.awk b/hurd/intr-rpc.awk
new file mode 100644
index 0000000000..9dbcd6f8e2
--- /dev/null
+++ b/hurd/intr-rpc.awk
@@ -0,0 +1,45 @@
+# Icky intimate knowledge of MiG output.
+
+BEGIN \
+  {
+    nprotolines=0; proto=0;
+    args=""; echo=1; isintr=0;
+    intrcall = "__hurd_intr_rpc_" call;
+    print "#include <hurd/signal.h>";
+  }
+
+$NF == intrcall { isintr=1; }
+
+NF == 1 && $1 == ")" { proto=0; }
+proto \
+  {
+    protolines[nprotolines++] = $0;
+    arg = $NF;
+    if (substr(arg, 1, 1) == "*")
+      arg = substr(arg, 2, length(arg)-1);
+    args = args arg;
+  }
+NF == 1 && $1 == "(" { proto=1; }
+
+NF == 3 && $1 == "InP->Head.msgh_request_port" \
+  { portarg = substr($3, 1, length($3)-1); }
+
+{ print $0; }
+
+END \
+  {
+    if (isintr)
+      {
+	print "\n\n/* User-callable interrupt-handling stub.  */";
+	print "kern_return_t __" call;
+	print "(";
+	for (i = 0; i < nprotolines; ++i)
+	  print protolines[i];
+	print ")";
+	print "{";
+	print "  return HURD_EINTR_RPC (" portarg ", " \
+	  intrcall "(" args "));";
+	print "}";
+      }
+    print "weak_alias (__" call ", " call ")"
+  }