ADDED arch/posix/errnos Index: arch/posix/errnos ================================================================== --- arch/posix/errnos +++ arch/posix/errnos @@ -0,0 +1,11 @@ +EPERM +EINVAL +EBADF +EFAULT +ENOSPC +EDQUOT +EIO +EAGAIN +EFBIG +EINTR +EDESTADDRREQ Index: build.sh ================================================================== --- build.sh +++ build.sh @@ -184,28 +184,29 @@ # awk scripts can handle and turn into a list of constants. echo '#include ' > $gen/system_calls.t.1 # this is the magic part cat arch/posix/syscalls > $gen/system_calls.t.2 sed -e 's;^\(.*\)$;\1 SYS_\1;' -i $gen/system_calls.t.2 cat $gen/system_calls.t.1 $gen/system_calls.t.2 | cpp -P >$gen/system_calls.tbl + + # generate errno tables the same way + echo '#include ' > $gen/error_codes.t.1 # this is the magic part + cat arch/posix/errnos > $gen/error_codes.t.2 + sed -e 's;^\(.*\)$;k_platform_error_\1 \1;' -i $gen/error_codes.t.2 + cat $gen/error_codes.t.1 $gen/error_codes.t.2 | cpp -P | grep "^k_platform_error" >$gen/error_codes.tbl # haaaack else case $os in - # lin) grep -h "#define __NR_" $p_headers_syscall | sed 's;^#define __NR_;;' > $gen/system_calls.tbl;; - # fbsd) grep -h "#define SYS_" $p_headers_syscall | sed 's;^#define SYS_;;' | sed 's;[\t ]\+; ;' > $gen/system_calls.tbl;; *) noimpl 'system call table generation';; esac fi -# cat $p_headers_syscall $gen/system_calls.tbl | cpp -P | + +# take the OS-specific system call tables that have been prepared +# for us above and feed them into awk scripts to generate C headers awk -f arch/syscall.awk -v out=s <$gen/system_calls.tbl>$gen/system_calls.s -# cat $p_headers_syscall $gen/system_calls.tbl | cpp -P | awk -f arch/syscall.awk -v out=h <$gen/system_calls.tbl>$gen/system_calls.h -# generate errno tables -grep -h "#[ ]*define[ ]\+E" $p_headers_errno | - sed 's;^#[\t ]*define[\t ]\+\(E[A-Z0-9]\+\).*$;k_platform_error_\1 \1;' >\ - $gen/error_names.tbl -cat $p_headers_errno $gen/error_names.tbl | cpp -P >$gen/error_numbers.tbl -awk -f arch/errtbl.awk <$gen/error_numbers.tbl >$gen/error_table.h +# do the same with our error codes table +awk -f arch/errtbl.awk <$gen/error_codes.tbl >$gen/error_table.h # generate symbol tables for error handling functions mkdir -p "$to/k" awk -f global/gen-conds.awk $to/k/internal.egroup.h awk -f global/gen-ident.awk $gen/internal.ident.c