Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F144305361
D14271.id39058.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
5 KB
Referenced Files
None
Subscribers
None
D14271.id39058.diff
View Options
Index: sys/sys/ipc.h
===================================================================
--- sys/sys/ipc.h
+++ sys/sys/ipc.h
@@ -119,12 +119,14 @@
#define IPC_INFO 3 /* get info */
#endif
-#ifdef _KERNEL
+#if defined(_KERNEL) || defined(_WANT_IPCID_MACROS)
/* Macros to convert between ipc ids and array indices or sequence ids */
#define IPCID_TO_IX(id) ((id) & 0xffff)
#define IPCID_TO_SEQ(id) (((id) >> 16) & 0xffff)
#define IXSEQ_TO_IPCID(ix,perm) (((perm.seq) << 16) | (ix & 0xffff))
+#endif
+#ifdef _KERNEL
struct thread;
struct proc;
struct vmspace;
Index: sys/sys/msg.h
===================================================================
--- sys/sys/msg.h
+++ sys/sys/msg.h
@@ -116,7 +116,6 @@
#endif
#ifdef _KERNEL
-
struct msg {
struct msg *msg_next; /* next msg in the chain */
long msg_type; /* type of this message */
@@ -126,7 +125,9 @@
short msg_spot; /* location of start of msg in buffer */
struct label *label; /* MAC Framework label */
};
+#endif
+#if defined(_KERNEL) || defined(_WANT_MSGINFO)
/*
* Based on the configuration parameters described in an SVR2 (yes, two)
* config(1m) man page.
@@ -145,8 +146,9 @@
int msgssz; /* size of a message segment (see note) */
int msgseg; /* number of message segments */
};
-extern struct msginfo msginfo;
+#endif
+#if defined(_KERNEL) || defined(_WANT_MSQID_KERNEL)
/*
* Kernel wrapper for the user-level structure.
*/
@@ -162,10 +164,11 @@
struct label *label; /* MAC label */
struct ucred *cred; /* creator's credentials */
};
+#endif
-#endif /* _KERNEL */
-
-#if !defined(_KERNEL) || defined(_WANT_MSG_PROTOTYPES)
+#ifdef _KERNEL
+extern struct msginfo msginfo;
+#else /* _KERNEL */
__BEGIN_DECLS
int msgctl(int, int, struct msqid_ds *);
int msgget(key_t, int);
@@ -175,7 +178,6 @@
int msgsys(int, ...);
#endif
__END_DECLS
-
-#endif /* !_KERNEL || _WANT_MSG_PROTOTYPES */
+#endif /* !_KERNEL */
#endif /* !_SYS_MSG_H_ */
Index: sys/sys/sem.h
===================================================================
--- sys/sys/sem.h
+++ sys/sys/sem.h
@@ -101,8 +101,7 @@
#define SEM_A IPC_W /* alter permission */
#define SEM_R IPC_R /* read permission */
-#ifdef _KERNEL
-
+#if defined(_KERNEL) || defined(_WANT_SEMINFO)
/*
* semaphore info struct
*/
@@ -117,8 +116,9 @@
int semvmx; /* semaphore maximum value */
int semaem; /* adjust on exit max value */
};
-extern struct seminfo seminfo;
+#endif
+#if defined(_KERNEL) || defined(_WANT_SEMID_KERNEL)
/*
* Kernel wrapper for the user-level structure
*/
@@ -127,19 +127,23 @@
struct label *label; /* MAC framework label */
struct ucred *cred; /* creator's credentials */
};
+#endif
+#if defined(_KERNEL) || defined(_WANT_SEM_INTERNAL_MODES)
/* 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);
-#endif /* _KERNEL */
+#else /* !_KERNEL */
-#if !defined(_KERNEL) || defined(_WANT_SEM_PROTOTYPES)
__BEGIN_DECLS
#if __BSD_VISIBLE
int semsys(int, ...);
@@ -149,6 +153,6 @@
int semop(int, struct sembuf *, size_t);
__END_DECLS
-#endif /* !_KERNEL || _WANT_SEM_PROTOTYPES */
+#endif /* !_KERNEL */
#endif /* !_SYS_SEM_H_ */
Index: sys/sys/shm.h
===================================================================
--- sys/sys/shm.h
+++ sys/sys/shm.h
@@ -107,9 +107,7 @@
time_t shm_ctime; /* time of last change by shmctl() */
};
-#ifdef _KERNEL
-#include <vm/vm.h>
-
+#if defined(_KERNEL) || defined(_WANT_SHMINFO)
/*
* System 5 style catch-all structure for shared memory constants that
* might be of interest to user programs. Do we really want/need this?
@@ -121,6 +119,15 @@
u_long shmseg; /* max shared memory segments per process */
u_long shmall; /* max amount of shared memory (pages) */
};
+#endif
+
+#if defined(_KERNEL) || defined(_WANT_SHMID_KERNEL)
+#ifdef _KERNEL
+#include <vm/vm.h>
+#else
+struct vm_object;
+typedef struct vm_object *vm_object_t;
+#endif
/*
* Add a kernel wrapper to the shmid_ds struct so that private info (like the
@@ -132,8 +139,7 @@
struct label *label; /* MAC label */
struct ucred *cred; /* creator's credendials */
};
-
-extern struct shminfo shminfo;
+#endif
struct shm_info {
int used_ids;
@@ -144,15 +150,17 @@
unsigned long swap_successes;
};
-struct thread;
+#ifdef _KERNEL
struct proc;
struct vmspace;
+extern struct shminfo shminfo;
+
void shmexit(struct vmspace *);
void shmfork(struct proc *, struct proc *);
-#endif /* _KERNEL */
-#if !defined(_KERNEL) || defined(_WANT_SHM_PROTOTYPES)
+#else /* !_KERNEL */
+
#include <sys/cdefs.h>
#ifndef _SIZE_T_DECLARED
@@ -170,6 +178,6 @@
int shmdt(const void *);
__END_DECLS
-#endif /* _KERNEL || _WANT_SHM_PROTOTYPES */
+#endif /* _KERNEL */
#endif /* !_SYS_SHM_H_ */
Index: usr.bin/ipcrm/ipcrm.c
===================================================================
--- usr.bin/ipcrm/ipcrm.c
+++ usr.bin/ipcrm/ipcrm.c
@@ -36,14 +36,18 @@
__FBSDID("$FreeBSD$");
#include <sys/param.h>
-#define _WANT_MSG_PROTOTYPES
-#define _WANT_SEM_PROTOTYPES
-#define _WANT_SHM_PROTOTYPES
-#define _KERNEL
+#define _WANT_IPCID_MACROS
+#include <sys/ipc.h>
+#define _WANT_MSGINFO
+#define _WANT_MSQID_KERNEL
+#include <sys/msg.h>
+#define _WANT_SEM_INTERNAL_MODES
+#define _WANT_SEMINFO
+#define _WANT_SEMID_KERNEL
#include <sys/sem.h>
+#define _WANT_SHMINFO
+#define _WANT_SHMID_KERNEL
#include <sys/shm.h>
-#include <sys/msg.h>
-#undef _KERNEL
#include <ctype.h>
#include <err.h>
Index: usr.bin/ipcs/ipc.h
===================================================================
--- usr.bin/ipcs/ipc.h
+++ usr.bin/ipcs/ipc.h
@@ -68,3 +68,6 @@
extern struct semid_kernel *sema;
extern struct msqid_kernel *msqids;
extern struct shmid_kernel *shmsegs;
+extern struct seminfo seminfo;
+extern struct msginfo msginfo;
+extern struct shminfo shminfo;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Feb 8, 6:21 PM (21 h, 48 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28483010
Default Alt Text
D14271.id39058.diff (5 KB)
Attached To
Mode
D14271: Get rid of the requirement to include SysV IPC headers with _KERNEL defined in ipcrm by introducing a number of _WANT_foo defines.
Attached
Detach File
Event Timeline
Log In to Comment