cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

sem.h (3094B)


      1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
      2#ifndef _UAPI_LINUX_SEM_H
      3#define _UAPI_LINUX_SEM_H
      4
      5#include <linux/ipc.h>
      6
      7/* semop flags */
      8#define SEM_UNDO        0x1000  /* undo the operation on exit */
      9
     10/* semctl Command Definitions. */
     11#define GETPID  11       /* get sempid */
     12#define GETVAL  12       /* get semval */
     13#define GETALL  13       /* get all semval's */
     14#define GETNCNT 14       /* get semncnt */
     15#define GETZCNT 15       /* get semzcnt */
     16#define SETVAL  16       /* set semval */
     17#define SETALL  17       /* set all semval's */
     18
     19/* ipcs ctl cmds */
     20#define SEM_STAT 18
     21#define SEM_INFO 19
     22#define SEM_STAT_ANY 20
     23
     24/* Obsolete, used only for backwards compatibility and libc5 compiles */
     25struct semid_ds {
     26	struct ipc_perm	sem_perm;		/* permissions .. see ipc.h */
     27	__kernel_old_time_t sem_otime;		/* last semop time */
     28	__kernel_old_time_t sem_ctime;		/* create/last semctl() time */
     29	struct sem	*sem_base;		/* ptr to first semaphore in array */
     30	struct sem_queue *sem_pending;		/* pending operations to be processed */
     31	struct sem_queue **sem_pending_last;	/* last pending operation */
     32	struct sem_undo	*undo;			/* undo requests on this array */
     33	unsigned short	sem_nsems;		/* no. of semaphores in array */
     34};
     35
     36/* Include the definition of semid64_ds */
     37#include <asm/sembuf.h>
     38
     39/* semop system calls takes an array of these. */
     40struct sembuf {
     41	unsigned short  sem_num;	/* semaphore index in array */
     42	short		sem_op;		/* semaphore operation */
     43	short		sem_flg;	/* operation flags */
     44};
     45
     46/* arg for semctl system calls. */
     47union semun {
     48	int val;			/* value for SETVAL */
     49	struct semid_ds __user *buf;	/* buffer for IPC_STAT & IPC_SET */
     50	unsigned short __user *array;	/* array for GETALL & SETALL */
     51	struct seminfo __user *__buf;	/* buffer for IPC_INFO */
     52	void __user *__pad;
     53};
     54
     55struct  seminfo {
     56	int semmap;
     57	int semmni;
     58	int semmns;
     59	int semmnu;
     60	int semmsl;
     61	int semopm;
     62	int semume;
     63	int semusz;
     64	int semvmx;
     65	int semaem;
     66};
     67
     68/*
     69 * SEMMNI, SEMMSL and SEMMNS are default values which can be
     70 * modified by sysctl.
     71 * The values has been chosen to be larger than necessary for any
     72 * known configuration.
     73 *
     74 * SEMOPM should not be increased beyond 1000, otherwise there is the
     75 * risk that semop()/semtimedop() fails due to kernel memory fragmentation when
     76 * allocating the sop array.
     77 */
     78
     79
     80#define SEMMNI  32000           /* <= IPCMNI  max # of semaphore identifiers */
     81#define SEMMSL  32000           /* <= INT_MAX max num of semaphores per id */
     82#define SEMMNS  (SEMMNI*SEMMSL) /* <= INT_MAX max # of semaphores in system */
     83#define SEMOPM  500	        /* <= 1 000 max num of ops per semop call */
     84#define SEMVMX  32767           /* <= 32767 semaphore maximum value */
     85#define SEMAEM  SEMVMX          /* adjust on exit max value */
     86
     87/* unused */
     88#define SEMUME  SEMOPM          /* max num of undo entries per process */
     89#define SEMMNU  SEMMNS          /* num of undo structures system wide */
     90#define SEMMAP  SEMMNS          /* # of entries in semaphore map */
     91#define SEMUSZ  20		/* sizeof struct sem_undo */
     92
     93
     94#endif /* _UAPI_LINUX_SEM_H */