diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2022-08-02 20:06:12 +0300 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2022-08-02 20:06:12 +0300 |
commit | 8bb5e7f4dcd9b9ef22a3ea25c9066a8a968f12dd (patch) | |
tree | 0f1383880607a227142f9388a066959926233ff1 /tools/lib/api/fd/array.c | |
parent | 2a96271fb66c499e4a89d76a89d3d01170c10bef (diff) | |
parent | 7c744d00990ea999d27f306f6db5ccb61b1304b2 (diff) | |
download | linux-8bb5e7f4dcd9b9ef22a3ea25c9066a8a968f12dd.tar.xz |
Merge branch 'next' into for-linus
Prepare input updates for 5.20 (or 6.0) merge window.
Diffstat (limited to 'tools/lib/api/fd/array.c')
-rw-r--r-- | tools/lib/api/fd/array.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tools/lib/api/fd/array.c b/tools/lib/api/fd/array.c index 5e6cb9debe37..f0f195207fca 100644 --- a/tools/lib/api/fd/array.c +++ b/tools/lib/api/fd/array.c @@ -88,6 +88,23 @@ int fdarray__add(struct fdarray *fda, int fd, short revents, enum fdarray_flags return pos; } +int fdarray__dup_entry_from(struct fdarray *fda, int pos, struct fdarray *from) +{ + struct pollfd *entry; + int npos; + + if (pos >= from->nr) + return -EINVAL; + + entry = &from->entries[pos]; + + npos = fdarray__add(fda, entry->fd, entry->events, from->priv[pos].flags); + if (npos >= 0) + fda->priv[npos] = from->priv[pos]; + + return npos; +} + int fdarray__filter(struct fdarray *fda, short revents, void (*entry_destructor)(struct fdarray *fda, int fd, void *arg), void *arg) |