summaryrefslogtreecommitdiff
path: root/tools/lib/api/fd/array.h
diff options
context:
space:
mode:
authorAlexey Budankov <alexey.budankov@linux.intel.com>2020-07-17 09:59:45 +0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2020-07-21 09:52:51 -0300
commitab4c1f9f686836e7a772af0c6dd71fe9efa2609c (patch)
tree8d98ecfa53cb765d1e7d0affa808421f7db781b5 /tools/lib/api/fd/array.h
parent59b4412f27f1410a5b22f0244368c4d5ea00d316 (diff)
libperf: Add flags to fdarray fds objects
Store flags per struct pollfd *entries object in a bitmap of int size. Implement fdarray_flag__nonfilterable flag to skip object from counting by fdarray__filter(). Fixed fdarray test issue reported by kernel test robot. Reported-by: kernel test robot <rong.a.chen@intel.com> Signed-off-by: Alexey Budankov <alexey.budankov@linux.intel.com> Acked-by: Jiri Olsa <jolsa@redhat.com> Acked-by: Namhyung Kim <namhyung@kernel.org> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lore.kernel.org/lkml/6b7d43ff-0801-d5dd-4e90-fcd86b17c1c8@linux.intel.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/lib/api/fd/array.h')
-rw-r--r--tools/lib/api/fd/array.h16
1 files changed, 12 insertions, 4 deletions
diff --git a/tools/lib/api/fd/array.h b/tools/lib/api/fd/array.h
index b39557d1a88f..7fcf21a33c0c 100644
--- a/tools/lib/api/fd/array.h
+++ b/tools/lib/api/fd/array.h
@@ -21,19 +21,27 @@ struct fdarray {
int nr_alloc;
int nr_autogrow;
struct pollfd *entries;
- union {
- int idx;
- void *ptr;
+ struct priv {
+ union {
+ int idx;
+ void *ptr;
+ };
+ unsigned int flags;
} *priv;
};
+enum fdarray_flags {
+ fdarray_flag__default = 0x00000000,
+ fdarray_flag__nonfilterable = 0x00000001
+};
+
void fdarray__init(struct fdarray *fda, int nr_autogrow);
void fdarray__exit(struct fdarray *fda);
struct fdarray *fdarray__new(int nr_alloc, int nr_autogrow);
void fdarray__delete(struct fdarray *fda);
-int fdarray__add(struct fdarray *fda, int fd, short revents);
+int fdarray__add(struct fdarray *fda, int fd, short revents, enum fdarray_flags flags);
int fdarray__poll(struct fdarray *fda, int timeout);
int fdarray__filter(struct fdarray *fda, short revents,
void (*entry_destructor)(struct fdarray *fda, int fd, void *arg),