diff options
Diffstat (limited to 'tools/lib/api')
| -rw-r--r-- | tools/lib/api/Makefile | 2 | ||||
| -rw-r--r-- | tools/lib/api/fd/array.c | 17 | ||||
| -rw-r--r-- | tools/lib/api/fd/array.h | 1 | 
3 files changed, 19 insertions, 1 deletions
| diff --git a/tools/lib/api/Makefile b/tools/lib/api/Makefile index a13e9c7f1fc5..e21e1b40b525 100644 --- a/tools/lib/api/Makefile +++ b/tools/lib/api/Makefile @@ -60,7 +60,7 @@ $(LIBFILE): $(API_IN)  clean:  	$(call QUIET_CLEAN, libapi) $(RM) $(LIBFILE); \ -	find $(if $(OUTPUT),$(OUTPUT),.) -name \*.o -or -name \*.o.cmd -or -name \*.o.d | xargs $(RM) +	find $(or $(OUTPUT),.) -name \*.o -or -name \*.o.cmd -or -name \*.o.d | xargs $(RM)  FORCE: 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) diff --git a/tools/lib/api/fd/array.h b/tools/lib/api/fd/array.h index 7fcf21a33c0c..60ad197c8ee9 100644 --- a/tools/lib/api/fd/array.h +++ b/tools/lib/api/fd/array.h @@ -42,6 +42,7 @@ 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, enum fdarray_flags flags); +int fdarray__dup_entry_from(struct fdarray *fda, int pos, struct fdarray *from);  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), | 
