summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2001-08-12 22:50:13 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2001-08-12 22:50:13 +0000
commit34f549c27d56694f67a4c08f95b2ad06c5ec300a (patch)
tree454a10e8508f5cdd15726a02d94f3ad027445dd1
parent056e67aef1baaa328c478ea41ba7dede336512e3 (diff)
Don't allocate globals in include files, use extern declarations.
Move the actual variables into their respective .c files. As a bonus, remove semmap which is not used.
-rw-r--r--sys/kern/sysv_msg.c6
-rw-r--r--sys/kern/sysv_sem.c12
-rw-r--r--sys/kern/sysv_shm.c5
-rw-r--r--sys/sys/msg.h10
-rw-r--r--sys/sys/sem.h15
-rw-r--r--sys/sys/shm.h8
6 files changed, 32 insertions, 24 deletions
diff --git a/sys/kern/sysv_msg.c b/sys/kern/sysv_msg.c
index 70f94c2d407..fa6b0eead78 100644
--- a/sys/kern/sysv_msg.c
+++ b/sys/kern/sysv_msg.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sysv_msg.c,v 1.10 2001/06/22 14:14:09 deraadt Exp $ */
+/* $OpenBSD: sysv_msg.c,v 1.11 2001/08/12 22:50:12 millert Exp $ */
/* $NetBSD: sysv_msg.c,v 1.19 1996/02/09 19:00:18 christos Exp $ */
/*
@@ -36,6 +36,10 @@
int nfree_msgmaps; /* # of free map entries */
short free_msgmaps; /* head of linked list of free map entries */
struct msg *free_msghdrs; /* list of free msg headers */
+char *msgpool; /* MSGMAX byte long msg buffer pool */
+struct msgmap *msgmaps; /* MSGSEG msgmap structures */
+struct msg *msghdrs; /* MSGTQL msg headers */
+struct msqid_ds *msqids; /* MSGMNI msqid_ds struct's */
void msg_freehdr __P((struct msg *));
diff --git a/sys/kern/sysv_sem.c b/sys/kern/sysv_sem.c
index cef45295d38..36b1b0cd084 100644
--- a/sys/kern/sysv_sem.c
+++ b/sys/kern/sysv_sem.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sysv_sem.c,v 1.5 2001/05/16 17:14:35 millert Exp $ */
+/* $OpenBSD: sysv_sem.c,v 1.6 2001/08/12 22:50:12 millert Exp $ */
/* $NetBSD: sysv_sem.c,v 1.26 1996/02/09 19:00:25 christos Exp $ */
/*
@@ -20,6 +20,10 @@
#include <sys/syscallargs.h>
int semtot = 0;
+struct semid_ds *sema; /* semaphore id pool */
+struct sem *sem; /* semaphore pool */
+struct sem_undo *semu_list; /* list of active undo structures */
+int *semu; /* undo structure pool */
struct sem_undo *semu_alloc __P((struct proc *));
int semundo_adjust __P((struct proc *, struct sem_undo **, int, int, int));
@@ -50,7 +54,6 @@ seminit()
* Allocate a new sem_undo structure for a process
* (returns ptr to structure or NULL if no more room)
*/
-
struct sem_undo *
semu_alloc(p)
struct proc *p;
@@ -120,7 +123,6 @@ semu_alloc(p)
/*
* Adjust a particular entry for a particular proc
*/
-
int
semundo_adjust(p, supptr, semid, semnum, adjval)
register struct proc *p;
@@ -154,8 +156,8 @@ semundo_adjust(p, supptr, semid, semnum, adjval)
}
/*
- * Look for the requested entry and adjust it (delete if adjval becomes
- * 0).
+ * Look for the requested entry and adjust it
+ * (delete if adjval becomes 0).
*/
sunptr = &suptr->un_ent[0];
for (i = 0; i < suptr->un_cnt; i++, sunptr++) {
diff --git a/sys/kern/sysv_shm.c b/sys/kern/sysv_shm.c
index 2f628635fe0..7902a10549a 100644
--- a/sys/kern/sysv_shm.c
+++ b/sys/kern/sysv_shm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sysv_shm.c,v 1.19 2001/06/27 04:49:47 art Exp $ */
+/* $OpenBSD: sysv_shm.c,v 1.20 2001/08/12 22:50:12 millert Exp $ */
/* $NetBSD: sysv_shm.c,v 1.50 1998/10/21 22:24:29 tron Exp $ */
/*
@@ -49,6 +49,9 @@
#include <vm/vm.h>
#include <uvm/uvm_extern.h>
+struct shminfo shminfo;
+struct shmid_ds *shmsegs;
+
struct shmid_ds *shm_find_segment_by_shmid __P((int));
/*
diff --git a/sys/sys/msg.h b/sys/sys/msg.h
index d81a8fb9551..2a5bc568772 100644
--- a/sys/sys/msg.h
+++ b/sys/sys/msg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: msg.h,v 1.5 1998/06/11 19:21:28 deraadt Exp $ */
+/* $OpenBSD: msg.h,v 1.6 2001/08/12 22:50:12 millert Exp $ */
/* $NetBSD: msg.h,v 1.9 1996/02/09 18:25:18 christos Exp $ */
/*
@@ -158,10 +158,10 @@ struct msgmap {
/* 0..(MSGSEG-1) -> index of next segment */
};
-char *msgpool; /* MSGMAX byte long msg buffer pool */
-struct msgmap *msgmaps; /* MSGSEG msgmap structures */
-struct msg *msghdrs; /* MSGTQL msg headers */
-struct msqid_ds *msqids; /* MSGMNI msqid_ds struct's */
+extern char *msgpool; /* MSGMAX byte long msg buffer pool */
+extern struct msgmap *msgmaps; /* MSGSEG msgmap structures */
+extern struct msg *msghdrs; /* MSGTQL msg headers */
+extern struct msqid_ds *msqids; /* MSGMNI msqid_ds struct's */
#define MSG_LOCKED 01000 /* Is this msqid_ds locked? */
diff --git a/sys/sys/sem.h b/sys/sys/sem.h
index 7b67bad27e8..f27ddb7d063 100644
--- a/sys/sys/sem.h
+++ b/sys/sys/sem.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: sem.h,v 1.8 2000/05/01 23:12:30 deraadt Exp $ */
+/* $OpenBSD: sem.h,v 1.9 2001/08/12 22:50:12 millert Exp $ */
/* $NetBSD: sem.h,v 1.8 1996/02/09 18:25:29 christos Exp $ */
/*
@@ -123,7 +123,7 @@ struct seminfo {
semvmx, /* semaphore maximum value */
semaem; /* adjust on exit max value */
};
-struct seminfo seminfo;
+extern struct seminfo seminfo;
/* internal "mode" bits */
#define SEM_ALLOC 01000 /* semaphore is allocated */
@@ -160,13 +160,12 @@ struct seminfo seminfo;
#define SEMUSZ (sizeof(struct sem_undo)+sizeof(struct undo)*SEMUME)
/*
- * Structures allocated in machdep.c
+ * Structures allocated in machdep.c, defined/initialized in sysv_sem.c
*/
-struct semid_ds *sema; /* semaphore id pool */
-struct sem *sem; /* semaphore pool */
-struct map *semmap; /* semaphore allocation map */
-struct sem_undo *semu_list; /* list of active undo structures */
-int *semu; /* undo structure pool */
+extern struct semid_ds *sema; /* semaphore id pool */
+extern struct sem *sem; /* semaphore pool */
+extern struct sem_undo *semu_list; /* list of active undo structures */
+extern int *semu; /* undo structure pool */
/*
* Macro to find a particular sem_undo vector
diff --git a/sys/sys/shm.h b/sys/sys/shm.h
index 67684d88f81..bc5de3428bc 100644
--- a/sys/sys/shm.h
+++ b/sys/sys/shm.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: shm.h,v 1.9 2001/05/05 20:57:02 art Exp $ */
+/* $OpenBSD: shm.h,v 1.10 2001/08/12 22:50:12 millert Exp $ */
/* $NetBSD: shm.h,v 1.20 1996/04/09 20:55:35 cgd Exp $ */
/*
@@ -83,7 +83,7 @@ struct oshmid_ds {
#define SHM_UNLOCK 4 /* Unlock a segment locked by SHM_LOCK. */
/*
- * System 5 style catch-all structure for shared memory constants that
+ * System V style catch-all structure for shared memory constants that
* might be of interest to user programs. Do we really want/need this?
*/
struct shminfo {
@@ -93,8 +93,8 @@ struct shminfo {
int shmseg; /* max shared memory segments per process */
int shmall; /* max amount of shared memory (pages) */
};
-struct shminfo shminfo;
-struct shmid_ds *shmsegs;
+extern struct shminfo shminfo;
+extern struct shmid_ds *shmsegs;
struct vmspace;