github.com/nicocha30/gvisor-ligolo@v0.0.0-20230726075806-989fa2c0a413/pkg/abi/linux/fcntl.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  // Commands from linux/fcntl.h.
    18  const (
    19  	F_DUPFD         = 0
    20  	F_GETFD         = 1
    21  	F_SETFD         = 2
    22  	F_GETFL         = 3
    23  	F_SETFL         = 4
    24  	F_GETLK         = 5
    25  	F_SETLK         = 6
    26  	F_SETLKW        = 7
    27  	F_SETOWN        = 8
    28  	F_GETOWN        = 9
    29  	F_SETSIG        = 10
    30  	F_GETSIG        = 11
    31  	F_SETOWN_EX     = 15
    32  	F_GETOWN_EX     = 16
    33  	F_OFD_GETLK     = 36
    34  	F_OFD_SETLK     = 37
    35  	F_OFD_SETLKW    = 38
    36  	F_DUPFD_CLOEXEC = 1024 + 6
    37  	F_SETPIPE_SZ    = 1024 + 7
    38  	F_GETPIPE_SZ    = 1024 + 8
    39  )
    40  
    41  // Commands for F_SETLK.
    42  const (
    43  	F_RDLCK = 0
    44  	F_WRLCK = 1
    45  	F_UNLCK = 2
    46  )
    47  
    48  // Flags for fcntl.
    49  const (
    50  	FD_CLOEXEC = 00000001
    51  )
    52  
    53  // Flock is the lock structure for F_SETLK.
    54  //
    55  // +marshal
    56  type Flock struct {
    57  	Type   int16
    58  	Whence int16
    59  	_      [4]byte
    60  	Start  int64
    61  	Len    int64
    62  	PID    int32
    63  	_      [4]byte
    64  }
    65  
    66  // Owner types for F_SETOWN_EX and F_GETOWN_EX.
    67  const (
    68  	F_OWNER_TID  = 0
    69  	F_OWNER_PID  = 1
    70  	F_OWNER_PGRP = 2
    71  )
    72  
    73  // FOwnerEx is the owner structure for F_SETOWN_EX and F_GETOWN_EX.
    74  //
    75  // +marshal
    76  type FOwnerEx struct {
    77  	Type int32
    78  	PID  int32
    79  }