diff --git a/sys/sys/msg.h b/sys/sys/msg.h index d8c950e66c47..a880c538ddc1 100644 --- a/sys/sys/msg.h +++ b/sys/sys/msg.h @@ -1,171 +1,168 @@ /* $NetBSD: msg.h,v 1.4 1994/06/29 06:44:43 cgd Exp $ */ /*- * SVID compatible msg.h file * * Author: Daniel Boulet * * Copyright 1993 Daniel Boulet and RTMX Inc. * * This system call was implemented by Daniel Boulet under contract from RTMX. * * Redistribution and use in source forms, with and without modification, * are permitted provided that this entire comment appears intact. * * Redistribution in binary form may occur without any restrictions. * Obviously, it would be nice if you gave credit where credit is due * but requiring it would be too onerous. * * This software is provided ``AS IS'' without any warranties of any kind. */ #ifndef _SYS_MSG_H_ #define _SYS_MSG_H_ #include #include #ifdef _WANT_SYSVMSG_INTERNALS #define _WANT_SYSVIPC_INTERNALS #endif #include /* * The MSG_NOERROR identifier value, the msqid_ds struct and the msg struct * are as defined by the SV API Intel 386 Processor Supplement. */ #define MSG_NOERROR 010000 /* don't complain about too long msgs */ typedef unsigned long msglen_t; typedef unsigned long msgqnum_t; #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 _SSIZE_T_DECLARED typedef __ssize_t ssize_t; #define _SSIZE_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 msqid_ds_old { struct ipc_perm_old msg_perm; /* msg queue permission bits */ struct msg *__msg_first; /* first message in the queue */ struct msg *__msg_last; /* last message in the queue */ msglen_t msg_cbytes; /* number of bytes in use on the queue */ msgqnum_t msg_qnum; /* number of msgs in the queue */ msglen_t msg_qbytes; /* max # of bytes on the queue */ pid_t msg_lspid; /* pid of last msgsnd() */ pid_t msg_lrpid; /* pid of last msgrcv() */ time_t msg_stime; /* time of last msgsnd() */ long msg_pad1; time_t msg_rtime; /* time of last msgrcv() */ long msg_pad2; time_t msg_ctime; /* time of last msgctl() */ long msg_pad3; long msg_pad4[4]; }; #endif /* * XXX there seems to be no prefix reserved for this header, so the name * "msg" in "struct msg" and the names of all of the nonstandard members * are namespace pollution. */ struct msqid_ds { struct ipc_perm msg_perm; /* msg queue permission bits */ struct msg *__msg_first; /* first message in the queue */ struct msg *__msg_last; /* last message in the queue */ msglen_t msg_cbytes; /* number of bytes in use on the queue */ msgqnum_t msg_qnum; /* number of msgs in the queue */ msglen_t msg_qbytes; /* max # of bytes on the queue */ pid_t msg_lspid; /* pid of last msgsnd() */ pid_t msg_lrpid; /* pid of last msgrcv() */ time_t msg_stime; /* time of last msgsnd() */ time_t msg_rtime; /* time of last msgrcv() */ time_t msg_ctime; /* time of last msgctl() */ }; #ifdef _KERNEL struct msg { struct msg *msg_next; /* next msg in the chain */ long msg_type; /* type of this message */ /* >0 -> type of this message */ /* 0 -> free header */ u_short msg_ts; /* size of this message */ short msg_spot; /* location of start of msg in buffer */ struct label *label; /* MAC Framework label */ }; #endif #if defined(_KERNEL) || defined(_WANT_SYSVMSG_INTERNALS) /* * Based on the configuration parameters described in an SVR2 (yes, two) * config(1m) man page. * * Each message is broken up and stored in segments that are msgssz bytes * long. For efficiency reasons, this should be a power of two. Also, * it doesn't make sense if it is less than 8 or greater than about 256. * Consequently, msginit in kern/sysv_msg.c checks that msgssz is a power of * two between 8 and 1024 inclusive (and panic's if it isn't). */ struct msginfo { int msgmax; /* max chars in a message */ int msgmni; /* max message queue identifiers */ int msgmnb; /* max chars in a queue */ int msgtql; /* max messages in system */ int msgssz; /* size of a message segment (see note) */ int msgseg; /* number of message segments */ }; /* * Kernel wrapper for the user-level structure. */ struct msqid_kernel { /* * Data structure exposed to user space. */ struct msqid_ds u; /* * Kernel-private components of the message queue. */ struct label *label; /* MAC label */ struct ucred *cred; /* creator's credentials */ }; #endif #ifdef _KERNEL extern struct msginfo msginfo; int kern_get_msqids(struct thread *td, struct msqid_kernel **res, size_t *sz); #else /* _KERNEL */ __BEGIN_DECLS int msgctl(int, int, struct msqid_ds *); int msgget(key_t, int); ssize_t msgrcv(int, void *, size_t, long, int); int msgsnd(int, const void *, size_t, int); -#if __BSD_VISIBLE -int msgsys(int, ...); -#endif __END_DECLS #endif /* !_KERNEL */ #endif /* !_SYS_MSG_H_ */ diff --git a/sys/sys/sem.h b/sys/sys/sem.h index 5634f4b0cfcc..ebb287d6642f 100644 --- a/sys/sys/sem.h +++ b/sys/sys/sem.h @@ -1,161 +1,158 @@ /* $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_ #ifdef _WANT_SYSVSEM_INTERNALS #define _WANT_SYSVIPC_INTERNALS #endif #include #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 UTC, Jan. 1, 1970, without leap seconds */ 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 UTC, Jan. 1, 1970, without leap seconds */ }; /* * 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 #if defined(_KERNEL) || defined(_WANT_SEMUN) /* * 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 */ }; #endif /* * 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 */ #if defined(_KERNEL) || defined(_WANT_SYSVSEM_INTERNALS) /* * semaphore info struct */ struct seminfo { int semmni; /* # of semaphore identifiers */ int semmns; /* # of semaphores in system */ int semmnu; /* # of undo structures in system */ int semmsl; /* max # of semaphores per id */ int semopm; /* max # of operations per semop call */ int semume; /* max # of undo entries per process */ int semusz; /* size in bytes of undo structure */ int semvmx; /* semaphore maximum value */ int semaem; /* adjust on exit max value */ }; /* * Kernel wrapper for the user-level structure */ struct semid_kernel { struct semid_ds u; struct label *label; /* MAC framework label */ struct ucred *cred; /* creator's credentials */ }; /* internal "mode" bits */ #define SEM_ALLOC 01000 /* semaphore is allocated */ #define SEM_DEST 02000 /* semaphore will be destroyed on last detach */ #endif #ifdef _KERNEL extern struct seminfo seminfo; /* * Process sem_undo vectors at proc exit. */ void semexit(struct proc *p); int kern_get_sema(struct thread *td, struct semid_kernel **res, size_t *sz); #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_ */ diff --git a/sys/sys/shm.h b/sys/sys/shm.h index a1aa6ca54c60..d80de811ef7d 100644 --- a/sys/sys/shm.h +++ b/sys/sys/shm.h @@ -1,185 +1,182 @@ /* $NetBSD: shm.h,v 1.15 1994/06/29 06:45:17 cgd Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause * * Copyright (c) 1994 Adam Glass * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by Adam Glass. * 4. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * As defined+described in "X/Open System Interfaces and Headers" * Issue 4, p. XXX */ #ifndef _SYS_SHM_H_ #define _SYS_SHM_H_ #include #ifdef _WANT_SYSVSHM_INTERNALS #define _WANT_SYSVIPC_INTERNALS #endif #include #include #include #define SHM_RDONLY 010000 /* Attach read-only (else read-write) */ #define SHM_RND 020000 /* Round attach address to SHMLBA */ #define SHM_REMAP 030000 /* Unmap before mapping */ #define SHMLBA PAGE_SIZE /* Segment low boundary address multiple */ /* "official" access mode definitions; somewhat braindead since you have to specify (SHM_* >> 3) for group and (SHM_* >> 6) for world permissions */ #define SHM_R (IPC_R) #define SHM_W (IPC_W) /* predefine tbd *LOCK shmctl commands */ #define SHM_LOCK 11 #define SHM_UNLOCK 12 /* ipcs shmctl commands for Linux compatibility */ #define SHM_STAT 13 #define SHM_INFO 14 #ifndef _PID_T_DECLARED typedef __pid_t pid_t; #define _PID_T_DECLARED #endif #ifndef _TIME_T_DECLARED typedef __time_t time_t; #define _TIME_T_DECLARED #endif #ifndef _SIZE_T_DECLARED typedef __size_t size_t; #define _SIZE_T_DECLARED #endif #if defined(COMPAT_FREEBSD4) || defined(COMPAT_FREEBSD5) || \ defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD7) struct shmid_ds_old { struct ipc_perm_old shm_perm; /* operation permission structure */ int shm_segsz; /* size of segment in bytes */ pid_t shm_lpid; /* process ID of last shared memory op */ pid_t shm_cpid; /* process ID of creator */ short shm_nattch; /* number of current attaches */ time_t shm_atime; /* time of last shmat() */ time_t shm_dtime; /* time of last shmdt() */ time_t shm_ctime; /* time of last change by shmctl() */ void *shm_internal; /* sysv stupidity */ }; #endif typedef unsigned int shmatt_t; struct shmid_ds { struct ipc_perm shm_perm; /* operation permission structure */ size_t shm_segsz; /* size of segment in bytes */ pid_t shm_lpid; /* process ID of last shared memory op */ pid_t shm_cpid; /* process ID of creator */ shmatt_t shm_nattch; /* number of current attaches */ time_t shm_atime; /* time of last shmat() */ time_t shm_dtime; /* time of last shmdt() */ time_t shm_ctime; /* time of last change by shmctl() */ }; #if defined(_KERNEL) || defined(_WANT_SYSVSHM_INTERNALS) /* * System 5 style catch-all structure for shared memory constants that * might be of interest to user programs. Do we really want/need this? */ struct shminfo { u_long shmmax; /* max shared memory segment size (bytes) */ u_long shmmin; /* max shared memory segment size (bytes) */ u_long shmmni; /* max number of shared memory identifiers */ u_long shmseg; /* max shared memory segments per process */ u_long shmall; /* max amount of shared memory (pages) */ }; struct vm_object; /* * Add a kernel wrapper to the shmid_ds struct so that private info (like the * MAC label) can be added to it, without changing the user interface. */ struct shmid_kernel { struct shmid_ds u; struct vm_object *object; struct label *label; /* MAC label */ struct ucred *cred; /* creator's credendials */ }; #endif struct shm_info { int used_ids; unsigned long shm_tot; unsigned long shm_rss; unsigned long shm_swp; unsigned long swap_attempts; unsigned long swap_successes; }; #ifdef _KERNEL struct proc; struct vmspace; extern struct shminfo shminfo; #define SHMSEG_FREE 0x0200 #define SHMSEG_REMOVED 0x0400 #define SHMSEG_ALLOCATED 0x0800 void shmexit(struct vmspace *); void shmfork(struct proc *, struct proc *); int kern_get_shmsegs(struct thread *td, struct shmid_kernel **res, size_t *sz); #else /* !_KERNEL */ #include #ifndef _SIZE_T_DECLARED typedef __size_t size_t; #define _SIZE_T_DECLARED #endif __BEGIN_DECLS -#if __BSD_VISIBLE -int shmsys(int, ...); -#endif void *shmat(int, const void *, int); int shmget(key_t, size_t, int); int shmctl(int, int, struct shmid_ds *); int shmdt(const void *); __END_DECLS #endif /* _KERNEL */ #endif /* !_SYS_SHM_H_ */