forked from RTEMS/rtems-libbsd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
create-kernel-namespace.sh
executable file
·133 lines (128 loc) · 4.2 KB
/
create-kernel-namespace.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
#!/bin/sh -x
#
# Copyright (c) 2016 embedded brains GmbH. All rights reserved.
#
# embedded brains GmbH
# Dornierstr. 4
# 82178 Puchheim
# Germany
# <rtems@embedded-brains.de>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
#
# This script generates the kernel namespace header file
# <machine/rtems-bsd-kernel-namespace.h>.
#
objdump --syms `for i in build/*rtems* ; do \
find $i/freebsd/sys/ -name '*.o' ; \
echo $i/rtemsbsd/rtems/rtems-kernel-*.o ; \
done` \
| awk '/^[0-9a-f]+[[:blank:]]+g/ {print $6}' \
| sed 's/^_bsd_//' \
| sed '/^accept$/d' \
| sed '/^arc4random$/d' \
| sed '/^bind$/d' \
| sed '/^blackhole$/d' \
| sed '/^bpf_filter$/d' \
| sed '/^bpf_jitter$/d' \
| sed '/^bpf_jitter_enable$/d' \
| sed '/^bpf_validate$/d' \
| sed '/^connect$/d' \
| sed '/^drop_redirect$/d' \
| sed '/^drop_synfin$/d' \
| sed '/^free$/d' \
| sed '/^getentropy$/d' \
| sed '/^getpeername$/d' \
| sed '/^getsockname$/d' \
| sed '/^getsockopt$/d' \
| sed '/^ifqmaxlen$/d' \
| sed '/^in6addr_any$/d' \
| sed '/^in6addr_loopback$/d' \
| sed '/^in6addr_nodelocal_allnodes$/d' \
| sed '/^in6addr_linklocal_allnodes$/d' \
| sed '/^kevent$/d' \
| sed '/^kqueue$/d' \
| sed '/^listen$/d' \
| sed '/^malloc$/d' \
| sed '/^max_datalen$/d' \
| sed '/^max_hdr$/d' \
| sed '/^max_linkhdr$/d' \
| sed '/^max_protohdr$/d' \
| sed '/^maxsockets$/d' \
| sed '/^nd6_debug$/d' \
| sed '/^nd6_delay$/d' \
| sed '/^nd6_gctimer$/d' \
| sed '/^nd6_maxnudhint$/d' \
| sed '/^nd6_mmaxtries$/d' \
| sed '/^nd6_onlink_ns_rfc4861$/d' \
| sed '/^nd6_prune$/d' \
| sed '/^nd6_umaxtries$/d' \
| sed '/^nd6_useloopback$/d' \
| sed '/^nmbclusters$/d' \
| sed '/^nmbjumbo16$/d' \
| sed '/^nmbjumbo9$/d' \
| sed '/^nmbjumbop$/d' \
| sed '/^nmbufs$/d' \
| sed '/^nolocaltimewait$/d' \
| sed '/^path_mtu_discovery$/d' \
| sed '/^pause$/d' \
| sed '/^pf_osfp_entry_pl$/d' \
| sed '/^pf_osfp_pl$/d' \
| sed '/^pipe$/d' \
| sed '/^poll$/d' \
| sed '/^random$/d' \
| sed '/^realloc$/d' \
| sed '/^reallocf$/d' \
| sed '/^recvfrom$/d' \
| sed '/^recvmsg$/d' \
| sed '/^rtems/d' \
| sed '/^select$/d' \
| sed '/^sendmsg$/d' \
| sed '/^sendto$/d' \
| sed '/^setfib$/d' \
| sed '/^setsockopt$/d' \
| sed '/^shutdown$/d' \
| sed '/^socket$/d' \
| sed '/^socketpair$/d' \
| sed '/^soreceive_stream$/d' \
| sed '/^srandom$/d' \
| sed '/^strdup$/d' \
| sed '/^sysctlbyname$/d' \
| sed '/^sysctl$/d' \
| sed '/^sysctlnametomib$/d' \
| sed '/sys_init/d' \
| sed '/^taskqueue_/d' \
| sed '/^tcp_offload_listen_start$/d' \
| sed '/^tcp_offload_listen_stop$/d' \
| sed '/^ticks$/d' \
| sed '/^useloopback$/d' \
| sed '/^_Watchdog_Ticks_since_boot$/d' \
| sort -u > symbols.txt
cat << eof > rtems-bsd-kernel-namespace.h
#ifndef _RTEMS_BSD_MACHINE_RTEMS_BSD_KERNEL_SPACE_H_
#error "the header file <machine/rtems-bsd-kernel-space.h> must be included first"
#endif
eof
sed 's/^\(.*\)/#define \1 _bsd_\1/' < symbols.txt >> rtems-bsd-kernel-namespace.h
rm symbols.txt
mv rtems-bsd-kernel-namespace.h rtemsbsd/include/machine/rtems-bsd-kernel-namespace.h