Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/rump/include/rump Generate rump_errno2host(): translates...
details: https://anonhg.NetBSD.org/src/rev/7ef23ed75532
branches: trunk
changeset: 810723:7ef23ed75532
user: pooka <pooka%NetBSD.org@localhost>
date: Tue Sep 15 14:55:12 2015 +0000
description:
Generate rump_errno2host(): translates rump kernel errnos to host errnos.
Essentially, it's a partial I-know-what-I'm-doing syscall compat.
Functionality requested by Robert Millan.
diffstat:
sys/rump/include/rump/makerumpdefs.sh | 46 ++++++++++++++++++++++++++++++++--
1 files changed, 43 insertions(+), 3 deletions(-)
diffs (71 lines):
diff -r 24b5edc0604a -r 7ef23ed75532 sys/rump/include/rump/makerumpdefs.sh
--- a/sys/rump/include/rump/makerumpdefs.sh Tue Sep 15 09:51:01 2015 +0000
+++ b/sys/rump/include/rump/makerumpdefs.sh Tue Sep 15 14:55:12 2015 +0000
@@ -8,7 +8,7 @@
rm -f rumpdefs.h
exec 3>&1 > rumpdefs.h
-printf '/* $NetBSD: makerumpdefs.sh,v 1.27 2015/09/10 16:21:32 pooka Exp $ */\n\n'
+printf '/* $NetBSD: makerumpdefs.sh,v 1.28 2015/09/15 14:55:12 pooka Exp $ */\n\n'
printf '/*\n *\tAUTOMATICALLY GENERATED. DO NOT EDIT.\n */\n\n'
printf '#ifndef _RUMP_RUMPDEFS_H_\n'
printf '#define _RUMP_RUMPDEFS_H_\n\n'
@@ -126,11 +126,11 @@
printf '\n#endif /* _RUMP_RUMPDEFS_H_ */\n'
exec 1>&3
+
echo Generating rumperr.h
rm -f rumperr.h
exec > rumperr.h
-
-printf '/* $NetBSD: makerumpdefs.sh,v 1.27 2015/09/10 16:21:32 pooka Exp $ */\n\n'
+printf '/* $NetBSD: makerumpdefs.sh,v 1.28 2015/09/15 14:55:12 pooka Exp $ */\n\n'
printf '/*\n *\tAUTOMATICALLY GENERATED. DO NOT EDIT.\n */\n'
fromvers ../../../sys/errno.h
@@ -168,4 +168,44 @@
exit 1
fi
+echo Generating rumperrno2host.h 1>&3
+rm -f rumperrno2host.h
+exec > rumperrno2host.h
+printf '/* $NetBSD: makerumpdefs.sh,v 1.28 2015/09/15 14:55:12 pooka Exp $ */\n\n'
+printf '/*\n *\tAUTOMATICALLY GENERATED. DO NOT EDIT.\n */\n'
+
+fromvers ../../../sys/errno.h
+
+printf "\n#ifndef ERANGE\n#error include ISO C style errno.h first\n#endif\n"
+printf "\nstatic inline int \nrump_errno2host(int rumperrno)\n{\n\n"
+printf "\tswitch (rumperrno) {\n\tcase 0:\n"
+printf "\t\t return 0;\n"
+awk '/^#define[ ]*E.*[0-9]/{
+ ename = $2
+ evalue = $3
+ error = 1
+ if (ename == "ELAST") {
+ printf "\tdefault:\n"
+ printf "#ifdef EINVAL\n\t\treturn EINVAL;\n"
+ printf "#else\n\t\treturn ERANGE;\n#endif\n"
+ printf "\t}\n}\n"
+ error = 0
+ exit 0
+ }
+ if (preverror + 1 != evalue)
+ exit 1
+ preverror = evalue
+ printf "#ifdef %s\n", ename
+ printf "\tcase %d:\n\t\treturn %s;\n", evalue, ename
+ printf "#endif\n"
+}
+END {
+ exit error
+}' < ../../../sys/errno.h
+if [ $? -ne 0 ]; then
+ echo 'Parsing errno.h failed!' 1>&3
+ rm -f rumpdefs.h rumperr.h rumperrno2host.h
+ exit 1
+fi
+
exit 0
Home |
Main Index |
Thread Index |
Old Index