b648d4806b
- The uid/cuid members of struct ipc_perm are now uid_t instead of unsigned short. - The gid/cgid members of struct ipc_perm are now gid_t instead of unsigned short. - The mode member of struct ipc_perm is now mode_t instead of unsigned short (this is merely a style bug). - The rather dubious padding fields for ABI compat with SV/I386 have been removed from struct msqid_ds and struct semid_ds. - The shm_segsz member of struct shmid_ds is now a size_t instead of an int. This removes the need for the shm_bsegsz member in struct shmid_kernel and should allow for complete support of SYSV SHM regions >= 2GB. - The shm_nattch member of struct shmid_ds is now an int instead of a short. - The shm_internal member of struct shmid_ds is now gone. The internal VM object pointer for SHM regions has been moved into struct shmid_kernel. - The existing __semctl(), msgctl(), and shmctl() system call entries are now marked COMPAT7 and new versions of those system calls which support the new ABI are now present. - The new system calls are assigned to the FBSD-1.1 version in libc. The FBSD-1.0 symbols in libc now refer to the old COMPAT7 system calls. - A simplistic framework for tagging system calls with compatibility symbol versions has been added to libc. Version tags are added to system calls by adding an appropriate __sym_compat() entry to src/lib/libc/incldue/compat.h. [1] PR: kern/16195 kern/113218 bin/129855 Reviewed by: arch@, rwatson Discussed with: kan, kib [1]
154 lines
4.1 KiB
C
154 lines
4.1 KiB
C
/* $FreeBSD$ */
|
|
/* $NetBSD: sem.h,v 1.5 1994/06/29 06:45:15 cgd Exp $ */
|
|
|
|
/*
|
|
* SVID compatible sem.h file
|
|
*
|
|
* Author: Daniel Boulet
|
|
*/
|
|
|
|
#ifndef _SYS_SEM_H_
|
|
#define _SYS_SEM_H_
|
|
|
|
#include <sys/ipc.h>
|
|
|
|
#ifndef _PID_T_DECLARED
|
|
typedef __pid_t pid_t;
|
|
#define _PID_T_DECLARED
|
|
#endif
|
|
|
|
#ifndef _SIZE_T_DECLARED
|
|
typedef __size_t size_t;
|
|
#define _SIZE_T_DECLARED
|
|
#endif
|
|
|
|
#ifndef _TIME_T_DECLARED
|
|
typedef __time_t time_t;
|
|
#define _TIME_T_DECLARED
|
|
#endif
|
|
|
|
#if defined(COMPAT_FREEBSD4) || defined(COMPAT_FREEBSD5) || \
|
|
defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD7)
|
|
struct semid_ds_old {
|
|
struct ipc_perm_old sem_perm; /* operation permission struct */
|
|
struct sem *sem_base; /* pointer to first semaphore in set */
|
|
unsigned short sem_nsems; /* number of sems in set */
|
|
time_t sem_otime; /* last operation time */
|
|
long sem_pad1; /* SVABI/386 says I need this here */
|
|
time_t sem_ctime; /* last change time */
|
|
/* Times measured in secs since */
|
|
/* 00:00:00 GMT, Jan. 1, 1970 */
|
|
long sem_pad2; /* SVABI/386 says I need this here */
|
|
long sem_pad3[4]; /* SVABI/386 says I need this here */
|
|
};
|
|
#endif
|
|
|
|
struct semid_ds {
|
|
struct ipc_perm sem_perm; /* operation permission struct */
|
|
struct sem *sem_base; /* pointer to first semaphore in set */
|
|
unsigned short sem_nsems; /* number of sems in set */
|
|
time_t sem_otime; /* last operation time */
|
|
time_t sem_ctime; /* last change time */
|
|
/* Times measured in secs since */
|
|
/* 00:00:00 GMT, Jan. 1, 1970 */
|
|
};
|
|
|
|
/*
|
|
* semop's sops parameter structure
|
|
*/
|
|
struct sembuf {
|
|
unsigned short sem_num; /* semaphore # */
|
|
short sem_op; /* semaphore operation */
|
|
short sem_flg; /* operation flags */
|
|
};
|
|
#define SEM_UNDO 010000
|
|
|
|
#if defined(COMPAT_FREEBSD4) || defined(COMPAT_FREEBSD5) || \
|
|
defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD7) || \
|
|
defined(_WANT_SEMUN_OLD)
|
|
union semun_old {
|
|
int val; /* value for SETVAL */
|
|
struct semid_ds_old *buf; /* buffer for IPC_STAT & IPC_SET */
|
|
unsigned short *array; /* array for GETALL & SETALL */
|
|
};
|
|
#endif
|
|
|
|
/*
|
|
* semctl's arg parameter structure
|
|
*/
|
|
union semun {
|
|
int val; /* value for SETVAL */
|
|
struct semid_ds *buf; /* buffer for IPC_STAT & IPC_SET */
|
|
unsigned short *array; /* array for GETALL & SETALL */
|
|
};
|
|
|
|
/*
|
|
* commands for semctl
|
|
*/
|
|
#define GETNCNT 3 /* Return the value of semncnt {READ} */
|
|
#define GETPID 4 /* Return the value of sempid {READ} */
|
|
#define GETVAL 5 /* Return the value of semval {READ} */
|
|
#define GETALL 6 /* Return semvals into arg.array {READ} */
|
|
#define GETZCNT 7 /* Return the value of semzcnt {READ} */
|
|
#define SETVAL 8 /* Set the value of semval to arg.val {ALTER} */
|
|
#define SETALL 9 /* Set semvals from arg.array {ALTER} */
|
|
#define SEM_STAT 10 /* Like IPC_STAT but treats semid as sema-index */
|
|
#define SEM_INFO 11 /* Like IPC_INFO but treats semid as sema-index */
|
|
|
|
/*
|
|
* Permissions
|
|
*/
|
|
#define SEM_A IPC_W /* alter permission */
|
|
#define SEM_R IPC_R /* read permission */
|
|
|
|
#ifdef _KERNEL
|
|
|
|
/*
|
|
* semaphore info struct
|
|
*/
|
|
struct seminfo {
|
|
int semmap, /* # of entries in semaphore map */
|
|
semmni, /* # of semaphore identifiers */
|
|
semmns, /* # of semaphores in system */
|
|
semmnu, /* # of undo structures in system */
|
|
semmsl, /* max # of semaphores per id */
|
|
semopm, /* max # of operations per semop call */
|
|
semume, /* max # of undo entries per process */
|
|
semusz, /* size in bytes of undo structure */
|
|
semvmx, /* semaphore maximum value */
|
|
semaem; /* adjust on exit max value */
|
|
};
|
|
extern struct seminfo seminfo;
|
|
|
|
/*
|
|
* Kernel wrapper for the user-level structure
|
|
*/
|
|
struct semid_kernel {
|
|
struct semid_ds u;
|
|
struct label *label; /* MAC framework label */
|
|
};
|
|
|
|
/* internal "mode" bits */
|
|
#define SEM_ALLOC 01000 /* semaphore is allocated */
|
|
#define SEM_DEST 02000 /* semaphore will be destroyed on last detach */
|
|
|
|
/*
|
|
* Process sem_undo vectors at proc exit.
|
|
*/
|
|
void semexit(struct proc *p);
|
|
|
|
#else /* ! _KERNEL */
|
|
|
|
__BEGIN_DECLS
|
|
#if __BSD_VISIBLE
|
|
int semsys(int, ...);
|
|
#endif
|
|
int semctl(int, int, int, ...);
|
|
int semget(key_t, int, int);
|
|
int semop(int, struct sembuf *, size_t);
|
|
__END_DECLS
|
|
|
|
#endif /* !_KERNEL */
|
|
|
|
#endif /* !_SYS_SEM_H_ */
|