github.com/SagerNet/gvisor@v0.0.0-20210707092255-7731c139d75c/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_DUPFD_CLOEXEC = 1024 + 6 34 F_SETPIPE_SZ = 1024 + 7 35 F_GETPIPE_SZ = 1024 + 8 36 ) 37 38 // Commands for F_SETLK. 39 const ( 40 F_RDLCK = 0 41 F_WRLCK = 1 42 F_UNLCK = 2 43 ) 44 45 // Flags for fcntl. 46 const ( 47 FD_CLOEXEC = 00000001 48 ) 49 50 // Flock is the lock structure for F_SETLK. 51 // 52 // +marshal 53 type Flock struct { 54 Type int16 55 Whence int16 56 _ [4]byte 57 Start int64 58 Len int64 59 PID int32 60 _ [4]byte 61 } 62 63 // Owner types for F_SETOWN_EX and F_GETOWN_EX. 64 const ( 65 F_OWNER_TID = 0 66 F_OWNER_PID = 1 67 F_OWNER_PGRP = 2 68 ) 69 70 // FOwnerEx is the owner structure for F_SETOWN_EX and F_GETOWN_EX. 71 // 72 // +marshal 73 type FOwnerEx struct { 74 Type int32 75 PID int32 76 }