github.com/google/syzkaller@v0.0.0-20240517125934-c0f1611a36d6/sys/openbsd/ipc.txt (about)

     1  # Copyright 2017 syzkaller project authors. All rights reserved.
     2  # Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
     3  
     4  include <sys/types.h>
     5  include <sys/fcntl.h>
     6  include <sys/stat.h>
     7  include <sys/ipc.h>
     8  include <sys/shm.h>
     9  include <sys/msg.h>
    10  include <sys/sem.h>
    11  
    12  resource ipc[int32]: 0, 0xffffffffffffffff
    13  
    14  # TODO: describe ipc syscall
    15  
    16  resource ipc_msq[ipc]
    17  msgget(key proc[2039379027, 4], flags flags[msgget_flags]) ipc_msq
    18  msgget$private(key const[IPC_PRIVATE], flags flags[msgget_flags]) ipc_msq
    19  msgsnd(msqid ipc_msq, msgp ptr[in, msgbuf], sz len[msgp], flags flags[msgsnd_flags])
    20  msgrcv(msqid ipc_msq, msgp ptr[out, msgbuf], sz len[msgp], typ flags[msgbuf_type], flags flags[msgrcv_flags])
    21  msgctl$IPC_STAT(msqid ipc_msq, cmd const[IPC_STAT], buf buffer[out])
    22  msgctl$IPC_SET(msqid ipc_msq, cmd const[IPC_SET], buf ptr[in, msqid_ds])
    23  msgctl$IPC_RMID(msqid ipc_msq, cmd const[IPC_RMID])
    24  
    25  resource ipc_sem[ipc]
    26  semget(key proc[2039359027, 4], nsems flags[sem_sem_id], flags flags[semget_flags]) ipc_sem
    27  semget$private(key const[IPC_PRIVATE], nsems flags[sem_sem_id], flags flags[semget_flags]) ipc_sem
    28  semop(semid ipc_sem, ops ptr[in, array[sembuf]], nops len[ops])
    29  semctl$IPC_STAT(semid ipc_sem, semnum const[0], cmd const[IPC_STAT], arg buffer[out])
    30  semctl$IPC_SET(semid ipc_sem, semnum const[0], cmd const[IPC_SET], arg ptr[in, semid_ds])
    31  semctl$IPC_RMID(semid ipc_sem, semnum const[0], cmd const[IPC_RMID])
    32  semctl$GETALL(semid ipc_sem, semnum const[0], cmd const[GETALL], arg buffer[out])
    33  semctl$GETNCNT(semid ipc_sem, semnum flags[sem_sem_id], cmd const[GETNCNT], arg buffer[out])
    34  semctl$GETPID(semid ipc_sem, semnum flags[sem_sem_id], cmd const[GETPID], arg buffer[out])
    35  semctl$GETVAL(semid ipc_sem, semnum flags[sem_sem_id], cmd const[GETVAL], arg buffer[out])
    36  semctl$GETZCNT(semid ipc_sem, semnum flags[sem_sem_id], cmd const[GETZCNT], arg buffer[out])
    37  semctl$SETALL(semid ipc_sem, semnum const[0], cmd const[SETALL], arg ptr[in, array[int16]])
    38  semctl$SETVAL(semid ipc_sem, semnum flags[sem_sem_id], cmd const[SETVAL], arg ptr[in, int32])
    39  
    40  resource ipc_shm[ipc]
    41  resource shmaddr[intptr]: 0
    42  # The unused arg is unused by syscall (does not exist at all),
    43  # but it helps to generate sane size values.
    44  shmget(key proc[2039339027, 4], size len[unused], flags flags[shmget_flags], unused vma) ipc_shm
    45  shmget$private(key const[IPC_PRIVATE], size len[unused], flags flags[shmget_flags], unused vma) ipc_shm
    46  shmat(shmid ipc_shm, addr vma, flags flags[shmat_flags]) shmaddr
    47  shmctl$IPC_STAT(shmid ipc_shm, cmd const[IPC_STAT], buf buffer[out])
    48  shmctl$IPC_SET(shmid ipc_shm, cmd const[IPC_SET], buf ptr[in, shmid_ds])
    49  shmctl$IPC_RMID(shmid ipc_shm, cmd const[IPC_RMID])
    50  shmctl$SHM_LOCK(shmid ipc_shm, cmd const[SHM_LOCK])
    51  shmctl$SHM_UNLOCK(shmid ipc_shm, cmd const[SHM_UNLOCK])
    52  shmdt(addr shmaddr)
    53  
    54  msgget_flags = IPC_CREAT, IPC_EXCL, open_mode
    55  msgbuf_type = 0, 1, 2, 3
    56  msgsnd_flags = IPC_NOWAIT
    57  msgrcv_flags = IPC_NOWAIT, MSG_NOERROR
    58  semget_flags = IPC_CREAT, IPC_EXCL, open_mode
    59  semop_flags = IPC_NOWAIT, SEM_UNDO
    60  sem_sem_id = 0, 1, 2, 3, 4
    61  shmget_flags = IPC_CREAT, IPC_EXCL, open_mode
    62  shmat_flags = SHM_RND, SHM_RDONLY
    63  
    64  ipc_perm {
    65  	key	int32
    66  	uid	uid
    67  	gid	gid
    68  	cuid	uid
    69  	cgid	gid
    70  	mode	flags[open_mode, int32]
    71  	seq	int16
    72  	pad0	const[0, int16]
    73  	pad1	const[0, intptr]
    74  	pad2	const[0, intptr]
    75  }
    76  
    77  msqid_ds {
    78  	perm	ipc_perm
    79  	qnum	intptr
    80  	qbytes	intptr
    81  	lspid	pid
    82  	lrpid	pid
    83  	stime	intptr
    84  	rtime	intptr
    85  	ctime	intptr
    86  	cbytes	intptr
    87  	pad0	const[0, intptr]
    88  	pad1	const[0, intptr]
    89  }
    90  
    91  shmid_ds {
    92  	perm	ipc_perm
    93  	segsz	int32
    94  	nattch	int16
    95  	cpid	pid
    96  	lpid	pid
    97  	atime	intptr
    98  	dtime	intptr
    99  	ctime	intptr
   100  	unused0	const[0, int16]
   101  	unused1	const[0, intptr]
   102  	unused2	const[0, intptr]
   103  }
   104  
   105  semid_ds {
   106  	perm	ipc_perm
   107  	otime	intptr
   108  	ctime	intptr
   109  	nsems	intptr
   110  	pad0	const[0, intptr]
   111  	pad1	const[0, intptr]
   112  }
   113  
   114  sembuf {
   115  	num	flags[sem_sem_id, int16]
   116  	op	int16
   117  	flg	flags[semop_flags, int16]
   118  }
   119  
   120  msgbuf {
   121  	typ	flags[msgbuf_type, intptr]
   122  	data	array[int8]
   123  } [packed]