From e60460f4e5137ab0c4aa4994fd30ada30ab31415 Mon Sep 17 00:00:00 2001 From: Andrii Nakryiko Date: Wed, 29 May 2019 10:05:50 -0700 Subject: [PATCH] linux/err.h: add PTR_ERR_OR_ZERO Add missing PTR_ERR_OR_ZERO implementation. Also add a bunch of generated files to .gitignore. Signed-off-by: Andrii Nakryiko --- include/linux/err.h | 5 +++++ src/.gitignore | 2 ++ 2 files changed, 7 insertions(+) diff --git a/include/linux/err.h b/include/linux/err.h index a3db4cf..1b1dafb 100644 --- a/include/linux/err.h +++ b/include/linux/err.h @@ -30,4 +30,9 @@ static inline bool IS_ERR_OR_NULL(const void *ptr) return (!ptr) || IS_ERR_VALUE((unsigned long)ptr); } +static inline long PTR_ERR_OR_ZERO(const void *ptr) +{ + return IS_ERR(ptr) ? PTR_ERR(ptr) : 0; +} + #endif diff --git a/src/.gitignore b/src/.gitignore index e0292b1..fddb29b 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -1,2 +1,4 @@ *.o *.a +/libbpf.pc +/libbpf.so*