Commit 5fd58e56 by Ian Lance Taylor

Add some Solaris support to mksysinfo.sh.

From Rainer Orth.

From-SVN: r168739
parent cff0c39d
...@@ -8,8 +8,8 @@ ...@@ -8,8 +8,8 @@
# This shell script creates the sysinfo.go file which holds types and # This shell script creates the sysinfo.go file which holds types and
# constants extracted from the system header files. This relies on a # constants extracted from the system header files. This relies on a
# hook in gcc: the -ggo option will generate debugging information in # hook in gcc: the -fdump-go-spec option will generate debugging
# Go syntax. # information in Go syntax.
# We currently #include all the files at once, which works, but leads # We currently #include all the files at once, which works, but leads
# to exposing some names which ideally should not be exposed, as they # to exposing some names which ideally should not be exposed, as they
...@@ -69,11 +69,13 @@ grep -v '^// ' gen-sysinfo.go | \ ...@@ -69,11 +69,13 @@ grep -v '^// ' gen-sysinfo.go | \
grep -v '^func' | \ grep -v '^func' | \
grep -v '^type _timeval ' | \ grep -v '^type _timeval ' | \
grep -v '^type _timespec ' | \ grep -v '^type _timespec ' | \
grep -v '^type _timestruc_t ' | \
grep -v '^type _epoll_' | \ grep -v '^type _epoll_' | \
grep -v 'in6_addr' | \ grep -v 'in6_addr' | \
grep -v 'sockaddr_in6' | \ grep -v 'sockaddr_in6' | \
sed -e 's/\([^a-zA-Z0-9_]\)_timeval\([^a-zA-Z0-9_]\)/\1Timeval\2/g' \ sed -e 's/\([^a-zA-Z0-9_]\)_timeval\([^a-zA-Z0-9_]\)/\1Timeval\2/g' \
-e 's/\([^a-zA-Z0-9_]\)_timespec\([^a-zA-Z0-9_]\)/\1Timespec\2/g' \ -e 's/\([^a-zA-Z0-9_]\)_timespec\([^a-zA-Z0-9_]\)/\1Timespec\2/g' \
-e 's/\([^a-zA-Z0-9_]\)_timestruc_t\([^a-zA-Z0-9_]\)/\1Timestruc\2/g' \
>> ${OUT} >> ${OUT}
# The errno constants. # The errno constants.
...@@ -83,6 +85,9 @@ grep '^const _E' gen-sysinfo.go | \ ...@@ -83,6 +85,9 @@ grep '^const _E' gen-sysinfo.go | \
# The O_xxx flags. # The O_xxx flags.
grep '^const _\(O\|F\|FD\)_' gen-sysinfo.go | \ grep '^const _\(O\|F\|FD\)_' gen-sysinfo.go | \
sed -e 's/^\(const \)_\([^= ]*\)\(.*\)$/\1\2 = _\2/' >> ${OUT} sed -e 's/^\(const \)_\([^= ]*\)\(.*\)$/\1\2 = _\2/' >> ${OUT}
if ! grep '^const O_ASYNC' ${OUT} >/dev/null 2>&1; then
echo "const O_ASYNC = 0" >> ${OUT}
fi
if ! grep '^const O_CLOEXEC' ${OUT} >/dev/null 2>&1; then if ! grep '^const O_CLOEXEC' ${OUT} >/dev/null 2>&1; then
echo "const O_CLOEXEC = 0" >> ${OUT} echo "const O_CLOEXEC = 0" >> ${OUT}
fi fi
...@@ -195,9 +200,13 @@ fi ...@@ -195,9 +200,13 @@ fi
if ! grep '^const PTRACE_EVENT_EXIT' ${OUT} > /dev/null 2>&1; then if ! grep '^const PTRACE_EVENT_EXIT' ${OUT} > /dev/null 2>&1; then
echo "const PTRACE_EVENT_EXIT = 6" >> ${OUT} echo "const PTRACE_EVENT_EXIT = 6" >> ${OUT}
fi fi
if ! grep '^const _PTRACE_TRACEME' ${OUT} > /dev/null 2>&1; then
echo "const _PTRACE_TRACEME = 0" >> ${OUT}
fi
# The registers returned by PTRACE_GETREGS. This is probably # The registers returned by PTRACE_GETREGS. This is probably
# GNU/Linux specific. # GNU/Linux specific; it should do no harm if there is no
# _user_regs_struct.
regs=`grep '^type _user_regs_struct struct' gen-sysinfo.go` regs=`grep '^type _user_regs_struct struct' gen-sysinfo.go`
if test "$regs" != ""; then if test "$regs" != ""; then
regs=`echo $regs | sed -e 's/type _user_regs_struct struct //' -e 's/[{}]//g'` regs=`echo $regs | sed -e 's/type _user_regs_struct struct //' -e 's/[{}]//g'`
...@@ -263,6 +272,18 @@ echo $timespec | \ ...@@ -263,6 +272,18 @@ echo $timespec | \
-e 's/tv_sec *[a-zA-Z0-9_]*/Sec Timespec_sec_t/' \ -e 's/tv_sec *[a-zA-Z0-9_]*/Sec Timespec_sec_t/' \
-e 's/tv_nsec *[a-zA-Z0-9_]*/Nsec Timespec_nsec_t/' >> ${OUT} -e 's/tv_nsec *[a-zA-Z0-9_]*/Nsec Timespec_nsec_t/' >> ${OUT}
timestruc=`grep '^type _timestruc_t ' gen-sysinfo.go || true`
if test "$timestruc" != ""; then
timestruc_sec=`echo $timestruc | sed -n -e 's/^.*tv_sec \([^ ]*\);.*$/\1/p'`
timestruc_nsec=`echo $timestruc | sed -n -e 's/^.*tv_nsec \([^ ]*\);.*$/\1/p'`
echo "type Timestruc_sec_t $timestruc_sec" >> ${OUT}
echo "type Timestruc_nsec_t $timestruc_nsec" >> ${OUT}
echo $timestruc | \
sed -e 's/^type _timestruc_t /type Timestruc /' \
-e 's/tv_sec *[a-zA-Z0-9_]*/Sec Timestruc_sec_t/' \
-e 's/tv_nsec *[a-zA-Z0-9_]*/Nsec Timestruc_nsec_t/' >> ${OUT}
fi
# The stat type. # The stat type.
grep 'type _stat ' gen-sysinfo.go | \ grep 'type _stat ' gen-sysinfo.go | \
sed -e 's/type _stat/type Stat_t/' \ sed -e 's/type _stat/type Stat_t/' \
...@@ -281,6 +302,7 @@ grep 'type _stat ' gen-sysinfo.go | \ ...@@ -281,6 +302,7 @@ grep 'type _stat ' gen-sysinfo.go | \
-e 's/st_ctim/Ctime/' \ -e 's/st_ctim/Ctime/' \
-e 's/\([^a-zA-Z0-9_]\)_timeval\([^a-zA-Z0-9_]\)/\1Timeval\2/g' \ -e 's/\([^a-zA-Z0-9_]\)_timeval\([^a-zA-Z0-9_]\)/\1Timeval\2/g' \
-e 's/\([^a-zA-Z0-9_]\)_timespec\([^a-zA-Z0-9_]\)/\1Timespec\2/g' \ -e 's/\([^a-zA-Z0-9_]\)_timespec\([^a-zA-Z0-9_]\)/\1Timespec\2/g' \
-e 's/\([^a-zA-Z0-9_]\)_timestruc_t\([^a-zA-Z0-9_]\)/\1Timestruc\2/g' \
>> ${OUT} >> ${OUT}
# The directory searching types. # The directory searching types.
...@@ -309,9 +331,10 @@ if test "$rusage" != ""; then ...@@ -309,9 +331,10 @@ if test "$rusage" != ""; then
f=`echo $field | sed -e 's/^\(.\).*$/\1/'` f=`echo $field | sed -e 's/^\(.\).*$/\1/'`
r=`echo $field | sed -e 's/^.\(.*\)$/\1/'` r=`echo $field | sed -e 's/^.\(.*\)$/\1/'`
f=`echo $f | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ` f=`echo $f | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`
# Fix _timeval and _timespec. # Fix _timeval _timespec, and _timestruc_t.
r=`echo $r | sed -e s'/ _timeval$/ Timeval/'` r=`echo $r | sed -e s'/ _timeval$/ Timeval/'`
r=`echo $r | sed -e s'/ _timespec$/ Timespec/'` r=`echo $r | sed -e s'/ _timespec$/ Timespec/'`
r=`echo $r | sed -e s'/ _timestruc_t$/ Timestruc/'`
field="$f$r" field="$f$r"
nrusage="$nrusage $field;" nrusage="$nrusage $field;"
done done
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment