+ 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;
+ }
+
+ MALLOC(msghdrs, struct msg *,
+ sizeof(struct msg) * msginfo.msgtql,
+ M_SHM, M_WAITOK);
+ if (msghdrs == NULL) {
+ printf("msginit: can't allocate msghdrs");
+ goto bad;
+ }
+
+ MALLOC(msqids, struct msqid_kernel *,
+ sizeof(struct user_msqid_ds) * msginfo.msgmni,
+ M_SHM, M_WAITOK);
+ if (msqids == NULL) {
+ printf("msginit: can't allocate msqids");
+ goto bad;