clone.sh 513 B

1234567891011121314151617
  1. #!/bin/sh
  2. # SPDX-License-Identifier: LGPL-2.1
  3. if [ $# -ne 1 ] ; then
  4. beauty_uapi_linux_dir=tools/perf/trace/beauty/include/uapi/linux/
  5. else
  6. beauty_uapi_linux_dir=$1
  7. fi
  8. linux_sched=${beauty_uapi_linux_dir}/sched.h
  9. printf "static const char *clone_flags[] = {\n"
  10. regex='^[[:space:]]*#[[:space:]]*define[[:space:]]+CLONE_([^_]+[[:alnum:]_]+)[[:space:]]+(0x[[:xdigit:]]+)[[:space:]]*.*'
  11. grep -E $regex ${linux_sched} | \
  12. sed -r "s/$regex/\2 \1/g" | \
  13. xargs printf "\t[ilog2(%s) + 1] = \"%s\",\n"
  14. printf "};\n"