[v3,01/11] devtools: warn when adding some pthread calls
Checks
Commit Message
All pthread functions below have an equivalent in rte_thread API:
- pthread_create
- pthread_join
- pthread_detach
- pthread_setname_np
- pthread_set_name_np
- pthread_setaffinity_np
- pthread_attr_setinheritsched
- pthread_attr_setschedpolicy
Usage of these functions will be raised to encourage rte_thread adoption.
The pthread functions for locks and cancel are still allowed.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
v2: replace (|_) with _?
---
devtools/checkpatches.sh | 8 ++++++++
1 file changed, 8 insertions(+)
@@ -119,6 +119,14 @@ check_forbidden_additions() { # <patch>
-f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
"$1" || res=1
+ # refrain from using some pthread functions
+ awk -v FOLDERS="lib drivers app examples" \
+ -v EXPRESSIONS="pthread_(create|join|detach|set(_?name_np|affinity_np)|attr_set(inheritsched|schedpolicy))\\\(" \
+ -v RET_ON_FAIL=1 \
+ -v MESSAGE='Using pthread functions, prefer rte_thread' \
+ -f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
+ "$1" || res=1
+
# forbid use of __reserved which is a reserved keyword in Windows system headers
awk -v FOLDERS="lib drivers app examples" \
-v EXPRESSIONS='\\<__reserved\\>' \