Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/java.base/windows/native/libnio/ch/wepoll.h
41134 views
1
/*
2
* Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation. Oracle designates this
8
* particular file as subject to the "Classpath" exception as provided
9
* by Oracle in the LICENSE file that accompanied this code.
10
*
11
* This code is distributed in the hope that it will be useful, but WITHOUT
12
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14
* version 2 for more details (a copy is included in the LICENSE file that
15
* accompanied this code).
16
*
17
* You should have received a copy of the GNU General Public License version
18
* 2 along with this work; if not, write to the Free Software Foundation,
19
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20
*
21
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22
* or visit www.oracle.com if you need additional information or have any
23
* questions.
24
*/
25
26
/*
27
* This file is available under and governed by the GNU General Public
28
* License version 2 only, as published by the Free Software Foundation.
29
* However, the following notice accompanied the original version of this
30
* file and, per its terms, should not be removed:
31
*
32
* wepoll - epoll for Windows
33
* https://github.com/piscisaureus/wepoll
34
*
35
* Copyright 2012-2020, Bert Belder <[email protected]>
36
* All rights reserved.
37
*
38
* Redistribution and use in source and binary forms, with or without
39
* modification, are permitted provided that the following conditions are
40
* met:
41
*
42
* * Redistributions of source code must retain the above copyright
43
* notice, this list of conditions and the following disclaimer.
44
*
45
* * Redistributions in binary form must reproduce the above copyright
46
* notice, this list of conditions and the following disclaimer in the
47
* documentation and/or other materials provided with the distribution.
48
*
49
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
50
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
51
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
52
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
53
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
54
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
55
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
56
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
57
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
58
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
59
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
60
*/
61
62
#ifndef WEPOLL_H_
63
#define WEPOLL_H_
64
65
#ifndef WEPOLL_EXPORT
66
#define WEPOLL_EXPORT
67
#endif
68
69
#include <stdint.h>
70
71
enum EPOLL_EVENTS {
72
EPOLLIN = (int) (1U << 0),
73
EPOLLPRI = (int) (1U << 1),
74
EPOLLOUT = (int) (1U << 2),
75
EPOLLERR = (int) (1U << 3),
76
EPOLLHUP = (int) (1U << 4),
77
EPOLLRDNORM = (int) (1U << 6),
78
EPOLLRDBAND = (int) (1U << 7),
79
EPOLLWRNORM = (int) (1U << 8),
80
EPOLLWRBAND = (int) (1U << 9),
81
EPOLLMSG = (int) (1U << 10), /* Never reported. */
82
EPOLLRDHUP = (int) (1U << 13),
83
EPOLLONESHOT = (int) (1U << 31)
84
};
85
86
#define EPOLLIN (1U << 0)
87
#define EPOLLPRI (1U << 1)
88
#define EPOLLOUT (1U << 2)
89
#define EPOLLERR (1U << 3)
90
#define EPOLLHUP (1U << 4)
91
#define EPOLLRDNORM (1U << 6)
92
#define EPOLLRDBAND (1U << 7)
93
#define EPOLLWRNORM (1U << 8)
94
#define EPOLLWRBAND (1U << 9)
95
#define EPOLLMSG (1U << 10)
96
#define EPOLLRDHUP (1U << 13)
97
#define EPOLLONESHOT (1U << 31)
98
99
#define EPOLL_CTL_ADD 1
100
#define EPOLL_CTL_MOD 2
101
#define EPOLL_CTL_DEL 3
102
103
typedef void* HANDLE;
104
typedef uintptr_t SOCKET;
105
106
typedef union epoll_data {
107
void* ptr;
108
int fd;
109
uint32_t u32;
110
uint64_t u64;
111
SOCKET sock; /* Windows specific */
112
HANDLE hnd; /* Windows specific */
113
} epoll_data_t;
114
115
struct epoll_event {
116
uint32_t events; /* Epoll events and flags */
117
epoll_data_t data; /* User data variable */
118
};
119
120
#ifdef __cplusplus
121
extern "C" {
122
#endif
123
124
WEPOLL_EXPORT HANDLE epoll_create(int size);
125
WEPOLL_EXPORT HANDLE epoll_create1(int flags);
126
127
WEPOLL_EXPORT int epoll_close(HANDLE ephnd);
128
129
WEPOLL_EXPORT int epoll_ctl(HANDLE ephnd,
130
int op,
131
SOCKET sock,
132
struct epoll_event* event);
133
134
WEPOLL_EXPORT int epoll_wait(HANDLE ephnd,
135
struct epoll_event* events,
136
int maxevents,
137
int timeout);
138
139
#ifdef __cplusplus
140
} /* extern "C" */
141
#endif
142
143
#endif /* WEPOLL_H_ */
144
145