libk  mktbl.errno.linux.sh at [03d58c0419]

File arch/mktbl.errno.linux.sh artifact d84e39d1e1 part of check-in 03d58c0419


#!/usr/bin/env bash
set -eu

OUTDIR=$1
ABI=$2

INC_DEF=/usr/src/linux
p_include="${LINUX_SRC:-$INC_DEF}"
p_uapi="$p_include/tools/include/uapi"

cpp -D__"$ABI"__ -undef -dM -I"$p_uapi" "$p_uapi/asm/errno.h" | sort -nrk3 | awk -F' ' '{
if ($2 !~ "^_"){
	ids[$2] = $3;
	if ($3 ~ /^[0-9]+$/) val=$3;
	else val=ids[$3];
	print $2 " " val;
}}' | sort -nk2 > "$OUTDIR/error_table.tbl"