
#include "Webserv.hpp"

int	Webserv::_epoll_update(int fd, uint32_t events, int op)
{
	struct epoll_event	ev;
	std::memset(&ev, 0, sizeof ev);
	ev.events = events;
	ev.data.fd = fd;
	if (::epoll_ctl(_epfd, op, fd, &ev) == -1)
	{
		std::perror("err _epoll_update()");
		return (-1);
	}
	return (0);
}

int	Webserv::_epoll_update(int fd, uint32_t events, int op, void *ptr)
{
	struct epoll_event	ev;
	std::memset(&ev, 0, sizeof ev);
	ev.events = events;
	ev.data.ptr = ptr;
	if (::epoll_ctl(_epfd, op, fd, &ev) == -1)
	{
		std::perror("err _epoll_update()");
		return (-1);
	}
	return (0);
}
