Annotation of src/sys/rump/makerumpsyscalls.sh, Revision 1.2
1.1 pooka 1: #!/bin/sh
2: #
1.2 ! pooka 3: # $NetBSD: makerumpsyscalls.sh,v 1.1 2014/04/27 15:05:30 pooka Exp $
1.1 pooka 4: #
5:
6: #
7: # This utility generates component-specific initializers for the
8: # rump kernel syscall vector.
9: #
10: # Procedure is:
11: # 1) edit syscalls.master
12: # 2) run makesyscalls.sh
13: # 3) do a build in sys/rump
14: # 4) run this script
15: # 5) commit results
16: #
17:
18: # default, override by giving argument
19: LIBDIR=/usr/lib
20:
21: SYSCOMPONENT_librump=librump/rumpkern/rumpkern_syscalls.c
22: SYSCOMPONENT_librumpnet=librump/rumpnet/rumpnet_syscalls.c
23: SYSCOMPONENT_librumpvfs=librump/rumpvfs/rumpvfs_syscalls.c
24:
25: die ()
26: {
27:
28: echo '>> ERROR:' $*
29: exit 1
30: }
31:
32: [ -f "./rump.sysmap" ] || die rump.sysmap not found
33: [ -f "./Makefile.rump" ] || die run script in src/sys/rump
34: [ -z "${1}" ] || LIBDIR=$1
35:
36: #
37: # BEGIN
38: #
39:
40: IFS=' '
41: AWKPROG='BEGIN {
42: while ((getline < "rump.sysmap") == 1) {
43: if ($2 != "sys_nomodule")
44: syscalls[$2] = $1
45: }
46: }
47:
48: $5 == "GLOBAL" && $7 != "UND" {
49: sub("rumpns_", "", $8)
50: if (syscalls[$8] != 0)
51: results[$8] = 1
52: }
53:
54: END {
55: for (res in results) {
56: printf "%d %s\n", syscalls[res], res | "sort -n"
57: }
58: }
59: '
60:
1.2 ! pooka 61: SYSCOMP_HDR='/* $NetBSD: makerumpsyscalls.sh,v 1.1 2014/04/27 15:05:30 pooka Exp $ */
1.1 pooka 62:
63: /* AUTOMATICALLY GENERATED BY makerumpsyscalls.sh */
64:
65: #include <sys/cdefs.h>
1.2 ! pooka 66: __KERNEL_RCSID(0, "$NetBSD: makerumpsyscalls.sh,v 1.1 2014/04/27 15:05:30 pooka Exp $");
1.1 pooka 67:
68: #include <sys/param.h>
69:
70: #include "rump_private.h"
71: '
72:
73: SYSCOMP_BODY='
74: RUMP_COMPONENT(RUMP_COMPONENT_SYSCALL)
75: {
76:
77: rump_syscall_boot_establish(mysys, __arraycount(mysys));
78: }'
79:
80: makesyscomponent ()
81: {
82:
83: echo Generating $1
84: exec 3>&1 >${1}
85:
86: echo "${SYSCOMP_HDR}"
87:
1.2 ! pooka 88: echo ${2} | awk '{printf "extern sy_call_t %s;\n", $2}'
1.1 pooka 89: printf '\nstatic const struct rump_onesyscall mysys[] = {\n'
90: echo ${2} | awk '{printf "\t{ %d,\t%s },\n", $1, $2}'
91: printf '};\n'
92:
93: echo "${SYSCOMP_BODY}"
94:
95: exec 1>&3
96: }
97:
98: sawlibrump=false
99: for file in ${LIBDIR}/librump*.so ; do
100: b=$(basename ${file})
101: b=${b%%.*}
102: res=$(readelf -W --syms ${file} | awk "${AWKPROG}")
103: if [ ! -z "${res}" ]; then
104: eval outname=\${SYSCOMPONENT_${b}}
105: [ -z "${outname}" ] && die Unknown syscall provider $b
106: makesyscomponent $outname "$res"
107:
108: [ $b = "librump" ] && sawlibrump=true
109: fi
110: done
111:
112: ${sawlibrump} || die Did not see librump. Wrong directory?
CVSweb <webmaster@jp.NetBSD.org>