github.com/sagernet/gvisor@v0.0.0-20240428053021-e691de28565f/pkg/abi/linux/poll.go (about)

     1  // Copyright 2018 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  // PollFD is struct pollfd, used by poll(2)/ppoll(2), from uapi/asm-generic/poll.h.
    18  //
    19  // +marshal slice:PollFDSlice
    20  type PollFD struct {
    21  	FD      int32
    22  	Events  int16
    23  	REvents int16
    24  }
    25  
    26  // Poll event flags, used by poll(2)/ppoll(2) and/or
    27  // epoll_ctl(2)/epoll_wait(2), from uapi/asm-generic/poll.h.
    28  const (
    29  	POLLIN         = 0x0001
    30  	POLLPRI        = 0x0002
    31  	POLLOUT        = 0x0004
    32  	POLLERR        = 0x0008
    33  	POLLHUP        = 0x0010
    34  	POLLNVAL       = 0x0020
    35  	POLLRDNORM     = 0x0040
    36  	POLLRDBAND     = 0x0080
    37  	POLLWRNORM     = 0x0100
    38  	POLLWRBAND     = 0x0200
    39  	POLLMSG        = 0x0400
    40  	POLLREMOVE     = 0x1000
    41  	POLLRDHUP      = 0x2000
    42  	POLLFREE       = 0x4000
    43  	POLL_BUSY_LOOP = 0x8000
    44  )