github.com/nicocha30/gvisor-ligolo@v0.0.0-20230726075806-989fa2c0a413/pkg/abi/linux/sem.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  // semctl Command Definitions. Source: include/uapi/linux/sem.h
    18  const (
    19  	GETPID  = 11
    20  	GETVAL  = 12
    21  	GETALL  = 13
    22  	GETNCNT = 14
    23  	GETZCNT = 15
    24  	SETVAL  = 16
    25  	SETALL  = 17
    26  )
    27  
    28  // ipcs ctl cmds. Source: include/uapi/linux/sem.h
    29  const (
    30  	SEM_STAT     = 18
    31  	SEM_INFO     = 19
    32  	SEM_STAT_ANY = 20
    33  )
    34  
    35  // Information about system-wide sempahore limits and parameters.
    36  //
    37  // Source: include/uapi/linux/sem.h
    38  const (
    39  	SEMMNI = 32000
    40  	SEMMSL = 32000
    41  	SEMMNS = SEMMNI * SEMMSL
    42  	SEMOPM = 500
    43  	SEMVMX = 32767
    44  	SEMAEM = SEMVMX
    45  
    46  	SEMUME = SEMOPM
    47  	SEMMNU = SEMMNS
    48  	SEMMAP = SEMMNS
    49  	SEMUSZ = 20
    50  )
    51  
    52  // Semaphore flags.
    53  const (
    54  	SEM_UNDO = 0x1000
    55  )
    56  
    57  // Sembuf is equivalent to struct sembuf.
    58  //
    59  // +marshal slice:SembufSlice
    60  type Sembuf struct {
    61  	SemNum uint16
    62  	SemOp  int16
    63  	SemFlg int16
    64  }
    65  
    66  // SemInfo is equivalent to struct seminfo.
    67  //
    68  // Source: include/uapi/linux/sem.h
    69  //
    70  // +marshal
    71  type SemInfo struct {
    72  	SemMap uint32
    73  	SemMni uint32
    74  	SemMns uint32
    75  	SemMnu uint32
    76  	SemMsl uint32
    77  	SemOpm uint32
    78  	SemUme uint32
    79  	SemUsz uint32
    80  	SemVmx uint32
    81  	SemAem uint32
    82  }