gvisor.dev/gvisor@v0.0.0-20240520182842-f9d4d51c7e0f/pkg/abi/linux/mqueue.go (about)

     1  // Copyright 2021 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  // Default values for POSIX message queues. Source:
    18  // include/linux/ipc_namespace.h
    19  const (
    20  	DFLT_QUEUESMAX       = 256
    21  	MIN_MSGMAX           = 1
    22  	DFLT_MSG        uint = 10
    23  	DFLT_MSGMAX          = 10
    24  	HARD_MSGMAX          = 65536
    25  	MIN_MSGSIZEMAX       = 128
    26  	DFLT_MSGSIZE    uint = 8192
    27  	DFLT_MSGSIZEMAX      = 8192
    28  	HARD_MSGSIZEMAX      = (16 * 1024 * 1024)
    29  )
    30  
    31  // Maximum values for a message queue. Source: include/uapi/linux/mqueue.h
    32  const (
    33  	MQ_PRIO_MAX  = 32768
    34  	MQ_BYTES_MAX = 819200
    35  )
    36  
    37  // Codes used by mq_notify. Source: include/uapi/linux/mqueue.h
    38  const (
    39  	NOTIFY_NONE    = 0
    40  	NOTIFY_WOKENUP = 1
    41  	NOTIFY_REMOVED = 2
    42  
    43  	NOTIFY_COOKIE_LEN = 32
    44  )
    45  
    46  // MqAttr is equivalent to struct mq_attr. Source: include/uapi/linux/mqueue.h
    47  //
    48  // +marshal
    49  type MqAttr struct {
    50  	MqFlags   int64    // Message queue flags.
    51  	MqMaxmsg  int64    // Maximum number of messages.
    52  	MqMsgsize int64    // Maximum message size.
    53  	MqCurmsgs int64    // Number of messages currently queued.
    54  	_         [4]int64 // Ignored for input, zeroed for output.
    55  }