public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
728a2afe1f6bf3d784985ca2c19cea6a419cf770 blob 1021 bytes (raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
 
// SPDX-License-Identifier: GPL-2.0-or-later
/* epoll_ctl.c - epoll manipulation helpers
 *
 * Copyright Red Hat
 * Author: Laurent Vivier <lvivier@redhat.com>
 */

#include <errno.h>

#include "epoll_ctl.h"

/**
 * epoll_add() - Add a file descriptor to an epollfd
 * @epollfd:	epoll file descriptor to add to
 * @events:	epoll events
 * @ref:	epoll reference for the file descriptor (includes fd and metadata)
 *
 * Return: 0 on success, negative errno on failure
 */
int epoll_add(int epollfd, uint32_t events, union epoll_ref ref)
{
	struct epoll_event ev;
	int ret;

	ev.events = events;
	ev.data.u64 = ref.u64;

	ret = epoll_ctl(epollfd, EPOLL_CTL_ADD, ref.fd, &ev);
	if (ret == -1) {
		ret = -errno;
		err("Failed to add fd to epoll: %s", strerror_(-ret));
	}

	return ret;
}

/**
 * epoll_del() - Remove a file descriptor from an epollfd
 * @epollfd:	epoll file descriptor to remove from
 * @fd:		File descriptor to remove
 */
void epoll_del(int epollfd, int fd)
{
	epoll_ctl(epollfd, EPOLL_CTL_DEL, fd, NULL);
}
debug log:

solving 728a2afe1f6b ...
found 728a2afe1f6b in https://passt.top/passt

Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).