Mercurial > hg > CbC > CbC_gcc
comparison libgo/mkrsysinfo.sh @ 145:1830386684a0
gcc-9.2.0
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 11:34:05 +0900 |
parents | 84e7813d76e9 |
children |
comparison
equal
deleted
inserted
replaced
131:84e7813d76e9 | 145:1830386684a0 |
---|---|
29 sed -e 's/\([^a-zA-Z0-9_]\)_timeval\([^a-zA-Z0-9_]\)/\1timeval\2/g' \ | 29 sed -e 's/\([^a-zA-Z0-9_]\)_timeval\([^a-zA-Z0-9_]\)/\1timeval\2/g' \ |
30 -e 's/\([^a-zA-Z0-9_]\)_timespec_t\([^a-zA-Z0-9_]\)/\1timespec\2/g' \ | 30 -e 's/\([^a-zA-Z0-9_]\)_timespec_t\([^a-zA-Z0-9_]\)/\1timespec\2/g' \ |
31 -e 's/\([^a-zA-Z0-9_]\)_timespec\([^a-zA-Z0-9_]\)/\1timespec\2/g' \ | 31 -e 's/\([^a-zA-Z0-9_]\)_timespec\([^a-zA-Z0-9_]\)/\1timespec\2/g' \ |
32 >> ${OUT} | 32 >> ${OUT} |
33 | 33 |
34 # The C long type, needed because that is the type that ptrace returns. | |
35 sizeof_long=`grep '^const ___SIZEOF_LONG__ = ' gen-sysinfo.go | sed -e 's/.*= //'` | |
36 if test "$sizeof_long" = "4"; then | |
37 echo "type _C_long int32" >> ${OUT} | |
38 echo "type _C_ulong uint32" >> ${OUT} | |
39 elif test "$sizeof_long" = "8"; then | |
40 echo "type _C_long int64" >> ${OUT} | |
41 echo "type _C_ulong uint64" >> ${OUT} | |
42 else | |
43 echo 1>&2 "mkrsysinfo.sh: could not determine size of long (got $sizeof_long)" | |
44 exit 1 | |
45 fi | |
46 | |
34 # On AIX, the _arpcom struct, is filtered by the above grep sequence, as it as | 47 # On AIX, the _arpcom struct, is filtered by the above grep sequence, as it as |
35 # a field of type _in6_addr, but other types depend on _arpcom, so we need to | 48 # a field of type _in6_addr, but other types depend on _arpcom, so we need to |
36 # put it back. | 49 # put it back. |
37 grep '^type _arpcom ' gen-sysinfo.go | \ | 50 grep '^type _arpcom ' gen-sysinfo.go | \ |
38 sed -e 's/_in6_addr/[16]byte/' >> ${OUT} | 51 sed -e 's/_in6_addr/[16]byte/' >> ${OUT} |
71 sed -e 's/^type ___timespec /type timespec /' \ | 84 sed -e 's/^type ___timespec /type timespec /' \ |
72 -e 's/^type _timespec /type timespec /' \ | 85 -e 's/^type _timespec /type timespec /' \ |
73 -e 's/tv_sec *[a-zA-Z0-9_]*/tv_sec timespec_sec_t/' \ | 86 -e 's/tv_sec *[a-zA-Z0-9_]*/tv_sec timespec_sec_t/' \ |
74 -e 's/tv_nsec *[a-zA-Z0-9_]*/tv_nsec timespec_nsec_t/' >> ${OUT} | 87 -e 's/tv_nsec *[a-zA-Z0-9_]*/tv_nsec timespec_nsec_t/' >> ${OUT} |
75 echo >> ${OUT} | 88 echo >> ${OUT} |
76 echo "func (ts *timespec) set_sec(x int64) {" >> ${OUT} | 89 echo "func (ts *timespec) setNsec(ns int64) {" >> ${OUT} |
77 echo " ts.tv_sec = timespec_sec_t(x)" >> ${OUT} | 90 echo " ts.tv_sec = timespec_sec_t(ns / 1e9)" >> ${OUT} |
91 echo " ts.tv_nsec = timespec_nsec_t(ns % 1e9)" >> ${OUT} | |
78 echo "}" >> ${OUT} | 92 echo "}" >> ${OUT} |
79 echo >> ${OUT} | 93 echo >> ${OUT} |
80 echo "func (ts *timespec) set_nsec(x int32) {" >> ${OUT} | |
81 echo " ts.tv_nsec = timespec_nsec_t(x)" >> ${OUT} | |
82 echo "}" >> ${OUT} | |
83 | 94 |
84 # Define the epollevent struct. This needs special attention because | 95 # Define the epollevent struct. This needs special attention because |
85 # the C definition uses a union and is sometimes packed. | 96 # the C definition uses a union and is sometimes packed. |
86 if grep '^const _epoll_data_offset ' ${OUT} >/dev/null 2>&1; then | 97 if grep '^const _epoll_data_offset ' ${OUT} >/dev/null 2>&1; then |
87 val=`grep '^const _epoll_data_offset ' ${OUT} | sed -e 's/const _epoll_data_offset = \(.*\)$/\1/'` | 98 val=`grep '^const _epoll_data_offset ' ${OUT} | sed -e 's/const _epoll_data_offset = \(.*\)$/\1/'` |
196 # The *BSD kevent struct. | 207 # The *BSD kevent struct. |
197 grep '^type _kevent ' gen-sysinfo.go | \ | 208 grep '^type _kevent ' gen-sysinfo.go | \ |
198 sed -e s'/_kevent/keventt/' \ | 209 sed -e s'/_kevent/keventt/' \ |
199 -e 's/ udata [^;}]*/ udata *byte/' \ | 210 -e 's/ udata [^;}]*/ udata *byte/' \ |
200 >> ${OUT} | 211 >> ${OUT} |
212 | |
213 # Type 'uint128' is needed in a couple of type definitions on arm64,such | |
214 # as _user_fpsimd_struct, _elf_fpregset_t, etc. | |
215 if ! grep '^type uint128' ${OUT} > /dev/null 2>&1; then | |
216 echo "type uint128 [16]byte" >> ${OUT} | |
217 fi |