github.com/nicocha30/gvisor-ligolo@v0.0.0-20230726075806-989fa2c0a413/pkg/abi/linux/epoll.go (about)

     1  // Copyright 2019 The gVisor Authors.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  package linux
    16  
    17  // Event masks.
    18  const (
    19  	EPOLLIN     = 0x1
    20  	EPOLLPRI    = 0x2
    21  	EPOLLOUT    = 0x4
    22  	EPOLLERR    = 0x8
    23  	EPOLLHUP    = 0x10
    24  	EPOLLRDNORM = 0x40
    25  	EPOLLRDBAND = 0x80
    26  	EPOLLWRNORM = 0x100
    27  	EPOLLWRBAND = 0x200
    28  	EPOLLMSG    = 0x400
    29  	EPOLLRDHUP  = 0x2000
    30  )
    31  
    32  // Per-file descriptor flags.
    33  const (
    34  	EPOLLEXCLUSIVE = 1 << 28
    35  	EPOLLWAKEUP    = 1 << 29
    36  	EPOLLONESHOT   = 1 << 30
    37  	EPOLLET        = 1 << 31
    38  
    39  	// EP_PRIVATE_BITS is fs/eventpoll.c:EP_PRIVATE_BITS, the set of all bits
    40  	// in an epoll event mask that correspond to flags rather than I/O events.
    41  	EP_PRIVATE_BITS = EPOLLEXCLUSIVE | EPOLLWAKEUP | EPOLLONESHOT | EPOLLET
    42  )
    43  
    44  // Operation flags.
    45  const (
    46  	EPOLL_CLOEXEC  = 0x80000
    47  	EPOLL_NONBLOCK = 0x800
    48  )
    49  
    50  // Control operations.
    51  const (
    52  	EPOLL_CTL_ADD = 0x1
    53  	EPOLL_CTL_DEL = 0x2
    54  	EPOLL_CTL_MOD = 0x3
    55  )
    56  
    57  // SizeOfEpollEvent is the size of EpollEvent struct.
    58  var SizeOfEpollEvent = (*EpollEvent)(nil).SizeBytes()