make_capabilities_h.sh 366 B

12345678910
  1. #!/bin/sh
  2. CC=$1
  3. [ -n "$TARGET_CC_NOCACHE" ] && CC=$TARGET_CC_NOCACHE
  4. echo "#include <linux/capability.h>"
  5. echo "static const char *capabilities_names[] = {"
  6. echo "#include <linux/capability.h>" | ${CC} -E -dM - | grep '#define CAP' | grep -vE '(CAP_TO|CAP_LAST_CAP)' | \
  7. awk '{print $3" "$2}' | sort -n | awk '{print " ["$1"]\t= \""tolower($2)"\","}'
  8. echo "};"