]> git.proxmox.com Git - ceph.git/blob - ceph/src/msg/async/EventPoll.h
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / msg / async / EventPoll.h
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
3 /*
4 * Ceph - scalable distributed file system
5 *
6 * Copyright (C) 2022 Rafael Lopez <rafael.lopez@softiron.com>
7 *
8 *
9 * This is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License version 2.1, as published by the Free Software
12 * Foundation. See file COPYING.
13 *
14 */
15
16 #ifndef CEPH_MSG_EVENTPOLL_H
17 #define CEPH_MSG_EVENTPOLL_H
18
19 #ifdef _WIN32
20 #include <winsock2.h>
21 #else
22 #include <poll.h>
23 #endif
24
25 #include "Event.h"
26
27 typedef struct pollfd POLLFD;
28
29 class PollDriver : public EventDriver {
30 int max_pfds;
31 int hard_max_pfds;
32 POLLFD *pfds;
33 CephContext *cct;
34
35 private:
36 int poll_ctl(int, int, int);
37
38 public:
39 explicit PollDriver(CephContext *c): cct(c) {}
40 ~PollDriver() override {}
41
42 int init(EventCenter *c, int nevent) override;
43 int add_event(int fd, int cur_mask, int add_mask) override;
44 int del_event(int fd, int cur_mask, int del_mask) override;
45 int resize_events(int newsize) override;
46 int event_wait(std::vector<FiredFileEvent> &fired_events,
47 struct timeval *tp) override;
48 };
49
50 #endif