+ 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 = kheap_alloc(KHEAP_DATA_BUFFERS, msginfo.msgmax, Z_WAITOK);
+ if (msgpool == NULL) {
+ printf("msginit: can't allocate msgpool");
+ goto bad;
+ }
+ msgmaps = kheap_alloc(KM_SHM, sizeof(struct msgmap) * msginfo.msgseg,
+ Z_WAITOK);
+ if (msgmaps == NULL) {
+ printf("msginit: can't allocate msgmaps");
+ goto bad;
+ }
+
+ msghdrs = kheap_alloc(KM_SHM, sizeof(struct msg) * msginfo.msgtql,
+ Z_WAITOK);
+ if (msghdrs == NULL) {
+ printf("msginit: can't allocate msghdrs");
+ goto bad;
+ }
+
+ msqids = kheap_alloc(KM_SHM,
+ sizeof(struct msqid_kernel) * msginfo.msgmni, Z_WAITOK);
+ if (msqids == NULL) {
+ printf("msginit: can't allocate msqids");
+ goto bad;