- printf("msginfo.msgseg=%d\n", msginfo.msgseg);
- panic("msginfo.msgseg > 32767");
+ printf("msginfo.msgseg=%d (> 32767); resetting to %d\n", msginfo.msgseg, MSGSEG);
+ msginfo.msgseg = MSGSEG;
+ }
+
+
+ /*
+ * Allocate memory for message pool, maps, headers, and queue IDs;
+ * if this fails, fail safely and leave it uninitialized (related
+ * system calls will fail).
+ */
+ msgpool = (char *)_MALLOC(msginfo.msgmax, M_SHM, M_WAITOK);
+ if (msgpool == NULL) {
+ printf("msginit: can't allocate msgpool");
+ goto bad;
+ }
+ MALLOC(msgmaps, struct msgmap *,
+ sizeof(struct msgmap) * msginfo.msgseg,
+ M_SHM, M_WAITOK);
+ if (msgmaps == NULL) {
+ printf("msginit: can't allocate msgmaps");
+ goto bad;