18c2ecf20Sopenharmony_ci#!/bin/sh 28c2ecf20Sopenharmony_ci# SPDX-License-Identifier: LGPL-2.1 38c2ecf20Sopenharmony_ci 48c2ecf20Sopenharmony_ci[ $# -eq 1 ] && header_dir=$1 || header_dir=tools/include/uapi/linux/ 58c2ecf20Sopenharmony_ci 68c2ecf20Sopenharmony_ciprintf "static const char *prctl_options[] = {\n" 78c2ecf20Sopenharmony_ciregex='^#define[[:space:]]+PR_(\w+)[[:space:]]*([[:xdigit:]]+).*' 88c2ecf20Sopenharmony_ciegrep $regex ${header_dir}/prctl.h | grep -v PR_SET_PTRACER | \ 98c2ecf20Sopenharmony_ci sed -r "s/$regex/\2 \1/g" | \ 108c2ecf20Sopenharmony_ci sort -n | xargs printf "\t[%s] = \"%s\",\n" 118c2ecf20Sopenharmony_ciprintf "};\n" 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ciprintf "static const char *prctl_set_mm_options[] = {\n" 148c2ecf20Sopenharmony_ciregex='^#[[:space:]]+define[[:space:]]+PR_SET_MM_(\w+)[[:space:]]*([[:digit:]]+).*' 158c2ecf20Sopenharmony_ciegrep $regex ${header_dir}/prctl.h | \ 168c2ecf20Sopenharmony_ci sed -r "s/$regex/\2 \1/g" | \ 178c2ecf20Sopenharmony_ci sort -n | xargs printf "\t[%s] = \"%s\",\n" 188c2ecf20Sopenharmony_ciprintf "};\n" 19