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

     1  # Copyright 2021 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/filio.h>
     7  include <sys/ipc.h>
     8  include <sys/mman.h>
     9  include <sys/msg.h>
    10  include <sys/sem.h>
    11  include <sys/shm.h>
    12  include <sys/stat.h>
    13  
    14  resource ipc[int32]: 0, 0xffffffffffffffff
    15  
    16  # TODO: describe ipc syscall
    17  
    18  define SYS___semctl	510
    19  
    20  resource ipc_msq[ipc]
    21  msgget(key proc[2039379027, 4], flags flags[msgget_flags]) ipc_msq
    22  msgget$private(key const[IPC_PRIVATE], flags flags[msgget_flags]) ipc_msq
    23  msgsnd(msqid ipc_msq, msgp ptr[in, msgbuf], sz len[msgp], flags flags[msgsnd_flags])
    24  msgrcv(msqid ipc_msq, msgp ptr[out, msgbuf], sz len[msgp], typ flags[msgbuf_type], flags flags[msgrcv_flags])
    25  msgctl$IPC_STAT(msqid ipc_msq, cmd const[IPC_STAT], buf buffer[out])
    26  msgctl$IPC_SET(msqid ipc_msq, cmd const[IPC_SET], buf ptr[in, msqid_ds])
    27  msgctl$IPC_RMID(msqid ipc_msq, cmd const[IPC_RMID])
    28  
    29  resource ipc_sem[ipc]
    30  semget(key proc[2039359027, 4], nsems flags[sem_sem_id], flags flags[semget_flags]) ipc_sem
    31  semget$private(key const[IPC_PRIVATE], nsems flags[sem_sem_id], flags flags[semget_flags]) ipc_sem
    32  semop(semid ipc_sem, ops ptr[in, array[sembuf]], nops len[ops])
    33  
    34  resource ipc_shm[ipc]
    35  resource shmaddr[intptr]: 0
    36  # The unused arg is unused by syscall (does not exist at all),
    37  # but it helps to generate sane size values.
    38  shmget(key proc[2039339027, 4], size len[unused], flags flags[shmget_flags], unused vma) ipc_shm
    39  shmget$private(key const[IPC_PRIVATE], size len[unused], flags flags[shmget_flags], unused vma) ipc_shm
    40  shmat(shmid ipc_shm, addr vma, flags flags[shmat_flags]) shmaddr
    41  shmctl$IPC_STAT(shmid ipc_shm, cmd const[IPC_STAT], buf buffer[out])
    42  shmctl$IPC_SET(shmid ipc_shm, cmd const[IPC_SET], buf ptr[in, shmid_ds])
    43  shmctl$IPC_RMID(shmid ipc_shm, cmd const[IPC_RMID])
    44  shmdt(addr shmaddr)
    45  
    46  shm_unlink(path ptr[in, filename])
    47  
    48  msgget_flags = IPC_CREAT, IPC_EXCL, open_mode
    49  msgbuf_type = 0, 1, 2, 3
    50  msgsnd_flags = IPC_NOWAIT
    51  msgrcv_flags = IPC_NOWAIT, MSG_NOERROR
    52  semget_flags = IPC_CREAT, IPC_EXCL, open_mode
    53  semop_flags = IPC_NOWAIT, SEM_UNDO
    54  sem_sem_id = 0, 1, 2, 3, 4
    55  shmget_flags = IPC_CREAT, IPC_EXCL, open_mode
    56  shmat_flags = SHM_RND, SHM_RDONLY
    57  
    58  ipc_perm {
    59  	key	int32
    60  	uid	uid
    61  	gid	gid
    62  	cuid	uid
    63  	cgid	gid
    64  	mode	flags[open_mode, int32]
    65  	seq	int16
    66  	pad0	const[0, int16]
    67  	pad1	const[0, intptr]
    68  	pad2	const[0, intptr]
    69  }
    70  
    71  msqid_ds {
    72  	perm	ipc_perm
    73  	stime	intptr
    74  	rtime	intptr
    75  	ctime	intptr
    76  	cbytes	intptr
    77  	qnum	intptr
    78  	qbytes	intptr
    79  	lspid	pid
    80  	lrpid	pid
    81  	pad0	const[0, intptr]
    82  	pad1	const[0, intptr]
    83  }
    84  
    85  shmid_ds {
    86  	perm	ipc_perm
    87  	segsz	int32
    88  	atime	intptr
    89  	dtime	intptr
    90  	ctime	intptr
    91  	cpid	pid
    92  	lpid	pid
    93  	nattch	int16
    94  	unused0	const[0, int16]
    95  	unused1	const[0, intptr]
    96  	unused2	const[0, intptr]
    97  }
    98  
    99  sembuf {
   100  	num	flags[sem_sem_id, int16]
   101  	op	int16
   102  	flg	flags[semop_flags, int16]
   103  }
   104  
   105  msgbuf {
   106  	typ	flags[msgbuf_type, intptr]
   107  	data	array[int8]
   108  } [packed]