PERFORCE change 111025 for review
Todd Miller
millert at FreeBSD.org
Mon Dec 4 08:47:55 PST 2006
http://perforce.freebsd.org/chv.cgi?CH=111025
Change 111025 by millert at millert_g5tower on 2006/12/04 16:38:58
Export the posix sem/shm subsystem locks.
Use struct definitions in the header files instead
of duplicating them in the .c files.
Affected files ...
.. //depot/projects/trustedbsd/sedarwin8/darwin/xnu/bsd/kern/posix_sem.c#6 edit
.. //depot/projects/trustedbsd/sedarwin8/darwin/xnu/bsd/kern/posix_shm.c#6 edit
.. //depot/projects/trustedbsd/sedarwin8/darwin/xnu/bsd/sys/posix_sem.h#4 edit
.. //depot/projects/trustedbsd/sedarwin8/darwin/xnu/bsd/sys/posix_shm.h#4 edit
Differences ...
==== //depot/projects/trustedbsd/sedarwin8/darwin/xnu/bsd/kern/posix_sem.c#6 (text+ko) ====
@@ -65,6 +65,7 @@
#include <sys/tty.h>
#include <sys/malloc.h>
#include <sys/semaphore.h>
+#include <sys/posix_sem.h>
#include <sys/sysproto.h>
#include <bsm/audit_kernel.h>
@@ -90,30 +91,7 @@
#define f_ops f_fglob->fg_ops
#define f_offset f_fglob->fg_offset
#define f_data f_fglob->fg_data
-#define PSEMNAMLEN 31 /* maximum name segment length we bother with */
-
-struct pseminfo {
- unsigned int psem_flags;
- unsigned int psem_usecount;
- mode_t psem_mode;
- uid_t psem_uid;
- gid_t psem_gid;
- char psem_name[PSEMNAMLEN + 1]; /* segment name */
- semaphore_t psem_semobject;
- struct proc * sem_proc;
- struct label * psem_label;
-};
-#define PSEMINFO_NULL (struct pseminfo *)0
-#define PSEM_NONE 1
-#define PSEM_DEFINED 2
-#define PSEM_ALLOCATED 4
-#define PSEM_MAPPED 8
-#define PSEM_INUSE 0x10
-#define PSEM_REMOVED 0x20
-#define PSEM_INCREATE 0x40
-#define PSEM_INDELETE 0x80
-
struct psemcache {
LIST_ENTRY(psemcache) psem_hash; /* hash chain */
struct pseminfo *pseminfo; /* vnode the name refers to */
@@ -183,10 +161,7 @@
static lck_grp_t *psx_sem_subsys_lck_grp;
static lck_grp_attr_t *psx_sem_subsys_lck_grp_attr;
static lck_attr_t *psx_sem_subsys_lck_attr;
-static lck_mtx_t psx_sem_subsys_mutex;
-
-#define PSEM_SUBSYS_LOCK() lck_mtx_lock(& psx_sem_subsys_mutex)
-#define PSEM_SUBSYS_UNLOCK() lck_mtx_unlock(& psx_sem_subsys_mutex)
+ lck_mtx_t psx_sem_subsys_mutex;
static int psem_cache_add(struct pseminfo *psemp, struct psemname *pnp, struct psemcache *pcp);
==== //depot/projects/trustedbsd/sedarwin8/darwin/xnu/bsd/kern/posix_shm.c#6 (text+ko) ====
@@ -67,6 +67,7 @@
#include <sys/mman.h>
#include <sys/stat.h>
#include <sys/sysproto.h>
+#include <sys/posix_shm.h>
#include <bsm/audit_kernel.h>
@@ -93,35 +94,7 @@
#define f_ops f_fglob->fg_ops
#define f_offset f_fglob->fg_offset
#define f_data f_fglob->fg_data
-#define PSHMNAMLEN 31 /* maximum name segment length we bother with */
-
-struct pshminfo {
- unsigned int pshm_flags;
- unsigned int pshm_usecount;
- off_t pshm_length;
- mode_t pshm_mode;
- uid_t pshm_uid;
- gid_t pshm_gid;
- char pshm_name[PSHMNAMLEN + 1]; /* segment name */
- void * pshm_memobject;
-#if DIAGNOSTIC
- unsigned int pshm_readcount;
- unsigned int pshm_writecount;
- struct proc * pshm_proc;
-#endif /* DIAGNOSTIC */
- struct label* pshm_label;
-};
-#define PSHMINFO_NULL (struct pshminfo *)0
-#define PSHM_NONE 1
-#define PSHM_DEFINED 2
-#define PSHM_ALLOCATED 4
-#define PSHM_MAPPED 8
-#define PSHM_INUSE 0x10
-#define PSHM_REMOVED 0x20
-#define PSHM_INCREATE 0x40
-#define PSHM_INDELETE 0x80
-
struct pshmcache {
LIST_ENTRY(pshmcache) pshm_hash; /* hash chain */
struct pshminfo *pshminfo; /* vnode the name refers to */
@@ -193,10 +166,7 @@
static lck_grp_t *psx_shm_subsys_lck_grp;
static lck_grp_attr_t *psx_shm_subsys_lck_grp_attr;
static lck_attr_t *psx_shm_subsys_lck_attr;
-static lck_mtx_t psx_shm_subsys_mutex;
-
-#define PSHM_SUBSYS_LOCK() lck_mtx_lock(& psx_shm_subsys_mutex)
-#define PSHM_SUBSYS_UNLOCK() lck_mtx_unlock(& psx_shm_subsys_mutex)
+ lck_mtx_t psx_shm_subsys_mutex;
/* Initialize the mutex governing access to the posix shm subsystem */
==== //depot/projects/trustedbsd/sedarwin8/darwin/xnu/bsd/sys/posix_sem.h#4 (text+ko) ====
@@ -76,4 +76,10 @@
#define PSEM_INCREATE 0x40
#define PSEM_INDELETE 0x80
+#ifdef KERNEL
+extern lck_mtx_t psx_sem_subsys_mutex;
+#define PSEM_SUBSYS_LOCK() lck_mtx_lock(& psx_sem_subsys_mutex)
+#define PSEM_SUBSYS_UNLOCK() lck_mtx_unlock(& psx_sem_subsys_mutex)
+#endif
+
#endif
==== //depot/projects/trustedbsd/sedarwin8/darwin/xnu/bsd/sys/posix_shm.h#4 (text+ko) ====
@@ -80,4 +80,10 @@
#define PSHM_INCREATE 0x40
#define PSHM_INDELETE 0x80
+#ifdef KERNEL
+extern lck_mtx_t psx_shm_subsys_mutex;
+#define PSHM_SUBSYS_LOCK() lck_mtx_lock(& psx_shm_subsys_mutex)
+#define PSHM_SUBSYS_UNLOCK() lck_mtx_unlock(& psx_shm_subsys_mutex)
+#endif /* KERNEL */
+
#endif
More information about the trustedbsd-cvs
mailing list