prctl_option.sh 629 B

1234567891011121314151617
  1. #!/bin/sh
  2. [ $# -eq 1 ] && header_dir=$1 || header_dir=tools/include/uapi/linux/
  3. printf "static const char *prctl_options[] = {\n"
  4. regex='^#define[[:space:]]+PR_([GS]ET\w+)[[:space:]]*([[:xdigit:]]+).*'
  5. egrep $regex ${header_dir}/prctl.h | grep -v PR_SET_PTRACER | \
  6. sed -r "s/$regex/\2 \1/g" | \
  7. sort -n | xargs printf "\t[%s] = \"%s\",\n"
  8. printf "};\n"
  9. printf "static const char *prctl_set_mm_options[] = {\n"
  10. regex='^#[[:space:]]+define[[:space:]]+PR_SET_MM_(\w+)[[:space:]]*([[:digit:]]+).*'
  11. egrep $regex ${header_dir}/prctl.h | \
  12. sed -r "s/$regex/\2 \1/g" | \
  13. sort -n | xargs printf "\t[%s] = \"%s\",\n"
  14. printf "};\n"