diff --git a/sys/alpha/alpha/busdma_machdep.c b/sys/alpha/alpha/busdma_machdep.c index 8b701041b521..169231bed7f2 100644 --- a/sys/alpha/alpha/busdma_machdep.c +++ b/sys/alpha/alpha/busdma_machdep.c @@ -360,7 +360,7 @@ bus_dmamem_alloc_size(bus_dma_tag_t dmat, void** vaddr, int flags, if ((size <= PAGE_SIZE) && dmat->lowaddr >= ptoa(Maxmem)) { *vaddr = malloc(size, M_DEVBUF, - (flags & BUS_DMA_NOWAIT) ? M_NOWAIT : 0); + (flags & BUS_DMA_NOWAIT) ? M_NOWAIT : M_WAITOK); } else { /* * XXX Use Contigmalloc until it is merged into this facility @@ -368,7 +368,7 @@ bus_dmamem_alloc_size(bus_dma_tag_t dmat, void** vaddr, int flags, * multi-seg allocations yet though. */ *vaddr = contigmalloc(size, M_DEVBUF, - (flags & BUS_DMA_NOWAIT) ? M_NOWAIT : 0, + (flags & BUS_DMA_NOWAIT) ? M_NOWAIT : M_WAITOK, 0ul, dmat->lowaddr, dmat->alignment? dmat->alignment : 1ul, dmat->boundary); } diff --git a/sys/alpha/osf1/imgact_osf1.c b/sys/alpha/osf1/imgact_osf1.c index 5db50d0fc374..d6331823a8e2 100644 --- a/sys/alpha/osf1/imgact_osf1.c +++ b/sys/alpha/osf1/imgact_osf1.c @@ -112,7 +112,7 @@ exec_osf1_imgact(struct image_params *imgp) printf("unknown ecoff magic %x\n", eap->magic); return ENOEXEC; } - osf_auxargs = malloc(sizeof(Osf_Auxargs), M_TEMP, M_ZERO); + osf_auxargs = malloc(sizeof(Osf_Auxargs), M_TEMP, M_WAITOK | M_ZERO); imgp->auxargs = osf_auxargs; osf_auxargs->executable = osf_auxargs->exec_path; path_not_saved = copyinstr(imgp->fname, osf_auxargs->executable, @@ -135,7 +135,7 @@ exec_osf1_imgact(struct image_params *imgp) * page of the loader. */ ndp = (struct nameidata *)malloc(sizeof(struct nameidata), - M_TEMP, 0); + M_TEMP, M_WAITOK); NDINIT(ndp, LOOKUP, LOCKLEAF | FOLLOW | SAVENAME, UIO_SYSSPACE, "/compat/osf1/sbin/loader", FIRST_THREAD_IN_PROC(imgp->proc)); @@ -218,7 +218,7 @@ exec_osf1_imgact(struct image_params *imgp) raw_dend = (eap->data_start + eap->dsize); if (dend > raw_dend) { caddr_t zeros; - zeros = malloc(dend-raw_dend, M_TEMP, M_ZERO); + zeros = malloc(dend-raw_dend,M_TEMP,M_WAITOK|M_ZERO); if ((error = copyout(zeros, (caddr_t)raw_dend, dend-raw_dend))) { uprintf("Can't zero start of bss, error %d\n",error); diff --git a/sys/alpha/osf1/osf1_misc.c b/sys/alpha/osf1/osf1_misc.c index adf76e377a41..8b49723c7450 100644 --- a/sys/alpha/osf1/osf1_misc.c +++ b/sys/alpha/osf1/osf1_misc.c @@ -120,7 +120,7 @@ osf1_emul_find(td, sgp, prefix, path, pbuf, cflag) struct vattr vat; struct vattr vatroot; - buf = (char *) malloc(MAXPATHLEN, M_TEMP, 0); + buf = (char *) malloc(MAXPATHLEN, M_TEMP, M_WAITOK); *pbuf = path; for (ptr = buf; (*ptr = *prefix) != '\0'; ptr++, prefix++) @@ -1180,8 +1180,8 @@ osf1_readv(td, uap) osize = uap->iovcnt * sizeof (struct osf1_iovec); nsize = uap->iovcnt * sizeof (struct iovec); - oio = malloc(osize, M_TEMP, 0); - nio = malloc(nsize, M_TEMP, 0); + oio = malloc(osize, M_TEMP, M_WAITOK); + nio = malloc(nsize, M_TEMP, M_WAITOK); error = 0; if ((error = copyin(uap->iovp, oio, osize))) @@ -1229,8 +1229,8 @@ osf1_writev(td, uap) osize = uap->iovcnt * sizeof (struct osf1_iovec); nsize = uap->iovcnt * sizeof (struct iovec); - oio = malloc(osize, M_TEMP, 0); - nio = malloc(nsize, M_TEMP, 0); + oio = malloc(osize, M_TEMP, M_WAITOK); + nio = malloc(nsize, M_TEMP, M_WAITOK); error = 0; if ((error = copyin(uap->iovp, oio, osize))) diff --git a/sys/amd64/amd64/amd64_mem.c b/sys/amd64/amd64/amd64_mem.c index f3fc4e89db25..589fc64721cb 100644 --- a/sys/amd64/amd64/amd64_mem.c +++ b/sys/amd64/amd64/amd64_mem.c @@ -557,7 +557,7 @@ i686_mrinit(struct mem_range_softc *sc) sc->mr_desc = (struct mem_range_desc *)malloc(nmdesc * sizeof(struct mem_range_desc), - M_MEMDESC, M_ZERO); + M_MEMDESC, M_WAITOK | M_ZERO); sc->mr_ndesc = nmdesc; mrd = sc->mr_desc; diff --git a/sys/amd64/amd64/bios.c b/sys/amd64/amd64/bios.c index ae14099f93be..747a3a14394f 100644 --- a/sys/amd64/amd64/bios.c +++ b/sys/amd64/amd64/bios.c @@ -388,7 +388,7 @@ bios16(struct bios_args *args, char *fmt, ...) /* * no page table, so create one and install it. */ - pte = (pt_entry_t *)malloc(PAGE_SIZE, M_TEMP, 0); + pte = (pt_entry_t *)malloc(PAGE_SIZE, M_TEMP, M_WAITOK); ptd = (pd_entry_t *)((u_int)ptd + KERNBASE); *ptd = vtophys(pte) | PG_RW | PG_V; } else { diff --git a/sys/amd64/amd64/busdma_machdep.c b/sys/amd64/amd64/busdma_machdep.c index a5a20fcbab03..8f5898faa868 100644 --- a/sys/amd64/amd64/busdma_machdep.c +++ b/sys/amd64/amd64/busdma_machdep.c @@ -341,7 +341,7 @@ bus_dmamem_alloc_size(bus_dma_tag_t dmat, void** vaddr, int flags, if ((size <= PAGE_SIZE) && dmat->lowaddr >= ptoa(Maxmem)) { *vaddr = malloc(size, M_DEVBUF, - (flags & BUS_DMA_NOWAIT) ? M_NOWAIT : 0); + (flags & BUS_DMA_NOWAIT) ? M_NOWAIT : M_WAITOK); } else { /* * XXX Use Contigmalloc until it is merged into this facility @@ -349,7 +349,7 @@ bus_dmamem_alloc_size(bus_dma_tag_t dmat, void** vaddr, int flags, * multi-seg allocations yet though. */ *vaddr = contigmalloc(size, M_DEVBUF, - (flags & BUS_DMA_NOWAIT) ? M_NOWAIT : 0, + (flags & BUS_DMA_NOWAIT) ? M_NOWAIT : M_WAITOK, 0ul, dmat->lowaddr, dmat->alignment? dmat->alignment : 1ul, dmat->boundary); } diff --git a/sys/amd64/amd64/mem.c b/sys/amd64/amd64/mem.c index 4905d3c8158c..41fa63640b60 100644 --- a/sys/amd64/amd64/mem.c +++ b/sys/amd64/amd64/mem.c @@ -265,7 +265,7 @@ mmioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct thread *td) if (nd > 0) { md = (struct mem_range_desc *) malloc(nd * sizeof(struct mem_range_desc), - M_MEMDESC, 0); + M_MEMDESC, M_WAITOK); error = mem_range_attr_get(md, &nd); if (!error) error = copyout(md, mo->mo_desc, @@ -279,7 +279,7 @@ mmioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct thread *td) case MEMRANGE_SET: md = (struct mem_range_desc *)malloc(sizeof(struct mem_range_desc), - M_MEMDESC, 0); + M_MEMDESC, M_WAITOK); error = copyin(mo->mo_desc, md, sizeof(struct mem_range_desc)); /* clamp description string */ md->mr_owner[sizeof(md->mr_owner) - 1] = 0; diff --git a/sys/amd64/amd64/mp_machdep.c b/sys/amd64/amd64/mp_machdep.c index cc29843c7772..7ebd6ea9020a 100644 --- a/sys/amd64/amd64/mp_machdep.c +++ b/sys/amd64/amd64/mp_machdep.c @@ -919,13 +919,13 @@ mptable_pass2(void) pgeflag = 0; /* XXX - Not used under SMP yet. */ MALLOC(io_apic_versions, u_int32_t *, sizeof(u_int32_t) * mp_napics, - M_DEVBUF, 0); + M_DEVBUF, M_WAITOK); MALLOC(ioapic, volatile ioapic_t **, sizeof(ioapic_t *) * mp_napics, - M_DEVBUF, 0); + M_DEVBUF, M_WAITOK); MALLOC(io_apic_ints, io_int *, sizeof(io_int) * (nintrs + 1), - M_DEVBUF, 0); + M_DEVBUF, M_WAITOK); MALLOC(bus_data, bus_datum *, sizeof(bus_datum) * mp_nbusses, - M_DEVBUF, 0); + M_DEVBUF, M_WAITOK); bzero(ioapic, sizeof(ioapic_t *) * mp_napics); diff --git a/sys/amd64/amd64/mptable.c b/sys/amd64/amd64/mptable.c index cc29843c7772..7ebd6ea9020a 100644 --- a/sys/amd64/amd64/mptable.c +++ b/sys/amd64/amd64/mptable.c @@ -919,13 +919,13 @@ mptable_pass2(void) pgeflag = 0; /* XXX - Not used under SMP yet. */ MALLOC(io_apic_versions, u_int32_t *, sizeof(u_int32_t) * mp_napics, - M_DEVBUF, 0); + M_DEVBUF, M_WAITOK); MALLOC(ioapic, volatile ioapic_t **, sizeof(ioapic_t *) * mp_napics, - M_DEVBUF, 0); + M_DEVBUF, M_WAITOK); MALLOC(io_apic_ints, io_int *, sizeof(io_int) * (nintrs + 1), - M_DEVBUF, 0); + M_DEVBUF, M_WAITOK); MALLOC(bus_data, bus_datum *, sizeof(bus_datum) * mp_nbusses, - M_DEVBUF, 0); + M_DEVBUF, M_WAITOK); bzero(ioapic, sizeof(ioapic_t *) * mp_napics); diff --git a/sys/amd64/amd64/sys_machdep.c b/sys/amd64/amd64/sys_machdep.c index bd89b74341af..5fcad0311b0a 100644 --- a/sys/amd64/amd64/sys_machdep.c +++ b/sys/amd64/amd64/sys_machdep.c @@ -298,7 +298,7 @@ user_ldt_alloc(struct mdproc *mdp, int len) mtx_unlock_spin(&sched_lock); mtx_assert(&sched_lock, MA_NOTOWNED); MALLOC(new_ldt, struct proc_ldt *, sizeof(struct proc_ldt), - M_SUBPROC, 0); + M_SUBPROC, M_WAITOK); new_ldt->ldt_len = len = NEW_MAX_LD(len); new_ldt->ldt_base = (caddr_t)kmem_alloc(kernel_map, diff --git a/sys/amd64/ia32/ia32_misc.c b/sys/amd64/ia32/ia32_misc.c index d593c04ee1b3..c6f26fe7038e 100644 --- a/sys/amd64/ia32/ia32_misc.c +++ b/sys/amd64/ia32/ia32_misc.c @@ -105,7 +105,7 @@ ia32_emul_find(td, sgp, prefix, path, pbuf, cflag) struct vattr vat; struct vattr vatroot; - buf = (char *) malloc(MAXPATHLEN, M_TEMP, 0); + buf = (char *) malloc(MAXPATHLEN, M_TEMP, M_WAITOK); *pbuf = path; for (ptr = buf; (*ptr = *prefix) != '\0'; ptr++, prefix++) @@ -768,8 +768,8 @@ ia32_readv(struct thread *td, struct ia32_readv_args *uap) osize = uap->iovcnt * sizeof (struct iovec32); nsize = uap->iovcnt * sizeof (struct iovec); - oio = malloc(osize, M_TEMP, 0); - nio = malloc(nsize, M_TEMP, 0); + oio = malloc(osize, M_TEMP, M_WAITOK); + nio = malloc(nsize, M_TEMP, M_WAITOK); error = 0; if ((error = copyin(uap->iovp, oio, osize))) @@ -814,8 +814,8 @@ ia32_writev(struct thread *td, struct ia32_writev_args *uap) osize = uap->iovcnt * sizeof (struct iovec32); nsize = uap->iovcnt * sizeof (struct iovec); - oio = malloc(osize, M_TEMP, 0); - nio = malloc(nsize, M_TEMP, 0); + oio = malloc(osize, M_TEMP, M_WAITOK); + nio = malloc(nsize, M_TEMP, M_WAITOK); error = 0; if ((error = copyin(uap->iovp, oio, osize))) diff --git a/sys/amd64/include/mptable.h b/sys/amd64/include/mptable.h index cc29843c7772..7ebd6ea9020a 100644 --- a/sys/amd64/include/mptable.h +++ b/sys/amd64/include/mptable.h @@ -919,13 +919,13 @@ mptable_pass2(void) pgeflag = 0; /* XXX - Not used under SMP yet. */ MALLOC(io_apic_versions, u_int32_t *, sizeof(u_int32_t) * mp_napics, - M_DEVBUF, 0); + M_DEVBUF, M_WAITOK); MALLOC(ioapic, volatile ioapic_t **, sizeof(ioapic_t *) * mp_napics, - M_DEVBUF, 0); + M_DEVBUF, M_WAITOK); MALLOC(io_apic_ints, io_int *, sizeof(io_int) * (nintrs + 1), - M_DEVBUF, 0); + M_DEVBUF, M_WAITOK); MALLOC(bus_data, bus_datum *, sizeof(bus_datum) * mp_nbusses, - M_DEVBUF, 0); + M_DEVBUF, M_WAITOK); bzero(ioapic, sizeof(ioapic_t *) * mp_napics); diff --git a/sys/cam/cam_periph.c b/sys/cam/cam_periph.c index 591d765ed068..247ebb87a24e 100644 --- a/sys/cam/cam_periph.c +++ b/sys/cam/cam_periph.c @@ -89,7 +89,7 @@ periphdriver_register(void *data) int ndrivers; ndrivers = nperiph_drivers + 2; - newdrivers = malloc(sizeof(*newdrivers) * ndrivers, M_TEMP, 0); + newdrivers = malloc(sizeof(*newdrivers) * ndrivers, M_TEMP, M_WAITOK); if (periph_drivers) bcopy(periph_drivers, newdrivers, sizeof(*newdrivers) * nperiph_drivers); diff --git a/sys/cam/cam_sim.c b/sys/cam/cam_sim.c index 35b18f7e0b48..b7e0ec5bdf56 100644 --- a/sys/cam/cam_sim.c +++ b/sys/cam/cam_sim.c @@ -67,7 +67,7 @@ cam_sim_alloc(sim_action_func sim_action, sim_poll_func sim_poll, */ if (strcmp(sim_name, "xpt") == 0) sim = (struct cam_sim *)malloc(sizeof(struct cam_sim), - M_DEVBUF, 0); + M_DEVBUF, M_WAITOK); else sim = (struct cam_sim *)malloc(sizeof(struct cam_sim), M_DEVBUF, M_NOWAIT); diff --git a/sys/cam/cam_xpt.c b/sys/cam/cam_xpt.c index 96af6d74af43..e22357b4e636 100644 --- a/sys/cam/cam_xpt.c +++ b/sys/cam/cam_xpt.c @@ -4804,7 +4804,7 @@ xpt_alloc_ccb() { union ccb *new_ccb; - new_ccb = malloc(sizeof(*new_ccb), M_DEVBUF, 0); + new_ccb = malloc(sizeof(*new_ccb), M_DEVBUF, M_WAITOK); return (new_ccb); } @@ -5169,7 +5169,7 @@ xpt_scan_bus(struct cam_periph *periph, union ccb *request_ccb) /* Save some state for use while we probe for devices */ scan_info = (xpt_scan_bus_info *) - malloc(sizeof(xpt_scan_bus_info), M_TEMP, 0); + malloc(sizeof(xpt_scan_bus_info), M_TEMP, M_WAITOK); scan_info->request_ccb = request_ccb; scan_info->cpi = &work_ccb->cpi; diff --git a/sys/cam/scsi/scsi_cd.c b/sys/cam/scsi/scsi_cd.c index ebfe241a35f5..543714f275cb 100644 --- a/sys/cam/scsi/scsi_cd.c +++ b/sys/cam/scsi/scsi_cd.c @@ -1784,7 +1784,7 @@ cdioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct thread *td) struct cd_mode_data *data; data = malloc(sizeof(struct cd_mode_data), M_TEMP, - 0); + M_WAITOK); CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, ("trying to do CDIOCPLAYTRACKS\n")); @@ -1818,7 +1818,7 @@ cdioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct thread *td) struct cd_mode_data *data; data = malloc(sizeof(struct cd_mode_data), M_TEMP, - 0); + M_WAITOK); CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, ("trying to do CDIOCPLAYMSF\n")); @@ -1853,7 +1853,7 @@ cdioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct thread *td) ("trying to do CDIOCPLAYBLOCKS\n")); data = malloc(sizeof(struct cd_mode_data), M_TEMP, - 0); + M_WAITOK); error = cdgetmode(periph, data, AUDIO_PAGE); if (error) { @@ -1880,7 +1880,7 @@ cdioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct thread *td) ("trying to do CDIOCREADSUBCHANNEL\n")); data = malloc(sizeof(struct cd_sub_channel_info), - M_TEMP, 0); + M_TEMP, M_WAITOK); if ((len > sizeof(struct cd_sub_channel_info)) || (len < sizeof(struct cd_sub_channel_header))) { @@ -1924,7 +1924,7 @@ cdioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct thread *td) ("trying to do CDIOREADTOCHEADER\n")); th = malloc(sizeof(struct ioc_toc_header), M_TEMP, - 0); + M_WAITOK); error = cdreadtoc(periph, 0, 0, (struct cd_toc_entry *)th, sizeof (*th)); @@ -1967,8 +1967,8 @@ cdioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct thread *td) CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, ("trying to do CDIOREADTOCENTRYS\n")); - data = malloc(sizeof(data_t), M_TEMP, 0); - lead = malloc(sizeof(lead_t), M_TEMP, 0); + data = malloc(sizeof(data_t), M_TEMP, M_WAITOK); + lead = malloc(sizeof(lead_t), M_TEMP, M_WAITOK); if (te->data_len < sizeof(struct cd_toc_entry) || (te->data_len % sizeof(struct cd_toc_entry)) != 0 @@ -2094,7 +2094,7 @@ cdioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct thread *td) CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, ("trying to do CDIOREADTOCENTRY\n")); - data = malloc(sizeof(data_t), M_TEMP, 0); + data = malloc(sizeof(data_t), M_TEMP, M_WAITOK); if (te->address_format != CD_MSF_FORMAT && te->address_format != CD_LBA_FORMAT) { @@ -2160,7 +2160,7 @@ cdioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct thread *td) ("trying to do CDIOCSETPATCH\n")); data = malloc(sizeof(struct cd_mode_data), M_TEMP, - 0); + M_WAITOK); error = cdgetmode(periph, data, AUDIO_PAGE); if (error) { free(data, M_TEMP); @@ -2185,7 +2185,7 @@ cdioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct thread *td) ("trying to do CDIOCGETVOL\n")); data = malloc(sizeof(struct cd_mode_data), M_TEMP, - 0); + M_WAITOK); error = cdgetmode(periph, data, AUDIO_PAGE); if (error) { free(data, M_TEMP); @@ -2209,7 +2209,7 @@ cdioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct thread *td) ("trying to do CDIOCSETVOL\n")); data = malloc(sizeof(struct cd_mode_data), M_TEMP, - 0); + M_WAITOK); error = cdgetmode(periph, data, AUDIO_PAGE); if (error) { free(data, M_TEMP); @@ -2235,7 +2235,7 @@ cdioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct thread *td) ("trying to do CDIOCSETMONO\n")); data = malloc(sizeof(struct cd_mode_data), - M_TEMP, 0); + M_TEMP, M_WAITOK); error = cdgetmode(periph, data, AUDIO_PAGE); if (error) { free(data, M_TEMP); @@ -2259,7 +2259,7 @@ cdioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct thread *td) ("trying to do CDIOCSETSTEREO\n")); data = malloc(sizeof(struct cd_mode_data), M_TEMP, - 0); + M_WAITOK); error = cdgetmode(periph, data, AUDIO_PAGE); if (error) { free(data, M_TEMP); @@ -2283,7 +2283,7 @@ cdioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct thread *td) ("trying to do CDIOCSETMUTE\n")); data = malloc(sizeof(struct cd_mode_data), M_TEMP, - 0); + M_WAITOK); error = cdgetmode(periph, data, AUDIO_PAGE); if (error) { free(data, M_TEMP); @@ -2305,7 +2305,7 @@ cdioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct thread *td) ("trying to do CDIOCSETLEFT\n")); data = malloc(sizeof(struct cd_mode_data), M_TEMP, - 0); + M_WAITOK); error = cdgetmode(periph, data, AUDIO_PAGE); if (error) { free(data, M_TEMP); @@ -2329,7 +2329,7 @@ cdioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct thread *td) ("trying to do CDIOCSETRIGHT\n")); data = malloc(sizeof(struct cd_mode_data), M_TEMP, - 0); + M_WAITOK); error = cdgetmode(periph, data, AUDIO_PAGE); if (error) { free(data, M_TEMP); @@ -2481,7 +2481,7 @@ cdsize(dev_t dev, u_int32_t *size) ccb = cdgetccb(periph, /* priority */ 1); rcap_buf = malloc(sizeof(struct scsi_read_capacity_data), - M_TEMP, 0); + M_TEMP, M_WAITOK); scsi_read_capacity(&ccb->csio, /*retries*/ 1, @@ -3050,7 +3050,7 @@ cdreportkey(struct cam_periph *periph, struct dvd_authinfo *authinfo) } if (length != 0) { - databuf = malloc(length, M_DEVBUF, M_ZERO); + databuf = malloc(length, M_DEVBUF, M_WAITOK | M_ZERO); } else databuf = NULL; @@ -3183,7 +3183,7 @@ cdsendkey(struct cam_periph *periph, struct dvd_authinfo *authinfo) length = sizeof(*challenge_data); - challenge_data = malloc(length, M_DEVBUF, M_ZERO); + challenge_data = malloc(length, M_DEVBUF, M_WAITOK | M_ZERO); databuf = (u_int8_t *)challenge_data; @@ -3200,7 +3200,7 @@ cdsendkey(struct cam_periph *periph, struct dvd_authinfo *authinfo) length = sizeof(*key2_data); - key2_data = malloc(length, M_DEVBUF, M_ZERO); + key2_data = malloc(length, M_DEVBUF, M_WAITOK | M_ZERO); databuf = (u_int8_t *)key2_data; @@ -3217,7 +3217,7 @@ cdsendkey(struct cam_periph *periph, struct dvd_authinfo *authinfo) length = sizeof(*rpc_data); - rpc_data = malloc(length, M_DEVBUF, M_ZERO); + rpc_data = malloc(length, M_DEVBUF, M_WAITOK | M_ZERO); databuf = (u_int8_t *)rpc_data; @@ -3359,7 +3359,7 @@ cdreaddvdstructure(struct cam_periph *periph, struct dvd_struct *dvdstruct) } if (length != 0) { - databuf = malloc(length, M_DEVBUF, M_ZERO); + databuf = malloc(length, M_DEVBUF, M_WAITOK | M_ZERO); } else databuf = NULL; diff --git a/sys/cam/scsi/scsi_ch.c b/sys/cam/scsi/scsi_ch.c index 51f694679b8c..fcbb53bac37b 100644 --- a/sys/cam/scsi/scsi_ch.c +++ b/sys/cam/scsi/scsi_ch.c @@ -1100,7 +1100,7 @@ chgetelemstatus(struct cam_periph *periph, * we can allocate enough storage for all of them. We assume * that the first one can fit into 1k. */ - data = (caddr_t)malloc(1024, M_DEVBUF, 0); + data = (caddr_t)malloc(1024, M_DEVBUF, M_WAITOK); ccb = cam_periph_getccb(periph, /*priority*/ 1); @@ -1137,7 +1137,7 @@ chgetelemstatus(struct cam_periph *periph, * device. */ free(data, M_DEVBUF); - data = (caddr_t)malloc(size, M_DEVBUF, 0); + data = (caddr_t)malloc(size, M_DEVBUF, M_WAITOK); scsi_read_element_status(&ccb->csio, /* retries */ 1, @@ -1172,7 +1172,7 @@ chgetelemstatus(struct cam_periph *periph, user_data = (struct changer_element_status *) malloc(avail * sizeof(struct changer_element_status), - M_DEVBUF, M_ZERO); + M_DEVBUF, M_WAITOK | M_ZERO); desc = (struct read_element_status_descriptor *)((uintptr_t)data + sizeof(struct read_element_status_header) + diff --git a/sys/cam/scsi/scsi_da.c b/sys/cam/scsi/scsi_da.c index 6b5802deb536..65878a18fe93 100644 --- a/sys/cam/scsi/scsi_da.c +++ b/sys/cam/scsi/scsi_da.c @@ -582,7 +582,7 @@ daopen(dev_t dev, int flags __unused, int fmt __unused, struct thread *td __unus /* Do a read capacity */ rcap = (struct scsi_read_capacity_data *)malloc(sizeof(*rcap), M_TEMP, - 0); + M_WAITOK); ccb = cam_periph_getccb(periph, /*priority*/1); scsi_read_capacity(&ccb->csio, diff --git a/sys/cam/scsi/scsi_low.c b/sys/cam/scsi/scsi_low.c index 753560a72763..afda1138e293 100644 --- a/sys/cam/scsi/scsi_low.c +++ b/sys/cam/scsi/scsi_low.c @@ -961,7 +961,7 @@ scsi_low_rescan_bus_cam(slp) struct scsi_low_softc *slp; { struct cam_path *path; - union ccb *ccb = malloc(sizeof(union ccb), M_DEVBUF, 0); + union ccb *ccb = malloc(sizeof(union ccb), M_DEVBUF, M_WAITOK); cam_status status; bzero(ccb, sizeof(union ccb)); diff --git a/sys/cam/scsi/scsi_sa.c b/sys/cam/scsi/scsi_sa.c index 75dd670bf26c..e77865bee5e7 100644 --- a/sys/cam/scsi/scsi_sa.c +++ b/sys/cam/scsi/scsi_sa.c @@ -1896,7 +1896,7 @@ samount(struct cam_periph *periph, int oflags, dev_t dev) * read a full record. */ rblim = (struct scsi_read_block_limits_data *) - malloc(8192, M_TEMP, 0); + malloc(8192, M_TEMP, M_WAITOK); if (rblim == NULL) { xpt_print_path(ccb->ccb_h.path); printf("no memory for test read\n"); @@ -2521,7 +2521,7 @@ sagetparams(struct cam_periph *periph, sa_params params_to_get, mode_buffer_len += sizeof (sa_comp_t); } - mode_buffer = malloc(mode_buffer_len, M_TEMP, M_ZERO); + mode_buffer = malloc(mode_buffer_len, M_TEMP, M_WAITOK | M_ZERO); mode_hdr = (struct scsi_mode_header_6 *)mode_buffer; mode_blk = (struct scsi_mode_blk_desc *)&mode_hdr[1]; @@ -2701,7 +2701,7 @@ sasetparams(struct cam_periph *periph, sa_params params_to_set, softc = (struct sa_softc *)periph->softc; - ccomp = malloc(sizeof (sa_comp_t), M_TEMP, 0); + ccomp = malloc(sizeof (sa_comp_t), M_TEMP, M_WAITOK); /* * Since it doesn't make sense to set the number of blocks, or @@ -2724,7 +2724,7 @@ sasetparams(struct cam_periph *periph, sa_params params_to_set, if (params_to_set & SA_PARAM_COMPRESSION) mode_buffer_len += sizeof (sa_comp_t); - mode_buffer = malloc(mode_buffer_len, M_TEMP, M_ZERO); + mode_buffer = malloc(mode_buffer_len, M_TEMP, M_WAITOK | M_ZERO); mode_hdr = (struct scsi_mode_header_6 *)mode_buffer; mode_blk = (struct scsi_mode_blk_desc *)&mode_hdr[1]; diff --git a/sys/cam/scsi/scsi_target.c b/sys/cam/scsi/scsi_target.c index 25001efafc0e..9db2604dce38 100644 --- a/sys/cam/scsi/scsi_target.c +++ b/sys/cam/scsi/scsi_target.c @@ -189,7 +189,7 @@ targopen(dev_t dev, int flags, int fmt, struct thread *td) "targ%d", dev2unit(dev)); } MALLOC(softc, struct targ_softc *, sizeof(*softc), M_TARG, - M_ZERO); + M_WAITOK | M_ZERO); dev->si_drv1 = softc; softc->state = TARG_STATE_OPENED; softc->periph = NULL; @@ -977,7 +977,7 @@ targgetccb(struct targ_softc *softc, xpt_opcode type, int priority) int ccb_len; ccb_len = targccblen(type); - MALLOC(ccb, union ccb *, ccb_len, M_TARG, 0); + MALLOC(ccb, union ccb *, ccb_len, M_TARG, M_WAITOK); CAM_DEBUG(softc->path, CAM_DEBUG_PERIPH, ("getccb %p\n", ccb)); xpt_setup_ccb(&ccb->ccb_h, softc->path, priority); @@ -1021,7 +1021,7 @@ targgetdescr(struct targ_softc *softc) struct targ_cmd_descr *descr; MALLOC(descr, struct targ_cmd_descr *, sizeof(*descr), M_TARG, - 0); + M_WAITOK); descr->mapinfo.num_bufs_used = 0; return (descr); } diff --git a/sys/coda/cnode.h b/sys/coda/cnode.h index 8d0cebe3d131..962d329580e4 100644 --- a/sys/coda/cnode.h +++ b/sys/coda/cnode.h @@ -66,7 +66,7 @@ MALLOC_DECLARE(M_CODA); #define CODA_ALLOC(ptr, cast, size) \ do { \ - ptr = (cast)malloc((unsigned long) size, M_CODA, 0); \ + ptr = (cast)malloc((unsigned long) size, M_CODA, M_WAITOK); \ if (ptr == 0) { \ panic("kernel malloc returns 0 at %s:%d\n", __FILE__, __LINE__); \ } \ diff --git a/sys/compat/freebsd32/freebsd32_misc.c b/sys/compat/freebsd32/freebsd32_misc.c index d593c04ee1b3..c6f26fe7038e 100644 --- a/sys/compat/freebsd32/freebsd32_misc.c +++ b/sys/compat/freebsd32/freebsd32_misc.c @@ -105,7 +105,7 @@ ia32_emul_find(td, sgp, prefix, path, pbuf, cflag) struct vattr vat; struct vattr vatroot; - buf = (char *) malloc(MAXPATHLEN, M_TEMP, 0); + buf = (char *) malloc(MAXPATHLEN, M_TEMP, M_WAITOK); *pbuf = path; for (ptr = buf; (*ptr = *prefix) != '\0'; ptr++, prefix++) @@ -768,8 +768,8 @@ ia32_readv(struct thread *td, struct ia32_readv_args *uap) osize = uap->iovcnt * sizeof (struct iovec32); nsize = uap->iovcnt * sizeof (struct iovec); - oio = malloc(osize, M_TEMP, 0); - nio = malloc(nsize, M_TEMP, 0); + oio = malloc(osize, M_TEMP, M_WAITOK); + nio = malloc(nsize, M_TEMP, M_WAITOK); error = 0; if ((error = copyin(uap->iovp, oio, osize))) @@ -814,8 +814,8 @@ ia32_writev(struct thread *td, struct ia32_writev_args *uap) osize = uap->iovcnt * sizeof (struct iovec32); nsize = uap->iovcnt * sizeof (struct iovec); - oio = malloc(osize, M_TEMP, 0); - nio = malloc(nsize, M_TEMP, 0); + oio = malloc(osize, M_TEMP, M_WAITOK); + nio = malloc(nsize, M_TEMP, M_WAITOK); error = 0; if ((error = copyin(uap->iovp, oio, osize))) diff --git a/sys/compat/linux/linux_file.c b/sys/compat/linux/linux_file.c index 160b2a9f90ce..2b37dcdaf40c 100644 --- a/sys/compat/linux/linux_file.c +++ b/sys/compat/linux/linux_file.c @@ -297,7 +297,7 @@ getdents_common(struct thread *td, struct linux_getdents64_args *args, buflen = max(LINUX_DIRBLKSIZ, nbytes); buflen = min(buflen, MAXBSIZE); - buf = malloc(buflen, M_TEMP, 0); + buf = malloc(buflen, M_TEMP, M_WAITOK); vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td); again: diff --git a/sys/compat/linux/linux_getcwd.c b/sys/compat/linux/linux_getcwd.c index 81e84a303154..bb1c28fb3260 100644 --- a/sys/compat/linux/linux_getcwd.c +++ b/sys/compat/linux/linux_getcwd.c @@ -181,7 +181,7 @@ linux_getcwd_scandir(lvpp, uvpp, bpp, bufp, td) dirbuflen = DIRBLKSIZ; if (dirbuflen < va.va_blocksize) dirbuflen = va.va_blocksize; - dirbuf = (char *)malloc(dirbuflen, M_TEMP, 0); + dirbuf = (char *)malloc(dirbuflen, M_TEMP, M_WAITOK); #if 0 unionread: @@ -429,7 +429,7 @@ linux_getcwd(struct thread *td, struct linux_getcwd_args *args) else if (len < 2) return ERANGE; - path = (char *)malloc(len, M_TEMP, 0); + path = (char *)malloc(len, M_TEMP, M_WAITOK); error = kern___getcwd(td, path, UIO_SYSSPACE, len); if (!error) { diff --git a/sys/compat/linux/linux_ioctl.c b/sys/compat/linux/linux_ioctl.c index eb1b9749aa7d..9f10ba5152fe 100644 --- a/sys/compat/linux/linux_ioctl.c +++ b/sys/compat/linux/linux_ioctl.c @@ -2420,7 +2420,7 @@ linux_ioctl_register_handler(struct linux_ioctl_handler *h) } if (he == NULL) { MALLOC(he, struct handler_element *, sizeof(*he), - M_LINUX, 0); + M_LINUX, M_WAITOK); he->func = h->func; } else TAILQ_REMOVE(&handlers, he, list); diff --git a/sys/compat/linux/linux_mib.c b/sys/compat/linux/linux_mib.c index 4f7f199b320b..d9cdd076124c 100644 --- a/sys/compat/linux/linux_mib.c +++ b/sys/compat/linux/linux_mib.c @@ -139,7 +139,7 @@ linux_get_prison(struct proc *p) if (pr->pr_linux == NULL) { mtx_unlock(&pr->pr_mtx); MALLOC(lpr, struct linux_prison *, sizeof *lpr, - M_PRISON, M_ZERO); + M_PRISON, M_WAITOK|M_ZERO); mtx_lock(&pr->pr_mtx); if (pr->pr_linux == NULL) { pr->pr_linux = lpr; diff --git a/sys/compat/linux/linux_sysctl.c b/sys/compat/linux/linux_sysctl.c index d737f559df20..699b5d6f01fb 100644 --- a/sys/compat/linux/linux_sysctl.c +++ b/sys/compat/linux/linux_sysctl.c @@ -92,7 +92,7 @@ linux_sysctl(struct thread *td, struct linux_sysctl_args *args) if (la.nlen <= 0 || la.nlen > LINUX_CTL_MAXNAME) return (ENOTDIR); - mib = malloc(la.nlen * sizeof(l_int), M_TEMP, 0); + mib = malloc(la.nlen * sizeof(l_int), M_TEMP, M_WAITOK); error = copyin(la.name, mib, la.nlen * sizeof(l_int)); if (error) { free(mib, M_TEMP); diff --git a/sys/compat/linux/linux_util.c b/sys/compat/linux/linux_util.c index bd2c81d8ede1..5bd8c15fa359 100644 --- a/sys/compat/linux/linux_util.c +++ b/sys/compat/linux/linux_util.c @@ -101,7 +101,7 @@ linux_emul_convpath(td, path, pathseg, pbuf, cflag) char *ptr, *buf, *cp; size_t len, sz; - buf = (char *) malloc(MAXPATHLEN, M_TEMP, 0); + buf = (char *) malloc(MAXPATHLEN, M_TEMP, M_WAITOK); *pbuf = buf; prefix = linux_emul_path; diff --git a/sys/compat/pecoff/imgact_pecoff.c b/sys/compat/pecoff/imgact_pecoff.c index b15e5c690c82..fd9ab262a1db 100644 --- a/sys/compat/pecoff/imgact_pecoff.c +++ b/sys/compat/pecoff/imgact_pecoff.c @@ -184,7 +184,7 @@ pecoff_coredump(register struct thread * td, register struct vnode * vp, limit) return (EFAULT); tempuser = malloc(ctob(uarea_pages + kstack_pages), M_TEMP, - M_ZERO); + M_WAITOK | M_ZERO); if (tempuser == NULL) return (ENOMEM); PROC_LOCK(p); @@ -393,7 +393,7 @@ pecoff_load_file(struct thread * td, const char *file, u_long * addr, u_long * e goto fail; if ((error = pecoff_signature(td, imgp->vp, &dh) != 0)) goto fail; - fp = malloc(PECOFF_HDR_SIZE, M_TEMP, 0); + fp = malloc(PECOFF_HDR_SIZE, M_TEMP, M_WAITOK); peofs = dh.d_peofs + sizeof(signature) - 1; if ((error = pecoff_read_from(td, imgp->vp, peofs, (caddr_t) fp, PECOFF_HDR_SIZE) != 0)) goto fail; @@ -405,7 +405,7 @@ pecoff_load_file(struct thread * td, const char *file, u_long * addr, u_long * e wp = (void *) ((char *) ap + sizeof(struct coff_aouthdr)); /* read section header */ scnsiz = sizeof(struct coff_scnhdr) * fp->f_nscns; - sh = malloc(scnsiz, M_TEMP, 0); + sh = malloc(scnsiz, M_TEMP, M_WAITOK); if ((error = pecoff_read_from(td, imgp->vp, peofs + PECOFF_HDR_SIZE, (caddr_t) sh, scnsiz)) != 0) goto fail; @@ -481,7 +481,7 @@ exec_pecoff_coff_prep_zmagic(struct image_params * imgp, struct vmspace *vmspace; struct pecoff_args *argp = NULL; - sh = malloc(scnsiz, M_TEMP, 0); + sh = malloc(scnsiz, M_TEMP, M_WAITOK); wp = (void *) ((char *) ap + sizeof(struct coff_aouthdr)); error = pecoff_read_from(FIRST_THREAD_IN_PROC(imgp->proc), imgp->vp, @@ -529,7 +529,7 @@ exec_pecoff_coff_prep_zmagic(struct image_params * imgp, vmspace->vm_taddr = (caddr_t) (uintptr_t) text_addr; vmspace->vm_dsize = data_size >> PAGE_SHIFT; vmspace->vm_daddr = (caddr_t) (uintptr_t) data_addr; - argp = malloc(sizeof(struct pecoff_args), M_TEMP, 0); + argp = malloc(sizeof(struct pecoff_args), M_TEMP, M_WAITOK); if (argp == NULL) { error = ENOMEM; goto fail; @@ -659,7 +659,7 @@ imgact_pecoff(struct image_params * imgp) VOP_UNLOCK(imgp->vp, 0, td); peofs = dp->d_peofs + sizeof(signature) - 1; - fp = malloc(PECOFF_HDR_SIZE, M_TEMP, 0); + fp = malloc(PECOFF_HDR_SIZE, M_TEMP, M_WAITOK); error = pecoff_read_from(FIRST_THREAD_IN_PROC(imgp->proc), imgp->vp, peofs, (caddr_t) fp, PECOFF_HDR_SIZE); if (error) diff --git a/sys/compat/svr4/svr4_filio.c b/sys/compat/svr4/svr4_filio.c index ab98dced59bd..ca1b8db0aeaf 100644 --- a/sys/compat/svr4/svr4_filio.c +++ b/sys/compat/svr4/svr4_filio.c @@ -68,7 +68,7 @@ svr4_sys_poll(td, uap) pa.timeout = uap->timeout; siz = uap->nfds * sizeof(struct pollfd); - pfd = (struct pollfd *)malloc(siz, M_TEMP, 0); + pfd = (struct pollfd *)malloc(siz, M_TEMP, M_WAITOK); error = poll(td, (struct poll_args *)uap); diff --git a/sys/compat/svr4/svr4_misc.c b/sys/compat/svr4/svr4_misc.c index 5938993f9498..2db3c960ffed 100644 --- a/sys/compat/svr4/svr4_misc.c +++ b/sys/compat/svr4/svr4_misc.c @@ -296,7 +296,7 @@ svr4_sys_getdents64(td, uap) #define DIRBLKSIZ 512 /* XXX we used to use ufs's DIRBLKSIZ */ buflen = max(DIRBLKSIZ, nbytes); buflen = min(buflen, MAXBSIZE); - buf = malloc(buflen, M_TEMP, 0); + buf = malloc(buflen, M_TEMP, M_WAITOK); vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td); again: aiov.iov_base = buf; @@ -459,7 +459,7 @@ svr4_sys_getdents(td, uap) } buflen = min(MAXBSIZE, uap->nbytes); - buf = malloc(buflen, M_TEMP, 0); + buf = malloc(buflen, M_TEMP, M_WAITOK); vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td); off = fp->f_offset; again: diff --git a/sys/compat/svr4/svr4_socket.c b/sys/compat/svr4/svr4_socket.c index 54274f9db7a9..b5da396c92bf 100644 --- a/sys/compat/svr4/svr4_socket.c +++ b/sys/compat/svr4/svr4_socket.c @@ -138,7 +138,7 @@ svr4_add_socket(td, path, st) atomic_store_rel_int(&svr4_str_initialized, 2); } - e = malloc(sizeof(*e), M_TEMP, 0); + e = malloc(sizeof(*e), M_TEMP, M_WAITOK); e->cookie = NULL; e->dev = st->st_dev; e->ino = st->st_ino; diff --git a/sys/compat/svr4/svr4_stream.c b/sys/compat/svr4/svr4_stream.c index ce2b68af34b2..95d67cd2d0dd 100644 --- a/sys/compat/svr4/svr4_stream.c +++ b/sys/compat/svr4/svr4_stream.c @@ -212,7 +212,7 @@ svr4_sendit(td, s, mp, flags) if (KTRPOINT(td, KTR_GENIO)) { int iovlen = auio.uio_iovcnt * sizeof (struct iovec); - MALLOC(ktriov, struct iovec *, iovlen, M_TEMP, 0); + MALLOC(ktriov, struct iovec *, iovlen, M_TEMP, M_WAITOK); bcopy((caddr_t)auio.uio_iov, (caddr_t)ktriov, iovlen); ktruio = auio; } @@ -297,7 +297,7 @@ svr4_recvit(td, s, mp, namelenp) if (KTRPOINT(td, KTR_GENIO)) { int iovlen = auio.uio_iovcnt * sizeof (struct iovec); - MALLOC(ktriov, struct iovec *, iovlen, M_TEMP, 0); + MALLOC(ktriov, struct iovec *, iovlen, M_TEMP, M_WAITOK); bcopy((caddr_t)auio.uio_iov, (caddr_t)ktriov, iovlen); ktruio = auio; } @@ -405,7 +405,7 @@ show_ioc(str, ioc) const char *str; struct svr4_strioctl *ioc; { - u_char *ptr = (u_char *) malloc(ioc->len, M_TEMP, 0); + u_char *ptr = (u_char *) malloc(ioc->len, M_TEMP, M_WAITOK); int error; uprintf("%s cmd = %ld, timeout = %d, len = %d, buf = %p { ", @@ -441,7 +441,7 @@ show_strbuf(str) len = maxlen; if (len > 0) { - ptr = (u_char *) malloc(len, M_TEMP, 0); + ptr = (u_char *) malloc(len, M_TEMP, M_WAITOK); if ((error = copyin(str->buf, ptr, len)) != 0) { free((char *) ptr, M_TEMP); diff --git a/sys/compat/svr4/svr4_sysvec.c b/sys/compat/svr4/svr4_sysvec.c index 508e9dc7f801..1d4ad6e5cfad 100644 --- a/sys/compat/svr4/svr4_sysvec.c +++ b/sys/compat/svr4/svr4_sysvec.c @@ -267,7 +267,7 @@ svr4_emul_find(td, sgp, prefix, path, pbuf, cflag) char *ptr, *buf, *cp; size_t sz, len; - buf = (char *) malloc(MAXPATHLEN, M_TEMP, 0); + buf = (char *) malloc(MAXPATHLEN, M_TEMP, M_WAITOK); *pbuf = path; for (ptr = buf; (*ptr = *prefix) != '\0'; ptr++, prefix++) diff --git a/sys/contrib/dev/fla/fla.c b/sys/contrib/dev/fla/fla.c index aad18b63e51d..dda7f5b18989 100644 --- a/sys/contrib/dev/fla/fla.c +++ b/sys/contrib/dev/fla/fla.c @@ -65,7 +65,7 @@ static struct cdevsw fladisk_cdevsw; void * doc2k_malloc(int bytes) { - return malloc(bytes, M_FLA, 0); + return malloc(bytes, M_FLA, M_WAITOK); } void diff --git a/sys/contrib/dev/oltr/if_oltr.c b/sys/contrib/dev/oltr/if_oltr.c index 453fe75d12e1..73f4d576468b 100644 --- a/sys/contrib/dev/oltr/if_oltr.c +++ b/sys/contrib/dev/oltr/if_oltr.c @@ -1404,14 +1404,14 @@ DriverReceiveFrameCompleted(void *DriverHandle, int ByteCount, int FragmentCount if (sc->state > OL_CLOSED) { if (ReceiveStatus == TRLLD_RCV_OK) { - MGETHDR(m0, M_NOWAIT, MT_DATA); + MGETHDR(m0, M_DONTWAIT, MT_DATA); mbuf_size = MHLEN - 2; if (!m0) { ifp->if_ierrors++; goto dropped; } if (ByteCount + 2 > MHLEN) { - MCLGET(m0, M_NOWAIT); + MCLGET(m0, M_DONTWAIT); mbuf_size = MCLBYTES - 2; if (!(m0->m_flags & M_EXT)) { m_freem(m0); @@ -1446,7 +1446,7 @@ DriverReceiveFrameCompleted(void *DriverHandle, int ByteCount, int FragmentCount frag_offset = 0; } if ((mbuf_offset == mbuf_size) && (frame_len > 0)) { - MGET(m1, M_NOWAIT, MT_DATA); + MGET(m1, M_DONTWAIT, MT_DATA); mbuf_size = MHLEN; if (!m1) { ifp->if_ierrors++; @@ -1454,7 +1454,7 @@ DriverReceiveFrameCompleted(void *DriverHandle, int ByteCount, int FragmentCount goto dropped; } if (frame_len > MHLEN) { - MCLGET(m1, M_NOWAIT); + MCLGET(m1, M_DONTWAIT); mbuf_size = MCLBYTES; if (!(m1->m_flags & M_EXT)) { m_freem(m0); diff --git a/sys/contrib/ipfilter/netinet/fil.c b/sys/contrib/ipfilter/netinet/fil.c index 7072753610c0..67d9f032c772 100644 --- a/sys/contrib/ipfilter/netinet/fil.c +++ b/sys/contrib/ipfilter/netinet/fil.c @@ -1209,7 +1209,7 @@ int out; mc = dupmsg(m); # else # if defined(__OpenBSD__) && (OpenBSD >= 199905) - mc = m_copym2(m, 0, M_COPYALL, M_NOWAIT); + mc = m_copym2(m, 0, M_COPYALL, M_DONTWAIT); # else mc = m_copy(m, 0, M_COPYALL); # endif @@ -1608,7 +1608,7 @@ m_copyback(m0, off, len, cp) off -= mlen; totlen += mlen; if (m->m_next == 0) { - n = m_getclr(M_NOWAIT, m->m_type); + n = m_getclr(M_DONTWAIT, m->m_type); if (n == 0) goto out; n->m_len = min(MLEN, len + off); @@ -1627,7 +1627,7 @@ m_copyback(m0, off, len, cp) if (len == 0) break; if (m->m_next == 0) { - n = m_get(M_NOWAIT, m->m_type); + n = m_get(M_DONTWAIT, m->m_type); if (n == 0) break; n->m_len = min(MLEN, len); diff --git a/sys/contrib/ipfilter/netinet/ip_fil.c b/sys/contrib/ipfilter/netinet/ip_fil.c index ec4f041dc290..f1f63a9f8759 100644 --- a/sys/contrib/ipfilter/netinet/ip_fil.c +++ b/sys/contrib/ipfilter/netinet/ip_fil.c @@ -1199,9 +1199,9 @@ fr_info_t *fin; if (tcp->th_flags & TH_RST) return -1; /* feedback loop */ # if (BSD < 199306) || defined(__sgi) - m = m_get(M_NOWAIT, MT_HEADER); + m = m_get(M_DONTWAIT, MT_HEADER); # else - m = m_gethdr(M_NOWAIT, MT_HEADER); + m = m_gethdr(M_DONTWAIT, MT_HEADER); # endif if (m == NULL) return ENOBUFS; @@ -1377,10 +1377,10 @@ int dst; # if (BSD < 199306) || defined(__sgi) avail = MLEN; - m = m_get(M_NOWAIT, MT_HEADER); + m = m_get(M_DONTWAIT, MT_HEADER); # else avail = MHLEN; - m = m_gethdr(M_NOWAIT, MT_HEADER); + m = m_gethdr(M_DONTWAIT, MT_HEADER); # endif if (m == NULL) return ENOBUFS; @@ -1404,11 +1404,11 @@ int dst; if (type == ICMP6_DST_UNREACH) code = icmptoicmp6unreach[code]; - MGETHDR(m, M_NOWAIT, MT_HEADER); + MGETHDR(m, M_DONTWAIT, MT_HEADER); if (!m) return ENOBUFS; - MCLGET(m, M_NOWAIT); + MCLGET(m, M_DONTWAIT); if ((m->m_flags & M_EXT) == 0) { m_freem(m); return ENOBUFS; @@ -1604,7 +1604,7 @@ frdest_t *fdp; * problem. */ if (M_WRITABLE(m) == 0) { - if ((m0 = m_dup(m, M_NOWAIT)) != NULL) { + if ((m0 = m_dup(m, M_DONTWAIT)) != NULL) { m_freem(*mpp); *mpp = m0; m = m0; @@ -1787,9 +1787,9 @@ frdest_t *fdp; mhlen = sizeof (struct ip); for (off = hlen + len; off < ip->ip_len; off += len) { # ifdef MGETHDR - MGETHDR(m, M_NOWAIT, MT_HEADER); + MGETHDR(m, M_DONTWAIT, MT_HEADER); # else - MGET(m, M_NOWAIT, MT_HEADER); + MGET(m, M_DONTWAIT, MT_HEADER); # endif if (m == 0) { error = ENOBUFS; diff --git a/sys/dev/agp/agp.c b/sys/dev/agp/agp.c index 293011c26245..f8210267ccba 100644 --- a/sys/dev/agp/agp.c +++ b/sys/dev/agp/agp.c @@ -357,7 +357,7 @@ agp_generic_alloc_memory(device_t dev, int type, vm_size_t size) return 0; } - mem = malloc(sizeof *mem, M_AGP, 0); + mem = malloc(sizeof *mem, M_AGP, M_WAITOK); mem->am_id = sc->as_nextid++; mem->am_size = size; mem->am_type = 0; diff --git a/sys/dev/agp/agp_i810.c b/sys/dev/agp/agp_i810.c index 7590c501fe09..39890ac4cd64 100644 --- a/sys/dev/agp/agp_i810.c +++ b/sys/dev/agp/agp_i810.c @@ -567,7 +567,7 @@ agp_i810_alloc_memory(device_t dev, int type, vm_size_t size) return 0; } - mem = malloc(sizeof *mem, M_AGP, 0); + mem = malloc(sizeof *mem, M_AGP, M_WAITOK); mem->am_id = sc->agp.as_nextid++; mem->am_size = size; mem->am_type = type; diff --git a/sys/dev/amr/amr.c b/sys/dev/amr/amr.c index e763c6c71890..e75c2afc1429 100644 --- a/sys/dev/amr/amr.c +++ b/sys/dev/amr/amr.c @@ -433,7 +433,7 @@ amr_ioctl(dev_t dev, u_long cmd, caddr_t addr, int32_t flag, d_thread_t *td) debug(1, "AMR_IO_COMMAND 0x%x", au->au_cmd[0]); /* handle inbound data buffer */ if (au->au_length != 0) { - if ((dp = malloc(au->au_length, M_DEVBUF, 0)) == NULL) { + if ((dp = malloc(au->au_length, M_DEVBUF, M_WAITOK)) == NULL) { error = ENOMEM; break; } @@ -449,7 +449,7 @@ amr_ioctl(dev_t dev, u_long cmd, caddr_t addr, int32_t flag, d_thread_t *td) /* handle SCSI passthrough command */ if (au->au_cmd[0] == AMR_CMD_PASS) { - if ((ap = malloc(sizeof(*ap), M_DEVBUF, M_ZERO)) == NULL) { + if ((ap = malloc(sizeof(*ap), M_DEVBUF, M_WAITOK | M_ZERO)) == NULL) { error = ENOMEM; break; } diff --git a/sys/dev/an/if_an.c b/sys/dev/an/if_an.c index c33c7c0418dd..cf1ff5d832ee 100644 --- a/sys/dev/an/if_an.c +++ b/sys/dev/an/if_an.c @@ -921,12 +921,12 @@ an_rxeof(sc) /* dump raw 802.11 packet to bpf and skip ip stack */ BPF_TAP(ifp, bpf_buf, len); } else { - MGETHDR(m, M_NOWAIT, MT_DATA); + MGETHDR(m, M_DONTWAIT, MT_DATA); if (m == NULL) { ifp->if_ierrors++; return; } - MCLGET(m, M_NOWAIT); + MCLGET(m, M_DONTWAIT); if (!(m->m_flags & M_EXT)) { m_freem(m); ifp->if_ierrors++; @@ -1006,12 +1006,12 @@ an_rxeof(sc) if (an_rx_desc.an_done && !an_rx_desc.an_valid) { buf = sc->an_rx_buffer[count].an_dma_vaddr; - MGETHDR(m, M_NOWAIT, MT_DATA); + MGETHDR(m, M_DONTWAIT, MT_DATA); if (m == NULL) { ifp->if_ierrors++; return; } - MCLGET(m, M_NOWAIT); + MCLGET(m, M_DONTWAIT); if (!(m->m_flags & M_EXT)) { m_freem(m); ifp->if_ierrors++; @@ -3610,7 +3610,7 @@ flashcard(ifp, l_ioctl) free(sc->an_flash_buffer, M_DEVBUF); sc->an_flash_buffer = NULL; } - sc->an_flash_buffer = malloc(FLASH_SIZE, M_DEVBUF, 0); + sc->an_flash_buffer = malloc(FLASH_SIZE, M_DEVBUF, M_WAITOK); if (sc->an_flash_buffer) return setflashmode(ifp); else diff --git a/sys/dev/ar/if_ar.c b/sys/dev/ar/if_ar.c index 14561f774388..0c09885c6d83 100644 --- a/sys/dev/ar/if_ar.c +++ b/sys/dev/ar/if_ar.c @@ -1078,7 +1078,7 @@ arc_init(struct ar_hardc *hc) u_char isr, mar; MALLOC(sc, struct ar_softc *, hc->numports * sizeof(struct ar_softc), - M_DEVBUF, M_ZERO); + M_DEVBUF, M_WAITOK | M_ZERO); if (sc == NULL) return; hc->sc = sc; @@ -1678,7 +1678,7 @@ ar_get_packets(struct ar_softc *sc) while(ar_packet_avail(sc, &len, &rxstat)) { TRC(printf("apa: len %d, rxstat %x\n", len, rxstat)); if(((rxstat & SCA_DESC_ERRORS) == 0) && (len < MCLBYTES)) { - MGETHDR(m, M_NOWAIT, MT_DATA); + MGETHDR(m, M_DONTWAIT, MT_DATA); if(m == NULL) { /* eat packet if get mbuf fail!! */ ar_eat_packet(sc, 1); @@ -1693,7 +1693,7 @@ ar_get_packets(struct ar_softc *sc) #endif /* NETGRAPH */ m->m_pkthdr.len = m->m_len = len; if(len > MHLEN) { - MCLGET(m, M_NOWAIT); + MCLGET(m, M_DONTWAIT); if((m->m_flags & M_EXT) == 0) { m_freem(m); ar_eat_packet(sc, 1); diff --git a/sys/dev/asr/asr.c b/sys/dev/asr/asr.c index c377c9d48a1a..4e1c28415579 100644 --- a/sys/dev/asr/asr.c +++ b/sys/dev/asr/asr.c @@ -911,7 +911,7 @@ asr_alloc_ccb ( OUT union asr_ccb * new_ccb; if ((new_ccb = (union asr_ccb *)malloc(sizeof(*new_ccb), - M_DEVBUF, M_ZERO)) != (union asr_ccb *)NULL) { + M_DEVBUF, M_WAITOK | M_ZERO)) != (union asr_ccb *)NULL) { new_ccb->ccb_h.pinfo.priority = 1; new_ccb->ccb_h.pinfo.index = CAM_UNQUEUED_INDEX; new_ccb->ccb_h.spriv_ptr0 = sc; @@ -1205,7 +1205,7 @@ ASR_getTidAddress( if ((new_entry == FALSE) || ((sc->ha_targets[bus] = bus_ptr = (target2lun_t *)malloc ( sizeof(*bus_ptr) + (sizeof(bus_ptr->LUN) * new_size), - M_TEMP, M_ZERO)) + M_TEMP, M_WAITOK | M_ZERO)) == (target2lun_t *)NULL)) { debug_asr_printf("failed to allocate bus list\n"); return ((tid_t *)NULL); @@ -1222,7 +1222,7 @@ ASR_getTidAddress( if ((new_entry == FALSE) || ((new_bus_ptr = (target2lun_t *)malloc ( sizeof(*bus_ptr) + (sizeof(bus_ptr->LUN) * new_size), - M_TEMP, M_ZERO)) + M_TEMP, M_WAITOK | M_ZERO)) == (target2lun_t *)NULL)) { debug_asr_printf("failed to reallocate bus list\n"); return ((tid_t *)NULL); @@ -1258,7 +1258,7 @@ ASR_getTidAddress( if ((new_entry == FALSE) || ((bus_ptr->LUN[target] = target_ptr = (lun2tid_t *)malloc ( sizeof(*target_ptr) + (sizeof(target_ptr->TID) * new_size), - M_TEMP, M_ZERO)) + M_TEMP, M_WAITOK | M_ZERO)) == (lun2tid_t *)NULL)) { debug_asr_printf("failed to allocate target list\n"); return ((tid_t *)NULL); @@ -1275,7 +1275,7 @@ ASR_getTidAddress( if ((new_entry == FALSE) || ((new_target_ptr = (lun2tid_t *)malloc ( sizeof(*target_ptr) + (sizeof(target_ptr->TID) * new_size), - M_TEMP, M_ZERO)) + M_TEMP, M_WAITOK | M_ZERO)) == (lun2tid_t *)NULL)) { debug_asr_printf("failed to reallocate target list\n"); return ((tid_t *)NULL); @@ -1808,7 +1808,7 @@ ASR_acquireLct ( MessageSizeInBytes = sizeof(I2O_EXEC_LCT_NOTIFY_MESSAGE) - sizeof(I2O_SG_ELEMENT) + sizeof(I2O_SGE_SIMPLE_ELEMENT); if ((Message_Ptr = (PI2O_EXEC_LCT_NOTIFY_MESSAGE)malloc ( - MessageSizeInBytes, M_TEMP, 0)) + MessageSizeInBytes, M_TEMP, M_WAITOK)) == (PI2O_EXEC_LCT_NOTIFY_MESSAGE)NULL) { return (ENOMEM); } @@ -1852,7 +1852,7 @@ ASR_acquireLct ( free (Message_Ptr, M_TEMP); return (EINVAL); } - if ((sc->ha_LCT = (PI2O_LCT)malloc (len, M_TEMP, 0)) + if ((sc->ha_LCT = (PI2O_LCT)malloc (len, M_TEMP, M_WAITOK)) == (PI2O_LCT)NULL) { free (Message_Ptr, M_TEMP); return (ENOMEM); @@ -1921,7 +1921,7 @@ ASR_acquireLct ( PI2O_EXEC_LCT_NOTIFY_MESSAGE NewMessage_Ptr; if ((NewMessage_Ptr = (PI2O_EXEC_LCT_NOTIFY_MESSAGE) - malloc (MessageSizeInBytes, M_TEMP, 0)) + malloc (MessageSizeInBytes, M_TEMP, M_WAITOK)) == (PI2O_EXEC_LCT_NOTIFY_MESSAGE)NULL) { free (sc->ha_LCT, M_TEMP); sc->ha_LCT = (PI2O_LCT)NULL; @@ -2262,7 +2262,7 @@ ASR_initOutBound ( * initialization time. */ if ((sc->ha_Msgs = (PI2O_SCSI_ERROR_REPLY_MESSAGE_FRAME) - contigmalloc (size, M_DEVBUF, 0, 0ul, + contigmalloc (size, M_DEVBUF, M_WAITOK, 0ul, 0xFFFFFFFFul, (u_long)sizeof(U32), 0ul)) != (PI2O_SCSI_ERROR_REPLY_MESSAGE_FRAME)NULL) { (void)bzero ((char *)sc->ha_Msgs, size); @@ -2296,7 +2296,7 @@ ASR_setSysTab( int retVal; if ((SystemTable = (PI2O_SET_SYSTAB_HEADER)malloc ( - sizeof(I2O_SET_SYSTAB_HEADER), M_TEMP, M_ZERO)) + sizeof(I2O_SET_SYSTAB_HEADER), M_TEMP, M_WAITOK | M_ZERO)) == (PI2O_SET_SYSTAB_HEADER)NULL) { return (ENOMEM); } @@ -2306,7 +2306,7 @@ ASR_setSysTab( if ((Message_Ptr = (PI2O_EXEC_SYS_TAB_SET_MESSAGE)malloc ( sizeof(I2O_EXEC_SYS_TAB_SET_MESSAGE) - sizeof(I2O_SG_ELEMENT) + ((3+SystemTable->NumberEntries) * sizeof(I2O_SGE_SIMPLE_ELEMENT)), - M_TEMP, 0)) == (PI2O_EXEC_SYS_TAB_SET_MESSAGE)NULL) { + M_TEMP, M_WAITOK)) == (PI2O_EXEC_SYS_TAB_SET_MESSAGE)NULL) { free (SystemTable, M_TEMP); return (ENOMEM); } @@ -2918,7 +2918,7 @@ asr_attach (ATTACH_ARGS) /* Check if the device is there? */ if ((ASR_resetIOP(sc->ha_Virt, sc->ha_Fvirt) == 0) || ((status = (PI2O_EXEC_STATUS_GET_REPLY)malloc ( - sizeof(I2O_EXEC_STATUS_GET_REPLY), M_TEMP, 0)) + sizeof(I2O_EXEC_STATUS_GET_REPLY), M_TEMP, M_WAITOK)) == (PI2O_EXEC_STATUS_GET_REPLY)NULL) || (ASR_getStatus(sc->ha_Virt, sc->ha_Fvirt, status) == NULL)) { printf ("asr%d: could not initialize hardware\n", unit); @@ -3037,7 +3037,7 @@ asr_attach (ATTACH_ARGS) printf ("asr%d:", unit); if ((iq = (struct scsi_inquiry_data *)malloc ( - sizeof(struct scsi_inquiry_data), M_TEMP, M_ZERO)) + sizeof(struct scsi_inquiry_data), M_TEMP, M_WAITOK | M_ZERO)) != (struct scsi_inquiry_data *)NULL) { defAlignLong(PRIVATE_SCSI_SCB_EXECUTE_MESSAGE,Message); PPRIVATE_SCSI_SCB_EXECUTE_MESSAGE Message_Ptr; @@ -3947,7 +3947,7 @@ ASR_queue_i( } /* Copy in the message into a local allocation */ if ((Message_Ptr = (PI2O_MESSAGE_FRAME)malloc ( - sizeof(I2O_MESSAGE_FRAME), M_TEMP, 0)) + sizeof(I2O_MESSAGE_FRAME), M_TEMP, M_WAITOK)) == (PI2O_MESSAGE_FRAME)NULL) { debug_usr_cmd_printf ( "Failed to acquire I2O_MESSAGE_FRAME memory\n"); @@ -4014,7 +4014,7 @@ ASR_queue_i( } if ((Message_Ptr = (PI2O_MESSAGE_FRAME)malloc (MessageSizeInBytes, - M_TEMP, 0)) == (PI2O_MESSAGE_FRAME)NULL) { + M_TEMP, M_WAITOK)) == (PI2O_MESSAGE_FRAME)NULL) { debug_usr_cmd_printf ("Failed to acquire frame[%d] memory\n", MessageSizeInBytes); return (ENOMEM); @@ -4030,7 +4030,7 @@ ASR_queue_i( /* Check the size of the reply frame, and start constructing */ if ((Reply_Ptr = (PI2O_SCSI_ERROR_REPLY_MESSAGE_FRAME)malloc ( - sizeof(I2O_MESSAGE_FRAME), M_TEMP, 0)) + sizeof(I2O_MESSAGE_FRAME), M_TEMP, M_WAITOK)) == (PI2O_SCSI_ERROR_REPLY_MESSAGE_FRAME)NULL) { free (Message_Ptr, M_TEMP); debug_usr_cmd_printf ( @@ -4061,7 +4061,7 @@ ASR_queue_i( ((ReplySizeInBytes > sizeof(I2O_SCSI_ERROR_REPLY_MESSAGE_FRAME)) ? ReplySizeInBytes : sizeof(I2O_SCSI_ERROR_REPLY_MESSAGE_FRAME)), - M_TEMP, 0)) == (PI2O_SCSI_ERROR_REPLY_MESSAGE_FRAME)NULL) { + M_TEMP, M_WAITOK)) == (PI2O_SCSI_ERROR_REPLY_MESSAGE_FRAME)NULL) { free (Message_Ptr, M_TEMP); debug_usr_cmd_printf ("Failed to acquire frame[%d] memory\n", ReplySizeInBytes); @@ -4130,7 +4130,7 @@ ASR_queue_i( if ((elm = (struct ioctlSgList_S *)malloc ( sizeof(*elm) - sizeof(elm->KernelSpace) + len, - M_TEMP, 0)) + M_TEMP, M_WAITOK)) == (struct ioctlSgList_S *)NULL) { debug_usr_cmd_printf ( "Failed to allocate SG[%d]\n", len); @@ -4219,7 +4219,7 @@ ASR_queue_i( if ((NewMessage_Ptr = (PI2O_MESSAGE_FRAME) malloc (MessageSizeInBytes, - M_TEMP, 0)) + M_TEMP, M_WAITOK)) == (PI2O_MESSAGE_FRAME)NULL) { debug_usr_cmd_printf ( "Failed to acquire frame[%d] memory\n", diff --git a/sys/dev/ata/atapi-cam.c b/sys/dev/ata/atapi-cam.c index b6329a65d3d3..02e234b70502 100644 --- a/sys/dev/ata/atapi-cam.c +++ b/sys/dev/ata/atapi-cam.c @@ -624,7 +624,7 @@ static void cam_rescan(struct cam_sim *sim) { struct cam_path *path; - union ccb *ccb = malloc(sizeof(union ccb), M_ATACAM, M_ZERO); + union ccb *ccb = malloc(sizeof(union ccb), M_ATACAM, M_WAITOK | M_ZERO); if (xpt_create_path(&path, xpt_periph, cam_sim_path(sim), CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD) != CAM_REQ_CMP) diff --git a/sys/dev/awi/awi.c b/sys/dev/awi/awi.c index 1eeaf78476e9..e77fae6d601a 100644 --- a/sys/dev/awi/awi.c +++ b/sys/dev/awi/awi.c @@ -1243,7 +1243,7 @@ awi_fix_txhdr(sc, m0) llc->llc_snap.org_code[2] = 0; llc->llc_snap.ether_type = eh.ether_type; } - M_PREPEND(m0, sizeof(struct ieee80211_frame), M_NOWAIT); + M_PREPEND(m0, sizeof(struct ieee80211_frame), M_DONTWAIT); if (m0 == NULL) return NULL; wh = mtod(m0, struct ieee80211_frame *); @@ -1321,7 +1321,7 @@ awi_fix_rxhdr(sc, m0) off = 0; while (m0->m_pkthdr.len > off) { if (n0 == NULL) { - MGETHDR(n, M_NOWAIT, MT_DATA); + MGETHDR(n, M_DONTWAIT, MT_DATA); if (n == NULL) { m_freem(m0); return NULL; @@ -1329,7 +1329,7 @@ awi_fix_rxhdr(sc, m0) M_MOVE_PKTHDR(n, m0); n->m_len = MHLEN; } else { - MGET(n, M_NOWAIT, MT_DATA); + MGET(n, M_DONTWAIT, MT_DATA); if (n == NULL) { m_freem(m0); m_freem(n0); @@ -1338,7 +1338,7 @@ awi_fix_rxhdr(sc, m0) n->m_len = MLEN; } if (m0->m_pkthdr.len - off >= MINCLSIZE) { - MCLGET(n, M_NOWAIT); + MCLGET(n, M_DONTWAIT); if (n->m_flags & M_EXT) n->m_len = n->m_ext.ext_size; } @@ -1549,14 +1549,14 @@ awi_devget(sc, off, len) while (len > 0) { if (top == NULL) { - MGETHDR(m, M_NOWAIT, MT_DATA); + MGETHDR(m, M_DONTWAIT, MT_DATA); if (m == NULL) return NULL; m->m_pkthdr.rcvif = sc->sc_ifp; m->m_pkthdr.len = len; m->m_len = MHLEN; } else { - MGET(m, M_NOWAIT, MT_DATA); + MGET(m, M_DONTWAIT, MT_DATA); if (m == NULL) { m_freem(top); return NULL; @@ -1564,7 +1564,7 @@ awi_devget(sc, off, len) m->m_len = MLEN; } if (len >= MINCLSIZE) { - MCLGET(m, M_NOWAIT); + MCLGET(m, M_DONTWAIT); if (m->m_flags & M_EXT) m->m_len = m->m_ext.ext_size; } @@ -2232,7 +2232,7 @@ awi_send_deauth(sc) struct ieee80211_frame *wh; u_int8_t *deauth; - MGETHDR(m, M_NOWAIT, MT_DATA); + MGETHDR(m, M_DONTWAIT, MT_DATA); if (m == NULL) return; if (ifp->if_flags & IFF_DEBUG) @@ -2269,7 +2269,7 @@ awi_send_auth(sc, seq) struct ieee80211_frame *wh; u_int8_t *auth; - MGETHDR(m, M_NOWAIT, MT_DATA); + MGETHDR(m, M_DONTWAIT, MT_DATA); if (m == NULL) return; sc->sc_status = AWI_ST_AUTH; @@ -2370,7 +2370,7 @@ awi_send_asreq(sc, reassoc) u_int16_t capinfo, lintval; u_int8_t *asreq; - MGETHDR(m, M_NOWAIT, MT_DATA); + MGETHDR(m, M_DONTWAIT, MT_DATA); if (m == NULL) return; sc->sc_status = AWI_ST_ASSOC; diff --git a/sys/dev/awi/awi_wep.c b/sys/dev/awi/awi_wep.c index 1eec0233bfb4..ecaf548b4ce0 100644 --- a/sys/dev/awi/awi_wep.c +++ b/sys/dev/awi/awi_wep.c @@ -319,7 +319,7 @@ awi_wep_encrypt(sc, m0, txflag) ctx = sc->sc_wep_ctx; m = m0; left = m->m_pkthdr.len; - MGET(n, M_NOWAIT, m->m_type); + MGET(n, M_DONTWAIT, m->m_type); n0 = n; if (n == NULL) goto fail; @@ -333,7 +333,7 @@ awi_wep_encrypt(sc, m0, txflag) } n->m_len = MHLEN; if (n->m_pkthdr.len >= MINCLSIZE) { - MCLGET(n, M_NOWAIT); + MCLGET(n, M_DONTWAIT); if (n->m_flags & M_EXT) n->m_len = n->m_ext.ext_size; } @@ -382,13 +382,13 @@ awi_wep_encrypt(sc, m0, txflag) if (len > n->m_len - noff) { len = n->m_len - noff; if (len == 0) { - MGET(n->m_next, M_NOWAIT, n->m_type); + MGET(n->m_next, M_DONTWAIT, n->m_type); if (n->m_next == NULL) goto fail; n = n->m_next; n->m_len = MLEN; if (left >= MINCLSIZE) { - MCLGET(n, M_NOWAIT); + MCLGET(n, M_DONTWAIT); if (n->m_flags & M_EXT) n->m_len = n->m_ext.ext_size; } @@ -418,7 +418,7 @@ awi_wep_encrypt(sc, m0, txflag) n->m_len = noff + sizeof(crcbuf); else { n->m_len = noff; - MGET(n->m_next, M_NOWAIT, n->m_type); + MGET(n->m_next, M_DONTWAIT, n->m_type); if (n->m_next == NULL) goto fail; n = n->m_next; diff --git a/sys/dev/bge/if_bge.c b/sys/dev/bge/if_bge.c index 26803b8d543a..01d720370479 100644 --- a/sys/dev/bge/if_bge.c +++ b/sys/dev/bge/if_bge.c @@ -719,12 +719,12 @@ bge_newbuf_std(sc, i, m) struct bge_rx_bd *r; if (m == NULL) { - MGETHDR(m_new, M_NOWAIT, MT_DATA); + MGETHDR(m_new, M_DONTWAIT, MT_DATA); if (m_new == NULL) { return(ENOBUFS); } - MCLGET(m_new, M_NOWAIT); + MCLGET(m_new, M_DONTWAIT); if (!(m_new->m_flags & M_EXT)) { m_freem(m_new); return(ENOBUFS); @@ -765,7 +765,7 @@ bge_newbuf_jumbo(sc, i, m) caddr_t *buf = NULL; /* Allocate the mbuf. */ - MGETHDR(m_new, M_NOWAIT, MT_DATA); + MGETHDR(m_new, M_DONTWAIT, MT_DATA); if (m_new == NULL) { return(ENOBUFS); } diff --git a/sys/dev/cardbus/cardbus_cis.c b/sys/dev/cardbus/cardbus_cis.c index 250ac65916b8..adee34dac411 100644 --- a/sys/dev/cardbus/cardbus_cis.c +++ b/sys/dev/cardbus/cardbus_cis.c @@ -201,7 +201,7 @@ decode_tuple_copy(device_t cbdev, device_t child, int id, struct cis_tupleinfo *tmpbuf; tmpbuf = malloc(sizeof(struct cis_tupleinfo) * (ncisread_buf+1), - M_DEVBUF, 0); + M_DEVBUF, M_WAITOK); if (ncisread_buf > 0) { memcpy(tmpbuf, cisread_buf, sizeof(struct cis_tupleinfo) * ncisread_buf); @@ -211,7 +211,7 @@ decode_tuple_copy(device_t cbdev, device_t child, int id, cisread_buf[ncisread_buf].id = id; cisread_buf[ncisread_buf].len = len; - cisread_buf[ncisread_buf].data = malloc(len, M_DEVBUF, 0); + cisread_buf[ncisread_buf].data = malloc(len, M_DEVBUF, M_WAITOK); memcpy(cisread_buf[ncisread_buf].data, tupledata, len); ncisread_buf++; return (0); @@ -804,7 +804,7 @@ cardbus_alloc_resources(device_t cbdev, device_t child) if (count == 0) return (0); barlist = malloc(sizeof(struct resource_list_entry*) * count, M_DEVBUF, - 0); + M_WAITOK); count = 0; SLIST_FOREACH(rle, &dinfo->pci.resources, link) { barlist[count] = rle; diff --git a/sys/dev/ccd/ccd.c b/sys/dev/ccd/ccd.c index c7f659102f0e..d947708b6021 100644 --- a/sys/dev/ccd/ccd.c +++ b/sys/dev/ccd/ccd.c @@ -186,7 +186,7 @@ ccdnew(int unit) if (IS_ALLOCATED(unit) || unit > 32) return (NULL); - MALLOC(sc, struct ccd_s *, sizeof(*sc), M_CCD, M_ZERO); + MALLOC(sc, struct ccd_s *, sizeof(*sc), M_CCD, M_WAITOK | M_ZERO); sc->sc_unit = unit; LIST_INSERT_HEAD(&ccd_softc_list, sc, list); /* XXX: UNLOCK(unique unit numbers) */ @@ -263,7 +263,7 @@ ccdinit(struct ccd_s *cs, char **cpaths, struct thread *td) /* Allocate space for the component info. */ cs->sc_cinfo = malloc(cs->sc_nccdisks * sizeof(struct ccdcinfo), - M_CCD, 0); + M_CCD, M_WAITOK); /* * Verify that each component piece exists and record @@ -271,7 +271,7 @@ ccdinit(struct ccd_s *cs, char **cpaths, struct thread *td) */ maxsecsize = 0; minsize = 0; - tmppath = malloc(MAXPATHLEN, M_CCD, 0); + tmppath = malloc(MAXPATHLEN, M_CCD, M_WAITOK); for (ix = 0; ix < cs->sc_nccdisks; ix++) { vp = cs->sc_vpp[ix]; ci = &cs->sc_cinfo[ix]; @@ -284,7 +284,7 @@ ccdinit(struct ccd_s *cs, char **cpaths, struct thread *td) MAXPATHLEN, &ci->ci_pathlen)) != 0) { goto fail; } - ci->ci_path = malloc(ci->ci_pathlen, M_CCD, 0); + ci->ci_path = malloc(ci->ci_pathlen, M_CCD, M_WAITOK); bcopy(tmppath, ci->ci_path, ci->ci_pathlen); ci->ci_dev = vn_todev(vp); @@ -439,7 +439,7 @@ ccdinterleave(struct ccd_s *cs, int unit) */ size = (cs->sc_nccdisks + 1) * sizeof(struct ccdiinfo); cs->sc_itable = (struct ccdiinfo *)malloc(size, M_CCD, - M_ZERO); + M_WAITOK | M_ZERO); /* * Trivial case: no interleave (actually interleave of disk size). @@ -453,7 +453,7 @@ ccdinterleave(struct ccd_s *cs, int unit) for (ix = 0; ix < cs->sc_nccdisks; ix++) { /* Allocate space for ii_index. */ - ii->ii_index = malloc(sizeof(int), M_CCD, 0); + ii->ii_index = malloc(sizeof(int), M_CCD, M_WAITOK); ii->ii_ndisk = 1; ii->ii_startblk = bn; ii->ii_startoff = 0; @@ -476,7 +476,7 @@ ccdinterleave(struct ccd_s *cs, int unit) * we use. */ ii->ii_index = malloc((sizeof(int) * cs->sc_nccdisks), - M_CCD, 0); + M_CCD, M_WAITOK); /* * Locate the smallest of the remaining components @@ -1066,9 +1066,9 @@ ccdioctltoo(int unit, u_long cmd, caddr_t data, int flag, struct thread *td) * componet pathnames and device numbers. */ cpp = malloc(ccio->ccio_ndisks * sizeof(char *), - M_CCD, 0); + M_CCD, M_WAITOK); vpp = malloc(ccio->ccio_ndisks * sizeof(struct vnode *), - M_CCD, 0); + M_CCD, M_WAITOK); error = copyin((caddr_t)ccio->ccio_disks, (caddr_t)cpp, ccio->ccio_ndisks * sizeof(char **)); @@ -1124,7 +1124,8 @@ ccdioctltoo(int unit, u_long cmd, caddr_t data, int flag, struct thread *td) ccio->ccio_unit = unit; ccio->ccio_size = cs->sc_size; ccg = &cs->sc_geom; - cs->sc_disk = malloc(sizeof(struct disk), M_CCD, M_ZERO); + cs->sc_disk = malloc(sizeof(struct disk), M_CCD, + M_ZERO | M_WAITOK); cs->sc_disk->d_strategy = ccdstrategy; cs->sc_disk->d_name = "ccd"; cs->sc_disk->d_sectorsize = ccg->ccg_secsize; diff --git a/sys/dev/ciss/ciss.c b/sys/dev/ciss/ciss.c index 3189ca066155..540627271582 100644 --- a/sys/dev/ciss/ciss.c +++ b/sys/dev/ciss/ciss.c @@ -1930,7 +1930,7 @@ ciss_user_command(struct ciss_softc *sc, IOCTL_Command_struct *ioc) */ cr->cr_length = ioc->buf_size; if (ioc->buf_size > 0) { - if ((cr->cr_data = malloc(ioc->buf_size, CISS_MALLOC_CLASS, 0)) == NULL) { + if ((cr->cr_data = malloc(ioc->buf_size, CISS_MALLOC_CLASS, M_WAITOK)) == NULL) { error = ENOMEM; goto out; } @@ -2109,7 +2109,7 @@ ciss_cam_rescan_target(struct ciss_softc *sc, int target) debug_called(1); - if ((ccb = malloc(sizeof(union ccb), M_TEMP, M_ZERO)) == NULL) { + if ((ccb = malloc(sizeof(union ccb), M_TEMP, M_WAITOK | M_ZERO)) == NULL) { ciss_printf(sc, "rescan failed (can't allocate CCB)\n"); return; } diff --git a/sys/dev/cm/smc90cx6.c b/sys/dev/cm/smc90cx6.c index 9347b5d2bb68..7ef0d1084237 100644 --- a/sys/dev/cm/smc90cx6.c +++ b/sys/dev/cm/smc90cx6.c @@ -628,7 +628,7 @@ cm_srint(vsc) splx(s); /* Allocate header mbuf */ - MGETHDR(m, M_NOWAIT, MT_DATA); + MGETHDR(m, M_DONTWAIT, MT_DATA); if (m == 0) { /* @@ -665,7 +665,7 @@ cm_srint(vsc) */ if ((len + 2 + 2) > MHLEN) { /* attach an mbuf cluster */ - MCLGET(m, M_NOWAIT); + MCLGET(m, M_DONTWAIT); /* Insist on getting a cluster */ if ((m->m_flags & M_EXT) == 0) { diff --git a/sys/dev/cnw/if_cnw.c b/sys/dev/cnw/if_cnw.c index 7043fff0c87b..84bdcedcd5cf 100644 --- a/sys/dev/cnw/if_cnw.c +++ b/sys/dev/cnw/if_cnw.c @@ -941,7 +941,7 @@ cnw_read(sc) bufbytes = 0; bufptr = 0; /* XXX make gcc happy */ - MGETHDR(m, M_NOWAIT, MT_DATA); + MGETHDR(m, M_DONTWAIT, MT_DATA); if (m == 0) return (0); #if !defined(__FreeBSD__) @@ -956,7 +956,7 @@ cnw_read(sc) while (totbytes > 0) { if (top) { - MGET(m, M_NOWAIT, MT_DATA); + MGET(m, M_DONTWAIT, MT_DATA); if (m == 0) { m_freem(top); return (0); @@ -964,7 +964,7 @@ cnw_read(sc) mbytes = MLEN; } if (totbytes >= MINCLSIZE) { - MCLGET(m, M_NOWAIT); + MCLGET(m, M_DONTWAIT); if ((m->m_flags & M_EXT) == 0) { m_free(m); m_freem(top); diff --git a/sys/dev/cs/if_cs.c b/sys/dev/cs/if_cs.c index 94643f0a1892..bffccf909b23 100644 --- a/sys/dev/cs/if_cs.c +++ b/sys/dev/cs/if_cs.c @@ -780,12 +780,12 @@ cs_get_packet(struct cs_softc *sc) return -1; } - MGETHDR(m, M_NOWAIT, MT_DATA); + MGETHDR(m, M_DONTWAIT, MT_DATA); if (m==NULL) return -1; if (length > MHLEN) { - MCLGET(m, M_NOWAIT); + MCLGET(m, M_DONTWAIT); if (!(m->m_flags & M_EXT)) { m_freem(m); return -1; diff --git a/sys/dev/dc/if_dc.c b/sys/dev/dc/if_dc.c index 0fb625d83621..1570ea452602 100644 --- a/sys/dev/dc/if_dc.c +++ b/sys/dev/dc/if_dc.c @@ -2428,11 +2428,11 @@ dc_newbuf(sc, i, m) c = &sc->dc_ldata->dc_rx_list[i]; if (m == NULL) { - MGETHDR(m_new, M_NOWAIT, MT_DATA); + MGETHDR(m_new, M_DONTWAIT, MT_DATA); if (m_new == NULL) return(ENOBUFS); - MCLGET(m_new, M_NOWAIT); + MCLGET(m_new, M_DONTWAIT); if (!(m_new->m_flags & M_EXT)) { m_freem(m_new); return(ENOBUFS); @@ -3192,11 +3192,11 @@ dc_coal(sc, m_head) struct mbuf *m_new, *m; m = *m_head; - MGETHDR(m_new, M_NOWAIT, MT_DATA); + MGETHDR(m_new, M_DONTWAIT, MT_DATA); if (m_new == NULL) return(ENOBUFS); if (m->m_pkthdr.len > MHLEN) { - MCLGET(m_new, M_NOWAIT); + MCLGET(m_new, M_DONTWAIT); if (!(m_new->m_flags & M_EXT)) { m_freem(m_new); return(ENOBUFS); diff --git a/sys/dev/de/if_de.c b/sys/dev/de/if_de.c index 9e1e319b2f2b..d1865865a099 100644 --- a/sys/dev/de/if_de.c +++ b/sys/dev/de/if_de.c @@ -195,7 +195,7 @@ tulip_txprobe( * either is connected so the transmit is the only way * to verify the connectivity. */ - MGETHDR(m, M_NOWAIT, MT_DATA); + MGETHDR(m, M_DONTWAIT, MT_DATA); if (m == NULL) return 0; /* @@ -3545,12 +3545,12 @@ tulip_rx_intr( */ if (accept || ms == NULL) { struct mbuf *m0; - MGETHDR(m0, M_NOWAIT, MT_DATA); + MGETHDR(m0, M_DONTWAIT, MT_DATA); if (m0 != NULL) { #if defined(TULIP_COPY_RXDATA) if (!accept || total_len >= (MHLEN - 2)) { #endif - MCLGET(m0, M_NOWAIT); + MCLGET(m0, M_DONTWAIT); if ((m0->m_flags & M_EXT) == 0) { m_freem(m0); m0 = NULL; @@ -4061,10 +4061,10 @@ tulip_mbuf_compress( { struct mbuf *m0; #if MCLBYTES >= ETHERMTU + 18 && !defined(BIG_PACKET) - MGETHDR(m0, M_NOWAIT, MT_DATA); + MGETHDR(m0, M_DONTWAIT, MT_DATA); if (m0 != NULL) { if (m->m_pkthdr.len > MHLEN) { - MCLGET(m0, M_NOWAIT); + MCLGET(m0, M_DONTWAIT); if ((m0->m_flags & M_EXT) == 0) { m_freem(m); m_freem(m0); @@ -4081,9 +4081,9 @@ tulip_mbuf_compress( while (len > 0) { if (mlen == MHLEN) { - MGETHDR(*mp, M_NOWAIT, MT_DATA); + MGETHDR(*mp, M_DONTWAIT, MT_DATA); } else { - MGET(*mp, M_NOWAIT, MT_DATA); + MGET(*mp, M_DONTWAIT, MT_DATA); } if (*mp == NULL) { m_freem(m0); @@ -4091,7 +4091,7 @@ tulip_mbuf_compress( break; } if (len > MLEN) { - MCLGET(*mp, M_NOWAIT); + MCLGET(*mp, M_DONTWAIT); if (((*mp)->m_flags & M_EXT) == 0) { m_freem(m0); m0 = NULL; diff --git a/sys/dev/digi/digi.c b/sys/dev/digi/digi.c index cde3b98734a2..57f60222dc24 100644 --- a/sys/dev/digi/digi.c +++ b/sys/dev/digi/digi.c @@ -546,12 +546,12 @@ digi_init(struct digi_softc *sc) if (sc->ports) free(sc->ports, M_TTYS); sc->ports = malloc(sizeof(struct digi_p) * sc->numports, - M_TTYS, M_ZERO); + M_TTYS, M_WAITOK | M_ZERO); if (sc->ttys) free(sc->ttys, M_TTYS); sc->ttys = malloc(sizeof(struct tty) * sc->numports, - M_TTYS, M_ZERO); + M_TTYS, M_WAITOK | M_ZERO); /* * XXX Should read port 0xc90 for an array of 2byte values, 1 per @@ -1035,7 +1035,7 @@ digi_loadmoduledata(struct digi_softc *sc) KASSERT(sc->module != NULL, ("Uninitialised module name")); modlen = strlen(sc->module); - modfile = malloc(modlen + 6, M_TEMP, 0); + modfile = malloc(modlen + 6, M_TEMP, M_WAITOK); snprintf(modfile, modlen + 6, "digi_%s", sc->module); if ((res = linker_reference_module(modfile, NULL, &lf)) != 0) { if (res == ENOENT && rootdev == NODEV) @@ -1049,7 +1049,7 @@ digi_loadmoduledata(struct digi_softc *sc) if (res != 0) return (res); - sym = malloc(modlen + 10, M_TEMP, 0); + sym = malloc(modlen + 10, M_TEMP, M_WAITOK); snprintf(sym, modlen + 10, "digi_mod_%s", sc->module); if ((symptr = linker_file_lookup_symbol(lf, sym, 0)) == NULL) printf("digi_%s.ko: Symbol `%s' not found\n", sc->module, sym); @@ -1065,19 +1065,19 @@ digi_loadmoduledata(struct digi_softc *sc) sc->bios.size = digi_mod->dm_bios.size; if (sc->bios.size != 0 && digi_mod->dm_bios.data != NULL) { - sc->bios.data = malloc(sc->bios.size, M_TTYS, 0); + sc->bios.data = malloc(sc->bios.size, M_TTYS, M_WAITOK); bcopy(digi_mod->dm_bios.data, sc->bios.data, sc->bios.size); } sc->fep.size = digi_mod->dm_fep.size; if (sc->fep.size != 0 && digi_mod->dm_fep.data != NULL) { - sc->fep.data = malloc(sc->fep.size, M_TTYS, 0); + sc->fep.data = malloc(sc->fep.size, M_TTYS, M_WAITOK); bcopy(digi_mod->dm_fep.data, sc->fep.data, sc->fep.size); } sc->link.size = digi_mod->dm_link.size; if (sc->link.size != 0 && digi_mod->dm_link.data != NULL) { - sc->link.data = malloc(sc->link.size, M_TTYS, 0); + sc->link.data = malloc(sc->link.size, M_TTYS, M_WAITOK); bcopy(digi_mod->dm_link.data, sc->link.data, sc->link.size); } diff --git a/sys/dev/dpt/dpt_scsi.c b/sys/dev/dpt/dpt_scsi.c index 9186c9615bfe..f035a8c249a3 100644 --- a/sys/dev/dpt/dpt_scsi.c +++ b/sys/dev/dpt/dpt_scsi.c @@ -2321,12 +2321,12 @@ dpt_user_cmd(dpt_softc_t * dpt, eata_pt_t * user_cmd, /* Data I/O is involved in this command. Alocate buffer */ if (ccb->eata_ccb.cp_datalen > PAGE_SIZE) { data = contigmalloc(ccb->eata_ccb.cp_datalen, - M_TEMP, 0, 0, ~0, + M_TEMP, M_WAITOK, 0, ~0, ccb->eata_ccb.cp_datalen, 0x10000); } else { data = malloc(ccb->eata_ccb.cp_datalen, M_TEMP, - 0); + M_WAITOK); } if (data == NULL) { diff --git a/sys/dev/drm/drm_drv.h b/sys/dev/drm/drm_drv.h index 1425859b7cc3..729b2f960c04 100644 --- a/sys/dev/drm/drm_drv.h +++ b/sys/dev/drm/drm_drv.h @@ -1451,7 +1451,7 @@ DRM(linux_ioctl)(DRM_OS_STRUCTPROC *p, struct linux_ioctl_args* args) if ( size > STK_PARAMS ) { if ( size > IOCPARM_MAX ) return EINVAL; - memp = malloc( (u_long)size, DRM(M_DRM), 0 ); + memp = malloc( (u_long)size, DRM(M_DRM), M_WAITOK ); data = memp; } else { data = ubuf.stkbuf; diff --git a/sys/dev/drm/drm_memory.h b/sys/dev/drm/drm_memory.h index c6f319c84ba8..81fa561a4186 100644 --- a/sys/dev/drm/drm_memory.h +++ b/sys/dev/drm/drm_memory.h @@ -288,7 +288,7 @@ unsigned long DRM(alloc_pages)(int order, int area) address = __get_free_pages(GFP_KERNEL, order); #endif /* __linux__ */ #ifdef __FreeBSD__ - address = (vm_offset_t) contigmalloc(bytes, DRM(M_DRM), 0, 0, ~0, 1, 0); + address = (vm_offset_t) contigmalloc(bytes, DRM(M_DRM), M_WAITOK, 0, ~0, 1, 0); #endif /* __FreeBSD__ */ if (!address) { DRM_OS_SPINLOCK(&DRM(mem_lock)); diff --git a/sys/dev/ed/if_ed.c b/sys/dev/ed/if_ed.c index e5040a553051..8d1c84996fd1 100644 --- a/sys/dev/ed/if_ed.c +++ b/sys/dev/ed/if_ed.c @@ -2679,7 +2679,7 @@ ed_get_packet(sc, buf, len) struct mbuf *m; /* Allocate a header mbuf */ - MGETHDR(m, M_NOWAIT, MT_DATA); + MGETHDR(m, M_DONTWAIT, MT_DATA); if (m == NULL) return; m->m_pkthdr.rcvif = ifp; @@ -2693,7 +2693,7 @@ ed_get_packet(sc, buf, len) */ if ((len + 2) > MHLEN) { /* Attach an mbuf cluster */ - MCLGET(m, M_NOWAIT); + MCLGET(m, M_DONTWAIT); /* Insist on getting a cluster */ if ((m->m_flags & M_EXT) == 0) { diff --git a/sys/dev/em/if_em.c b/sys/dev/em/if_em.c index 9f8b609e8ef9..1503ea2779c6 100644 --- a/sys/dev/em/if_em.c +++ b/sys/dev/em/if_em.c @@ -1802,12 +1802,12 @@ em_get_buf(int i, struct adapter *adapter, ifp = &adapter->interface_data.ac_if; if (mp == NULL) { - MGETHDR(mp, M_NOWAIT, MT_DATA); + MGETHDR(mp, M_DONTWAIT, MT_DATA); if (mp == NULL) { adapter->mbuf_alloc_failed++; return(ENOBUFS); } - MCLGET(mp, M_NOWAIT); + MCLGET(mp, M_DONTWAIT); if ((mp->m_flags & M_EXT) == 0) { m_freem(mp); adapter->mbuf_cluster_failed++; diff --git a/sys/dev/en/midway.c b/sys/dev/en/midway.c index 3e5d3f30059d..ffcc6c96dfda 100644 --- a/sys/dev/en/midway.c +++ b/sys/dev/en/midway.c @@ -601,7 +601,7 @@ u_int totlen, *drqneed; struct mbuf *top, **mp; *drqneed = 0; - MGETHDR(m, M_NOWAIT, MT_DATA); + MGETHDR(m, M_DONTWAIT, MT_DATA); if (m == NULL) return(NULL); m->m_pkthdr.rcvif = &sc->enif; @@ -613,7 +613,7 @@ u_int totlen, *drqneed; /* if (top != NULL) then we've already got 1 mbuf on the chain */ while (totlen > 0) { if (top) { - MGET(m, M_NOWAIT, MT_DATA); + MGET(m, M_DONTWAIT, MT_DATA); if (!m) { m_freem(top); return(NULL); /* out of mbufs */ @@ -621,7 +621,7 @@ u_int totlen, *drqneed; m->m_len = MLEN; } if (totlen >= MINCLSIZE) { - MCLGET(m, M_NOWAIT); + MCLGET(m, M_DONTWAIT); if ((m->m_flags & M_EXT) == 0) { m_free(m); m_freem(top); @@ -1770,12 +1770,12 @@ struct mbuf **mm, *prev; m->m_data = (caddr_t)d; } else { /* can't write to an M_EXT mbuf since it may be shared */ - MGET(new, M_NOWAIT, MT_DATA); + MGET(new, M_DONTWAIT, MT_DATA); if (!new) { EN_COUNT(sc->mfixfail); return(0); } - MCLGET(new, M_NOWAIT); + MCLGET(new, M_DONTWAIT); if ((new->m_flags & M_EXT) == 0) { m_free(new); EN_COUNT(sc->mfixfail); @@ -1837,14 +1837,14 @@ STATIC int en_makeexclusive(sc, mm, prev) if (MEXT_IS_REF(m)) { /* make a real copy of the M_EXT mbuf since it is shared */ - MGET(new, M_NOWAIT, MT_DATA); + MGET(new, M_DONTWAIT, MT_DATA); if (!new) { EN_COUNT(sc->mfixfail); return(0); } if (m->m_flags & M_PKTHDR) M_MOVE_PKTHDR(new, m); - MCLGET(new, M_NOWAIT); + MCLGET(new, M_DONTWAIT); if ((new->m_flags & M_EXT) == 0) { m_free(new); EN_COUNT(sc->mfixfail); diff --git a/sys/dev/ep/if_ep.c b/sys/dev/ep/if_ep.c index 5e0dc5de7528..749fa580b001 100644 --- a/sys/dev/ep/if_ep.c +++ b/sys/dev/ep/if_ep.c @@ -686,11 +686,11 @@ epread(sc) rx_fifo = rx_fifo2 = status & RX_BYTES_MASK; if (EP_FTST(sc, F_RX_FIRST)) { - MGETHDR(m, M_NOWAIT, MT_DATA); + MGETHDR(m, M_DONTWAIT, MT_DATA); if (!m) goto out; if (rx_fifo >= MINCLSIZE) - MCLGET(m, M_NOWAIT); + MCLGET(m, M_DONTWAIT); sc->top = sc->mcur = top = m; #define EROUND ((sizeof(struct ether_header) + 3) & ~3) #define EOFF (EROUND - sizeof(struct ether_header)) @@ -714,11 +714,11 @@ epread(sc) lenthisone = min(rx_fifo, M_TRAILINGSPACE(m)); if (lenthisone == 0) { /* no room in this one */ mcur = m; - MGET(m, M_NOWAIT, MT_DATA); + MGET(m, M_DONTWAIT, MT_DATA); if (!m) goto out; if (rx_fifo >= MINCLSIZE) - MCLGET(m, M_NOWAIT); + MCLGET(m, M_DONTWAIT); m->m_len = 0; mcur->m_next = m; lenthisone = min(rx_fifo, M_TRAILINGSPACE(m)); diff --git a/sys/dev/ex/if_ex.c b/sys/dev/ex/if_ex.c index d948af229b39..f7458afe73c6 100644 --- a/sys/dev/ex/if_ex.c +++ b/sys/dev/ex/if_ex.c @@ -695,7 +695,7 @@ ex_rx_intr(struct ex_softc *sc) QQQ = pkt_len = inw(iobase + IO_PORT_REG); if (rx_status & RCV_OK_bit) { - MGETHDR(m, M_NOWAIT, MT_DATA); + MGETHDR(m, M_DONTWAIT, MT_DATA); ipkt = m; if (ipkt == NULL) { ifp->if_iqdrops++; @@ -706,7 +706,7 @@ ex_rx_intr(struct ex_softc *sc) while (pkt_len > 0) { if (pkt_len > MINCLSIZE) { - MCLGET(m, M_NOWAIT); + MCLGET(m, M_DONTWAIT); if (m->m_flags & M_EXT) { m->m_len = MCLBYTES; } else { @@ -731,7 +731,7 @@ ex_rx_intr(struct ex_softc *sc) pkt_len -= m->m_len; if (pkt_len > 0) { - MGET(m->m_next, M_NOWAIT, MT_DATA); + MGET(m->m_next, M_DONTWAIT, MT_DATA); if (m->m_next == NULL) { m_freem(ipkt); ifp->if_iqdrops++; diff --git a/sys/dev/fb/fb.c b/sys/dev/fb/fb.c index edfc64eef5b1..0dbb73bac830 100644 --- a/sys/dev/fb/fb.c +++ b/sys/dev/fb/fb.c @@ -86,12 +86,12 @@ vid_realloc_array(void) s = spltty(); newsize = ((adapters + ARRAY_DELTA)/ARRAY_DELTA)*ARRAY_DELTA; - new_adp = malloc(sizeof(*new_adp)*newsize, M_DEVBUF, M_ZERO); + new_adp = malloc(sizeof(*new_adp)*newsize, M_DEVBUF, M_WAITOK | M_ZERO); new_vidsw = malloc(sizeof(*new_vidsw)*newsize, M_DEVBUF, - M_ZERO); + M_WAITOK | M_ZERO); #ifdef FB_INSTALL_CDEV new_cdevsw = malloc(sizeof(*new_cdevsw)*newsize, M_DEVBUF, - M_ZERO); + M_WAITOK | M_ZERO); #endif bcopy(adapter, new_adp, sizeof(*adapter)*adapters); bcopy(vidsw, new_vidsw, sizeof(*vidsw)*adapters); diff --git a/sys/dev/fb/vga.c b/sys/dev/fb/vga.c index 0f3cda117dda..56e015ba1399 100644 --- a/sys/dev/fb/vga.c +++ b/sys/dev/fb/vga.c @@ -2848,7 +2848,7 @@ get_palette(video_adapter_t *adp, int base, int count, if ((base < 0) || (base >= 256) || (base + count > 256)) return EINVAL; - r = malloc(count*3, M_DEVBUF, 0); + r = malloc(count*3, M_DEVBUF, M_WAITOK); g = r + count; b = g + count; if (vga_save_palette2(adp, base, count, r, g, b)) { @@ -2879,7 +2879,7 @@ set_palette(video_adapter_t *adp, int base, int count, if ((base < 0) || (base >= 256) || (base + count > 256)) return EINVAL; - r = malloc(count*3, M_DEVBUF, 0); + r = malloc(count*3, M_DEVBUF, M_WAITOK); g = r + count; b = g + count; copyin(red, r, count); diff --git a/sys/dev/fe/if_fe.c b/sys/dev/fe/if_fe.c index 81e4865d176f..b6ad14cef775 100644 --- a/sys/dev/fe/if_fe.c +++ b/sys/dev/fe/if_fe.c @@ -1847,13 +1847,13 @@ fe_get_packet (struct fe_softc * sc, u_short len) */ /* Allocate an mbuf with packet header info. */ - MGETHDR(m, M_NOWAIT, MT_DATA); + MGETHDR(m, M_DONTWAIT, MT_DATA); if (m == NULL) return -1; /* Attach a cluster if this packet doesn't fit in a normal mbuf. */ if (len > MHLEN - NFS_MAGIC_OFFSET) { - MCLGET(m, M_NOWAIT); + MCLGET(m, M_DONTWAIT); if (!(m->m_flags & M_EXT)) { m_freem(m); return -1; diff --git a/sys/dev/firewire/if_fwe.c b/sys/dev/firewire/if_fwe.c index 3f428df45fde..ca9bd816bdb0 100644 --- a/sys/dev/firewire/if_fwe.c +++ b/sys/dev/firewire/if_fwe.c @@ -469,7 +469,7 @@ fwe_as_output(struct fwe_softc *fwe, struct ifnet *ifp) xfer->act.hand = fwe_output_callback; /* keep ip packet alignment for alpha */ - M_PREPEND(m, ALIGN_PAD, M_NOWAIT); + M_PREPEND(m, ALIGN_PAD, M_DONTWAIT); fp = (struct fw_pkt *)&xfer->dst; /* XXX */ xfer->dst = *((int32_t *)&fwe->pkt_hdr); fp->mode.stream.len = htons(m->m_pkthdr.len); @@ -547,7 +547,7 @@ fwe_as_input(struct fw_xferq *xferq) while ((xfer = STAILQ_FIRST(&xferq->q)) != NULL) { STAILQ_REMOVE_HEAD(&xferq->q, link); xferq->queued --; - MGETHDR(m, M_NOWAIT, MT_DATA); + MGETHDR(m, M_DONTWAIT, MT_DATA); if (m == NULL) { printf("MGETHDR failed\n"); fw_xfer_free(xfer); diff --git a/sys/dev/fxp/if_fxp.c b/sys/dev/fxp/if_fxp.c index 062e432e3c84..cb2a986d3761 100644 --- a/sys/dev/fxp/if_fxp.c +++ b/sys/dev/fxp/if_fxp.c @@ -1069,13 +1069,13 @@ fxp_start(struct ifnet *ifp) * mbuf chain first. Bail out if we can't get the * new buffers. */ - MGETHDR(mn, M_NOWAIT, MT_DATA); + MGETHDR(mn, M_DONTWAIT, MT_DATA); if (mn == NULL) { m_freem(mb_head); break; } if (mb_head->m_pkthdr.len > MHLEN) { - MCLGET(mn, M_NOWAIT); + MCLGET(mn, M_DONTWAIT); if ((mn->m_flags & M_EXT) == 0) { m_freem(mn); m_freem(mb_head); @@ -1873,7 +1873,7 @@ fxp_add_rfabuf(struct fxp_softc *sc, struct mbuf *oldm) struct mbuf *m; struct fxp_rfa *rfa, *p_rfa; - m = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR); + m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); if (m == NULL) { /* try to recycle the old mbuf instead */ if (oldm == NULL) return 1; diff --git a/sys/dev/gem/if_gem.c b/sys/dev/gem/if_gem.c index 09bef5fa37a4..ae0d2b6ac566 100644 --- a/sys/dev/gem/if_gem.c +++ b/sys/dev/gem/if_gem.c @@ -1422,7 +1422,7 @@ gem_add_rxbuf(sc, idx) struct mbuf *m; int error; - m = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR); + m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); if (m == NULL) return (ENOBUFS); m->m_len = m->m_pkthdr.len = m->m_ext.ext_size; diff --git a/sys/dev/gx/if_gx.c b/sys/dev/gx/if_gx.c index 8dec6b213f76..8d59cd682705 100644 --- a/sys/dev/gx/if_gx.c +++ b/sys/dev/gx/if_gx.c @@ -1068,13 +1068,13 @@ gx_newbuf(struct gx_softc *gx, int idx, struct mbuf *m) struct gx_rx_desc *r; if (m == NULL) { - MGETHDR(m_new, M_NOWAIT, MT_DATA); + MGETHDR(m_new, M_DONTWAIT, MT_DATA); if (m_new == NULL) { device_printf(gx->gx_dev, "mbuf allocation failed -- packet dropped\n"); return (ENOBUFS); } - MCLGET(m_new, M_NOWAIT); + MCLGET(m_new, M_DONTWAIT); if ((m_new->m_flags & M_EXT) == 0) { device_printf(gx->gx_dev, "cluster allocation failed -- packet dropped\n"); diff --git a/sys/dev/hifn/hifn7751.c b/sys/dev/hifn/hifn7751.c index 6b6d9c6b922c..cb58fe0b0f98 100644 --- a/sys/dev/hifn/hifn7751.c +++ b/sys/dev/hifn/hifn7751.c @@ -1667,14 +1667,14 @@ hifn_crypto( totlen = cmd->src_mapsize; if (cmd->src_m->m_flags & M_PKTHDR) { len = MHLEN; - MGETHDR(m0, M_NOWAIT, MT_DATA); - if (m0 && !m_dup_pkthdr(m0, cmd->src_m, M_NOWAIT)) { + MGETHDR(m0, M_DONTWAIT, MT_DATA); + if (m0 && !m_dup_pkthdr(m0, cmd->src_m, M_DONTWAIT)) { m_free(m0); m0 = NULL; } } else { len = MLEN; - MGET(m0, M_NOWAIT, MT_DATA); + MGET(m0, M_DONTWAIT, MT_DATA); } if (m0 == NULL) { hifnstats.hst_nomem_mbuf++; @@ -1682,7 +1682,7 @@ hifn_crypto( goto err_srcmap; } if (totlen >= MINCLSIZE) { - MCLGET(m0, M_NOWAIT); + MCLGET(m0, M_DONTWAIT); if ((m0->m_flags & M_EXT) == 0) { hifnstats.hst_nomem_mcl++; err = dma->cmdu ? ERESTART : ENOMEM; @@ -1696,7 +1696,7 @@ hifn_crypto( mlast = m0; while (totlen > 0) { - MGET(m, M_NOWAIT, MT_DATA); + MGET(m, M_DONTWAIT, MT_DATA); if (m == NULL) { hifnstats.hst_nomem_mbuf++; err = dma->cmdu ? ERESTART : ENOMEM; @@ -1705,7 +1705,7 @@ hifn_crypto( } len = MLEN; if (totlen >= MINCLSIZE) { - MCLGET(m, M_NOWAIT); + MCLGET(m, M_DONTWAIT); if ((m->m_flags & M_EXT) == 0) { hifnstats.hst_nomem_mcl++; err = dma->cmdu ? ERESTART : ENOMEM; diff --git a/sys/dev/hme/if_hme.c b/sys/dev/hme/if_hme.c index aadbe475a2d4..83d15fde8969 100644 --- a/sys/dev/hme/if_hme.c +++ b/sys/dev/hme/if_hme.c @@ -491,7 +491,7 @@ hme_add_rxbuf(struct hme_softc *sc, unsigned int ri, int keepold) hme_discard_rxbuf(sc, ri); return (0); } - if ((m = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR)) == NULL) + if ((m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR)) == NULL) return (ENOBUFS); m->m_len = m->m_pkthdr.len = m->m_ext.ext_size; b = mtod(m, uintptr_t); diff --git a/sys/dev/idt/idt.c b/sys/dev/idt/idt.c index e5169e01930b..3a74b4dd6edc 100644 --- a/sys/dev/idt/idt.c +++ b/sys/dev/idt/idt.c @@ -1171,10 +1171,10 @@ nicstar_ld_rcv_buf(IDT * idt) idt_sysctl_buflarge = 10; while (card_small < idt_sysctl_bufsmall) { /* 05/25/2001 from fixed */ - MGETHDR(m1, M_NOWAIT, MT_DATA); + MGETHDR(m1, M_DONTWAIT, MT_DATA); if (m1 == NULL) break; - MGETHDR(m2, M_NOWAIT, MT_DATA); + MGETHDR(m2, M_DONTWAIT, MT_DATA); if (m2 == NULL) { m_free(m1); break; @@ -2006,11 +2006,11 @@ idt_mbufcl_get(void) { struct mbuf *m; - MGETHDR(m, M_NOWAIT, MT_DATA); + MGETHDR(m, M_DONTWAIT, MT_DATA); if (m == NULL) return (NULL); - MCLGET(m, M_NOWAIT); + MCLGET(m, M_DONTWAIT); if (m->m_flags & M_EXT) return (m); diff --git a/sys/dev/ie/if_ie.c b/sys/dev/ie/if_ie.c index 088f12268827..b3e844c61827 100644 --- a/sys/dev/ie/if_ie.c +++ b/sys/dev/ie/if_ie.c @@ -1133,7 +1133,7 @@ ieget(int unit, struct ie_softc *ie, struct mbuf **mp) if (totlen <= 0) return (-1); - MGETHDR(m, M_NOWAIT, MT_DATA); + MGETHDR(m, M_DONTWAIT, MT_DATA); if (!m) { ie_drop_packet_buffer(unit, ie); /* XXXX if_ierrors++; */ @@ -1188,7 +1188,7 @@ ieget(int unit, struct ie_softc *ie, struct mbuf **mp) * single mbuf which may or may not be big enough. Got that? */ if (top) { - MGET(m, M_NOWAIT, MT_DATA); + MGET(m, M_DONTWAIT, MT_DATA); if (!m) { m_freem(top); ie_drop_packet_buffer(unit, ie); @@ -1197,7 +1197,7 @@ ieget(int unit, struct ie_softc *ie, struct mbuf **mp) m->m_len = MLEN; } if (resid >= MINCLSIZE) { - MCLGET(m, M_NOWAIT); + MCLGET(m, M_DONTWAIT); if (m->m_flags & M_EXT) m->m_len = min(resid, MCLBYTES); } else { diff --git a/sys/dev/iicbus/if_ic.c b/sys/dev/iicbus/if_ic.c index 84d7b2fbeeff..a6660b744d31 100644 --- a/sys/dev/iicbus/if_ic.c +++ b/sys/dev/iicbus/if_ic.c @@ -192,14 +192,14 @@ icioctl(struct ifnet *ifp, u_long cmd, caddr_t data) return (error); sc->ic_obuf = malloc(sc->ic_if.if_mtu + ICHDRLEN, - M_DEVBUF, 0); + M_DEVBUF, M_WAITOK); if (!sc->ic_obuf) { iicbus_release_bus(parent, icdev); return ENOBUFS; } sc->ic_ifbuf = malloc(sc->ic_if.if_mtu + ICHDRLEN, - M_DEVBUF, 0); + M_DEVBUF, M_WAITOK); if (!sc->ic_ifbuf) { iicbus_release_bus(parent, icdev); return ENOBUFS; diff --git a/sys/dev/isp/isp_pci.c b/sys/dev/isp/isp_pci.c index 449fa141d593..9636a7ff4831 100644 --- a/sys/dev/isp/isp_pci.c +++ b/sys/dev/isp/isp_pci.c @@ -624,7 +624,7 @@ isp_pci_attach(device_t dev) } if (amt) { FCPARAM(isp)->isp_dump_data = - malloc(amt, M_DEVBUF, M_ZERO); + malloc(amt, M_DEVBUF, M_WAITOK | M_ZERO); } else { device_printf(dev, "f/w crash dumps not supported for this model\n"); @@ -1105,14 +1105,14 @@ isp_pci_mbxdma(struct ispsoftc *isp) len = sizeof (XS_T **) * isp->isp_maxcmds; - isp->isp_xflist = (XS_T **) malloc(len, M_DEVBUF, M_ZERO); + isp->isp_xflist = (XS_T **) malloc(len, M_DEVBUF, M_WAITOK | M_ZERO); if (isp->isp_xflist == NULL) { isp_prt(isp, ISP_LOGERR, "cannot alloc xflist array"); ISP_LOCK(isp); return (1); } len = sizeof (bus_dmamap_t) * isp->isp_maxcmds; - pcs->dmaps = (bus_dmamap_t *) malloc(len, M_DEVBUF, 0); + pcs->dmaps = (bus_dmamap_t *) malloc(len, M_DEVBUF, M_WAITOK); if (pcs->dmaps == NULL) { isp_prt(isp, ISP_LOGERR, "can't alloc dma map storage"); free(isp->isp_xflist, M_DEVBUF); diff --git a/sys/dev/isp/isp_sbus.c b/sys/dev/isp/isp_sbus.c index 829ee8e2852f..d2af1a5ef3d6 100644 --- a/sys/dev/isp/isp_sbus.c +++ b/sys/dev/isp/isp_sbus.c @@ -498,14 +498,14 @@ isp_sbus_mbxdma(struct ispsoftc *isp) } len = sizeof (XS_T **) * isp->isp_maxcmds; - isp->isp_xflist = (XS_T **) malloc(len, M_DEVBUF, M_ZERO); + isp->isp_xflist = (XS_T **) malloc(len, M_DEVBUF, M_WAITOK | M_ZERO); if (isp->isp_xflist == NULL) { isp_prt(isp, ISP_LOGERR, "cannot alloc xflist array"); ISP_LOCK(isp); return (1); } len = sizeof (bus_dmamap_t) * isp->isp_maxcmds; - sbs->dmaps = (bus_dmamap_t *) malloc(len, M_DEVBUF, 0); + sbs->dmaps = (bus_dmamap_t *) malloc(len, M_DEVBUF, M_WAITOK); if (sbs->dmaps == NULL) { isp_prt(isp, ISP_LOGERR, "can't alloc dma map storage"); free(isp->isp_xflist, M_DEVBUF); diff --git a/sys/dev/kbd/kbd.c b/sys/dev/kbd/kbd.c index 035813aed91d..6eef728733bc 100644 --- a/sys/dev/kbd/kbd.c +++ b/sys/dev/kbd/kbd.c @@ -454,7 +454,7 @@ kbd_attach(keyboard_t *kbd) "kbd%r", kbd->kb_index); if (dev->si_drv1 == NULL) dev->si_drv1 = malloc(sizeof(genkbd_softc_t), M_DEVBUF, - 0); + M_WAITOK); bzero(dev->si_drv1, sizeof(genkbd_softc_t)); printf("kbd%d at %s%d\n", kbd->kb_index, kbd->kb_name, kbd->kb_unit); diff --git a/sys/dev/lge/if_lge.c b/sys/dev/lge/if_lge.c index 81d10419e682..9efa94da6485 100644 --- a/sys/dev/lge/if_lge.c +++ b/sys/dev/lge/if_lge.c @@ -784,7 +784,7 @@ lge_newbuf(sc, c, m) caddr_t *buf = NULL; if (m == NULL) { - MGETHDR(m_new, M_NOWAIT, MT_DATA); + MGETHDR(m_new, M_DONTWAIT, MT_DATA); if (m_new == NULL) { printf("lge%d: no memory for rx list " "-- packet dropped!\n", sc->lge_unit); diff --git a/sys/dev/lmc/if_lmc.c b/sys/dev/lmc/if_lmc.c index 68fce9045f2e..83250cfc86c2 100644 --- a/sys/dev/lmc/if_lmc.c +++ b/sys/dev/lmc/if_lmc.c @@ -621,9 +621,9 @@ lmc_rx_intr(lmc_softc_t * const sc) */ if (accept || ms == NULL) { struct mbuf *m0; - MGETHDR(m0, M_NOWAIT, MT_DATA); + MGETHDR(m0, M_DONTWAIT, MT_DATA); if (m0 != NULL) { - MCLGET(m0, M_NOWAIT); + MCLGET(m0, M_DONTWAIT); if ((m0->m_flags & M_EXT) == 0) { m_freem(m0); m0 = NULL; @@ -830,10 +830,10 @@ lmc_mbuf_compress(struct mbuf *m) { struct mbuf *m0; #if MCLBYTES >= LMC_MTU + PPP_HEADER_LEN && !defined(BIG_PACKET) - MGETHDR(m0, M_NOWAIT, MT_DATA); + MGETHDR(m0, M_DONTWAIT, MT_DATA); if (m0 != NULL) { if (m->m_pkthdr.len > MHLEN) { - MCLGET(m0, M_NOWAIT); + MCLGET(m0, M_DONTWAIT); if ((m0->m_flags & M_EXT) == 0) { m_freem(m); m_freem(m0); @@ -850,9 +850,9 @@ lmc_mbuf_compress(struct mbuf *m) while (len > 0) { if (mlen == MHLEN) { - MGETHDR(*mp, M_NOWAIT, MT_DATA); + MGETHDR(*mp, M_DONTWAIT, MT_DATA); } else { - MGET(*mp, M_NOWAIT, MT_DATA); + MGET(*mp, M_DONTWAIT, MT_DATA); } if (*mp == NULL) { m_freem(m0); @@ -860,7 +860,7 @@ lmc_mbuf_compress(struct mbuf *m) break; } if (len > MLEN) { - MCLGET(*mp, M_NOWAIT); + MCLGET(*mp, M_DONTWAIT); if (((*mp)->m_flags & M_EXT) == 0) { m_freem(m0); m0 = NULL; diff --git a/sys/dev/lnc/if_lnc.c b/sys/dev/lnc/if_lnc.c index c1d63f191f6e..eeb678abbe27 100644 --- a/sys/dev/lnc/if_lnc.c +++ b/sys/dev/lnc/if_lnc.c @@ -314,10 +314,10 @@ alloc_mbuf_cluster(struct lnc_softc *sc, struct host_ring_entry *desc) sc->mbufs = m->m_next; /* XXX m->m_data = m->m_ext.ext_buf;*/ } else { - MGET(m, M_NOWAIT, MT_DATA); + MGET(m, M_DONTWAIT, MT_DATA); if (!m) return(1); - MCLGET(m, M_NOWAIT); + MCLGET(m, M_DONTWAIT); if (!m->m_ext.ext_buf) { m_free(m); return(1); @@ -379,7 +379,7 @@ mbuf_packet(struct lnc_softc *sc, int start_of_packet, int pkt_len) int amount; /* Get a pkthdr mbuf for the start of packet */ - MGETHDR(head, M_NOWAIT, MT_DATA); + MGETHDR(head, M_DONTWAIT, MT_DATA); if (!head) { LNCSTATS(drop_packet) return(0); @@ -409,13 +409,13 @@ mbuf_packet(struct lnc_softc *sc, int start_of_packet, int pkt_len) if (amount == 0) { /* mbuf must be empty */ m_prev = m; - MGET(m, M_NOWAIT, MT_DATA); + MGET(m, M_DONTWAIT, MT_DATA); if (!m) { m_freem(head); return(0); } if (pkt_len >= MINCLSIZE) - MCLGET(m, M_NOWAIT); + MCLGET(m, M_DONTWAIT); m->m_len = 0; m_prev->m_next = m; amount = min(blen, M_TRAILINGSPACE(m)); @@ -1218,9 +1218,9 @@ chain_to_cluster(struct mbuf *m) { struct mbuf *new; - MGET(new, M_NOWAIT, MT_DATA); + MGET(new, M_DONTWAIT, MT_DATA); if (new) { - MCLGET(new, M_NOWAIT); + MCLGET(new, M_DONTWAIT); if (new->m_ext.ext_buf) { new->m_len = mbuf_to_buffer(m, new->m_data); m_freem(m); diff --git a/sys/dev/md/md.c b/sys/dev/md/md.c index 75f76ee373c2..591cd646a1dc 100644 --- a/sys/dev/md/md.c +++ b/sys/dev/md/md.c @@ -658,7 +658,7 @@ mdnew(int unit) unit = max + 1; if (unit > 255) return (NULL); - sc = (struct md_s *)malloc(sizeof *sc, M_MD, M_ZERO); + sc = (struct md_s *)malloc(sizeof *sc, M_MD, M_WAITOK | M_ZERO); sc->unit = unit; bioq_init(&sc->bio_queue); mtx_init(&sc->queue_mtx, "md bio queue", NULL, MTX_DEF); @@ -815,7 +815,7 @@ mdsetcred(struct md_s *sc, struct ucred *cred) struct uio auio; struct iovec aiov; - tmpbuf = malloc(sc->secsize, M_TEMP, 0); + tmpbuf = malloc(sc->secsize, M_TEMP, M_WAITOK); bzero(&auio, sizeof(auio)); aiov.iov_base = tmpbuf; diff --git a/sys/dev/mlx/mlx.c b/sys/dev/mlx/mlx.c index 61e1c8beeeb3..aecd9dc34b80 100644 --- a/sys/dev/mlx/mlx.c +++ b/sys/dev/mlx/mlx.c @@ -1880,7 +1880,7 @@ mlx_user_command(struct mlx_softc *sc, struct mlx_usercommand *mu) if (mu->mu_datasize > 0) { if (mu->mu_datasize > MAXPHYS) return (EINVAL); - if (((kbuf = malloc(mu->mu_datasize, M_DEVBUF, 0)) == NULL) || + if (((kbuf = malloc(mu->mu_datasize, M_DEVBUF, M_WAITOK)) == NULL) || (error = copyin(mu->mu_buf, kbuf, mu->mu_datasize))) goto out; debug(0, "got kernel buffer"); diff --git a/sys/dev/mly/mly.c b/sys/dev/mly/mly.c index 71759ce7193f..4fd18801849b 100644 --- a/sys/dev/mly/mly.c +++ b/sys/dev/mly/mly.c @@ -2019,7 +2019,7 @@ mly_cam_rescan_btl(struct mly_softc *sc, int bus, int target) debug_called(1); - if ((ccb = malloc(sizeof(union ccb), M_TEMP, M_ZERO)) == NULL) { + if ((ccb = malloc(sizeof(union ccb), M_TEMP, M_WAITOK | M_ZERO)) == NULL) { mly_printf(sc, "rescan failed (can't allocate CCB)\n"); return; } diff --git a/sys/dev/mpt/mpt_pci.c b/sys/dev/mpt/mpt_pci.c index 7f9a14571142..9a0a5ba9493d 100644 --- a/sys/dev/mpt/mpt_pci.c +++ b/sys/dev/mpt/mpt_pci.c @@ -478,7 +478,7 @@ mpt_dma_mem_alloc(mpt_softc_t *mpt) len = sizeof (request_t *) * MPT_REQ_MEM_SIZE(mpt); #ifdef RELENG_4 - mpt->request_pool = (request_t *) malloc(len, M_DEVBUF, 0); + mpt->request_pool = (request_t *) malloc(len, M_DEVBUF, M_WAITOK); if (mpt->request_pool == NULL) { device_printf(dev, "cannot allocate request pool\n"); return (1); @@ -486,7 +486,7 @@ mpt_dma_mem_alloc(mpt_softc_t *mpt) bzero(mpt->request_pool, len); #else mpt->request_pool = (request_t *) - malloc(len, M_DEVBUF, M_ZERO); + malloc(len, M_DEVBUF, M_WAITOK | M_ZERO); if (mpt->request_pool == NULL) { device_printf(dev, "cannot allocate request pool\n"); return (1); diff --git a/sys/dev/musycc/musycc.c b/sys/dev/musycc/musycc.c index 48504db17f37..3fb7834b1e32 100644 --- a/sys/dev/musycc/musycc.c +++ b/sys/dev/musycc/musycc.c @@ -696,9 +696,9 @@ musycc_intr0_rx_eom(struct softc *sc, int ch) m->m_len = m->m_pkthdr.len = status & 0x3fff; error = (status >> 16) & 0xf; if (error == 0) { - MGETHDR(m2, M_NOWAIT, MT_DATA); + MGETHDR(m2, M_DONTWAIT, MT_DATA); if (m2 != NULL) { - MCLGET(m2, M_NOWAIT); + MCLGET(m2, M_DONTWAIT); if((m2->m_flags & M_EXT) != 0) { /* Substitute the mbuf+cluster. */ md->m = m2; @@ -1069,7 +1069,7 @@ musycc_newhook(node_p node, hook_p hook, const char *name) return (EINVAL); if (sc->chan[chan] == NULL) { - MALLOC(sch, struct schan *, sizeof(*sch), M_MUSYCC, M_ZERO); + MALLOC(sch, struct schan *, sizeof(*sch), M_MUSYCC, M_WAITOK | M_ZERO); sch->sc = sc; sch->state = DOWN; sch->chan = chan; @@ -1268,9 +1268,9 @@ musycc_connect(hook_p hook) sch->nmd = nmd = 200 + nts * 4; sch->rx_last_md = 0; MALLOC(sc->mdt[ch], struct mdesc *, - sizeof(struct mdesc) * nmd, M_MUSYCC, 0); + sizeof(struct mdesc) * nmd, M_MUSYCC, M_WAITOK); MALLOC(sc->mdr[ch], struct mdesc *, - sizeof(struct mdesc) * nmd, M_MUSYCC, 0); + sizeof(struct mdesc) * nmd, M_MUSYCC, M_WAITOK); for (i = 0; i < nmd; i++) { if (i == nmd - 1) { sc->mdt[ch][i].snext = &sc->mdt[ch][0]; @@ -1287,13 +1287,13 @@ musycc_connect(hook_p hook) sc->mdt[ch][i].m = NULL; sc->mdt[ch][i].data = 0; - MGETHDR(m, 0, MT_DATA); + MGETHDR(m, M_TRYWAIT, MT_DATA); if (m == NULL) goto errfree; - MCLGET(m, 0); + MCLGET(m, M_TRYWAIT); if ((m->m_flags & M_EXT) == 0) { /* We've waited mbuf_wait and still got nothing. - We're calling with 0 anyway - a little + We're calling with M_TRYWAIT anyway - a little defensive programming costs us very little - if anything at all in the case of error. */ m_free(m); @@ -1455,7 +1455,7 @@ musycc_attach(device_t self) f = pci_get_function(self); /* For function zero allocate a csoftc */ if (f == 0) { - MALLOC(csc, struct csoftc *, sizeof(*csc), M_MUSYCC, M_ZERO); + MALLOC(csc, struct csoftc *, sizeof(*csc), M_MUSYCC, M_WAITOK | M_ZERO); csc->bus = pci_get_bus(self); csc->slot = pci_get_slot(self); LIST_INSERT_HEAD(&sc_list, csc, list); @@ -1529,7 +1529,7 @@ musycc_attach(device_t self) sc->reg = (struct globalr *) (csc->virbase[0] + i * 0x800); MALLOC(sc->mycg, struct mycg *, - sizeof(struct mycg), M_MUSYCC, M_ZERO); + sizeof(struct mycg), M_MUSYCC, M_WAITOK | M_ZERO); sc->ram = &sc->mycg->cg; error = ng_make_node_common(&ngtypestruct, &sc->node); diff --git a/sys/dev/my/if_my.c b/sys/dev/my/if_my.c index 70ac9508a8e0..9f7a930186c7 100644 --- a/sys/dev/my/if_my.c +++ b/sys/dev/my/if_my.c @@ -1179,14 +1179,14 @@ my_newbuf(struct my_softc * sc, struct my_chain_onefrag * c) struct mbuf *m_new = NULL; MY_LOCK(sc); - MGETHDR(m_new, M_NOWAIT, MT_DATA); + MGETHDR(m_new, M_DONTWAIT, MT_DATA); if (m_new == NULL) { printf("my%d: no memory for rx list -- packet dropped!\n", sc->my_unit); MY_UNLOCK(sc); return (ENOBUFS); } - MCLGET(m_new, M_NOWAIT); + MCLGET(m_new, M_DONTWAIT); if (!(m_new->m_flags & M_EXT)) { printf("my%d: no memory for rx list -- packet dropped!\n", sc->my_unit); @@ -1451,14 +1451,14 @@ my_encap(struct my_softc * sc, struct my_chain * c, struct mbuf * m_head) * chain. */ m = m_head; - MGETHDR(m_new, M_NOWAIT, MT_DATA); + MGETHDR(m_new, M_DONTWAIT, MT_DATA); if (m_new == NULL) { printf("my%d: no memory for tx list", sc->my_unit); MY_UNLOCK(sc); return (1); } if (m_head->m_pkthdr.len > MHLEN) { - MCLGET(m_new, M_NOWAIT); + MCLGET(m_new, M_DONTWAIT); if (!(m_new->m_flags & M_EXT)) { m_freem(m_new); printf("my%d: no memory for tx list", sc->my_unit); diff --git a/sys/dev/nge/if_nge.c b/sys/dev/nge/if_nge.c index e591ea75a2fc..d498ebb07ba2 100644 --- a/sys/dev/nge/if_nge.c +++ b/sys/dev/nge/if_nge.c @@ -1162,7 +1162,7 @@ nge_newbuf(sc, c, m) caddr_t *buf = NULL; if (m == NULL) { - MGETHDR(m_new, M_NOWAIT, MT_DATA); + MGETHDR(m_new, M_DONTWAIT, MT_DATA); if (m_new == NULL) { printf("nge%d: no memory for rx list " "-- packet dropped!\n", sc->nge_unit); diff --git a/sys/dev/nmdm/nmdm.c b/sys/dev/nmdm/nmdm.c index 2c69998e527d..6037451eeb67 100644 --- a/sys/dev/nmdm/nmdm.c +++ b/sys/dev/nmdm/nmdm.c @@ -133,7 +133,7 @@ nmdminit(n) if (n & ~0xff) return; - pt = malloc(sizeof(*pt), M_NLMDM, 0); + pt = malloc(sizeof(*pt), M_NLMDM, M_WAITOK); bzero(pt, sizeof(*pt)); pt->part1.dev = dev1 = make_dev(&nmdm_cdevsw, n+n, 0, 0, 0666, "nmdm%dA", n); diff --git a/sys/dev/null/null.c b/sys/dev/null/null.c index 7a3ae8b108bf..908e533a9287 100644 --- a/sys/dev/null/null.c +++ b/sys/dev/null/null.c @@ -127,7 +127,7 @@ null_modevent(module_t mod, int type, void *data) case MOD_LOAD: if (bootverbose) printf("null: \n"); - zbuf = (void *)malloc(PAGE_SIZE, M_TEMP, M_ZERO); + zbuf = (void *)malloc(PAGE_SIZE, M_TEMP, M_WAITOK | M_ZERO); zero_dev = make_dev(&zero_cdevsw, ZERO_MINOR, UID_ROOT, GID_WHEEL, 0666, "zero"); null_dev = make_dev(&null_cdevsw, NULL_MINOR, UID_ROOT, diff --git a/sys/dev/ofw/openfirm.c b/sys/dev/ofw/openfirm.c index 9ea97d3ad970..7704109b44a3 100644 --- a/sys/dev/ofw/openfirm.c +++ b/sys/dev/ofw/openfirm.c @@ -292,7 +292,7 @@ OF_getprop(phandle_t package, char *propname, void *buf, int buflen) /* * Store the value of a property of a package into newly allocated memory (using - * the M_OFWPROP malloc pool and 0). elsz is the size of a single element, + * the M_OFWPROP malloc pool and M_WAITOK). elsz is the size of a single element, * the number of elements is return in number. */ int @@ -305,7 +305,7 @@ OF_getprop_alloc(phandle_t package, char *propname, int elsz, void **buf) len % elsz != 0) return (-1); - *buf = malloc(len, M_OFWPROP, 0); + *buf = malloc(len, M_OFWPROP, M_WAITOK); if (OF_getprop(package, propname, *buf, len) == -1) { free(*buf, M_OFWPROP); *buf = NULL; diff --git a/sys/dev/ofw/openfirmio.c b/sys/dev/ofw/openfirmio.c index 8bd5c0474a1d..6f4061961818 100644 --- a/sys/dev/ofw/openfirmio.c +++ b/sys/dev/ofw/openfirmio.c @@ -115,7 +115,7 @@ openfirm_getstr(int len, const char *user, char **cpp) if ((u_int)len > OFW_NAME_MAX) return (ENAMETOOLONG); - *cpp = cp = malloc(len + 1, M_TEMP, 0); + *cpp = cp = malloc(len + 1, M_TEMP, M_WAITOK); if (cp == NULL) return (ENOMEM); error = copyin(user, cp, len); @@ -183,7 +183,7 @@ openfirm_ioctl(dev_t dev, u_long cmd, caddr_t data, int flags, /* -1 means no entry; 0 means no value */ if (len <= 0) break; - value = malloc(len, M_TEMP, 0); + value = malloc(len, M_TEMP, M_WAITOK); if (value == NULL) { error = ENOMEM; break; diff --git a/sys/dev/pccard/pccard.c b/sys/dev/pccard/pccard.c index 2cf04a207142..6c8263283727 100644 --- a/sys/dev/pccard/pccard.c +++ b/sys/dev/pccard/pccard.c @@ -224,7 +224,7 @@ pccard_attach_card(device_t dev) * can be on at a time. */ ivar = malloc(sizeof(struct pccard_ivar), M_DEVBUF, - M_ZERO); + M_WAITOK | M_ZERO); child = device_add_child(dev, NULL, -1); device_set_ivars(child, ivar); ivar->fcn = pf; diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c index 130bf3c822b8..a450df845894 100644 --- a/sys/dev/pci/pci.c +++ b/sys/dev/pci/pci.c @@ -335,7 +335,7 @@ pci_read_device(device_t pcib, int b, int s, int f, size_t size) devlist_entry = NULL; if (PCIB_READ_CONFIG(pcib, b, s, f, PCIR_DEVVENDOR, 4) != -1) { - devlist_entry = malloc(size, M_DEVBUF, M_ZERO); + devlist_entry = malloc(size, M_DEVBUF, M_WAITOK | M_ZERO); if (devlist_entry == NULL) return (NULL); diff --git a/sys/dev/pci/pci_user.c b/sys/dev/pci/pci_user.c index d39b026e2ae1..83b63b3ed692 100644 --- a/sys/dev/pci/pci_user.c +++ b/sys/dev/pci/pci_user.c @@ -307,7 +307,7 @@ pci_ioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) * Allocate a buffer to hold the patterns. */ pattern_buf = malloc(cio->pat_buf_len, M_TEMP, - 0); + M_WAITOK); error = copyin(cio->patterns, pattern_buf, cio->pat_buf_len); if (error != 0) diff --git a/sys/dev/pdq/pdq_freebsd.h b/sys/dev/pdq/pdq_freebsd.h index 5db50c800097..bd949005072b 100644 --- a/sys/dev/pdq/pdq_freebsd.h +++ b/sys/dev/pdq/pdq_freebsd.h @@ -186,9 +186,9 @@ typedef struct _pdq_os_ctx_t { #define PDQ_OS_DATABUF_ALLOC(pdq, b) do { \ PDQ_OS_DATABUF_T *x_m0; \ - MGETHDR(x_m0, M_NOWAIT, MT_DATA); \ + MGETHDR(x_m0, M_DONTWAIT, MT_DATA); \ if (x_m0 != NULL) { \ - MCLGET(x_m0, M_NOWAIT); \ + MCLGET(x_m0, M_DONTWAIT); \ if ((x_m0->m_flags & M_EXT) == 0) { \ m_free(x_m0); \ (b) = NULL; \ diff --git a/sys/dev/pdq/pdq_ifsubr.c b/sys/dev/pdq/pdq_ifsubr.c index 5af78841d9a0..064bb688af04 100644 --- a/sys/dev/pdq/pdq_ifsubr.c +++ b/sys/dev/pdq/pdq_ifsubr.c @@ -703,12 +703,12 @@ pdq_os_databuf_alloc( struct mbuf *m; bus_dmamap_t map; - MGETHDR(m, M_NOWAIT, MT_DATA); + MGETHDR(m, M_DONTWAIT, MT_DATA); if (m == NULL) { printf("%s: can't alloc small buf\n", sc->sc_dev.dv_xname); return NULL; } - MCLGET(m, M_NOWAIT); + MCLGET(m, M_DONTWAIT); if ((m->m_flags & M_EXT) == 0) { printf("%s: can't alloc cluster\n", sc->sc_dev.dv_xname); m_free(m); diff --git a/sys/dev/pdq/pdqvar.h b/sys/dev/pdq/pdqvar.h index 825a2b9a177f..09358d86995c 100644 --- a/sys/dev/pdq/pdqvar.h +++ b/sys/dev/pdq/pdqvar.h @@ -401,9 +401,9 @@ typedef struct mbuf PDQ_OS_DATABUF_T; #ifndef PDQ_OS_DATABUF_ALLOC #define PDQ_OS_DATABUF_ALLOC(pdq, b) do { \ PDQ_OS_DATABUF_T *x_m0; \ - MGETHDR(x_m0, M_NOWAIT, MT_DATA); \ + MGETHDR(x_m0, M_DONTWAIT, MT_DATA); \ if (x_m0 != NULL) { \ - MCLGET(x_m0, M_NOWAIT); \ + MCLGET(x_m0, M_DONTWAIT); \ if ((x_m0->m_flags & M_EXT) == 0) { \ m_free(x_m0); \ (b) = NULL; \ diff --git a/sys/dev/ppbus/if_plip.c b/sys/dev/ppbus/if_plip.c index 24a18ecd0021..5ba4dc3a6099 100644 --- a/sys/dev/ppbus/if_plip.c +++ b/sys/dev/ppbus/if_plip.c @@ -343,7 +343,7 @@ lpioctl (struct ifnet *ifp, u_long cmd, caddr_t data) } sc->sc_ifbuf = malloc(sc->sc_if.if_mtu + MLPIPHDRLEN, - M_DEVBUF, 0); + M_DEVBUF, M_WAITOK); if (!sc->sc_ifbuf) { ppb_release_bus(ppbus, dev); return ENOBUFS; diff --git a/sys/dev/ppbus/lpt.c b/sys/dev/ppbus/lpt.c index abc9e95c5d76..9364c5033659 100644 --- a/sys/dev/ppbus/lpt.c +++ b/sys/dev/ppbus/lpt.c @@ -548,8 +548,8 @@ lptopen(dev_t dev, int flags, int fmt, struct thread *td) ppb_wctr(ppbus, sc->sc_control); sc->sc_state = OPEN; - sc->sc_inbuf = malloc(BUFSIZE, M_DEVBUF, 0); - sc->sc_statbuf = malloc(BUFSTATSIZE, M_DEVBUF, 0); + sc->sc_inbuf = malloc(BUFSIZE, M_DEVBUF, M_WAITOK); + sc->sc_statbuf = malloc(BUFSTATSIZE, M_DEVBUF, M_WAITOK); sc->sc_xfercnt = 0; splx(s); diff --git a/sys/dev/ppbus/vpo.c b/sys/dev/ppbus/vpo.c index 09208b6e9d56..ad83e2f83270 100644 --- a/sys/dev/ppbus/vpo.c +++ b/sys/dev/ppbus/vpo.c @@ -186,7 +186,7 @@ static void vpo_cam_rescan(struct vpo_data *vpo) { struct cam_path *path; - union ccb *ccb = malloc(sizeof(union ccb), M_TEMP, M_ZERO); + union ccb *ccb = malloc(sizeof(union ccb), M_TEMP, M_WAITOK | M_ZERO); if (xpt_create_path(&path, xpt_periph, cam_sim_path(vpo->sim), 0, 0) != CAM_REQ_CMP) { diff --git a/sys/dev/puc/puc.c b/sys/dev/puc/puc.c index 4cba354222dd..18d2fbabc0f5 100644 --- a/sys/dev/puc/puc.c +++ b/sys/dev/puc/puc.c @@ -248,7 +248,7 @@ puc_attach(device_t dev, const struct puc_device_description *desc) rle->res = sc->sc_bar_mappings[bidx].res; } else { rle->res = malloc(sizeof(struct resource), M_DEVBUF, - M_ZERO); + M_WAITOK | M_ZERO); if (rle->res == NULL) { free(pdev, M_DEVBUF); return (ENOMEM); diff --git a/sys/dev/raidframe/rf_freebsdkintf.c b/sys/dev/raidframe/rf_freebsdkintf.c index 144cda693ea7..e2b2508349d4 100644 --- a/sys/dev/raidframe/rf_freebsdkintf.c +++ b/sys/dev/raidframe/rf_freebsdkintf.c @@ -917,7 +917,7 @@ raidioctl(dev, cmd, data, flag, td) case RAIDFRAME_INIT_LABELS: MALLOC(ci_label, RF_ComponentLabel_t *, sizeof(RF_ComponentLabel_t), M_RAIDFRAME, - M_ZERO); + M_WAITOK | M_ZERO); clabel = (RF_ComponentLabel_t *) data; /* we only want the serial number from @@ -984,7 +984,7 @@ raidioctl(dev, cmd, data, flag, td) case RAIDFRAME_ADD_HOT_SPARE: MALLOC(hot_spare, RF_SingleComponent_t *, sizeof(RF_SingleComponent_t), M_RAIDFRAME, - M_ZERO); + M_WAITOK | M_ZERO); sparePtr = (RF_SingleComponent_t *) data; memcpy( hot_spare, sparePtr, sizeof(RF_SingleComponent_t)); retcode = rf_add_hot_spare(raidPtr, hot_spare); @@ -997,7 +997,7 @@ raidioctl(dev, cmd, data, flag, td) case RAIDFRAME_DELETE_COMPONENT: MALLOC(component, RF_SingleComponent_t *, sizeof(RF_SingleComponent_t), M_RAIDFRAME, - M_ZERO); + M_WAITOK | M_ZERO); componentPtr = (RF_SingleComponent_t *)data; memcpy( component, componentPtr, sizeof(RF_SingleComponent_t)); @@ -1008,7 +1008,7 @@ raidioctl(dev, cmd, data, flag, td) case RAIDFRAME_INCORPORATE_HOT_SPARE: MALLOC(component, RF_SingleComponent_t *, sizeof(RF_SingleComponent_t), M_RAIDFRAME, - M_ZERO); + M_WAITOK | M_ZERO); componentPtr = (RF_SingleComponent_t *)data; memcpy( component, componentPtr, sizeof(RF_SingleComponent_t)); @@ -1020,7 +1020,7 @@ raidioctl(dev, cmd, data, flag, td) MALLOC(component, RF_SingleComponent_t *, sizeof(RF_SingleComponent_t), M_RAIDFRAME, - M_ZERO); + M_WAITOK | M_ZERO); if (raidPtr->Layout.map->faultsTolerated == 0) { /* Can't do this on a RAID 0!! */ FREE(component, M_RAIDFRAME); @@ -2894,7 +2894,7 @@ rf_set_autoconfig(raidPtr, new_value) int row, column; MALLOC(clabel, RF_ComponentLabel_t *, sizeof(RF_ComponentLabel_t), - M_RAIDFRAME, M_ZERO); + M_RAIDFRAME, M_WAITOK | M_ZERO); raidPtr->autoconfigure = new_value; for(row=0; rownumRow; row++) { @@ -2924,7 +2924,7 @@ rf_set_rootpartition(raidPtr, new_value) int row, column; MALLOC(clabel, RF_ComponentLabel_t *, sizeof(RF_ComponentLabel_t), - M_RAIDFRAME, M_ZERO); + M_RAIDFRAME, M_WAITOK | M_ZERO); raidPtr->root_partition = new_value; for(row=0; rownumRow; row++) { diff --git a/sys/dev/raidframe/rf_shutdown.c b/sys/dev/raidframe/rf_shutdown.c index 9dc62558946e..7db93e9ce895 100644 --- a/sys/dev/raidframe/rf_shutdown.c +++ b/sys/dev/raidframe/rf_shutdown.c @@ -61,7 +61,7 @@ _rf_ShutdownCreate( * and shutdown after RAIDframe internal allocation system. */ /* ent = (RF_ShutdownList_t *) malloc(sizeof(RF_ShutdownList_t), - M_RAIDFRAME, 0); */ + M_RAIDFRAME, M_WAITOK); */ ent = (RF_ShutdownList_t *) malloc(sizeof(RF_ShutdownList_t), M_RAIDFRAME, M_NOWAIT); if (ent == NULL) diff --git a/sys/dev/random/randomdev.c b/sys/dev/random/randomdev.c index 6256ae217d31..d965cbc8d366 100644 --- a/sys/dev/random/randomdev.c +++ b/sys/dev/random/randomdev.c @@ -187,7 +187,7 @@ random_read(dev_t dev __unused, struct uio *uio, int flag) return error; } c = uio->uio_resid < PAGE_SIZE ? uio->uio_resid : PAGE_SIZE; - random_buf = (void *)malloc((u_long)c, M_TEMP, 0); + random_buf = (void *)malloc((u_long)c, M_TEMP, M_WAITOK); while (uio->uio_resid > 0 && error == 0) { ret = read_random_real(random_buf, c); error = uiomove(random_buf, ret, uio); @@ -205,7 +205,7 @@ random_write(dev_t dev __unused, struct uio *uio, int flag __unused) void *random_buf; error = 0; - random_buf = (void *)malloc(PAGE_SIZE, M_TEMP, 0); + random_buf = (void *)malloc(PAGE_SIZE, M_TEMP, M_WAITOK); while (uio->uio_resid > 0) { c = (int)(uio->uio_resid < PAGE_SIZE ? uio->uio_resid diff --git a/sys/dev/ray/if_ray.c b/sys/dev/ray/if_ray.c index 7cd9b8758694..1c92d50bd9ee 100644 --- a/sys/dev/ray/if_ray.c +++ b/sys/dev/ray/if_ray.c @@ -1782,14 +1782,14 @@ ray_rx(struct ray_softc *sc, size_t rcs) goto skip_read; } - MGETHDR(m0, M_NOWAIT, MT_DATA); + MGETHDR(m0, M_DONTWAIT, MT_DATA); if (m0 == NULL) { RAY_RECERR(sc, "MGETHDR failed"); ifp->if_ierrors++; goto skip_read; } if (pktlen > MHLEN) { - MCLGET(m0, M_NOWAIT); + MCLGET(m0, M_DONTWAIT); if (!(m0->m_flags & M_EXT)) { RAY_RECERR(sc, "MCLGET failed"); ifp->if_ierrors++; @@ -3155,7 +3155,7 @@ ray_com_malloc(ray_comqfn_t function, int flags, char *mesg) struct ray_comq_entry *com; MALLOC(com, struct ray_comq_entry *, - sizeof(struct ray_comq_entry), M_RAYCOM, 0); + sizeof(struct ray_comq_entry), M_RAYCOM, M_WAITOK); return (ray_com_init(com, function, flags, mesg)); } diff --git a/sys/dev/sbni/if_sbni.c b/sys/dev/sbni/if_sbni.c index d99882f10c4d..e5d54172a8eb 100644 --- a/sys/dev/sbni/if_sbni.c +++ b/sys/dev/sbni/if_sbni.c @@ -814,7 +814,7 @@ get_rx_buf(struct sbni_softc *sc) { struct mbuf *m; - MGETHDR(m, M_NOWAIT, MT_DATA); + MGETHDR(m, M_DONTWAIT, MT_DATA); if (m == NULL) { if_printf(&sc->arpcom.ac_if, "cannot allocate header mbuf\n"); return (0); @@ -828,7 +828,7 @@ get_rx_buf(struct sbni_softc *sc) */ if (ETHER_MAX_LEN + 2 > MHLEN) { /* Attach an mbuf cluster */ - MCLGET(m, M_NOWAIT); + MCLGET(m, M_DONTWAIT); if ((m->m_flags & M_EXT) == 0) { m_freem(m); return (0); diff --git a/sys/dev/sf/if_sf.c b/sys/dev/sf/if_sf.c index 7b63a0120518..a148ba575862 100644 --- a/sys/dev/sf/if_sf.c +++ b/sys/dev/sf/if_sf.c @@ -924,11 +924,11 @@ sf_newbuf(sc, c, m) struct mbuf *m_new = NULL; if (m == NULL) { - MGETHDR(m_new, M_NOWAIT, MT_DATA); + MGETHDR(m_new, M_DONTWAIT, MT_DATA); if (m_new == NULL) return(ENOBUFS); - MCLGET(m_new, M_NOWAIT); + MCLGET(m_new, M_DONTWAIT); if (!(m_new->m_flags & M_EXT)) { m_freem(m_new); return(ENOBUFS); @@ -1304,14 +1304,14 @@ sf_encap(sc, c, m_head) if (m != NULL) { struct mbuf *m_new = NULL; - MGETHDR(m_new, M_NOWAIT, MT_DATA); + MGETHDR(m_new, M_DONTWAIT, MT_DATA); if (m_new == NULL) { printf("sf%d: no memory for tx list\n", sc->sf_unit); return(1); } if (m_head->m_pkthdr.len > MHLEN) { - MCLGET(m_new, M_NOWAIT); + MCLGET(m_new, M_DONTWAIT); if (!(m_new->m_flags & M_EXT)) { m_freem(m_new); printf("sf%d: no memory for tx list\n", diff --git a/sys/dev/sk/if_sk.c b/sys/dev/sk/if_sk.c index 3aa40e797070..e58d1c4f2803 100644 --- a/sys/dev/sk/if_sk.c +++ b/sys/dev/sk/if_sk.c @@ -688,7 +688,7 @@ sk_newbuf(sc_if, c, m) if (m == NULL) { caddr_t *buf = NULL; - MGETHDR(m_new, M_NOWAIT, MT_DATA); + MGETHDR(m_new, M_DONTWAIT, MT_DATA); if (m_new == NULL) return(ENOBUFS); diff --git a/sys/dev/sn/if_sn.c b/sys/dev/sn/if_sn.c index 18ca1cc82fe2..46011cb18393 100644 --- a/sys/dev/sn/if_sn.c +++ b/sys/dev/sn/if_sn.c @@ -1057,7 +1057,7 @@ snread(register struct ifnet *ifp) /* * Allocate a header mbuf from the kernel. */ - MGETHDR(m, M_NOWAIT, MT_DATA); + MGETHDR(m, M_DONTWAIT, MT_DATA); if (m == NULL) goto out; @@ -1067,7 +1067,7 @@ snread(register struct ifnet *ifp) /* * Attach an mbuf cluster */ - MCLGET(m, M_NOWAIT); + MCLGET(m, M_DONTWAIT); /* * Insist on getting a cluster diff --git a/sys/dev/snc/dp83932.c b/sys/dev/snc/dp83932.c index bb92c96cc440..f0ebae15aeeb 100644 --- a/sys/dev/snc/dp83932.c +++ b/sys/dev/snc/dp83932.c @@ -1121,7 +1121,7 @@ sonic_get(sc, pkt, datalen) * Our sonic_read() and sonic_get() require it. */ - MGETHDR(m, M_NOWAIT, MT_DATA); + MGETHDR(m, M_DONTWAIT, MT_DATA); if (m == 0) return (0); m->m_pkthdr.rcvif = &sc->sc_if; @@ -1132,7 +1132,7 @@ sonic_get(sc, pkt, datalen) while (datalen > 0) { if (top) { - MGET(m, M_NOWAIT, MT_DATA); + MGET(m, M_DONTWAIT, MT_DATA); if (m == 0) { m_freem(top); return (0); @@ -1140,7 +1140,7 @@ sonic_get(sc, pkt, datalen) len = MLEN; } if (datalen >= MINCLSIZE) { - MCLGET(m, M_NOWAIT); + MCLGET(m, M_DONTWAIT); if ((m->m_flags & M_EXT) == 0) { if (top) m_freem(top); return (0); diff --git a/sys/dev/snp/snp.c b/sys/dev/snp/snp.c index 81583431a1c8..34e3e29d030d 100644 --- a/sys/dev/snp/snp.c +++ b/sys/dev/snp/snp.c @@ -150,7 +150,7 @@ snplwrite(tp, uio, flag) snp = tp->t_sc; while (uio->uio_resid > 0) { ilen = imin(512, uio->uio_resid); - ibuf = malloc(ilen, M_SNP, 0); + ibuf = malloc(ilen, M_SNP, M_WAITOK); error = uiomove(ibuf, ilen, uio); if (error != 0) break; @@ -391,7 +391,7 @@ snpopen(dev, flag, mode, td) make_dev(&snp_cdevsw, minor(dev), UID_ROOT, GID_WHEEL, 0600, "snp%d", dev2unit(dev)); dev->si_drv1 = snp = malloc(sizeof(*snp), M_SNP, - M_ZERO); + M_WAITOK | M_ZERO); snp->snp_unit = dev2unit(dev); } else return (EBUSY); @@ -402,7 +402,7 @@ snpopen(dev, flag, mode, td) */ snp->snp_flags = SNOOP_OPEN; - snp->snp_buf = malloc(SNOOP_MINLEN, M_SNP, 0); + snp->snp_buf = malloc(SNOOP_MINLEN, M_SNP, M_WAITOK); snp->snp_blen = SNOOP_MINLEN; snp->snp_base = 0; snp->snp_len = 0; @@ -480,7 +480,7 @@ snp_down(snp) if (snp->snp_blen != SNOOP_MINLEN) { free(snp->snp_buf, M_SNP); - snp->snp_buf = malloc(SNOOP_MINLEN, M_SNP, 0); + snp->snp_buf = malloc(SNOOP_MINLEN, M_SNP, M_WAITOK); snp->snp_blen = SNOOP_MINLEN; } snp->snp_flags |= SNOOP_DOWN; diff --git a/sys/dev/sound/midi/midi.c b/sys/dev/sound/midi/midi.c index 6e2de523830c..07d26608fcb7 100644 --- a/sys/dev/sound/midi/midi.c +++ b/sys/dev/sound/midi/midi.c @@ -282,7 +282,7 @@ create_mididev_info_unit(int type, mididev_info *mdinf, synthdev_info *syninf) } /* As malloc(9) might block, allocate mididev_info now. */ - mdnew = malloc(sizeof(mididev_info), M_DEVBUF, M_ZERO); + mdnew = malloc(sizeof(mididev_info), M_DEVBUF, M_WAITOK | M_ZERO); if (mdnew == NULL) return NULL; bcopy(mdinf, mdnew, sizeof(mididev_info)); @@ -607,7 +607,7 @@ midi_read(dev_t i_dev, struct uio * buf, int flag) len = buf->uio_resid; lenr = 0; - uiobuf = (u_char *)malloc(len, M_DEVBUF, M_ZERO); + uiobuf = (u_char *)malloc(len, M_DEVBUF, M_WAITOK | M_ZERO); if (uiobuf == NULL) return (ENOMEM); @@ -659,7 +659,7 @@ midi_write(dev_t i_dev, struct uio * buf, int flag) len = buf->uio_resid; lenw = 0; - uiobuf = (u_char *)malloc(len, M_DEVBUF, M_ZERO); + uiobuf = (u_char *)malloc(len, M_DEVBUF, M_WAITOK | M_ZERO); if (uiobuf == NULL) return (ENOMEM); diff --git a/sys/dev/sound/midi/midibuf.c b/sys/dev/sound/midi/midibuf.c index 41ea4dd2a385..8b4eda7dbc00 100644 --- a/sys/dev/sound/midi/midibuf.c +++ b/sys/dev/sound/midi/midibuf.c @@ -55,7 +55,7 @@ int midibuf_init(midi_dbuf *dbuf) { if (dbuf->buf == NULL) { - dbuf->buf = malloc(MIDI_BUFFSIZE, M_DEVBUF, M_ZERO); + dbuf->buf = malloc(MIDI_BUFFSIZE, M_DEVBUF, M_WAITOK | M_ZERO); cv_init(&dbuf->cv_in, "midi queue in"); cv_init(&dbuf->cv_out, "midi queue out"); } diff --git a/sys/dev/sound/midi/sequencer.c b/sys/dev/sound/midi/sequencer.c index 7d0b6e2aadca..5115cc9b6fc2 100644 --- a/sys/dev/sound/midi/sequencer.c +++ b/sys/dev/sound/midi/sequencer.c @@ -322,7 +322,7 @@ seq_initunit(int unit) dev_t seqdev, musicdev; /* Allocate the softc. */ - scp = malloc(sizeof(*scp), M_DEVBUF, M_ZERO); + scp = malloc(sizeof(*scp), M_DEVBUF, M_WAITOK | M_ZERO); if (scp == (sc_p)NULL) { printf("seq_initunit: unit %d, softc allocation failed.\n", unit); return (1); @@ -544,7 +544,7 @@ seq_read(dev_t i_dev, struct uio *buf, int flag) len = buf->uio_resid; lenr = 0; - uiobuf = (u_char *)malloc(len, M_DEVBUF, M_ZERO); + uiobuf = (u_char *)malloc(len, M_DEVBUF, M_WAITOK | M_ZERO); if (uiobuf == NULL) return (ENOMEM); @@ -2364,7 +2364,7 @@ create_seqdev_info_unit(int unit, seqdev_info *seq) seqdev_info *sd, *sdnew; /* As malloc(9) might block, allocate seqdev_info now. */ - sdnew = malloc(sizeof(seqdev_info), M_DEVBUF, M_ZERO); + sdnew = malloc(sizeof(seqdev_info), M_DEVBUF, M_WAITOK | M_ZERO); if (sdnew == NULL) return NULL; bcopy(seq, sdnew, sizeof(seqdev_info)); diff --git a/sys/dev/sound/midi/timer.c b/sys/dev/sound/midi/timer.c index b5c75cf4a64d..ba4bce0d5828 100644 --- a/sys/dev/sound/midi/timer.c +++ b/sys/dev/sound/midi/timer.c @@ -97,7 +97,7 @@ timerdev_install(void) tmd = NULL; scp = NULL; - scp = malloc(sizeof(*scp), M_DEVBUF, M_ZERO); + scp = malloc(sizeof(*scp), M_DEVBUF, M_WAITOK | M_ZERO); if (scp == NULL) { ret = ENOMEM; goto fail; @@ -146,7 +146,7 @@ create_timerdev_info_unit(timerdev_info *tmdinf) } /* As malloc(9) might block, allocate timerdev_info now. */ - tmdnew = malloc(sizeof(timerdev_info), M_DEVBUF, M_ZERO); + tmdnew = malloc(sizeof(timerdev_info), M_DEVBUF, M_WAITOK | M_ZERO); if (tmdnew == NULL) return NULL; bcopy(tmdinf, tmdnew, sizeof(timerdev_info)); diff --git a/sys/dev/sound/pci/ds1.c b/sys/dev/sound/pci/ds1.c index dfffd8d23b4d..896a8af0e7ac 100644 --- a/sys/dev/sound/pci/ds1.c +++ b/sys/dev/sound/pci/ds1.c @@ -934,7 +934,7 @@ ds_pci_attach(device_t dev) struct ac97_info *codec = NULL; char status[SND_STATUSLEN]; - if ((sc = malloc(sizeof(*sc), M_DEVBUF, M_ZERO)) == NULL) { + if ((sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK | M_ZERO)) == NULL) { device_printf(dev, "cannot allocate softc\n"); return ENXIO; } diff --git a/sys/dev/sound/pci/emu10k1.c b/sys/dev/sound/pci/emu10k1.c index 52e16bff27cb..e9c99cb41b13 100644 --- a/sys/dev/sound/pci/emu10k1.c +++ b/sys/dev/sound/pci/emu10k1.c @@ -1455,7 +1455,7 @@ emu_pci_attach(device_t dev) int i, gotmic; char status[SND_STATUSLEN]; - if ((sc = malloc(sizeof(*sc), M_DEVBUF, M_ZERO)) == NULL) { + if ((sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK | M_ZERO)) == NULL) { device_printf(dev, "cannot allocate softc\n"); return ENXIO; } diff --git a/sys/dev/sound/pcm/ac97.c b/sys/dev/sound/pcm/ac97.c index a4b49a37792b..472c2dab11e4 100644 --- a/sys/dev/sound/pcm/ac97.c +++ b/sys/dev/sound/pcm/ac97.c @@ -552,7 +552,7 @@ ac97_create(device_t dev, void *devinfo, kobj_class_t cls) snprintf(codec->name, AC97_NAMELEN, "%s:ac97", device_get_nameunit(dev)); codec->lock = snd_mtxcreate(codec->name, "ac97 codec"); - codec->methods = kobj_create(cls, M_AC97, 0); + codec->methods = kobj_create(cls, M_AC97, M_WAITOK); if (codec->methods == NULL) { snd_mtxlock(codec->lock); snd_mtxfree(codec->lock); diff --git a/sys/dev/sound/pcm/buffer.c b/sys/dev/sound/pcm/buffer.c index 645e3b359757..a096b4017150 100644 --- a/sys/dev/sound/pcm/buffer.c +++ b/sys/dev/sound/pcm/buffer.c @@ -35,7 +35,7 @@ sndbuf_create(device_t dev, char *drv, char *desc) { struct snd_dbuf *b; - b = malloc(sizeof(*b), M_DEVBUF, M_ZERO); + b = malloc(sizeof(*b), M_DEVBUF, M_WAITOK | M_ZERO); snprintf(b->name, SNDBUF_NAMELEN, "%s:%s", drv, desc); b->dev = dev; diff --git a/sys/dev/sound/pcm/fake.c b/sys/dev/sound/pcm/fake.c index f1bd33cc70f5..8c4ba7781400 100644 --- a/sys/dev/sound/pcm/fake.c +++ b/sys/dev/sound/pcm/fake.c @@ -117,8 +117,8 @@ fkchan_setup(device_t dev) struct snddev_info *d = device_get_softc(dev); struct pcm_channel *c; - c = malloc(sizeof(*c), M_DEVBUF, 0); - c->methods = kobj_create(&fkchan_class, M_DEVBUF, 0); + c = malloc(sizeof(*c), M_DEVBUF, M_WAITOK); + c->methods = kobj_create(&fkchan_class, M_DEVBUF, M_WAITOK); c->parentsnddev = d; snprintf(c->name, CHN_NAMELEN, "%s:fake", device_get_nameunit(dev)); diff --git a/sys/dev/sound/pcm/feeder.c b/sys/dev/sound/pcm/feeder.c index 915111a660b2..91bdb66311cc 100644 --- a/sys/dev/sound/pcm/feeder.c +++ b/sys/dev/sound/pcm/feeder.c @@ -59,7 +59,7 @@ feeder_register(void *p) KASSERT(fc->desc == NULL, ("first feeder not root: %s", fc->name)); SLIST_INIT(&feedertab); - fte = malloc(sizeof(*fte), M_FEEDER, M_ZERO); + fte = malloc(sizeof(*fte), M_FEEDER, M_WAITOK | M_ZERO); if (fte == NULL) { printf("can't allocate memory for root feeder: %s\n", fc->name); @@ -84,7 +84,7 @@ feeder_register(void *p) i = 0; while ((feedercnt < MAXFEEDERS) && (fc->desc[i].type > 0)) { /* printf("adding feeder %s, %x -> %x\n", fc->name, fc->desc[i].in, fc->desc[i].out); */ - fte = malloc(sizeof(*fte), M_FEEDER, M_ZERO); + fte = malloc(sizeof(*fte), M_FEEDER, M_WAITOK | M_ZERO); if (fte == NULL) { printf("can't allocate memory for feeder '%s', %x -> %x\n", fc->name, fc->desc[i].in, fc->desc[i].out); diff --git a/sys/dev/sound/pcm/mixer.c b/sys/dev/sound/pcm/mixer.c index 2c3c3f4d230b..182d2902385f 100644 --- a/sys/dev/sound/pcm/mixer.c +++ b/sys/dev/sound/pcm/mixer.c @@ -200,7 +200,7 @@ mixer_init(device_t dev, kobj_class_t cls, void *devinfo) dev_t pdev; int i, unit; - m = (struct snd_mixer *)kobj_create(cls, M_MIXER, M_ZERO); + m = (struct snd_mixer *)kobj_create(cls, M_MIXER, M_WAITOK | M_ZERO); snprintf(m->name, MIXER_NAMELEN, "%s:mixer", device_get_nameunit(dev)); m->lock = snd_mtxcreate(m->name, "pcm mixer"); m->type = cls->name; diff --git a/sys/dev/sound/pcm/sndstat.c b/sys/dev/sound/pcm/sndstat.c index 6d2a27a8a4cd..bdaff2bc9968 100644 --- a/sys/dev/sound/pcm/sndstat.c +++ b/sys/dev/sound/pcm/sndstat.c @@ -222,7 +222,7 @@ sndstat_register(device_t dev, char *str, sndstat_handler handler) unit = -1; } - ent = malloc(sizeof *ent, M_DEVBUF, M_ZERO | 0); + ent = malloc(sizeof *ent, M_DEVBUF, M_ZERO | M_WAITOK); if (!ent) return ENOSPC; diff --git a/sys/dev/sound/pcm/sound.c b/sys/dev/sound/pcm/sound.c index f6d852fc4255..c184a69e13e9 100644 --- a/sys/dev/sound/pcm/sound.c +++ b/sys/dev/sound/pcm/sound.c @@ -91,7 +91,7 @@ snd_mtxcreate(const char *desc, const char *type) #ifdef USING_MUTEX struct mtx *m; - m = malloc(sizeof(*m), M_DEVBUF, M_ZERO); + m = malloc(sizeof(*m), M_DEVBUF, M_WAITOK | M_ZERO); if (m == NULL) return NULL; mtx_init(m, desc, type, MTX_RECURSE); @@ -364,11 +364,11 @@ pcm_chn_create(struct snddev_info *d, struct pcm_channel *parent, kobj_class_t c return NULL; } - ch = malloc(sizeof(*ch), M_DEVBUF, M_ZERO); + ch = malloc(sizeof(*ch), M_DEVBUF, M_WAITOK | M_ZERO); if (!ch) return NULL; - ch->methods = kobj_create(cls, M_DEVBUF, 0); + ch->methods = kobj_create(cls, M_DEVBUF, M_WAITOK); if (!ch->methods) { free(ch, M_DEVBUF); @@ -426,7 +426,7 @@ pcm_chn_add(struct snddev_info *d, struct pcm_channel *ch, int mkdev) int unit = device_get_unit(d->dev); int x = -1; - sce = malloc(sizeof(*sce), M_DEVBUF, M_ZERO); + sce = malloc(sizeof(*sce), M_DEVBUF, M_WAITOK | M_ZERO); if (!sce) { return ENOMEM; } diff --git a/sys/dev/sound/pcm/vchan.c b/sys/dev/sound/pcm/vchan.c index f0b5c1e862a8..eca4ac44c5f9 100644 --- a/sys/dev/sound/pcm/vchan.c +++ b/sys/dev/sound/pcm/vchan.c @@ -122,7 +122,7 @@ vchan_init(kobj_t obj, void *devinfo, struct snd_dbuf *b, struct pcm_channel *c, struct pcm_channel *parent = devinfo; KASSERT(dir == PCMDIR_PLAY, ("vchan_init: bad direction")); - ch = malloc(sizeof(*ch), M_DEVBUF, M_ZERO); + ch = malloc(sizeof(*ch), M_DEVBUF, M_WAITOK | M_ZERO); ch->parent = parent; ch->channel = c; ch->fmt = AFMT_U8; @@ -235,7 +235,7 @@ vchan_create(struct pcm_channel *parent) struct pcm_channel *child; int err, first; - pce = malloc(sizeof(*pce), M_DEVBUF, M_ZERO); + pce = malloc(sizeof(*pce), M_DEVBUF, M_WAITOK | M_ZERO); if (!pce) { return ENOMEM; } diff --git a/sys/dev/speaker/spkr.c b/sys/dev/speaker/spkr.c index e6487c1acb1b..de4c5cab33eb 100644 --- a/sys/dev/speaker/spkr.c +++ b/sys/dev/speaker/spkr.c @@ -495,7 +495,7 @@ spkropen(dev, flags, fmt, td) (void) printf("spkropen: about to perform play initialization\n"); #endif /* DEBUG */ playinit(); - spkr_inbuf = malloc(DEV_BSIZE, M_SPKR, 0); + spkr_inbuf = malloc(DEV_BSIZE, M_SPKR, M_WAITOK); spkr_active = TRUE; return(0); } diff --git a/sys/dev/sr/if_sr.c b/sys/dev/sr/if_sr.c index dfde40e9693e..18b5511f6741 100644 --- a/sys/dev/sr/if_sr.c +++ b/sys/dev/sr/if_sr.c @@ -311,7 +311,7 @@ sr_attach(device_t device) hc = (struct sr_hardc *)device_get_softc(device); MALLOC(sc, struct sr_softc *, hc->numports * sizeof(struct sr_softc), - M_DEVBUF, M_ZERO); + M_DEVBUF, M_WAITOK | M_ZERO); if (sc == NULL) goto errexit; hc->sc = sc; @@ -2088,7 +2088,7 @@ sr_get_packets(struct sr_softc *sc) sc->unit, rxstat, len); #endif - MGETHDR(m, M_NOWAIT, MT_DATA); + MGETHDR(m, M_DONTWAIT, MT_DATA); if (m == NULL) { /* * eat (flush) packet if get mbuf fail!! @@ -2106,7 +2106,7 @@ sr_get_packets(struct sr_softc *sc) #endif /* NETGRAPH */ m->m_pkthdr.len = m->m_len = len; if (len > MHLEN) { - MCLGET(m, M_NOWAIT); + MCLGET(m, M_DONTWAIT); if ((m->m_flags & M_EXT) == 0) { /* * We couldn't get a big enough diff --git a/sys/dev/streams/streams.c b/sys/dev/streams/streams.c index 4ee45a2f3114..4347d99b402d 100644 --- a/sys/dev/streams/streams.c +++ b/sys/dev/streams/streams.c @@ -367,7 +367,7 @@ svr4_stream_get(fp) } /* Allocate a new one. */ - st = malloc(sizeof(struct svr4_strm), M_TEMP, 0); + st = malloc(sizeof(struct svr4_strm), M_TEMP, M_WAITOK); st->s_family = so->so_proto->pr_domain->dom_family; st->s_cmd = ~0; st->s_afd = -1; diff --git a/sys/dev/syscons/daemon/daemon_saver.c b/sys/dev/syscons/daemon/daemon_saver.c index aebeab2545ab..3cd58305cde5 100644 --- a/sys/dev/syscons/daemon/daemon_saver.c +++ b/sys/dev/syscons/daemon/daemon_saver.c @@ -383,7 +383,7 @@ daemon_init(video_adapter_t *adp) { messagelen = strlen(hostname) + 3 + strlen(ostype) + 1 + strlen(osrelease); - message = malloc(messagelen + 1, M_DEVBUF, 0); + message = malloc(messagelen + 1, M_DEVBUF, M_WAITOK); sprintf(message, "%s - %s %s", hostname, ostype, osrelease); blanked = 0; return 0; diff --git a/sys/dev/syscons/schistory.c b/sys/dev/syscons/schistory.c index 479add933025..30cbdfd0af41 100644 --- a/sys/dev/syscons/schistory.c +++ b/sys/dev/syscons/schistory.c @@ -124,7 +124,7 @@ sc_alloc_history_buffer(scr_stat *scp, int lines, int prev_ysize, int wait) /* allocate a new buffer */ history = (sc_vtb_t *)malloc(sizeof(*history), M_DEVBUF, - (wait) ? 0 : M_NOWAIT); + (wait) ? M_WAITOK : M_NOWAIT); if (history != NULL) { if (lines > min_lines) extra_history_size -= lines - min_lines; diff --git a/sys/dev/syscons/scmouse.c b/sys/dev/syscons/scmouse.c index 6db469aeef91..0c4ba2cdb457 100644 --- a/sys/dev/syscons/scmouse.c +++ b/sys/dev/syscons/scmouse.c @@ -106,7 +106,7 @@ sc_alloc_cut_buffer(scr_stat *scp, int wait) free(p, M_DEVBUF); cut_buffer_size = scp->xsize * scp->ysize + 1; p = (u_char *)malloc(cut_buffer_size, - M_DEVBUF, (wait) ? 0 : M_NOWAIT); + M_DEVBUF, (wait) ? M_WAITOK : M_NOWAIT); if (p != NULL) p[0] = '\0'; cut_buffer = p; diff --git a/sys/dev/syscons/scvtb.c b/sys/dev/syscons/scvtb.c index 8a0a24f6f4ac..6712e9b4c643 100644 --- a/sys/dev/syscons/scvtb.c +++ b/sys/dev/syscons/scvtb.c @@ -61,7 +61,7 @@ sc_vtb_init(sc_vtb_t *vtb, int type, int cols, int rows, void *buf, int wait) vtb->vtb_buffer = (vm_offset_t)malloc(cols*rows*sizeof(u_int16_t), M_DEVBUF, - (wait) ? 0 : M_NOWAIT); + (wait) ? M_WAITOK : M_NOWAIT); if (vtb->vtb_buffer != 0) { bzero((void *)sc_vtb_pointer(vtb, 0), cols*rows*sizeof(u_int16_t)); diff --git a/sys/dev/syscons/snake/snake_saver.c b/sys/dev/syscons/snake/snake_saver.c index 5741eea0e8b1..ea5651fee2f6 100644 --- a/sys/dev/syscons/snake/snake_saver.c +++ b/sys/dev/syscons/snake/snake_saver.c @@ -131,9 +131,9 @@ static int snake_init(video_adapter_t *adp) { messagelen = strlen(ostype) + 1 + strlen(osrelease); - message = malloc(messagelen + 1, M_DEVBUF, 0); + message = malloc(messagelen + 1, M_DEVBUF, M_WAITOK); sprintf(message, "%s %s", ostype, osrelease); - messagep = malloc(messagelen * sizeof *messagep, M_DEVBUF, 0); + messagep = malloc(messagelen * sizeof *messagep, M_DEVBUF, M_WAITOK); return 0; } diff --git a/sys/dev/syscons/syscons.c b/sys/dev/syscons/syscons.c index 38465abab7fe..6a885c459761 100644 --- a/sys/dev/syscons/syscons.c +++ b/sys/dev/syscons/syscons.c @@ -318,7 +318,7 @@ sc_attach_unit(int unit, int flags) /* assert(sc_console->ts != NULL); */ kernel_console_ts = sc_console->ts; sc_console->ts = malloc(sc_console->tsw->te_size, - M_DEVBUF, 0); + M_DEVBUF, M_WAITOK); bcopy(kernel_console_ts, sc_console->ts, sc_console->tsw->te_size); (*sc_console->tsw->te_default_attr)(sc_console, user_default.std_color, @@ -2674,9 +2674,9 @@ scinit(int unit, int flags) sc->font_16 = font_16; } else if (sc->font_8 == NULL) { /* assert(sc_malloc) */ - sc->font_8 = malloc(sizeof(font_8), M_DEVBUF, 0); - sc->font_14 = malloc(sizeof(font_14), M_DEVBUF, 0); - sc->font_16 = malloc(sizeof(font_16), M_DEVBUF, 0); + sc->font_8 = malloc(sizeof(font_8), M_DEVBUF, M_WAITOK); + sc->font_14 = malloc(sizeof(font_14), M_DEVBUF, M_WAITOK); + sc->font_16 = malloc(sizeof(font_16), M_DEVBUF, M_WAITOK); } #endif @@ -2703,7 +2703,7 @@ scinit(int unit, int flags) kernel_default.rev_color); } else { /* assert(sc_malloc) */ - sc->dev = malloc(sizeof(dev_t)*sc->vtys, M_DEVBUF, M_ZERO); + sc->dev = malloc(sizeof(dev_t)*sc->vtys, M_DEVBUF, M_WAITOK|M_ZERO); sc->dev[0] = makedev(CDEV_MAJOR, unit*MAXCONS); sc->dev[0]->si_tty = ttymalloc(sc->dev[0]->si_tty); scp = alloc_scp(sc, sc->first_vty); @@ -2928,7 +2928,7 @@ static scr_stat /* assert(sc_malloc) */ - scp = (scr_stat *)malloc(sizeof(scr_stat), M_DEVBUF, 0); + scp = (scr_stat *)malloc(sizeof(scr_stat), M_DEVBUF, M_WAITOK); init_scp(sc, vty, scp); sc_alloc_scr_buffer(scp, TRUE, TRUE); diff --git a/sys/dev/ti/if_ti.c b/sys/dev/ti/if_ti.c index 894ac43559a5..a3843223270e 100644 --- a/sys/dev/ti/if_ti.c +++ b/sys/dev/ti/if_ti.c @@ -1130,11 +1130,11 @@ ti_newbuf_std(sc, i, m) struct ti_rx_desc *r; if (m == NULL) { - MGETHDR(m_new, M_NOWAIT, MT_DATA); + MGETHDR(m_new, M_DONTWAIT, MT_DATA); if (m_new == NULL) return(ENOBUFS); - MCLGET(m_new, M_NOWAIT); + MCLGET(m_new, M_DONTWAIT); if (!(m_new->m_flags & M_EXT)) { m_freem(m_new); return(ENOBUFS); @@ -1174,7 +1174,7 @@ ti_newbuf_mini(sc, i, m) struct ti_rx_desc *r; if (m == NULL) { - MGETHDR(m_new, M_NOWAIT, MT_DATA); + MGETHDR(m_new, M_DONTWAIT, MT_DATA); if (m_new == NULL) { return(ENOBUFS); } @@ -1218,7 +1218,7 @@ ti_newbuf_jumbo(sc, i, m) caddr_t *buf = NULL; /* Allocate the mbuf. */ - MGETHDR(m_new, M_NOWAIT, MT_DATA); + MGETHDR(m_new, M_DONTWAIT, MT_DATA); if (m_new == NULL) { return(ENOBUFS); } @@ -1300,19 +1300,19 @@ ti_newbuf_jumbo(sc, idx, m_old) } } else { /* Allocate the mbufs. */ - MGETHDR(m_new, M_NOWAIT, MT_DATA); + MGETHDR(m_new, M_DONTWAIT, MT_DATA); if (m_new == NULL) { printf("ti%d: mbuf allocation failed " "-- packet dropped!\n", sc->ti_unit); goto nobufs; } - MGET(m[NPAYLOAD], M_NOWAIT, MT_DATA); + MGET(m[NPAYLOAD], M_DONTWAIT, MT_DATA); if (m[NPAYLOAD] == NULL) { printf("ti%d: cluster mbuf allocation failed " "-- packet dropped!\n", sc->ti_unit); goto nobufs; } - MCLGET(m[NPAYLOAD], M_NOWAIT); + MCLGET(m[NPAYLOAD], M_DONTWAIT); if ((m[NPAYLOAD]->m_flags & M_EXT) == 0) { printf("ti%d: mbuf allocation failed " "-- packet dropped!\n", sc->ti_unit); @@ -1321,7 +1321,7 @@ ti_newbuf_jumbo(sc, idx, m_old) m[NPAYLOAD]->m_len = MCLBYTES; for (i = 0; i < NPAYLOAD; i++){ - MGET(m[i], M_NOWAIT, MT_DATA); + MGET(m[i], M_DONTWAIT, MT_DATA); if (m[i] == NULL) { printf("ti%d: mbuf allocation failed " "-- packet dropped!\n", sc->ti_unit); diff --git a/sys/dev/trm/trm.c b/sys/dev/trm/trm.c index 839112353cea..e157cb1141ea 100644 --- a/sys/dev/trm/trm.c +++ b/sys/dev/trm/trm.c @@ -2887,7 +2887,7 @@ trm_initACB(PACB pACB, u_int16_t unit) for (j = 0; j < (pACB->max_lun +1); j++) { pACB->scan_devices[i][j] = 1; pACB->pDCB[i][j]= (PDCB) malloc ( - sizeof (struct _DCB), M_DEVBUF, 0); + sizeof (struct _DCB), M_DEVBUF, M_WAITOK); trm_initDCB(pACB, pACB->pDCB[i][j], unit, i, j); TRM_DPRINTF("pDCB= %8x \n", @@ -3292,7 +3292,7 @@ trm_attach(device_t pci_config_id) * of the multi-channel controller. * trm_action : sim_action_func * trm_poll : sim_poll_func - * "trm" : sim_name ,if sim_name = "xpt" ..M_DEVBUF,0 + * "trm" : sim_name ,if sim_name = "xpt" ..M_DEVBUF,M_WAITOK * pACB : *softc if sim_name <> "xpt" ..M_DEVBUF,M_NOWAIT * pACB->unit : unit * 1 : max_dev_transactions diff --git a/sys/dev/twe/twe.c b/sys/dev/twe/twe.c index 4284942db37c..43df8e98760b 100644 --- a/sys/dev/twe/twe.c +++ b/sys/dev/twe/twe.c @@ -476,7 +476,7 @@ twe_ioctl(struct twe_softc *sc, int cmd, void *addr) /* if there's a data buffer, allocate and copy it in */ tr->tr_length = tu->tu_size; if (tr->tr_length > 0) { - if ((tr->tr_data = malloc(tr->tr_length, M_DEVBUF, 0)) == NULL) { + if ((tr->tr_data = malloc(tr->tr_length, M_DEVBUF, M_WAITOK)) == NULL) { error = ENOMEM; goto cmd_done; } @@ -559,7 +559,7 @@ twe_ioctl(struct twe_softc *sc, int cmd, void *addr) break; case TWEIO_SET_PARAM: - if ((data = malloc(tp->tp_size, M_DEVBUF, 0)) == NULL) { + if ((data = malloc(tp->tp_size, M_DEVBUF, M_WAITOK)) == NULL) { error = ENOMEM; } else { error = copyin(tp->tp_data, data, tp->tp_size); diff --git a/sys/dev/tx/if_tx.c b/sys/dev/tx/if_tx.c index 5a6871934a78..189a69ef8906 100644 --- a/sys/dev/tx/if_tx.c +++ b/sys/dev/tx/if_tx.c @@ -577,7 +577,7 @@ epic_ifstart(ifp) /* If packet was more than EPIC_MAX_FRAGS parts, */ /* recopy packet to new allocated mbuf cluster */ if( NULL != m ){ - m = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR); + m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); if( NULL == m ){ m_freem(m0); ifp->if_oerrors++; @@ -652,7 +652,7 @@ epic_rx_done(sc) m = buf->mbuf; /* Try to get mbuf cluster */ - buf->mbuf = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR); + buf->mbuf = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); if( NULL == buf->mbuf ) { buf->mbuf = m; desc->status = 0x8000; @@ -1415,7 +1415,7 @@ epic_queue_last_packet(sc) if ((desc->status & 0x8000) || (buf->mbuf != NULL)) return (EBUSY); - MGETHDR(m0, M_NOWAIT, MT_DATA); + MGETHDR(m0, M_DONTWAIT, MT_DATA); if (NULL == m0) return (ENOBUFS); @@ -1556,7 +1556,7 @@ epic_init_rings(sc) return EFAULT; } - buf->mbuf = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR); + buf->mbuf = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); if( NULL == buf->mbuf ) { epic_free_rings(sc); return ENOBUFS; diff --git a/sys/dev/tx/if_txvar.h b/sys/dev/tx/if_txvar.h index 465727fc7075..16dc36d9f5b7 100644 --- a/sys/dev/tx/if_txvar.h +++ b/sys/dev/tx/if_txvar.h @@ -134,9 +134,9 @@ struct epic_type { /* Macro to get either mbuf cluster or nothing */ #define EPIC_MGETCLUSTER(m) \ - { MGETHDR((m),M_NOWAIT,MT_DATA); \ + { MGETHDR((m),M_DONTWAIT,MT_DATA); \ if (m) { \ - MCLGET((m),M_NOWAIT); \ + MCLGET((m),M_DONTWAIT); \ if( 0 == ((m)->m_flags & M_EXT) ) { \ m_freem(m); \ (m) = NULL; \ diff --git a/sys/dev/txp/if_txp.c b/sys/dev/txp/if_txp.c index 385c91d0a62d..7c4d74d25ec3 100644 --- a/sys/dev/txp/if_txp.c +++ b/sys/dev/txp/if_txp.c @@ -768,13 +768,13 @@ txp_rx_reclaim(sc, r) */ struct mbuf *mnew; - MGETHDR(mnew, M_NOWAIT, MT_DATA); + MGETHDR(mnew, M_DONTWAIT, MT_DATA); if (mnew == NULL) { m_freem(m); goto next; } if (m->m_len > (MHLEN - 2)) { - MCLGET(mnew, M_NOWAIT); + MCLGET(mnew, M_DONTWAIT); if (!(mnew->m_flags & M_EXT)) { m_freem(mnew); m_freem(m); @@ -847,11 +847,11 @@ txp_rxbuf_reclaim(sc) if (sd->sd_mbuf != NULL) break; - MGETHDR(sd->sd_mbuf, M_NOWAIT, MT_DATA); + MGETHDR(sd->sd_mbuf, M_DONTWAIT, MT_DATA); if (sd->sd_mbuf == NULL) goto err_sd; - MCLGET(sd->sd_mbuf, M_NOWAIT); + MCLGET(sd->sd_mbuf, M_DONTWAIT); if ((sd->sd_mbuf->m_flags & M_EXT) == 0) goto err_mbuf; sd->sd_mbuf->m_pkthdr.rcvif = ifp; @@ -1142,11 +1142,11 @@ txp_rxring_fill(sc) for (i = 0; i < RXBUF_ENTRIES; i++) { sd = sc->sc_rxbufs[i].rb_sd; - MGETHDR(sd->sd_mbuf, M_NOWAIT, MT_DATA); + MGETHDR(sd->sd_mbuf, M_DONTWAIT, MT_DATA); if (sd->sd_mbuf == NULL) return(ENOBUFS); - MCLGET(sd->sd_mbuf, M_NOWAIT); + MCLGET(sd->sd_mbuf, M_DONTWAIT); if ((sd->sd_mbuf->m_flags & M_EXT) == 0) { m_freem(sd->sd_mbuf); return(ENOBUFS); diff --git a/sys/dev/ubsec/ubsec.c b/sys/dev/ubsec/ubsec.c index de1566eb47c4..728ebb417ef0 100644 --- a/sys/dev/ubsec/ubsec.c +++ b/sys/dev/ubsec/ubsec.c @@ -1332,14 +1332,14 @@ ubsec_process(void *arg, struct cryptop *crp, int hint) totlen = q->q_src_mapsize; if (q->q_src_m->m_flags & M_PKTHDR) { len = MHLEN; - MGETHDR(m, M_NOWAIT, MT_DATA); - if (m && !m_dup_pkthdr(m, q->q_src_m, M_NOWAIT)) { + MGETHDR(m, M_DONTWAIT, MT_DATA); + if (m && !m_dup_pkthdr(m, q->q_src_m, M_DONTWAIT)) { m_free(m); m = NULL; } } else { len = MLEN; - MGET(m, M_NOWAIT, MT_DATA); + MGET(m, M_DONTWAIT, MT_DATA); } if (m == NULL) { ubsecstats.hst_nombuf++; @@ -1347,7 +1347,7 @@ ubsec_process(void *arg, struct cryptop *crp, int hint) goto errout; } if (totlen >= MINCLSIZE) { - MCLGET(m, M_NOWAIT); + MCLGET(m, M_DONTWAIT); if ((m->m_flags & M_EXT) == 0) { m_free(m); ubsecstats.hst_nomcl++; @@ -1362,7 +1362,7 @@ ubsec_process(void *arg, struct cryptop *crp, int hint) while (totlen > 0) { if (top) { - MGET(m, M_NOWAIT, MT_DATA); + MGET(m, M_DONTWAIT, MT_DATA); if (m == NULL) { m_freem(top); ubsecstats.hst_nombuf++; @@ -1372,7 +1372,7 @@ ubsec_process(void *arg, struct cryptop *crp, int hint) len = MLEN; } if (top && totlen >= MINCLSIZE) { - MCLGET(m, M_NOWAIT); + MCLGET(m, M_DONTWAIT); if ((m->m_flags & M_EXT) == 0) { *mp = m; m_freem(top); diff --git a/sys/dev/usb/hid.c b/sys/dev/usb/hid.c index d5484a8ecd63..b37a5d06d517 100644 --- a/sys/dev/usb/hid.c +++ b/sys/dev/usb/hid.c @@ -96,7 +96,7 @@ hid_start_parse(void *d, int len, int kindset) { struct hid_data *s; - s = malloc(sizeof *s, M_TEMP, M_ZERO); + s = malloc(sizeof *s, M_TEMP, M_WAITOK|M_ZERO); s->start = s->p = d; s->end = (char *)d + len; s->kindset = kindset; @@ -288,7 +288,7 @@ hid_get_item(struct hid_data *s, struct hid_item *h) c->loc.count = dval; break; case 10: /* Push */ - hi = malloc(sizeof *hi, M_TEMP, 0); + hi = malloc(sizeof *hi, M_TEMP, M_WAITOK); *hi = s->cur; c->next = hi; break; diff --git a/sys/dev/usb/if_aue.c b/sys/dev/usb/if_aue.c index 94903c40eecf..fa80dd6ec08b 100644 --- a/sys/dev/usb/if_aue.c +++ b/sys/dev/usb/if_aue.c @@ -812,14 +812,14 @@ aue_newbuf(struct aue_softc *sc, struct aue_chain *c, struct mbuf *m) struct mbuf *m_new = NULL; if (m == NULL) { - MGETHDR(m_new, M_NOWAIT, MT_DATA); + MGETHDR(m_new, M_DONTWAIT, MT_DATA); if (m_new == NULL) { printf("aue%d: no memory for rx list " "-- packet dropped!\n", sc->aue_unit); return (ENOBUFS); } - MCLGET(m_new, M_NOWAIT); + MCLGET(m_new, M_DONTWAIT); if (!(m_new->m_flags & M_EXT)) { printf("aue%d: no memory for rx list " "-- packet dropped!\n", sc->aue_unit); diff --git a/sys/dev/usb/if_cue.c b/sys/dev/usb/if_cue.c index a669e97ccd53..8748a83558c6 100644 --- a/sys/dev/usb/if_cue.c +++ b/sys/dev/usb/if_cue.c @@ -568,14 +568,14 @@ cue_newbuf(struct cue_softc *sc, struct cue_chain *c, struct mbuf *m) struct mbuf *m_new = NULL; if (m == NULL) { - MGETHDR(m_new, M_NOWAIT, MT_DATA); + MGETHDR(m_new, M_DONTWAIT, MT_DATA); if (m_new == NULL) { printf("cue%d: no memory for rx list " "-- packet dropped!\n", sc->cue_unit); return(ENOBUFS); } - MCLGET(m_new, M_NOWAIT); + MCLGET(m_new, M_DONTWAIT); if (!(m_new->m_flags & M_EXT)) { printf("cue%d: no memory for rx list " "-- packet dropped!\n", sc->cue_unit); diff --git a/sys/dev/usb/if_kue.c b/sys/dev/usb/if_kue.c index 3f51b5ae1f22..767d6fab845f 100644 --- a/sys/dev/usb/if_kue.c +++ b/sys/dev/usb/if_kue.c @@ -542,14 +542,14 @@ kue_newbuf(struct kue_softc *sc, struct kue_chain *c, struct mbuf *m) struct mbuf *m_new = NULL; if (m == NULL) { - MGETHDR(m_new, M_NOWAIT, MT_DATA); + MGETHDR(m_new, M_DONTWAIT, MT_DATA); if (m_new == NULL) { printf("kue%d: no memory for rx list " "-- packet dropped!\n", sc->kue_unit); return(ENOBUFS); } - MCLGET(m_new, M_NOWAIT); + MCLGET(m_new, M_DONTWAIT); if (!(m_new->m_flags & M_EXT)) { printf("kue%d: no memory for rx list " "-- packet dropped!\n", sc->kue_unit); diff --git a/sys/dev/usb/ubsa.c b/sys/dev/usb/ubsa.c index 81915d3b30ba..60ebd4ca95ba 100644 --- a/sys/dev/usb/ubsa.c +++ b/sys/dev/usb/ubsa.c @@ -278,7 +278,7 @@ USB_ATTACH(ubsa) int i; dev = uaa->device; - devinfo = malloc(1024, M_USBDEV, 0); + devinfo = malloc(1024, M_USBDEV, M_WAITOK); ucom = &sc->sc_ucom; bzero(sc, sizeof (struct ubsa_softc)); @@ -643,7 +643,7 @@ ubsa_open(void *addr, int portno) DPRINTF(("ubsa_open: sc = %p\n", sc)); if (sc->sc_intr_number != -1 && sc->sc_intr_pipe == NULL) { - sc->sc_intr_buf = malloc(sc->sc_isize, M_USBDEV, 0); + sc->sc_intr_buf = malloc(sc->sc_isize, M_USBDEV, M_WAITOK); err = usbd_open_pipe_intr(sc->sc_intr_iface, sc->sc_intr_number, USBD_SHORT_XFER_OK, diff --git a/sys/dev/usb/udbp.c b/sys/dev/usb/udbp.c index 77f4b1d076b0..a0519da07d0a 100644 --- a/sys/dev/usb/udbp.c +++ b/sys/dev/usb/udbp.c @@ -326,11 +326,11 @@ USB_ATTACH(udbp) if (!sc->sc_bulkout_xfer) { goto bad; } - sc->sc_bulkin_buffer = malloc(UDBP_BUFFERSIZE, M_USBDEV, 0); + sc->sc_bulkin_buffer = malloc(UDBP_BUFFERSIZE, M_USBDEV, M_WAITOK); if (!sc->sc_bulkin_buffer) { goto bad; } - sc->sc_bulkout_buffer = malloc(UDBP_BUFFERSIZE, M_USBDEV, 0); + sc->sc_bulkout_buffer = malloc(UDBP_BUFFERSIZE, M_USBDEV, M_WAITOK); if (!sc->sc_bulkout_xfer || !sc->sc_bulkout_buffer) { goto bad; } diff --git a/sys/dev/usb/uftdi.c b/sys/dev/usb/uftdi.c index fb2445989092..d400ff8122de 100644 --- a/sys/dev/usb/uftdi.c +++ b/sys/dev/usb/uftdi.c @@ -171,7 +171,7 @@ USB_ATTACH(uftdi) usbd_status err; struct ucom_softc *ucom = &sc->sc_ucom; DPRINTFN(10,("\nuftdi_attach: sc=%p\n", sc)); - devinfo = malloc(1024, M_USBDEV, 0); + devinfo = malloc(1024, M_USBDEV, M_WAITOK); ucom->sc_dev = self; ucom->sc_udev = dev; diff --git a/sys/dev/usb/ugen.c b/sys/dev/usb/ugen.c index 06bbaddd9807..fb2b46af8221 100644 --- a/sys/dev/usb/ugen.c +++ b/sys/dev/usb/ugen.c @@ -422,7 +422,7 @@ ugenopen(dev_t dev, int flag, int mode, usb_proc_ptr p) isize = UGETW(edesc->wMaxPacketSize); if (isize == 0) /* shouldn't happen */ return (EINVAL); - sce->ibuf = malloc(isize, M_USBDEV, 0); + sce->ibuf = malloc(isize, M_USBDEV, M_WAITOK); DPRINTFN(5, ("ugenopen: intr endpt=%d,isize=%d\n", endpt, isize)); if (clalloc(&sce->q, UGEN_IBSIZE, 0) == -1) @@ -452,7 +452,7 @@ ugenopen(dev_t dev, int flag, int mode, usb_proc_ptr p) if (isize == 0) /* shouldn't happen */ return (EINVAL); sce->ibuf = malloc(isize * UGEN_NISOFRAMES, - M_USBDEV, 0); + M_USBDEV, M_WAITOK); sce->cur = sce->fill = sce->ibuf; sce->limit = sce->ibuf + isize * UGEN_NISOFRAMES; DPRINTFN(5, ("ugenopen: isoc endpt=%d, isize=%d\n", @@ -1042,7 +1042,7 @@ ugen_get_cdesc(struct ugen_softc *sc, int index, int *lenp) len = UGETW(tdesc->wTotalLength); if (lenp) *lenp = len; - cdesc = malloc(len, M_TEMP, 0); + cdesc = malloc(len, M_TEMP, M_WAITOK); memcpy(cdesc, tdesc, len); DPRINTFN(5,("ugen_get_cdesc: current, len=%d\n", len)); } else { @@ -1053,7 +1053,7 @@ ugen_get_cdesc(struct ugen_softc *sc, int index, int *lenp) DPRINTFN(5,("ugen_get_cdesc: index=%d, len=%d\n", index, len)); if (lenp) *lenp = len; - cdesc = malloc(len, M_TEMP, 0); + cdesc = malloc(len, M_TEMP, M_WAITOK); err = usbd_get_config_desc_full(sc->sc_udev, index, cdesc, len); if (err) { free(cdesc, M_TEMP); @@ -1307,7 +1307,7 @@ ugen_do_ioctl(struct ugen_softc *sc, int endpt, u_long cmd, ur->ucr_request.bmRequestType & UT_READ ? UIO_READ : UIO_WRITE; uio.uio_procp = p; - ptr = malloc(len, M_TEMP, 0); + ptr = malloc(len, M_TEMP, M_WAITOK); if (uio.uio_rw == UIO_WRITE) { error = uiomove(ptr, len, &uio); if (error) diff --git a/sys/dev/usb/uhci.c b/sys/dev/usb/uhci.c index 228b352f2ef0..68a80700e7ed 100644 --- a/sys/dev/usb/uhci.c +++ b/sys/dev/usb/uhci.c @@ -2529,7 +2529,7 @@ uhci_setup_isoc(usbd_pipe_handle pipe) iso = &upipe->u.iso; iso->stds = malloc(UHCI_VFRAMELIST_COUNT * sizeof (uhci_soft_td_t *), - M_USBHC, 0); + M_USBHC, M_WAITOK); token = rd ? UHCI_TD_IN (0, endpt, addr, 0) : UHCI_TD_OUT(0, endpt, addr, 0); @@ -2775,7 +2775,7 @@ uhci_device_setintr(uhci_softc_t *sc, struct uhci_pipe *upipe, int ival) upipe->u.intr.npoll = npoll; upipe->u.intr.qhs = - malloc(npoll * sizeof(uhci_soft_qh_t *), M_USBHC, 0); + malloc(npoll * sizeof(uhci_soft_qh_t *), M_USBHC, M_WAITOK); /* * Figure out which offset in the schedule that has most diff --git a/sys/dev/usb/uhid.c b/sys/dev/usb/uhid.c index ad8862ea8cc2..2570aa19a8d4 100644 --- a/sys/dev/usb/uhid.c +++ b/sys/dev/usb/uhid.c @@ -418,8 +418,8 @@ uhidopen(dev_t dev, int flag, int mode, usb_proc_ptr p) return (ENOMEM); } - sc->sc_ibuf = malloc(sc->sc_isize, M_USBDEV, 0); - sc->sc_obuf = malloc(sc->sc_osize, M_USBDEV, 0); + sc->sc_ibuf = malloc(sc->sc_isize, M_USBDEV, M_WAITOK); + sc->sc_obuf = malloc(sc->sc_osize, M_USBDEV, M_WAITOK); /* Set up interrupt pipe. */ err = usbd_open_pipe_intr(sc->sc_iface, sc->sc_ep_addr, diff --git a/sys/dev/usb/umass.c b/sys/dev/usb/umass.c index f1a2e3c1694f..df04e4e8b2da 100644 --- a/sys/dev/usb/umass.c +++ b/sys/dev/usb/umass.c @@ -2128,7 +2128,7 @@ umass_cam_rescan(void *addr) struct umass_softc *sc = (struct umass_softc *) addr; #endif struct cam_path *path; - union ccb *ccb = malloc(sizeof(union ccb), M_USBDEV, 0); + union ccb *ccb = malloc(sizeof(union ccb), M_USBDEV, M_WAITOK); memset(ccb, 0, sizeof(union ccb)); diff --git a/sys/dev/usb/umodem.c b/sys/dev/usb/umodem.c index d6bbfc58224b..30e337d83696 100644 --- a/sys/dev/usb/umodem.c +++ b/sys/dev/usb/umodem.c @@ -247,7 +247,7 @@ USB_ATTACH(umodem) int i; struct ucom_softc *ucom; - devinfo = malloc(1024, M_USBDEV, 0); + devinfo = malloc(1024, M_USBDEV, M_WAITOK); usbd_devinfo(dev, 0, devinfo); ucom = &sc->sc_ucom; ucom->sc_dev = self; diff --git a/sys/dev/usb/uplcom.c b/sys/dev/usb/uplcom.c index e576f9cbc243..cc017c807658 100644 --- a/sys/dev/usb/uplcom.c +++ b/sys/dev/usb/uplcom.c @@ -260,7 +260,7 @@ USB_ATTACH(uplcom) usbd_status err; int i; - devinfo = malloc(1024, M_USBDEV, 0); + devinfo = malloc(1024, M_USBDEV, M_WAITOK); ucom = &sc->sc_ucom; bzero(sc, sizeof (struct uplcom_softc)); @@ -685,7 +685,7 @@ uplcom_open(void *addr, int portno) if (sc->sc_intr_number != -1 && sc->sc_intr_pipe == NULL) { sc->sc_status = 0; /* clear status bit */ - sc->sc_intr_buf = malloc(sc->sc_isize, M_USBDEV, 0); + sc->sc_intr_buf = malloc(sc->sc_isize, M_USBDEV, M_WAITOK); err = usbd_open_pipe_intr(sc->sc_intr_iface, sc->sc_intr_number, USBD_SHORT_XFER_OK, diff --git a/sys/dev/usb/urio.c b/sys/dev/usb/urio.c index d0eb1fab5550..ba9ca84b96d2 100644 --- a/sys/dev/usb/urio.c +++ b/sys/dev/usb/urio.c @@ -552,7 +552,7 @@ urioioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, usb_proc_ptr p) req.bmRequestType & UT_READ ? UIO_READ : UIO_WRITE; uio.uio_procp = p; - ptr = malloc(len, M_TEMP, 0); + ptr = malloc(len, M_TEMP, M_WAITOK); if (uio.uio_rw == UIO_WRITE) { error = uiomove(ptr, len, &uio); if (error) diff --git a/sys/dev/usb/usb.c b/sys/dev/usb/usb.c index 4e9483cb2400..21127d698383 100644 --- a/sys/dev/usb/usb.c +++ b/sys/dev/usb/usb.c @@ -596,7 +596,7 @@ usbioctl(dev_t devt, u_long cmd, caddr_t data, int flag, usb_proc_ptr p) ur->ucr_request.bmRequestType & UT_READ ? UIO_READ : UIO_WRITE; uio.uio_procp = p; - ptr = malloc(len, M_TEMP, 0); + ptr = malloc(len, M_TEMP, M_WAITOK); if (uio.uio_rw == UIO_WRITE) { error = uiomove(ptr, len, &uio); if (error) @@ -774,7 +774,7 @@ usb_add_event(int type, struct usb_event *uep) struct timeval thetime; int s; - ueq = malloc(sizeof *ueq, M_USBDEV, 0); + ueq = malloc(sizeof *ueq, M_USBDEV, M_WAITOK); ueq->ue = *uep; ueq->ue.ue_type = type; microtime(&thetime); diff --git a/sys/dev/usb/uscanner.c b/sys/dev/usb/uscanner.c index 4a793c6333e8..80f79abeb3f7 100644 --- a/sys/dev/usb/uscanner.c +++ b/sys/dev/usb/uscanner.c @@ -384,8 +384,8 @@ uscanneropen(dev_t dev, int flag, int mode, usb_proc_ptr p) sc->sc_state |= USCANNER_OPEN; - sc->sc_bulkin_buffer = malloc(USCANNER_BUFFERSIZE, M_USBDEV, 0); - sc->sc_bulkout_buffer = malloc(USCANNER_BUFFERSIZE, M_USBDEV, 0); + sc->sc_bulkin_buffer = malloc(USCANNER_BUFFERSIZE, M_USBDEV, M_WAITOK); + sc->sc_bulkout_buffer = malloc(USCANNER_BUFFERSIZE, M_USBDEV, M_WAITOK); /* No need to check buffers for NULL since we have WAITOK */ sc->sc_bulkin_bufferlen = USCANNER_BUFFERSIZE; diff --git a/sys/dev/usb/uvisor.c b/sys/dev/usb/uvisor.c index 1ea97d9a9953..0cffd8684d5d 100644 --- a/sys/dev/usb/uvisor.c +++ b/sys/dev/usb/uvisor.c @@ -233,7 +233,7 @@ USB_ATTACH(uvisor) usbd_status err; struct ucom_softc *ucom; - devinfo = malloc(1024, M_USBDEV, 0); + devinfo = malloc(1024, M_USBDEV, M_WAITOK); ucom = &sc->sc_ucom; bzero(sc, sizeof (struct uvisor_softc)); diff --git a/sys/dev/usb/uvscom.c b/sys/dev/usb/uvscom.c index bc9a856e829e..aac4743d47bc 100644 --- a/sys/dev/usb/uvscom.c +++ b/sys/dev/usb/uvscom.c @@ -265,7 +265,7 @@ USB_ATTACH(uvscom) usbd_status err; int i; - devinfo = malloc(1024, M_USBDEV, 0); + devinfo = malloc(1024, M_USBDEV, M_WAITOK); ucom = &sc->sc_ucom; bzero(sc, sizeof (struct uvscom_softc)); @@ -728,7 +728,7 @@ uvscom_open(void *addr, int portno) return (ENXIO); } - sc->sc_intr_buf = malloc(sc->sc_isize, M_USBDEV, 0); + sc->sc_intr_buf = malloc(sc->sc_isize, M_USBDEV, M_WAITOK); err = usbd_open_pipe_intr(sc->sc_ucom.sc_iface, sc->sc_intr_number, USBD_SHORT_XFER_OK, diff --git a/sys/dev/vinum/vinumext.h b/sys/dev/vinum/vinumext.h index a8af0cddf460..3c6bbad1e16c 100644 --- a/sys/dev/vinum/vinumext.h +++ b/sys/dev/vinum/vinumext.h @@ -245,7 +245,7 @@ void FFree(void *mem, char *, int); #define LOCKDRIVE(d) lockdrive (d, __FILE__, __LINE__) #else #define Malloc(x) malloc((x), M_DEVBUF, \ - curthread->td_proc->p_intr_nesting_level == 0? 0: M_NOWAIT) + curthread->td_proc->p_intr_nesting_level == 0? M_WAITOK: M_NOWAIT) #define Free(x) free((x), M_DEVBUF) #define LOCKDRIVE(d) lockdrive (d) #endif diff --git a/sys/dev/vinum/vinummemory.c b/sys/dev/vinum/vinummemory.c index cedcbfb51459..6936e481e0f1 100644 --- a/sys/dev/vinum/vinummemory.c +++ b/sys/dev/vinum/vinummemory.c @@ -152,7 +152,7 @@ MMalloc(int size, char *file, int line) /* Wait for malloc if we can */ result = malloc(size, M_DEVBUF, - curthread->td_intr_nesting_level == 0 ? 0 : M_NOWAIT); + curthread->td_intr_nesting_level == 0 ? M_WAITOK : M_NOWAIT); if (result == NULL) log(LOG_ERR, "vinum: can't allocate %d bytes from %s:%d\n", size, file, line); else { diff --git a/sys/dev/vr/if_vr.c b/sys/dev/vr/if_vr.c index b6d472d622da..95e4670835a1 100644 --- a/sys/dev/vr/if_vr.c +++ b/sys/dev/vr/if_vr.c @@ -1041,11 +1041,11 @@ vr_newbuf(sc, c, m) struct mbuf *m_new = NULL; if (m == NULL) { - MGETHDR(m_new, M_NOWAIT, MT_DATA); + MGETHDR(m_new, M_DONTWAIT, MT_DATA); if (m_new == NULL) return(ENOBUFS); - MCLGET(m_new, M_NOWAIT); + MCLGET(m_new, M_DONTWAIT); if (!(m_new->m_flags & M_EXT)) { m_freem(m_new); return(ENOBUFS); @@ -1423,13 +1423,13 @@ vr_encap(sc, c, m_head) if (m != NULL) { struct mbuf *m_new = NULL; - MGETHDR(m_new, M_NOWAIT, MT_DATA); + MGETHDR(m_new, M_DONTWAIT, MT_DATA); if (m_new == NULL) { printf("vr%d: no memory for tx list\n", sc->vr_unit); return(1); } if (m_head->m_pkthdr.len > MHLEN) { - MCLGET(m_new, M_NOWAIT); + MCLGET(m_new, M_DONTWAIT); if (!(m_new->m_flags & M_EXT)) { m_freem(m_new); printf("vr%d: no memory for tx list\n", diff --git a/sys/dev/vx/if_vx.c b/sys/dev/vx/if_vx.c index d86fab8f8c82..143a821e57dd 100644 --- a/sys/dev/vx/if_vx.c +++ b/sys/dev/vx/if_vx.c @@ -761,7 +761,7 @@ vxget(sc, totlen) m = sc->mb[sc->next_mb]; sc->mb[sc->next_mb] = 0; if (m == 0) { - MGETHDR(m, M_NOWAIT, MT_DATA); + MGETHDR(m, M_DONTWAIT, MT_DATA); if (m == 0) return 0; } else { @@ -800,7 +800,7 @@ vxget(sc, totlen) m = sc->mb[sc->next_mb]; sc->mb[sc->next_mb] = 0; if (m == 0) { - MGET(m, M_NOWAIT, MT_DATA); + MGET(m, M_DONTWAIT, MT_DATA); if (m == 0) { splx(sh); m_freem(top); @@ -812,7 +812,7 @@ vxget(sc, totlen) len = MLEN; } if (totlen >= MINCLSIZE) { - MCLGET(m, M_NOWAIT); + MCLGET(m, M_DONTWAIT); if (m->m_flags & M_EXT) len = MCLBYTES; } @@ -993,7 +993,7 @@ vxmbuffill(sp) i = sc->last_mb; do { if (sc->mb[i] == NULL) - MGET(sc->mb[i], M_NOWAIT, MT_DATA); + MGET(sc->mb[i], M_DONTWAIT, MT_DATA); if (sc->mb[i] == NULL) break; i = (i + 1) % MAX_MBS; diff --git a/sys/dev/wi/if_wi.c b/sys/dev/wi/if_wi.c index 1b4ce1af9c55..a5c6ff65eec5 100644 --- a/sys/dev/wi/if_wi.c +++ b/sys/dev/wi/if_wi.c @@ -916,9 +916,9 @@ wi_start(struct ifnet *ifp) if (sc->sc_drvbpf) { struct mbuf *mb; - MGETHDR(mb, M_NOWAIT, m0->m_type); + MGETHDR(mb, M_DONTWAIT, m0->m_type); if (mb != NULL) { - (void) m_dup_pkthdr(mb, m0, M_NOWAIT); + (void) m_dup_pkthdr(mb, m0, M_DONTWAIT); mb->m_next = m0; mb->m_data = (caddr_t)&frmhdr; mb->m_len = sizeof(frmhdr); @@ -1345,7 +1345,7 @@ wi_rx_intr(struct wi_softc *sc) len = le16toh(frmhdr.wi_dat_len); off = ALIGN(sizeof(struct ieee80211_frame)); - MGETHDR(m, M_NOWAIT, MT_DATA); + MGETHDR(m, M_DONTWAIT, MT_DATA); if (m == NULL) { CSR_WRITE_2(sc, WI_EVENT_ACK, WI_EV_RX); ifp->if_ierrors++; @@ -1353,7 +1353,7 @@ wi_rx_intr(struct wi_softc *sc) return; } if (off + len > MHLEN) { - MCLGET(m, M_NOWAIT); + MCLGET(m, M_DONTWAIT); if ((m->m_flags & M_EXT) == 0) { CSR_WRITE_2(sc, WI_EVENT_ACK, WI_EV_RX); m_freem(m); @@ -1376,9 +1376,9 @@ wi_rx_intr(struct wi_softc *sc) if (sc->sc_drvbpf) { struct mbuf *mb; - MGETHDR(mb, M_NOWAIT, m->m_type); + MGETHDR(mb, M_DONTWAIT, m->m_type); if (mb != NULL) { - (void) m_dup_pkthdr(mb, m, M_NOWAIT); + (void) m_dup_pkthdr(mb, m, M_DONTWAIT); mb->m_next = m; mb->m_data = (caddr_t)&frmhdr; mb->m_len = sizeof(frmhdr); diff --git a/sys/dev/wl/if_wl.c b/sys/dev/wl/if_wl.c index 4b44fa37b830..dfaca89135c9 100644 --- a/sys/dev/wl/if_wl.c +++ b/sys/dev/wl/if_wl.c @@ -966,7 +966,7 @@ wlread(int unit, u_short fd_p) /* * Allocate a cluster'd mbuf to receive the packet. */ - m = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR); + m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); if (m == NULL) { if (wlhwrst(unit) != TRUE) { sc->hacr &= ~HACR_INTRON; diff --git a/sys/dev/xe/if_xe.c b/sys/dev/xe/if_xe.c index 6ed52828cf40..aa5722896874 100644 --- a/sys/dev/xe/if_xe.c +++ b/sys/dev/xe/if_xe.c @@ -643,7 +643,7 @@ xe_intr(void *xscp) if (len & 0x01) len++; - MGETHDR(mbp, M_NOWAIT, MT_DATA); /* Allocate a header mbuf */ + MGETHDR(mbp, M_DONTWAIT, MT_DATA); /* Allocate a header mbuf */ if (mbp != NULL) { mbp->m_pkthdr.rcvif = ifp; mbp->m_pkthdr.len = mbp->m_len = len; @@ -654,7 +654,7 @@ xe_intr(void *xscp) * alignment hack below. */ if (len + 2 > MHLEN) { - MCLGET(mbp, M_NOWAIT); + MCLGET(mbp, M_DONTWAIT); if ((mbp->m_flags & M_EXT) == 0) { m_freem(mbp); mbp = NULL; diff --git a/sys/fs/cd9660/cd9660_vfsops.c b/sys/fs/cd9660/cd9660_vfsops.c index f9161176bc53..a44df4caa371 100644 --- a/sys/fs/cd9660/cd9660_vfsops.c +++ b/sys/fs/cd9660/cd9660_vfsops.c @@ -411,7 +411,7 @@ iso_mountfs(devvp, mp, td, argp) pri_sierra->root_directory_record: pri->root_directory_record); - isomp = malloc(sizeof *isomp, M_ISOFSMNT, M_ZERO); + isomp = malloc(sizeof *isomp, M_ISOFSMNT, M_WAITOK | M_ZERO); isomp->logical_block_size = logical_block_size; isomp->volume_space_size = isonum_733 (high_sierra? @@ -712,7 +712,7 @@ cd9660_vget_internal(mp, ino, flags, vpp, relocated, isodir) return (error); } MALLOC(ip, struct iso_node *, sizeof(struct iso_node), M_ISOFSNODE, - M_ZERO); + M_WAITOK | M_ZERO); vp->v_data = ip; ip->i_vnode = vp; ip->i_dev = dev; diff --git a/sys/fs/cd9660/cd9660_vnops.c b/sys/fs/cd9660/cd9660_vnops.c index 062c22aa27c1..0b892e6e8012 100644 --- a/sys/fs/cd9660/cd9660_vnops.c +++ b/sys/fs/cd9660/cd9660_vnops.c @@ -194,7 +194,7 @@ cd9660_getattr(ap) struct uio auio; char *cp; - MALLOC(cp, char *, MAXPATHLEN, M_TEMP, 0); + MALLOC(cp, char *, MAXPATHLEN, M_TEMP, M_WAITOK); aiov.iov_base = cp; aiov.iov_len = MAXPATHLEN; auio.uio_iov = &aiov; @@ -451,7 +451,7 @@ cd9660_readdir(ap) imp = dp->i_mnt; bmask = imp->im_bmask; - MALLOC(idp, struct isoreaddir *, sizeof(*idp), M_TEMP, 0); + MALLOC(idp, struct isoreaddir *, sizeof(*idp), M_TEMP, M_WAITOK); idp->saveent.d_namlen = idp->assocent.d_namlen = 0; /* * XXX @@ -468,7 +468,7 @@ cd9660_readdir(ap) */ ncookies = uio->uio_resid / 16; MALLOC(cookies, u_long *, ncookies * sizeof(u_int), M_TEMP, - 0); + M_WAITOK); idp->cookies = cookies; idp->ncookies = ncookies; } @@ -671,7 +671,7 @@ cd9660_readlink(ap) if (uio->uio_segflg == UIO_SYSSPACE) symname = uio->uio_iov->iov_base; else - symname = uma_zalloc(namei_zone, 0); + symname = uma_zalloc(namei_zone, M_WAITOK); /* * Ok, we just gathering a symbolic name in SL record. diff --git a/sys/fs/coda/cnode.h b/sys/fs/coda/cnode.h index 8d0cebe3d131..962d329580e4 100644 --- a/sys/fs/coda/cnode.h +++ b/sys/fs/coda/cnode.h @@ -66,7 +66,7 @@ MALLOC_DECLARE(M_CODA); #define CODA_ALLOC(ptr, cast, size) \ do { \ - ptr = (cast)malloc((unsigned long) size, M_CODA, 0); \ + ptr = (cast)malloc((unsigned long) size, M_CODA, M_WAITOK); \ if (ptr == 0) { \ panic("kernel malloc returns 0 at %s:%d\n", __FILE__, __LINE__); \ } \ diff --git a/sys/fs/devfs/devfs_devs.c b/sys/fs/devfs/devfs_devs.c index 75ef5737cabe..95f2e2ee14af 100644 --- a/sys/fs/devfs/devfs_devs.c +++ b/sys/fs/devfs/devfs_devs.c @@ -152,11 +152,11 @@ devfs_attemptoverflow(int insist) or = NULL; n = devfs_noverflowwant; nb = sizeof (dev_t *) * n; - MALLOC(ot, dev_t **, nb, M_DEVFS, (insist ? 0 : M_NOWAIT) | M_ZERO); + MALLOC(ot, dev_t **, nb, M_DEVFS, (insist ? M_WAITOK : M_NOWAIT) | M_ZERO); if (ot == NULL) goto bail; nb = sizeof (int) * n; - MALLOC(or, int *, nb, M_DEVFS, (insist ? 0 : M_NOWAIT) | M_ZERO); + MALLOC(or, int *, nb, M_DEVFS, (insist ? M_WAITOK : M_NOWAIT) | M_ZERO); if (or == NULL) goto bail; if (!atomic_cmpset_ptr(&devfs_overflow, NULL, ot)) @@ -199,7 +199,7 @@ devfs_newdirent(char *name, int namelen) d.d_namlen = namelen; i = sizeof (*de) + GENERIC_DIRSIZ(&d); - MALLOC(de, struct devfs_dirent *, i, M_DEVFS, M_ZERO); + MALLOC(de, struct devfs_dirent *, i, M_DEVFS, M_WAITOK | M_ZERO); de->de_dirent = (struct dirent *)(de + 1); de->de_dirent->d_namlen = namelen; de->de_dirent->d_reclen = GENERIC_DIRSIZ(&d); @@ -294,7 +294,7 @@ devfs_populate(struct devfs_mount *dm) if (devfs_noverflow && dm->dm_overflow == NULL) { i = devfs_noverflow * sizeof (struct devfs_dirent *); MALLOC(dm->dm_overflow, struct devfs_dirent **, i, - M_DEVFS, M_ZERO); + M_DEVFS, M_WAITOK | M_ZERO); } while (dm->dm_generation != devfs_generation) { dm->dm_generation = devfs_generation; @@ -352,7 +352,7 @@ devfs_populate(struct devfs_mount *dm) de->de_dirent->d_type = DT_LNK; pdev = dev->si_parent; j = strlen(pdev->si_name) + 1; - MALLOC(de->de_symlink, char *, j, M_DEVFS, 0); + MALLOC(de->de_symlink, char *, j, M_DEVFS, M_WAITOK); bcopy(pdev->si_name, de->de_symlink, j); } else { de->de_inode = i; diff --git a/sys/fs/devfs/devfs_rule.c b/sys/fs/devfs/devfs_rule.c index 1da70197db3a..e6802024617f 100644 --- a/sys/fs/devfs/devfs_rule.c +++ b/sys/fs/devfs/devfs_rule.c @@ -222,7 +222,7 @@ devfs_rules_ioctl(struct mount *mp, u_long cmd, caddr_t data, struct thread *td) error = ESRCH; goto out; } - dk = malloc(sizeof(*dk), M_TEMP, M_ZERO); + dk = malloc(sizeof(*dk), M_TEMP, M_WAITOK | M_ZERO); memcpy(&dk->dk_rule, dr, sizeof(*dr)); lockmgr(&dm->dm_lock, LK_UPGRADE, 0, td); devfs_rule_applydm(dk, dm); @@ -556,7 +556,7 @@ devfs_rule_insert(struct devfs_rule *dr) return (error); } - dk = malloc(sizeof(*dk), M_DEVFS, 0); + dk = malloc(sizeof(*dk), M_DEVFS, M_WAITOK); dk->dk_ruleset = ds; if (dsi != NULL) ++dsi->ds_refcount; @@ -749,7 +749,7 @@ devfs_ruleset_create(devfs_rsnum rsnum) KASSERT(devfs_ruleset_bynum(rsnum) == NULL, ("creating already existent ruleset %d", rsnum)); - ds = malloc(sizeof(*ds), M_DEVFS, M_ZERO); + ds = malloc(sizeof(*ds), M_DEVFS, M_WAITOK | M_ZERO); ds->ds_number = rsnum; ds->ds_refcount = ds->ds_flags = 0; SLIST_INIT(&ds->ds_rules); diff --git a/sys/fs/devfs/devfs_vfsops.c b/sys/fs/devfs/devfs_vfsops.c index 26b0deb7cac6..64d4cdeaa9cb 100644 --- a/sys/fs/devfs/devfs_vfsops.c +++ b/sys/fs/devfs/devfs_vfsops.c @@ -77,10 +77,10 @@ devfs_nmount(mp, ndp, td) return (EOPNOTSUPP); MALLOC(fmp, struct devfs_mount *, sizeof(struct devfs_mount), - M_DEVFS, M_ZERO); + M_DEVFS, M_WAITOK | M_ZERO); MALLOC(fmp->dm_dirent, struct devfs_dirent **, sizeof(struct devfs_dirent *) * NDEVFSINO, - M_DEVFS, M_ZERO); + M_DEVFS, M_WAITOK | M_ZERO); lockinit(&fmp->dm_lock, PVFS, "devfs", 0, LK_NOPAUSE); mp->mnt_flag |= MNT_LOCAL; diff --git a/sys/fs/devfs/devfs_vnops.c b/sys/fs/devfs/devfs_vnops.c index db6e475c7228..6b6683a5fe5c 100644 --- a/sys/fs/devfs/devfs_vnops.c +++ b/sys/fs/devfs/devfs_vnops.c @@ -607,7 +607,7 @@ devfs_readdir(ap) } if( !error && ap->a_ncookies != NULL && ap->a_cookies != NULL ) { MALLOC(cookiebuf, u_long *, ncookies * sizeof(u_long), - M_TEMP, 0); + M_TEMP, M_WAITOK); cookiep = cookiebuf; dps = (struct dirent *)((char *)uio->uio_iov->iov_base - (uio->uio_offset - oldoff)); @@ -858,7 +858,7 @@ devfs_symlink(ap) de->de_inode = dmp->dm_inode++; de->de_dirent->d_type = DT_LNK; i = strlen(ap->a_target) + 1; - MALLOC(de->de_symlink, char *, i, M_DEVFS, 0); + MALLOC(de->de_symlink, char *, i, M_DEVFS, M_WAITOK); bcopy(ap->a_target, de->de_symlink, i); lockmgr(&dmp->dm_lock, LK_EXCLUSIVE, 0, curthread); #ifdef MAC diff --git a/sys/fs/fdescfs/fdesc_vfsops.c b/sys/fs/fdescfs/fdesc_vfsops.c index 18bff45d8c5a..a4741bc3760c 100644 --- a/sys/fs/fdescfs/fdesc_vfsops.c +++ b/sys/fs/fdescfs/fdesc_vfsops.c @@ -89,7 +89,7 @@ fdesc_mount(mp, ndp, td) return (error); MALLOC(fmp, struct fdescmount *, sizeof(struct fdescmount), - M_FDESCMNT, 0); /* XXX */ + M_FDESCMNT, M_WAITOK); /* XXX */ rvp->v_type = VDIR; rvp->v_vflag |= VV_ROOT; fmp->f_root = rvp; diff --git a/sys/fs/fdescfs/fdesc_vnops.c b/sys/fs/fdescfs/fdesc_vnops.c index 467066ba8067..2225220cfe1d 100644 --- a/sys/fs/fdescfs/fdesc_vnops.c +++ b/sys/fs/fdescfs/fdesc_vnops.c @@ -132,7 +132,7 @@ fdesc_allocvp(ftype, ix, mp, vpp, td) * might cause a bogus v_data pointer to get dereferenced * elsewhere if MALLOC should block. */ - MALLOC(fd, struct fdescnode *, sizeof(struct fdescnode), M_TEMP, 0); + MALLOC(fd, struct fdescnode *, sizeof(struct fdescnode), M_TEMP, M_WAITOK); error = getnewvnode("fdesc", mp, fdesc_vnodeop_p, vpp); if (error) { diff --git a/sys/fs/fifofs/fifo_vnops.c b/sys/fs/fifofs/fifo_vnops.c index bb58afb637e0..64fee388c93c 100644 --- a/sys/fs/fifofs/fifo_vnops.c +++ b/sys/fs/fifofs/fifo_vnops.c @@ -174,7 +174,7 @@ fifo_open(ap) int error; if ((fip = vp->v_fifoinfo) == NULL) { - MALLOC(fip, struct fifoinfo *, sizeof(*fip), M_VNODE, 0); + MALLOC(fip, struct fifoinfo *, sizeof(*fip), M_VNODE, M_WAITOK); vp->v_fifoinfo = fip; error = socreate(AF_LOCAL, &rso, SOCK_STREAM, 0, ap->a_td->td_ucred, ap->a_td); diff --git a/sys/fs/hpfs/hpfs_subr.c b/sys/fs/hpfs/hpfs_subr.c index 6d020cde1269..b45ebbd0a869 100644 --- a/sys/fs/hpfs/hpfs_subr.c +++ b/sys/fs/hpfs/hpfs_subr.c @@ -110,10 +110,10 @@ hpfs_bminit( dprintf(("0x%lx data bands, ", hpmp->hpm_dbnum)); MALLOC(hpmp->hpm_bmind, lsn_t *, hpmp->hpm_dbnum * sizeof(lsn_t), - M_HPFSMNT, 0); + M_HPFSMNT, M_WAITOK); MALLOC(hpmp->hpm_bitmap, u_int8_t *, hpmp->hpm_dbnum * BMSIZE, - M_HPFSMNT, 0); + M_HPFSMNT, M_WAITOK); error = bread(hpmp->hpm_devvp, hpmp->hpm_su.su_bitmap.lsn1, ((hpmp->hpm_dbnum + 0x7F) & ~(0x7F)) << 2, NOCRED, &bp); @@ -273,7 +273,7 @@ hpfs_cpinit ( cpicnt = hpmp->hpm_sp.sp_cpinum; MALLOC(hpmp->hpm_cpdblk, struct cpdblk *, - cpicnt * sizeof(struct cpdblk), M_HPFSMNT, 0); + cpicnt * sizeof(struct cpdblk), M_HPFSMNT, M_WAITOK); cpdbp = hpmp->hpm_cpdblk; lsn = hpmp->hpm_sp.sp_cpi; diff --git a/sys/fs/hpfs/hpfs_vfsops.c b/sys/fs/hpfs/hpfs_vfsops.c index 7244936607a7..1242e8419ce2 100644 --- a/sys/fs/hpfs/hpfs_vfsops.c +++ b/sys/fs/hpfs/hpfs_vfsops.c @@ -252,7 +252,7 @@ hpfs_mountfs(devvp, mp, argsp, td) /* * Do actual mount */ - hpmp = malloc(sizeof(struct hpfsmount), M_HPFSMNT, M_ZERO); + hpmp = malloc(sizeof(struct hpfsmount), M_HPFSMNT, M_WAITOK | M_ZERO); /* Read in SuperBlock */ error = bread(devvp, SUBLOCK, SUSIZE, NOCRED, &bp); @@ -494,7 +494,7 @@ hpfs_vget( * check for it). */ MALLOC(hp, struct hpfsnode *, sizeof(struct hpfsnode), - M_HPFSNO, 0); + M_HPFSNO, M_WAITOK); error = getnewvnode("hpfs", hpmp->hpm_mp, hpfs_vnodeop_p, &vp); if (error) { diff --git a/sys/fs/hpfs/hpfs_vnops.c b/sys/fs/hpfs/hpfs_vnops.c index 6578095aee76..fe9d36a47743 100644 --- a/sys/fs/hpfs/hpfs_vnops.c +++ b/sys/fs/hpfs/hpfs_vnops.c @@ -1005,7 +1005,7 @@ hpfs_readdir(ap) ((caddr_t)uio->uio_iov->iov_base - (uio->uio_offset - off)); MALLOC(cookies, u_long *, ncookies * sizeof(u_long), - M_TEMP, 0); + M_TEMP, M_WAITOK); for (dp = dpStart, cookiep = cookies, i=0; i < ncookies; dp = (struct dirent *)((caddr_t) dp + dp->d_reclen), i++) { diff --git a/sys/fs/msdosfs/msdosfs_denode.c b/sys/fs/msdosfs/msdosfs_denode.c index a0da2c7bf878..735e7dfebd57 100644 --- a/sys/fs/msdosfs/msdosfs_denode.c +++ b/sys/fs/msdosfs/msdosfs_denode.c @@ -246,7 +246,7 @@ deget(pmp, dirclust, diroffset, depp) * might cause a bogus v_data pointer to get dereferenced * elsewhere if MALLOC should block. */ - MALLOC(ldep, struct denode *, sizeof(struct denode), M_MSDOSFSNODE, 0); + MALLOC(ldep, struct denode *, sizeof(struct denode), M_MSDOSFSNODE, M_WAITOK); /* * Directory entry was not in cache, have to create a vnode and diff --git a/sys/fs/msdosfs/msdosfs_vfsops.c b/sys/fs/msdosfs/msdosfs_vfsops.c index 82b80434430b..b6ea5143c710 100644 --- a/sys/fs/msdosfs/msdosfs_vfsops.c +++ b/sys/fs/msdosfs/msdosfs_vfsops.c @@ -349,7 +349,7 @@ mountmsdosfs(devvp, mp, td, argp) } #endif - pmp = malloc(sizeof *pmp, M_MSDOSFSMNT, M_ZERO); + pmp = malloc(sizeof *pmp, M_MSDOSFSMNT, M_WAITOK | M_ZERO); pmp->pm_mountp = mp; /* @@ -560,7 +560,7 @@ mountmsdosfs(devvp, mp, td, argp) pmp->pm_inusemap = malloc(((pmp->pm_maxcluster + N_INUSEBITS - 1) / N_INUSEBITS) * sizeof(*pmp->pm_inusemap), - M_MSDOSFSFAT, 0); + M_MSDOSFSFAT, M_WAITOK); /* * fillinusemap() needs pm_devvp. diff --git a/sys/fs/msdosfs/msdosfs_vnops.c b/sys/fs/msdosfs/msdosfs_vnops.c index d3687758ee5c..c92c83adeea1 100644 --- a/sys/fs/msdosfs/msdosfs_vnops.c +++ b/sys/fs/msdosfs/msdosfs_vnops.c @@ -1501,7 +1501,7 @@ msdosfs_readdir(ap) if (ap->a_ncookies) { ncookies = uio->uio_resid / 16; MALLOC(cookies, u_long *, ncookies * sizeof(u_long), M_TEMP, - 0); + M_WAITOK); *ap->a_cookies = cookies; *ap->a_ncookies = ncookies; } diff --git a/sys/fs/ntfs/ntfs_subr.c b/sys/fs/ntfs/ntfs_subr.c index 919fcff42a4b..20b98a540123 100644 --- a/sys/fs/ntfs/ntfs_subr.c +++ b/sys/fs/ntfs/ntfs_subr.c @@ -187,7 +187,7 @@ ntfs_ntvattrget( } /* Scan $ATTRIBUTE_LIST for requested attribute */ len = lvap->va_datalen; - MALLOC(alpool, caddr_t, len, M_TEMP, 0); + MALLOC(alpool, caddr_t, len, M_TEMP, M_WAITOK); error = ntfs_readntvattr_plain(ntmp, ip, lvap, 0, len, alpool, &len, NULL); if (error) @@ -266,7 +266,7 @@ ntfs_loadntnode( dprintf(("ntfs_loadntnode: loading ino: %d\n",ip->i_number)); MALLOC(mfrp, struct filerec *, ntfs_bntob(ntmp->ntm_bpmftrec), - M_TEMP, 0); + M_TEMP, M_WAITOK); if (ip->i_number < NTFS_SYSNODESNUM) { struct buf *bp; @@ -390,7 +390,7 @@ ntfs_ntlookup( NULL)); MALLOC(ip, struct ntnode *, sizeof(struct ntnode), M_NTFSNTNODE, - M_ZERO); + M_WAITOK | M_ZERO); ddprintf(("ntfs_ntlookup: allocating ntnode: %d: %p\n", ino, ip)); /* Generic initialization */ @@ -539,7 +539,7 @@ ntfs_attrtontvattr( *rvapp = NULL; MALLOC(vap, struct ntvattr *, sizeof(struct ntvattr), - M_NTFSNTVATTR, M_ZERO); + M_NTFSNTVATTR, M_WAITOK | M_ZERO); vap->va_ip = NULL; vap->va_flag = rap->a_hdr.a_flag; vap->va_type = rap->a_hdr.a_type; @@ -576,7 +576,7 @@ ntfs_attrtontvattr( vap->va_vcnstart = 0; vap->va_vcnend = ntfs_btocn(vap->va_allocated); MALLOC(vap->va_datap, caddr_t, vap->va_datalen, - M_NTFSRDATA, 0); + M_NTFSRDATA, M_WAITOK); memcpy(vap->va_datap, (caddr_t) rap + rap->a_r.a_dataoff, rap->a_r.a_datalen); } @@ -617,8 +617,8 @@ ntfs_runtovrun( off += (run[off] & 0xF) + ((run[off] >> 4) & 0xF) + 1; cnt++; } - MALLOC(cn, cn_t *, cnt * sizeof(cn_t), M_NTFSRUN, 0); - MALLOC(cl, cn_t *, cnt * sizeof(cn_t), M_NTFSRUN, 0); + MALLOC(cn, cn_t *, cnt * sizeof(cn_t), M_NTFSRUN, M_WAITOK); + MALLOC(cl, cn_t *, cnt * sizeof(cn_t), M_NTFSRUN, M_WAITOK); off = 0; cnt = 0; @@ -738,13 +738,13 @@ ntfs_fget( return (0); MALLOC(fp, struct fnode *, sizeof(struct fnode), M_NTFSFNODE, - M_ZERO); + M_WAITOK | M_ZERO); dprintf(("ntfs_fget: allocating fnode: %p\n",fp)); fp->f_ip = ip; if (attrname) { fp->f_flag |= FN_AATTRNAME; - MALLOC(fp->f_attrname, char *, strlen(attrname)+1, M_TEMP, 0); + MALLOC(fp->f_attrname, char *, strlen(attrname)+1, M_TEMP, M_WAITOK); strcpy(fp->f_attrname, attrname); } else fp->f_attrname = NULL; @@ -829,7 +829,7 @@ ntfs_ntlookupattr( out: if (namelen) { - MALLOC((*attrname), char *, namelen, M_TEMP, 0); + MALLOC((*attrname), char *, namelen, M_TEMP, M_WAITOK); memcpy((*attrname), name, namelen); (*attrname)[namelen] = '\0'; } @@ -894,7 +894,7 @@ ntfs_ntlookupfile( dprintf(("ntfs_ntlookupfile: blksz: %d, rdsz: %d\n", blsize, rdsize)); - MALLOC(rdbuf, caddr_t, blsize, M_TEMP, 0); + MALLOC(rdbuf, caddr_t, blsize, M_TEMP, M_WAITOK); error = ntfs_readattr(ntmp, ip, NTFS_A_INDXROOT, "$I30", 0, rdsize, rdbuf, NULL); @@ -1112,7 +1112,7 @@ ntfs_ntreaddir( if (fp->f_dirblbuf == NULL) { fp->f_dirblsz = vap->va_a_iroot->ir_size; MALLOC(fp->f_dirblbuf, caddr_t, - max(vap->va_datalen,fp->f_dirblsz), M_NTFSDIR, 0); + max(vap->va_datalen,fp->f_dirblsz), M_NTFSDIR, M_WAITOK); } blsize = fp->f_dirblsz; @@ -1127,7 +1127,7 @@ ntfs_ntreaddir( error = ENOTDIR; goto fail; } - MALLOC(bmp, u_char *, bmvap->va_datalen, M_TEMP, 0); + MALLOC(bmp, u_char *, bmvap->va_datalen, M_TEMP, M_WAITOK); error = ntfs_readattr(ntmp, ip, NTFS_A_INDXBITMAP, "$I30", 0, bmvap->va_datalen, bmp, NULL); if (error) @@ -1708,9 +1708,9 @@ ntfs_readattr( vap->va_compressalg)); MALLOC(cup, u_int8_t *, ntfs_cntob(NTFS_COMPUNIT_CL), - M_NTFSDECOMP, 0); + M_NTFSDECOMP, M_WAITOK); MALLOC(uup, u_int8_t *, ntfs_cntob(NTFS_COMPUNIT_CL), - M_NTFSDECOMP, 0); + M_NTFSDECOMP, M_WAITOK); cn = (ntfs_btocn(roff)) & (~(NTFS_COMPUNIT_CL - 1)); off = roff - ntfs_cntob(cn); @@ -1943,7 +1943,7 @@ ntfs_toupper_use(mp, ntmp) * so don't bother reading more */ MALLOC(ntfs_toupper_tab, wchar *, 65536 * sizeof(wchar), - M_NTFSRDATA, 0); + M_NTFSRDATA, M_WAITOK); if ((error = VFS_VGET(mp, NTFS_UPCASEINO, LK_EXCLUSIVE, &vp))) goto out; @@ -1991,14 +1991,14 @@ ntfs_u28_init( char ** u28; int i, j, h, l; - MALLOC(u28, char **, 256 * sizeof(char*), M_TEMP, M_ZERO); + MALLOC(u28, char **, 256 * sizeof(char*), M_TEMP, M_WAITOK | M_ZERO); for (i=0; i<256; i++) { h = (u2w[i] >> 8) & 0xFF; l = (u2w[i]) &0xFF; if (u28[h] == NULL) { - MALLOC(u28[h], char *, 256 * sizeof(char), M_TEMP, 0); + MALLOC(u28[h], char *, 256 * sizeof(char), M_TEMP, M_WAITOK); for (j=0; j<256; j++) u28[h][j] = '_'; } @@ -2039,7 +2039,7 @@ ntfs_82u_init( wchar * _82u; int i; - MALLOC(_82u, wchar *, 256 * sizeof(wchar), M_TEMP, 0); + MALLOC(_82u, wchar *, 256 * sizeof(wchar), M_TEMP, M_WAITOK); if (u2w == NULL) { for (i=0; i<256; i++) diff --git a/sys/fs/ntfs/ntfs_vfsops.c b/sys/fs/ntfs/ntfs_vfsops.c index 7221e0b6b4bc..1e267a990ec9 100644 --- a/sys/fs/ntfs/ntfs_vfsops.c +++ b/sys/fs/ntfs/ntfs_vfsops.c @@ -309,7 +309,7 @@ ntfs_mountfs(devvp, mp, argsp, td) error = bread(devvp, BBLOCK, BBSIZE, NOCRED, &bp); if (error) goto out; - ntmp = malloc( sizeof *ntmp, M_NTFSMNT, M_ZERO); + ntmp = malloc( sizeof *ntmp, M_NTFSMNT, M_WAITOK | M_ZERO); bcopy( bp->b_data, &ntmp->ntm_bootfile, sizeof(struct bootfile) ); brelse( bp ); bp = NULL; @@ -415,7 +415,7 @@ ntfs_mountfs(devvp, mp, argsp, td) /* Alloc memory for attribute definitions */ MALLOC(ntmp->ntm_ad, struct ntvattrdef *, num * sizeof(struct ntvattrdef), - M_NTFSMNT, 0); + M_NTFSMNT, M_WAITOK); ntmp->ntm_adnum = num; @@ -562,7 +562,7 @@ ntfs_calccfree( bmsize = VTOF(vp)->f_size; - MALLOC(tmp, u_int8_t *, bmsize, M_TEMP, 0); + MALLOC(tmp, u_int8_t *, bmsize, M_TEMP, M_WAITOK); error = ntfs_readattr(ntmp, VTONT(vp), NTFS_A_DATA, NULL, 0, bmsize, tmp, NULL); diff --git a/sys/fs/ntfs/ntfs_vnops.c b/sys/fs/ntfs/ntfs_vnops.c index b39f0cb5a751..90ca4f1a8fa4 100644 --- a/sys/fs/ntfs/ntfs_vnops.c +++ b/sys/fs/ntfs/ntfs_vnops.c @@ -590,7 +590,7 @@ ntfs_readdir(ap) ((caddr_t)uio->uio_iov->iov_base - (uio->uio_offset - off)); MALLOC(cookies, u_long *, ncookies * sizeof(u_long), - M_TEMP, 0); + M_TEMP, M_WAITOK); for (dp = dpStart, cookiep = cookies, i=0; i < ncookies; dp = (struct dirent *)((caddr_t) dp + dp->d_reclen), i++) { diff --git a/sys/fs/nullfs/null_subr.c b/sys/fs/nullfs/null_subr.c index 0285add67787..f2a43e026264 100644 --- a/sys/fs/nullfs/null_subr.c +++ b/sys/fs/nullfs/null_subr.c @@ -212,7 +212,7 @@ null_nodeget(mp, lowervp, vpp) * elsewhere if MALLOC should block. */ MALLOC(xp, struct null_node *, sizeof(struct null_node), - M_NULLFSNODE, 0); + M_NULLFSNODE, M_WAITOK); error = getnewvnode("null", mp, null_vnodeop_p, &vp); if (error) { diff --git a/sys/fs/nullfs/null_vfsops.c b/sys/fs/nullfs/null_vfsops.c index 20b187767d35..d6ca21115f6d 100644 --- a/sys/fs/nullfs/null_vfsops.c +++ b/sys/fs/nullfs/null_vfsops.c @@ -158,7 +158,7 @@ nullfs_mount(mp, ndp, td) } xmp = (struct null_mount *) malloc(sizeof(struct null_mount), - M_NULLFSMNT, 0); /* XXX */ + M_NULLFSMNT, M_WAITOK); /* XXX */ /* * Save reference to underlying FS diff --git a/sys/fs/nwfs/nwfs_node.c b/sys/fs/nwfs/nwfs_node.c index d8bdbc456cf3..b92dd4c977cc 100644 --- a/sys/fs/nwfs/nwfs_node.c +++ b/sys/fs/nwfs/nwfs_node.c @@ -169,7 +169,7 @@ nwfs_allocvp(struct mount *mp, ncpfid fid, struct nw_entry_info *fap, * might cause a bogus v_data pointer to get dereferenced * elsewhere if MALLOC should block. */ - MALLOC(np, struct nwnode *, sizeof *np, M_NWNODE, M_ZERO); + MALLOC(np, struct nwnode *, sizeof *np, M_NWNODE, M_WAITOK | M_ZERO); error = getnewvnode("nwfs", mp, nwfs_vnodeop_p, &vp); if (error) { *vpp = NULL; diff --git a/sys/fs/nwfs/nwfs_vfsops.c b/sys/fs/nwfs/nwfs_vfsops.c index c033b1152e1c..f097b3e0173f 100644 --- a/sys/fs/nwfs/nwfs_vfsops.c +++ b/sys/fs/nwfs/nwfs_vfsops.c @@ -125,7 +125,7 @@ nwfs_initnls(struct nwmount *nmp) { nmp->m.nls.u2n = ncp_defnls.u2n; return 0; } - MALLOC(pe, char *, 256 * 4, M_NWFSDATA, 0); + MALLOC(pe, char *, 256 * 4, M_NWFSDATA, M_WAITOK); pc = pe; do { COPY_TABLE(nmp->m.nls.to_lower, ncp_defnls.to_lower); diff --git a/sys/fs/portalfs/portal_vfsops.c b/sys/fs/portalfs/portal_vfsops.c index 4c8c3f9472ec..66e516d4ff0b 100644 --- a/sys/fs/portalfs/portal_vfsops.c +++ b/sys/fs/portalfs/portal_vfsops.c @@ -113,10 +113,10 @@ portal_mount(mp, path, data, ndp, td) } MALLOC(pn, struct portalnode *, sizeof(struct portalnode), - M_TEMP, 0); + M_TEMP, M_WAITOK); MALLOC(fmp, struct portalmount *, sizeof(struct portalmount), - M_PORTALFSMNT, 0); /* XXX */ + M_PORTALFSMNT, M_WAITOK); /* XXX */ error = getnewvnode("portal", mp, portal_vnodeop_p, &rvp); /* XXX */ if (error) { diff --git a/sys/fs/portalfs/portal_vnops.c b/sys/fs/portalfs/portal_vnops.c index f272e141fb0b..0d8c06d3a0f1 100644 --- a/sys/fs/portalfs/portal_vnops.c +++ b/sys/fs/portalfs/portal_vnops.c @@ -132,7 +132,7 @@ portal_lookup(ap) * elsewhere if MALLOC should block. */ MALLOC(pt, struct portalnode *, sizeof(struct portalnode), - M_TEMP, 0); + M_TEMP, M_WAITOK); error = getnewvnode("portal", dvp->v_mount, portal_vnodeop_p, &fvp); if (error) { @@ -150,7 +150,7 @@ portal_lookup(ap) size++; cnp->cn_consume = size - cnp->cn_namelen; - pt->pt_arg = malloc(size+1, M_TEMP, 0); + pt->pt_arg = malloc(size+1, M_TEMP, M_WAITOK); pt->pt_size = size+1; bcopy(pname, pt->pt_arg, pt->pt_size); pt->pt_fileid = portal_fileid++; diff --git a/sys/fs/pseudofs/pseudofs.c b/sys/fs/pseudofs/pseudofs.c index 67b3fae96722..8297ef6af3f9 100644 --- a/sys/fs/pseudofs/pseudofs.c +++ b/sys/fs/pseudofs/pseudofs.c @@ -92,7 +92,7 @@ _pfs_fixup_dir(struct pfs_node *parent) struct pfs_node *dir; MALLOC(dir, struct pfs_node *, sizeof *dir, - M_PFSNODES, M_ZERO); + M_PFSNODES, M_WAITOK|M_ZERO); dir->pn_name[0] = '.'; dir->pn_type = pfstype_this; @@ -102,7 +102,7 @@ _pfs_fixup_dir(struct pfs_node *parent) } MALLOC(dir, struct pfs_node *, sizeof *dir, - M_PFSNODES, M_ZERO); + M_PFSNODES, M_WAITOK|M_ZERO); dir->pn_name[0] = dir->pn_name[1] = '.'; dir->pn_type = pfstype_parent; @@ -127,7 +127,7 @@ pfs_create_dir(struct pfs_node *parent, char *name, ("%s(): node name is too long", __func__)); MALLOC(dir, struct pfs_node *, sizeof *dir, - M_PFSNODES, M_ZERO); + M_PFSNODES, M_WAITOK|M_ZERO); strcpy(dir->pn_name, name); dir->pn_type = (flags & PFS_PROCDEP) ? pfstype_procdir : pfstype_dir; dir->pn_attr = attr; @@ -160,7 +160,7 @@ pfs_create_file(struct pfs_node *parent, char *name, pfs_fill_t fill, ("%s(): node name is too long", __func__)); MALLOC(node, struct pfs_node *, sizeof *node, - M_PFSNODES, M_ZERO); + M_PFSNODES, M_WAITOK|M_ZERO); strcpy(node->pn_name, name); node->pn_type = pfstype_file; node->pn_func = fill; @@ -320,7 +320,7 @@ pfs_init(struct pfs_info *pi, struct vfsconf *vfc) /* set up the root diretory */ MALLOC(root, struct pfs_node *, sizeof *root, - M_PFSNODES, M_ZERO); + M_PFSNODES, M_WAITOK|M_ZERO); root->pn_type = pfstype_root; root->pn_name[0] = '/'; root->pn_info = pi; diff --git a/sys/fs/pseudofs/pseudofs_fileno.c b/sys/fs/pseudofs/pseudofs_fileno.c index 0ca164027e48..4341e236fa9a 100644 --- a/sys/fs/pseudofs/pseudofs_fileno.c +++ b/sys/fs/pseudofs/pseudofs_fileno.c @@ -82,7 +82,7 @@ pfs_fileno_init(struct pfs_info *pi) struct pfs_bitmap *pb; MALLOC(pb, struct pfs_bitmap *, sizeof *pb, - M_PFSFILENO, M_ZERO); + M_PFSFILENO, M_WAITOK|M_ZERO); mtx_lock(&pi->pi_mutex); @@ -144,7 +144,7 @@ pfs_get_fileno(struct pfs_info *pi) if (pb == NULL) { mtx_unlock(&pi->pi_mutex); MALLOC(pb, struct pfs_bitmap *, sizeof *pb, - M_PFSFILENO, M_ZERO); + M_PFSFILENO, M_WAITOK|M_ZERO); mtx_lock(&pi->pi_mutex); /* protect against possible race */ while (ppb->pb_next) diff --git a/sys/fs/pseudofs/pseudofs_vncache.c b/sys/fs/pseudofs/pseudofs_vncache.c index eed7aefe54fc..c832925ff2c9 100644 --- a/sys/fs/pseudofs/pseudofs_vncache.c +++ b/sys/fs/pseudofs/pseudofs_vncache.c @@ -133,7 +133,7 @@ pfs_vncache_alloc(struct mount *mp, struct vnode **vpp, ++pfs_vncache_misses; /* nope, get a new one */ - MALLOC(pvd, struct pfs_vdata *, sizeof *pvd, M_PFSVNCACHE, 0); + MALLOC(pvd, struct pfs_vdata *, sizeof *pvd, M_PFSVNCACHE, M_WAITOK); if (++pfs_vncache_entries > pfs_vncache_maxentries) pfs_vncache_maxentries = pfs_vncache_entries; error = getnewvnode("pseudofs", mp, pfs_vnodeop_p, vpp); diff --git a/sys/fs/smbfs/smbfs_node.c b/sys/fs/smbfs/smbfs_node.c index f4c3c039b0f8..093e7ca423d8 100644 --- a/sys/fs/smbfs/smbfs_node.c +++ b/sys/fs/smbfs/smbfs_node.c @@ -114,7 +114,7 @@ smbfs_name_alloc(const u_char *name, int nmlen) nmlen++; #ifdef SMBFS_NAME_DEBUG - cp = malloc(nmlen + 2 + sizeof(int), M_SMBNODENAME, 0); + cp = malloc(nmlen + 2 + sizeof(int), M_SMBNODENAME, M_WAITOK); *(int*)cp = nmlen; cp += sizeof(int); cp[0] = 0xfc; @@ -122,7 +122,7 @@ smbfs_name_alloc(const u_char *name, int nmlen) bcopy(name, cp, nmlen - 1); cp[nmlen] = 0xfe; #else - cp = malloc(nmlen, M_SMBNODENAME, 0); + cp = malloc(nmlen, M_SMBNODENAME, M_WAITOK); bcopy(name, cp, nmlen - 1); #endif cp[nmlen - 1] = 0; @@ -219,7 +219,7 @@ smbfs_node_alloc(struct mount *mp, struct vnode *dvp, if (fap == NULL) return ENOENT; - MALLOC(np, struct smbnode *, sizeof *np, M_SMBNODE, 0); + MALLOC(np, struct smbnode *, sizeof *np, M_SMBNODE, M_WAITOK); error = getnewvnode("smbfs", mp, smbfs_vnodeop_p, &vp); if (error) { FREE(np, M_SMBNODE); diff --git a/sys/fs/smbfs/smbfs_smb.c b/sys/fs/smbfs/smbfs_smb.c index 59a5691f7a4b..034fc7725b7f 100644 --- a/sys/fs/smbfs/smbfs_smb.c +++ b/sys/fs/smbfs/smbfs_smb.c @@ -1264,7 +1264,7 @@ static int smbfs_findopenLM2(struct smbfs_fctx *ctx, struct smbnode *dnp, const char *wildcard, int wclen, int attr, struct smb_cred *scred) { - ctx->f_name = malloc(SMB_MAXFNAMELEN, M_SMBFSDATA, 0); + ctx->f_name = malloc(SMB_MAXFNAMELEN, M_SMBFSDATA, M_WAITOK); if (ctx->f_name == NULL) return ENOMEM; ctx->f_infolevel = SMB_DIALECT(SSTOVC(ctx->f_ssp)) < SMB_DIALECT_NTLM0_12 ? @@ -1371,7 +1371,7 @@ smbfs_findnextLM2(struct smbfs_fctx *ctx, int limit) if (ctx->f_rnamelen <= nmlen) { if (ctx->f_rname) free(ctx->f_rname, M_SMBFSDATA); - ctx->f_rname = malloc(nmlen + 1, M_SMBFSDATA, 0); + ctx->f_rname = malloc(nmlen + 1, M_SMBFSDATA, M_WAITOK); ctx->f_rnamelen = nmlen; } bcopy(ctx->f_name, ctx->f_rname, nmlen); @@ -1404,7 +1404,7 @@ smbfs_findopen(struct smbnode *dnp, const char *wildcard, int wclen, int attr, struct smbfs_fctx *ctx; int error; - ctx = malloc(sizeof(*ctx), M_SMBFSDATA, 0); + ctx = malloc(sizeof(*ctx), M_SMBFSDATA, M_WAITOK); if (ctx == NULL) return ENOMEM; bzero(ctx, sizeof(*ctx)); diff --git a/sys/fs/udf/udf_vfsops.c b/sys/fs/udf/udf_vfsops.c index 2e7df0a1ee23..b41b86bfc24b 100644 --- a/sys/fs/udf/udf_vfsops.c +++ b/sys/fs/udf/udf_vfsops.c @@ -562,7 +562,7 @@ udf_vget(struct mount *mp, ino_t ino, int flags, struct vnode **vpp) * Allocate memory and check the tag id's before grabbing a new * vnode, since it's hard to roll back if there is a problem. */ - unode = uma_zalloc(udf_zone_node, 0); + unode = uma_zalloc(udf_zone_node, M_WAITOK); if (unode == NULL) { printf("Cannot allocate udf node\n"); return (ENOMEM); diff --git a/sys/fs/udf/udf_vnops.c b/sys/fs/udf/udf_vnops.c index f6d5fd220828..8d9be5790aa3 100644 --- a/sys/fs/udf/udf_vnops.c +++ b/sys/fs/udf/udf_vnops.c @@ -449,7 +449,7 @@ udf_transname(char *cs0string, char *destname, int len) int i, unilen = 0; /* allocate a buffer big enough to hold an 8->16 bit expansion */ - transname = uma_zalloc(udf_zone_trans, 0); + transname = uma_zalloc(udf_zone_trans, M_WAITOK); if ((unilen = udf_UncompressUnicode(len, cs0string, transname)) == -1) { printf("udf: Unicode translation failed\n"); @@ -486,7 +486,7 @@ udf_cmpname(char *cs0string, char *cmpname, int cs0len, int cmplen) int error = 0; /* This is overkill, but not worth creating a new zone */ - transname = uma_zalloc(udf_zone_trans, 0); + transname = uma_zalloc(udf_zone_trans, M_WAITOK); cs0len = udf_transname(cs0string, transname, cs0len); @@ -532,7 +532,7 @@ udf_opendir(struct udf_node *node, int offset, int fsize, struct udf_mnt *udfmp) { struct udf_dirstream *ds; - ds = uma_zalloc(udf_zone_ds, M_ZERO); + ds = uma_zalloc(udf_zone_ds, M_WAITOK | M_ZERO); ds->node = node; ds->offset = offset; @@ -597,7 +597,7 @@ udf_getfid(struct udf_dirstream *ds) * logical sector in size. */ MALLOC(ds->buf, uint8_t*, ds->udfmp->bsize, M_UDFFID, - M_ZERO); + M_WAITOK | M_ZERO); bcopy(fid, ds->buf, frag_size); /* Reduce all of the casting magic */ @@ -697,7 +697,7 @@ udf_readdir(struct vop_readdir_args *a) */ ncookies = uio->uio_resid / 8; MALLOC(cookies, u_long *, sizeof(u_long) * ncookies, - M_TEMP, 0); + M_TEMP, M_WAITOK); if (cookies == NULL) return (ENOMEM); uiodir.ncookies = ncookies; diff --git a/sys/fs/umapfs/umap_subr.c b/sys/fs/umapfs/umap_subr.c index e33adb61f80a..d3fed34602e6 100644 --- a/sys/fs/umapfs/umap_subr.c +++ b/sys/fs/umapfs/umap_subr.c @@ -210,7 +210,7 @@ umap_node_alloc(mp, lowervp, vpp) * elsewhere if MALLOC should block. */ MALLOC(xp, struct umap_node *, sizeof(struct umap_node), - M_TEMP, 0); + M_TEMP, M_WAITOK); error = getnewvnode("umap", mp, umap_vnodeop_p, vpp); if (error) { diff --git a/sys/fs/umapfs/umap_vfsops.c b/sys/fs/umapfs/umap_vfsops.c index b148c73bdd56..c1ed75108e37 100644 --- a/sys/fs/umapfs/umap_vfsops.c +++ b/sys/fs/umapfs/umap_vfsops.c @@ -155,7 +155,7 @@ umapfs_mount(mp, path, data, ndp, td) #endif amp = (struct umap_mount *) malloc(sizeof(struct umap_mount), - M_UMAPFSMNT, 0); /* XXX */ + M_UMAPFSMNT, M_WAITOK); /* XXX */ /* * Save reference to underlying FS diff --git a/sys/fs/unionfs/union_subr.c b/sys/fs/unionfs/union_subr.c index b645265b671b..e08b70a1ee96 100644 --- a/sys/fs/unionfs/union_subr.c +++ b/sys/fs/unionfs/union_subr.c @@ -509,7 +509,7 @@ union_allocvp(vpp, mp, dvp, upperdvp, cnp, uppervp, lowervp, docache) union_newlower(un, lowervp); if (cnp && (lowervp != NULLVP)) { un->un_path = malloc(cnp->cn_namelen+1, - M_TEMP, 0); + M_TEMP, M_WAITOK); bcopy(cnp->cn_nameptr, un->un_path, cnp->cn_namelen); un->un_path[cnp->cn_namelen] = '\0'; @@ -564,7 +564,7 @@ union_allocvp(vpp, mp, dvp, upperdvp, cnp, uppervp, lowervp, docache) } MALLOC((*vpp)->v_data, void *, sizeof(struct union_node), - M_TEMP, 0); + M_TEMP, M_WAITOK); ASSERT_VOP_LOCKED(*vpp, "union_allocvp"); (*vpp)->v_vflag |= vflag; @@ -591,7 +591,7 @@ union_allocvp(vpp, mp, dvp, upperdvp, cnp, uppervp, lowervp, docache) un->un_openl = 0; if (cnp && (lowervp != NULLVP)) { - un->un_path = malloc(cnp->cn_namelen+1, M_TEMP, 0); + un->un_path = malloc(cnp->cn_namelen+1, M_TEMP, M_WAITOK); bcopy(cnp->cn_nameptr, un->un_path, cnp->cn_namelen); un->un_path[cnp->cn_namelen] = '\0'; } else { @@ -686,7 +686,7 @@ union_copyfile(fvp, tvp, cred, td) VOP_LEASE(fvp, td, cred, LEASE_READ); VOP_LEASE(tvp, td, cred, LEASE_WRITE); - buf = malloc(MAXBSIZE, M_TEMP, 0); + buf = malloc(MAXBSIZE, M_TEMP, M_WAITOK); /* ugly loop follows... */ do { @@ -858,7 +858,7 @@ union_relookup(um, dvp, vpp, cnp, cn, path, pathlen) * Conclusion: Horrible. */ cn->cn_namelen = pathlen; - cn->cn_pnbuf = uma_zalloc(namei_zone, 0); + cn->cn_pnbuf = uma_zalloc(namei_zone, M_WAITOK); bcopy(path, cn->cn_pnbuf, cn->cn_namelen); cn->cn_pnbuf[cn->cn_namelen] = '\0'; @@ -1068,7 +1068,7 @@ union_vn_create(vpp, un, td) * copied in the first place). */ cn.cn_namelen = strlen(un->un_path); - cn.cn_pnbuf = uma_zalloc(namei_zone, 0); + cn.cn_pnbuf = uma_zalloc(namei_zone, M_WAITOK); bcopy(un->un_path, cn.cn_pnbuf, cn.cn_namelen+1); cn.cn_nameiop = CREATE; cn.cn_flags = (LOCKPARENT|LOCKLEAF|HASBUF|SAVENAME|ISLASTCN); @@ -1260,7 +1260,7 @@ union_dircache(vp, td) union_dircache_r(vp, 0, &cnt); cnt++; dircache = malloc(cnt * sizeof(struct vnode *), - M_TEMP, 0); + M_TEMP, M_WAITOK); vpp = dircache; union_dircache_r(vp, &vpp, &cnt); *vpp = NULLVP; diff --git a/sys/fs/unionfs/union_vfsops.c b/sys/fs/unionfs/union_vfsops.c index 505c5da32594..637b35077f0d 100644 --- a/sys/fs/unionfs/union_vfsops.c +++ b/sys/fs/unionfs/union_vfsops.c @@ -194,7 +194,7 @@ union_mount(mp, ndp, td) */ um = (struct union_mount *) malloc(sizeof(struct union_mount), - M_UNIONFSMNT, M_ZERO); + M_UNIONFSMNT, M_WAITOK | M_ZERO); um->um_op = op; diff --git a/sys/geom/bde/g_bde.c b/sys/geom/bde/g_bde.c index 8a399261ae2e..4d7f615e6e69 100644 --- a/sys/geom/bde/g_bde.c +++ b/sys/geom/bde/g_bde.c @@ -212,7 +212,7 @@ g_bde_config(struct g_configargs *ga) while (1) { sectorsize = cp->provider->sectorsize; mediasize = cp->provider->mediasize; - sc = g_malloc(sizeof(struct g_bde_softc), M_ZERO); + sc = g_malloc(sizeof(struct g_bde_softc), M_WAITOK | M_ZERO); gp->softc = sc; sc->geom = gp; sc->consumer = cp; diff --git a/sys/geom/geom_aes.c b/sys/geom/geom_aes.c index 5471cbf6c142..72f0d3dcc56f 100644 --- a/sys/geom/geom_aes.c +++ b/sys/geom/geom_aes.c @@ -148,7 +148,7 @@ g_aes_read_done(struct bio *bp) gp = bp->bio_from->geom; sc = gp->softc; - sb = g_malloc(sc->sectorsize, 0); + sb = g_malloc(sc->sectorsize, M_WAITOK); b = bp->bio_data; e = bp->bio_data; e += bp->bio_length; @@ -211,7 +211,7 @@ g_aes_start(struct bio *bp) } bp2->bio_done = g_aes_write_done; bp2->bio_offset += sc->sectorsize; - bp2->bio_data = g_malloc(bp->bio_length, 0); + bp2->bio_data = g_malloc(bp->bio_length, M_WAITOK); b = bp->bio_data; e = bp->bio_data; e += bp->bio_length; @@ -322,7 +322,7 @@ g_aes_taste(struct g_class *mp, struct g_provider *pp, int flags __unused) if (buf == NULL || error != 0) { break; } - sc = g_malloc(sizeof(struct g_aes_softc), M_ZERO); + sc = g_malloc(sizeof(struct g_aes_softc), M_WAITOK | M_ZERO); if (!memcmp(buf, aes_magic, strlen(aes_magic))) { sc->keying = KEY_ZERO; } else if (!memcmp(buf, aes_magic_random, diff --git a/sys/geom/geom_ccd.c b/sys/geom/geom_ccd.c index c7f659102f0e..d947708b6021 100644 --- a/sys/geom/geom_ccd.c +++ b/sys/geom/geom_ccd.c @@ -186,7 +186,7 @@ ccdnew(int unit) if (IS_ALLOCATED(unit) || unit > 32) return (NULL); - MALLOC(sc, struct ccd_s *, sizeof(*sc), M_CCD, M_ZERO); + MALLOC(sc, struct ccd_s *, sizeof(*sc), M_CCD, M_WAITOK | M_ZERO); sc->sc_unit = unit; LIST_INSERT_HEAD(&ccd_softc_list, sc, list); /* XXX: UNLOCK(unique unit numbers) */ @@ -263,7 +263,7 @@ ccdinit(struct ccd_s *cs, char **cpaths, struct thread *td) /* Allocate space for the component info. */ cs->sc_cinfo = malloc(cs->sc_nccdisks * sizeof(struct ccdcinfo), - M_CCD, 0); + M_CCD, M_WAITOK); /* * Verify that each component piece exists and record @@ -271,7 +271,7 @@ ccdinit(struct ccd_s *cs, char **cpaths, struct thread *td) */ maxsecsize = 0; minsize = 0; - tmppath = malloc(MAXPATHLEN, M_CCD, 0); + tmppath = malloc(MAXPATHLEN, M_CCD, M_WAITOK); for (ix = 0; ix < cs->sc_nccdisks; ix++) { vp = cs->sc_vpp[ix]; ci = &cs->sc_cinfo[ix]; @@ -284,7 +284,7 @@ ccdinit(struct ccd_s *cs, char **cpaths, struct thread *td) MAXPATHLEN, &ci->ci_pathlen)) != 0) { goto fail; } - ci->ci_path = malloc(ci->ci_pathlen, M_CCD, 0); + ci->ci_path = malloc(ci->ci_pathlen, M_CCD, M_WAITOK); bcopy(tmppath, ci->ci_path, ci->ci_pathlen); ci->ci_dev = vn_todev(vp); @@ -439,7 +439,7 @@ ccdinterleave(struct ccd_s *cs, int unit) */ size = (cs->sc_nccdisks + 1) * sizeof(struct ccdiinfo); cs->sc_itable = (struct ccdiinfo *)malloc(size, M_CCD, - M_ZERO); + M_WAITOK | M_ZERO); /* * Trivial case: no interleave (actually interleave of disk size). @@ -453,7 +453,7 @@ ccdinterleave(struct ccd_s *cs, int unit) for (ix = 0; ix < cs->sc_nccdisks; ix++) { /* Allocate space for ii_index. */ - ii->ii_index = malloc(sizeof(int), M_CCD, 0); + ii->ii_index = malloc(sizeof(int), M_CCD, M_WAITOK); ii->ii_ndisk = 1; ii->ii_startblk = bn; ii->ii_startoff = 0; @@ -476,7 +476,7 @@ ccdinterleave(struct ccd_s *cs, int unit) * we use. */ ii->ii_index = malloc((sizeof(int) * cs->sc_nccdisks), - M_CCD, 0); + M_CCD, M_WAITOK); /* * Locate the smallest of the remaining components @@ -1066,9 +1066,9 @@ ccdioctltoo(int unit, u_long cmd, caddr_t data, int flag, struct thread *td) * componet pathnames and device numbers. */ cpp = malloc(ccio->ccio_ndisks * sizeof(char *), - M_CCD, 0); + M_CCD, M_WAITOK); vpp = malloc(ccio->ccio_ndisks * sizeof(struct vnode *), - M_CCD, 0); + M_CCD, M_WAITOK); error = copyin((caddr_t)ccio->ccio_disks, (caddr_t)cpp, ccio->ccio_ndisks * sizeof(char **)); @@ -1124,7 +1124,8 @@ ccdioctltoo(int unit, u_long cmd, caddr_t data, int flag, struct thread *td) ccio->ccio_unit = unit; ccio->ccio_size = cs->sc_size; ccg = &cs->sc_geom; - cs->sc_disk = malloc(sizeof(struct disk), M_CCD, M_ZERO); + cs->sc_disk = malloc(sizeof(struct disk), M_CCD, + M_ZERO | M_WAITOK); cs->sc_disk->d_strategy = ccdstrategy; cs->sc_disk->d_name = "ccd"; cs->sc_disk->d_sectorsize = ccg->ccg_secsize; diff --git a/sys/geom/geom_ctl.c b/sys/geom/geom_ctl.c index b3cd33185fcf..48bac226f5ad 100644 --- a/sys/geom/geom_ctl.c +++ b/sys/geom/geom_ctl.c @@ -174,7 +174,7 @@ g_ctl_ioctl_configgeom(dev_t dev, u_long cmd, caddr_t data, int fflag, struct th else if (gcp->len == 0) { ga.ptr = NULL; } else { - ga.ptr = g_malloc(gcp->len, 0); + ga.ptr = g_malloc(gcp->len, M_WAITOK); error = copyin(gcp->ptr, ga.ptr, gcp->len); if (error) { g_free(ga.ptr); diff --git a/sys/geom/geom_dev.c b/sys/geom/geom_dev.c index 2bb3ac6823bc..55a90585546a 100644 --- a/sys/geom/geom_dev.c +++ b/sys/geom/geom_dev.c @@ -305,7 +305,7 @@ g_dev_ioctl(dev_t dev, u_long cmd, caddr_t data, int fflag, struct thread *td) break; default: - gio = g_malloc(sizeof *gio, M_ZERO); + gio = g_malloc(sizeof *gio, M_WAITOK | M_ZERO); gio->cmd = cmd; gio->data = data; gio->fflag = fflag; diff --git a/sys/geom/geom_disk.c b/sys/geom/geom_disk.c index 4688bcf08d6c..1f7e8b0c69c7 100644 --- a/sys/geom/geom_disk.c +++ b/sys/geom/geom_disk.c @@ -337,7 +337,7 @@ disk_create(int unit, struct disk *dp, int flags, struct cdevsw *cdevsw, void * { dev_t dev; - dev = g_malloc(sizeof *dev, M_ZERO); + dev = g_malloc(sizeof *dev, M_WAITOK | M_ZERO); dp->d_unit = unit; dp->d_dev = dev; dp->d_flags = flags; diff --git a/sys/geom/geom_event.c b/sys/geom/geom_event.c index 228bc065fcb2..1b657e91a1c0 100644 --- a/sys/geom/geom_event.c +++ b/sys/geom/geom_event.c @@ -266,7 +266,7 @@ g_post_event(enum g_events ev, struct g_class *mp, struct g_geom *gp, struct g_p g_trace(G_T_TOPOLOGY, "g_post_event(%d, %p, %p, %p, %p)", ev, mp, gp, pp, cp); g_topology_assert(); - ep = g_malloc(sizeof *ep, M_ZERO); + ep = g_malloc(sizeof *ep, M_WAITOK | M_ZERO); ep->event = ev; if (mp != NULL) { ep->class = mp; diff --git a/sys/geom/geom_gpt.c b/sys/geom/geom_gpt.c index a54d9a28439b..6b046c449809 100644 --- a/sys/geom/geom_gpt.c +++ b/sys/geom/geom_gpt.c @@ -220,7 +220,7 @@ g_gpt_taste(struct g_class *mp, struct g_provider *pp, int insist) ent = (void*)(buf + i * hdr->hdr_entsz); if (!memcmp(&ent->ent_type, &unused, sizeof(unused))) continue; - gs->part[i] = g_malloc(hdr->hdr_entsz, 0); + gs->part[i] = g_malloc(hdr->hdr_entsz, M_WAITOK); if (gs->part[i] == NULL) break; bcopy(ent, gs->part[i], hdr->hdr_entsz); diff --git a/sys/geom/geom_io.c b/sys/geom/geom_io.c index dc426376e1d5..399df597daaf 100644 --- a/sys/geom/geom_io.c +++ b/sys/geom/geom_io.c @@ -493,7 +493,7 @@ g_read_data(struct g_consumer *cp, off_t offset, off_t length, int *error) bp->bio_done = NULL; bp->bio_offset = offset; bp->bio_length = length; - ptr = g_malloc(length, 0); + ptr = g_malloc(length, M_WAITOK); bp->bio_data = ptr; g_io_request(bp, cp); errorc = biowait(bp, "gread"); diff --git a/sys/geom/geom_mirror.c b/sys/geom/geom_mirror.c index db426cda2a8c..23e2f5244023 100644 --- a/sys/geom/geom_mirror.c +++ b/sys/geom/geom_mirror.c @@ -214,7 +214,7 @@ g_mirror_taste(struct g_class *mp, struct g_provider *pp, int flags __unused) g_topology_unlock(); break; } - gp->softc = g_malloc(sizeof(struct g_mirror_softc), 0); + gp->softc = g_malloc(sizeof(struct g_mirror_softc), M_WAITOK); sc = gp->softc; memcpy(sc->magic, buf + 16, sizeof sc->magic); g_topology_lock(); diff --git a/sys/geom/geom_slice.c b/sys/geom/geom_slice.c index 43fbc5ff3a31..0a237513a5f0 100644 --- a/sys/geom/geom_slice.c +++ b/sys/geom/geom_slice.c @@ -71,10 +71,10 @@ g_slice_init(unsigned nslice, unsigned scsize) { struct g_slicer *gsp; - gsp = g_malloc(sizeof *gsp, M_ZERO); - gsp->softc = g_malloc(scsize, M_ZERO); + gsp = g_malloc(sizeof *gsp, M_WAITOK | M_ZERO); + gsp->softc = g_malloc(scsize, M_WAITOK | M_ZERO); gsp->slices = g_malloc(nslice * sizeof(struct g_slice), - M_ZERO); + M_WAITOK | M_ZERO); gsp->nslice = nslice; return (gsp); } @@ -377,7 +377,7 @@ g_slice_conf_hot(struct g_geom *gp, u_int idx, off_t offset, off_t length) gsp = gp->softc; gsl = gsp->hot; if(idx >= gsp->nhot) { - gsl2 = g_malloc((idx + 1) * sizeof *gsl2, M_ZERO); + gsl2 = g_malloc((idx + 1) * sizeof *gsl2, M_WAITOK | M_ZERO); if (gsp->hot != NULL) bcopy(gsp->hot, gsl2, gsp->nhot * sizeof *gsl2); gsp->hot = gsl2; diff --git a/sys/geom/geom_subr.c b/sys/geom/geom_subr.c index e2209fc417ac..1b9c01ef9d32 100644 --- a/sys/geom/geom_subr.c +++ b/sys/geom/geom_subr.c @@ -100,9 +100,9 @@ g_new_geomf(struct g_class *mp, const char *fmt, ...) sb = sbuf_new(NULL, NULL, 0, SBUF_AUTOEXTEND); sbuf_vprintf(sb, fmt, ap); sbuf_finish(sb); - gp = g_malloc(sizeof *gp, M_ZERO); + gp = g_malloc(sizeof *gp, M_WAITOK | M_ZERO); gp->protect = 0x020016601; - gp->name = g_malloc(sbuf_len(sb) + 1, M_ZERO); + gp->name = g_malloc(sbuf_len(sb) + 1, M_WAITOK | M_ZERO); gp->class = mp; gp->rank = 1; LIST_INIT(&gp->consumer); @@ -143,7 +143,7 @@ g_new_consumer(struct g_geom *gp) ("g_new_consumer on geom(%s) (class %s) without orphan", gp->name, gp->class->name)); - cp = g_malloc(sizeof *cp, M_ZERO); + cp = g_malloc(sizeof *cp, M_WAITOK | M_ZERO); cp->protect = 0x020016602; cp->geom = gp; cp->stat = g_stat_new(cp); @@ -179,7 +179,7 @@ g_new_providerf(struct g_geom *gp, const char *fmt, ...) sb = sbuf_new(NULL, NULL, 0, SBUF_AUTOEXTEND); sbuf_vprintf(sb, fmt, ap); sbuf_finish(sb); - pp = g_malloc(sizeof *pp + sbuf_len(sb) + 1, M_ZERO); + pp = g_malloc(sizeof *pp + sbuf_len(sb) + 1, M_WAITOK | M_ZERO); pp->protect = 0x020016603; pp->name = (char *)(pp + 1); strcpy(pp->name, sbuf_data(sb)); @@ -684,7 +684,7 @@ g_idclass(struct geomidorname *p) return (mp); return (NULL); } - n = g_malloc(p->len + 1, 0); + n = g_malloc(p->len + 1, M_WAITOK); if (copyin(p->u.name, n, p->len) == 0) { n[p->len] = '\0'; LIST_FOREACH(mp, &g_classes, class) @@ -711,7 +711,7 @@ g_idgeom(struct geomidorname *p) return (gp); return (NULL); } - n = g_malloc(p->len + 1, 0); + n = g_malloc(p->len + 1, M_WAITOK); if (copyin(p->u.name, n, p->len) == 0) { n[p->len] = '\0'; LIST_FOREACH(mp, &g_classes, class) @@ -741,7 +741,7 @@ g_idprovider(struct geomidorname *p) return (pp); return (NULL); } - n = g_malloc(p->len + 1, 0); + n = g_malloc(p->len + 1, M_WAITOK); if (copyin(p->u.name, n, p->len) == 0) { n[p->len] = '\0'; LIST_FOREACH(mp, &g_classes, class) diff --git a/sys/gnu/ext2fs/ext2_inode.c b/sys/gnu/ext2fs/ext2_inode.c index 66737619b96b..fc14dba51817 100644 --- a/sys/gnu/ext2fs/ext2_inode.c +++ b/sys/gnu/ext2fs/ext2_inode.c @@ -414,7 +414,7 @@ ext2_indirtrunc(ip, lbn, dbn, lastbn, level, countp) } bap = (int32_t *)bp->b_data; - MALLOC(copy, int32_t *, fs->s_blocksize, M_TEMP, 0); + MALLOC(copy, int32_t *, fs->s_blocksize, M_TEMP, M_WAITOK); bcopy((caddr_t)bap, (caddr_t)copy, (u_int)fs->s_blocksize); bzero((caddr_t)&bap[last + 1], (u_int)(NINDIR(fs) - (last + 1)) * sizeof (int32_t)); diff --git a/sys/gnu/ext2fs/ext2_lookup.c b/sys/gnu/ext2fs/ext2_lookup.c index c11aa5af4d23..49caccfb8684 100644 --- a/sys/gnu/ext2fs/ext2_lookup.c +++ b/sys/gnu/ext2fs/ext2_lookup.c @@ -181,7 +181,7 @@ ext2_readdir(ap) auio.uio_resid = count; auio.uio_segflg = UIO_SYSSPACE; aiov.iov_len = count; - MALLOC(dirbuf, caddr_t, count, M_TEMP, 0); + MALLOC(dirbuf, caddr_t, count, M_TEMP, M_WAITOK); aiov.iov_base = dirbuf; error = VOP_READ(ap->a_vp, &auio, 0, ap->a_cred); if (error == 0) { @@ -243,7 +243,7 @@ ext2_readdir(ap) if (uio->uio_segflg != UIO_SYSSPACE || uio->uio_iovcnt != 1) panic("ext2fs_readdir: unexpected uio from NFS server"); MALLOC(cookies, u_long *, ncookies * sizeof(u_long), M_TEMP, - 0); + M_WAITOK); off = startoffset; for (dp = (struct ext2_dir_entry_2 *)dirbuf, cookiep = cookies, ecookies = cookies + ncookies; diff --git a/sys/gnu/ext2fs/ext2_vfsops.c b/sys/gnu/ext2fs/ext2_vfsops.c index d281ddb9a279..d91a92ea0d8f 100644 --- a/sys/gnu/ext2fs/ext2_vfsops.c +++ b/sys/gnu/ext2fs/ext2_vfsops.c @@ -135,7 +135,7 @@ ext2_mountroot() printf("ext2_mountroot: can't find rootvp\n"); return (error); } - mp = bsd_malloc((u_long)sizeof(struct mount), M_MOUNT, 0); + mp = bsd_malloc((u_long)sizeof(struct mount), M_MOUNT, M_WAITOK); bzero((char *)mp, (u_long)sizeof(struct mount)); TAILQ_INIT(&mp->mnt_nvnodelist); TAILQ_INIT(&mp->mnt_reservedvnlist); @@ -473,7 +473,7 @@ static int compute_sb_data(devvp, es, fs) V(s_db_per_group) fs->s_group_desc = bsd_malloc(db_count * sizeof (struct buf *), - M_EXT2MNT, 0); + M_EXT2MNT, M_WAITOK); /* adjust logic_sb_block */ if(fs->s_blocksize > SBSIZE) @@ -683,16 +683,16 @@ ext2_mountfs(devvp, mp, td) goto out; } } - ump = bsd_malloc(sizeof *ump, M_EXT2MNT, 0); + ump = bsd_malloc(sizeof *ump, M_EXT2MNT, M_WAITOK); bzero((caddr_t)ump, sizeof *ump); /* I don't know whether this is the right strategy. Note that we dynamically allocate both an ext2_sb_info and an ext2_super_block while Linux keeps the super block in a locked buffer */ ump->um_e2fs = bsd_malloc(sizeof(struct ext2_sb_info), - M_EXT2MNT, 0); + M_EXT2MNT, M_WAITOK); ump->um_e2fs->s_es = bsd_malloc(sizeof(struct ext2_super_block), - M_EXT2MNT, 0); + M_EXT2MNT, M_WAITOK); bcopy(es, ump->um_e2fs->s_es, (u_int)sizeof(struct ext2_super_block)); if ((error = compute_sb_data(devvp, ump->um_e2fs->s_es, ump->um_e2fs))) goto out; @@ -1005,7 +1005,7 @@ ext2_vget(mp, ino, flags, vpp) * which will cause a panic because ext2_sync() blindly * dereferences vp->v_data (as well it should). */ - MALLOC(ip, struct inode *, sizeof(struct inode), M_EXT2NODE, 0); + MALLOC(ip, struct inode *, sizeof(struct inode), M_EXT2NODE, M_WAITOK); /* Allocate a new vnode/inode. */ if ((error = getnewvnode("ext2fs", mp, ext2_vnodeop_p, &vp)) != 0) { diff --git a/sys/gnu/fs/ext2fs/ext2_inode.c b/sys/gnu/fs/ext2fs/ext2_inode.c index 66737619b96b..fc14dba51817 100644 --- a/sys/gnu/fs/ext2fs/ext2_inode.c +++ b/sys/gnu/fs/ext2fs/ext2_inode.c @@ -414,7 +414,7 @@ ext2_indirtrunc(ip, lbn, dbn, lastbn, level, countp) } bap = (int32_t *)bp->b_data; - MALLOC(copy, int32_t *, fs->s_blocksize, M_TEMP, 0); + MALLOC(copy, int32_t *, fs->s_blocksize, M_TEMP, M_WAITOK); bcopy((caddr_t)bap, (caddr_t)copy, (u_int)fs->s_blocksize); bzero((caddr_t)&bap[last + 1], (u_int)(NINDIR(fs) - (last + 1)) * sizeof (int32_t)); diff --git a/sys/gnu/fs/ext2fs/ext2_lookup.c b/sys/gnu/fs/ext2fs/ext2_lookup.c index c11aa5af4d23..49caccfb8684 100644 --- a/sys/gnu/fs/ext2fs/ext2_lookup.c +++ b/sys/gnu/fs/ext2fs/ext2_lookup.c @@ -181,7 +181,7 @@ ext2_readdir(ap) auio.uio_resid = count; auio.uio_segflg = UIO_SYSSPACE; aiov.iov_len = count; - MALLOC(dirbuf, caddr_t, count, M_TEMP, 0); + MALLOC(dirbuf, caddr_t, count, M_TEMP, M_WAITOK); aiov.iov_base = dirbuf; error = VOP_READ(ap->a_vp, &auio, 0, ap->a_cred); if (error == 0) { @@ -243,7 +243,7 @@ ext2_readdir(ap) if (uio->uio_segflg != UIO_SYSSPACE || uio->uio_iovcnt != 1) panic("ext2fs_readdir: unexpected uio from NFS server"); MALLOC(cookies, u_long *, ncookies * sizeof(u_long), M_TEMP, - 0); + M_WAITOK); off = startoffset; for (dp = (struct ext2_dir_entry_2 *)dirbuf, cookiep = cookies, ecookies = cookies + ncookies; diff --git a/sys/gnu/fs/ext2fs/ext2_vfsops.c b/sys/gnu/fs/ext2fs/ext2_vfsops.c index d281ddb9a279..d91a92ea0d8f 100644 --- a/sys/gnu/fs/ext2fs/ext2_vfsops.c +++ b/sys/gnu/fs/ext2fs/ext2_vfsops.c @@ -135,7 +135,7 @@ ext2_mountroot() printf("ext2_mountroot: can't find rootvp\n"); return (error); } - mp = bsd_malloc((u_long)sizeof(struct mount), M_MOUNT, 0); + mp = bsd_malloc((u_long)sizeof(struct mount), M_MOUNT, M_WAITOK); bzero((char *)mp, (u_long)sizeof(struct mount)); TAILQ_INIT(&mp->mnt_nvnodelist); TAILQ_INIT(&mp->mnt_reservedvnlist); @@ -473,7 +473,7 @@ static int compute_sb_data(devvp, es, fs) V(s_db_per_group) fs->s_group_desc = bsd_malloc(db_count * sizeof (struct buf *), - M_EXT2MNT, 0); + M_EXT2MNT, M_WAITOK); /* adjust logic_sb_block */ if(fs->s_blocksize > SBSIZE) @@ -683,16 +683,16 @@ ext2_mountfs(devvp, mp, td) goto out; } } - ump = bsd_malloc(sizeof *ump, M_EXT2MNT, 0); + ump = bsd_malloc(sizeof *ump, M_EXT2MNT, M_WAITOK); bzero((caddr_t)ump, sizeof *ump); /* I don't know whether this is the right strategy. Note that we dynamically allocate both an ext2_sb_info and an ext2_super_block while Linux keeps the super block in a locked buffer */ ump->um_e2fs = bsd_malloc(sizeof(struct ext2_sb_info), - M_EXT2MNT, 0); + M_EXT2MNT, M_WAITOK); ump->um_e2fs->s_es = bsd_malloc(sizeof(struct ext2_super_block), - M_EXT2MNT, 0); + M_EXT2MNT, M_WAITOK); bcopy(es, ump->um_e2fs->s_es, (u_int)sizeof(struct ext2_super_block)); if ((error = compute_sb_data(devvp, ump->um_e2fs->s_es, ump->um_e2fs))) goto out; @@ -1005,7 +1005,7 @@ ext2_vget(mp, ino, flags, vpp) * which will cause a panic because ext2_sync() blindly * dereferences vp->v_data (as well it should). */ - MALLOC(ip, struct inode *, sizeof(struct inode), M_EXT2NODE, 0); + MALLOC(ip, struct inode *, sizeof(struct inode), M_EXT2NODE, M_WAITOK); /* Allocate a new vnode/inode. */ if ((error = getnewvnode("ext2fs", mp, ext2_vnodeop_p, &vp)) != 0) { diff --git a/sys/i386/i386/bios.c b/sys/i386/i386/bios.c index ae14099f93be..747a3a14394f 100644 --- a/sys/i386/i386/bios.c +++ b/sys/i386/i386/bios.c @@ -388,7 +388,7 @@ bios16(struct bios_args *args, char *fmt, ...) /* * no page table, so create one and install it. */ - pte = (pt_entry_t *)malloc(PAGE_SIZE, M_TEMP, 0); + pte = (pt_entry_t *)malloc(PAGE_SIZE, M_TEMP, M_WAITOK); ptd = (pd_entry_t *)((u_int)ptd + KERNBASE); *ptd = vtophys(pte) | PG_RW | PG_V; } else { diff --git a/sys/i386/i386/busdma_machdep.c b/sys/i386/i386/busdma_machdep.c index a5a20fcbab03..8f5898faa868 100644 --- a/sys/i386/i386/busdma_machdep.c +++ b/sys/i386/i386/busdma_machdep.c @@ -341,7 +341,7 @@ bus_dmamem_alloc_size(bus_dma_tag_t dmat, void** vaddr, int flags, if ((size <= PAGE_SIZE) && dmat->lowaddr >= ptoa(Maxmem)) { *vaddr = malloc(size, M_DEVBUF, - (flags & BUS_DMA_NOWAIT) ? M_NOWAIT : 0); + (flags & BUS_DMA_NOWAIT) ? M_NOWAIT : M_WAITOK); } else { /* * XXX Use Contigmalloc until it is merged into this facility @@ -349,7 +349,7 @@ bus_dmamem_alloc_size(bus_dma_tag_t dmat, void** vaddr, int flags, * multi-seg allocations yet though. */ *vaddr = contigmalloc(size, M_DEVBUF, - (flags & BUS_DMA_NOWAIT) ? M_NOWAIT : 0, + (flags & BUS_DMA_NOWAIT) ? M_NOWAIT : M_WAITOK, 0ul, dmat->lowaddr, dmat->alignment? dmat->alignment : 1ul, dmat->boundary); } diff --git a/sys/i386/i386/elan-mmcr.c b/sys/i386/i386/elan-mmcr.c index ca6476828dea..7ddd90cbda44 100644 --- a/sys/i386/i386/elan-mmcr.c +++ b/sys/i386/i386/elan-mmcr.c @@ -286,7 +286,7 @@ elan_write(dev_t dev, struct uio *uio, int ioflag) if (uio->uio_resid > 512) return (EINVAL); - s = malloc(uio->uio_resid + 1, M_DEVBUF, 0); + s = malloc(uio->uio_resid + 1, M_DEVBUF, M_WAITOK); if (s == NULL) return (ENOMEM); untimeout(timeout_errled, NULL, errled_h); diff --git a/sys/i386/i386/i686_mem.c b/sys/i386/i386/i686_mem.c index f3fc4e89db25..589fc64721cb 100644 --- a/sys/i386/i386/i686_mem.c +++ b/sys/i386/i386/i686_mem.c @@ -557,7 +557,7 @@ i686_mrinit(struct mem_range_softc *sc) sc->mr_desc = (struct mem_range_desc *)malloc(nmdesc * sizeof(struct mem_range_desc), - M_MEMDESC, M_ZERO); + M_MEMDESC, M_WAITOK | M_ZERO); sc->mr_ndesc = nmdesc; mrd = sc->mr_desc; diff --git a/sys/i386/i386/mem.c b/sys/i386/i386/mem.c index 4905d3c8158c..41fa63640b60 100644 --- a/sys/i386/i386/mem.c +++ b/sys/i386/i386/mem.c @@ -265,7 +265,7 @@ mmioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct thread *td) if (nd > 0) { md = (struct mem_range_desc *) malloc(nd * sizeof(struct mem_range_desc), - M_MEMDESC, 0); + M_MEMDESC, M_WAITOK); error = mem_range_attr_get(md, &nd); if (!error) error = copyout(md, mo->mo_desc, @@ -279,7 +279,7 @@ mmioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct thread *td) case MEMRANGE_SET: md = (struct mem_range_desc *)malloc(sizeof(struct mem_range_desc), - M_MEMDESC, 0); + M_MEMDESC, M_WAITOK); error = copyin(mo->mo_desc, md, sizeof(struct mem_range_desc)); /* clamp description string */ md->mr_owner[sizeof(md->mr_owner) - 1] = 0; diff --git a/sys/i386/i386/mp_machdep.c b/sys/i386/i386/mp_machdep.c index cc29843c7772..7ebd6ea9020a 100644 --- a/sys/i386/i386/mp_machdep.c +++ b/sys/i386/i386/mp_machdep.c @@ -919,13 +919,13 @@ mptable_pass2(void) pgeflag = 0; /* XXX - Not used under SMP yet. */ MALLOC(io_apic_versions, u_int32_t *, sizeof(u_int32_t) * mp_napics, - M_DEVBUF, 0); + M_DEVBUF, M_WAITOK); MALLOC(ioapic, volatile ioapic_t **, sizeof(ioapic_t *) * mp_napics, - M_DEVBUF, 0); + M_DEVBUF, M_WAITOK); MALLOC(io_apic_ints, io_int *, sizeof(io_int) * (nintrs + 1), - M_DEVBUF, 0); + M_DEVBUF, M_WAITOK); MALLOC(bus_data, bus_datum *, sizeof(bus_datum) * mp_nbusses, - M_DEVBUF, 0); + M_DEVBUF, M_WAITOK); bzero(ioapic, sizeof(ioapic_t *) * mp_napics); diff --git a/sys/i386/i386/mptable.c b/sys/i386/i386/mptable.c index cc29843c7772..7ebd6ea9020a 100644 --- a/sys/i386/i386/mptable.c +++ b/sys/i386/i386/mptable.c @@ -919,13 +919,13 @@ mptable_pass2(void) pgeflag = 0; /* XXX - Not used under SMP yet. */ MALLOC(io_apic_versions, u_int32_t *, sizeof(u_int32_t) * mp_napics, - M_DEVBUF, 0); + M_DEVBUF, M_WAITOK); MALLOC(ioapic, volatile ioapic_t **, sizeof(ioapic_t *) * mp_napics, - M_DEVBUF, 0); + M_DEVBUF, M_WAITOK); MALLOC(io_apic_ints, io_int *, sizeof(io_int) * (nintrs + 1), - M_DEVBUF, 0); + M_DEVBUF, M_WAITOK); MALLOC(bus_data, bus_datum *, sizeof(bus_datum) * mp_nbusses, - M_DEVBUF, 0); + M_DEVBUF, M_WAITOK); bzero(ioapic, sizeof(ioapic_t *) * mp_napics); diff --git a/sys/i386/i386/sys_machdep.c b/sys/i386/i386/sys_machdep.c index bd89b74341af..5fcad0311b0a 100644 --- a/sys/i386/i386/sys_machdep.c +++ b/sys/i386/i386/sys_machdep.c @@ -298,7 +298,7 @@ user_ldt_alloc(struct mdproc *mdp, int len) mtx_unlock_spin(&sched_lock); mtx_assert(&sched_lock, MA_NOTOWNED); MALLOC(new_ldt, struct proc_ldt *, sizeof(struct proc_ldt), - M_SUBPROC, 0); + M_SUBPROC, M_WAITOK); new_ldt->ldt_len = len = NEW_MAX_LD(len); new_ldt->ldt_base = (caddr_t)kmem_alloc(kernel_map, diff --git a/sys/i386/i386/vm86.c b/sys/i386/i386/vm86.c index 6126ddac51f7..dd7624f7bb9a 100644 --- a/sys/i386/i386/vm86.c +++ b/sys/i386/i386/vm86.c @@ -490,7 +490,7 @@ vm86_addpage(struct vm86context *vmc, int pagenum, vm_offset_t kva) goto full; /* XXX grow map? */ if (kva == 0) { - kva = (vm_offset_t)malloc(PAGE_SIZE, M_TEMP, 0); + kva = (vm_offset_t)malloc(PAGE_SIZE, M_TEMP, M_WAITOK); flags = VMAP_MALLOC; } diff --git a/sys/i386/ibcs2/ibcs2_misc.c b/sys/i386/ibcs2/ibcs2_misc.c index abebf2a34a72..295be86b1df7 100644 --- a/sys/i386/ibcs2/ibcs2_misc.c +++ b/sys/i386/ibcs2/ibcs2_misc.c @@ -333,7 +333,7 @@ ibcs2_getdents(td, uap) #define DIRBLKSIZ 512 /* XXX we used to use ufs's DIRBLKSIZ */ buflen = max(DIRBLKSIZ, uap->nbytes); buflen = min(buflen, MAXBSIZE); - buf = malloc(buflen, M_TEMP, 0); + buf = malloc(buflen, M_TEMP, M_WAITOK); vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td); again: aiov.iov_base = buf; @@ -494,7 +494,7 @@ ibcs2_read(td, uap) buflen = max(DIRBLKSIZ, uap->nbytes); buflen = min(buflen, MAXBSIZE); - buf = malloc(buflen, M_TEMP, 0); + buf = malloc(buflen, M_TEMP, M_WAITOK); vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td); again: aiov.iov_base = buf; diff --git a/sys/i386/ibcs2/ibcs2_util.c b/sys/i386/ibcs2/ibcs2_util.c index 55ff6abff0db..217243300822 100644 --- a/sys/i386/ibcs2/ibcs2_util.c +++ b/sys/i386/ibcs2/ibcs2_util.c @@ -66,7 +66,7 @@ ibcs2_emul_find(td, sgp, prefix, path, pbuf, cflag) char *ptr, *buf, *cp; size_t sz, len; - buf = (char *) malloc(MAXPATHLEN, M_TEMP, 0); + buf = (char *) malloc(MAXPATHLEN, M_TEMP, M_WAITOK); *pbuf = path; for (ptr = buf; (*ptr = *prefix) != '\0'; ptr++, prefix++) diff --git a/sys/i386/ibcs2/imgact_coff.c b/sys/i386/ibcs2/imgact_coff.c index b19cb56d74cc..fb5f537566f7 100644 --- a/sys/i386/ibcs2/imgact_coff.c +++ b/sys/i386/ibcs2/imgact_coff.c @@ -386,7 +386,7 @@ exec_coff_imgact(imgp) int emul_path_len = strlen(ibcs2_emul_path); libbuf = malloc(MAXPATHLEN + emul_path_len, - M_TEMP, 0); + M_TEMP, M_WAITOK); strcpy(libbuf, ibcs2_emul_path); for (j = off; j < scns[i].s_size + off;) { diff --git a/sys/i386/include/mptable.h b/sys/i386/include/mptable.h index cc29843c7772..7ebd6ea9020a 100644 --- a/sys/i386/include/mptable.h +++ b/sys/i386/include/mptable.h @@ -919,13 +919,13 @@ mptable_pass2(void) pgeflag = 0; /* XXX - Not used under SMP yet. */ MALLOC(io_apic_versions, u_int32_t *, sizeof(u_int32_t) * mp_napics, - M_DEVBUF, 0); + M_DEVBUF, M_WAITOK); MALLOC(ioapic, volatile ioapic_t **, sizeof(ioapic_t *) * mp_napics, - M_DEVBUF, 0); + M_DEVBUF, M_WAITOK); MALLOC(io_apic_ints, io_int *, sizeof(io_int) * (nintrs + 1), - M_DEVBUF, 0); + M_DEVBUF, M_WAITOK); MALLOC(bus_data, bus_datum *, sizeof(bus_datum) * mp_nbusses, - M_DEVBUF, 0); + M_DEVBUF, M_WAITOK); bzero(ioapic, sizeof(ioapic_t *) * mp_napics); diff --git a/sys/i386/isa/ctx.c b/sys/i386/isa/ctx.c index 6b5a2caf742b..e70c40ee5840 100644 --- a/sys/i386/isa/ctx.c +++ b/sys/i386/isa/ctx.c @@ -234,7 +234,7 @@ ctxopen(dev_t dev, int flags, int fmt, struct thread *td) /* get space for the LUT buffer */ - sr->lutp = malloc(LUTSIZE, M_DEVBUF, 0); + sr->lutp = malloc(LUTSIZE, M_DEVBUF, M_WAITOK); if (sr->lutp == NULL) return (ENOMEM); diff --git a/sys/i386/isa/gpib.c b/sys/i386/isa/gpib.c index 4b7b3cbb5f2f..0a5a0e054fbd 100644 --- a/sys/i386/isa/gpib.c +++ b/sys/i386/isa/gpib.c @@ -184,7 +184,7 @@ gpopen(dev, flags, fmt, td) return (EBUSY); /* Have memory for buffer? */ - sc->sc_inbuf = malloc(BUFSIZE, M_DEVBUF, 0); + sc->sc_inbuf = malloc(BUFSIZE, M_DEVBUF, M_WAITOK); if (sc->sc_inbuf == 0) return (ENOMEM); diff --git a/sys/i386/isa/if_cx.c b/sys/i386/isa/if_cx.c index a96d5fa280cc..b64f9787ddaa 100644 --- a/sys/i386/isa/if_cx.c +++ b/sys/i386/isa/if_cx.c @@ -136,11 +136,11 @@ static struct mbuf *makembuf (void *buf, unsigned len) { struct mbuf *m, *o, *p; - MGETHDR (m, M_NOWAIT, MT_DATA); + MGETHDR (m, M_DONTWAIT, MT_DATA); if (! m) return (0); if (len >= MINCLSIZE) - MCLGET (m, M_NOWAIT); + MCLGET (m, M_DONTWAIT); m->m_pkthdr.len = len; m->m_len = 0; @@ -153,13 +153,13 @@ static struct mbuf *makembuf (void *buf, unsigned len) if (! n) { /* Allocate new mbuf. */ o = p; - MGET (p, M_NOWAIT, MT_DATA); + MGET (p, M_DONTWAIT, MT_DATA); if (! p) { m_freem (m); return (0); } if (len >= MINCLSIZE) - MCLGET (p, M_NOWAIT); + MCLGET (p, M_DONTWAIT); p->m_len = 0; o->m_next = p; diff --git a/sys/i386/isa/if_el.c b/sys/i386/isa/if_el.c index 60abe60dbe5e..dd6236526d04 100644 --- a/sys/i386/isa/if_el.c +++ b/sys/i386/isa/if_el.c @@ -671,7 +671,7 @@ elget(buf, totlen, ifp) cp = buf; epkt = cp + totlen; - MGETHDR(m, M_NOWAIT, MT_DATA); + MGETHDR(m, M_DONTWAIT, MT_DATA); if (m == 0) return (0); m->m_pkthdr.rcvif = ifp; @@ -681,7 +681,7 @@ elget(buf, totlen, ifp) mp = ⊤ while (totlen > 0) { if (top) { - MGET(m, M_NOWAIT, MT_DATA); + MGET(m, M_DONTWAIT, MT_DATA); if (m == 0) { m_freem(top); return (0); @@ -690,7 +690,7 @@ elget(buf, totlen, ifp) } len = min(totlen, epkt - cp); if (len >= MINCLSIZE) { - MCLGET(m, M_NOWAIT); + MCLGET(m, M_DONTWAIT); if (m->m_flags & M_EXT) m->m_len = len = min(len, MCLBYTES); else diff --git a/sys/i386/isa/if_le.c b/sys/i386/isa/if_le.c index d3dd2f13b690..3ed6a96c1701 100644 --- a/sys/i386/isa/if_le.c +++ b/sys/i386/isa/if_le.c @@ -386,7 +386,7 @@ le_input( struct ifnet *ifp = &sc->le_if; struct mbuf *m; - MGETHDR(m, M_NOWAIT, MT_DATA); + MGETHDR(m, M_DONTWAIT, MT_DATA); if (m == NULL) { ifp->if_ierrors++; return; @@ -394,14 +394,14 @@ le_input( m->m_pkthdr.len = total_len; m->m_pkthdr.rcvif = ifp; if (total_len + LE_XTRA > MHLEN /* >= MINCLSIZE */) { - MCLGET(m, M_NOWAIT); + MCLGET(m, M_DONTWAIT); if ((m->m_flags & M_EXT) == 0) { m_free(m); ifp->if_ierrors++; return; } } else if (total_len + LE_XTRA > MHLEN && MINCLSIZE == (MHLEN+MLEN)) { - MGET(m->m_next, M_NOWAIT, MT_DATA); + MGET(m->m_next, M_DONTWAIT, MT_DATA); if (m->m_next == NULL) { m_free(m); ifp->if_ierrors++; diff --git a/sys/i386/isa/if_rdp.c b/sys/i386/isa/if_rdp.c index 84cd17490d86..574d3e76a9fa 100644 --- a/sys/i386/isa/if_rdp.c +++ b/sys/i386/isa/if_rdp.c @@ -1095,7 +1095,7 @@ rdp_get_packet(struct rdp_softc *sc, unsigned len) size_t s; /* Allocate a header mbuf */ - MGETHDR(m, M_NOWAIT, MT_DATA); + MGETHDR(m, M_DONTWAIT, MT_DATA); if (m == NULL) return; m->m_pkthdr.rcvif = ifp; @@ -1109,7 +1109,7 @@ rdp_get_packet(struct rdp_softc *sc, unsigned len) */ if ((len + ETHER_ALIGN) > MHLEN) { /* Attach an mbuf cluster */ - MCLGET(m, M_NOWAIT); + MCLGET(m, M_DONTWAIT); /* Insist on getting a cluster */ if ((m->m_flags & M_EXT) == 0) { diff --git a/sys/i386/isa/loran.c b/sys/i386/isa/loran.c index 9e32538d24a1..59c4b6e8b7bb 100644 --- a/sys/i386/isa/loran.c +++ b/sys/i386/isa/loran.c @@ -402,7 +402,7 @@ loranwrite(dev_t dev, struct uio * uio, int ioflag) idx = minor(dev); - MALLOC(this, struct datapoint *, sizeof *this, M_LORAN, 0); + MALLOC(this, struct datapoint *, sizeof *this, M_LORAN, M_WAITOK); c = imin(uio->uio_resid, (int)sizeof *this); err = uiomove((caddr_t)this, c, uio); if (err) { diff --git a/sys/i386/isa/pcvt/pcvt_kbd.c b/sys/i386/isa/pcvt/pcvt_kbd.c index d3362e3462d9..d1041964390f 100644 --- a/sys/i386/isa/pcvt/pcvt_kbd.c +++ b/sys/i386/isa/pcvt/pcvt_kbd.c @@ -330,7 +330,7 @@ void ovlinit(int force) { if(ovlinitflag == 0 && (ovltbl = (Ovl_tbl *)malloc(sizeof(Ovl_tbl) * OVLTBL_SIZE, - M_DEVBUF, 0)) == NULL) + M_DEVBUF, M_WAITOK)) == NULL) panic("pcvt_kbd: malloc of Ovl_tbl failed"); for(i=0; i= vesa_vmode_max) { vesa_vmode_max += MODE_TABLE_DELTA; p = malloc(sizeof(*vesa_vmode)*(vesa_vmode_max + 1), - M_DEVBUF, 0); + M_DEVBUF, M_WAITOK); #if VESA_DEBUG > 1 printf("vesa_bios_init(): modes:%d, vesa_mode_max:%d\n", modes, vesa_vmode_max); @@ -1341,7 +1341,7 @@ get_palette(video_adapter_t *adp, int base, int count, if (bits <= 6) return 1; - r = malloc(count*3, M_DEVBUF, 0); + r = malloc(count*3, M_DEVBUF, M_WAITOK); g = r + count; b = g + count; error = vesa_bios_save_palette2(base, count, r, g, b, bits); @@ -1378,7 +1378,7 @@ set_palette(video_adapter_t *adp, int base, int count, || ((bits = vesa_bios_set_dac(8)) <= 6)) return 1; - r = malloc(count*3, M_DEVBUF, 0); + r = malloc(count*3, M_DEVBUF, M_WAITOK); g = r + count; b = g + count; copyin(red, r, count); diff --git a/sys/i386/isa/wt.c b/sys/i386/isa/wt.c index 37627d25b486..ab5d4c3e1a57 100644 --- a/sys/i386/isa/wt.c +++ b/sys/i386/isa/wt.c @@ -343,7 +343,7 @@ wtopen (dev_t dev, int flag, int fmt, struct thread *td) return (ENXIO); t->bsize = (minor (dev) & WT_BSIZE) ? 1024 : 512; - t->buf = malloc (t->bsize, M_TEMP, 0); + t->buf = malloc (t->bsize, M_TEMP, M_WAITOK); if (! t->buf) return (EAGAIN); diff --git a/sys/i386/linux/linux_sysvec.c b/sys/i386/linux/linux_sysvec.c index 70fe108e90c9..63ff5d701f1b 100644 --- a/sys/i386/linux/linux_sysvec.c +++ b/sys/i386/linux/linux_sysvec.c @@ -731,7 +731,7 @@ linux_aout_coredump(struct thread *td, struct vnode *vp, off_t limit) vm->vm_dsize + vm->vm_ssize) >= limit) return (EFAULT); tempuser = malloc(ctob(uarea_pages + kstack_pages), M_TEMP, - M_ZERO); + M_WAITOK | M_ZERO); if (tempuser == NULL) return (ENOMEM); PROC_LOCK(p); diff --git a/sys/i4b/driver/i4b_ipr.c b/sys/i4b/driver/i4b_ipr.c index e35b4e51857b..33033d221a85 100644 --- a/sys/i4b/driver/i4b_ipr.c +++ b/sys/i4b/driver/i4b_ipr.c @@ -255,7 +255,7 @@ i4biprattach(void *dummy) #ifdef IPR_VJ_USEBUFFER if(!((sc->sc_cbuf = - (u_char *)malloc(I4BIPRMAXMTU+128, M_DEVBUF, 0)))) + (u_char *)malloc(I4BIPRMAXMTU+128, M_DEVBUF, M_WAITOK)))) { panic("if_ipr.c, ipr_attach: VJ malloc failed"); } diff --git a/sys/i4b/layer1/ihfc/i4b_ihfc_l1if.c b/sys/i4b/layer1/ihfc/i4b_ihfc_l1if.c index ee698c7603c1..c5c3d4714eef 100644 --- a/sys/i4b/layer1/ihfc/i4b_ihfc_l1if.c +++ b/sys/i4b/layer1/ihfc/i4b_ihfc_l1if.c @@ -121,7 +121,7 @@ ihfc_ph_data_req(int unit, struct mbuf *m, int freeflag) /* "Allow" I-frames (-hp) */ - if (freeflag == MBUF_DONTFREE) m = m_copypacket(m, M_NOWAIT); + if (freeflag == MBUF_DONTFREE) m = m_copypacket(m, M_DONTWAIT); if (!_IF_QFULL(&S_IFQUEUE) && m) { diff --git a/sys/i4b/layer2/i4b_mbuf.c b/sys/i4b/layer2/i4b_mbuf.c index c12a9ae97bd9..95f234ce43f3 100644 --- a/sys/i4b/layer2/i4b_mbuf.c +++ b/sys/i4b/layer2/i4b_mbuf.c @@ -78,7 +78,7 @@ i4b_Dgetmbuf(int len) return(NULL); } - MGETHDR(m, M_NOWAIT, MT_I4B_D); /* get mbuf with pkthdr */ + MGETHDR(m, M_DONTWAIT, MT_I4B_D); /* get mbuf with pkthdr */ /* did we actually get the mbuf ? */ @@ -94,7 +94,7 @@ i4b_Dgetmbuf(int len) if(len >= MHLEN) { - MCLGET(m, M_NOWAIT); + MCLGET(m, M_DONTWAIT); if(!(m->m_flags & M_EXT)) { @@ -155,7 +155,7 @@ i4b_Bgetmbuf(int len) return(NULL); } - MGETHDR(m, M_NOWAIT, MT_I4B_B); /* get mbuf with pkthdr */ + MGETHDR(m, M_DONTWAIT, MT_I4B_B); /* get mbuf with pkthdr */ /* did we actually get the mbuf ? */ @@ -171,7 +171,7 @@ i4b_Bgetmbuf(int len) if(len >= MHLEN) { - MCLGET(m, M_NOWAIT); + MCLGET(m, M_DONTWAIT); if(!(m->m_flags & M_EXT)) { diff --git a/sys/i4b/layer4/i4b_i4bdrv.c b/sys/i4b/layer4/i4b_i4bdrv.c index 95afcc99a892..1dffc0f4625d 100644 --- a/sys/i4b/layer4/i4b_i4bdrv.c +++ b/sys/i4b/layer4/i4b_i4bdrv.c @@ -646,10 +646,10 @@ i4bioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) } prots = malloc(r->numprotos * sizeof(struct isdn_dr_prot), - M_DEVBUF, 0); + M_DEVBUF, M_WAITOK); prots2 = malloc(r->numprotos * sizeof(struct isdn_dr_prot), - M_DEVBUF, 0); + M_DEVBUF, M_WAITOK); if(!prots || !prots2) { @@ -661,7 +661,7 @@ i4bioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) for(i = 0; i < r->numprotos; i++) { - prots2[i].microcode = malloc(prots[i].bytecount, M_DEVBUF, 0); + prots2[i].microcode = malloc(prots[i].bytecount, M_DEVBUF, M_WAITOK); copyin(prots[i].microcode, prots2[i].microcode, prots[i].bytecount); prots2[i].bytecount = prots[i].bytecount; } @@ -721,7 +721,7 @@ i4bioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) goto diag_done; } - req.in_param = malloc(r->in_param_len, M_DEVBUF, 0); + req.in_param = malloc(r->in_param_len, M_DEVBUF, M_WAITOK); if(!req.in_param) { @@ -735,7 +735,7 @@ i4bioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) if(req.out_param_len) { - req.out_param = malloc(r->out_param_len, M_DEVBUF, 0); + req.out_param = malloc(r->out_param_len, M_DEVBUF, M_WAITOK); if(!req.out_param) { diff --git a/sys/ia64/ia32/ia32_misc.c b/sys/ia64/ia32/ia32_misc.c index d593c04ee1b3..c6f26fe7038e 100644 --- a/sys/ia64/ia32/ia32_misc.c +++ b/sys/ia64/ia32/ia32_misc.c @@ -105,7 +105,7 @@ ia32_emul_find(td, sgp, prefix, path, pbuf, cflag) struct vattr vat; struct vattr vatroot; - buf = (char *) malloc(MAXPATHLEN, M_TEMP, 0); + buf = (char *) malloc(MAXPATHLEN, M_TEMP, M_WAITOK); *pbuf = path; for (ptr = buf; (*ptr = *prefix) != '\0'; ptr++, prefix++) @@ -768,8 +768,8 @@ ia32_readv(struct thread *td, struct ia32_readv_args *uap) osize = uap->iovcnt * sizeof (struct iovec32); nsize = uap->iovcnt * sizeof (struct iovec); - oio = malloc(osize, M_TEMP, 0); - nio = malloc(nsize, M_TEMP, 0); + oio = malloc(osize, M_TEMP, M_WAITOK); + nio = malloc(nsize, M_TEMP, M_WAITOK); error = 0; if ((error = copyin(uap->iovp, oio, osize))) @@ -814,8 +814,8 @@ ia32_writev(struct thread *td, struct ia32_writev_args *uap) osize = uap->iovcnt * sizeof (struct iovec32); nsize = uap->iovcnt * sizeof (struct iovec); - oio = malloc(osize, M_TEMP, 0); - nio = malloc(nsize, M_TEMP, 0); + oio = malloc(osize, M_TEMP, M_WAITOK); + nio = malloc(nsize, M_TEMP, M_WAITOK); error = 0; if ((error = copyin(uap->iovp, oio, osize))) diff --git a/sys/ia64/ia64/busdma_machdep.c b/sys/ia64/ia64/busdma_machdep.c index d12ea4f7ab13..70b8d4c06a79 100644 --- a/sys/ia64/ia64/busdma_machdep.c +++ b/sys/ia64/ia64/busdma_machdep.c @@ -347,7 +347,7 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddr, int flags, if ((dmat->maxsize <= PAGE_SIZE) && dmat->lowaddr >= ptoa(Maxmem)) { *vaddr = malloc(dmat->maxsize, M_DEVBUF, - (flags & BUS_DMA_NOWAIT) ? M_NOWAIT : 0); + (flags & BUS_DMA_NOWAIT) ? M_NOWAIT : M_WAITOK); } else { /* * XXX Use Contigmalloc until it is merged into this facility @@ -355,7 +355,7 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddr, int flags, * multi-seg allocations yet though. */ *vaddr = contigmalloc(dmat->maxsize, M_DEVBUF, - (flags & BUS_DMA_NOWAIT) ? M_NOWAIT : 0, + (flags & BUS_DMA_NOWAIT) ? M_NOWAIT : M_WAITOK, 0ul, dmat->lowaddr, dmat->alignment? dmat->alignment : 1ul, dmat->boundary); } diff --git a/sys/ia64/ia64/mca.c b/sys/ia64/ia64/mca.c index 4109e3de8931..ff66b7a45470 100644 --- a/sys/ia64/ia64/mca.c +++ b/sys/ia64/ia64/mca.c @@ -109,7 +109,7 @@ ia64_mca_save_state(int type) mtx_unlock_spin(&mca_info_block_lock); totsz = sizeof(struct sysctl_oid) + recsz + 32; - oidp = malloc(totsz, M_MCA, M_ZERO); + oidp = malloc(totsz, M_MCA, M_WAITOK|M_ZERO); state = (char*)(oidp + 1); name = state + recsz; sprintf(name, "%lld", (long long)seqnr); @@ -199,8 +199,8 @@ ia64_mca_init(void) max_size = round_page(max_size); if (max_size) { - p = contigmalloc(max_size, M_TEMP, 0, 0ul, 256*1024*1024 - 1, - PAGE_SIZE, 256*1024*1024); + p = contigmalloc(max_size, M_TEMP, M_WAITOK, 0ul, + 256*1024*1024 - 1, PAGE_SIZE, 256*1024*1024); mca_info_block = IA64_PHYS_TO_RR7(ia64_tpa((u_int64_t)p)); if (bootverbose) diff --git a/sys/ia64/ia64/mp_machdep.c b/sys/ia64/ia64/mp_machdep.c index 2a7ff9f95f9c..4ef629bdcbe6 100644 --- a/sys/ia64/ia64/mp_machdep.c +++ b/sys/ia64/ia64/mp_machdep.c @@ -222,7 +222,7 @@ cpu_mp_start() * recording a trapframe. */ ks = contigmalloc(KSTACK_PAGES * PAGE_SIZE, M_TEMP, - 0, + M_WAITOK, 0ul, 256*1024*1024 - 1, PAGE_SIZE, diff --git a/sys/ia64/ia64/pmap.c b/sys/ia64/ia64/pmap.c index 82135fe26a47..0be8b8335e86 100644 --- a/sys/ia64/ia64/pmap.c +++ b/sys/ia64/ia64/pmap.c @@ -748,7 +748,7 @@ pmap_new_thread(struct thread *td, int pages) * 7 address for it which makes it impossible to accidentally * lose when recording a trapframe. */ - ks = contigmalloc(pages * PAGE_SIZE, M_PMAP, 0, 0ul, + ks = contigmalloc(pages * PAGE_SIZE, M_PMAP, M_WAITOK, 0ul, 256*1024*1024 - 1, PAGE_SIZE, 256*1024*1024); if (ks == NULL) panic("pmap_new_thread: could not contigmalloc %d pages\n", @@ -1214,7 +1214,7 @@ pmap_find_pte(vm_offset_t va) pte = pmap_find_vhpt(va); if (!pte) { - pte = uma_zalloc(ptezone, 0); + pte = uma_zalloc(ptezone, M_WAITOK); pte->pte_p = 0; } return pte; diff --git a/sys/ia64/ia64/sscdisk.c b/sys/ia64/ia64/sscdisk.c index 64435b0f1cee..3943cbd122db 100644 --- a/sys/ia64/ia64/sscdisk.c +++ b/sys/ia64/ia64/sscdisk.c @@ -195,7 +195,7 @@ ssccreate(int unit) if (sc->unit == unit) return (NULL); } - MALLOC(sc, struct ssc_s *,sizeof(*sc), M_SSC, M_ZERO); + MALLOC(sc, struct ssc_s *,sizeof(*sc), M_SSC, M_WAITOK | M_ZERO); LIST_INSERT_HEAD(&ssc_softc_list, sc, list); sc->unit = unit; bioq_init(&sc->bio_queue); diff --git a/sys/isofs/cd9660/cd9660_vfsops.c b/sys/isofs/cd9660/cd9660_vfsops.c index f9161176bc53..a44df4caa371 100644 --- a/sys/isofs/cd9660/cd9660_vfsops.c +++ b/sys/isofs/cd9660/cd9660_vfsops.c @@ -411,7 +411,7 @@ iso_mountfs(devvp, mp, td, argp) pri_sierra->root_directory_record: pri->root_directory_record); - isomp = malloc(sizeof *isomp, M_ISOFSMNT, M_ZERO); + isomp = malloc(sizeof *isomp, M_ISOFSMNT, M_WAITOK | M_ZERO); isomp->logical_block_size = logical_block_size; isomp->volume_space_size = isonum_733 (high_sierra? @@ -712,7 +712,7 @@ cd9660_vget_internal(mp, ino, flags, vpp, relocated, isodir) return (error); } MALLOC(ip, struct iso_node *, sizeof(struct iso_node), M_ISOFSNODE, - M_ZERO); + M_WAITOK | M_ZERO); vp->v_data = ip; ip->i_vnode = vp; ip->i_dev = dev; diff --git a/sys/isofs/cd9660/cd9660_vnops.c b/sys/isofs/cd9660/cd9660_vnops.c index 062c22aa27c1..0b892e6e8012 100644 --- a/sys/isofs/cd9660/cd9660_vnops.c +++ b/sys/isofs/cd9660/cd9660_vnops.c @@ -194,7 +194,7 @@ cd9660_getattr(ap) struct uio auio; char *cp; - MALLOC(cp, char *, MAXPATHLEN, M_TEMP, 0); + MALLOC(cp, char *, MAXPATHLEN, M_TEMP, M_WAITOK); aiov.iov_base = cp; aiov.iov_len = MAXPATHLEN; auio.uio_iov = &aiov; @@ -451,7 +451,7 @@ cd9660_readdir(ap) imp = dp->i_mnt; bmask = imp->im_bmask; - MALLOC(idp, struct isoreaddir *, sizeof(*idp), M_TEMP, 0); + MALLOC(idp, struct isoreaddir *, sizeof(*idp), M_TEMP, M_WAITOK); idp->saveent.d_namlen = idp->assocent.d_namlen = 0; /* * XXX @@ -468,7 +468,7 @@ cd9660_readdir(ap) */ ncookies = uio->uio_resid / 16; MALLOC(cookies, u_long *, ncookies * sizeof(u_int), M_TEMP, - 0); + M_WAITOK); idp->cookies = cookies; idp->ncookies = ncookies; } @@ -671,7 +671,7 @@ cd9660_readlink(ap) if (uio->uio_segflg == UIO_SYSSPACE) symname = uio->uio_iov->iov_base; else - symname = uma_zalloc(namei_zone, 0); + symname = uma_zalloc(namei_zone, M_WAITOK); /* * Ok, we just gathering a symbolic name in SL record. diff --git a/sys/kern/imgact_aout.c b/sys/kern/imgact_aout.c index a11c17dc8676..e96054a19bed 100644 --- a/sys/kern/imgact_aout.c +++ b/sys/kern/imgact_aout.c @@ -276,7 +276,7 @@ aout_coredump(td, vp, limit) + vm->vm_dsize + vm->vm_ssize) >= limit) return (EFAULT); tempuser = malloc(ctob(uarea_pages + kstack_pages), M_TEMP, - M_ZERO); + M_WAITOK | M_ZERO); if (tempuser == NULL) return (ENOMEM); PROC_LOCK(p); diff --git a/sys/kern/imgact_elf.c b/sys/kern/imgact_elf.c index e0d49d4a92f5..f6b0cb2175b4 100644 --- a/sys/kern/imgact_elf.c +++ b/sys/kern/imgact_elf.c @@ -516,7 +516,7 @@ __elfN(load_file)(struct proc *p, const char *file, u_long *addr, if (curthread->td_proc != p) panic("elf_load_file - thread"); /* XXXKSE DIAGNOSTIC */ - tempdata = malloc(sizeof(*tempdata), M_TEMP, 0); + tempdata = malloc(sizeof(*tempdata), M_TEMP, M_WAITOK); nd = &tempdata->nd; attr = &tempdata->attr; imgp = &tempdata->image_params; @@ -812,7 +812,7 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *imgp) imgp->proc->p_sysent = sv; if (interp != NULL) { - path = malloc(MAXPATHLEN, M_TEMP, 0); + path = malloc(MAXPATHLEN, M_TEMP, M_WAITOK); snprintf(path, MAXPATHLEN, "%s%s", brand_info->emul_path, interp); if ((error = __elfN(load_file)(imgp->proc, path, &addr, @@ -831,7 +831,7 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *imgp) /* * Construct auxargs table (used by the fixup routine) */ - elf_auxargs = malloc(sizeof(Elf_Auxargs), M_TEMP, 0); + elf_auxargs = malloc(sizeof(Elf_Auxargs), M_TEMP, M_WAITOK); elf_auxargs->execfd = -1; elf_auxargs->phdr = proghdr; elf_auxargs->phent = hdr->e_phentsize; @@ -951,7 +951,7 @@ __elfN(coredump)(td, vp, limit) * Allocate memory for building the header, fill it up, * and write it out. */ - hdr = malloc(hdrsize, M_TEMP, 0); + hdr = malloc(hdrsize, M_TEMP, M_WAITOK); if (hdr == NULL) { return (EINVAL); } @@ -1113,7 +1113,7 @@ __elfN(corehdr)(td, vp, cred, numsegs, hdr, hdrsize) prfpregset_t *fpregset; prpsinfo_t *psinfo; - tempdata = malloc(sizeof(*tempdata), M_TEMP, M_ZERO | 0); + tempdata = malloc(sizeof(*tempdata), M_TEMP, M_ZERO | M_WAITOK); status = &tempdata->status; fpregset = &tempdata->fpregset; psinfo = &tempdata->psinfo; diff --git a/sys/kern/inflate.c b/sys/kern/inflate.c index e8142944b009..2a16ba2c2d08 100644 --- a/sys/kern/inflate.c +++ b/sys/kern/inflate.c @@ -551,7 +551,7 @@ huft_build(glbl, b, n, s, d, e, t, m) l[h] = j; /* set table size in stack */ /* allocate and link in new table */ - if ((q = (struct huft *) malloc((z + 1) * sizeof(struct huft), M_GZIP, 0)) == + if ((q = (struct huft *) malloc((z + 1) * sizeof(struct huft), M_GZIP, M_WAITOK)) == (struct huft *) NULL) { if (h) huft_free(glbl, u[0]); @@ -1049,7 +1049,7 @@ inflate(glbl) u_char *p = NULL; if (!glbl->gz_slide) - p = glbl->gz_slide = malloc(GZ_WSIZE, M_GZIP, 0); + p = glbl->gz_slide = malloc(GZ_WSIZE, M_GZIP, M_WAITOK); #endif if (!glbl->gz_slide) #ifdef _KERNEL diff --git a/sys/kern/kern_alq.c b/sys/kern/kern_alq.c index 7e86b55be861..7ddacc811b15 100644 --- a/sys/kern/kern_alq.c +++ b/sys/kern/kern_alq.c @@ -352,9 +352,9 @@ alq_open(struct alq **alqp, const char *file, int size, int count) /* We just unlock so we hold a reference */ VOP_UNLOCK(nd.ni_vp, 0, td); - alq = malloc(sizeof(*alq), M_ALD, M_ZERO); - alq->aq_entbuf = malloc(count * size, M_ALD, M_ZERO); - alq->aq_first = malloc(sizeof(*ale) * count, M_ALD, M_ZERO); + alq = malloc(sizeof(*alq), M_ALD, M_WAITOK|M_ZERO); + alq->aq_entbuf = malloc(count * size, M_ALD, M_WAITOK|M_ZERO); + alq->aq_first = malloc(sizeof(*ale) * count, M_ALD, M_WAITOK|M_ZERO); alq->aq_vp = nd.ni_vp; alq->aq_cred = crhold(td->td_ucred); alq->aq_entmax = count; diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index 342673eabcd3..97298d59d2f1 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -697,7 +697,7 @@ fsetown(pgid, sigiop) ret = 0; /* Allocate and fill in the new sigio out of locks. */ - MALLOC(sigio, struct sigio *, sizeof(struct sigio), M_SIGIO, 0); + MALLOC(sigio, struct sigio *, sizeof(struct sigio), M_SIGIO, M_WAITOK); sigio->sio_pgid = pgid; sigio->sio_ucred = crhold(curthread->td_ucred); sigio->sio_myref = sigiop; @@ -1082,7 +1082,7 @@ fdalloc(td, want, result) * than KMEM_ZMAX bytes. uma_large_malloc() requires Giant. */ mtx_lock(&Giant); - newofile = malloc(nfiles * OFILESIZE, M_FILEDESC, 0); + newofile = malloc(nfiles * OFILESIZE, M_FILEDESC, M_WAITOK); mtx_unlock(&Giant); /* @@ -1173,7 +1173,7 @@ falloc(td, resultfp, resultfd) struct file *fp, *fq; int error, i; - fp = uma_zalloc(file_zone, M_ZERO); + fp = uma_zalloc(file_zone, M_WAITOK | M_ZERO); sx_xlock(&filelist_lock); if (nfiles >= maxfiles) { sx_xunlock(&filelist_lock); @@ -1243,7 +1243,7 @@ fdinit(fdp) struct filedesc0 *newfdp; MALLOC(newfdp, struct filedesc0 *, sizeof(struct filedesc0), - M_FILEDESC, M_ZERO); + M_FILEDESC, M_WAITOK | M_ZERO); mtx_init(&newfdp->fd_fd.fd_mtx, FILEDESC_LOCK_DESC, NULL, MTX_DEF); newfdp->fd_fd.fd_cdir = fdp->fd_cdir; if (newfdp->fd_fd.fd_cdir) @@ -1299,7 +1299,7 @@ fdcopy(fdp) FILEDESC_UNLOCK(fdp); MALLOC(newfdp, struct filedesc *, sizeof(struct filedesc0), - M_FILEDESC, 0); + M_FILEDESC, M_WAITOK); FILEDESC_LOCK(fdp); bcopy(fdp, newfdp, sizeof(struct filedesc)); FILEDESC_UNLOCK(fdp); @@ -1339,7 +1339,7 @@ fdcopy(fdp) i /= 2; FILEDESC_UNLOCK(fdp); MALLOC(newfdp->fd_ofiles, struct file **, i * OFILESIZE, - M_FILEDESC, 0); + M_FILEDESC, M_WAITOK); FILEDESC_LOCK(fdp); newfdp->fd_lastfile = fdp->fd_lastfile; newfdp->fd_nfiles = fdp->fd_nfiles; diff --git a/sys/kern/kern_environment.c b/sys/kern/kern_environment.c index 70ba635c5375..98f5fc64a807 100644 --- a/sys/kern/kern_environment.c +++ b/sys/kern/kern_environment.c @@ -131,7 +131,7 @@ kenv(td, uap) return (error); } - name = malloc(KENV_MNAMELEN, M_TEMP, 0); + name = malloc(KENV_MNAMELEN, M_TEMP, M_WAITOK); error = copyinstr(uap->name, name, KENV_MNAMELEN, NULL); if (error) @@ -166,7 +166,7 @@ kenv(td, uap) } if (len > KENV_MVALLEN) len = KENV_MVALLEN; - value = malloc(len, M_TEMP, 0); + value = malloc(len, M_TEMP, M_WAITOK); error = copyinstr(uap->value, value, len, NULL); if (error) { free(value, M_TEMP); @@ -207,11 +207,11 @@ init_dynamic_kenv(void *data __unused) char *cp; int len, i; - kenvp = malloc(KENV_SIZE * sizeof(char *), M_KENV, M_ZERO); + kenvp = malloc(KENV_SIZE * sizeof(char *), M_KENV, M_WAITOK | M_ZERO); i = 0; for (cp = kern_envp; cp != NULL; cp = kernenv_next(cp)) { len = strlen(cp) + 1; - kenvp[i] = malloc(len, M_KENV, 0); + kenvp[i] = malloc(len, M_KENV, M_WAITOK); strcpy(kenvp[i++], cp); } kenvp[i] = NULL; @@ -290,7 +290,7 @@ getenv(const char *name) strcpy(buf, cp); sx_sunlock(&kenv_lock); len = strlen(buf) + 1; - ret = malloc(len, M_KENV, 0); + ret = malloc(len, M_KENV, M_WAITOK); strcpy(ret, buf); } else { sx_sunlock(&kenv_lock); @@ -337,7 +337,7 @@ setenv(const char *name, const char *value) vallen = strlen(value) + 1; if (vallen > KENV_MVALLEN) return (-1); - buf = malloc(namelen + vallen, M_KENV, 0); + buf = malloc(namelen + vallen, M_KENV, M_WAITOK); sprintf(buf, "%s=%s", name, value); sx_xlock(&kenv_lock); diff --git a/sys/kern/kern_event.c b/sys/kern/kern_event.c index 4910b7e1ec4c..8c552d1a4ea7 100644 --- a/sys/kern/kern_event.c +++ b/sys/kern/kern_event.c @@ -330,7 +330,7 @@ filt_timerattach(struct knote *kn) kn->kn_flags |= EV_CLEAR; /* automatically set */ MALLOC(calloutp, struct callout *, sizeof(*calloutp), - M_KQUEUE, 0); + M_KQUEUE, M_WAITOK); callout_init(calloutp, 0); callout_reset(calloutp, tticks, filt_timerexpire, kn); kn->kn_hook = calloutp; @@ -372,7 +372,7 @@ kqueue(struct thread *td, struct kqueue_args *uap) error = falloc(td, &fp, &fd); if (error) goto done2; - kq = malloc(sizeof(struct kqueue), M_KQUEUE, M_ZERO); + kq = malloc(sizeof(struct kqueue), M_KQUEUE, M_WAITOK | M_ZERO); TAILQ_INIT(&kq->kq_head); FILE_LOCK(fp); fp->f_flag = FREAD | FWRITE; @@ -980,7 +980,7 @@ knote_attach(struct knote *kn, struct filedesc *fdp) size += KQEXTENT; FILEDESC_UNLOCK(fdp); MALLOC(list, struct klist *, - size * sizeof(struct klist *), M_KQUEUE, 0); + size * sizeof(struct klist *), M_KQUEUE, M_WAITOK); FILEDESC_LOCK(fdp); if (fdp->fd_knlistsize > kn->kn_id) { FREE(list, M_KQUEUE); @@ -1074,7 +1074,7 @@ SYSINIT(knote, SI_SUB_PSEUDO, SI_ORDER_ANY, knote_init, NULL) static struct knote * knote_alloc(void) { - return ((struct knote *)uma_zalloc(knote_zone, 0)); + return ((struct knote *)uma_zalloc(knote_zone, M_WAITOK)); } static void diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index b6d77d2d975a..f239ab7ad3e7 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -425,7 +425,7 @@ kern_execve(td, fname, argv, envv, mac_p) oldprocsig = p->p_procsig; PROC_UNLOCK(p); MALLOC(newprocsig, struct procsig *, sizeof(struct procsig), - M_SUBPROC, 0); + M_SUBPROC, M_WAITOK); bcopy(oldprocsig, newprocsig, sizeof(*newprocsig)); newprocsig->ps_refcnt = 1; oldprocsig->ps_refcnt--; @@ -1171,7 +1171,7 @@ exec_register(execsw_arg) if (execsw) for (es = execsw; *es; es++) count++; - newexecsw = malloc(count * sizeof(*es), M_TEMP, 0); + newexecsw = malloc(count * sizeof(*es), M_TEMP, M_WAITOK); if (newexecsw == NULL) return (ENOMEM); xs = newexecsw; @@ -1205,7 +1205,7 @@ exec_unregister(execsw_arg) for (es = execsw; *es; es++) if (*es != execsw_arg) count++; - newexecsw = malloc(count * sizeof(*es), M_TEMP, 0); + newexecsw = malloc(count * sizeof(*es), M_TEMP, M_WAITOK); if (newexecsw == NULL) return (ENOMEM); xs = newexecsw; diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c index abf9025c7a09..2e0e7098fa49 100644 --- a/sys/kern/kern_exit.c +++ b/sys/kern/kern_exit.c @@ -228,7 +228,7 @@ exit1(td, rv) MALLOC(p->p_ru, struct rusage *, sizeof(struct rusage), - M_ZOMBIE, 0); + M_ZOMBIE, M_WAITOK); /* * If parent is waiting for us to exit or exec, * P_PPWAIT is set; we will wakeup the parent below. diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c index 6089c922664a..5c36a246ea7f 100644 --- a/sys/kern/kern_fork.c +++ b/sys/kern/kern_fork.c @@ -313,7 +313,7 @@ fork1(td, flags, pages, procp) } /* Allocate new proc. */ - newproc = uma_zalloc(proc_zone, 0); + newproc = uma_zalloc(proc_zone, M_WAITOK); #ifdef MAC mac_init_proc(newproc); #endif @@ -438,12 +438,12 @@ fork1(td, flags, pages, procp) */ if (flags & RFSIGSHARE) { MALLOC(newsigacts, struct sigacts *, - sizeof(struct sigacts), M_SUBPROC, 0); + sizeof(struct sigacts), M_SUBPROC, M_WAITOK); newprocsig = NULL; } else { newsigacts = NULL; MALLOC(newprocsig, struct procsig *, sizeof(struct procsig), - M_SUBPROC, 0); + M_SUBPROC, M_WAITOK); } /* diff --git a/sys/kern/kern_intr.c b/sys/kern/kern_intr.c index 53308680e79f..a0a7e0d1e0e0 100644 --- a/sys/kern/kern_intr.c +++ b/sys/kern/kern_intr.c @@ -177,7 +177,7 @@ ithread_create(struct ithd **ithread, int vector, int flags, if ((flags & ~IT_SOFT) != 0) return (EINVAL); - ithd = malloc(sizeof(struct ithd), M_ITHREAD, M_ZERO); + ithd = malloc(sizeof(struct ithd), M_ITHREAD, M_WAITOK | M_ZERO); ithd->it_vector = vector; ithd->it_disable = disable; ithd->it_enable = enable; @@ -249,7 +249,7 @@ ithread_add_handler(struct ithd* ithread, const char *name, if ((flags & INTR_FAST) !=0) flags |= INTR_EXCL; - ih = malloc(sizeof(struct intrhand), M_ITHREAD, M_ZERO); + ih = malloc(sizeof(struct intrhand), M_ITHREAD, M_WAITOK | M_ZERO); ih->ih_handler = handler; ih->ih_argument = arg; ih->ih_name = name; diff --git a/sys/kern/kern_jail.c b/sys/kern/kern_jail.c index f367d4f56e05..15f4b36450d8 100644 --- a/sys/kern/kern_jail.c +++ b/sys/kern/kern_jail.c @@ -72,7 +72,7 @@ jail(td, uap) if (j.version != 0) return (EINVAL); - MALLOC(pr, struct prison *, sizeof *pr , M_PRISON, M_ZERO); + MALLOC(pr, struct prison *, sizeof *pr , M_PRISON, M_WAITOK | M_ZERO); mtx_init(&pr->pr_mtx, "jail mutex", NULL, MTX_DEF); pr->pr_securelevel = securelevel; error = copyinstr(j.hostname, &pr->pr_host, sizeof pr->pr_host, 0); diff --git a/sys/kern/kern_kse.c b/sys/kern/kern_kse.c index b3017d0520ce..55b0f24aa833 100644 --- a/sys/kern/kern_kse.c +++ b/sys/kern/kern_kse.c @@ -899,7 +899,7 @@ thread_reap(void) struct ksegrp * ksegrp_alloc(void) { - return (uma_zalloc(ksegrp_zone, 0)); + return (uma_zalloc(ksegrp_zone, M_WAITOK)); } /* @@ -908,7 +908,7 @@ ksegrp_alloc(void) struct kse * kse_alloc(void) { - return (uma_zalloc(kse_zone, 0)); + return (uma_zalloc(kse_zone, M_WAITOK)); } /* @@ -918,7 +918,7 @@ struct thread * thread_alloc(void) { thread_reap(); /* check if any zombies to get */ - return (uma_zalloc(thread_zone, 0)); + return (uma_zalloc(thread_zone, M_WAITOK)); } /* diff --git a/sys/kern/kern_ktrace.c b/sys/kern/kern_ktrace.c index 23f6f7ba7515..bb4642c5acb3 100644 --- a/sys/kern/kern_ktrace.c +++ b/sys/kern/kern_ktrace.c @@ -131,7 +131,7 @@ ktrace_init(void *dummy) STAILQ_INIT(&ktr_todo); STAILQ_INIT(&ktr_free); for (i = 0; i < ktr_requestpool; i++) { - req = malloc(sizeof(struct ktr_request), M_KTRACE, 0); + req = malloc(sizeof(struct ktr_request), M_KTRACE, M_WAITOK); STAILQ_INSERT_HEAD(&ktr_free, req, ktr_list); } kthread_create(ktr_loop, NULL, NULL, RFHIGHPID, 0, "ktrace"); @@ -199,7 +199,7 @@ ktrace_resize_pool(uint newsize) while (ktr_requestpool < newsize) { mtx_unlock(&ktrace_mtx); req = malloc(sizeof(struct ktr_request), M_KTRACE, - 0); + M_WAITOK); mtx_lock(&ktrace_mtx); STAILQ_INSERT_HEAD(&ktr_free, req, ktr_list); ktr_requestpool++; @@ -321,7 +321,7 @@ ktrsyscall(code, narg, args) buflen = sizeof(register_t) * narg; if (buflen > 0) { - buf = malloc(buflen, M_KTRACE, 0); + buf = malloc(buflen, M_KTRACE, M_WAITOK); bcopy(args, buf, buflen); } req = ktr_getrequest(KTR_SYSCALL); @@ -371,7 +371,7 @@ ktrnamei(path) namelen = strlen(path); if (namelen > 0) { - buf = malloc(namelen, M_KTRACE, 0); + buf = malloc(namelen, M_KTRACE, M_WAITOK); bcopy(path, buf, namelen); } req = ktr_getrequest(KTR_NAMEI); @@ -413,7 +413,7 @@ ktrgenio(fd, rw, uio, error) uio->uio_offset = 0; uio->uio_rw = UIO_WRITE; datalen = imin(uio->uio_resid, ktr_geniosize); - buf = malloc(datalen, M_KTRACE, 0); + buf = malloc(datalen, M_KTRACE, M_WAITOK); if (uiomove(buf, datalen, uio)) { free(buf, M_KTRACE); return; @@ -625,7 +625,7 @@ utrace(td, uap) return (0); if (uap->len > KTR_USER_MAXLEN) return (EINVAL); - cp = malloc(uap->len, M_KTRACE, 0); + cp = malloc(uap->len, M_KTRACE, M_WAITOK); error = copyin(uap->addr, cp, uap->len); if (error) { free(cp, M_KTRACE); diff --git a/sys/kern/kern_linker.c b/sys/kern/kern_linker.c index fcecdd954f5b..3c38baca614a 100644 --- a/sys/kern/kern_linker.c +++ b/sys/kern/kern_linker.c @@ -110,7 +110,7 @@ linker_strdup(const char *str) { char *result; - if ((result = malloc((strlen(str) + 1), M_LINKER, 0)) != NULL) + if ((result = malloc((strlen(str) + 1), M_LINKER, M_WAITOK)) != NULL) strcpy(result, str); return (result); } @@ -402,7 +402,7 @@ linker_find_file_by_name(const char *filename) linker_file_t lf = 0; char *koname; - koname = malloc(strlen(filename) + 4, M_LINKER, 0); + koname = malloc(strlen(filename) + 4, M_LINKER, M_WAITOK); if (koname == NULL) goto out; sprintf(koname, "%s.ko", filename); @@ -444,7 +444,7 @@ linker_make_file(const char *pathname, linker_class_t lc) filename = linker_basename(pathname); KLD_DPF(FILE, ("linker_make_file: new file, filename=%s\n", filename)); - lf = (linker_file_t)kobj_create((kobj_class_t)lc, M_LINKER, 0); + lf = (linker_file_t)kobj_create((kobj_class_t)lc, M_LINKER, M_WAITOK); if (lf == NULL) goto out; lf->refs = 1; @@ -558,7 +558,7 @@ linker_file_add_dependency(linker_file_t file, linker_file_t dep) linker_file_t *newdeps; newdeps = malloc((file->ndeps + 1) * sizeof(linker_file_t *), - M_LINKER, M_ZERO); + M_LINKER, M_WAITOK | M_ZERO); if (newdeps == NULL) return (ENOMEM); @@ -644,7 +644,7 @@ linker_file_lookup_symbol(linker_file_t file, const char *name, int deps) common_size = (common_size + sizeof(int) - 1) & -sizeof(int); cp = malloc(sizeof(struct common_symbol) + common_size + strlen(name) + 1, M_LINKER, - M_ZERO); + M_WAITOK | M_ZERO); if (cp == NULL) { KLD_DPF(SYM, ("linker_file_lookup_symbol: nomem\n")); return (0); @@ -753,7 +753,7 @@ kldload(struct thread *td, struct kldload_args *uap) if ((error = suser(td)) != 0) goto out; - pathname = malloc(MAXPATHLEN, M_TEMP, 0); + pathname = malloc(MAXPATHLEN, M_TEMP, M_WAITOK); if ((error = copyinstr(uap->file, pathname, MAXPATHLEN, NULL)) != 0) goto out; @@ -839,7 +839,7 @@ kldfind(struct thread *td, struct kldfind_args *uap) mtx_lock(&Giant); td->td_retval[0] = -1; - pathname = malloc(MAXPATHLEN, M_TEMP, 0); + pathname = malloc(MAXPATHLEN, M_TEMP, M_WAITOK); if ((error = copyinstr(uap->file, pathname, MAXPATHLEN, NULL)) != 0) goto out; @@ -1011,7 +1011,7 @@ kldsym(struct thread *td, struct kldsym_args *uap) error = EINVAL; goto out; } - symstr = malloc(MAXPATHLEN, M_TEMP, 0); + symstr = malloc(MAXPATHLEN, M_TEMP, M_WAITOK); if ((error = copyinstr(lookup.symname, symstr, MAXPATHLEN, NULL)) != 0) goto out; if (uap->fileid != 0) { @@ -1381,7 +1381,7 @@ linker_lookup_file(const char *path, int pathlen, const char *name, sep = (path[pathlen - 1] != '/') ? "/" : ""; reclen = pathlen + strlen(sep) + namelen + extlen + 1; - result = malloc(reclen, M_LINKER, 0); + result = malloc(reclen, M_LINKER, M_WAITOK); for (cpp = linker_ext_list; *cpp; cpp++) { snprintf(result, reclen, "%.*s%s%.*s%s", pathlen, path, sep, namelen, name, *cpp); @@ -1433,7 +1433,7 @@ linker_hints_lookup(const char *path, int pathlen, const char *modname, sep = (path[pathlen - 1] != '/') ? "/" : ""; reclen = imax(modnamelen, strlen(linker_hintfile)) + pathlen + strlen(sep) + 1; - pathbuf = malloc(reclen, M_LINKER, 0); + pathbuf = malloc(reclen, M_LINKER, M_WAITOK); snprintf(pathbuf, reclen, "%.*s%s%s", pathlen, path, sep, linker_hintfile); @@ -1456,7 +1456,7 @@ linker_hints_lookup(const char *path, int pathlen, const char *modname, printf("hints file too large %ld\n", (long)vattr.va_size); goto bad; } - hints = malloc(vattr.va_size, M_TEMP, 0); + hints = malloc(vattr.va_size, M_TEMP, M_WAITOK); if (hints == NULL) goto bad; error = vn_rdwr(UIO_READ, nd.ni_vp, (caddr_t)hints, vattr.va_size, 0, diff --git a/sys/kern/kern_lockf.c b/sys/kern/kern_lockf.c index b5d420453f4d..cb1fad413389 100644 --- a/sys/kern/kern_lockf.c +++ b/sys/kern/kern_lockf.c @@ -160,7 +160,7 @@ lf_advlock(ap, head, size) /* * Create the lockf structure */ - MALLOC(lock, struct lockf *, sizeof *lock, M_LOCKF, 0); + MALLOC(lock, struct lockf *, sizeof *lock, M_LOCKF, M_WAITOK); lock->lf_start = start; lock->lf_end = end; lock->lf_id = ap->a_id; @@ -726,7 +726,7 @@ lf_split(lock1, lock2) * Make a new lock consisting of the last part of * the encompassing lock */ - MALLOC(splitlock, struct lockf *, sizeof *splitlock, M_LOCKF, 0); + MALLOC(splitlock, struct lockf *, sizeof *splitlock, M_LOCKF, M_WAITOK); bcopy(lock1, splitlock, sizeof *splitlock); splitlock->lf_start = lock2->lf_end + 1; TAILQ_INIT(&splitlock->lf_blkhd); diff --git a/sys/kern/kern_mac.c b/sys/kern/kern_mac.c index b4df06f8964f..e9d9eeb3b51a 100644 --- a/sys/kern/kern_mac.c +++ b/sys/kern/kern_mac.c @@ -758,7 +758,7 @@ mac_init_pipe(struct pipe *pipe) { struct label *label; - label = malloc(sizeof(struct label), M_MACPIPELABEL, M_ZERO); + label = malloc(sizeof(struct label), M_MACPIPELABEL, M_ZERO|M_WAITOK); pipe->pipe_label = label; pipe->pipe_peer->pipe_label = label; mac_init_pipe_label(label); @@ -1323,7 +1323,7 @@ mac_execve_enter(struct image_params *imgp, struct mac *mac_p, if (error) return (error); - buffer = malloc(mac.m_buflen, M_MACTEMP, 0); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, buffer, mac.m_buflen, NULL); if (error) { free(buffer, M_MACTEMP); @@ -2727,16 +2727,16 @@ mac_ioctl_ifnet_get(struct ucred *cred, struct ifreq *ifr, if (error) return (error); - elements = malloc(mac.m_buflen, M_MACTEMP, 0); + elements = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, elements, mac.m_buflen, NULL); if (error) { free(elements, M_MACTEMP); return (error); } - buffer = malloc(mac.m_buflen, M_MACTEMP, M_ZERO); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK | M_ZERO); error = mac_externalize_ifnet_label(&ifnet->if_label, elements, - buffer, mac.m_buflen, 0); + buffer, mac.m_buflen, M_WAITOK); if (error == 0) error = copyout(buffer, mac.m_string, strlen(buffer)+1); @@ -2763,7 +2763,7 @@ mac_ioctl_ifnet_set(struct ucred *cred, struct ifreq *ifr, if (error) return (error); - buffer = malloc(mac.m_buflen, M_MACTEMP, 0); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, buffer, mac.m_buflen, NULL); if (error) { free(buffer, M_MACTEMP); @@ -2839,14 +2839,14 @@ mac_setsockopt_label_set(struct ucred *cred, struct socket *so, if (error) return (error); - buffer = malloc(mac->m_buflen, M_MACTEMP, 0); + buffer = malloc(mac->m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac->m_string, buffer, mac->m_buflen, NULL); if (error) { free(buffer, M_MACTEMP); return (error); } - mac_init_socket_label(&intlabel, 0); + mac_init_socket_label(&intlabel, M_WAITOK); error = mac_internalize_socket_label(&intlabel, buffer); free(buffer, M_MACTEMP); if (error) { @@ -2893,16 +2893,16 @@ mac_getsockopt_label_get(struct ucred *cred, struct socket *so, if (error) return (error); - elements = malloc(mac->m_buflen, M_MACTEMP, 0); + elements = malloc(mac->m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac->m_string, elements, mac->m_buflen, NULL); if (error) { free(elements, M_MACTEMP); return (error); } - buffer = malloc(mac->m_buflen, M_MACTEMP, M_ZERO); + buffer = malloc(mac->m_buflen, M_MACTEMP, M_WAITOK | M_ZERO); error = mac_externalize_socket_label(&so->so_label, elements, - buffer, mac->m_buflen, 0); + buffer, mac->m_buflen, M_WAITOK); if (error == 0) error = copyout(buffer, mac->m_string, strlen(buffer)+1); @@ -2923,16 +2923,16 @@ mac_getsockopt_peerlabel_get(struct ucred *cred, struct socket *so, if (error) return (error); - elements = malloc(mac->m_buflen, M_MACTEMP, 0); + elements = malloc(mac->m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac->m_string, elements, mac->m_buflen, NULL); if (error) { free(elements, M_MACTEMP); return (error); } - buffer = malloc(mac->m_buflen, M_MACTEMP, M_ZERO); + buffer = malloc(mac->m_buflen, M_MACTEMP, M_WAITOK | M_ZERO); error = mac_externalize_socket_peer_label(&so->so_peerlabel, - elements, buffer, mac->m_buflen, 0); + elements, buffer, mac->m_buflen, M_WAITOK); if (error == 0) error = copyout(buffer, mac->m_string, strlen(buffer)+1); @@ -3040,7 +3040,7 @@ __mac_get_pid(struct thread *td, struct __mac_get_pid_args *uap) if (error) return (error); - elements = malloc(mac.m_buflen, M_MACTEMP, 0); + elements = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, elements, mac.m_buflen, NULL); if (error) { free(elements, M_MACTEMP); @@ -3048,9 +3048,9 @@ __mac_get_pid(struct thread *td, struct __mac_get_pid_args *uap) return (error); } - buffer = malloc(mac.m_buflen, M_MACTEMP, M_ZERO); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK | M_ZERO); error = mac_externalize_cred_label(&tcred->cr_label, elements, - buffer, mac.m_buflen, 0); + buffer, mac.m_buflen, M_WAITOK); if (error == 0) error = copyout(buffer, mac.m_string, strlen(buffer)+1); @@ -3078,16 +3078,16 @@ __mac_get_proc(struct thread *td, struct __mac_get_proc_args *uap) if (error) return (error); - elements = malloc(mac.m_buflen, M_MACTEMP, 0); + elements = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, elements, mac.m_buflen, NULL); if (error) { free(elements, M_MACTEMP); return (error); } - buffer = malloc(mac.m_buflen, M_MACTEMP, M_ZERO); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK | M_ZERO); error = mac_externalize_cred_label(&td->td_ucred->cr_label, - elements, buffer, mac.m_buflen, 0); + elements, buffer, mac.m_buflen, M_WAITOK); if (error == 0) error = copyout(buffer, mac.m_string, strlen(buffer)+1); @@ -3117,7 +3117,7 @@ __mac_set_proc(struct thread *td, struct __mac_set_proc_args *uap) if (error) return (error); - buffer = malloc(mac.m_buflen, M_MACTEMP, 0); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, buffer, mac.m_buflen, NULL); if (error) { free(buffer, M_MACTEMP); @@ -3194,14 +3194,14 @@ __mac_get_fd(struct thread *td, struct __mac_get_fd_args *uap) if (error) return (error); - elements = malloc(mac.m_buflen, M_MACTEMP, 0); + elements = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, elements, mac.m_buflen, NULL); if (error) { free(elements, M_MACTEMP); return (error); } - buffer = malloc(mac.m_buflen, M_MACTEMP, M_ZERO); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK | M_ZERO); mtx_lock(&Giant); /* VFS */ error = fget(td, uap->fd, &fp); if (error) @@ -3241,12 +3241,12 @@ __mac_get_fd(struct thread *td, struct __mac_get_fd_args *uap) case DTYPE_VNODE: if (error == 0) error = mac_externalize_vnode_label(&intlabel, - elements, buffer, mac.m_buflen, 0); + elements, buffer, mac.m_buflen, M_WAITOK); mac_destroy_vnode_label(&intlabel); break; case DTYPE_PIPE: error = mac_externalize_pipe_label(&intlabel, elements, - buffer, mac.m_buflen, 0); + buffer, mac.m_buflen, M_WAITOK); mac_destroy_pipe_label(&intlabel); break; default: @@ -3284,14 +3284,14 @@ __mac_get_file(struct thread *td, struct __mac_get_file_args *uap) if (error) return (error); - elements = malloc(mac.m_buflen, M_MACTEMP, 0); + elements = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, elements, mac.m_buflen, NULL); if (error) { free(elements, M_MACTEMP); return (error); } - buffer = malloc(mac.m_buflen, M_MACTEMP, M_ZERO); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK | M_ZERO); mtx_lock(&Giant); /* VFS */ NDINIT(&nd, LOOKUP, LOCKLEAF | FOLLOW, UIO_USERSPACE, uap->path_p, td); @@ -3302,7 +3302,7 @@ __mac_get_file(struct thread *td, struct __mac_get_file_args *uap) mac_init_vnode_label(&intlabel); mac_copy_vnode_label(&nd.ni_vp->v_label, &intlabel); error = mac_externalize_vnode_label(&intlabel, elements, buffer, - mac.m_buflen, 0); + mac.m_buflen, M_WAITOK); NDFREE(&nd, 0); mac_destroy_vnode_label(&intlabel); @@ -3339,14 +3339,14 @@ __mac_get_link(struct thread *td, struct __mac_get_link_args *uap) if (error) return (error); - elements = malloc(mac.m_buflen, M_MACTEMP, 0); + elements = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, elements, mac.m_buflen, NULL); if (error) { free(elements, M_MACTEMP); return (error); } - buffer = malloc(mac.m_buflen, M_MACTEMP, M_ZERO); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK | M_ZERO); mtx_lock(&Giant); /* VFS */ NDINIT(&nd, LOOKUP, LOCKLEAF | NOFOLLOW, UIO_USERSPACE, uap->path_p, td); @@ -3357,7 +3357,7 @@ __mac_get_link(struct thread *td, struct __mac_get_link_args *uap) mac_init_vnode_label(&intlabel); mac_copy_vnode_label(&nd.ni_vp->v_label, &intlabel); error = mac_externalize_vnode_label(&intlabel, elements, buffer, - mac.m_buflen, 0); + mac.m_buflen, M_WAITOK); NDFREE(&nd, 0); mac_destroy_vnode_label(&intlabel); @@ -3396,7 +3396,7 @@ __mac_set_fd(struct thread *td, struct __mac_set_fd_args *uap) if (error) return (error); - buffer = malloc(mac.m_buflen, M_MACTEMP, 0); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, buffer, mac.m_buflen, NULL); if (error) { free(buffer, M_MACTEMP); @@ -3482,7 +3482,7 @@ __mac_set_file(struct thread *td, struct __mac_set_file_args *uap) if (error) return (error); - buffer = malloc(mac.m_buflen, M_MACTEMP, 0); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, buffer, mac.m_buflen, NULL); if (error) { free(buffer, M_MACTEMP); @@ -3538,7 +3538,7 @@ __mac_set_link(struct thread *td, struct __mac_set_link_args *uap) if (error) return (error); - buffer = malloc(mac.m_buflen, M_MACTEMP, 0); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, buffer, mac.m_buflen, NULL); if (error) { free(buffer, M_MACTEMP); diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c index 33d23f101961..c18212034dc3 100644 --- a/sys/kern/kern_malloc.c +++ b/sys/kern/kern_malloc.c @@ -173,7 +173,7 @@ malloc(size, type, flags) #endif if (!(flags & M_NOWAIT)) KASSERT(curthread->td_intr_nesting_level == 0, - ("malloc() without M_NOWAIT in interrupt context")); + ("malloc(M_WAITOK) in interrupt context")); if (size <= KMEM_ZMAX) { if (size & KMEM_ZMASK) size = (size & ~KMEM_ZMASK) + KMEM_ZBASE; @@ -206,7 +206,7 @@ malloc(size, type, flags) mtx_unlock(&ksp->ks_mtx); if (!(flags & M_NOWAIT)) - KASSERT(va != NULL, ("malloc() without M_NOWAIT returned NULL")); + KASSERT(va != NULL, ("malloc(M_WAITOK) returned NULL")); if (va == NULL) { t_malloc_fail = time_uptime; } @@ -501,7 +501,7 @@ sysctl_kern_malloc(SYSCTL_HANDLER_ARGS) mtx_unlock(&malloc_mtx); bufsize = linesize * (cnt + 1); - p = buf = (char *)malloc(bufsize, M_TEMP, M_ZERO); + p = buf = (char *)malloc(bufsize, M_TEMP, M_WAITOK|M_ZERO); mtx_lock(&malloc_mtx); len = snprintf(p, linesize, @@ -581,7 +581,7 @@ sysctl_kern_mprof(SYSCTL_HANDLER_ARGS) waste = 0; mem = 0; - p = buf = (char *)malloc(bufsize, M_TEMP, M_ZERO); + p = buf = (char *)malloc(bufsize, M_TEMP, M_WAITOK|M_ZERO); len = snprintf(p, bufsize, "\n Size Requests Real Size\n"); bufsize -= len; diff --git a/sys/kern/kern_module.c b/sys/kern/kern_module.c index 84ad1c62a143..677d9f15fe4c 100644 --- a/sys/kern/kern_module.c +++ b/sys/kern/kern_module.c @@ -132,7 +132,7 @@ module_register(const moduledata_t *data, linker_file_t container) } MOD_SUNLOCK; namelen = strlen(data->name) + 1; - newmod = malloc(sizeof(struct module) + namelen, M_MODULE, 0); + newmod = malloc(sizeof(struct module) + namelen, M_MODULE, M_WAITOK); if (newmod == NULL) return (ENOMEM); MOD_XLOCK; diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c index 73062c2f23ea..00f61866deb7 100644 --- a/sys/kern/kern_proc.c +++ b/sys/kern/kern_proc.c @@ -975,7 +975,7 @@ pargs_alloc(int len) struct pargs *pa; MALLOC(pa, struct pargs *, sizeof(struct pargs) + len, M_PARGS, - 0); + M_WAITOK); pa->ar_ref = 1; pa->ar_length = len; return (pa); diff --git a/sys/kern/kern_prot.c b/sys/kern/kern_prot.c index e89f342279c9..027913745f75 100644 --- a/sys/kern/kern_prot.c +++ b/sys/kern/kern_prot.c @@ -336,8 +336,8 @@ setsid(register struct thread *td, struct setsid_args *uap) error = 0; pgrp = NULL; - MALLOC(newpgrp, struct pgrp *, sizeof(struct pgrp), M_PGRP, M_ZERO); - MALLOC(newsess, struct session *, sizeof(struct session), M_SESSION, M_ZERO); + MALLOC(newpgrp, struct pgrp *, sizeof(struct pgrp), M_PGRP, M_WAITOK | M_ZERO); + MALLOC(newsess, struct session *, sizeof(struct session), M_SESSION, M_WAITOK | M_ZERO); sx_xlock(&proctree_lock); @@ -399,7 +399,7 @@ setpgid(struct thread *td, register struct setpgid_args *uap) error = 0; - MALLOC(newpgrp, struct pgrp *, sizeof(struct pgrp), M_PGRP, M_ZERO); + MALLOC(newpgrp, struct pgrp *, sizeof(struct pgrp), M_PGRP, M_WAITOK | M_ZERO); sx_xlock(&proctree_lock); if (uap->pid != 0 && uap->pid != curp->p_pid) { @@ -1678,7 +1678,7 @@ crget(void) { register struct ucred *cr; - MALLOC(cr, struct ucred *, sizeof(*cr), M_CRED, M_ZERO); + MALLOC(cr, struct ucred *, sizeof(*cr), M_CRED, M_WAITOK | M_ZERO); cr->cr_ref = 1; cr->cr_mtxp = mtx_pool_find(cr); #ifdef MAC diff --git a/sys/kern/kern_resource.c b/sys/kern/kern_resource.c index d0892e1e7c57..5b3920cbaab7 100644 --- a/sys/kern/kern_resource.c +++ b/sys/kern/kern_resource.c @@ -826,7 +826,7 @@ limcopy(lim) register struct plimit *copy; MALLOC(copy, struct plimit *, sizeof(struct plimit), - M_SUBPROC, 0); + M_SUBPROC, M_WAITOK); bcopy(lim->pl_rlimit, copy->pl_rlimit, sizeof(struct plimit)); copy->p_lflags = 0; copy->p_refcnt = 1; @@ -883,7 +883,7 @@ uifind(uid) struct uidinfo *old_uip; mtx_unlock(&uihashtbl_mtx); - uip = malloc(sizeof(*uip), M_UIDINFO, M_ZERO); + uip = malloc(sizeof(*uip), M_UIDINFO, M_WAITOK | M_ZERO); mtx_lock(&uihashtbl_mtx); /* * There's a chance someone created our uidinfo while we diff --git a/sys/kern/kern_subr.c b/sys/kern/kern_subr.c index dca389fa65f3..154b6e03ab4f 100644 --- a/sys/kern/kern_subr.c +++ b/sys/kern/kern_subr.c @@ -490,7 +490,7 @@ hashinit(elements, type, hashmask) for (hashsize = 1; hashsize <= elements; hashsize <<= 1) continue; hashsize >>= 1; - hashtbl = malloc((u_long)hashsize * sizeof(*hashtbl), type, 0); + hashtbl = malloc((u_long)hashsize * sizeof(*hashtbl), type, M_WAITOK); for (i = 0; i < hashsize; i++) LIST_INIT(&hashtbl[i]); *hashmask = hashsize - 1; @@ -539,7 +539,7 @@ phashinit(elements, type, nentries) hashsize = primes[i]; } hashsize = primes[i - 1]; - hashtbl = malloc((u_long)hashsize * sizeof(*hashtbl), type, 0); + hashtbl = malloc((u_long)hashsize * sizeof(*hashtbl), type, M_WAITOK); for (i = 0; i < hashsize; i++) LIST_INIT(&hashtbl[i]); *nentries = hashsize; diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c index 0a0d94cb021e..08d1f80ec99d 100644 --- a/sys/kern/kern_sysctl.c +++ b/sys/kern/kern_sysctl.c @@ -224,7 +224,7 @@ sysctl_ctx_entry_add(struct sysctl_ctx_list *clist, struct sysctl_oid *oidp) if (clist == NULL || oidp == NULL) return(NULL); - e = malloc(sizeof(struct sysctl_ctx_entry), M_SYSCTLOID, 0); + e = malloc(sizeof(struct sysctl_ctx_entry), M_SYSCTLOID, M_WAITOK); e->entry = oidp; TAILQ_INSERT_HEAD(clist, e, link); return (e); @@ -354,13 +354,13 @@ sysctl_add_oid(struct sysctl_ctx_list *clist, struct sysctl_oid_list *parent, return (NULL); } } - oidp = malloc(sizeof(struct sysctl_oid), M_SYSCTLOID, M_ZERO); + oidp = malloc(sizeof(struct sysctl_oid), M_SYSCTLOID, M_WAITOK|M_ZERO); oidp->oid_parent = parent; SLIST_NEXT(oidp, oid_link) = NULL; oidp->oid_number = number; oidp->oid_refcnt = 1; len = strlen(name); - newname = malloc(len + 1, M_SYSCTLOID, 0); + newname = malloc(len + 1, M_SYSCTLOID, M_WAITOK); bcopy(name, newname, len + 1); newname[len] = '\0'; oidp->oid_name = newname; @@ -369,7 +369,7 @@ sysctl_add_oid(struct sysctl_ctx_list *clist, struct sysctl_oid_list *parent, if ((kind & CTLTYPE) == CTLTYPE_NODE) { /* Allocate space for children */ SYSCTL_CHILDREN(oidp) = malloc(sizeof(struct sysctl_oid_list), - M_SYSCTLOID, 0); + M_SYSCTLOID, M_WAITOK); SLIST_INIT(SYSCTL_CHILDREN(oidp)); } else { oidp->oid_arg1 = arg1; @@ -378,7 +378,7 @@ sysctl_add_oid(struct sysctl_ctx_list *clist, struct sysctl_oid_list *parent, oidp->oid_fmt = fmt; if (descr) { int len = strlen(descr) + 1; - oidp->descr = malloc(len, M_SYSCTLOID, 0); + oidp->descr = malloc(len, M_SYSCTLOID, M_WAITOK); if (oidp->descr) strcpy((char *)(uintptr_t)(const void *)oidp->descr, descr); } @@ -679,7 +679,7 @@ sysctl_sysctl_name2oid(SYSCTL_HANDLER_ARGS) if (req->newlen >= MAXPATHLEN) /* XXX arbitrary, undocumented */ return (ENAMETOOLONG); - p = malloc(req->newlen+1, M_SYSCTL, 0); + p = malloc(req->newlen+1, M_SYSCTL, M_WAITOK); error = SYSCTL_IN(req, p, req->newlen); if (error) { @@ -823,7 +823,7 @@ sysctl_handle_string(SYSCTL_HANDLER_ARGS) */ retry: outlen = strlen((char *)arg1)+1; - tmparg = malloc(outlen, M_SYSCTLTMP, 0); + tmparg = malloc(outlen, M_SYSCTLTMP, M_WAITOK); if (strlcpy(tmparg, (char *)arg1, outlen) >= outlen) { free(tmparg, M_SYSCTLTMP); @@ -867,7 +867,7 @@ sysctl_handle_opaque(SYSCTL_HANDLER_ARGS) sysctl_wire_old_buffer(req, arg2); error = SYSCTL_OUT(req, arg1, arg2); } else { - tmparg = malloc(arg2, M_SYSCTLTMP, 0); + tmparg = malloc(arg2, M_SYSCTLTMP, M_WAITOK); bcopy(arg1, tmparg, arg2); error = SYSCTL_OUT(req, tmparg, arg2); free(tmparg, M_SYSCTLTMP); diff --git a/sys/kern/kern_thread.c b/sys/kern/kern_thread.c index b3017d0520ce..55b0f24aa833 100644 --- a/sys/kern/kern_thread.c +++ b/sys/kern/kern_thread.c @@ -899,7 +899,7 @@ thread_reap(void) struct ksegrp * ksegrp_alloc(void) { - return (uma_zalloc(ksegrp_zone, 0)); + return (uma_zalloc(ksegrp_zone, M_WAITOK)); } /* @@ -908,7 +908,7 @@ ksegrp_alloc(void) struct kse * kse_alloc(void) { - return (uma_zalloc(kse_zone, 0)); + return (uma_zalloc(kse_zone, M_WAITOK)); } /* @@ -918,7 +918,7 @@ struct thread * thread_alloc(void) { thread_reap(); /* check if any zombies to get */ - return (uma_zalloc(thread_zone, 0)); + return (uma_zalloc(thread_zone, M_WAITOK)); } /* diff --git a/sys/kern/link_elf.c b/sys/kern/link_elf.c index 6c3e4d4fd268..f15803fa8435 100644 --- a/sys/kern/link_elf.c +++ b/sys/kern/link_elf.c @@ -235,7 +235,7 @@ link_elf_link_common_finish(linker_file_t lf) #ifdef DDB GDB_STATE(RT_ADD); ef->gdb.l_addr = lf->address; - newfilename = malloc(strlen(lf->filename) + 1, M_LINKER, 0); + newfilename = malloc(strlen(lf->filename) + 1, M_LINKER, M_WAITOK); strcpy(newfilename, lf->filename); ef->gdb.l_name = newfilename; ef->gdb.l_ld = ef->dynamic; @@ -571,7 +571,7 @@ link_elf_load_file(linker_class_t cls, const char* filename, /* * Read the elf header from the file. */ - firstpage = malloc(PAGE_SIZE, M_LINKER, 0); + firstpage = malloc(PAGE_SIZE, M_LINKER, M_WAITOK); if (firstpage == NULL) { error = ENOMEM; goto out; @@ -702,7 +702,7 @@ link_elf_load_file(linker_class_t cls, const char* filename, goto out; } #else - ef->address = malloc(mapsize, M_LINKER, 0); + ef->address = malloc(mapsize, M_LINKER, M_WAITOK); if (!ef->address) { error = ENOMEM; goto out; @@ -773,7 +773,7 @@ link_elf_load_file(linker_class_t cls, const char* filename, nbytes = hdr->e_shnum * hdr->e_shentsize; if (nbytes == 0 || hdr->e_shoff == 0) goto nosyms; - shdr = malloc(nbytes, M_LINKER, M_ZERO); + shdr = malloc(nbytes, M_LINKER, M_WAITOK | M_ZERO); if (shdr == NULL) { error = ENOMEM; goto out; @@ -796,9 +796,9 @@ link_elf_load_file(linker_class_t cls, const char* filename, goto nosyms; symcnt = shdr[symtabindex].sh_size; - ef->symbase = malloc(symcnt, M_LINKER, 0); + ef->symbase = malloc(symcnt, M_LINKER, M_WAITOK); strcnt = shdr[symstrindex].sh_size; - ef->strbase = malloc(strcnt, M_LINKER, 0); + ef->strbase = malloc(strcnt, M_LINKER, M_WAITOK); if (ef->symbase == NULL || ef->strbase == NULL) { error = ENOMEM; @@ -1124,7 +1124,7 @@ link_elf_lookup_set(linker_file_t lf, const char *name, int len, error = 0, count; len = strlen(name) + sizeof("__start_set_"); /* sizeof includes \0 */ - setsym = malloc(len, M_LINKER, 0); + setsym = malloc(len, M_LINKER, M_WAITOK); if (setsym == NULL) return ENOMEM; diff --git a/sys/kern/link_elf_obj.c b/sys/kern/link_elf_obj.c index 6c3e4d4fd268..f15803fa8435 100644 --- a/sys/kern/link_elf_obj.c +++ b/sys/kern/link_elf_obj.c @@ -235,7 +235,7 @@ link_elf_link_common_finish(linker_file_t lf) #ifdef DDB GDB_STATE(RT_ADD); ef->gdb.l_addr = lf->address; - newfilename = malloc(strlen(lf->filename) + 1, M_LINKER, 0); + newfilename = malloc(strlen(lf->filename) + 1, M_LINKER, M_WAITOK); strcpy(newfilename, lf->filename); ef->gdb.l_name = newfilename; ef->gdb.l_ld = ef->dynamic; @@ -571,7 +571,7 @@ link_elf_load_file(linker_class_t cls, const char* filename, /* * Read the elf header from the file. */ - firstpage = malloc(PAGE_SIZE, M_LINKER, 0); + firstpage = malloc(PAGE_SIZE, M_LINKER, M_WAITOK); if (firstpage == NULL) { error = ENOMEM; goto out; @@ -702,7 +702,7 @@ link_elf_load_file(linker_class_t cls, const char* filename, goto out; } #else - ef->address = malloc(mapsize, M_LINKER, 0); + ef->address = malloc(mapsize, M_LINKER, M_WAITOK); if (!ef->address) { error = ENOMEM; goto out; @@ -773,7 +773,7 @@ link_elf_load_file(linker_class_t cls, const char* filename, nbytes = hdr->e_shnum * hdr->e_shentsize; if (nbytes == 0 || hdr->e_shoff == 0) goto nosyms; - shdr = malloc(nbytes, M_LINKER, M_ZERO); + shdr = malloc(nbytes, M_LINKER, M_WAITOK | M_ZERO); if (shdr == NULL) { error = ENOMEM; goto out; @@ -796,9 +796,9 @@ link_elf_load_file(linker_class_t cls, const char* filename, goto nosyms; symcnt = shdr[symtabindex].sh_size; - ef->symbase = malloc(symcnt, M_LINKER, 0); + ef->symbase = malloc(symcnt, M_LINKER, M_WAITOK); strcnt = shdr[symstrindex].sh_size; - ef->strbase = malloc(strcnt, M_LINKER, 0); + ef->strbase = malloc(strcnt, M_LINKER, M_WAITOK); if (ef->symbase == NULL || ef->strbase == NULL) { error = ENOMEM; @@ -1124,7 +1124,7 @@ link_elf_lookup_set(linker_file_t lf, const char *name, int len, error = 0, count; len = strlen(name) + sizeof("__start_set_"); /* sizeof includes \0 */ - setsym = malloc(len, M_LINKER, 0); + setsym = malloc(len, M_LINKER, M_WAITOK); if (setsym == NULL) return ENOMEM; diff --git a/sys/kern/subr_blist.c b/sys/kern/subr_blist.c index 8acf5f53f1d6..a58e548401fe 100644 --- a/sys/kern/subr_blist.c +++ b/sys/kern/subr_blist.c @@ -157,14 +157,14 @@ blist_create(daddr_t blocks) skip = (skip + 1) * BLIST_META_RADIX; } - bl = malloc(sizeof(struct blist), M_SWAP, M_ZERO); + bl = malloc(sizeof(struct blist), M_SWAP, M_WAITOK | M_ZERO); bl->bl_blocks = blocks; bl->bl_radix = radix; bl->bl_skip = skip; bl->bl_rootblks = 1 + blst_radix_init(NULL, bl->bl_radix, bl->bl_skip, blocks); - bl->bl_root = malloc(sizeof(blmeta_t) * bl->bl_rootblks, M_SWAP, 0); + bl->bl_root = malloc(sizeof(blmeta_t) * bl->bl_rootblks, M_SWAP, M_WAITOK); #if defined(BLIST_DEBUG) printf( diff --git a/sys/kern/subr_clist.c b/sys/kern/subr_clist.c index e4da151d2cc8..165f628e256f 100644 --- a/sys/kern/subr_clist.c +++ b/sys/kern/subr_clist.c @@ -135,8 +135,8 @@ cblock_alloc_cblocks(number) cbp = malloc(sizeof *cbp, M_TTYS, M_NOWAIT); if (cbp == NULL) { printf( -"cblock_alloc_cblocks: M_NOWAIT malloc failed, trying blocking malloc\n"); - cbp = malloc(sizeof *cbp, M_TTYS, 0); +"cblock_alloc_cblocks: M_NOWAIT malloc failed, trying M_WAITOK\n"); + cbp = malloc(sizeof *cbp, M_TTYS, M_WAITOK); } /* * Freed cblocks have zero quotes and garbage elsewhere. diff --git a/sys/kern/subr_mbuf.c b/sys/kern/subr_mbuf.c index 97944ece2183..0713b7bf0868 100644 --- a/sys/kern/subr_mbuf.c +++ b/sys/kern/subr_mbuf.c @@ -478,7 +478,7 @@ mbuf_init(void *dummy) pcpu_cnt = MB_GET_PCPU_LIST_NUM(&mb_list_mbuf, i); MB_LOCK_CONT(pcpu_cnt); for (j = 0; j < NMB_MBUF_INIT; j++) { - if (mb_pop_cont(&mb_list_mbuf, M_NOWAIT, pcpu_cnt) + if (mb_pop_cont(&mb_list_mbuf, M_DONTWAIT, pcpu_cnt) == NULL) goto bad; } @@ -487,7 +487,7 @@ mbuf_init(void *dummy) pcpu_cnt = MB_GET_PCPU_LIST_NUM(&mb_list_clust, i); MB_LOCK_CONT(pcpu_cnt); for (j = 0; j < NMB_CLUST_INIT; j++) { - if (mb_pop_cont(&mb_list_clust, M_NOWAIT, pcpu_cnt) + if (mb_pop_cont(&mb_list_clust, M_DONTWAIT, pcpu_cnt) == NULL) goto bad; } @@ -528,15 +528,15 @@ mb_pop_cont(struct mb_lstmngr *mb_list, int how, struct mb_pcpu_list *cnt_lst) bucket = malloc(sizeof(struct mb_bucket) + PAGE_SIZE / mb_list->ml_objsize * sizeof(void *), M_MBUF, - how == 0 ? 0 : M_NOWAIT); + how == M_TRYWAIT ? M_WAITOK : M_NOWAIT); if (bucket == NULL) return (NULL); p = (caddr_t)kmem_malloc(mb_list->ml_map, PAGE_SIZE, - how == 0 ? 0 : M_NOWAIT); + how == M_TRYWAIT ? M_WAITOK : M_NOWAIT); if (p == NULL) { free(bucket, M_MBUF); - if (how == 0) + if (how == M_TRYWAIT) mb_list->ml_mapfull = 1; return (NULL); } @@ -563,7 +563,7 @@ mb_pop_cont(struct mb_lstmngr *mb_list, int how, struct mb_pcpu_list *cnt_lst) * The general case is very easy. Complications only arise if our PCPU * container is empty. Things get worse if the PCPU container is empty, * the general container is empty, and we've run out of address space - * in our map; then we try to block if we're willing to wait. + * in our map; then we try to block if we're willing to (M_TRYWAIT). */ static __inline void * @@ -667,7 +667,7 @@ mb_alloc(struct mb_lstmngr *mb_list, int how, short type, short persist, else *pers_list=cnt_lst->mb_cont.mc_numowner; } else { - if (how == 0) { + if (how == M_TRYWAIT) { /* * Absolute worst-case scenario. * We block if we're willing to, but @@ -701,7 +701,7 @@ mb_alloc(struct mb_lstmngr *mb_list, int how, short type, short persist, /* * This is the worst-case scenario called only if we're allocating with - * 0. We first drain all the protocols, then try to find an mbuf + * M_TRYWAIT. We first drain all the protocols, then try to find an mbuf * by looking in every PCPU container. If we're still unsuccesful, we * try the general container one last time and possibly block on our * starved cv. @@ -1128,8 +1128,8 @@ _mgetm_internal(int how, short type, short persist, int cchnum) * Allocate and return a single (normal) mbuf. NULL is returned on failure. * * Arguments: - * - how: 0 to try to block for kern.ipc.mbuf_wait number of ticks - * if really starved for memory. M_NOWAIT to never block. + * - how: M_TRYWAIT to try to block for kern.ipc.mbuf_wait number of ticks + * if really starved for memory. M_DONTWAIT to never block. * - type: the type of the mbuf being allocated. */ struct mbuf * @@ -1156,8 +1156,8 @@ m_get(int how, short type) * - m: existing chain to which to append new chain (optional). * - len: total length of data to append, either in mbufs or clusters * (we allocate whatever combination yields the best fit). - * - how: 0 to try to block for kern.ipc.mbuf_wait number of ticks - * if really starved for memory. M_NOWAIT to never block. + * - how: M_TRYWAIT to try to block for kern.ipc.mbuf_wait number of ticks + * if really starved for memory. M_DONTWAIT to never block. * - type: the type of the mbuf being allocated. */ struct mbuf * @@ -1246,8 +1246,8 @@ m_getm(struct mbuf *m, int len, int how, short type) * Allocate and return a single M_PKTHDR mbuf. NULL is returned on failure. * * Arguments: - * - how: 0 to try to block for kern.ipc.mbuf_wait number of ticks - * if really starved for memory. M_NOWAIT to never block. + * - how: M_TRYWAIT to try to block for kern.ipc.mbuf_wait number of ticks + * if really starved for memory. M_DONTWAIT to never block. * - type: the type of the mbuf being allocated. */ struct mbuf * @@ -1273,8 +1273,8 @@ m_gethdr(int how, short type) * returned on failure. * * Arguments: - * - how: 0 to try to block for kern.ipc.mbuf_wait number of ticks - * if really starved for memory. M_NOWAIT to never block. + * - how: M_TRYWAIT to try to block for kern.ipc.mbuf_wait number of ticks + * if really starved for memory. M_DONTWAIT to never block. * - type: the type of the mbuf being allocated. */ struct mbuf * @@ -1295,8 +1295,8 @@ m_get_clrd(int how, short type) * returned on failure. * * Arguments: - * - how: 0 to try to block for kern.ipc.mbuf_wait number of ticks - * if really starved for memory. M_NOWAIT to never block. + * - how: M_TRYWAIT to try to block for kern.ipc.mbuf_wait number of ticks + * if really starved for memory. M_DONTWAIT to never block. * - type: the type of the mbuf being allocated. */ struct mbuf * @@ -1419,8 +1419,8 @@ m_freem(struct mbuf *mb) * NULL on failure. * * Arguments: - * - how: 0 to try to block for kern.ipc.mbuf_wait number of ticks - * if really starved for memory. M_NOWAIT to never block. + * - how: M_TRYWAIT to try to block for kern.ipc.mbuf_wait number of ticks + * if really starved for memory. M_DONTWAIT to never block. * - type: the type of the mbuf being allocated. * - flags: any flags to pass to the mbuf being allocated; if this includes * the M_PKTHDR bit, then the mbuf is configured as a M_PKTHDR mbuf. @@ -1471,8 +1471,8 @@ m_getcl(int how, short type, int flags) * * Arguments: * - mb: the existing mbuf to which to attach the allocated cluster. - * - how: 0 to try to block for kern.ipc.mbuf_wait number of ticks - * if really starved for memory. M_NOWAIT to never block. + * - how: M_TRYWAIT to try to block for kern.ipc.mbuf_wait number of ticks + * if really starved for memory. M_DONTWAIT to never block. */ void m_clget(struct mbuf *mb, int how) diff --git a/sys/kern/subr_mchain.c b/sys/kern/subr_mchain.c index 2125004bf5c8..ed231bae8742 100644 --- a/sys/kern/subr_mchain.c +++ b/sys/kern/subr_mchain.c @@ -58,7 +58,7 @@ mb_init(struct mbchain *mbp) { struct mbuf *m; - m = m_gethdr(0, MT_DATA); + m = m_gethdr(M_TRYWAIT, MT_DATA); if (m == NULL) return ENOBUFS; m->m_len = 0; @@ -115,7 +115,7 @@ mb_reserve(struct mbchain *mbp, int size) panic("mb_reserve: size = %d\n", size); m = mbp->mb_cur; if (mbp->mb_mleft < size) { - mn = m_get(0, MT_DATA); + mn = m_get(M_TRYWAIT, MT_DATA); if (mn == NULL) return NULL; mbp->mb_cur = m->m_next = mn; @@ -192,7 +192,7 @@ mb_put_mem(struct mbchain *mbp, c_caddr_t source, int size, int type) while (size > 0) { if (mleft == 0) { if (m->m_next == NULL) { - m = m_getm(m, size, 0, MT_DATA); + m = m_getm(m, size, M_TRYWAIT, MT_DATA); if (m == NULL) return ENOBUFS; } @@ -292,7 +292,7 @@ md_init(struct mdchain *mdp) { struct mbuf *m; - m = m_gethdr(0, MT_DATA); + m = m_gethdr(M_TRYWAIT, MT_DATA); if (m == NULL) return ENOBUFS; m->m_len = 0; @@ -500,7 +500,7 @@ md_get_mbuf(struct mdchain *mdp, int size, struct mbuf **ret) { struct mbuf *m = mdp->md_cur, *rm; - rm = m_copym(m, mdp->md_pos - mtod(m, u_char*), size, 0); + rm = m_copym(m, mdp->md_pos - mtod(m, u_char*), size, M_TRYWAIT); if (rm == NULL) return EBADRPC; md_get_mem(mdp, NULL, size, MB_MZERO); diff --git a/sys/kern/subr_prf.c b/sys/kern/subr_prf.c index abe059bf7610..5a298acdf601 100644 --- a/sys/kern/subr_prf.c +++ b/sys/kern/subr_prf.c @@ -260,8 +260,8 @@ log_console(struct uio *uio) pri = LOG_INFO | LOG_CONSOLE; muio = *uio; iovlen = uio->uio_iovcnt * sizeof (struct iovec); - MALLOC(miov, struct iovec *, iovlen, M_TEMP, 0); - MALLOC(consbuffer, char *, CONSCHUNK, M_TEMP, 0); + MALLOC(miov, struct iovec *, iovlen, M_TEMP, M_WAITOK); + MALLOC(consbuffer, char *, CONSCHUNK, M_TEMP, M_WAITOK); bcopy(muio.uio_iov, miov, iovlen); muio.uio_iov = miov; uio = &muio; diff --git a/sys/kern/subr_prof.c b/sys/kern/subr_prof.c index 894309d8dbd7..cf4a6e98b827 100644 --- a/sys/kern/subr_prof.c +++ b/sys/kern/subr_prof.c @@ -107,7 +107,7 @@ kmupetext(uintfptr_t nhighpc) np.tolimit = MAXARCS; np.tossize = np.tolimit * sizeof(struct tostruct); cp = malloc(np.kcountsize + np.fromssize + np.tossize, - M_GPROF, 0); + M_GPROF, M_WAITOK); /* * Check for something else extending highpc while we slept. */ @@ -176,7 +176,7 @@ kmstartup(dummy) p->tolimit = MAXARCS; p->tossize = p->tolimit * sizeof(struct tostruct); cp = (char *)malloc(p->kcountsize + p->fromssize + p->tossize, - M_GPROF, M_ZERO); + M_GPROF, M_WAITOK | M_ZERO); p->tos = (struct tostruct *)cp; cp += p->tossize; p->kcount = (HISTCOUNTER *)cp; diff --git a/sys/kern/subr_sbuf.c b/sys/kern/subr_sbuf.c index f4ec519f0b74..9e63e8e7aaf5 100644 --- a/sys/kern/subr_sbuf.c +++ b/sys/kern/subr_sbuf.c @@ -49,7 +49,7 @@ #ifdef _KERNEL MALLOC_DEFINE(M_SBUF, "sbuf", "string buffers"); -#define SBMALLOC(size) malloc(size, M_SBUF, 0) +#define SBMALLOC(size) malloc(size, M_SBUF, M_WAITOK) #define SBFREE(buf) free(buf, M_SBUF) #else /* _KERNEL */ #define KASSERT(e, m) diff --git a/sys/kern/sys_generic.c b/sys/kern/sys_generic.c index 9e3ccff82be2..c26cf47dcee1 100644 --- a/sys/kern/sys_generic.c +++ b/sys/kern/sys_generic.c @@ -248,7 +248,7 @@ readv(td, uap) error = EINVAL; goto done; } - MALLOC(iov, struct iovec *, iovlen, M_IOV, 0); + MALLOC(iov, struct iovec *, iovlen, M_IOV, M_WAITOK); needfree = iov; } else iov = aiov; @@ -274,7 +274,7 @@ readv(td, uap) * if tracing, save a copy of iovec */ if (KTRPOINT(td, KTR_GENIO)) { - MALLOC(ktriov, struct iovec *, iovlen, M_TEMP, 0); + MALLOC(ktriov, struct iovec *, iovlen, M_TEMP, M_WAITOK); bcopy(auio.uio_iov, ktriov, iovlen); ktruio = auio; } @@ -480,7 +480,7 @@ writev(td, uap) error = EINVAL; goto done; } - MALLOC(iov, struct iovec *, iovlen, M_IOV, 0); + MALLOC(iov, struct iovec *, iovlen, M_IOV, M_WAITOK); needfree = iov; } else { iov = aiov; @@ -508,7 +508,7 @@ writev(td, uap) * if tracing, save a copy of iovec and uio */ if (KTRPOINT(td, KTR_GENIO)) { - MALLOC(ktriov, struct iovec *, iovlen, M_TEMP, 0); + MALLOC(ktriov, struct iovec *, iovlen, M_TEMP, M_WAITOK); bcopy(auio.uio_iov, ktriov, iovlen); ktruio = auio; } @@ -618,7 +618,7 @@ ioctl(td, uap) memp = NULL; if (size > sizeof (ubuf.stkbuf)) { - memp = malloc((u_long)size, M_IOCTLOPS, 0); + memp = malloc((u_long)size, M_IOCTLOPS, M_WAITOK); data = memp; } else { data = ubuf.stkbuf; @@ -768,7 +768,7 @@ kern_select(struct thread *td, int nd, fd_set *fd_in, fd_set *fd_ou, if (nbufbytes <= sizeof s_selbits) selbits = &s_selbits[0]; else - selbits = malloc(nbufbytes, M_SELECT, 0); + selbits = malloc(nbufbytes, M_SELECT, M_WAITOK); /* * Assign pointers into the bit buffers and fetch the input bits. @@ -968,7 +968,7 @@ poll(td, uap) } ni = nfds * sizeof(struct pollfd); if (ni > sizeof(smallbits)) - bits = malloc(ni, M_TEMP, 0); + bits = malloc(ni, M_TEMP, M_WAITOK); else bits = smallbits; error = copyin(uap->fds, bits, ni); diff --git a/sys/kern/sys_pipe.c b/sys/kern/sys_pipe.c index 2612101fc5dd..32c9384521b4 100644 --- a/sys/kern/sys_pipe.c +++ b/sys/kern/sys_pipe.c @@ -206,7 +206,7 @@ pipe(td, uap) KASSERT(pipe_zone != NULL, ("pipe_zone not initialized")); - pmtx = malloc(sizeof(*pmtx), M_TEMP, M_ZERO); + pmtx = malloc(sizeof(*pmtx), M_TEMP, M_WAITOK | M_ZERO); rpipe = wpipe = NULL; if (pipe_create(&rpipe) || pipe_create(&wpipe)) { @@ -346,7 +346,7 @@ pipe_create(cpipep) struct pipe *cpipe; int error; - *cpipep = uma_zalloc(pipe_zone, 0); + *cpipep = uma_zalloc(pipe_zone, M_WAITOK); if (*cpipep == NULL) return (ENOMEM); diff --git a/sys/kern/sysv_msg.c b/sys/kern/sysv_msg.c index 08ca4b5a5f32..47e629c3b246 100644 --- a/sys/kern/sysv_msg.c +++ b/sys/kern/sysv_msg.c @@ -141,16 +141,16 @@ msginit() msginfo.msgmax = msginfo.msgseg * msginfo.msgssz; TUNABLE_INT_FETCH("kern.ipc.msgmni", &msginfo.msgmni); - msgpool = malloc(msginfo.msgmax, M_MSG, 0); + msgpool = malloc(msginfo.msgmax, M_MSG, M_WAITOK); if (msgpool == NULL) panic("msgpool is NULL"); - msgmaps = malloc(sizeof(struct msgmap) * msginfo.msgseg, M_MSG, 0); + msgmaps = malloc(sizeof(struct msgmap) * msginfo.msgseg, M_MSG, M_WAITOK); if (msgmaps == NULL) panic("msgmaps is NULL"); - msghdrs = malloc(sizeof(struct msg) * msginfo.msgtql, M_MSG, 0); + msghdrs = malloc(sizeof(struct msg) * msginfo.msgtql, M_MSG, M_WAITOK); if (msghdrs == NULL) panic("msghdrs is NULL"); - msqids = malloc(sizeof(struct msqid_ds) * msginfo.msgmni, M_MSG, 0); + msqids = malloc(sizeof(struct msqid_ds) * msginfo.msgmni, M_MSG, M_WAITOK); if (msqids == NULL) panic("msqids is NULL"); diff --git a/sys/kern/sysv_sem.c b/sys/kern/sysv_sem.c index 0a7e58b7596e..7eeb625043b7 100644 --- a/sys/kern/sysv_sem.c +++ b/sys/kern/sysv_sem.c @@ -185,12 +185,12 @@ seminit(void) TUNABLE_INT_FETCH("kern.ipc.semvmx", &seminfo.semvmx); TUNABLE_INT_FETCH("kern.ipc.semaem", &seminfo.semaem); - sem = malloc(sizeof(struct sem) * seminfo.semmns, M_SEM, 0); + sem = malloc(sizeof(struct sem) * seminfo.semmns, M_SEM, M_WAITOK); sema = malloc(sizeof(struct semid_ds) * seminfo.semmni, M_SEM, - 0); + M_WAITOK); sema_mtx = malloc(sizeof(struct mtx) * seminfo.semmni, M_SEM, - M_ZERO); - semu = malloc(seminfo.semmnu * seminfo.semusz, M_SEM, 0); + M_WAITOK | M_ZERO); + semu = malloc(seminfo.semmnu * seminfo.semusz, M_SEM, M_WAITOK); for (i = 0; i < seminfo.semmni; i++) { sema[i].sem_base = 0; @@ -644,7 +644,7 @@ __semctl(td, uap) if ((error = copyin(arg, &real_arg, sizeof(real_arg))) != 0) goto done2; array = malloc(sizeof(*array) * semaptr->sem_nsems, M_TEMP, - 0); + M_WAITOK); mtx_lock(sema_mtxp); if ((error = semvalid(uap->semid, semaptr)) != 0) goto done2; @@ -702,7 +702,7 @@ __semctl(td, uap) mtx_unlock(sema_mtxp); if ((error = copyin(arg, &real_arg, sizeof(real_arg))) != 0) goto done2; - array = malloc(sizeof(*array) * count, M_TEMP, 0); + array = malloc(sizeof(*array) * count, M_TEMP, M_WAITOK); copyin(real_arg.array, array, count * sizeof(*array)); if (error) break; @@ -898,7 +898,7 @@ semop(td, uap) nsops)); return (E2BIG); } - sops = malloc(nsops * sizeof(sops[0]), M_SEM, 0); + sops = malloc(nsops * sizeof(sops[0]), M_SEM, M_WAITOK); if ((error = copyin(uap->sops, sops, nsops * sizeof(sops[0]))) != 0) { DPRINTF(("error = %d from copyin(%08x, %08x, %d)\n", error, uap->sops, sops, nsops * sizeof(sops[0]))); diff --git a/sys/kern/sysv_shm.c b/sys/kern/sysv_shm.c index 97f9afb3cad4..d3fa3230ac56 100644 --- a/sys/kern/sysv_shm.c +++ b/sys/kern/sysv_shm.c @@ -314,7 +314,7 @@ shmat(td, uap) shmmap_s = p->p_vmspace->vm_shm; if (shmmap_s == NULL) { size = shminfo.shmseg * sizeof(struct shmmap_state); - shmmap_s = malloc(size, M_SHM, 0); + shmmap_s = malloc(size, M_SHM, M_WAITOK); for (i = 0; i < shminfo.shmseg; i++) shmmap_s[i].shmid = -1; p->p_vmspace->vm_shm = shmmap_s; @@ -643,7 +643,7 @@ shmget_allocate_segment(td, uap, mode) shmseg->shm_perm.key = uap->key; shmseg->shm_perm.seq = (shmseg->shm_perm.seq + 1) & 0x7fff; shm_handle = (struct shm_handle *) - malloc(sizeof(struct shm_handle), M_SHM, 0); + malloc(sizeof(struct shm_handle), M_SHM, M_WAITOK); shmid = IXSEQ_TO_IPCID(segnum, shmseg->shm_perm); /* @@ -756,7 +756,7 @@ shmfork_myhook(p1, p2) int i; size = shminfo.shmseg * sizeof(struct shmmap_state); - shmmap_s = malloc(size, M_SHM, 0); + shmmap_s = malloc(size, M_SHM, M_WAITOK); bcopy(p1->p_vmspace->vm_shm, shmmap_s, size); p2->p_vmspace->vm_shm = shmmap_s; for (i = 0; i < shminfo.shmseg; i++, shmmap_s++) @@ -791,7 +791,7 @@ shmrealloc(void) if (shmalloced >= shminfo.shmmni) return; - newsegs = malloc(shminfo.shmmni * sizeof(*newsegs), M_SHM, 0); + newsegs = malloc(shminfo.shmmni * sizeof(*newsegs), M_SHM, M_WAITOK); if (newsegs == NULL) return; for (i = 0; i < shmalloced; i++) @@ -822,7 +822,7 @@ shminit() TUNABLE_INT_FETCH("kern.ipc.shm_use_phys", &shm_use_phys); shmalloced = shminfo.shmmni; - shmsegs = malloc(shmalloced * sizeof(shmsegs[0]), M_SHM, 0); + shmsegs = malloc(shmalloced * sizeof(shmsegs[0]), M_SHM, M_WAITOK); if (shmsegs == NULL) panic("cannot allocate initial memory for sysvshm"); for (i = 0; i < shmalloced; i++) { diff --git a/sys/kern/tty.c b/sys/kern/tty.c index 2c4e5547d2c2..6f8114eb53fa 100644 --- a/sys/kern/tty.c +++ b/sys/kern/tty.c @@ -2609,7 +2609,7 @@ ttymalloc(struct tty *tp) if (tp) return(tp); - tp = malloc(sizeof *tp, M_TTYS, M_ZERO); + tp = malloc(sizeof *tp, M_TTYS, M_WAITOK | M_ZERO); ttyregister(tp); return (tp); } diff --git a/sys/kern/tty_cons.c b/sys/kern/tty_cons.c index 9d487b7737e0..361a5ddedaa2 100644 --- a/sys/kern/tty_cons.c +++ b/sys/kern/tty_cons.c @@ -277,7 +277,7 @@ sysctl_kern_console(SYSCTL_HANDLER_ARGS) STAILQ_FOREACH(cnd, &cn_devlist, cnd_next) len += strlen(devtoname(cnd->cnd_cn->cn_dev)) + 1; len = len > CNDEVPATHMAX ? len : CNDEVPATHMAX; - MALLOC(name, char *, len, M_TEMP, M_ZERO); + MALLOC(name, char *, len, M_TEMP, M_WAITOK | M_ZERO); p = name; STAILQ_FOREACH(cnd, &cn_devlist, cnd_next) p += sprintf(p, "%s,", devtoname(cnd->cnd_cn->cn_dev)); diff --git a/sys/kern/tty_pty.c b/sys/kern/tty_pty.c index d954ac757083..098108cc80ab 100644 --- a/sys/kern/tty_pty.c +++ b/sys/kern/tty_pty.c @@ -153,7 +153,7 @@ ptyinit(dev_t devc) devc->si_flags &= ~SI_CHEAPCLONE; - pt = malloc(sizeof(*pt), M_PTY, M_ZERO); + pt = malloc(sizeof(*pt), M_PTY, M_WAITOK | M_ZERO); pt->devs = devs = make_dev(&pts_cdevsw, n, UID_ROOT, GID_WHEEL, 0666, "tty%c%r", names[n / 32], n % 32); pt->devc = devc; diff --git a/sys/kern/tty_subr.c b/sys/kern/tty_subr.c index e4da151d2cc8..165f628e256f 100644 --- a/sys/kern/tty_subr.c +++ b/sys/kern/tty_subr.c @@ -135,8 +135,8 @@ cblock_alloc_cblocks(number) cbp = malloc(sizeof *cbp, M_TTYS, M_NOWAIT); if (cbp == NULL) { printf( -"cblock_alloc_cblocks: M_NOWAIT malloc failed, trying blocking malloc\n"); - cbp = malloc(sizeof *cbp, M_TTYS, 0); +"cblock_alloc_cblocks: M_NOWAIT malloc failed, trying M_WAITOK\n"); + cbp = malloc(sizeof *cbp, M_TTYS, M_WAITOK); } /* * Freed cblocks have zero quotes and garbage elsewhere. diff --git a/sys/kern/uipc_accf.c b/sys/kern/uipc_accf.c index 6580e1d72024..b31026af3b68 100644 --- a/sys/kern/uipc_accf.c +++ b/sys/kern/uipc_accf.c @@ -115,7 +115,7 @@ accept_filt_generic_mod_event(module_t mod, int event, void *data) switch (event) { case MOD_LOAD: - MALLOC(p, struct accept_filter *, sizeof(*p), M_ACCF, 0); + MALLOC(p, struct accept_filter *, sizeof(*p), M_ACCF, M_WAITOK); bcopy(accfp, p, sizeof(*p)); s = splnet(); error = accept_filt_add(p); diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c index 4ea316c5aa0d..bc6aa71e683c 100644 --- a/sys/kern/uipc_mbuf.c +++ b/sys/kern/uipc_mbuf.c @@ -164,7 +164,7 @@ m_prepend(struct mbuf *m, int len, int how) /* * Make a copy of an mbuf chain starting "off0" bytes from the beginning, * continuing for "len" bytes. If len is M_COPYALL, copy to end of mbuf. - * The wait parameter is a choice of 0/M_NOWAIT from caller. + * The wait parameter is a choice of M_TRYWAIT/M_DONTWAIT from caller. * Note that the copy is read-only, because clusters are not copied, * only their reference counts are incremented. */ @@ -522,7 +522,7 @@ m_pullup(struct mbuf *n, int len) } else { if (len > MHLEN) goto bad; - MGET(m, M_NOWAIT, n->m_type); + MGET(m, M_DONTWAIT, n->m_type); if (m == NULL) goto bad; m->m_len = 0; @@ -639,7 +639,7 @@ m_devget(char *buf, int totlen, int off, struct ifnet *ifp, if (off < 0 || off > MHLEN) return (NULL); - MGETHDR(m, M_NOWAIT, MT_DATA); + MGETHDR(m, M_DONTWAIT, MT_DATA); if (m == NULL) return (NULL); m->m_pkthdr.rcvif = ifp; @@ -648,7 +648,7 @@ m_devget(char *buf, int totlen, int off, struct ifnet *ifp, while (totlen > 0) { if (top) { - MGET(m, M_NOWAIT, MT_DATA); + MGET(m, M_DONTWAIT, MT_DATA); if (m == NULL) { m_freem(top); return (NULL); @@ -656,7 +656,7 @@ m_devget(char *buf, int totlen, int off, struct ifnet *ifp, len = MLEN; } if (totlen + off >= MINCLSIZE) { - MCLGET(m, M_NOWAIT); + MCLGET(m, M_DONTWAIT); if (m->m_flags & M_EXT) len = MCLBYTES; } else { @@ -704,7 +704,7 @@ m_copyback(struct mbuf *m0, int off, int len, caddr_t cp) off -= mlen; totlen += mlen; if (m->m_next == NULL) { - n = m_get_clrd(M_NOWAIT, m->m_type); + n = m_get_clrd(M_DONTWAIT, m->m_type); if (n == NULL) goto out; n->m_len = min(MLEN, len + off); @@ -723,7 +723,7 @@ m_copyback(struct mbuf *m0, int off, int len, caddr_t cp) if (len == 0) break; if (m->m_next == NULL) { - n = m_get(M_NOWAIT, m->m_type); + n = m_get(M_DONTWAIT, m->m_type); if (n == NULL) break; n->m_len = min(MLEN, len); diff --git a/sys/kern/uipc_mbuf2.c b/sys/kern/uipc_mbuf2.c index 336ffa5e27de..50b37f54ec44 100644 --- a/sys/kern/uipc_mbuf2.c +++ b/sys/kern/uipc_mbuf2.c @@ -171,7 +171,7 @@ m_pulldown(struct mbuf *m, int off, int len, int *offp) * chop the current mbuf into two pieces, set off to 0. */ if (len <= n->m_len - off) { - o = m_dup1(n, off, n->m_len - off, M_NOWAIT); + o = m_dup1(n, off, n->m_len - off, M_DONTWAIT); if (o == NULL) { m_freem(m); return NULL; /* ENOBUFS */ @@ -230,9 +230,9 @@ m_pulldown(struct mbuf *m, int off, int len, int *offp) * now, we need to do the hard way. don't m_copy as there's no room * on both end. */ - MGET(o, M_NOWAIT, m->m_type); + MGET(o, M_DONTWAIT, m->m_type); if (o && len > MLEN) { - MCLGET(o, M_NOWAIT); + MCLGET(o, M_DONTWAIT); if ((o->m_flags & M_EXT) == 0) { m_free(o); o = NULL; diff --git a/sys/kern/uipc_sem.c b/sys/kern/uipc_sem.c index 3d9d5b551d00..e3912e1b1cb9 100644 --- a/sys/kern/uipc_sem.c +++ b/sys/kern/uipc_sem.c @@ -188,7 +188,7 @@ sem_create(td, name, ksret, mode, value) uc = p->p_ucred; if (value > SEM_VALUE_MAX) return (EINVAL); - ret = malloc(sizeof(*ret), M_SEM, M_ZERO); + ret = malloc(sizeof(*ret), M_SEM, M_WAITOK | M_ZERO); if (name != NULL) { len = strlen(name); if (len > SEM_MAX_NAMELEN) { @@ -200,7 +200,7 @@ sem_create(td, name, ksret, mode, value) free(ret, M_SEM); return (EINVAL); } - ret->ks_name = malloc(len + 1, M_SEM, 0); + ret->ks_name = malloc(len + 1, M_SEM, M_WAITOK); strcpy(ret->ks_name, name); } else { ret->ks_name = NULL; @@ -504,7 +504,7 @@ sem_enter(p, ks) { struct kuser *ku, *k; - ku = malloc(sizeof(*ku), M_SEM, 0); + ku = malloc(sizeof(*ku), M_SEM, M_WAITOK); ku->ku_pid = p->p_pid; mtx_lock(&sem_lock); k = sem_getuser(p, ks); diff --git a/sys/kern/uipc_sockbuf.c b/sys/kern/uipc_sockbuf.c index 2ca7010288ec..b63eb1ae54c2 100644 --- a/sys/kern/uipc_sockbuf.c +++ b/sys/kern/uipc_sockbuf.c @@ -315,7 +315,7 @@ sowakeup(so, sb) if ((so->so_state & SS_ASYNC) && so->so_sigio != NULL) pgsigio(&so->so_sigio, SIGIO, 0); if (sb->sb_flags & SB_UPCALL) - (*so->so_upcall)(so, so->so_upcallarg, M_NOWAIT); + (*so->so_upcall)(so, so->so_upcallarg, M_DONTWAIT); if (sb->sb_flags & SB_AIO) aio_swake(so, sb); KNOTE(&sb->sb_sel.si_note, 0); @@ -626,7 +626,7 @@ sbappendaddr(sb, asa, m0, control) return (0); if (asa->sa_len > MLEN) return (0); - MGET(m, M_NOWAIT, MT_SONAME); + MGET(m, M_DONTWAIT, MT_SONAME); if (m == 0) return (0); m->m_len = asa->sa_len; @@ -833,10 +833,10 @@ sbcreatecontrol(p, size, type, level) if (CMSG_SPACE((u_int)size) > MCLBYTES) return ((struct mbuf *) NULL); - if ((m = m_get(M_NOWAIT, MT_CONTROL)) == NULL) + if ((m = m_get(M_DONTWAIT, MT_CONTROL)) == NULL) return ((struct mbuf *) NULL); if (CMSG_SPACE((u_int)size) > MLEN) { - MCLGET(m, M_NOWAIT); + MCLGET(m, M_DONTWAIT); if ((m->m_flags & M_EXT) == 0) { m_free(m); return ((struct mbuf *) NULL); @@ -924,7 +924,7 @@ dup_sockaddr(sa, canwait) struct sockaddr *sa2; MALLOC(sa2, struct sockaddr *, sa->sa_len, M_SONAME, - canwait ? 0 : M_NOWAIT); + canwait ? M_WAITOK : M_NOWAIT); if (sa2) bcopy(sa, sa2, sa->sa_len); return sa2; diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index 1ab28851f83d..4163f2e1d495 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -137,7 +137,7 @@ soalloc(waitok) int flag; if (waitok == 1) - flag = 0; + flag = M_WAITOK; else flag = M_NOWAIT; flag |= M_ZERO; @@ -482,7 +482,7 @@ sodisconnect(so) return (error); } -#define SBLOCKWAIT(f) (((f) & MSG_DONTWAIT) ? M_NOWAIT : 0) +#define SBLOCKWAIT(f) (((f) & MSG_DONTWAIT) ? M_NOWAIT : M_WAITOK) /* * Send on a socket. * If send must go all at once and message is larger than @@ -626,7 +626,7 @@ sosend(so, addr, uio, top, control, flags, td) cow_send = 0; #endif /* ZERO_COPY_SOCKETS */ if (top == 0) { - MGETHDR(m, 0, MT_DATA); + MGETHDR(m, M_TRYWAIT, MT_DATA); if (m == NULL) { error = ENOBUFS; goto release; @@ -635,7 +635,7 @@ sosend(so, addr, uio, top, control, flags, td) m->m_pkthdr.len = 0; m->m_pkthdr.rcvif = (struct ifnet *)0; } else { - MGET(m, 0, MT_DATA); + MGET(m, M_TRYWAIT, MT_DATA); if (m == NULL) { error = ENOBUFS; goto release; @@ -657,7 +657,7 @@ sosend(so, addr, uio, top, control, flags, td) } if (!cow_send){ #endif /* ZERO_COPY_SOCKETS */ - MCLGET(m, 0); + MCLGET(m, M_TRYWAIT); if ((m->m_flags & M_EXT) == 0) goto nopages; mlen = MCLBYTES; @@ -788,7 +788,7 @@ soreceive(so, psa, uio, mp0, controlp, flagsp) else flags = 0; if (flags & MSG_OOB) { - m = m_get(0, MT_DATA); + m = m_get(M_TRYWAIT, MT_DATA); if (m == NULL) return (ENOBUFS); error = (*pr->pr_usrreqs->pru_rcvoob)(so, m, flags & MSG_PEEK); @@ -1025,7 +1025,7 @@ soreceive(so, psa, uio, mp0, controlp, flagsp) moff += len; else { if (mp) - *mp = m_copym(m, 0, len, 0); + *mp = m_copym(m, 0, len, M_TRYWAIT); m->m_data += len; m->m_len -= len; so->so_rcv.sb_cc -= len; @@ -1128,7 +1128,7 @@ sorflush(so) struct sockbuf asb; sb->sb_flags |= SB_NOINTR; - (void) sblock(sb, 0); + (void) sblock(sb, M_WAITOK); s = splimp(); socantrcvmore(so); sbunlock(sb); @@ -1180,7 +1180,7 @@ do_setopt_accept_filter(so, sopt) goto out; } /* don't put large objects on the kernel stack */ - MALLOC(afap, struct accept_filter_arg *, sizeof(*afap), M_TEMP, 0); + MALLOC(afap, struct accept_filter_arg *, sizeof(*afap), M_TEMP, M_WAITOK); error = sooptcopyin(sopt, afap, sizeof *afap, sizeof *afap); afap->af_name[sizeof(afap->af_name)-1] = '\0'; afap->af_arg[sizeof(afap->af_arg)-1] = '\0'; @@ -1191,12 +1191,12 @@ do_setopt_accept_filter(so, sopt) error = ENOENT; goto out; } - MALLOC(af, struct so_accf *, sizeof(*af), M_ACCF, M_ZERO); + MALLOC(af, struct so_accf *, sizeof(*af), M_ACCF, M_WAITOK | M_ZERO); if (afp->accf_create != NULL) { if (afap->af_name[0] != '\0') { int len = strlen(afap->af_name) + 1; - MALLOC(af->so_accept_filter_str, char *, len, M_ACCF, 0); + MALLOC(af->so_accept_filter_str, char *, len, M_ACCF, M_WAITOK); strcpy(af->so_accept_filter_str, afap->af_name); } af->so_accept_filter_arg = afp->accf_create(so, afap->af_arg); @@ -1478,7 +1478,7 @@ sogetopt(so, sopt) if ((so->so_options & SO_ACCEPTCONN) == 0) return (EINVAL); MALLOC(afap, struct accept_filter_arg *, sizeof(*afap), - M_TEMP, M_ZERO); + M_TEMP, M_WAITOK | M_ZERO); if ((so->so_options & SO_ACCEPTFILTER) != 0) { strcpy(afap->af_name, so->so_accf->so_accept_filter->accf_name); if (so->so_accf->so_accept_filter_str != NULL) @@ -1581,11 +1581,11 @@ soopt_getm(struct sockopt *sopt, struct mbuf **mp) struct mbuf *m, *m_prev; int sopt_size = sopt->sopt_valsize; - MGET(m, sopt->sopt_td ? 0 : M_NOWAIT, MT_DATA); + MGET(m, sopt->sopt_td ? M_TRYWAIT : M_DONTWAIT, MT_DATA); if (m == 0) return ENOBUFS; if (sopt_size > MLEN) { - MCLGET(m, sopt->sopt_td ? 0 : M_NOWAIT); + MCLGET(m, sopt->sopt_td ? M_TRYWAIT : M_DONTWAIT); if ((m->m_flags & M_EXT) == 0) { m_free(m); return ENOBUFS; @@ -1599,13 +1599,13 @@ soopt_getm(struct sockopt *sopt, struct mbuf **mp) m_prev = m; while (sopt_size) { - MGET(m, sopt->sopt_td ? 0 : M_NOWAIT, MT_DATA); + MGET(m, sopt->sopt_td ? M_TRYWAIT : M_DONTWAIT, MT_DATA); if (m == 0) { m_freem(*mp); return ENOBUFS; } if (sopt_size > MLEN) { - MCLGET(m, sopt->sopt_td ? 0 : M_NOWAIT); + MCLGET(m, sopt->sopt_td ? M_TRYWAIT : M_DONTWAIT); if ((m->m_flags & M_EXT) == 0) { m_freem(*mp); return ENOBUFS; diff --git a/sys/kern/uipc_socket2.c b/sys/kern/uipc_socket2.c index 2ca7010288ec..b63eb1ae54c2 100644 --- a/sys/kern/uipc_socket2.c +++ b/sys/kern/uipc_socket2.c @@ -315,7 +315,7 @@ sowakeup(so, sb) if ((so->so_state & SS_ASYNC) && so->so_sigio != NULL) pgsigio(&so->so_sigio, SIGIO, 0); if (sb->sb_flags & SB_UPCALL) - (*so->so_upcall)(so, so->so_upcallarg, M_NOWAIT); + (*so->so_upcall)(so, so->so_upcallarg, M_DONTWAIT); if (sb->sb_flags & SB_AIO) aio_swake(so, sb); KNOTE(&sb->sb_sel.si_note, 0); @@ -626,7 +626,7 @@ sbappendaddr(sb, asa, m0, control) return (0); if (asa->sa_len > MLEN) return (0); - MGET(m, M_NOWAIT, MT_SONAME); + MGET(m, M_DONTWAIT, MT_SONAME); if (m == 0) return (0); m->m_len = asa->sa_len; @@ -833,10 +833,10 @@ sbcreatecontrol(p, size, type, level) if (CMSG_SPACE((u_int)size) > MCLBYTES) return ((struct mbuf *) NULL); - if ((m = m_get(M_NOWAIT, MT_CONTROL)) == NULL) + if ((m = m_get(M_DONTWAIT, MT_CONTROL)) == NULL) return ((struct mbuf *) NULL); if (CMSG_SPACE((u_int)size) > MLEN) { - MCLGET(m, M_NOWAIT); + MCLGET(m, M_DONTWAIT); if ((m->m_flags & M_EXT) == 0) { m_free(m); return ((struct mbuf *) NULL); @@ -924,7 +924,7 @@ dup_sockaddr(sa, canwait) struct sockaddr *sa2; MALLOC(sa2, struct sockaddr *, sa->sa_len, M_SONAME, - canwait ? 0 : M_NOWAIT); + canwait ? M_WAITOK : M_NOWAIT); if (sa2) bcopy(sa, sa2, sa->sa_len); return sa2; diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c index d0ccfa0271a7..e38bb90f5352 100644 --- a/sys/kern/uipc_syscalls.c +++ b/sys/kern/uipc_syscalls.c @@ -673,7 +673,7 @@ sendit(td, s, mp, flags) if (mp->msg_flags == MSG_COMPAT) { register struct cmsghdr *cm; - M_PREPEND(control, sizeof(*cm), 0); + M_PREPEND(control, sizeof(*cm), M_TRYWAIT); if (control == 0) { error = ENOBUFS; goto bad; @@ -691,7 +691,7 @@ sendit(td, s, mp, flags) #ifdef KTRACE if (KTRPOINT(td, KTR_GENIO)) { iovlen = auio.uio_iovcnt * sizeof (struct iovec); - MALLOC(ktriov, struct iovec *, iovlen, M_TEMP, 0); + MALLOC(ktriov, struct iovec *, iovlen, M_TEMP, M_WAITOK); bcopy(auio.uio_iov, ktriov, iovlen); ktruio = auio; } @@ -823,7 +823,7 @@ osendmsg(td, uap) } MALLOC(iov, struct iovec *, sizeof(struct iovec) * (u_int)msg.msg_iovlen, M_IOV, - 0); + M_WAITOK); } else { iov = aiov; } @@ -870,7 +870,7 @@ sendmsg(td, uap) } MALLOC(iov, struct iovec *, sizeof(struct iovec) * (u_int)msg.msg_iovlen, M_IOV, - 0); + M_WAITOK); } else { iov = aiov; } @@ -940,7 +940,7 @@ recvit(td, s, mp, namelenp) #ifdef KTRACE if (KTRPOINT(td, KTR_GENIO)) { iovlen = auio.uio_iovcnt * sizeof (struct iovec); - MALLOC(ktriov, struct iovec *, iovlen, M_TEMP, 0); + MALLOC(ktriov, struct iovec *, iovlen, M_TEMP, M_WAITOK); bcopy(auio.uio_iov, ktriov, iovlen); ktruio = auio; } @@ -1170,7 +1170,7 @@ orecvmsg(td, uap) } MALLOC(iov, struct iovec *, sizeof(struct iovec) * (u_int)msg.msg_iovlen, M_IOV, - 0); + M_WAITOK); } else { iov = aiov; } @@ -1221,7 +1221,7 @@ recvmsg(td, uap) } MALLOC(iov, struct iovec *, sizeof(struct iovec) * (u_int)msg.msg_iovlen, M_IOV, - 0); + M_WAITOK); } else { iov = aiov; } @@ -1557,7 +1557,7 @@ sockargs(mp, buf, buflen, type) #endif return (EINVAL); } - m = m_get(0, type); + m = m_get(M_TRYWAIT, type); if (m == NULL) return (ENOBUFS); m->m_len = buflen; @@ -1590,7 +1590,7 @@ getsockaddr(namp, uaddr, len) if (len > SOCK_MAXADDRLEN) return ENAMETOOLONG; - MALLOC(sa, struct sockaddr *, len, M_SONAME, 0); + MALLOC(sa, struct sockaddr *, len, M_SONAME, M_WAITOK); error = copyin(uaddr, sa, len); if (error) { FREE(sa, M_SONAME); @@ -1804,7 +1804,7 @@ do_sendfile(struct thread *td, struct sendfile_args *uap, int compat) /* * Protect against multiple writers to the socket. */ - (void) sblock(&so->so_snd, 0); + (void) sblock(&so->so_snd, M_WAITOK); /* * Loop through the pages in the file, starting with the requested @@ -1948,7 +1948,7 @@ do_sendfile(struct thread *td, struct sendfile_args *uap, int compat) /* * Get an mbuf header and set it up as having external storage. */ - MGETHDR(m, 0, MT_DATA); + MGETHDR(m, M_TRYWAIT, MT_DATA); if (m == NULL) { error = ENOBUFS; sf_buf_free((void *)sf->kva, NULL); diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c index 51c7d84e7f21..e3d3e3b219ec 100644 --- a/sys/kern/uipc_usrreq.c +++ b/sys/kern/uipc_usrreq.c @@ -541,7 +541,7 @@ unp_attach(so) if (error) return (error); } - unp = uma_zalloc(unp_zone, 0); + unp = uma_zalloc(unp_zone, M_WAITOK); if (unp == NULL) return (ENOBUFS); bzero(unp, sizeof *unp); @@ -610,7 +610,7 @@ unp_bind(unp, nam, td) if (namelen <= 0) return EINVAL; - buf = malloc(namelen + 1, M_TEMP, 0); + buf = malloc(namelen + 1, M_TEMP, M_WAITOK); strlcpy(buf, soun->sun_path, namelen + 1); restart: @@ -851,7 +851,7 @@ unp_pcblist(SYSCTL_HANDLER_ARGS) /* * OK, now we're committed to doing something. */ - xug = malloc(sizeof(*xug), M_TEMP, 0); + xug = malloc(sizeof(*xug), M_TEMP, M_WAITOK); gencnt = unp_gencnt; n = unp_count; @@ -865,7 +865,7 @@ unp_pcblist(SYSCTL_HANDLER_ARGS) return error; } - unp_list = malloc(n * sizeof *unp_list, M_TEMP, 0); + unp_list = malloc(n * sizeof *unp_list, M_TEMP, M_WAITOK); for (unp = LIST_FIRST(head), i = 0; unp && i < n; unp = LIST_NEXT(unp, unp_link)) { @@ -879,7 +879,7 @@ unp_pcblist(SYSCTL_HANDLER_ARGS) n = i; /* in case we lost some during malloc */ error = 0; - xu = malloc(sizeof(*xu), M_TEMP, 0); + xu = malloc(sizeof(*xu), M_TEMP, M_WAITOK); for (i = 0; i < n; i++) { unp = unp_list[i]; if (unp->unp_gencnt <= gencnt) { @@ -1385,7 +1385,7 @@ unp_gc() * * 91/09/19, bsy@cs.cmu.edu */ - extra_ref = malloc(nfiles * sizeof(struct file *), M_TEMP, 0); + extra_ref = malloc(nfiles * sizeof(struct file *), M_TEMP, M_WAITOK); sx_slock(&filelist_lock); for (nunref = 0, fp = LIST_FIRST(&filehead), fpp = extra_ref; fp != 0; fp = nextfp) { diff --git a/sys/kern/vfs_aio.c b/sys/kern/vfs_aio.c index 5cee627cff24..9532ff21bf2e 100644 --- a/sys/kern/vfs_aio.c +++ b/sys/kern/vfs_aio.c @@ -392,7 +392,7 @@ aio_init_aioinfo(struct proc *p) struct kaioinfo *ki; if (p->p_aioinfo == NULL) { - ki = uma_zalloc(kaio_zone, 0); + ki = uma_zalloc(kaio_zone, M_WAITOK); p->p_aioinfo = ki; ki->kaio_flags = 0; ki->kaio_maxactive_count = max_aio_per_proc; @@ -777,7 +777,7 @@ aio_daemon(void *uproc) * Allocate and ready the aio control info. There is one aiop structure * per daemon. */ - aiop = uma_zalloc(aiop_zone, 0); + aiop = uma_zalloc(aiop_zone, M_WAITOK); aiop->aiothread = td; aiop->aiothreadflags |= AIOP_FREE; @@ -801,9 +801,9 @@ aio_daemon(void *uproc) mtx_unlock(&Giant); /* The daemon resides in its own pgrp. */ MALLOC(newpgrp, struct pgrp *, sizeof(struct pgrp), M_PGRP, - M_ZERO); + M_WAITOK | M_ZERO); MALLOC(newsess, struct session *, sizeof(struct session), M_SESSION, - M_ZERO); + M_WAITOK | M_ZERO); sx_xlock(&proctree_lock); enterpgrp(mycp, mycp->p_pid, newpgrp, newsess); @@ -1301,7 +1301,7 @@ _aio_aqueue(struct thread *td, struct aiocb *job, struct aio_liojob *lj, int typ struct kqueue *kq; struct file *kq_fp; - aiocbe = uma_zalloc(aiocb_zone, 0); + aiocbe = uma_zalloc(aiocb_zone, M_WAITOK); aiocbe->inputcharge = 0; aiocbe->outputcharge = 0; callout_handle_init(&aiocbe->timeouthandle); @@ -1647,8 +1647,8 @@ aio_suspend(struct thread *td, struct aio_suspend_args *uap) return (EAGAIN); njoblist = 0; - ijoblist = uma_zalloc(aiol_zone, 0); - ujoblist = uma_zalloc(aiol_zone, 0); + ijoblist = uma_zalloc(aiol_zone, M_WAITOK); + ujoblist = uma_zalloc(aiol_zone, M_WAITOK); cbptr = uap->aiocbp; for (i = 0; i < uap->nent; i++) { @@ -1971,7 +1971,7 @@ lio_listio(struct thread *td, struct lio_listio_args *uap) if ((nent + ki->kaio_queue_count) > ki->kaio_qallowed_count) return (EAGAIN); - lj = uma_zalloc(aiolio_zone, 0); + lj = uma_zalloc(aiolio_zone, M_WAITOK); if (!lj) return (EAGAIN); diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index 104043cd65e5..a1f31e18728d 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -2742,7 +2742,7 @@ allocbuf(struct buf *bp, int size) (bp->b_bufsize == 0) && (mbsize <= PAGE_SIZE/2)) { - bp->b_data = malloc(mbsize, M_BIOBUF, 0); + bp->b_data = malloc(mbsize, M_BIOBUF, M_WAITOK); bp->b_bufsize = mbsize; bp->b_bcount = size; bp->b_flags |= B_MALLOC; diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index 33fc4f0ef059..cac844e4269d 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -417,7 +417,7 @@ cache_enter(dvp, vp, cnp) } ncp = (struct namecache *) - malloc(sizeof *ncp + cnp->cn_namelen, M_VFSCACHE, 0); + malloc(sizeof *ncp + cnp->cn_namelen, M_VFSCACHE, M_WAITOK); bzero((char *)ncp, sizeof *ncp); numcache++; if (!vp) { @@ -737,7 +737,7 @@ kern___getcwd(struct thread *td, u_char *buf, enum uio_seg bufseg, u_int buflen) if (buflen > MAXPATHLEN) buflen = MAXPATHLEN; error = 0; - tmpbuf = bp = malloc(buflen, M_TEMP, 0); + tmpbuf = bp = malloc(buflen, M_TEMP, M_WAITOK); bp += buflen - 1; *bp = '\0'; fdp = td->td_proc->p_fd; @@ -848,7 +848,7 @@ vn_fullpath(struct thread *td, struct vnode *vn, char **retbuf, char **freebuf) return (ENODEV); if (vn == NULL) return (EINVAL); - buf = malloc(MAXPATHLEN, M_TEMP, 0); + buf = malloc(MAXPATHLEN, M_TEMP, M_WAITOK); bp = buf + MAXPATHLEN - 1; *bp = '\0'; fdp = td->td_proc->p_fd; diff --git a/sys/kern/vfs_cluster.c b/sys/kern/vfs_cluster.c index da8441978fb1..7fd04023a8f0 100644 --- a/sys/kern/vfs_cluster.c +++ b/sys/kern/vfs_cluster.c @@ -1001,7 +1001,7 @@ cluster_collectbufs(vp, last_bp) len = vp->v_lastw - vp->v_cstart + 1; buflist = malloc(sizeof(struct buf *) * (len + 1) + sizeof(*buflist), - M_SEGMENT, 0); + M_SEGMENT, M_WAITOK); buflist->bs_nchildren = 0; buflist->bs_children = (struct buf **) (buflist + 1); for (lbn = vp->v_cstart, i = 0; i < len; lbn++, i++) { diff --git a/sys/kern/vfs_export.c b/sys/kern/vfs_export.c index 80158a34f1e2..b909b8304246 100644 --- a/sys/kern/vfs_export.c +++ b/sys/kern/vfs_export.c @@ -122,7 +122,7 @@ vfs_hang_addrlist(mp, nep, argp) return (EINVAL); i = sizeof(struct netcred) + argp->ex_addrlen + argp->ex_masklen; - np = (struct netcred *) malloc(i, M_NETADDR, M_ZERO); + np = (struct netcred *) malloc(i, M_NETADDR, M_WAITOK | M_ZERO); saddr = (struct sockaddr *) (np + 1); if ((error = copyin(argp->ex_addr, saddr, argp->ex_addrlen))) goto out; @@ -236,7 +236,7 @@ vfs_export(mp, argp) } if (argp->ex_flags & MNT_EXPORTED) { if (nep == NULL) { - nep = malloc(sizeof(struct netexport), M_MOUNT, M_ZERO); + nep = malloc(sizeof(struct netexport), M_MOUNT, M_WAITOK | M_ZERO); mp->mnt_export = nep; } if (argp->ex_flags & MNT_EXPUBLIC) { @@ -306,7 +306,7 @@ vfs_setpublicfs(mp, nep, argp) */ if (argp->ex_indexfile != NULL) { MALLOC(nfs_pub.np_index, char *, MAXNAMLEN + 1, M_TEMP, - 0); + M_WAITOK); error = copyinstr(argp->ex_indexfile, nfs_pub.np_index, MAXNAMLEN, (size_t *)0); if (!error) { diff --git a/sys/kern/vfs_extattr.c b/sys/kern/vfs_extattr.c index 0c89a944ae87..0592e9711649 100644 --- a/sys/kern/vfs_extattr.c +++ b/sys/kern/vfs_extattr.c @@ -1105,7 +1105,7 @@ kern_symlink(struct thread *td, char *path, char *link, enum uio_seg segflg) if (segflg == UIO_SYSSPACE) { syspath = path; } else { - syspath = uma_zalloc(namei_zone, 0); + syspath = uma_zalloc(namei_zone, M_WAITOK); if ((error = copyinstr(path, syspath, MAXPATHLEN, NULL)) != 0) goto out; } @@ -3111,7 +3111,7 @@ ogetdirentries(td, uap) kuio.uio_iov = &kiov; kuio.uio_segflg = UIO_SYSSPACE; kiov.iov_len = uap->count; - MALLOC(dirbuf, caddr_t, uap->count, M_TEMP, 0); + MALLOC(dirbuf, caddr_t, uap->count, M_TEMP, M_WAITOK); kiov.iov_base = dirbuf; error = VOP_READDIR(vp, &kuio, fp->f_cred, &eofflag, NULL, NULL); diff --git a/sys/kern/vfs_init.c b/sys/kern/vfs_init.c index 24ae27acc1e4..b221cd3aa3cb 100644 --- a/sys/kern/vfs_init.c +++ b/sys/kern/vfs_init.c @@ -133,7 +133,7 @@ vfs_opv_recalc(void) * detectable. */ MALLOC(vfs_op_offsets, int *, - num_op_descs * sizeof(int), M_TEMP, 0); + num_op_descs * sizeof(int), M_TEMP, M_WAITOK); if (vfs_op_offsets == NULL) panic("vfs_opv_recalc: no memory"); for (i = 0; i < num_op_descs; i++) @@ -186,7 +186,7 @@ vfs_opv_recalc(void) if (*opv_desc_vector_p == NULL) MALLOC(*opv_desc_vector_p, vop_t **, vfs_opv_numops * sizeof(vop_t *), M_VNODE, - M_ZERO); + M_WAITOK | M_ZERO); /* Fill in, with slot 0 being to return EOPNOTSUPP */ opv_desc_vector = *opv_desc_vector_p; @@ -221,7 +221,7 @@ vfs_add_vnodeops(const void *data) opv = (const struct vnodeopv_desc *)data; MALLOC(newopv, const struct vnodeopv_desc **, - (vnodeopv_num + 1) * sizeof(*newopv), M_VNODE, 0); + (vnodeopv_num + 1) * sizeof(*newopv), M_VNODE, M_WAITOK); if (vnodeopv_descs) { bcopy(vnodeopv_descs, newopv, vnodeopv_num * sizeof(*newopv)); FREE(vnodeopv_descs, M_VNODE); @@ -244,11 +244,11 @@ vfs_add_vnodeops(const void *data) /* not found, new entry */ MALLOC(newop, struct vnodeop_desc **, (num_op_descs + 1) * sizeof(*newop), - M_VNODE, 0); + M_VNODE, M_WAITOK); /* new reference count (for unload) */ MALLOC(newref, int *, (num_op_descs + 1) * sizeof(*newref), - M_VNODE, 0); + M_VNODE, M_WAITOK); if (vfs_op_descs) { bcopy(vfs_op_descs, newop, num_op_descs * sizeof(*newop)); @@ -306,11 +306,11 @@ vfs_rm_vnodeops(const void *data) } MALLOC(newop, struct vnodeop_desc **, (num_op_descs - 1) * sizeof(*newop), - M_VNODE, 0); + M_VNODE, M_WAITOK); /* new reference count (for unload) */ MALLOC(newref, int *, (num_op_descs - 1) * sizeof(*newref), - M_VNODE, 0); + M_VNODE, M_WAITOK); for (k = j; k < (num_op_descs - 1); k++) { vfs_op_descs[k] = vfs_op_descs[k + 1]; vfs_op_desc_refs[k] = vfs_op_desc_refs[k + 1]; @@ -340,7 +340,7 @@ vfs_rm_vnodeops(const void *data) if (opv_desc_vector != NULL) FREE(opv_desc_vector, M_VNODE); MALLOC(newopv, const struct vnodeopv_desc **, - (vnodeopv_num - 1) * sizeof(*newopv), M_VNODE, 0); + (vnodeopv_num - 1) * sizeof(*newopv), M_VNODE, M_WAITOK); bcopy(vnodeopv_descs, newopv, (vnodeopv_num - 1) * sizeof(*newopv)); FREE(vnodeopv_descs, M_VNODE); vnodeopv_descs = newopv; diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c index e33e2c650b6a..f064b6460ad9 100644 --- a/sys/kern/vfs_lookup.c +++ b/sys/kern/vfs_lookup.c @@ -120,7 +120,7 @@ namei(ndp) * name into the buffer. */ if ((cnp->cn_flags & HASBUF) == 0) - cnp->cn_pnbuf = uma_zalloc(namei_zone, 0); + cnp->cn_pnbuf = uma_zalloc(namei_zone, M_WAITOK); if (ndp->ni_segflg == UIO_SYSSPACE) error = copystr(ndp->ni_dirp, cnp->cn_pnbuf, MAXPATHLEN, (size_t *)&ndp->ni_pathlen); @@ -224,7 +224,7 @@ namei(ndp) } #endif if (ndp->ni_pathlen > 1) - cp = uma_zalloc(namei_zone, 0); + cp = uma_zalloc(namei_zone, M_WAITOK); else cp = cnp->cn_pnbuf; aiov.iov_base = cp; diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c index eb208cc7362e..9c47ceb66d0d 100644 --- a/sys/kern/vfs_mount.c +++ b/sys/kern/vfs_mount.c @@ -224,13 +224,13 @@ vfs_buildopts(struct uio *auio, struct vfsoptlist **options) int error, namelen, optlen; iovcnt = auio->uio_iovcnt; - opts = malloc(sizeof(struct vfsoptlist), M_MOUNT, 0); + opts = malloc(sizeof(struct vfsoptlist), M_MOUNT, M_WAITOK); TAILQ_INIT(opts); for (i = 0; i < iovcnt; i += 2) { - opt = malloc(sizeof(struct vfsopt), M_MOUNT, 0); + opt = malloc(sizeof(struct vfsopt), M_MOUNT, M_WAITOK); namelen = auio->uio_iov[i].iov_len; optlen = auio->uio_iov[i + 1].iov_len; - opt->name = malloc(namelen, M_MOUNT, 0); + opt->name = malloc(namelen, M_MOUNT, M_WAITOK); opt->value = NULL; if (auio->uio_segflg == UIO_SYSSPACE) { bcopy(auio->uio_iov[i].iov_base, opt->name, namelen); @@ -242,7 +242,7 @@ vfs_buildopts(struct uio *auio, struct vfsoptlist **options) } opt->len = optlen; if (optlen != 0) { - opt->value = malloc(optlen, M_MOUNT, 0); + opt->value = malloc(optlen, M_MOUNT, M_WAITOK); if (auio->uio_segflg == UIO_SYSSPACE) { bcopy(auio->uio_iov[i + 1].iov_base, opt->value, optlen); @@ -289,11 +289,11 @@ vfs_mergeopts(struct vfsoptlist *toopts, struct vfsoptlist *opts) opt2 = TAILQ_NEXT(opt2, link); } /* We want this option, duplicate it. */ - new = malloc(sizeof(struct vfsopt), M_MOUNT, 0); - new->name = malloc(strlen(opt->name) + 1, M_MOUNT, 0); + new = malloc(sizeof(struct vfsopt), M_MOUNT, M_WAITOK); + new->name = malloc(strlen(opt->name) + 1, M_MOUNT, M_WAITOK); strcpy(new->name, opt->name); if (opt->len != 0) { - new->value = malloc(opt->len, M_MOUNT, 0); + new->value = malloc(opt->len, M_MOUNT, M_WAITOK); bcopy(opt->value, new->value, opt->len); } else { new->value = NULL; @@ -334,7 +334,7 @@ nmount(td, uap) return (EINVAL); if (iovcnt > UIO_SMALLIOV) { - MALLOC(iov, struct iovec *, iovlen, M_IOV, 0); + MALLOC(iov, struct iovec *, iovlen, M_IOV, M_WAITOK); needfree = iov; } else { iov = aiov; @@ -406,8 +406,8 @@ kernel_vmount(int flags, ...) return (EINVAL); iovlen = iovcnt * sizeof (struct iovec); - MALLOC(iovp, struct iovec *, iovlen, M_MOUNT, 0); - MALLOC(buf, char *, len, M_MOUNT, 0); + MALLOC(iovp, struct iovec *, iovlen, M_MOUNT, M_WAITOK); + MALLOC(buf, char *, len, M_MOUNT, M_WAITOK); pos = buf; va_start(ap, flags); for (i = 0; i < iovcnt; i++) { @@ -634,7 +634,7 @@ vfs_nmount(td, fsflags, fsoptions) /* * Allocate and initialize the filesystem. */ - mp = malloc(sizeof(struct mount), M_MOUNT, M_ZERO); + mp = malloc(sizeof(struct mount), M_MOUNT, M_WAITOK | M_ZERO); TAILQ_INIT(&mp->mnt_nvnodelist); TAILQ_INIT(&mp->mnt_reservedvnlist); lockinit(&mp->mnt_lock, PVFS, "vfslock", 0, LK_NOPAUSE); @@ -805,8 +805,8 @@ mount(td, uap) char *fspath; int error; - fstype = malloc(MFSNAMELEN, M_TEMP, 0); - fspath = malloc(MNAMELEN, M_TEMP, 0); + fstype = malloc(MFSNAMELEN, M_TEMP, M_WAITOK); + fspath = malloc(MNAMELEN, M_TEMP, M_WAITOK); /* * vfs_mount() actually takes a kernel string for `type' and @@ -998,7 +998,7 @@ vfs_mount(td, fstype, fspath, fsflags, fsdata) /* * Allocate and initialize the filesystem. */ - mp = malloc(sizeof(struct mount), M_MOUNT, M_ZERO); + mp = malloc(sizeof(struct mount), M_MOUNT, M_WAITOK | M_ZERO); TAILQ_INIT(&mp->mnt_nvnodelist); TAILQ_INIT(&mp->mnt_reservedvnlist); lockinit(&mp->mnt_lock, PVFS, "vfslock", 0, LK_NOPAUSE); @@ -1361,7 +1361,7 @@ vfs_rootmountalloc(fstypename, devname, mpp) break; if (vfsp == NULL) return (ENODEV); - mp = malloc((u_long)sizeof(struct mount), M_MOUNT, M_ZERO); + mp = malloc((u_long)sizeof(struct mount), M_MOUNT, M_WAITOK | M_ZERO); lockinit(&mp->mnt_lock, PVFS, "vfslock", 0, LK_NOPAUSE); (void)vfs_busy(mp, LK_NOWAIT, 0, td); TAILQ_INIT(&mp->mnt_nvnodelist); @@ -1494,8 +1494,8 @@ vfs_mountroot_try(char *mountfrom) splx(s); /* parse vfs name and path */ - vfsname = malloc(MFSNAMELEN, M_MOUNT, 0); - path = malloc(MNAMELEN, M_MOUNT, 0); + vfsname = malloc(MFSNAMELEN, M_MOUNT, M_WAITOK); + path = malloc(MNAMELEN, M_MOUNT, M_WAITOK); vfsname[0] = path[0] = 0; sprintf(patt, "%%%d[a-z0-9]:%%%zds", MFSNAMELEN, MNAMELEN); if (sscanf(mountfrom, patt, vfsname, path) < 1) diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 7f3af03eac91..8e954eb6a48d 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -452,7 +452,7 @@ vop_lock_post(void *ap, int rc) void v_addpollinfo(struct vnode *vp) { - vp->v_pollinfo = uma_zalloc(vnodepoll_zone, 0); + vp->v_pollinfo = uma_zalloc(vnodepoll_zone, M_WAITOK); mtx_init(&vp->v_pollinfo->vpi_lock, "vnode pollinfo", NULL, MTX_DEF); } @@ -996,7 +996,7 @@ getnewvnode(tag, mp, vops, vpp) numvnodes++; mtx_unlock(&vnode_free_list_mtx); - vp = (struct vnode *) uma_zalloc(vnode_zone, M_ZERO); + vp = (struct vnode *) uma_zalloc(vnode_zone, M_WAITOK|M_ZERO); mtx_init(&vp->v_interlock, "vnode interlock", NULL, MTX_DEF); VI_LOCK(vp); vp->v_dd = vp; @@ -2938,7 +2938,7 @@ sysctl_vfs_conflist(SYSCTL_HANDLER_ARGS) cnt = 0; for (vfsp = vfsconf; vfsp != NULL; vfsp = vfsp->vfc_next) cnt++; - xvfsp = malloc(sizeof(struct xvfsconf) * cnt, M_TEMP, 0); + xvfsp = malloc(sizeof(struct xvfsconf) * cnt, M_TEMP, M_WAITOK); /* * Handle the race that we will have here when struct vfsconf * will be locked down by using both cnt and checking vfc_next @@ -3051,7 +3051,7 @@ sysctl_vnode(SYSCTL_HANDLER_ARGS) return (SYSCTL_OUT(req, 0, len)); sysctl_wire_old_buffer(req, 0); - xvn = malloc(len, M_TEMP, M_ZERO | 0); + xvn = malloc(len, M_TEMP, M_ZERO | M_WAITOK); n = 0; mtx_lock(&mountlist_mtx); TAILQ_FOREACH(mp, &mountlist, mnt_list) { diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index 0c89a944ae87..0592e9711649 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -1105,7 +1105,7 @@ kern_symlink(struct thread *td, char *path, char *link, enum uio_seg segflg) if (segflg == UIO_SYSSPACE) { syspath = path; } else { - syspath = uma_zalloc(namei_zone, 0); + syspath = uma_zalloc(namei_zone, M_WAITOK); if ((error = copyinstr(path, syspath, MAXPATHLEN, NULL)) != 0) goto out; } @@ -3111,7 +3111,7 @@ ogetdirentries(td, uap) kuio.uio_iov = &kiov; kuio.uio_segflg = UIO_SYSSPACE; kiov.iov_len = uap->count; - MALLOC(dirbuf, caddr_t, uap->count, M_TEMP, 0); + MALLOC(dirbuf, caddr_t, uap->count, M_TEMP, M_WAITOK); kiov.iov_base = dirbuf; error = VOP_READDIR(vp, &kuio, fp->f_cred, &eofflag, NULL, NULL); diff --git a/sys/libkern/iconv.c b/sys/libkern/iconv.c index 8352fcd1f832..8bc03c1e7a1f 100644 --- a/sys/libkern/iconv.c +++ b/sys/libkern/iconv.c @@ -186,7 +186,7 @@ iconv_register_cspair(const char *to, const char *from, ucsfrom = strcmp(from, iconv_unicode_string) == 0; if (!ucsfrom) csize += strlen(from) + 1; - csp = malloc(csize, M_ICONV, 0); + csp = malloc(csize, M_ICONV, M_WAITOK); bzero(csp, csize); csp->cp_id = iconv_csid++; csp->cp_dcp = dcp; @@ -360,7 +360,7 @@ iconv_sysctl_add(SYSCTL_HANDLER_ARGS) if (error) return error; if (din.ia_datalen) { - csp->cp_data = malloc(din.ia_datalen, M_ICONVDATA, 0); + csp->cp_data = malloc(din.ia_datalen, M_ICONVDATA, M_WAITOK); error = copyin(din.ia_data, csp->cp_data, din.ia_datalen); if (error) goto bad; diff --git a/sys/libkern/iconv_xlat.c b/sys/libkern/iconv_xlat.c index e355c6b42194..6dd2800a535f 100644 --- a/sys/libkern/iconv_xlat.c +++ b/sys/libkern/iconv_xlat.c @@ -62,7 +62,7 @@ iconv_xlat_open(struct iconv_converter_class *dcp, { struct iconv_xlat *dp; - dp = (struct iconv_xlat *)kobj_create((struct kobj_class*)dcp, M_ICONV, 0); + dp = (struct iconv_xlat *)kobj_create((struct kobj_class*)dcp, M_ICONV, M_WAITOK); dp->d_table = csp->cp_data; dp->d_csp = csp; csp->cp_refcount++; diff --git a/sys/net/bpf.c b/sys/net/bpf.c index e5a567df3a27..df210e203939 100644 --- a/sys/net/bpf.c +++ b/sys/net/bpf.c @@ -207,9 +207,9 @@ bpf_movein(uio, linktype, mp, sockp, datlen) return (EIO); if (len > MHLEN) { - m = m_getcl(0, MT_DATA, M_PKTHDR); + m = m_getcl(M_TRYWAIT, MT_DATA, M_PKTHDR); } else { - MGETHDR(m, 0, MT_DATA); + MGETHDR(m, M_TRYWAIT, MT_DATA); } if (m == NULL) return (ENOBUFS); @@ -340,7 +340,7 @@ bpfopen(dev, flags, fmt, td) if ((dev->si_flags & SI_NAMED) == 0) make_dev(&bpf_cdevsw, minor(dev), UID_ROOT, GID_WHEEL, 0600, "bpf%d", dev2unit(dev)); - MALLOC(d, struct bpf_d *, sizeof(*d), M_BPF, M_ZERO); + MALLOC(d, struct bpf_d *, sizeof(*d), M_BPF, M_WAITOK | M_ZERO); dev->si_drv1 = d; d->bd_bufsize = bpf_bufsize; d->bd_sig = SIGIO; @@ -947,7 +947,7 @@ bpf_setf(d, fp) return (EINVAL); size = flen * sizeof(*fp->bf_insns); - fcode = (struct bpf_insn *)malloc(size, M_BPF, 0); + fcode = (struct bpf_insn *)malloc(size, M_BPF, M_WAITOK); if (copyin((caddr_t)fp->bf_insns, (caddr_t)fcode, size) == 0 && bpf_validate(fcode, (int)flen)) { BPFD_LOCK(d); @@ -1247,11 +1247,11 @@ static int bpf_allocbufs(d) register struct bpf_d *d; { - d->bd_fbuf = (caddr_t)malloc(d->bd_bufsize, M_BPF, 0); + d->bd_fbuf = (caddr_t)malloc(d->bd_bufsize, M_BPF, M_WAITOK); if (d->bd_fbuf == 0) return (ENOBUFS); - d->bd_sbuf = (caddr_t)malloc(d->bd_bufsize, M_BPF, 0); + d->bd_sbuf = (caddr_t)malloc(d->bd_bufsize, M_BPF, M_WAITOK); if (d->bd_sbuf == 0) { free(d->bd_fbuf, M_BPF); return (ENOBUFS); diff --git a/sys/net/bpf_compat.h b/sys/net/bpf_compat.h index 16fae349b488..212ac5ff2808 100644 --- a/sys/net/bpf_compat.h +++ b/sys/net/bpf_compat.h @@ -45,7 +45,7 @@ * a fixed offset from the associated mbuf. Sorry for this kludge. */ #define malloc(size, type, canwait) \ -bpf_alloc(size, (canwait & M_NOWAIT) ? M_NOWAIT : 0) +bpf_alloc(size, (canwait & M_NOWAIT) ? M_DONTWAIT : M_TRYWAIT) #define free(cp, type) m_free(*(struct mbuf **)(cp - 8)) diff --git a/sys/net/bridge.c b/sys/net/bridge.c index ff01a22eaa46..6efcc346f1a6 100644 --- a/sys/net/bridge.c +++ b/sys/net/bridge.c @@ -246,7 +246,7 @@ add_cluster(u_int16_t cluster_id, struct arpcom *ac) } c[n_clusters].ht = (struct hash_table *) malloc(HASH_SIZE * sizeof(struct hash_table), - M_IFADDR, M_ZERO); + M_IFADDR, M_WAITOK | M_ZERO); if (c[n_clusters].ht == NULL) { printf("-- bridge: cannot allocate hash table for new cluster\n"); free(c, M_IFADDR); @@ -254,7 +254,7 @@ add_cluster(u_int16_t cluster_id, struct arpcom *ac) } c[n_clusters].my_macs = (struct bdg_addr *) malloc(BDG_MAX_PORTS * sizeof(struct bdg_addr), - M_IFADDR, M_ZERO); + M_IFADDR, M_WAITOK | M_ZERO); if (c[n_clusters].my_macs == NULL) { printf("-- bridge: cannot allocate mac addr table for new cluster\n"); free(c[n_clusters].ht, M_IFADDR); @@ -799,7 +799,7 @@ static struct mbuf * bdg_forward(struct mbuf *m0, struct ifnet *dst) { #define EH_RESTORE(_m) do { \ - M_PREPEND((_m), ETHER_HDR_LEN, M_NOWAIT); \ + M_PREPEND((_m), ETHER_HDR_LEN, M_DONTWAIT); \ if ((_m) == NULL) { \ bdg_dropped++; \ return NULL; \ @@ -976,7 +976,7 @@ bdg_forward(struct mbuf *m0, struct ifnet *dst) struct mbuf *m ; if (shared) { - m = m_copypacket(m0, M_NOWAIT); + m = m_copypacket(m0, M_DONTWAIT); if (m == NULL) { /* copy failed, give up */ bdg_dropped++; return NULL; @@ -1042,7 +1042,7 @@ bdg_forward(struct mbuf *m0, struct ifnet *dst) m = m0 ; m0 = NULL ; /* original is gone */ } else { - m = m_copypacket(m0, M_NOWAIT); + m = m_copypacket(m0, M_DONTWAIT); if (m == NULL) { IFNET_RUNLOCK(); printf("bdg_forward: sorry, m_copypacket failed!\n"); @@ -1091,7 +1091,7 @@ bdginit(void) printf("BRIDGE 020214 loaded\n"); ifp2sc = malloc(BDG_MAX_PORTS * sizeof(struct bdg_softc), - M_IFADDR, M_ZERO ); + M_IFADDR, M_WAITOK | M_ZERO ); if (ifp2sc == NULL) return ENOMEM ; diff --git a/sys/net/bsd_comp.c b/sys/net/bsd_comp.c index 89c5e293b8fd..dd6ab5617933 100644 --- a/sys/net/bsd_comp.c +++ b/sys/net/bsd_comp.c @@ -496,12 +496,12 @@ bsd_compress(state, mret, mp, slen, maxolen) *wptr++ = (v); \ if (wptr >= cp_end) { \ m->m_len = wptr - mtod(m, u_char *); \ - MGET(m->m_next, M_NOWAIT, MT_DATA); \ + MGET(m->m_next, M_DONTWAIT, MT_DATA); \ m = m->m_next; \ if (m) { \ m->m_len = 0; \ if (maxolen - olen > MLEN) \ - MCLGET(m, M_NOWAIT); \ + MCLGET(m, M_DONTWAIT); \ wptr = mtod(m, u_char *); \ cp_end = wptr + M_TRAILINGSPACE(m); \ } else \ @@ -538,12 +538,12 @@ bsd_compress(state, mret, mp, slen, maxolen) maxolen = slen; /* Allocate one mbuf to start with. */ - MGET(m, M_NOWAIT, MT_DATA); + MGET(m, M_DONTWAIT, MT_DATA); *mret = m; if (m != NULL) { m->m_len = 0; if (maxolen + db->hdrlen > MLEN) - MCLGET(m, M_NOWAIT); + MCLGET(m, M_DONTWAIT); m->m_data += db->hdrlen; wptr = mtod(m, u_char *); cp_end = wptr + M_TRAILINGSPACE(m); @@ -872,13 +872,13 @@ bsd_decompress(state, cmp, dmpp) /* * Allocate one mbuf to start with. */ - MGETHDR(dmp, M_NOWAIT, MT_DATA); + MGETHDR(dmp, M_DONTWAIT, MT_DATA); if (dmp == NULL) return DECOMP_ERROR; mret = dmp; dmp->m_len = 0; dmp->m_next = NULL; - MCLGET(dmp, M_NOWAIT); + MCLGET(dmp, M_DONTWAIT); dmp->m_data += db->hdrlen; wptr = mtod(dmp, u_char *); space = M_TRAILINGSPACE(dmp) - PPP_HDRLEN + 1; @@ -987,7 +987,7 @@ bsd_decompress(state, cmp, dmpp) */ if ((space -= codelen + extra) < 0) { dmp->m_len = wptr - mtod(dmp, u_char *); - MGET(m, M_NOWAIT, MT_DATA); + MGET(m, M_DONTWAIT, MT_DATA); if (m == NULL) { m_freem(mret); return DECOMP_ERROR; @@ -995,7 +995,7 @@ bsd_decompress(state, cmp, dmpp) m->m_len = 0; m->m_next = NULL; dmp->m_next = m; - MCLGET(m, M_NOWAIT); + MCLGET(m, M_DONTWAIT); space = M_TRAILINGSPACE(m) - (codelen + extra); if (space < 0) { /* now that's what I call *compression*. */ diff --git a/sys/net/if.c b/sys/net/if.c index d9b3dad76617..599d069a2c0b 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -280,7 +280,7 @@ if_grow(void) if_indexlim <<= 1; n = if_indexlim * sizeof(*e); - e = malloc(n, M_IFADDR, M_ZERO); + e = malloc(n, M_IFADDR, M_WAITOK | M_ZERO); if (ifindex_table != NULL) { memcpy((caddr_t)e, (caddr_t)ifindex_table, n/2); free((caddr_t)ifindex_table, M_IFADDR); @@ -429,7 +429,7 @@ if_attach(ifp) socksize = sizeof(*sdl); socksize = ROUNDUP(socksize); ifasize = sizeof(*ifa) + 2 * socksize; - ifa = (struct ifaddr *)malloc(ifasize, M_IFADDR, M_ZERO); + ifa = (struct ifaddr *)malloc(ifasize, M_IFADDR, M_WAITOK | M_ZERO); if (ifa) { IFA_LOCK_INIT(ifa); sdl = (struct sockaddr_dl *)(ifa + 1); @@ -775,7 +775,7 @@ if_clone_attach(ifc) len = maxclone >> 3; if ((len << 3) < maxclone) len++; - ifc->ifc_units = malloc(len, M_CLONE, M_ZERO); + ifc->ifc_units = malloc(len, M_CLONE, M_WAITOK | M_ZERO); ifc->ifc_bmlen = len; LIST_INSERT_HEAD(&if_cloners, ifc, ifc_list); @@ -1797,8 +1797,8 @@ if_addmulti(ifp, sa, retifma) llsa = 0; } - MALLOC(ifma, struct ifmultiaddr *, sizeof *ifma, M_IFMADDR, 0); - MALLOC(dupsa, struct sockaddr *, sa->sa_len, M_IFMADDR, 0); + MALLOC(ifma, struct ifmultiaddr *, sizeof *ifma, M_IFMADDR, M_WAITOK); + MALLOC(dupsa, struct sockaddr *, sa->sa_len, M_IFMADDR, M_WAITOK); bcopy(sa, dupsa, sa->sa_len); ifma->ifma_addr = dupsa; @@ -1827,9 +1827,9 @@ if_addmulti(ifp, sa, retifma) ifma->ifma_refcount++; } else { MALLOC(ifma, struct ifmultiaddr *, sizeof *ifma, - M_IFMADDR, 0); + M_IFMADDR, M_WAITOK); MALLOC(dupsa, struct sockaddr *, llsa->sa_len, - M_IFMADDR, 0); + M_IFMADDR, M_WAITOK); bcopy(llsa, dupsa, llsa->sa_len); ifma->ifma_addr = dupsa; ifma->ifma_ifp = ifp; diff --git a/sys/net/if_arcsubr.c b/sys/net/if_arcsubr.c index 562149f3972f..667291d46772 100644 --- a/sys/net/if_arcsubr.c +++ b/sys/net/if_arcsubr.c @@ -212,7 +212,7 @@ arc_output(ifp, m, dst, rt0) } isphds = arc_isphds(atype); - M_PREPEND(m, isphds ? ARC_HDRNEWLEN : ARC_HDRLEN, M_NOWAIT); + M_PREPEND(m, isphds ? ARC_HDRNEWLEN : ARC_HDRLEN, M_DONTWAIT); if (m == 0) senderr(ENOBUFS); ah = mtod(m, struct arc_header *); @@ -297,13 +297,13 @@ arc_frag_next(ifp) /* split out next fragment and return it */ if (ac->sflag < ac->fsflag) { /* we CAN'T have short packets here */ - ac->curr_frag = m_split(m, ARC_MAX_DATA, M_NOWAIT); + ac->curr_frag = m_split(m, ARC_MAX_DATA, M_DONTWAIT); if (ac->curr_frag == 0) { m_freem(m); return 0; } - M_PREPEND(m, ARC_HDRNEWLEN, M_NOWAIT); + M_PREPEND(m, ARC_HDRNEWLEN, M_DONTWAIT); if (m == 0) { m_freem(ac->curr_frag); ac->curr_frag = 0; @@ -322,7 +322,7 @@ arc_frag_next(ifp) ARC_MAX_FORBID_LEN - ARC_HDRNEWLEN + 2)) { ac->curr_frag = 0; - M_PREPEND(m, ARC_HDRNEWLEN_EXC, M_NOWAIT); + M_PREPEND(m, ARC_HDRNEWLEN_EXC, M_DONTWAIT); if (m == 0) return 0; @@ -335,7 +335,7 @@ arc_frag_next(ifp) } else { ac->curr_frag = 0; - M_PREPEND(m, ARC_HDRNEWLEN, M_NOWAIT); + M_PREPEND(m, ARC_HDRNEWLEN, M_DONTWAIT); if (m == 0) return 0; diff --git a/sys/net/if_atmsubr.c b/sys/net/if_atmsubr.c index 21b9f07c4482..3ec389443ee9 100644 --- a/sys/net/if_atmsubr.c +++ b/sys/net/if_atmsubr.c @@ -189,7 +189,7 @@ atm_output(ifp, m0, dst, rt0) sz = sizeof(atmdst); atm_flags = ATM_PH_FLAGS(&atmdst); if (atm_flags & ATM_PH_LLCSNAP) sz += 8; /* sizeof snap == 8 */ - M_PREPEND(m, sz, M_NOWAIT); + M_PREPEND(m, sz, M_DONTWAIT); if (m == 0) senderr(ENOBUFS); ad = mtod(m, struct atm_pseudohdr *); diff --git a/sys/net/if_disc.c b/sys/net/if_disc.c index 4bad63764767..79775f1ac3a5 100644 --- a/sys/net/if_disc.c +++ b/sys/net/if_disc.c @@ -87,7 +87,7 @@ disc_clone_create(struct if_clone *ifc, int unit) struct ifnet *ifp; struct disc_softc *sc; - sc = malloc(sizeof(struct disc_softc), M_DISC, 0); + sc = malloc(sizeof(struct disc_softc), M_DISC, M_WAITOK); bzero(sc, sizeof(struct disc_softc)); ifp = &sc->sc_if; diff --git a/sys/net/if_ef.c b/sys/net/if_ef.c index e7362ae7ce42..b064d381045b 100644 --- a/sys/net/if_ef.c +++ b/sys/net/if_ef.c @@ -430,7 +430,7 @@ ef_output(struct ifnet *ifp, struct mbuf **mp, struct sockaddr *dst, short *tp, type = htons(m->m_pkthdr.len); break; case ETHER_FT_8022: - M_PREPEND(m, ETHER_HDR_LEN + 3, 0); + M_PREPEND(m, ETHER_HDR_LEN + 3, M_TRYWAIT); if (m == NULL) { *mp = NULL; return ENOBUFS; @@ -453,7 +453,7 @@ ef_output(struct ifnet *ifp, struct mbuf **mp, struct sockaddr *dst, short *tp, *hlen += 3; break; case ETHER_FT_SNAP: - M_PREPEND(m, 8, 0); + M_PREPEND(m, 8, M_TRYWAIT); if (m == NULL) { *mp = NULL; return ENOBUFS; @@ -484,14 +484,14 @@ ef_clone(struct ef_link *efl, int ft) int ifnlen; efp = (struct efnet*)malloc(sizeof(struct efnet), M_IFADDR, - M_ZERO); + M_WAITOK | M_ZERO); if (efp == NULL) return ENOMEM; efp->ef_ifp = ifp; eifp = &efp->ef_ac.ac_if; ifnlen = 1 + snprintf(cbuf, sizeof(cbuf), "%s%df", ifp->if_name, ifp->if_unit); - ifname = (char*)malloc(ifnlen, M_IFADDR, 0); + ifname = (char*)malloc(ifnlen, M_IFADDR, M_WAITOK); eifp->if_name = strcpy(ifname, cbuf); eifp->if_unit = ft; eifp->if_softc = efp; @@ -514,7 +514,7 @@ ef_load(void) if (ifp->if_type != IFT_ETHER) continue; EFDEBUG("Found interface %s%d\n", ifp->if_name, ifp->if_unit); efl = (struct ef_link*)malloc(sizeof(struct ef_link), - M_IFADDR, M_ZERO); + M_IFADDR, M_WAITOK | M_ZERO); if (efl == NULL) { error = ENOMEM; break; diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c index 537dd1f2c6ac..0af11144bdf5 100644 --- a/sys/net/if_ethersubr.c +++ b/sys/net/if_ethersubr.c @@ -236,7 +236,7 @@ ether_output(ifp, m, dst, rt0) if ( aa->aa_flags & AFA_PHASE2 ) { struct llc llc; - M_PREPEND(m, sizeof(struct llc), 0); + M_PREPEND(m, sizeof(struct llc), M_TRYWAIT); llc.llc_dsap = llc.llc_ssap = LLC_SNAP_LSAP; llc.llc_control = LLC_UI; bcopy(at_org_code, llc.llc_snap_org_code, sizeof(at_org_code)); @@ -261,7 +261,7 @@ ether_output(ifp, m, dst, rt0) type = htons( m->m_pkthdr.len); break; case 0xe0e0: /* Novell 802.2 and Token-Ring */ - M_PREPEND(m, 3, 0); + M_PREPEND(m, 3, M_TRYWAIT); type = htons( m->m_pkthdr.len); cp = mtod(m, u_char *); *cp++ = 0xE0; @@ -312,7 +312,7 @@ ether_output(ifp, m, dst, rt0) * Add local net header. If no space in first mbuf, * allocate another. */ - M_PREPEND(m, sizeof (struct ether_header), M_NOWAIT); + M_PREPEND(m, sizeof (struct ether_header), M_DONTWAIT); if (m == 0) senderr(ENOBUFS); eh = mtod(m, struct ether_header *); @@ -470,7 +470,7 @@ ether_ipfw_chk(struct mbuf **m0, struct ifnet *dst, * Restore Ethernet header, as needed, in case the * mbuf chain was replaced by ipfw. */ - M_PREPEND(m, ETHER_HDR_LEN, M_NOWAIT); + M_PREPEND(m, ETHER_HDR_LEN, M_DONTWAIT); if (m == NULL) { *m0 = m; return 0; @@ -494,7 +494,7 @@ ether_ipfw_chk(struct mbuf **m0, struct ifnet *dst, * If shared, make a copy and keep the original. */ if (shared) { - m = m_copypacket(m, M_NOWAIT); + m = m_copypacket(m, M_DONTWAIT); if (m == NULL) return 0; } else { @@ -893,7 +893,7 @@ ether_demux(struct ifnet *ifp, struct mbuf *m) * Put back the ethernet header so netgraph has a * consistent view of inbound packets. */ - M_PREPEND(m, sizeof (struct ether_header), M_NOWAIT); + M_PREPEND(m, sizeof (struct ether_header), M_DONTWAIT); (*ng_ether_input_orphan_p)(ifp, m); return; } @@ -1112,7 +1112,7 @@ ether_resolvemulti(ifp, llsa, sa) if (!IN_MULTICAST(ntohl(sin->sin_addr.s_addr))) return EADDRNOTAVAIL; MALLOC(sdl, struct sockaddr_dl *, sizeof *sdl, M_IFMADDR, - M_ZERO); + M_WAITOK|M_ZERO); sdl->sdl_len = sizeof *sdl; sdl->sdl_family = AF_LINK; sdl->sdl_index = ifp->if_index; @@ -1139,7 +1139,7 @@ ether_resolvemulti(ifp, llsa, sa) if (!IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr)) return EADDRNOTAVAIL; MALLOC(sdl, struct sockaddr_dl *, sizeof *sdl, M_IFMADDR, - M_ZERO); + M_WAITOK|M_ZERO); sdl->sdl_len = sizeof *sdl; sdl->sdl_family = AF_LINK; sdl->sdl_index = ifp->if_index; diff --git a/sys/net/if_faith.c b/sys/net/if_faith.c index 08a5ca3d25e8..280a0417da62 100644 --- a/sys/net/if_faith.c +++ b/sys/net/if_faith.c @@ -159,7 +159,7 @@ faith_clone_create(ifc, unit) { struct faith_softc *sc; - sc = malloc(sizeof(struct faith_softc), M_FAITH, 0); + sc = malloc(sizeof(struct faith_softc), M_FAITH, M_WAITOK); bzero(sc, sizeof(struct faith_softc)); sc->sc_if.if_softc = sc; diff --git a/sys/net/if_fddisubr.c b/sys/net/if_fddisubr.c index 05ff6ae4e56e..49a5f21811d1 100644 --- a/sys/net/if_fddisubr.c +++ b/sys/net/if_fddisubr.c @@ -203,7 +203,7 @@ fddi_output(ifp, m, dst, rt0) if (aa->aa_flags & AFA_PHASE2) { struct llc llc; - M_PREPEND(m, LLC_SNAPFRAMELEN, 0); + M_PREPEND(m, LLC_SNAPFRAMELEN, M_TRYWAIT); if (m == 0) senderr(ENOBUFS); llc.llc_dsap = llc.llc_ssap = LLC_SNAP_LSAP; @@ -290,7 +290,7 @@ fddi_output(ifp, m, dst, rt0) */ if (type != 0) { struct llc *l; - M_PREPEND(m, LLC_SNAPFRAMELEN, M_NOWAIT); + M_PREPEND(m, LLC_SNAPFRAMELEN, M_DONTWAIT); if (m == 0) senderr(ENOBUFS); l = mtod(m, struct llc *); @@ -305,7 +305,7 @@ fddi_output(ifp, m, dst, rt0) * Add local net header. If no space in first mbuf, * allocate another. */ - M_PREPEND(m, FDDI_HDR_LEN, M_NOWAIT); + M_PREPEND(m, FDDI_HDR_LEN, M_DONTWAIT); if (m == 0) senderr(ENOBUFS); fh = mtod(m, struct fddi_header *); @@ -706,7 +706,7 @@ fddi_resolvemulti(ifp, llsa, sa) if (!IN_MULTICAST(ntohl(sin->sin_addr.s_addr))) return (EADDRNOTAVAIL); MALLOC(sdl, struct sockaddr_dl *, sizeof *sdl, M_IFMADDR, - 0); + M_WAITOK); sdl->sdl_len = sizeof *sdl; sdl->sdl_family = AF_LINK; sdl->sdl_index = ifp->if_index; @@ -735,7 +735,7 @@ fddi_resolvemulti(ifp, llsa, sa) if (!IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr)) return (EADDRNOTAVAIL); MALLOC(sdl, struct sockaddr_dl *, sizeof *sdl, M_IFMADDR, - 0); + M_WAITOK); sdl->sdl_len = sizeof *sdl; sdl->sdl_family = AF_LINK; sdl->sdl_index = ifp->if_index; diff --git a/sys/net/if_gif.c b/sys/net/if_gif.c index fce294df3934..1cb4463abd63 100644 --- a/sys/net/if_gif.c +++ b/sys/net/if_gif.c @@ -137,7 +137,7 @@ gif_clone_create(ifc, unit) { struct gif_softc *sc; - sc = malloc (sizeof(struct gif_softc), M_GIF, 0); + sc = malloc (sizeof(struct gif_softc), M_GIF, M_WAITOK); bzero(sc, sizeof(struct gif_softc)); sc->gif_if.if_softc = sc; @@ -777,12 +777,12 @@ gif_set_tunnel(ifp, src, dst) } osrc = sc->gif_psrc; - sa = (struct sockaddr *)malloc(src->sa_len, M_IFADDR, 0); + sa = (struct sockaddr *)malloc(src->sa_len, M_IFADDR, M_WAITOK); bcopy((caddr_t)src, (caddr_t)sa, src->sa_len); sc->gif_psrc = sa; odst = sc->gif_pdst; - sa = (struct sockaddr *)malloc(dst->sa_len, M_IFADDR, 0); + sa = (struct sockaddr *)malloc(dst->sa_len, M_IFADDR, M_WAITOK); bcopy((caddr_t)dst, (caddr_t)sa, dst->sa_len); sc->gif_pdst = sa; diff --git a/sys/net/if_gre.c b/sys/net/if_gre.c index 33a4eff9cca3..658539687205 100644 --- a/sys/net/if_gre.c +++ b/sys/net/if_gre.c @@ -160,7 +160,7 @@ gre_clone_create(ifc, unit) { struct gre_softc *sc; - sc = malloc(sizeof(struct gre_softc), M_GRE, 0); + sc = malloc(sizeof(struct gre_softc), M_GRE, M_WAITOK); memset(sc, 0, sizeof(struct gre_softc)); sc->sc_if.if_name = GRENAME; @@ -294,7 +294,7 @@ gre_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst, if ((m->m_data - msiz) < m->m_pktdat) { /* need new mbuf */ - MGETHDR(m0, M_NOWAIT, MT_HEADER); + MGETHDR(m0, M_DONTWAIT, MT_HEADER); if (m0 == NULL) { _IF_DROP(&ifp->if_snd); m_freem(m); @@ -348,7 +348,7 @@ gre_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst, error = EAFNOSUPPORT; goto end; } - M_PREPEND(m, sizeof(struct greip), M_NOWAIT); + M_PREPEND(m, sizeof(struct greip), M_DONTWAIT); } else { _IF_DROP(&ifp->if_snd); m_freem(m); diff --git a/sys/net/if_ieee80211subr.c b/sys/net/if_ieee80211subr.c index e67243580278..b088e26169c7 100644 --- a/sys/net/if_ieee80211subr.c +++ b/sys/net/if_ieee80211subr.c @@ -406,7 +406,7 @@ ieee80211_input(struct ifnet *ifp, struct mbuf *m, int rssi, u_int32_t rstamp) if (ic->ic_opmode == IEEE80211_M_HOSTAP) { eh = mtod(m, struct ether_header *); if (ETHER_IS_MULTICAST(eh->ether_dhost)) { - m1 = m_copym(m, 0, M_COPYALL, M_NOWAIT); + m1 = m_copym(m, 0, M_COPYALL, M_DONTWAIT); if (m1 == NULL) ifp->if_oerrors++; else @@ -517,7 +517,7 @@ ieee80211_mgmt_output(struct ifnet *ifp, struct ieee80211_node *ni, if (ni == NULL) ni = &ic->ic_bss; ni->ni_inact = 0; - M_PREPEND(m, sizeof(struct ieee80211_frame), M_NOWAIT); + M_PREPEND(m, sizeof(struct ieee80211_frame), M_DONTWAIT); if (m == NULL) return ENOMEM; wh = mtod(m, struct ieee80211_frame *); @@ -585,7 +585,7 @@ ieee80211_encap(struct ifnet *ifp, struct mbuf *m) llc->llc_snap.org_code[1] = 0; llc->llc_snap.org_code[2] = 0; llc->llc_snap.ether_type = eh.ether_type; - M_PREPEND(m, sizeof(struct ieee80211_frame), M_NOWAIT); + M_PREPEND(m, sizeof(struct ieee80211_frame), M_DONTWAIT); if (m == NULL) return NULL; wh = mtod(m, struct ieee80211_frame *); @@ -671,7 +671,7 @@ ieee80211_decap(struct ifnet *ifp, struct mbuf *m) pktlen = m->m_pkthdr.len; while (pktlen > off) { if (n0 == NULL) { - MGETHDR(n, M_NOWAIT, MT_DATA); + MGETHDR(n, M_DONTWAIT, MT_DATA); if (n == NULL) { m_freem(m); return NULL; @@ -679,7 +679,7 @@ ieee80211_decap(struct ifnet *ifp, struct mbuf *m) M_MOVE_PKTHDR(n, m); n->m_len = MHLEN; } else { - MGET(n, M_NOWAIT, MT_DATA); + MGET(n, M_DONTWAIT, MT_DATA); if (n == NULL) { m_freem(m); m_freem(n0); @@ -688,7 +688,7 @@ ieee80211_decap(struct ifnet *ifp, struct mbuf *m) n->m_len = MLEN; } if (pktlen - off >= MINCLSIZE) { - MCLGET(n, M_NOWAIT); + MCLGET(n, M_DONTWAIT); if (n->m_flags & M_EXT) n->m_len = n->m_ext.ext_size; } @@ -1407,7 +1407,7 @@ ieee80211_send_prreq(struct ieee80211com *ic, struct ieee80211_node *ni, * [tlv] ssid * [tlv] supported rates */ - MGETHDR(m, M_NOWAIT, MT_DATA); + MGETHDR(m, M_DONTWAIT, MT_DATA); if (m == NULL) return ENOMEM; m->m_data += sizeof(struct ieee80211_frame); @@ -1450,7 +1450,7 @@ ieee80211_send_prresp(struct ieee80211com *ic, struct ieee80211_node *bs0, * [tlv] supported rates * [tlv] parameter set (IBSS) */ - MGETHDR(m, M_NOWAIT, MT_DATA); + MGETHDR(m, M_DONTWAIT, MT_DATA); if (m == NULL) return ENOMEM; m->m_data += sizeof(struct ieee80211_frame); @@ -1503,7 +1503,7 @@ ieee80211_send_auth(struct ieee80211com *ic, struct ieee80211_node *ni, u_int16_t *frm; int ret; - MGETHDR(m, M_NOWAIT, MT_DATA); + MGETHDR(m, M_DONTWAIT, MT_DATA); if (m == NULL) return ENOMEM; MH_ALIGN(m, 2 * 3); @@ -1529,7 +1529,7 @@ ieee80211_send_deauth(struct ieee80211com *ic, struct ieee80211_node *ni, if (ifp->if_flags & IFF_DEBUG) if_printf(ifp, "station %s deauthenticate (reason %d)\n", ether_sprintf(ni->ni_macaddr), reason); - MGETHDR(m, M_NOWAIT, MT_DATA); + MGETHDR(m, M_DONTWAIT, MT_DATA); if (m == NULL) return ENOMEM; MH_ALIGN(m, 2); @@ -1555,7 +1555,7 @@ ieee80211_send_asreq(struct ieee80211com *ic, struct ieee80211_node *ni, * [tlv] ssid * [tlv] supported rates */ - MGETHDR(m, M_NOWAIT, MT_DATA); + MGETHDR(m, M_DONTWAIT, MT_DATA); if (m == NULL) return ENOMEM; m->m_data += sizeof(struct ieee80211_frame); @@ -1613,7 +1613,7 @@ ieee80211_send_asresp(struct ieee80211com *ic, struct ieee80211_node *ni, * [2] association ID * [tlv] supported rates */ - MGETHDR(m, M_NOWAIT, MT_DATA); + MGETHDR(m, M_DONTWAIT, MT_DATA); if (m == NULL) return ENOMEM; m->m_data += sizeof(struct ieee80211_frame); @@ -1659,7 +1659,7 @@ ieee80211_send_disassoc(struct ieee80211com *ic, struct ieee80211_node *ni, if (ifp->if_flags & IFF_DEBUG) if_printf(ifp, "station %s disassociate (reason %d)\n", ether_sprintf(ni->ni_macaddr), reason); - MGETHDR(m, M_NOWAIT, MT_DATA); + MGETHDR(m, M_DONTWAIT, MT_DATA); if (m == NULL) return ENOMEM; MH_ALIGN(m, 2); @@ -2476,7 +2476,7 @@ ieee80211_wep_crypt(struct ifnet *ifp, struct mbuf *m0, int txflag) } m = m0; left = m->m_pkthdr.len; - MGET(n, M_NOWAIT, m->m_type); + MGET(n, M_DONTWAIT, m->m_type); n0 = n; if (n == NULL) goto fail; @@ -2490,7 +2490,7 @@ ieee80211_wep_crypt(struct ifnet *ifp, struct mbuf *m0, int txflag) } n->m_len = MHLEN; if (n->m_pkthdr.len >= MINCLSIZE) { - MCLGET(n, M_NOWAIT); + MCLGET(n, M_DONTWAIT); if (n->m_flags & M_EXT) n->m_len = n->m_ext.ext_size; } @@ -2544,13 +2544,13 @@ ieee80211_wep_crypt(struct ifnet *ifp, struct mbuf *m0, int txflag) if (len > n->m_len - noff) { len = n->m_len - noff; if (len == 0) { - MGET(n->m_next, M_NOWAIT, n->m_type); + MGET(n->m_next, M_DONTWAIT, n->m_type); if (n->m_next == NULL) goto fail; n = n->m_next; n->m_len = MLEN; if (left >= MINCLSIZE) { - MCLGET(n, M_NOWAIT); + MCLGET(n, M_DONTWAIT); if (n->m_flags & M_EXT) n->m_len = n->m_ext.ext_size; } @@ -2579,7 +2579,7 @@ ieee80211_wep_crypt(struct ifnet *ifp, struct mbuf *m0, int txflag) n->m_len = noff + sizeof(crcbuf); else { n->m_len = noff; - MGET(n->m_next, M_NOWAIT, n->m_type); + MGET(n->m_next, M_DONTWAIT, n->m_type); if (n->m_next == NULL) goto fail; n = n->m_next; diff --git a/sys/net/if_iso88025subr.c b/sys/net/if_iso88025subr.c index 4fa3e36d0a5c..acb11471aac4 100644 --- a/sys/net/if_iso88025subr.c +++ b/sys/net/if_iso88025subr.c @@ -299,7 +299,7 @@ iso88025_output(ifp, m, dst, rt0) bcopy((caddr_t)&(satoipx_addr(dst).x_host), (caddr_t)edst, sizeof (edst)); - M_PREPEND(m, 3, 0); + M_PREPEND(m, 3, M_TRYWAIT); if (m == 0) senderr(ENOBUFS); m = m_pullup(m, 3); @@ -342,7 +342,7 @@ iso88025_output(ifp, m, dst, rt0) if (snap_type != 0) { struct llc *l; - M_PREPEND(m, sizeof (struct llc), M_NOWAIT); + M_PREPEND(m, sizeof (struct llc), M_DONTWAIT); if (m == 0) senderr(ENOBUFS); l = mtod(m, struct llc *); @@ -358,7 +358,7 @@ iso88025_output(ifp, m, dst, rt0) * Add local net header. If no space in first mbuf, * allocate another. */ - M_PREPEND(m, ISO88025_HDR_LEN + rif_len, M_NOWAIT); + M_PREPEND(m, ISO88025_HDR_LEN + rif_len, M_DONTWAIT); if (m == 0) senderr(ENOBUFS); diff --git a/sys/net/if_loop.c b/sys/net/if_loop.c index deeecab0e287..c753fdc2b05c 100644 --- a/sys/net/if_loop.c +++ b/sys/net/if_loop.c @@ -147,7 +147,7 @@ lo_clone_create(ifc, unit) { struct lo_softc *sc; - MALLOC(sc, struct lo_softc *, sizeof(*sc), M_LO, M_ZERO); + MALLOC(sc, struct lo_softc *, sizeof(*sc), M_LO, M_WAITOK | M_ZERO); sc->sc_if.if_name = LONAME; sc->sc_if.if_unit = unit; @@ -215,7 +215,7 @@ looutput(ifp, m, dst, rt) struct mbuf *n; /* XXX MT_HEADER should be m->m_type */ - MGETHDR(n, M_NOWAIT, MT_HEADER); + MGETHDR(n, M_DONTWAIT, MT_HEADER); if (!n) goto contiguousfail; M_MOVE_PKTHDR(n, m); @@ -227,7 +227,7 @@ looutput(ifp, m, dst, rt) */ m->m_pkthdr.label.l_flags &= ~MAC_FLAG_INITIALIZED; #endif - MCLGET(n, M_NOWAIT); + MCLGET(n, M_DONTWAIT); if (! (n->m_flags & M_EXT)) { m_freem(n); goto contiguousfail; diff --git a/sys/net/if_ppp.c b/sys/net/if_ppp.c index 75578447490c..564d3242d34f 100644 --- a/sys/net/if_ppp.c +++ b/sys/net/if_ppp.c @@ -199,7 +199,7 @@ ppp_clone_create(struct if_clone *ifc, int unit) { struct ppp_softc *sc; - sc = malloc(sizeof(struct ppp_softc), M_PPP, M_ZERO); + sc = malloc(sizeof(struct ppp_softc), M_PPP, M_WAITOK | M_ZERO); sc->sc_if.if_softc = sc; sc->sc_if.if_name = PPPNAME; sc->sc_if.if_unit = unit; @@ -572,7 +572,7 @@ pppioctl(sc, cmd, data, flag, td) } newcodelen = nbp->bf_len * sizeof(struct bpf_insn); if (newcodelen != 0) { - MALLOC(newcode, struct bpf_insn *, newcodelen, M_DEVBUF, 0); + MALLOC(newcode, struct bpf_insn *, newcodelen, M_DEVBUF, M_WAITOK); if (newcode == 0) { error = EINVAL; /* or sumpin */ break; @@ -831,7 +831,7 @@ pppoutput(ifp, m0, dst, rtp) * (This assumes M_LEADINGSPACE is always 0 for a cluster mbuf.) */ if (M_LEADINGSPACE(m0) < PPP_HDRLEN) { - m0 = m_prepend(m0, PPP_HDRLEN, M_NOWAIT); + m0 = m_prepend(m0, PPP_HDRLEN, M_DONTWAIT); if (m0 == 0) { error = ENOBUFS; goto bad; @@ -1411,13 +1411,13 @@ ppp_inproc(sc, m) } /* Copy the PPP and IP headers into a new mbuf. */ - MGETHDR(mp, M_NOWAIT, MT_DATA); + MGETHDR(mp, M_DONTWAIT, MT_DATA); if (mp == NULL) goto bad; mp->m_len = 0; mp->m_next = NULL; if (hlen + PPP_HDRLEN > MHLEN) { - MCLGET(mp, M_NOWAIT); + MCLGET(mp, M_DONTWAIT); if (M_TRAILINGSPACE(mp) < hlen + PPP_HDRLEN) { m_freem(mp); goto bad; /* lose if big headers and no clusters */ @@ -1475,7 +1475,7 @@ ppp_inproc(sc, m) * whole cluster on it. */ if (ilen <= MHLEN && M_IS_CLUSTER(m)) { - MGETHDR(mp, M_NOWAIT, MT_DATA); + MGETHDR(mp, M_DONTWAIT, MT_DATA); if (mp != NULL) { #ifdef MAC mac_create_mbuf_from_mbuf(m, mp); diff --git a/sys/net/if_sl.c b/sys/net/if_sl.c index 80d8b359f54f..8a91b0bbb3ff 100644 --- a/sys/net/if_sl.c +++ b/sys/net/if_sl.c @@ -264,11 +264,11 @@ slcreate() int unit; struct mbuf *m; - MALLOC(sc, struct sl_softc *, sizeof(*sc), M_SL, M_ZERO); + MALLOC(sc, struct sl_softc *, sizeof(*sc), M_SL, M_WAITOK | M_ZERO); - m = m_gethdr(0, MT_DATA); + m = m_gethdr(M_TRYWAIT, MT_DATA); if (m != NULL) { - MCLGET(m, 0); + MCLGET(m, M_TRYWAIT); if ((m->m_flags & M_EXT) == 0) { m_free(m); m = NULL; @@ -791,7 +791,7 @@ sl_btom(sc, len) { struct mbuf *m, *newm; - MGETHDR(m, M_NOWAIT, MT_DATA); + MGETHDR(m, M_DONTWAIT, MT_DATA); if (m == NULL) return (NULL); @@ -803,7 +803,7 @@ sl_btom(sc, len) * guarantees that packet will fit in a cluster. */ if (len >= MHLEN) { - MCLGET(m, M_NOWAIT); + MCLGET(m, M_DONTWAIT); if ((m->m_flags & M_EXT) == 0) { /* * we couldn't get a cluster - if memory's this diff --git a/sys/net/if_spppsubr.c b/sys/net/if_spppsubr.c index cfd1546c856f..2df21cf35066 100644 --- a/sys/net/if_spppsubr.c +++ b/sys/net/if_spppsubr.c @@ -618,7 +618,7 @@ sppp_input(struct ifnet *ifp, struct mbuf *m) * enough leading space in the existing mbuf). */ m_adj(m, vjlen); - M_PREPEND(m, hlen, M_NOWAIT); + M_PREPEND(m, hlen, M_DONTWAIT); if (m == NULL) goto drop2; bcopy(iphdr, mtod(m, u_char *), hlen); @@ -892,7 +892,7 @@ sppp_output(struct ifnet *ifp, struct mbuf *m, /* * Prepend general data packet PPP header. For now, IP only. */ - M_PREPEND (m, PPP_HEADER_LEN, M_NOWAIT); + M_PREPEND (m, PPP_HEADER_LEN, M_DONTWAIT); if (! m) { if (debug) log(LOG_DEBUG, SPP_FMT "no memory for transmit header\n", @@ -1036,7 +1036,7 @@ sppp_attach(struct ifnet *ifp) #ifdef INET6 sp->confflags |= CONF_ENABLE_IPV6; #endif - sp->pp_comp = malloc(sizeof(struct slcompress), M_TEMP, 0); + sp->pp_comp = malloc(sizeof(struct slcompress), M_TEMP, M_WAIT); sl_compress_init(sp->pp_comp, -1); sppp_lcp_init(sp); sppp_ipcp_init(sp); @@ -1357,7 +1357,7 @@ sppp_cisco_send(struct sppp *sp, int type, long par1, long par2) getmicrouptime(&tv); #endif - MGETHDR (m, M_NOWAIT, MT_DATA); + MGETHDR (m, M_DONTWAIT, MT_DATA); if (! m) return; m->m_pkthdr.len = m->m_len = PPP_HEADER_LEN + CISCO_PACKET_LEN; @@ -1410,7 +1410,7 @@ sppp_cp_send(struct sppp *sp, u_short proto, u_char type, if (len > MHLEN - PPP_HEADER_LEN - LCP_HEADER_LEN) len = MHLEN - PPP_HEADER_LEN - LCP_HEADER_LEN; - MGETHDR (m, M_NOWAIT, MT_DATA); + MGETHDR (m, M_DONTWAIT, MT_DATA); if (! m) return; m->m_pkthdr.len = m->m_len = PPP_HEADER_LEN + LCP_HEADER_LEN + len; @@ -4616,7 +4616,7 @@ sppp_auth_send(const struct cp *cp, struct sppp *sp, const char *msg; va_list ap; - MGETHDR (m, M_NOWAIT, MT_DATA); + MGETHDR (m, M_DONTWAIT, MT_DATA); if (! m) return; m->m_pkthdr.rcvif = 0; diff --git a/sys/net/if_stf.c b/sys/net/if_stf.c index b96883cf83f4..1d84836eb879 100644 --- a/sys/net/if_stf.c +++ b/sys/net/if_stf.c @@ -179,7 +179,7 @@ stf_clone_create(ifc, unit) { struct stf_softc *sc; - sc = malloc(sizeof(struct stf_softc), M_STF, M_ZERO); + sc = malloc(sizeof(struct stf_softc), M_STF, M_WAITOK | M_ZERO); sc->sc_if.if_name = STFNAME; sc->sc_if.if_unit = unit; @@ -446,7 +446,7 @@ stf_output(ifp, m, dst, rt) } #endif /*NBPFILTER > 0*/ - M_PREPEND(m, sizeof(struct ip), M_NOWAIT); + M_PREPEND(m, sizeof(struct ip), M_DONTWAIT); if (m && m->m_len < sizeof(struct ip)) m = m_pullup(m, sizeof(struct ip)); if (m == NULL) { diff --git a/sys/net/if_tap.c b/sys/net/if_tap.c index 58b535debba8..ee7124a9f09e 100644 --- a/sys/net/if_tap.c +++ b/sys/net/if_tap.c @@ -324,7 +324,7 @@ tapcreate(dev) char *name = NULL; /* allocate driver storage and create device */ - MALLOC(tp, struct tap_softc *, sizeof(*tp), M_TAP, M_ZERO); + MALLOC(tp, struct tap_softc *, sizeof(*tp), M_TAP, M_WAITOK | M_ZERO); SLIST_INSERT_HEAD(&taphead, tp, tap_next); unit = dev2unit(dev) & TAPMAXUNIT; @@ -839,7 +839,7 @@ tapwrite(dev, uio, flag) tlen = uio->uio_resid; /* get a header mbuf */ - MGETHDR(m, M_NOWAIT, MT_DATA); + MGETHDR(m, M_DONTWAIT, MT_DATA); if (m == NULL) return (ENOBUFS); mlen = MHLEN; @@ -852,7 +852,7 @@ tapwrite(dev, uio, flag) *mp = m; mp = &m->m_next; if (uio->uio_resid > 0) { - MGET(m, M_NOWAIT, MT_DATA); + MGET(m, M_DONTWAIT, MT_DATA); if (m == NULL) { error = ENOBUFS; break; diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c index e7c3a86db63c..bcb9062b4d3b 100644 --- a/sys/net/if_tun.c +++ b/sys/net/if_tun.c @@ -230,7 +230,7 @@ tuncreate(dev_t dev) dev = make_dev(&tun_cdevsw, minor(dev), UID_UUCP, GID_DIALER, 0600, "tun%d", dev2unit(dev)); - MALLOC(sc, struct tun_softc *, sizeof(*sc), M_TUN, M_ZERO); + MALLOC(sc, struct tun_softc *, sizeof(*sc), M_TUN, M_WAITOK | M_ZERO); sc->tun_flags = TUN_INITED; sc->next = tunhead; tunhead = sc; @@ -484,7 +484,7 @@ tunoutput( /* prepend sockaddr? this may abort if the mbuf allocation fails */ if (tp->tun_flags & TUN_LMODE) { /* allocate space for sockaddr */ - M_PREPEND(m0, dst->sa_len, M_NOWAIT); + M_PREPEND(m0, dst->sa_len, M_DONTWAIT); /* if allocation failed drop packet */ if (m0 == NULL) { @@ -498,7 +498,7 @@ tunoutput( if (tp->tun_flags & TUN_IFHEAD) { /* Prepend the address family */ - M_PREPEND(m0, 4, M_NOWAIT); + M_PREPEND(m0, 4, M_DONTWAIT); /* if allocation failed drop packet */ if (m0 == NULL) { @@ -718,7 +718,7 @@ tunwrite(dev_t dev, struct uio *uio, int flag) tlen = uio->uio_resid; /* get a header mbuf */ - MGETHDR(m, M_NOWAIT, MT_DATA); + MGETHDR(m, M_DONTWAIT, MT_DATA); if (m == NULL) return (ENOBUFS); mlen = MHLEN; @@ -731,7 +731,7 @@ tunwrite(dev_t dev, struct uio *uio, int flag) *mp = m; mp = &m->m_next; if (uio->uio_resid > 0) { - MGET (m, M_NOWAIT, MT_DATA); + MGET (m, M_DONTWAIT, MT_DATA); if (m == 0) { error = ENOBUFS; break; diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c index 421a8b571a3f..abef59159ba8 100644 --- a/sys/net/if_vlan.c +++ b/sys/net/if_vlan.c @@ -168,7 +168,7 @@ vlan_setmulti(struct ifnet *ifp) TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; - mc = malloc(sizeof(struct vlan_mc_entry), M_VLAN, 0); + mc = malloc(sizeof(struct vlan_mc_entry), M_VLAN, M_WAITOK); bcopy(LLADDR((struct sockaddr_dl *)ifma->ifma_addr), (char *)&mc->mc_addr, ETHER_ADDR_LEN); SLIST_INSERT_HEAD(&sc->vlan_mc_listhead, mc, mc_entries); @@ -232,7 +232,7 @@ vlan_clone_create(struct if_clone *ifc, int unit) struct ifnet *ifp; int s; - ifv = malloc(sizeof(struct ifvlan), M_VLAN, M_ZERO); + ifv = malloc(sizeof(struct ifvlan), M_VLAN, M_WAITOK | M_ZERO); ifp = &ifv->ifv_if; SLIST_INIT(&ifv->vlan_mc_listhead); @@ -323,7 +323,7 @@ vlan_start(struct ifnet *ifp) struct m_tag *mtag = m_tag_alloc(MTAG_VLAN, MTAG_VLAN_TAG, sizeof (u_int), - M_NOWAIT); + M_DONTWAIT); if (mtag == NULL) { ifp->if_oerrors++; m_freem(m); @@ -332,7 +332,7 @@ vlan_start(struct ifnet *ifp) *(u_int*)(mtag+1) = ifv->ifv_tag; m_tag_prepend(m, mtag); } else { - M_PREPEND(m, ifv->ifv_encaplen, M_NOWAIT); + M_PREPEND(m, ifv->ifv_encaplen, M_DONTWAIT); if (m == NULL) { if_printf(ifp, "unable to prepend VLAN header"); ifp->if_ierrors++; diff --git a/sys/net/if_vlan_var.h b/sys/net/if_vlan_var.h index ff656a62a169..42f2dcc92002 100644 --- a/sys/net/if_vlan_var.h +++ b/sys/net/if_vlan_var.h @@ -98,7 +98,7 @@ struct vlanreq { #define VLAN_INPUT_TAG(_ifp, _m, _t, _errcase) do { \ struct m_tag *mtag; \ mtag = m_tag_alloc(MTAG_VLAN, MTAG_VLAN_TAG, \ - sizeof (u_int), M_NOWAIT); \ + sizeof (u_int), M_DONTWAIT); \ if (mtag == NULL) { \ (_ifp)->if_ierrors++; \ m_freem(_m); \ diff --git a/sys/net/pfil.c b/sys/net/pfil.c index a53051b917b8..2ed40b2f0f4c 100644 --- a/sys/net/pfil.c +++ b/sys/net/pfil.c @@ -61,7 +61,7 @@ pfil_init(ph) * PFIL_IN call me on incoming packets * PFIL_OUT call me on outgoing packets * PFIL_ALL call me on all of the above - * PFIL_WAITOK OK to call malloc with 0. + * PFIL_WAITOK OK to call malloc with M_WAITOK. */ int pfil_add_hook(func, flags, ph) @@ -97,7 +97,7 @@ pfil_list_add(list, func, flags) struct packet_filter_hook *pfh; pfh = (struct packet_filter_hook *)malloc(sizeof(*pfh), M_IFADDR, - flags & PFIL_WAITOK ? 0 : M_NOWAIT); + flags & PFIL_WAITOK ? M_WAITOK : M_NOWAIT); if (pfh == NULL) return ENOMEM; pfh->pfil_func = func; diff --git a/sys/net/ppp_deflate.c b/sys/net/ppp_deflate.c index 96fb810341e2..3c7884e033d7 100644 --- a/sys/net/ppp_deflate.c +++ b/sys/net/ppp_deflate.c @@ -248,12 +248,12 @@ z_compress(arg, mret, mp, orig_len, maxolen) /* Allocate one mbuf initially. */ if (maxolen > orig_len) maxolen = orig_len; - MGET(m, M_NOWAIT, MT_DATA); + MGET(m, M_DONTWAIT, MT_DATA); *mret = m; if (m != NULL) { m->m_len = 0; if (maxolen + state->hdrlen > MLEN) - MCLGET(m, M_NOWAIT); + MCLGET(m, M_DONTWAIT); wspace = M_TRAILINGSPACE(m); if (state->hdrlen + PPP_HDRLEN + 2 < wspace) { m->m_data += state->hdrlen; @@ -308,12 +308,12 @@ z_compress(arg, mret, mp, orig_len, maxolen) if (m != NULL) { m->m_len = wspace; olen += wspace; - MGET(m->m_next, M_NOWAIT, MT_DATA); + MGET(m->m_next, M_DONTWAIT, MT_DATA); m = m->m_next; if (m != NULL) { m->m_len = 0; if (maxolen - olen > MLEN) - MCLGET(m, M_NOWAIT); + MCLGET(m, M_DONTWAIT); state->strm.next_out = mtod(m, u_char *); state->strm.avail_out = wspace = M_TRAILINGSPACE(m); } @@ -507,13 +507,13 @@ z_decompress(arg, mi, mop) ++state->seqno; /* Allocate an output mbuf. */ - MGETHDR(mo, M_NOWAIT, MT_DATA); + MGETHDR(mo, M_DONTWAIT, MT_DATA); if (mo == NULL) return DECOMP_ERROR; mo_head = mo; mo->m_len = 0; mo->m_next = NULL; - MCLGET(mo, M_NOWAIT); + MCLGET(mo, M_DONTWAIT); ospace = M_TRAILINGSPACE(mo); if (state->hdrlen + PPP_HDRLEN < ospace) { mo->m_data += state->hdrlen; @@ -582,13 +582,13 @@ z_decompress(arg, mi, mop) } else { mo->m_len = ospace; olen += ospace; - MGET(mo->m_next, M_NOWAIT, MT_DATA); + MGET(mo->m_next, M_DONTWAIT, MT_DATA); mo = mo->m_next; if (mo == NULL) { m_freem(mo_head); return DECOMP_ERROR; } - MCLGET(mo, M_NOWAIT); + MCLGET(mo, M_DONTWAIT); state->strm.next_out = mtod(mo, u_char *); state->strm.avail_out = ospace = M_TRAILINGSPACE(mo); } diff --git a/sys/net/ppp_tty.c b/sys/net/ppp_tty.c index 52a0ff5a314e..f50c4d6e704c 100644 --- a/sys/net/ppp_tty.c +++ b/sys/net/ppp_tty.c @@ -396,7 +396,7 @@ pppwrite(tp, uio, flag) s = spltty(); for (mp = &m0; uio->uio_resid; mp = &m->m_next) { - MGET(m, 0, MT_DATA); + MGET(m, M_TRYWAIT, MT_DATA); if ((*mp = m) == NULL) { m_freem(m0); splx(s); @@ -404,7 +404,7 @@ pppwrite(tp, uio, flag) } m->m_len = 0; if (uio->uio_resid >= MCLBYTES / 2) - MCLGET(m, M_NOWAIT); + MCLGET(m, M_DONTWAIT); len = M_TRAILINGSPACE(m); if (len > uio->uio_resid) len = uio->uio_resid; @@ -808,11 +808,11 @@ pppgetm(sc) mp = &sc->sc_m; for (len = sc->sc_mru + PPP_HDRLEN + PPP_FCSLEN; len > 0; ){ if ((m = *mp) == NULL) { - MGETHDR(m, M_NOWAIT, MT_DATA); + MGETHDR(m, M_DONTWAIT, MT_DATA); if (m == NULL) break; *mp = m; - MCLGET(m, M_NOWAIT); + MCLGET(m, M_DONTWAIT); } len -= M_DATASIZE(m); mp = &m->m_next; diff --git a/sys/net/raw_cb.c b/sys/net/raw_cb.c index 66abcd0368f5..6f3f8b5bb158 100644 --- a/sys/net/raw_cb.c +++ b/sys/net/raw_cb.c @@ -139,7 +139,7 @@ raw_bind(so, nam) if (ifnet == 0) return (EADDRNOTAVAIL); rp = sotorawcb(so); - nam = m_copym(nam, 0, M_COPYALL, 0); + nam = m_copym(nam, 0, M_COPYALL, M_TRYWAIT); rp->rcb_laddr = mtod(nam, struct sockaddr *); return (0); } diff --git a/sys/net/route.c b/sys/net/route.c index ee0b7d3096ef..7847466e6430 100644 --- a/sys/net/route.c +++ b/sys/net/route.c @@ -1071,7 +1071,7 @@ rtinit(ifa, cmd, flags) * (Assuming we have a mask) */ if (netmask != NULL) { - m = m_get(M_NOWAIT, MT_SONAME); + m = m_get(M_DONTWAIT, MT_SONAME); if (m == NULL) return(ENOBUFS); deldst = mtod(m, struct sockaddr *); diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c index 3b5457d678f5..4780cc5a8b8d 100644 --- a/sys/net/rtsock.c +++ b/sys/net/rtsock.c @@ -110,7 +110,7 @@ rts_attach(struct socket *so, int proto, struct thread *td) if (sotorawcb(so) != 0) return EISCONN; /* XXX panic? */ /* XXX */ - MALLOC(rp, struct rawcb *, sizeof *rp, M_PCB, M_ZERO); + MALLOC(rp, struct rawcb *, sizeof *rp, M_PCB, M_WAITOK | M_ZERO); if (rp == 0) return ENOBUFS; @@ -608,9 +608,9 @@ rt_msg1(type, rtinfo) } if (len > MCLBYTES) panic("rt_msg1"); - m = m_gethdr(M_NOWAIT, MT_DATA); + m = m_gethdr(M_DONTWAIT, MT_DATA); if (m && len > MHLEN) { - MCLGET(m, M_NOWAIT); + MCLGET(m, M_DONTWAIT); if ((m->m_flags & M_EXT) == 0) { m_free(m); m = NULL; diff --git a/sys/netatalk/aarp.c b/sys/netatalk/aarp.c index b89dfdc2edab..a22488acf257 100644 --- a/sys/netatalk/aarp.c +++ b/sys/netatalk/aarp.c @@ -127,7 +127,7 @@ aarpwhohas( struct arpcom *ac, struct sockaddr_at *sat ) struct llc *llc; struct sockaddr sa; - if (( m = m_gethdr( M_NOWAIT, MT_DATA )) == NULL ) { + if (( m = m_gethdr( M_DONTWAIT, MT_DATA )) == NULL ) { return; } #ifdef MAC @@ -166,7 +166,7 @@ aarpwhohas( struct arpcom *ac, struct sockaddr_at *sat ) bcopy((caddr_t)atmulticastaddr, (caddr_t)eh->ether_dhost, sizeof( eh->ether_dhost )); eh->ether_type = htons(sizeof(struct llc) + sizeof(struct ether_aarp)); - M_PREPEND( m, sizeof( struct llc ), 0 ); + M_PREPEND( m, sizeof( struct llc ), M_TRYWAIT ); llc = mtod( m, struct llc *); llc->llc_dsap = llc->llc_ssap = LLC_SNAP_LSAP; llc->llc_control = LLC_UI; @@ -440,7 +440,7 @@ at_aarpinput( struct arpcom *ac, struct mbuf *m) if ( aa->aa_flags & AFA_PHASE2 ) { eh->ether_type = htons( sizeof( struct llc ) + sizeof( struct ether_aarp )); - M_PREPEND( m, sizeof( struct llc ), M_NOWAIT ); + M_PREPEND( m, sizeof( struct llc ), M_DONTWAIT ); if ( m == NULL ) { return; } @@ -551,7 +551,7 @@ aarpprobe( void *arg ) aa->aa_ch = timeout( aarpprobe, (caddr_t)ac, hz / 5 ); } - if (( m = m_gethdr( M_NOWAIT, MT_DATA )) == NULL ) { + if (( m = m_gethdr( M_DONTWAIT, MT_DATA )) == NULL ) { return; } #ifdef MAC @@ -579,7 +579,7 @@ aarpprobe( void *arg ) sizeof( eh->ether_dhost )); eh->ether_type = htons( sizeof( struct llc ) + sizeof( struct ether_aarp )); - M_PREPEND( m, sizeof( struct llc ), 0 ); + M_PREPEND( m, sizeof( struct llc ), M_TRYWAIT ); llc = mtod( m, struct llc *); llc->llc_dsap = llc->llc_ssap = LLC_SNAP_LSAP; llc->llc_control = LLC_UI; diff --git a/sys/netatalk/at_control.c b/sys/netatalk/at_control.c index 8f9091163956..d7e7586b648a 100644 --- a/sys/netatalk/at_control.c +++ b/sys/netatalk/at_control.c @@ -138,7 +138,7 @@ at_control(struct socket *so, u_long cmd, caddr_t data, * allocate a fresh one. */ if ( aa == (struct at_ifaddr *) 0 ) { - aa0 = malloc(sizeof(struct at_ifaddr), M_IFADDR, M_ZERO); + aa0 = malloc(sizeof(struct at_ifaddr), M_IFADDR, M_WAITOK | M_ZERO); if (( aa = at_ifaddr ) != NULL ) { /* * Don't let the loopback be first, since the first diff --git a/sys/netatalk/ddp_output.c b/sys/netatalk/ddp_output.c index e3fb38453f5f..f15914be2bba 100644 --- a/sys/netatalk/ddp_output.c +++ b/sys/netatalk/ddp_output.c @@ -55,7 +55,7 @@ ddp_output( struct mbuf *m, struct socket *so) mac_create_mbuf_from_socket(so, m); #endif - M_PREPEND( m, sizeof( struct ddpehdr ), 0 ); + M_PREPEND( m, sizeof( struct ddpehdr ), M_TRYWAIT ); deh = mtod( m, struct ddpehdr *); deh->deh_pad = 0; @@ -196,7 +196,7 @@ ddp_route( struct mbuf *m, struct route *ro) * packets end up poorly aligned due to the three byte elap header. */ if ( !(aa->aa_flags & AFA_PHASE2) ) { - MGET( m0, 0, MT_HEADER ); + MGET( m0, M_TRYWAIT, MT_HEADER ); if ( m0 == 0 ) { m_freem( m ); printf("ddp_route: no buffers\n"); diff --git a/sys/netatalk/ddp_pcb.c b/sys/netatalk/ddp_pcb.c index 0bd2e6d1c4f5..fa79cec9de4a 100644 --- a/sys/netatalk/ddp_pcb.c +++ b/sys/netatalk/ddp_pcb.c @@ -420,7 +420,7 @@ at_pcballoc( struct socket *so ) { struct ddpcb *ddp; - MALLOC(ddp, struct ddpcb *, sizeof *ddp, M_PCB, M_ZERO); + MALLOC(ddp, struct ddpcb *, sizeof *ddp, M_PCB, M_WAITOK | M_ZERO); ddp->ddp_lsat.sat_port = ATADDR_ANYPORT; ddp->ddp_next = ddpcb; diff --git a/sys/netatalk/ddp_usrreq.c b/sys/netatalk/ddp_usrreq.c index 0bd2e6d1c4f5..fa79cec9de4a 100644 --- a/sys/netatalk/ddp_usrreq.c +++ b/sys/netatalk/ddp_usrreq.c @@ -420,7 +420,7 @@ at_pcballoc( struct socket *so ) { struct ddpcb *ddp; - MALLOC(ddp, struct ddpcb *, sizeof *ddp, M_PCB, M_ZERO); + MALLOC(ddp, struct ddpcb *, sizeof *ddp, M_PCB, M_WAITOK | M_ZERO); ddp->ddp_lsat.sat_port = ATADDR_ANYPORT; ddp->ddp_next = ddpcb; diff --git a/sys/netatm/atm_cm.c b/sys/netatm/atm_cm.c index c5e317289388..b101abf55039 100644 --- a/sys/netatm/atm_cm.c +++ b/sys/netatm/atm_cm.c @@ -174,7 +174,7 @@ atm_cm_connect(epp, token, ap, copp) /* * Get a connection block */ - cop = uma_zalloc(atm_connection_zone, 0); + cop = uma_zalloc(atm_connection_zone, M_WAITOK); if (cop == NULL) return (ENOMEM); @@ -405,7 +405,7 @@ atm_cm_connect(epp, token, ap, copp) /* * Get a connection VCC block */ - cvp = uma_zalloc(atm_connvc_zone, 0); + cvp = uma_zalloc(atm_connvc_zone, M_WAITOK); if (cvp == NULL) { err = ENOMEM; goto donex; @@ -551,7 +551,7 @@ atm_cm_listen(epp, token, ap, copp) /* * Get a connection block */ - cop = uma_zalloc(atm_connection_zone, 0); + cop = uma_zalloc(atm_connection_zone, M_WAITOK); if (cop == NULL) return (ENOMEM); @@ -710,7 +710,7 @@ atm_cm_listen(epp, token, ap, copp) /* * Get an attribute block and save listening attributes */ - cop->co_lattr = uma_zalloc(atm_attributes_zone, M_ZERO); + cop->co_lattr = uma_zalloc(atm_attributes_zone, M_WAITOK | M_ZERO); if (cop->co_lattr == NULL) { err = ENOMEM; goto done; @@ -815,7 +815,7 @@ atm_cm_addllc(epp, token, llc, ecop, copp) /* * Get a connection block */ - cop = uma_zalloc(atm_connection_zone, 0); + cop = uma_zalloc(atm_connection_zone, M_WAITOK); if (cop == NULL) return (ENOMEM); @@ -1266,7 +1266,7 @@ atm_cm_incoming(vcp, ap) /* * Get a connection VCC block */ - cvp = uma_zalloc(atm_connvc_zone, 0); + cvp = uma_zalloc(atm_connvc_zone, M_WAITOK); if (cvp == NULL) { err = ENOMEM; goto fail; @@ -1584,7 +1584,7 @@ atm_cm_incall(cvp) /* * Need a new connection block */ - cop = uma_zalloc(atm_connection_zone, 0); + cop = uma_zalloc(atm_connection_zone, M_WAITOK); if (cop == NULL) { cvp->cvc_attr.cause = atm_cause_tmpl; cvp->cvc_attr.cause.v.cause_value = diff --git a/sys/netatm/atm_device.c b/sys/netatm/atm_device.c index 959c61ca340b..c85303e93604 100644 --- a/sys/netatm/atm_device.c +++ b/sys/netatm/atm_device.c @@ -170,7 +170,7 @@ atm_dev_inst(ssp, cvcp) /* * Allocate a VCC control block */ - cvp = uma_zalloc(cup->cu_vcc_zone, 0); + cvp = uma_zalloc(cup->cu_vcc_zone, M_WAITOK); if (cvp == NULL) return (ENOMEM); diff --git a/sys/netatm/atm_if.c b/sys/netatm/atm_if.c index a93d566679f1..69c90820263a 100644 --- a/sys/netatm/atm_if.c +++ b/sys/netatm/atm_if.c @@ -496,7 +496,7 @@ atm_physif_ioctl(code, data, arg) */ for ( count = 0; count < asr->asr_nif_cnt; count++ ) { - nip = uma_zalloc(cup->cu_nif_zone, M_ZERO); + nip = uma_zalloc(cup->cu_nif_zone, M_WAITOK | M_ZERO); if ( nip == NULL ) { /* diff --git a/sys/netatm/atm_socket.c b/sys/netatm/atm_socket.c index 3c0b806ef318..6ff6abcc4018 100644 --- a/sys/netatm/atm_socket.c +++ b/sys/netatm/atm_socket.c @@ -596,7 +596,7 @@ atm_sock_sockaddr(so, addr) /* * Return local interface address, if known */ - satm = malloc(sizeof(*satm), M_SONAME, M_ZERO); + satm = malloc(sizeof(*satm), M_SONAME, M_WAITOK | M_ZERO); if (satm == NULL) return (ENOMEM); @@ -654,7 +654,7 @@ atm_sock_peeraddr(so, addr) /* * Return remote address, if known */ - satm = malloc(sizeof(*satm), M_SONAME, M_ZERO); + satm = malloc(sizeof(*satm), M_SONAME, M_WAITOK | M_ZERO); if (satm == NULL) return (ENOMEM); diff --git a/sys/netatm/ipatm/ipatm_if.c b/sys/netatm/ipatm/ipatm_if.c index 5dca9710587a..49dbf48c4a88 100644 --- a/sys/netatm/ipatm/ipatm_if.c +++ b/sys/netatm/ipatm/ipatm_if.c @@ -124,7 +124,7 @@ ipatm_nifstat(cmd, nip, arg) /* * Get a new interface block */ - inp = uma_zalloc(ipatm_nif_zone, 0); + inp = uma_zalloc(ipatm_nif_zone, M_WAITOK); if (inp == NULL) { err = ENOMEM; break; diff --git a/sys/netatm/ipatm/ipatm_vcm.c b/sys/netatm/ipatm/ipatm_vcm.c index 76c8a551a567..14cf7cc1f986 100644 --- a/sys/netatm/ipatm/ipatm_vcm.c +++ b/sys/netatm/ipatm/ipatm_vcm.c @@ -382,7 +382,7 @@ ipatm_openpvc(pvp, sivp) /* * Allocate IP VCC block */ - ivp = uma_zalloc(ipatm_vc_zone, 0); + ivp = uma_zalloc(ipatm_vc_zone, M_WAITOK); if (ivp == NULL) { err = ENOMEM; goto done; @@ -585,7 +585,7 @@ ipatm_createsvc(ifp, daf, dst, sivp) /* * Allocate IP VCC */ - ivp = uma_zalloc(ipatm_vc_zone, 0); + ivp = uma_zalloc(ipatm_vc_zone, M_WAITOK); if (ivp == NULL) { err = ENOMEM; goto done; @@ -937,7 +937,7 @@ ipatm_incoming(tok, cop, ap, tokp) /* * Allocate IP VCC */ - ivp = uma_zalloc(ipatm_vc_zone, 0); + ivp = uma_zalloc(ipatm_vc_zone, M_WAITOK); if (ivp == NULL) { err = ENOMEM; cause = T_ATM_CAUSE_UNSPECIFIED_RESOURCE_UNAVAILABLE; diff --git a/sys/netatm/port.h b/sys/netatm/port.h index d11bd40327d4..df599adf1cbc 100644 --- a/sys/netatm/port.h +++ b/sys/netatm/port.h @@ -126,8 +126,8 @@ #include typedef struct mbuf KBuffer; -#define KB_F_WAIT 0 -#define KB_F_NOWAIT M_NOWAIT +#define KB_F_WAIT M_TRYWAIT +#define KB_F_NOWAIT M_DONTWAIT #define KB_T_HEADER MT_HEADER #define KB_T_DATA MT_DATA diff --git a/sys/netatm/sigpvc/sigpvc_subr.c b/sys/netatm/sigpvc/sigpvc_subr.c index b0a4da533e12..4c3196e4f840 100644 --- a/sys/netatm/sigpvc/sigpvc_subr.c +++ b/sys/netatm/sigpvc/sigpvc_subr.c @@ -122,7 +122,7 @@ sigpvc_create_pvc(pvp, cvp, errp) /* * Allocate control block for PVC */ - vcp = uma_zalloc(sigpvc_vc_zone, M_ZERO); + vcp = uma_zalloc(sigpvc_vc_zone, M_WAITOK | M_ZERO); if (vcp == NULL) { *errp = ENOMEM; return (CALL_FAILED); diff --git a/sys/netatm/spans/spans_arp.c b/sys/netatm/spans/spans_arp.c index 7fb5a10483e5..e0c83f97ed38 100644 --- a/sys/netatm/spans/spans_arp.c +++ b/sys/netatm/spans/spans_arp.c @@ -172,7 +172,7 @@ spansarp_svcout(ivp, dst) /* * Now get the new arp entry */ - sap = uma_zalloc(spansarp_zone, 0); + sap = uma_zalloc(spansarp_zone, M_WAITOK); if (sap == NULL) { (void) splx(s); return (MAP_FAILED); @@ -720,7 +720,7 @@ spansarp_input(clp, m) /* * Source unknown and we're the target - add new entry */ - sap = uma_zalloc(spansarp_zone, 0); + sap = uma_zalloc(spansarp_zone, M_WAITOK); if (sap) { sap->sa_dstip.s_addr = in_src.s_addr; sap->sa_dstatm.address_format = T_ATM_SPANS_ADDR; @@ -961,7 +961,7 @@ spansarp_ioctl(code, data, arg1) /* * No, get a new arp entry */ - sap = uma_zalloc(spansarp_zone, 0); + sap = uma_zalloc(spansarp_zone, M_WAITOK); if (sap == NULL) { err = ENOMEM; break; diff --git a/sys/netatm/spans/spans_cls.c b/sys/netatm/spans/spans_cls.c index a71967884038..5b938923c796 100644 --- a/sys/netatm/spans/spans_cls.c +++ b/sys/netatm/spans/spans_cls.c @@ -348,7 +348,7 @@ spanscls_attach(spp) /* * Get a new cls control block */ - clp = uma_zalloc(spanscls_zone, 0); + clp = uma_zalloc(spanscls_zone, M_WAITOK); if (clp == NULL) return (ENOMEM); diff --git a/sys/netatm/spans/spans_msg.c b/sys/netatm/spans/spans_msg.c index 89185bd4149f..c59708081995 100644 --- a/sys/netatm/spans/spans_msg.c +++ b/sys/netatm/spans/spans_msg.c @@ -232,7 +232,7 @@ spans_send_open_req(spp, svp) /* * Get memory for a request message */ - req = uma_zalloc(spans_msg_zone, 0); + req = uma_zalloc(spans_msg_zone, M_WAITOK); if (req == NULL) { err = ENOBUFS; goto done; @@ -290,7 +290,7 @@ spans_send_open_rsp(spp, svp, result) /* * Get memory for a response message */ - rsp = uma_zalloc(spans_msg_zone, 0); + rsp = uma_zalloc(spans_msg_zone, M_WAITOK); if (rsp == NULL) return(ENOBUFS); @@ -340,7 +340,7 @@ spans_send_close_req(spp, svp) /* * Get memory for a close request */ - req = uma_zalloc(spans_msg_zone, 0); + req = uma_zalloc(spans_msg_zone, M_WAITOK); if (req == NULL) { err = ENOBUFS; goto done; @@ -468,7 +468,7 @@ spans_status_ind(spp, msg) * Respond to the status request or indication with a * status response */ - rsp_msg = uma_zalloc(spans_msg_zone, 0); + rsp_msg = uma_zalloc(spans_msg_zone, M_WAITOK); if (rsp_msg == NULL) return; rsp_msg->sm_vers = SPANS_VERS_1_0; @@ -658,7 +658,7 @@ spans_open_req(spp, msg) /* * Get a new VCCB for the connection */ - svp = uma_zalloc(spans_vc_zone, 0); + svp = uma_zalloc(spans_vc_zone, M_WAITOK); if (svp == NULL) { ATM_DEBUG0("spans_open_req: VCCB pool empty\n"); result = SPANS_NORSC; @@ -808,7 +808,7 @@ spans_open_req(spp, msg) * Some problem was detected with the request. Send a SPANS * message rejecting the connection. */ - rsp_msg = uma_zalloc(spans_msg_zone, 0); + rsp_msg = uma_zalloc(spans_msg_zone, M_WAITOK); if (rsp_msg == NULL) return; @@ -1034,7 +1034,7 @@ spans_close_req(spp, msg) /* * Respond to the SPANS_CLOSE_IND with a SPANS_CLOSE_RSP */ - rsp_msg = uma_zalloc(spans_msg_zone, 0); + rsp_msg = uma_zalloc(spans_msg_zone, M_WAITOK); if (rsp_msg == NULL) return; rsp_msg->sm_vers = SPANS_VERS_1_0; @@ -1169,7 +1169,7 @@ spans_multi_req(spp, msg) /* * Get memory for a SPANS_MULTI_RSP message. */ - rsp_msg = uma_zalloc(spans_msg_zone, 0); + rsp_msg = uma_zalloc(spans_msg_zone, M_WAITOK); if (rsp_msg == NULL) return; @@ -1215,7 +1215,7 @@ spans_add_req(spp, msg) /* * Get memory for a SPANS_ADD_RSP message. */ - rsp_msg = uma_zalloc(spans_msg_zone, 0); + rsp_msg = uma_zalloc(spans_msg_zone, M_WAITOK); if (rsp_msg == NULL) return; @@ -1262,7 +1262,7 @@ spans_join_req(spp, msg) /* * Get memory for a SPANS_JOIN_CNF message. */ - rsp_msg = uma_zalloc(spans_msg_zone, 0); + rsp_msg = uma_zalloc(spans_msg_zone, M_WAITOK); if (rsp_msg == NULL) return; @@ -1307,7 +1307,7 @@ spans_leave_req(spp, msg) /* * Get memory for a SPANS_LEAVE_CNF message. */ - rsp_msg = uma_zalloc(spans_msg_zone, 0); + rsp_msg = uma_zalloc(spans_msg_zone, M_WAITOK); if (rsp_msg == NULL) return; @@ -1401,7 +1401,7 @@ spans_query_req(spp, msg) /* * Get memory for a SPANS_QUERY_RSP message. */ - rsp_msg = uma_zalloc(spans_msg_zone, 0); + rsp_msg = uma_zalloc(spans_msg_zone, M_WAITOK); if (rsp_msg == NULL) return; @@ -1489,7 +1489,7 @@ spans_rcv_msg(spp, m) /* * Get storage for the message */ - msg = uma_zalloc(spans_msg_zone, 0); + msg = uma_zalloc(spans_msg_zone, M_WAITOK); if (msg == NULL) return; diff --git a/sys/netatm/spans/spans_proto.c b/sys/netatm/spans/spans_proto.c index 8f96374553cc..75628200c1e2 100644 --- a/sys/netatm/spans/spans_proto.c +++ b/sys/netatm/spans/spans_proto.c @@ -279,7 +279,7 @@ spans_timer(tip) /* * Send out SPANS_STAT_REQ message */ - msg = uma_zalloc(spans_msg_zone, 0); + msg = uma_zalloc(spans_msg_zone, M_WAITOK); if (msg == NULL) { /* XXX arr: This is bogus and will go away RSN */ /* Retry later if no memory */ diff --git a/sys/netatm/spans/spans_subr.c b/sys/netatm/spans/spans_subr.c index 24edec234e01..93ea6d44aba8 100644 --- a/sys/netatm/spans/spans_subr.c +++ b/sys/netatm/spans/spans_subr.c @@ -192,7 +192,7 @@ spans_open_vcc(spp, cvp) /* * Allocate control block for VCC */ - svp = uma_zalloc(spans_vc_zone, 0); + svp = uma_zalloc(spans_vc_zone, M_WAITOK); if (svp == NULL) { return(ENOMEM); } diff --git a/sys/netatm/uni/sscf_uni.c b/sys/netatm/uni/sscf_uni.c index a0c3d6750011..b5ff7d0e1cf9 100644 --- a/sys/netatm/uni/sscf_uni.c +++ b/sys/netatm/uni/sscf_uni.c @@ -213,7 +213,7 @@ sscf_uni_inst(ssp, cvp) /* * Allocate our control block */ - uvp = uma_zalloc(sscf_uni_zone, 0); + uvp = uma_zalloc(sscf_uni_zone, M_WAITOK); if (uvp == NULL) return (ENOMEM); uvp->uv_ustate = UVU_INST; diff --git a/sys/netatm/uni/sscop.c b/sys/netatm/uni/sscop.c index e5553077c1b4..6374f30caf0d 100644 --- a/sys/netatm/uni/sscop.c +++ b/sys/netatm/uni/sscop.c @@ -258,7 +258,7 @@ sscop_inst(ssp, cvp) /* * Allocate our control block */ - sop = uma_zalloc(sscop_zone, 0); + sop = uma_zalloc(sscop_zone, M_WAITOK); if (sop == NULL) return (ENOMEM); diff --git a/sys/netatm/uni/uniarp.c b/sys/netatm/uni/uniarp.c index e9469374eca5..0de56b8df535 100644 --- a/sys/netatm/uni/uniarp.c +++ b/sys/netatm/uni/uniarp.c @@ -713,7 +713,7 @@ uniarp_client_mode(uip, aap) * Now, get an arp entry for the server connection */ uip->uip_arpstate = UIAS_CLIENT_POPEN; - uap = uma_zalloc(uniarp_zone, M_ZERO); + uap = uma_zalloc(uniarp_zone, M_WAITOK | M_ZERO); if (uap == NULL) { UNIIP_ARP_TIMER(uip, 1 * ATM_HZ); return; diff --git a/sys/netatm/uni/uniarp_cache.c b/sys/netatm/uni/uniarp_cache.c index 10c780a05e1b..dbfe40241b94 100644 --- a/sys/netatm/uni/uniarp_cache.c +++ b/sys/netatm/uni/uniarp_cache.c @@ -126,7 +126,7 @@ uniarp_cache_svc(uip, ip, atm, atmsub, origin) * If there aren't any entries yet, create one */ if ((ipuap == NULL) && (nouap == NULL)) { - ipuap = uma_zalloc(uniarp_zone, 0); + ipuap = uma_zalloc(uniarp_zone, M_WAITOK); if (ipuap == NULL) return (ENOMEM); ipuap->ua_dstip.s_addr = ip->s_addr; diff --git a/sys/netatm/uni/uniarp_vcm.c b/sys/netatm/uni/uniarp_vcm.c index cfc081cd9583..ac1c1675f7ba 100644 --- a/sys/netatm/uni/uniarp_vcm.c +++ b/sys/netatm/uni/uniarp_vcm.c @@ -133,7 +133,7 @@ uniarp_pvcopen(ivp) /* * Get an arp map entry */ - uap = uma_zalloc(uniarp_zone, M_ZERO); + uap = uma_zalloc(uniarp_zone, M_WAITOK | M_ZERO); if (uap == NULL) return (MAP_FAILED); @@ -279,7 +279,7 @@ uniarp_svcout(ivp, dst) /* * We're a client with an open VCC to the server, get a new arp entry */ - uap = uma_zalloc(uniarp_zone, 0); + uap = uma_zalloc(uniarp_zone, M_WAITOK); if (uap == NULL) { (void) splx(s); return (MAP_FAILED); @@ -440,7 +440,7 @@ uniarp_svcin(ivp, dst, dstsub) /* * No info in the cache - get a new arp entry */ - uap = uma_zalloc(uniarp_zone, M_ZERO); + uap = uma_zalloc(uniarp_zone, M_WAITOK | M_ZERO); if (uap == NULL) { (void) splx(s); return (MAP_FAILED); diff --git a/sys/netatm/uni/uniip.c b/sys/netatm/uni/uniip.c index 7bdb1007fbd8..3635523df396 100644 --- a/sys/netatm/uni/uniip.c +++ b/sys/netatm/uni/uniip.c @@ -188,7 +188,7 @@ uniip_ipact(inp) /* * Get a new interface control block */ - uip = uma_zalloc(uniip_zone, M_ZERO); + uip = uma_zalloc(uniip_zone, M_WAITOK | M_ZERO); if (uip == NULL) return (ENOMEM); diff --git a/sys/netatm/uni/unisig_decode.c b/sys/netatm/uni/unisig_decode.c index c15d02e2a7c2..aa49fdaca7f9 100644 --- a/sys/netatm/uni/unisig_decode.c +++ b/sys/netatm/uni/unisig_decode.c @@ -67,7 +67,7 @@ __RCSID("@(#) $FreeBSD$"); #endif #define ALLOC_IE(ie) do { \ - (ie) = uma_zalloc(unisig_ie_zone, M_ZERO); \ + (ie) = uma_zalloc(unisig_ie_zone, M_WAITOK | M_ZERO); \ if ((ie) == NULL) \ return (ENOMEM); \ } while (0) diff --git a/sys/netatm/uni/unisig_subr.c b/sys/netatm/uni/unisig_subr.c index 8a91fb6e2245..31cd1a4fc2fd 100644 --- a/sys/netatm/uni/unisig_subr.c +++ b/sys/netatm/uni/unisig_subr.c @@ -275,7 +275,7 @@ unisig_open_vcc(usp, cvp) /* * Allocate control block for VCC */ - uvp = uma_zalloc(unisig_vc_zone, M_ZERO); + uvp = uma_zalloc(unisig_vc_zone, M_WAITOK | M_ZERO); if (uvp == NULL) { return(ENOMEM); } @@ -897,7 +897,7 @@ unisig_set_attrs(usp, msg, ap) if (ap->aal.tag == T_ATM_PRESENT) { if (!msg->msg_ie_aalp) { msg->msg_ie_aalp = uma_zalloc(unisig_ie_zone, - M_ZERO); + M_WAITOK | M_ZERO); if (msg->msg_ie_aalp == NULL) { err = ENOMEM; goto done; @@ -955,7 +955,7 @@ unisig_set_attrs(usp, msg, ap) if (ap->traffic.tag == T_ATM_PRESENT) { if (!msg->msg_ie_clrt) { msg->msg_ie_clrt = uma_zalloc(unisig_ie_zone, - M_ZERO); + M_WAITOK | M_ZERO); if (msg->msg_ie_clrt == NULL) { err = ENOMEM; goto done; @@ -1012,7 +1012,7 @@ unisig_set_attrs(usp, msg, ap) if (ap->bearer.tag == T_ATM_PRESENT) { if (!msg->msg_ie_bbcp) { msg->msg_ie_bbcp = uma_zalloc(unisig_ie_zone, - M_ZERO); + M_WAITOK | M_ZERO); if (msg->msg_ie_bbcp == NULL) { err = ENOMEM; goto done; @@ -1040,7 +1040,7 @@ unisig_set_attrs(usp, msg, ap) if (ap->bhli.tag == T_ATM_PRESENT) { if (!msg->msg_ie_bhli) { msg->msg_ie_bhli = uma_zalloc(unisig_ie_zone, - M_ZERO); + M_WAITOK | M_ZERO); if (msg->msg_ie_bhli == NULL) { err = ENOMEM; goto done; @@ -1080,7 +1080,7 @@ unisig_set_attrs(usp, msg, ap) ap->blli.tag_l3 == T_ATM_PRESENT) { if (!msg->msg_ie_blli) { msg->msg_ie_blli = uma_zalloc(unisig_ie_zone, - M_ZERO); + M_WAITOK | M_ZERO); if (msg->msg_ie_blli == NULL) { err = ENOMEM; goto done; @@ -1165,7 +1165,7 @@ unisig_set_attrs(usp, msg, ap) if (ap->called.tag == T_ATM_PRESENT) { if (!msg->msg_ie_cdad) { msg->msg_ie_cdad = uma_zalloc(unisig_ie_zone, - M_ZERO); + M_WAITOK | M_ZERO); if (msg->msg_ie_cdad == NULL) { err = ENOMEM; goto done; @@ -1181,7 +1181,7 @@ unisig_set_attrs(usp, msg, ap) if (ap->called.subaddr.address_format != T_ATM_ABSENT) { if (!msg->msg_ie_cdsa) { msg->msg_ie_cdsa = uma_zalloc(unisig_ie_zone, - M_ZERO); + M_WAITOK | M_ZERO); if (msg->msg_ie_cdsa == NULL) { err = ENOMEM; goto done; @@ -1203,7 +1203,7 @@ unisig_set_attrs(usp, msg, ap) if (ap->calling.tag == T_ATM_PRESENT) { if (!msg->msg_ie_cgad) { msg->msg_ie_cgad = uma_zalloc(unisig_ie_zone, - M_ZERO); + M_WAITOK | M_ZERO); if (msg->msg_ie_cgad == NULL) { err = ENOMEM; goto done; @@ -1220,7 +1220,7 @@ unisig_set_attrs(usp, msg, ap) T_ATM_ABSENT) { if (!msg->msg_ie_cgsa) { msg->msg_ie_cgsa = uma_zalloc(unisig_ie_zone, - M_ZERO); + M_WAITOK | M_ZERO); if (msg->msg_ie_cgsa == NULL) { err = ENOMEM; goto done; @@ -1241,7 +1241,7 @@ unisig_set_attrs(usp, msg, ap) if (ap->qos.tag == T_ATM_PRESENT) { if (!msg->msg_ie_qosp) { msg->msg_ie_qosp = uma_zalloc(unisig_ie_zone, - M_ZERO); + M_WAITOK | M_ZERO); if (msg->msg_ie_qosp == NULL) { err = ENOMEM; goto done; @@ -1273,7 +1273,7 @@ unisig_set_attrs(usp, msg, ap) ap->transit.v.length != 0) { if (!msg->msg_ie_trnt) { msg->msg_ie_trnt = uma_zalloc(unisig_ie_zone, - M_ZERO); + M_WAITOK | M_ZERO); if (msg->msg_ie_trnt == NULL) { err = ENOMEM; goto done; @@ -1298,7 +1298,7 @@ unisig_set_attrs(usp, msg, ap) if (ap->cause.tag == T_ATM_PRESENT) { if (!msg->msg_ie_caus) { msg->msg_ie_caus = uma_zalloc(unisig_ie_zone, - M_ZERO); + M_WAITOK | M_ZERO); if (msg->msg_ie_caus == NULL) { err = ENOMEM; goto done; diff --git a/sys/netatm/uni/unisig_vc_state.c b/sys/netatm/uni/unisig_vc_state.c index 6c5bc369650f..3c88cba80101 100644 --- a/sys/netatm/uni/unisig_vc_state.c +++ b/sys/netatm/uni/unisig_vc_state.c @@ -456,7 +456,7 @@ unisig_vc_act04(usp, uvp, msg) vpi = msg->msg_ie_cnid->ie_cnid_vpci; vci = msg->msg_ie_cnid->ie_cnid_vci; } else { - iep = uma_zalloc(unisig_ie_zone, 0); + iep = uma_zalloc(unisig_ie_zone, M_WAITOK); if (iep == NULL) return (ENOMEM); iep->ie_ident = UNI_IE_CNID; @@ -548,10 +548,10 @@ unisig_vc_act05(usp, uvp, msg) /* * Send a RELEASE message */ - rls_msg = uma_zalloc(unisig_msg_zone, M_ZERO); + rls_msg = uma_zalloc(unisig_msg_zone, M_WAITOK | M_ZERO); if (rls_msg == NULL) return(ENOMEM); - cause_ie = uma_zalloc(unisig_ie_zone, M_ZERO); + cause_ie = uma_zalloc(unisig_ie_zone, M_WAITOK | M_ZERO); if (cause_ie == NULL) { uma_zfree(unisig_msg_zone, rls_msg); return(ENOMEM); @@ -668,7 +668,7 @@ unisig_vc_act06(usp, uvp, msg) * No--VCI must have been specified earlier */ if (!uvp->uv_vci) { - iep = uma_zalloc(unisig_ie_zone, 0); + iep = uma_zalloc(unisig_ie_zone, M_WAITOK); if (iep == NULL) return(ENOMEM); iep->ie_ident = UNI_IE_CNID; @@ -742,7 +742,7 @@ unisig_vc_act06(usp, uvp, msg) /* * Get memory for a CONNECT ACK message */ - cack_msg = uma_zalloc(unisig_msg_zone, 0); + cack_msg = uma_zalloc(unisig_msg_zone, M_WAITOK); if (cack_msg == NULL) return(ENOMEM); @@ -1058,7 +1058,7 @@ unisig_vc_act09(usp, uvp, msg) int rc; struct unisig_msg *conn_msg; - conn_msg = uma_zalloc(unisig_msg_zone, 0); + conn_msg = uma_zalloc(unisig_msg_zone, M_WAITOK); if (conn_msg == NULL) return(ENOMEM); @@ -1389,7 +1389,7 @@ unisig_vc_act15(usp, uvp, msg) } } if (cause == UNI_IE_CAUS_MISSING) { - iep = uma_zalloc(unisig_ie_zone, 0); + iep = uma_zalloc(unisig_ie_zone, M_WAITOK); if (iep == NULL) return(ENOMEM); iep->ie_ident = UNI_IE_CNID; @@ -1611,7 +1611,7 @@ unisig_vc_act20(usp, uvp, msg) /* * Get memory for a STATUS ENQUIRY message */ - stat_msg = uma_zalloc(unisig_msg_zone, 0); + stat_msg = uma_zalloc(unisig_msg_zone, M_WAITOK); if (stat_msg == NULL) return(ENOMEM); @@ -1757,15 +1757,15 @@ unisig_vc_act22(usp, uvp, msg) /* * Get memory for a STATUS message */ - status = uma_zalloc(unisig_msg_zone, M_ZERO); + status = uma_zalloc(unisig_msg_zone, M_WAITOK | M_ZERO); if (status == NULL) return(ENOMEM); - callst_ie = uma_zalloc(unisig_ie_zone, M_ZERO); + callst_ie = uma_zalloc(unisig_ie_zone, M_WAITOK | M_ZERO); if (callst_ie == NULL) { uma_zfree(unisig_msg_zone, status); return(ENOMEM); } - cause_ie = uma_zalloc(unisig_ie_zone, M_ZERO); + cause_ie = uma_zalloc(unisig_ie_zone, M_WAITOK | M_ZERO); if (cause_ie == NULL) { uma_zfree(unisig_msg_zone, status); uma_zfree(unisig_ie_zone, callst_ie); @@ -1859,7 +1859,7 @@ unisig_vc_act23(usp, uvp, msg) /* * Get memory for the ADD PARTY REJECT message */ - apr_msg = uma_zalloc(unisig_msg_zone, M_ZERO); + apr_msg = uma_zalloc(unisig_msg_zone, M_WAITOK | M_ZERO); if (apr_msg == NULL) return(ENOMEM); diff --git a/sys/netgraph/bluetooth/drivers/bt3c/ng_bt3c_pccard.c b/sys/netgraph/bluetooth/drivers/bt3c/ng_bt3c_pccard.c index 2b008bf206b2..443c18acb784 100644 --- a/sys/netgraph/bluetooth/drivers/bt3c/ng_bt3c_pccard.c +++ b/sys/netgraph/bluetooth/drivers/bt3c/ng_bt3c_pccard.c @@ -832,7 +832,7 @@ bt3c_receive(bt3c_softc_p sc) sc->state = NG_BT3C_W4_PKT_IND; sc->want = 1; - MGETHDR(sc->m, M_NOWAIT, MT_DATA); + MGETHDR(sc->m, M_DONTWAIT, MT_DATA); if (sc->m == NULL) { NG_BT3C_ERR(sc->dev, "Could not get mbuf\n"); NG_BT3C_STAT_IERROR(sc->stat); @@ -996,7 +996,7 @@ bt3c_append(struct mbuf *m0, int c) } if (m->m_len >= len) { - MGET(m->m_next, M_NOWAIT, m0->m_type); + MGET(m->m_next, M_DONTWAIT, m0->m_type); if (m->m_next == NULL) return (ENOBUFS); diff --git a/sys/netgraph/bluetooth/drivers/h4/ng_h4.c b/sys/netgraph/bluetooth/drivers/h4/ng_h4.c index d793c04f43d6..650c6f4d2c06 100644 --- a/sys/netgraph/bluetooth/drivers/h4/ng_h4.c +++ b/sys/netgraph/bluetooth/drivers/h4/ng_h4.c @@ -170,7 +170,7 @@ ng_h4_open(dev_t dev, struct tty *tp) } /* Initialize private struct */ - MALLOC(sc, ng_h4_info_p, sizeof(*sc), M_NETGRAPH_H4, M_ZERO); + MALLOC(sc, ng_h4_info_p, sizeof(*sc), M_NETGRAPH_H4, M_WAITOK | M_ZERO); if (sc == NULL) { error = ENOMEM; goto out; @@ -516,7 +516,7 @@ ng_h4_input(int c, struct tty *tp) if (sc->hook != NULL && NG_HOOK_IS_VALID(sc->hook)) { struct mbuf *m = NULL; - MGETHDR(m, M_NOWAIT, MT_DATA); + MGETHDR(m, M_DONTWAIT, MT_DATA); if (m != NULL) { m->m_pkthdr.len = 0; diff --git a/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c b/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c index 71cb2dff11f4..603d72228bb6 100644 --- a/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c +++ b/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c @@ -1012,7 +1012,7 @@ ubt_intr_complete(usbd_xfer_handle h, usbd_private_handle p, usbd_status s) /* Copy HCI event frame to mbuf */ - MGETHDR(m, M_NOWAIT, MT_DATA); + MGETHDR(m, M_DONTWAIT, MT_DATA); if (m == NULL) { NG_UBT_ALERT( "%s: %s - Could not allocate mbuf\n", __func__, USBDEVNAME(sc->sc_dev)); @@ -1148,7 +1148,7 @@ ubt_bulk_in_complete(usbd_xfer_handle h, usbd_private_handle p, usbd_status s) if (h->actlen < sizeof(*hdr)) goto done; - MGETHDR(m, M_NOWAIT, MT_DATA); + MGETHDR(m, M_DONTWAIT, MT_DATA); if (m == NULL) { NG_UBT_ALERT( "%s: %s - Could not allocate mbuf\n", __func__, USBDEVNAME(sc->sc_dev)); @@ -1426,7 +1426,7 @@ ubt_isoc_in_complete(usbd_xfer_handle h, usbd_private_handle p, usbd_status s) /* Copy SCO data frame to mbuf */ - MGETHDR(m, M_NOWAIT, MT_DATA); + MGETHDR(m, M_DONTWAIT, MT_DATA); if (m == NULL) { NG_UBT_ALERT( "%s: %s - Could not allocate mbuf\n", diff --git a/sys/netgraph/bluetooth/hci/ng_hci_cmds.c b/sys/netgraph/bluetooth/hci/ng_hci_cmds.c index 3e3e501adf1d..5769ee586cec 100644 --- a/sys/netgraph/bluetooth/hci/ng_hci_cmds.c +++ b/sys/netgraph/bluetooth/hci/ng_hci_cmds.c @@ -116,7 +116,7 @@ ng_hci_send_command(ng_hci_unit_p unit) ng_hci_mtap(unit, m0); - m = m_dup(m0, M_NOWAIT); + m = m_dup(m0, M_DONTWAIT); if (m != NULL) NG_SEND_DATA_ONLY(error, unit->drv, m); else diff --git a/sys/netgraph/bluetooth/hci/ng_hci_evnt.c b/sys/netgraph/bluetooth/hci/ng_hci_evnt.c index cd199db08a3d..9d81380e019c 100644 --- a/sys/netgraph/bluetooth/hci/ng_hci_evnt.c +++ b/sys/netgraph/bluetooth/hci/ng_hci_evnt.c @@ -504,7 +504,7 @@ con_compl(ng_hci_unit_p unit, struct mbuf *event) } __attribute__ ((packed)) *lp; struct mbuf *m; - MGETHDR(m, M_NOWAIT, MT_DATA); + MGETHDR(m, M_DONTWAIT, MT_DATA); if (m != NULL) { m->m_pkthdr.len = m->m_len = sizeof(*lp); lp = mtod(m, struct __link_policy *); diff --git a/sys/netgraph/bluetooth/hci/ng_hci_misc.c b/sys/netgraph/bluetooth/hci/ng_hci_misc.c index c4f1f85c6c1d..ba92f8987ae2 100644 --- a/sys/netgraph/bluetooth/hci/ng_hci_misc.c +++ b/sys/netgraph/bluetooth/hci/ng_hci_misc.c @@ -67,7 +67,7 @@ ng_hci_mtap(ng_hci_unit_p unit, struct mbuf *m0) int error = 0; if (unit->raw != NULL && NG_HOOK_IS_VALID(unit->raw)) { - m = m_dup(m0, M_NOWAIT); + m = m_dup(m0, M_DONTWAIT); if (m != NULL) NG_SEND_DATA_ONLY(error, unit->raw, m); diff --git a/sys/netgraph/bluetooth/hci/ng_hci_ulpi.c b/sys/netgraph/bluetooth/hci/ng_hci_ulpi.c index 0a2c48b99659..97a0ea8ec2f3 100644 --- a/sys/netgraph/bluetooth/hci/ng_hci_ulpi.c +++ b/sys/netgraph/bluetooth/hci/ng_hci_ulpi.c @@ -232,7 +232,7 @@ ng_hci_lp_acl_con_req(ng_hci_unit_p unit, item_p item, hook_p hook) * Create HCI command */ - MGETHDR(m, M_NOWAIT, MT_DATA); + MGETHDR(m, M_DONTWAIT, MT_DATA); if (m == NULL) { ng_hci_free_con(con); error = ENOBUFS; @@ -427,7 +427,7 @@ ng_hci_lp_sco_con_req(ng_hci_unit_p unit, item_p item, hook_p hook) * Create HCI command */ - MGETHDR(m, M_NOWAIT, MT_DATA); + MGETHDR(m, M_DONTWAIT, MT_DATA); if (m == NULL) { ng_hci_free_con(sco_con); error = ENOBUFS; @@ -545,7 +545,7 @@ ng_hci_lp_discon_req(ng_hci_unit_p unit, item_p item, hook_p hook) * Create HCI command */ - MGETHDR(m, M_NOWAIT, MT_DATA); + MGETHDR(m, M_DONTWAIT, MT_DATA); if (m == NULL) { error = ENOBUFS; goto out; @@ -794,7 +794,7 @@ ng_hci_lp_con_rsp(ng_hci_unit_p unit, item_p item, hook_p hook) * Create HCI command */ - MGETHDR(m, M_NOWAIT, MT_DATA); + MGETHDR(m, M_DONTWAIT, MT_DATA); if (m == NULL) { error = ENOBUFS; goto out; @@ -1017,7 +1017,7 @@ ng_hci_lp_qos_req(ng_hci_unit_p unit, item_p item, hook_p hook) * Create HCI command */ - MGETHDR(m, M_NOWAIT, MT_DATA); + MGETHDR(m, M_DONTWAIT, MT_DATA); if (m == NULL) { error = ENOBUFS; goto out; @@ -1247,7 +1247,7 @@ ng_hci_process_con_watchdog_timeout(node_p node, hook_p hook, * Create HCI command */ - MGETHDR(m, M_NOWAIT, MT_DATA); + MGETHDR(m, M_DONTWAIT, MT_DATA); if (m == NULL) return; /* XXX this is bad */ diff --git a/sys/netgraph/bluetooth/l2cap/ng_l2cap_cmds.h b/sys/netgraph/bluetooth/l2cap/ng_l2cap_cmds.h index 42f53aacef9c..d107ad687ff7 100644 --- a/sys/netgraph/bluetooth/l2cap/ng_l2cap_cmds.h +++ b/sys/netgraph/bluetooth/l2cap/ng_l2cap_cmds.h @@ -54,7 +54,7 @@ do { \ ng_l2cap_cmd_rej_data_t data; \ } __attribute__ ((packed)) *c = NULL; \ \ - MGETHDR((_m), M_NOWAIT, MT_DATA); \ + MGETHDR((_m), M_DONTWAIT, MT_DATA); \ if ((_m) == NULL) \ break; \ \ @@ -88,7 +88,7 @@ do { \ ng_l2cap_con_req_cp param; \ } __attribute__ ((packed)) *c = NULL; \ \ - MGETHDR((_m), M_NOWAIT, MT_DATA); \ + MGETHDR((_m), M_DONTWAIT, MT_DATA); \ if ((_m) == NULL) \ break; \ \ @@ -111,7 +111,7 @@ do { \ ng_l2cap_con_rsp_cp param; \ } __attribute__ ((packed)) *c = NULL; \ \ - MGETHDR((_m), M_NOWAIT, MT_DATA); \ + MGETHDR((_m), M_DONTWAIT, MT_DATA); \ if ((_m) == NULL) \ break; \ \ @@ -136,7 +136,7 @@ do { \ ng_l2cap_cfg_req_cp param; \ } __attribute__ ((packed)) *c = NULL; \ \ - MGETHDR((_m), M_NOWAIT, MT_DATA); \ + MGETHDR((_m), M_DONTWAIT, MT_DATA); \ if ((_m) == NULL) { \ NG_FREE_M((_data)); \ break; \ @@ -168,7 +168,7 @@ do { \ ng_l2cap_cfg_rsp_cp param; \ } __attribute__ ((packed)) *c = NULL; \ \ - MGETHDR((_m), M_NOWAIT, MT_DATA); \ + MGETHDR((_m), M_DONTWAIT, MT_DATA); \ if ((_m) == NULL) { \ NG_FREE_M((_data)); \ break; \ @@ -198,7 +198,7 @@ do { \ do { \ u_int8_t *p = NULL; \ \ - MGETHDR((_m), M_NOWAIT, MT_DATA); \ + MGETHDR((_m), M_DONTWAIT, MT_DATA); \ if ((_m) == NULL) \ break; \ \ @@ -275,7 +275,7 @@ do { \ ng_l2cap_discon_req_cp param; \ } __attribute__ ((packed)) *c = NULL; \ \ - MGETHDR((_m), M_NOWAIT, MT_DATA); \ + MGETHDR((_m), M_DONTWAIT, MT_DATA); \ if ((_m) == NULL) \ break; \ \ @@ -298,7 +298,7 @@ do { \ ng_l2cap_discon_rsp_cp param; \ } __attribute__ ((packed)) *c = NULL; \ \ - MGETHDR((_m), M_NOWAIT, MT_DATA); \ + MGETHDR((_m), M_DONTWAIT, MT_DATA); \ if ((_m) == NULL) \ break; \ \ @@ -318,7 +318,7 @@ do { \ do { \ ng_l2cap_cmd_hdr_t *c = NULL; \ \ - MGETHDR((_m), M_NOWAIT, MT_DATA); \ + MGETHDR((_m), M_DONTWAIT, MT_DATA); \ if ((_m) == NULL) \ break; \ \ @@ -345,7 +345,7 @@ do { \ ng_l2cap_info_req_cp param; \ } __attribute__ ((packed)) *c = NULL; \ \ - MGETHDR((_m), M_NOWAIT, MT_DATA); \ + MGETHDR((_m), M_DONTWAIT, MT_DATA); \ if ((_m) == NULL) \ break; \ \ @@ -368,7 +368,7 @@ do { \ ng_l2cap_info_rsp_data_t data; \ } __attribute__ ((packed)) *c = NULL; \ \ - MGETHDR((_m), M_NOWAIT, MT_DATA); \ + MGETHDR((_m), M_DONTWAIT, MT_DATA); \ if ((_m) == NULL) \ break; \ \ diff --git a/sys/netgraph/bluetooth/l2cap/ng_l2cap_evnt.c b/sys/netgraph/bluetooth/l2cap/ng_l2cap_evnt.c index e4a644d60b02..3779b91a433f 100644 --- a/sys/netgraph/bluetooth/l2cap/ng_l2cap_evnt.c +++ b/sys/netgraph/bluetooth/l2cap/ng_l2cap_evnt.c @@ -190,7 +190,7 @@ ng_l2cap_process_signal_cmd(ng_l2cap_con_p con) /* Get the command, save the rest (if any) */ if (con->rx_pkt->m_pkthdr.len > hdr->length) - m = m_split(con->rx_pkt, hdr->length, M_NOWAIT); + m = m_split(con->rx_pkt, hdr->length, M_DONTWAIT); else m = NULL; diff --git a/sys/netgraph/bluetooth/l2cap/ng_l2cap_llpi.c b/sys/netgraph/bluetooth/l2cap/ng_l2cap_llpi.c index 39979be90c50..f505158564d3 100644 --- a/sys/netgraph/bluetooth/l2cap/ng_l2cap_llpi.c +++ b/sys/netgraph/bluetooth/l2cap/ng_l2cap_llpi.c @@ -502,7 +502,7 @@ ng_l2cap_lp_send(ng_l2cap_con_p con, u_int16_t dcid, struct mbuf *m0) /* Check length of the packet against HCI MTU */ len = m0->m_pkthdr.len; if (len > l2cap->pkt_size) { - m = m_split(m0, l2cap->pkt_size, M_NOWAIT); + m = m_split(m0, l2cap->pkt_size, M_DONTWAIT); if (m == NULL) { NG_L2CAP_ALERT( "%s: %s - m_split(%d) failed\n", __func__, NG_NODE_NAME(l2cap->node), diff --git a/sys/netgraph/bluetooth/l2cap/ng_l2cap_misc.c b/sys/netgraph/bluetooth/l2cap/ng_l2cap_misc.c index affa98e5f4a5..9fcbc6ee5d4a 100644 --- a/sys/netgraph/bluetooth/l2cap/ng_l2cap_misc.c +++ b/sys/netgraph/bluetooth/l2cap/ng_l2cap_misc.c @@ -432,7 +432,7 @@ ng_l2cap_queue_command_timeout(void *context) struct mbuf * ng_l2cap_prepend(struct mbuf *m, int size) { - M_PREPEND(m, size, M_NOWAIT); + M_PREPEND(m, size, M_DONTWAIT); if (m == NULL || (m->m_len < size && (m = m_pullup(m, size)) == NULL)) return (NULL); diff --git a/sys/netgraph/bluetooth/socket/ng_btsocket_hci_raw.c b/sys/netgraph/bluetooth/socket/ng_btsocket_hci_raw.c index 9bc24388a7de..8fa8a08e5ce3 100644 --- a/sys/netgraph/bluetooth/socket/ng_btsocket_hci_raw.c +++ b/sys/netgraph/bluetooth/socket/ng_btsocket_hci_raw.c @@ -275,7 +275,7 @@ ng_btsocket_hci_raw_node_rcvdata(hook_p hook, item_p item) struct mbuf *nam = NULL; int error; - MGET(nam, M_NOWAIT, MT_SONAME); + MGET(nam, M_DONTWAIT, MT_SONAME); if (nam != NULL) { struct sockaddr_hci *sa = mtod(nam, struct sockaddr_hci *); @@ -348,7 +348,7 @@ ng_btsocket_raw_send_ngmsg(char *path, int cmd, void *arg, int arglen) struct ng_mesg *msg = NULL; int error = 0; - NG_MKMESSAGE(msg, NGM_HCI_COOKIE, cmd, arglen, 0); + NG_MKMESSAGE(msg, NGM_HCI_COOKIE, cmd, arglen, M_WAITOK); if (msg == NULL) return (ENOMEM); @@ -374,7 +374,7 @@ ng_btsocket_raw_send_sync_ngmsg(ng_btsocket_hci_raw_pcb_p pcb, char *path, ng_btsocket_hci_raw_get_token(&pcb->token); pcb->msg = NULL; - NG_MKMESSAGE(msg, NGM_HCI_COOKIE, cmd, 0, 0); + NG_MKMESSAGE(msg, NGM_HCI_COOKIE, cmd, 0, M_WAITOK); if (msg == NULL) { pcb->token = 0; return (ENOMEM); @@ -504,7 +504,7 @@ ng_btsocket_hci_raw_data_input(struct mbuf *nam) * will check if socket has enough buffer space. */ - m = m_dup(m0, M_NOWAIT); + m = m_dup(m0, M_DONTWAIT); if (m != NULL) { struct mbuf *ctl = NULL; @@ -743,7 +743,7 @@ ng_btsocket_hci_raw_attach(struct socket *so, int proto, struct thread *td) return (error); MALLOC(pcb, ng_btsocket_hci_raw_pcb_p, sizeof(*pcb), - M_NETGRAPH_BTSOCKET_HCI_RAW, M_ZERO); + M_NETGRAPH_BTSOCKET_HCI_RAW, M_WAITOK | M_ZERO); if (pcb == NULL) return (ENOMEM); @@ -956,7 +956,7 @@ ng_btsocket_hci_raw_control(struct socket *so, u_long cmd, caddr_t data, pcb->msg = NULL; NG_MKMESSAGE(msg, NGM_HCI_COOKIE, - NGM_HCI_NODE_GET_NEIGHBOR_CACHE, 0, 0); + NGM_HCI_NODE_GET_NEIGHBOR_CACHE, 0, M_WAITOK); if (msg == NULL) { pcb->token = 0; error = ENOMEM; @@ -1014,7 +1014,7 @@ ng_btsocket_hci_raw_control(struct socket *so, u_long cmd, caddr_t data, pcb->msg = NULL; NG_MKMESSAGE(msg, NGM_HCI_COOKIE, NGM_HCI_NODE_GET_CON_LIST, - 0, 0); + 0, M_WAITOK); if (msg == NULL) { pcb->token = 0; error = ENOMEM; @@ -1271,7 +1271,7 @@ ng_btsocket_hci_raw_send(struct socket *so, int flags, struct mbuf *m, sa = (struct sockaddr *) &pcb->addr; } - MGET(nam, 0, MT_SONAME); + MGET(nam, M_TRYWAIT, MT_SONAME); if (nam == NULL) { error = ENOBUFS; goto drop; diff --git a/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c b/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c index 8360038d8bc7..dec7a3c2e62e 100644 --- a/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c +++ b/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c @@ -1464,7 +1464,7 @@ ng_btsocket_l2cap_data_input(struct mbuf *m, hook_p hook) * it is a broadcast traffic after all */ - copy = m_dup(m, M_NOWAIT); + copy = m_dup(m, M_DONTWAIT); if (copy != NULL) { sbappendrecord(&pcb->so->so_rcv, copy); sorwakeup(pcb->so); @@ -2384,7 +2384,7 @@ ng_btsocket_l2cap_send2(ng_btsocket_l2cap_pcb_p pcb) if (pcb->so->so_snd.sb_cc == 0) return (EINVAL); /* XXX */ - m = m_dup(pcb->so->so_snd.sb_mb, M_NOWAIT); + m = m_dup(pcb->so->so_snd.sb_mb, M_DONTWAIT); if (m == NULL) return (ENOBUFS); diff --git a/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap_raw.c b/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap_raw.c index 44e3be10ee61..3b24afd73a9f 100644 --- a/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap_raw.c +++ b/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap_raw.c @@ -571,7 +571,7 @@ ng_btsocket_l2cap_raw_attach(struct socket *so, int proto, struct thread *td) /* Allocate the PCB */ MALLOC(pcb, ng_btsocket_l2cap_raw_pcb_p, sizeof(*pcb), - M_NETGRAPH_BTSOCKET_L2CAP_RAW, M_ZERO); + M_NETGRAPH_BTSOCKET_L2CAP_RAW, M_WAITOK | M_ZERO); if (pcb == NULL) return (ENOMEM); @@ -758,7 +758,7 @@ ng_btsocket_l2cap_raw_control(struct socket *so, u_long cmd, caddr_t data, pcb->msg = NULL; NG_MKMESSAGE(msg, NGM_L2CAP_COOKIE, NGM_L2CAP_NODE_GET_FLAGS, - 0, 0); + 0, M_WAITOK); if (msg == NULL) { pcb->token = 0; error = ENOMEM; @@ -799,7 +799,7 @@ ng_btsocket_l2cap_raw_control(struct socket *so, u_long cmd, caddr_t data, pcb->msg = NULL; NG_MKMESSAGE(msg, NGM_L2CAP_COOKIE, NGM_L2CAP_NODE_GET_DEBUG, - 0, 0); + 0, M_WAITOK); if (msg == NULL) { pcb->token = 0; error = ENOMEM; @@ -837,7 +837,7 @@ ng_btsocket_l2cap_raw_control(struct socket *so, u_long cmd, caddr_t data, (struct ng_btsocket_l2cap_raw_node_debug *) data; NG_MKMESSAGE(msg, NGM_L2CAP_COOKIE, NGM_L2CAP_NODE_SET_DEBUG, - sizeof(ng_l2cap_node_debug_ep), 0); + sizeof(ng_l2cap_node_debug_ep), M_WAITOK); if (msg == NULL) { error = ENOMEM; break; @@ -865,7 +865,7 @@ ng_btsocket_l2cap_raw_control(struct socket *so, u_long cmd, caddr_t data, pcb->msg = NULL; NG_MKMESSAGE(msg, NGM_L2CAP_COOKIE, NGM_L2CAP_NODE_GET_CON_LIST, - 0, 0); + 0, M_WAITOK); if (msg == NULL) { pcb->token = 0; error = ENOMEM; @@ -923,7 +923,7 @@ ng_btsocket_l2cap_raw_control(struct socket *so, u_long cmd, caddr_t data, pcb->msg = NULL; NG_MKMESSAGE(msg, NGM_L2CAP_COOKIE, - NGM_L2CAP_NODE_GET_CHAN_LIST, 0, 0); + NGM_L2CAP_NODE_GET_CHAN_LIST, 0, M_WAITOK); if (msg == NULL) { pcb->token = 0; error = ENOMEM; @@ -987,7 +987,7 @@ ng_btsocket_l2cap_raw_control(struct socket *so, u_long cmd, caddr_t data, NG_MKMESSAGE(msg, NGM_L2CAP_COOKIE, NGM_L2CAP_L2CA_PING, sizeof(*ip) + p->echo_size, - 0); + M_WAITOK); if (msg == NULL) { pcb->token = 0; error = ENOMEM; @@ -1056,7 +1056,7 @@ ng_btsocket_l2cap_raw_control(struct socket *so, u_long cmd, caddr_t data, NG_MKMESSAGE(msg, NGM_L2CAP_COOKIE, NGM_L2CAP_L2CA_GET_INFO, sizeof(*ip) + p->info_size, - 0); + M_WAITOK); if (msg == NULL) { pcb->token = 0; error = ENOMEM; diff --git a/sys/netgraph/ng_UI.c b/sys/netgraph/ng_UI.c index 8751105deb63..e0733bce2fbe 100644 --- a/sys/netgraph/ng_UI.c +++ b/sys/netgraph/ng_UI.c @@ -194,7 +194,7 @@ ng_UI_rcvdata(hook_p hook, item_p item) m_adj(m, ptr - start); NG_FWD_NEW_DATA(error, item, priv->uplink, m); /* m -> NULL */ } else if (hook == priv->uplink) { - M_PREPEND(m, 1, M_NOWAIT); /* Prepend IP NLPID */ + M_PREPEND(m, 1, M_DONTWAIT); /* Prepend IP NLPID */ if (!m) ERROUT(ENOBUFS); mtod(m, u_char *)[0] = HDLC_UI; diff --git a/sys/netgraph/ng_bridge.c b/sys/netgraph/ng_bridge.c index 1e1ff1c70e1b..f552a503ee5a 100644 --- a/sys/netgraph/ng_bridge.c +++ b/sys/netgraph/ng_bridge.c @@ -713,7 +713,7 @@ ng_bridge_rcvdata(hook_p hook, item_p item) * It's usable link but not the reserved (first) one. * Copy mbuf and meta info for sending. */ - m2 = m_dup(m, M_NOWAIT); /* XXX m_copypacket() */ + m2 = m_dup(m, M_DONTWAIT); /* XXX m_copypacket() */ if (m2 == NULL) { link->stats.memoryFailures++; NG_FREE_ITEM(item); diff --git a/sys/netgraph/ng_cisco.c b/sys/netgraph/ng_cisco.c index 70ef5d7eb406..f263f3569399 100644 --- a/sys/netgraph/ng_cisco.c +++ b/sys/netgraph/ng_cisco.c @@ -360,7 +360,7 @@ cisco_rcvdata(hook_p hook, item_p item) /* OK so it came from a protocol, heading out. Prepend general data packet header. For now, IP,IPX only */ m = NGI_M(item); /* still associated with item */ - M_PREPEND(m, CISCO_HEADER_LEN, M_NOWAIT); + M_PREPEND(m, CISCO_HEADER_LEN, M_DONTWAIT); if (!m) { error = ENOBUFS; goto out; @@ -606,7 +606,7 @@ cisco_send(sc_p sc, int type, long par1, long par2) getmicrotime(&time); - MGETHDR(m, M_NOWAIT, MT_DATA); + MGETHDR(m, M_DONTWAIT, MT_DATA); if (!m) return (ENOBUFS); diff --git a/sys/netgraph/ng_eiface.c b/sys/netgraph/ng_eiface.c index 1bead1a0f9b4..7588c92fe8a1 100644 --- a/sys/netgraph/ng_eiface.c +++ b/sys/netgraph/ng_eiface.c @@ -417,7 +417,7 @@ ng_eiface_constructor(node_p node) int error = 0; /* Allocate node and interface private structures */ - MALLOC(priv, priv_p, sizeof(*priv), M_NETGRAPH, 0); + MALLOC(priv, priv_p, sizeof(*priv), M_NETGRAPH, M_WAITOK); if (priv == NULL) { return (ENOMEM); } diff --git a/sys/netgraph/ng_frame_relay.c b/sys/netgraph/ng_frame_relay.c index e2dc2996c3ef..dc555922be09 100644 --- a/sys/netgraph/ng_frame_relay.c +++ b/sys/netgraph/ng_frame_relay.c @@ -366,7 +366,7 @@ ngfrm_rcvdata(hook_p hook, item_p item) alen = sc->addrlen; if (alen == 0) alen = 2; /* default value for transmit */ - M_PREPEND(m, alen, M_NOWAIT); + M_PREPEND(m, alen, M_DONTWAIT); if (m == NULL) { error = ENOBUFS; goto bad; diff --git a/sys/netgraph/ng_gif.c b/sys/netgraph/ng_gif.c index 985cf315c0af..2d999590f412 100644 --- a/sys/netgraph/ng_gif.c +++ b/sys/netgraph/ng_gif.c @@ -309,7 +309,7 @@ ng_gif_glue_af(struct mbuf **mp, int af) * hopefully everything after that will not * need one. So let's just use M_PREPEND. */ - M_PREPEND(m, sizeof (tmp_af), M_NOWAIT); + M_PREPEND(m, sizeof (tmp_af), M_DONTWAIT); if (m == NULL) { error = ENOBUFS; goto done; diff --git a/sys/netgraph/ng_gif_demux.c b/sys/netgraph/ng_gif_demux.c index 9f6495a880b4..066bea6e4e29 100644 --- a/sys/netgraph/ng_gif_demux.c +++ b/sys/netgraph/ng_gif_demux.c @@ -346,7 +346,7 @@ ng_gif_demux_rcvdata(hook_p hook, item_p item) * Add address family header and set the output hook. */ iffam = get_iffam_from_hook(priv, hook); - M_PREPEND(m, sizeof (iffam->family), M_NOWAIT); + M_PREPEND(m, sizeof (iffam->family), M_DONTWAIT); if (m == NULL) { NG_FREE_M(m); NG_FREE_ITEM(item); diff --git a/sys/netgraph/ng_l2tp.c b/sys/netgraph/ng_l2tp.c index 69a7cf96ec02..ebc6a4186360 100644 --- a/sys/netgraph/ng_l2tp.c +++ b/sys/netgraph/ng_l2tp.c @@ -851,7 +851,7 @@ ng_l2tp_recv_lower(node_p node, item_p item) * later because of a memory error, because then the upper * layer would never get the packet. */ - M_PREPEND(m, 2, M_NOWAIT); + M_PREPEND(m, 2, M_DONTWAIT); if (m == NULL) { priv->stats.memoryFailures++; NG_FREE_ITEM(item); @@ -955,7 +955,7 @@ ng_l2tp_recv_ctrl(node_p node, item_p item) } /* Copy packet */ - if ((m = L2TP_COPY_MBUF(seq->xwin[i], M_NOWAIT)) == NULL) { + if ((m = L2TP_COPY_MBUF(seq->xwin[i], M_DONTWAIT)) == NULL) { priv->stats.memoryFailures++; return (ENOBUFS); } @@ -991,7 +991,7 @@ ng_l2tp_recv_data(node_p node, item_p item, hookpriv_p hpriv) M_PREPEND(m, 6 + (2 * (hpriv->conf.include_length != 0)) + (4 * (hpriv->conf.enable_dseq != 0)), - M_NOWAIT); + M_DONTWAIT); if (m == NULL) { priv->stats.memoryFailures++; NG_FREE_ITEM(item); @@ -1219,7 +1219,7 @@ ng_l2tp_seq_recv_nr(priv_p priv, u_int16_t nr) */ while ((i = L2TP_SEQ_DIFF(seq->ns, seq->rack)) < seq->cwnd && seq->xwin[i] != NULL) { - if ((m = L2TP_COPY_MBUF(seq->xwin[i], M_NOWAIT)) == NULL) + if ((m = L2TP_COPY_MBUF(seq->xwin[i], M_DONTWAIT)) == NULL) priv->stats.memoryFailures++; else ng_l2tp_xmit_ctrl(priv, m, seq->ns); @@ -1361,7 +1361,7 @@ ng_l2tp_seq_rack_timeout(void *arg) seq->acks = 0; /* Retransmit oldest unack'd packet */ - if ((m = L2TP_COPY_MBUF(seq->xwin[0], M_NOWAIT)) == NULL) + if ((m = L2TP_COPY_MBUF(seq->xwin[0], M_DONTWAIT)) == NULL) priv->stats.memoryFailures++; else ng_l2tp_xmit_ctrl(priv, m, seq->rack); @@ -1388,7 +1388,7 @@ ng_l2tp_xmit_ctrl(priv_p priv, struct mbuf *m, u_int16_t ns) if (m == NULL) { /* Create a new mbuf for ZLB packet */ - MGETHDR(m, M_NOWAIT, MT_DATA); + MGETHDR(m, M_DONTWAIT, MT_DATA); if (m == NULL) { priv->stats.memoryFailures++; return (ENOBUFS); @@ -1407,7 +1407,7 @@ ng_l2tp_xmit_ctrl(priv_p priv, struct mbuf *m, u_int16_t ns) m_adj(m, 2); /* Make room for L2TP header */ - M_PREPEND(m, 12, M_NOWAIT); + M_PREPEND(m, 12, M_DONTWAIT); if (m == NULL) { priv->stats.memoryFailures++; return (ENOBUFS); diff --git a/sys/netgraph/ng_lmi.c b/sys/netgraph/ng_lmi.c index f098aa8caf37..87f35675ac36 100644 --- a/sys/netgraph/ng_lmi.c +++ b/sys/netgraph/ng_lmi.c @@ -321,7 +321,7 @@ nglmi_inquire(sc_p sc, int full) if (sc->lmi_channel == NULL) return; - MGETHDR(m, M_NOWAIT, MT_DATA); + MGETHDR(m, M_DONTWAIT, MT_DATA); if (m == NULL) { log(LOG_ERR, "nglmi: unable to start up LMI processing\n"); return; diff --git a/sys/netgraph/ng_one2many.c b/sys/netgraph/ng_one2many.c index 5332049f4353..927bb77a99c1 100644 --- a/sys/netgraph/ng_one2many.c +++ b/sys/netgraph/ng_one2many.c @@ -427,7 +427,7 @@ ng_one2many_rcvdata(hook_p hook, item_p item) struct ng_one2many_link *mdst; mdst = &priv->many[priv->activeMany[i]]; - m2 = m_dup(m, M_NOWAIT); /* XXX m_copypacket() */ + m2 = m_dup(m, M_DONTWAIT); /* XXX m_copypacket() */ if (m2 == NULL) { mdst->stats.memoryFailures++; NG_FREE_ITEM(item); diff --git a/sys/netgraph/ng_ppp.c b/sys/netgraph/ng_ppp.c index 16373e3f4b57..6ffb0829d65b 100644 --- a/sys/netgraph/ng_ppp.c +++ b/sys/netgraph/ng_ppp.c @@ -1595,7 +1595,7 @@ ng_ppp_mp_output(node_p node, struct mbuf *m, meta_p meta) /* Split off next fragment as "m2" */ m2 = m; if (!lastFragment) { - struct mbuf *n = m_split(m, len, M_NOWAIT); + struct mbuf *n = m_split(m, len, M_DONTWAIT); if (n == NULL) { NG_FREE_M(m); @@ -1916,7 +1916,7 @@ ng_ppp_addproto(struct mbuf *m, int proto, int compOK) static struct mbuf * ng_ppp_prepend(struct mbuf *m, const void *buf, int len) { - M_PREPEND(m, len, M_NOWAIT); + M_PREPEND(m, len, M_DONTWAIT); if (m == NULL || (m->m_len < len && (m = m_pullup(m, len)) == NULL)) return (NULL); bcopy(buf, mtod(m, u_char *), len); diff --git a/sys/netgraph/ng_pppoe.c b/sys/netgraph/ng_pppoe.c index 521d708e190b..886747e65695 100644 --- a/sys/netgraph/ng_pppoe.c +++ b/sys/netgraph/ng_pppoe.c @@ -723,14 +723,14 @@ AAA printf("pppoe: Session out of memory\n"); LEAVE(ENOMEM); } - MGETHDR(neg->m, M_NOWAIT, MT_DATA); + MGETHDR(neg->m, M_DONTWAIT, MT_DATA); if(neg->m == NULL) { printf("pppoe: Session out of mbufs\n"); FREE(neg, M_NETGRAPH_PPPOE); LEAVE(ENOBUFS); } neg->m->m_pkthdr.rcvif = NULL; - MCLGET(neg->m, M_NOWAIT); + MCLGET(neg->m, M_DONTWAIT); if ((neg->m->m_flags & M_EXT) == 0) { printf("pppoe: Session out of mcls\n"); m_freem(neg->m); @@ -1008,7 +1008,7 @@ AAA * Put it into a cluster. */ struct mbuf *n; - n = m_dup(m, M_NOWAIT); + n = m_dup(m, M_DONTWAIT); m_freem(m); m = n; if (m) { @@ -1350,7 +1350,7 @@ AAA * But first correct the length. */ sp->pkt_hdr.ph.length = htons((short)(m->m_pkthdr.len)); - M_PREPEND(m, sizeof(*wh), M_NOWAIT); + M_PREPEND(m, sizeof(*wh), M_DONTWAIT); if (m == NULL) { LEAVE(ENOBUFS); } @@ -1525,7 +1525,7 @@ AAA wh->eh.ether_type = ETHERTYPE_PPPOE_DISC; /* generate a packet of that type */ - MGETHDR(m, M_NOWAIT, MT_DATA); + MGETHDR(m, M_DONTWAIT, MT_DATA); if(m == NULL) printf("pppoe: Session out of mbufs\n"); else { @@ -1596,7 +1596,7 @@ AAA case PPPOE_SINIT: case PPPOE_SREQ: /* timeouts on these produce resends */ - m0 = m_copypacket(sp->neg->m, M_NOWAIT); + m0 = m_copypacket(sp->neg->m, M_DONTWAIT); NG_SEND_DATA_ONLY( error, privp->ethernet_hook, m0); neg->timeout_handle = timeout(pppoe_ticker, hook, neg->timeout * hz); @@ -1642,7 +1642,7 @@ AAA case PPPOE_NEWCONNECTED: /* send the PADS without a timeout - we're now connected */ - m0 = m_copypacket(sp->neg->m, M_NOWAIT); + m0 = m_copypacket(sp->neg->m, M_DONTWAIT); NG_SEND_DATA_ONLY( error, privp->ethernet_hook, m0); break; @@ -1657,7 +1657,7 @@ AAA * send the offer but if they don't respond * in PPPOE_OFFER_TIMEOUT seconds, forget about it. */ - m0 = m_copypacket(sp->neg->m, M_NOWAIT); + m0 = m_copypacket(sp->neg->m, M_DONTWAIT); NG_SEND_DATA_ONLY( error, privp->ethernet_hook, m0); neg->timeout_handle = timeout(pppoe_ticker, hook, PPPOE_OFFER_TIMEOUT * hz); @@ -1665,7 +1665,7 @@ AAA case PPPOE_SINIT: case PPPOE_SREQ: - m0 = m_copypacket(sp->neg->m, M_NOWAIT); + m0 = m_copypacket(sp->neg->m, M_DONTWAIT); NG_SEND_DATA_ONLY( error, privp->ethernet_hook, m0); neg->timeout_handle = timeout(pppoe_ticker, hook, (hz * PPPOE_INITIAL_TIMEOUT)); diff --git a/sys/netgraph/ng_pptpgre.c b/sys/netgraph/ng_pptpgre.c index 4422b29cf60a..50811da57bee 100644 --- a/sys/netgraph/ng_pptpgre.c +++ b/sys/netgraph/ng_pptpgre.c @@ -522,7 +522,7 @@ ng_pptpgre_xmit(node_p node, item_p item) /* Prepend GRE header to outgoing frame */ grelen = sizeof(*gre) + sizeof(u_int32_t) * (gre->hasSeq + gre->hasAck); if (m == NULL) { - MGETHDR(m, M_NOWAIT, MT_DATA); + MGETHDR(m, M_DONTWAIT, MT_DATA); if (m == NULL) { priv->stats.memoryFailures++; if (item) @@ -532,7 +532,7 @@ ng_pptpgre_xmit(node_p node, item_p item) m->m_len = m->m_pkthdr.len = grelen; m->m_pkthdr.rcvif = NULL; } else { - M_PREPEND(m, grelen, M_NOWAIT); + M_PREPEND(m, grelen, M_DONTWAIT); if (m == NULL || (m->m_len < grelen && (m = m_pullup(m, grelen)) == NULL)) { priv->stats.memoryFailures++; diff --git a/sys/netgraph/ng_rfc1490.c b/sys/netgraph/ng_rfc1490.c index b6c75eafb7c5..778d07b5e90b 100644 --- a/sys/netgraph/ng_rfc1490.c +++ b/sys/netgraph/ng_rfc1490.c @@ -278,14 +278,14 @@ ng_rfc1490_rcvdata(hook_p hook, item_p item) break; } } else if (hook == priv->ppp) { - M_PREPEND(m, 2, M_NOWAIT); /* Prepend PPP NLPID */ + M_PREPEND(m, 2, M_DONTWAIT); /* Prepend PPP NLPID */ if (!m) ERROUT(ENOBUFS); mtod(m, u_char *)[0] = HDLC_UI; mtod(m, u_char *)[1] = NLPID_PPP; NG_FWD_NEW_DATA(error, item, priv->downlink, m); } else if (hook == priv->inet) { - M_PREPEND(m, 2, M_NOWAIT); /* Prepend IP NLPID */ + M_PREPEND(m, 2, M_DONTWAIT); /* Prepend IP NLPID */ if (!m) ERROUT(ENOBUFS); mtod(m, u_char *)[0] = HDLC_UI; diff --git a/sys/netgraph/ng_socket.c b/sys/netgraph/ng_socket.c index f5a7643187b1..f841a0e70f18 100644 --- a/sys/netgraph/ng_socket.c +++ b/sys/netgraph/ng_socket.c @@ -224,7 +224,7 @@ ngc_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *addr, /* Allocate an expendable buffer for the path, chop off * the sockaddr header, and make sure it's NUL terminated */ len = sap->sg_len - 2; - MALLOC(path, char *, len + 1, M_NETGRAPH_PATH, 0); + MALLOC(path, char *, len + 1, M_NETGRAPH_PATH, M_WAITOK); if (path == NULL) { error = ENOMEM; goto release; @@ -239,7 +239,7 @@ ngc_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *addr, /* Move the data into a linear buffer as well. Messages are not * delivered in mbufs. */ - MALLOC(msg, struct ng_mesg *, len + 1, M_NETGRAPH_MSG, 0); + MALLOC(msg, struct ng_mesg *, len + 1, M_NETGRAPH_MSG, M_WAITOK); if (msg == NULL) { error = ENOMEM; goto release; @@ -437,7 +437,7 @@ ng_setsockaddr(struct socket *so, struct sockaddr **addr) if ( NG_NODE_HAS_NAME(pcbp->sockdata->node)) sg_len += namelen = strlen(NG_NODE_NAME(pcbp->sockdata->node)); - MALLOC(sg, struct sockaddr_ng *, sg_len, M_SONAME, M_ZERO); + MALLOC(sg, struct sockaddr_ng *, sg_len, M_SONAME, M_WAITOK | M_ZERO); if (NG_NODE_HAS_NAME(pcbp->sockdata->node)) bcopy(NG_NODE_NAME(pcbp->sockdata->node), sg->sg_data, namelen); @@ -470,7 +470,7 @@ ng_attach_cntl(struct socket *so) /* Allocate node private info */ MALLOC(privdata, struct ngsock *, - sizeof(*privdata), M_NETGRAPH_SOCK, M_ZERO); + sizeof(*privdata), M_NETGRAPH_SOCK, M_WAITOK | M_ZERO); if (privdata == NULL) { ng_detach_common(pcbp, NG_CONTROL); return (ENOMEM); @@ -513,7 +513,7 @@ ng_attach_common(struct socket *so, int type) return (error); /* Allocate the pcb */ - MALLOC(pcbp, struct ngpcb *, sizeof(*pcbp), M_PCB, M_ZERO); + MALLOC(pcbp, struct ngpcb *, sizeof(*pcbp), M_PCB, M_WAITOK | M_ZERO); if (pcbp == NULL) return (ENOMEM); pcbp->type = type; diff --git a/sys/netgraph/ng_source.c b/sys/netgraph/ng_source.c index 8ad0a704d4c2..78525e89672d 100644 --- a/sys/netgraph/ng_source.c +++ b/sys/netgraph/ng_source.c @@ -640,7 +640,7 @@ ng_source_send (sc_p sc, int tosend, int *sent_p) break; /* duplicate the packet */ - m2 = m_copypacket(m, M_NOWAIT); + m2 = m_copypacket(m, M_DONTWAIT); if (m2 == NULL) { s = splnet(); IF_PREPEND(&sc->snd_queue, m); diff --git a/sys/netgraph/ng_tee.c b/sys/netgraph/ng_tee.c index 877ef169e9e1..fbe80ba6e65a 100644 --- a/sys/netgraph/ng_tee.c +++ b/sys/netgraph/ng_tee.c @@ -334,7 +334,7 @@ ngt_rcvdata(hook_p hook, item_p item) meta_p meta2; /* Copy packet (failure will not stop the original)*/ - m2 = m_dup(m, M_NOWAIT); + m2 = m_dup(m, M_DONTWAIT); if (m2) { /* Copy meta info */ diff --git a/sys/netgraph/ng_tty.c b/sys/netgraph/ng_tty.c index a25ee9ed6874..9a0175e053a0 100644 --- a/sys/netgraph/ng_tty.c +++ b/sys/netgraph/ng_tty.c @@ -203,7 +203,7 @@ ngt_open(dev_t dev, struct tty *tp) } /* Initialize private struct */ - MALLOC(sc, sc_p, sizeof(*sc), M_NETGRAPH, M_ZERO); + MALLOC(sc, sc_p, sizeof(*sc), M_NETGRAPH, M_WAITOK | M_ZERO); if (sc == NULL) { error = ENOMEM; goto done; @@ -368,7 +368,7 @@ ngt_input(int c, struct tty *tp) /* Get a new header mbuf if we need one */ if (!(m = sc->m)) { - MGETHDR(m, M_NOWAIT, MT_DATA); + MGETHDR(m, M_DONTWAIT, MT_DATA); if (!m) { if (sc->flags & FLG_DEBUG) log(LOG_ERR, diff --git a/sys/netgraph/ng_vjc.c b/sys/netgraph/ng_vjc.c index 14673ba03748..90d7d4d987c7 100644 --- a/sys/netgraph/ng_vjc.c +++ b/sys/netgraph/ng_vjc.c @@ -476,7 +476,7 @@ ng_vjc_rcvdata(hook_p hook, item_p item) m_adj(m, vjlen); /* Copy the reconstructed TCP/IP headers into a new mbuf */ - MGETHDR(hm, M_NOWAIT, MT_DATA); + MGETHDR(hm, M_DONTWAIT, MT_DATA); if (hm == NULL) { priv->slc.sls_errorin++; NG_FREE_M(m); @@ -486,7 +486,7 @@ ng_vjc_rcvdata(hook_p hook, item_p item) hm->m_len = 0; hm->m_pkthdr.rcvif = NULL; if (hlen > MHLEN) { /* unlikely, but can happen */ - MCLGET(hm, M_NOWAIT); + MCLGET(hm, M_DONTWAIT); if ((hm->m_flags & M_EXT) == 0) { m_freem(hm); priv->slc.sls_errorin++; diff --git a/sys/netinet/if_ether.c b/sys/netinet/if_ether.c index 4a4d91ff5b54..c463bf984a25 100644 --- a/sys/netinet/if_ether.c +++ b/sys/netinet/if_ether.c @@ -309,7 +309,7 @@ arprequest(ifp, sip, tip, enaddr) LLC_UI, 0x00, 0x00, 0x00, 0x08, 0x06 }; u_short ar_hrd; - if ((m = m_gethdr(M_NOWAIT, MT_DATA)) == NULL) + if ((m = m_gethdr(M_DONTWAIT, MT_DATA)) == NULL) return; m->m_pkthdr.rcvif = (struct ifnet *)0; #ifdef MAC diff --git a/sys/netinet/igmp.c b/sys/netinet/igmp.c index bc5fe1169097..929d456ec66c 100644 --- a/sys/netinet/igmp.c +++ b/sys/netinet/igmp.c @@ -108,7 +108,7 @@ igmp_init() /* * Construct a Router Alert option to use in outgoing packets */ - MGET(router_alert, M_NOWAIT, MT_DATA); + MGET(router_alert, M_DONTWAIT, MT_DATA); ra = mtod(router_alert, struct ipoption *); ra->ipopt_dst.s_addr = 0; ra->ipopt_list[0] = IPOPT_RA; /* Router Alert Option */ @@ -445,7 +445,7 @@ igmp_sendpkt(inm, type, addr) struct ip *ip; struct ip_moptions imo; - MGETHDR(m, M_NOWAIT, MT_HEADER); + MGETHDR(m, M_DONTWAIT, MT_HEADER); if (m == NULL) return; diff --git a/sys/netinet/in.c b/sys/netinet/in.c index 56104912ec04..89c412313527 100644 --- a/sys/netinet/in.c +++ b/sys/netinet/in.c @@ -268,7 +268,7 @@ in_control(so, cmd, data, ifp, td) return (EADDRNOTAVAIL); if (ia == (struct in_ifaddr *)0) { ia = (struct in_ifaddr *) - malloc(sizeof *ia, M_IFADDR, M_ZERO); + malloc(sizeof *ia, M_IFADDR, M_WAITOK | M_ZERO); if (ia == (struct in_ifaddr *)NULL) return (ENOBUFS); /* @@ -837,7 +837,7 @@ in_addmulti(ap, ifp) return ifma->ifma_protospec; } - /* XXX - if_addmulti does not use N_NOWAIT. Can this really be called + /* XXX - if_addmulti uses M_WAITOK. Can this really be called at interrupt time? If so, need to fix if_addmulti. XXX */ inm = (struct in_multi *)malloc(sizeof(*inm), M_IPMADDR, M_NOWAIT | M_ZERO); diff --git a/sys/netinet/in_gif.c b/sys/netinet/in_gif.c index 3e996d75b3cd..cdf094aafbdc 100644 --- a/sys/netinet/in_gif.c +++ b/sys/netinet/in_gif.c @@ -167,7 +167,7 @@ in_gif_output(ifp, family, m) ip_ecn_ingress(ECN_NOCARE, &iphdr.ip_tos, &tos); /* prepend new IP header */ - M_PREPEND(m, sizeof(struct ip), M_NOWAIT); + M_PREPEND(m, sizeof(struct ip), M_DONTWAIT); if (m && m->m_len < sizeof(struct ip)) m = m_pullup(m, sizeof(struct ip)); if (m == NULL) { diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index b0a66c617162..7f839175cf5a 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -660,7 +660,7 @@ in_sockaddr(port, addr_p) struct sockaddr_in *sin; MALLOC(sin, struct sockaddr_in *, sizeof *sin, M_SONAME, - M_ZERO); + M_WAITOK | M_ZERO); sin->sin_family = AF_INET; sin->sin_len = sizeof(*sin); sin->sin_addr = *addr_p; diff --git a/sys/netinet/ip_divert.c b/sys/netinet/ip_divert.c index bd8ea4db0e89..162d7f78a9ae 100644 --- a/sys/netinet/ip_divert.c +++ b/sys/netinet/ip_divert.c @@ -489,7 +489,7 @@ div_pcblist(SYSCTL_HANDLER_ARGS) if (error) return error; - inp_list = malloc(n * sizeof *inp_list, M_TEMP, 0); + inp_list = malloc(n * sizeof *inp_list, M_TEMP, M_WAITOK); if (inp_list == 0) return ENOMEM; diff --git a/sys/netinet/ip_encap.c b/sys/netinet/ip_encap.c index a547c6619b6c..478cdfae3ed5 100644 --- a/sys/netinet/ip_encap.c +++ b/sys/netinet/ip_encap.c @@ -487,7 +487,7 @@ encap_fillarg(m, ep) { struct m_tag *tag; - tag = m_tag_get(PACKET_TAG_ENCAP, sizeof (void*), M_NOWAIT); + tag = m_tag_get(PACKET_TAG_ENCAP, sizeof (void*), M_DONTWAIT); if (tag) { *(void**)(tag+1) = ep->arg; m_tag_prepend(m, tag); diff --git a/sys/netinet/ip_fw.c b/sys/netinet/ip_fw.c index b5327665e255..26f4a0463bd5 100644 --- a/sys/netinet/ip_fw.c +++ b/sys/netinet/ip_fw.c @@ -875,7 +875,7 @@ add_dyn_rule(struct ipfw_flow_id *id, u_int8_t dyn_type, struct ip_fw *rule) if (ipfw_dyn_v != NULL) free(ipfw_dyn_v, M_IPFW); ipfw_dyn_v = malloc(curr_dyn_buckets * sizeof r, - M_IPFW, M_NOWAIT | M_ZERO); + M_IPFW, M_DONTWAIT | M_ZERO); if (ipfw_dyn_v == NULL) return NULL; /* failed ! */ } @@ -2036,7 +2036,7 @@ ip_fw_ctl(struct sockopt *sopt) * bother filling up the buffer, just jump to the * sooptcopyout. */ - buf = malloc(size, M_TEMP, 0); + buf = malloc(size, M_TEMP, M_WAITOK); if (buf == 0) { splx(s); error = ENOBUFS; diff --git a/sys/netinet/ip_fw2.c b/sys/netinet/ip_fw2.c index e35078f8608f..eabcd67028ac 100644 --- a/sys/netinet/ip_fw2.c +++ b/sys/netinet/ip_fw2.c @@ -1057,7 +1057,7 @@ send_pkt(struct ipfw_flow_id *id, u_int32_t seq, u_int32_t ack, int flags) struct tcphdr *tcp; struct route sro; /* fake route */ - MGETHDR(m, M_NOWAIT, MT_HEADER); + MGETHDR(m, M_DONTWAIT, MT_HEADER); if (m == 0) return; m->m_pkthdr.rcvif = (struct ifnet *)0; @@ -2498,7 +2498,7 @@ ipfw_ctl(struct sockopt *sopt) * how much room is needed, do not bother filling up the * buffer, just jump to the sooptcopyout. */ - buf = malloc(size, M_TEMP, 0); + buf = malloc(size, M_TEMP, M_WAITOK); if (buf == 0) { splx(s); error = ENOBUFS; diff --git a/sys/netinet/ip_icmp.c b/sys/netinet/ip_icmp.c index a83dcbaa3fce..a15ece2b83ba 100644 --- a/sys/netinet/ip_icmp.c +++ b/sys/netinet/ip_icmp.c @@ -163,7 +163,7 @@ icmp_error(n, type, code, dest, destifp) /* * First, formulate icmp message */ - m = m_gethdr(M_NOWAIT, MT_HEADER); + m = m_gethdr(M_DONTWAIT, MT_HEADER); if (m == NULL) goto freeit; #ifdef MAC @@ -656,7 +656,7 @@ icmp_reflect(m) */ cp = (u_char *) (ip + 1); if ((opts = ip_srcroute()) == 0 && - (opts = m_gethdr(M_NOWAIT, MT_HEADER))) { + (opts = m_gethdr(M_DONTWAIT, MT_HEADER))) { opts->m_len = sizeof(struct in_addr); mtod(opts, struct in_addr *)->s_addr = 0; } diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c index 1965b025deab..3e1f8a508dc1 100644 --- a/sys/netinet/ip_input.c +++ b/sys/netinet/ip_input.c @@ -834,7 +834,7 @@ ip_input(struct mbuf *m) /* Clone packet if we're doing a 'tee' */ if ((divert_info & IP_FW_PORT_TEE_FLAG) != 0) - clone = m_dup(m, M_NOWAIT); + clone = m_dup(m, M_DONTWAIT); /* Restore packet header fields to original values */ ip->ip_len += hlen; @@ -985,7 +985,7 @@ ip_reass(struct mbuf *m, struct ipqhead *head, struct ipq *fp, * If first fragment to arrive, create a reassembly queue. */ if (fp == 0) { - if ((t = m_get(M_NOWAIT, MT_FTABLE)) == NULL) + if ((t = m_get(M_DONTWAIT, MT_FTABLE)) == NULL) goto dropfrag; fp = mtod(t, struct ipq *); #ifdef MAC @@ -1587,7 +1587,7 @@ ip_srcroute() if (ip_nhops == 0) return ((struct mbuf *)0); - m = m_get(M_NOWAIT, MT_HEADER); + m = m_get(M_DONTWAIT, MT_HEADER); if (m == 0) return ((struct mbuf *)0); @@ -1762,8 +1762,8 @@ ip_forward(struct mbuf *m, int srcrt, struct sockaddr_in *next_hop) * assume exclusive access to the IP header in `m', so any * data in a cluster may change before we reach icmp_error(). */ - MGET(mcopy, M_NOWAIT, m->m_type); - if (mcopy != NULL && !m_dup_pkthdr(mcopy, m, M_NOWAIT)) { + MGET(mcopy, M_DONTWAIT, m->m_type); + if (mcopy != NULL && !m_dup_pkthdr(mcopy, m, M_DONTWAIT)) { /* * It's probably ok if the pkthdr dup fails (because * the deep copy of the tag chain failed), but for now diff --git a/sys/netinet/ip_mroute.c b/sys/netinet/ip_mroute.c index d48ae3e3cba1..3caba6b3a115 100644 --- a/sys/netinet/ip_mroute.c +++ b/sys/netinet/ip_mroute.c @@ -1403,7 +1403,7 @@ encap_send(struct ip *ip, struct vif *vifp, struct mbuf *m) * new mbuf so we can modify it. Try to fill the new * mbuf since if we don't the ethernet driver will. */ - MGETHDR(mb_copy, M_NOWAIT, MT_HEADER); + MGETHDR(mb_copy, M_DONTWAIT, MT_HEADER); if (mb_copy == NULL) return; #ifdef MAC diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c index f61f61da6728..64e58e2547eb 100644 --- a/sys/netinet/ip_output.c +++ b/sys/netinet/ip_output.c @@ -802,7 +802,7 @@ ip_output(m0, opt, ro, flags, imo, inp) /* Clone packet if we're doing a 'tee' */ if ((off & IP_FW_PORT_TEE_FLAG) != 0) - clone = m_dup(m, M_NOWAIT); + clone = m_dup(m, M_DONTWAIT); /* * XXX @@ -1108,7 +1108,7 @@ ip_output(m0, opt, ro, flags, imo, inp) m0 = m; mhlen = sizeof (struct ip); for (; off < (u_short)ip->ip_len; off += len) { - MGETHDR(m, M_NOWAIT, MT_HEADER); + MGETHDR(m, M_DONTWAIT, MT_HEADER); if (m == 0) { error = ENOBUFS; ipstat.ips_odropped++; @@ -1274,7 +1274,7 @@ ip_insertoptions(m, opt, phlen) if (p->ipopt_dst.s_addr) ip->ip_dst = p->ipopt_dst; if (m->m_flags & M_EXT || m->m_data - optlen < m->m_pktdat) { - MGETHDR(n, M_NOWAIT, MT_HEADER); + MGETHDR(n, M_DONTWAIT, MT_HEADER); if (n == 0) { *phlen = 0; return (m); @@ -1379,7 +1379,7 @@ ip_ctloutput(so, sopt) error = EMSGSIZE; break; } - MGET(m, sopt->sopt_td ? 0 : M_NOWAIT, MT_HEADER); + MGET(m, sopt->sopt_td ? M_TRYWAIT : M_DONTWAIT, MT_HEADER); if (m == 0) { error = ENOBUFS; break; @@ -1773,7 +1773,7 @@ ip_setmoptions(sopt, imop) * allocate one and initialize to default values. */ imo = (struct ip_moptions*)malloc(sizeof(*imo), M_IPMOPTS, - 0); + M_WAITOK); if (imo == NULL) return (ENOBUFS); diff --git a/sys/netinet/raw_ip.c b/sys/netinet/raw_ip.c index 8a90be059716..e4e4eb24d0ff 100644 --- a/sys/netinet/raw_ip.c +++ b/sys/netinet/raw_ip.c @@ -287,7 +287,7 @@ rip_output(m, so, dst) m_freem(m); return(EMSGSIZE); } - M_PREPEND(m, sizeof(struct ip), 0); + M_PREPEND(m, sizeof(struct ip), M_TRYWAIT); ip = mtod(m, struct ip *); ip->ip_tos = inp->inp_ip_tos; ip->ip_off = 0; @@ -698,7 +698,7 @@ rip_pcblist(SYSCTL_HANDLER_ARGS) if (error) return error; - inp_list = malloc(n * sizeof *inp_list, M_TEMP, 0); + inp_list = malloc(n * sizeof *inp_list, M_TEMP, M_WAITOK); if (inp_list == 0) return ENOMEM; diff --git a/sys/netinet/tcp_output.c b/sys/netinet/tcp_output.c index 2e926d191ae4..34b0d844a94b 100644 --- a/sys/netinet/tcp_output.c +++ b/sys/netinet/tcp_output.c @@ -603,14 +603,14 @@ tcp_output(struct tcpcb *tp) m->m_len += hdrlen; m->m_data -= hdrlen; #else - MGETHDR(m, M_NOWAIT, MT_HEADER); + MGETHDR(m, M_DONTWAIT, MT_HEADER); if (m == NULL) { error = ENOBUFS; goto out; } #ifdef INET6 if (MHLEN < hdrlen + max_linkhdr) { - MCLGET(m, M_NOWAIT); + MCLGET(m, M_DONTWAIT); if ((m->m_flags & M_EXT) == 0) { m_freem(m); error = ENOBUFS; @@ -651,7 +651,7 @@ tcp_output(struct tcpcb *tp) else tcpstat.tcps_sndwinup++; - MGETHDR(m, M_NOWAIT, MT_HEADER); + MGETHDR(m, M_DONTWAIT, MT_HEADER); if (m == NULL) { error = ENOBUFS; goto out; diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index d12c8991e64b..844f279f081b 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -332,7 +332,7 @@ tcp_maketemplate(tp) struct mbuf *m; struct tcptemp *n; - m = m_get(M_NOWAIT, MT_HEADER); + m = m_get(M_DONTWAIT, MT_HEADER); if (m == NULL) return (0); m->m_len = sizeof(struct tcptemp); @@ -412,7 +412,7 @@ tcp_respond(tp, ipgen, th, m, ack, seq, flags) } } if (m == 0) { - m = m_gethdr(M_NOWAIT, MT_HEADER); + m = m_gethdr(M_DONTWAIT, MT_HEADER); if (m == NULL) return; tlen = 0; @@ -901,7 +901,7 @@ tcp_pcblist(SYSCTL_HANDLER_ARGS) if (error) return error; - inp_list = malloc(n * sizeof *inp_list, M_TEMP, 0); + inp_list = malloc(n * sizeof *inp_list, M_TEMP, M_WAITOK); if (inp_list == 0) return ENOMEM; @@ -1495,7 +1495,7 @@ ipsec_hdrsiz_tcp(tp) if ((tp == NULL) || ((inp = tp->t_inpcb) == NULL)) return 0; - MGETHDR(m, M_NOWAIT, MT_DATA); + MGETHDR(m, M_DONTWAIT, MT_DATA); if (!m) return 0; diff --git a/sys/netinet/tcp_syncache.c b/sys/netinet/tcp_syncache.c index daf6d8930b59..a8b031b3df26 100644 --- a/sys/netinet/tcp_syncache.c +++ b/sys/netinet/tcp_syncache.c @@ -247,7 +247,7 @@ syncache_init(void) /* Allocate the hash table. */ MALLOC(tcp_syncache.hashbase, struct syncache_head *, tcp_syncache.hashsize * sizeof(struct syncache_head), - M_SYNCACHE, 0); + M_SYNCACHE, M_WAITOK); /* Initialize the hash buckets. */ for (i = 0; i < tcp_syncache.hashsize; i++) { @@ -1099,7 +1099,7 @@ syncache_respond(sc, m) if (m) m_freem(m); - m = m_gethdr(M_NOWAIT, MT_HEADER); + m = m_gethdr(M_DONTWAIT, MT_HEADER); if (m == NULL) return (ENOBUFS); m->m_data += max_linkhdr; diff --git a/sys/netinet/tcp_timewait.c b/sys/netinet/tcp_timewait.c index d12c8991e64b..844f279f081b 100644 --- a/sys/netinet/tcp_timewait.c +++ b/sys/netinet/tcp_timewait.c @@ -332,7 +332,7 @@ tcp_maketemplate(tp) struct mbuf *m; struct tcptemp *n; - m = m_get(M_NOWAIT, MT_HEADER); + m = m_get(M_DONTWAIT, MT_HEADER); if (m == NULL) return (0); m->m_len = sizeof(struct tcptemp); @@ -412,7 +412,7 @@ tcp_respond(tp, ipgen, th, m, ack, seq, flags) } } if (m == 0) { - m = m_gethdr(M_NOWAIT, MT_HEADER); + m = m_gethdr(M_DONTWAIT, MT_HEADER); if (m == NULL) return; tlen = 0; @@ -901,7 +901,7 @@ tcp_pcblist(SYSCTL_HANDLER_ARGS) if (error) return error; - inp_list = malloc(n * sizeof *inp_list, M_TEMP, 0); + inp_list = malloc(n * sizeof *inp_list, M_TEMP, M_WAITOK); if (inp_list == 0) return ENOMEM; @@ -1495,7 +1495,7 @@ ipsec_hdrsiz_tcp(tp) if ((tp == NULL) || ((inp = tp->t_inpcb) == NULL)) return 0; - MGETHDR(m, M_NOWAIT, MT_DATA); + MGETHDR(m, M_DONTWAIT, MT_DATA); if (!m) return 0; diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c index 7d2a9f37a8af..7c1d8d93baba 100644 --- a/sys/netinet/udp_usrreq.c +++ b/sys/netinet/udp_usrreq.c @@ -585,7 +585,7 @@ udp_pcblist(SYSCTL_HANDLER_ARGS) if (error) return error; - inp_list = malloc(n * sizeof *inp_list, M_TEMP, 0); + inp_list = malloc(n * sizeof *inp_list, M_TEMP, M_WAITOK); if (inp_list == 0) return ENOMEM; @@ -802,7 +802,7 @@ udp_output(inp, m, addr, control, td) * Calculate data length and get a mbuf * for UDP and IP headers. */ - M_PREPEND(m, sizeof(struct udpiphdr), M_NOWAIT); + M_PREPEND(m, sizeof(struct udpiphdr), M_DONTWAIT); if (m == 0) { error = ENOBUFS; goto release; diff --git a/sys/netinet6/ah_core.c b/sys/netinet6/ah_core.c index 4b7da313cb9e..cbb620647ff7 100644 --- a/sys/netinet6/ah_core.c +++ b/sys/netinet6/ah_core.c @@ -1244,9 +1244,9 @@ ah4_calccksum(m, ahdat, len, algo, sav) error = EMSGSIZE; goto fail; } - MGET(n, M_NOWAIT, MT_DATA); + MGET(n, M_DONTWAIT, MT_DATA); if (n && hlen > MLEN) { - MCLGET(n, M_NOWAIT); + MCLGET(n, M_DONTWAIT); if ((n->m_flags & M_EXT) == 0) { m_free(n); n = NULL; @@ -1359,9 +1359,9 @@ ah4_calccksum(m, ahdat, len, algo, sav) error = EMSGSIZE; goto fail; } - MGET(n, M_NOWAIT, MT_DATA); + MGET(n, M_DONTWAIT, MT_DATA); if (n && totlen > MLEN) { - MCLGET(n, M_NOWAIT); + MCLGET(n, M_DONTWAIT); if ((n->m_flags & M_EXT) == 0) { m_free(n); n = NULL; @@ -1510,9 +1510,9 @@ ah6_calccksum(m, ahdat, len, algo, sav) error = EMSGSIZE; goto fail; } - MGET(n, M_NOWAIT, MT_DATA); + MGET(n, M_DONTWAIT, MT_DATA); if (n && newoff - off > MLEN) { - MCLGET(n, M_NOWAIT); + MCLGET(n, M_DONTWAIT); if ((n->m_flags & M_EXT) == 0) { m_free(n); n = NULL; @@ -1545,9 +1545,9 @@ ah6_calccksum(m, ahdat, len, algo, sav) error = EMSGSIZE; goto fail; } - MGET(n, M_NOWAIT, MT_DATA); + MGET(n, M_DONTWAIT, MT_DATA); if (n && newoff - off > MLEN) { - MCLGET(n, M_NOWAIT); + MCLGET(n, M_DONTWAIT); if ((n->m_flags & M_EXT) == 0) { m_free(n); n = NULL; diff --git a/sys/netinet6/ah_input.c b/sys/netinet6/ah_input.c index 94cd6735ecb1..0afdfedc1513 100644 --- a/sys/netinet6/ah_input.c +++ b/sys/netinet6/ah_input.c @@ -494,7 +494,7 @@ ah4_input(m, off) */ struct mbuf *n; - n = m_split(m, off, M_NOWAIT); + n = m_split(m, off, M_DONTWAIT); if (n == NULL) { /* m is retained by m_split */ goto fail; @@ -901,7 +901,7 @@ ah6_input(mp, offp, proto) */ struct mbuf *n; - n = m_split(m, off, M_NOWAIT); + n = m_split(m, off, M_DONTWAIT); if (n == NULL) { /* m is retained by m_split */ goto fail; diff --git a/sys/netinet6/ah_output.c b/sys/netinet6/ah_output.c index 00104ce4ac27..e85075225ce2 100644 --- a/sys/netinet6/ah_output.c +++ b/sys/netinet6/ah_output.c @@ -211,7 +211,7 @@ ah4_output(m, isr) panic("ah4_output: assumption failed (first mbuf length)"); if (M_LEADINGSPACE(m->m_next) < ahlen) { struct mbuf *n; - MGET(n, M_NOWAIT, MT_DATA); + MGET(n, M_DONTWAIT, MT_DATA); if (!n) { ipseclog((LOG_DEBUG, "ENOBUFS in ah4_output %d\n", __LINE__)); @@ -390,13 +390,13 @@ ah6_output(m, nexthdrp, md, isr) return EINVAL; } - MGET(mah, M_NOWAIT, MT_DATA); + MGET(mah, M_DONTWAIT, MT_DATA); if (!mah) { m_freem(m); return ENOBUFS; } if (ahlen > MLEN) { - MCLGET(mah, M_NOWAIT); + MCLGET(mah, M_DONTWAIT); if ((mah->m_flags & M_EXT) == 0) { m_free(mah); m_freem(m); diff --git a/sys/netinet6/esp_core.c b/sys/netinet6/esp_core.c index fe7d27b4319a..db09b9405c40 100644 --- a/sys/netinet6/esp_core.c +++ b/sys/netinet6/esp_core.c @@ -760,10 +760,10 @@ esp_cbc_decrypt(m, off, sav, algo, ivlen) if (!d || dn + blocklen > d->m_len) { if (d) dp = d; - MGET(d, M_NOWAIT, MT_DATA); + MGET(d, M_DONTWAIT, MT_DATA); i = m->m_pkthdr.len - (soff + sn); if (d && i > MLEN) { - MCLGET(d, M_NOWAIT); + MCLGET(d, M_DONTWAIT); if ((d->m_flags & M_EXT) == 0) { m_free(d); d = NULL; @@ -970,10 +970,10 @@ esp_cbc_encrypt(m, off, plen, sav, algo, ivlen) if (!d || dn + blocklen > d->m_len) { if (d) dp = d; - MGET(d, M_NOWAIT, MT_DATA); + MGET(d, M_DONTWAIT, MT_DATA); i = m->m_pkthdr.len - (soff + sn); if (d && i > MLEN) { - MCLGET(d, M_NOWAIT); + MCLGET(d, M_DONTWAIT); if ((d->m_flags & M_EXT) == 0) { m_free(d); d = NULL; diff --git a/sys/netinet6/esp_input.c b/sys/netinet6/esp_input.c index 1584aa484aad..d8de60c0ddf5 100644 --- a/sys/netinet6/esp_input.c +++ b/sys/netinet6/esp_input.c @@ -788,7 +788,7 @@ esp6_input(mp, offp, proto) */ struct mbuf *n; - n = m_split(m, off, M_NOWAIT); + n = m_split(m, off, M_DONTWAIT); if (n == NULL) { /* m is retained by m_split */ goto bad; @@ -810,12 +810,12 @@ esp6_input(mp, offp, proto) struct mbuf *n = NULL; int maxlen; - MGETHDR(n, M_NOWAIT, MT_HEADER); + MGETHDR(n, M_DONTWAIT, MT_HEADER); maxlen = MHLEN; if (n) M_MOVE_PKTHDR(n, m); if (n && n->m_pkthdr.len > maxlen) { - MCLGET(n, M_NOWAIT); + MCLGET(n, M_DONTWAIT); maxlen = MCLBYTES; if ((n->m_flags & M_EXT) == 0) { m_free(n); diff --git a/sys/netinet6/esp_output.c b/sys/netinet6/esp_output.c index 5a4932afd3ad..3e89c5d9a517 100644 --- a/sys/netinet6/esp_output.c +++ b/sys/netinet6/esp_output.c @@ -340,7 +340,7 @@ esp_output(m, nexthdrp, md, isr, af) * after: IP ... ESP IV payload */ if (M_LEADINGSPACE(md) < esphlen || (md->m_flags & M_EXT) != 0) { - MGET(n, M_NOWAIT, MT_DATA); + MGET(n, M_DONTWAIT, MT_DATA); if (!n) { m_freem(m); error = ENOBUFS; @@ -495,7 +495,7 @@ esp_output(m, nexthdrp, md, isr, af) } else { struct mbuf *nn; - MGET(nn, M_NOWAIT, MT_DATA); + MGET(nn, M_DONTWAIT, MT_DATA); if (!nn) { ipseclog((LOG_DEBUG, "esp%d_output: can't alloc mbuf", afnumber)); @@ -624,7 +624,7 @@ esp_output(m, nexthdrp, md, isr, af) } else { struct mbuf *nn; - MGET(nn, M_NOWAIT, MT_DATA); + MGET(nn, M_DONTWAIT, MT_DATA); if (!nn) { ipseclog((LOG_DEBUG, "can't alloc mbuf in esp%d_output", afnumber)); diff --git a/sys/netinet6/frag6.c b/sys/netinet6/frag6.c index c57709a9e285..515a9fb6d6b1 100644 --- a/sys/netinet6/frag6.c +++ b/sys/netinet6/frag6.c @@ -233,7 +233,7 @@ frag6_input(mp, offp, proto) goto dropfrag; frag6_nfragpackets++; q6 = (struct ip6q *)malloc(sizeof(struct ip6q), M_FTABLE, - M_NOWAIT); + M_DONTWAIT); if (q6 == NULL) goto dropfrag; bzero(q6, sizeof(*q6)); @@ -325,7 +325,7 @@ frag6_input(mp, offp, proto) } ip6af = (struct ip6asfrag *)malloc(sizeof(struct ip6asfrag), M_FTABLE, - M_NOWAIT); + M_DONTWAIT); if (ip6af == NULL) goto dropfrag; bzero(ip6af, sizeof(*ip6af)); @@ -489,7 +489,7 @@ frag6_input(mp, offp, proto) m->m_len -= sizeof(struct ip6_frag); } else { /* this comes with no copy if the boundary is on cluster */ - if ((t = m_split(m, offset, M_NOWAIT)) == NULL) { + if ((t = m_split(m, offset, M_DONTWAIT)) == NULL) { frag6_remque(q6); free(q6, M_FTABLE); frag6_nfragpackets--; diff --git a/sys/netinet6/icmp6.c b/sys/netinet6/icmp6.c index 4fa643472132..4cbef25bf73d 100644 --- a/sys/netinet6/icmp6.c +++ b/sys/netinet6/icmp6.c @@ -346,7 +346,7 @@ icmp6_error(m, type, code, param) m_adj(m, ICMPV6_PLD_MAXLEN - m->m_pkthdr.len); preplen = sizeof(struct ip6_hdr) + sizeof(struct icmp6_hdr); - M_PREPEND(m, preplen, M_NOWAIT); + M_PREPEND(m, preplen, M_DONTWAIT); if (m && m->m_len < preplen) m = m_pullup(m, preplen); if (m == NULL) { @@ -562,12 +562,12 @@ icmp6_input(mp, offp, proto) m_freem(n0); break; } - MGETHDR(n, M_NOWAIT, n0->m_type); + MGETHDR(n, M_DONTWAIT, n0->m_type); n0len = n0->m_pkthdr.len; /* save for use below */ if (n) M_MOVE_PKTHDR(n, n0); if (n && maxlen >= MHLEN) { - MCLGET(n, M_NOWAIT); + MCLGET(n, M_DONTWAIT); if ((n->m_flags & M_EXT) == 0) { m_free(n); n = NULL; @@ -624,7 +624,7 @@ icmp6_input(mp, offp, proto) icmp6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_mldquery); else icmp6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_mldreport); - if ((n = m_copym(m, 0, M_COPYALL, M_NOWAIT)) == NULL) { + if ((n = m_copym(m, 0, M_COPYALL, M_DONTWAIT)) == NULL) { /* give up local */ mld6_input(m, off); m = NULL; @@ -685,15 +685,15 @@ icmp6_input(mp, offp, proto) /* Give up remote */ break; } - MGETHDR(n, M_NOWAIT, m->m_type); + MGETHDR(n, M_DONTWAIT, m->m_type); if (n && maxlen > MHLEN) { - MCLGET(n, M_NOWAIT); + MCLGET(n, M_DONTWAIT); if ((n->m_flags & M_EXT) == 0) { m_free(n); n = NULL; } } - if (!m_dup_pkthdr(n, m, M_NOWAIT)) { + if (!m_dup_pkthdr(n, m, M_DONTWAIT)) { /* * Previous code did a blind M_COPY_PKTHDR * and said "just for rcvif". If true, then @@ -749,7 +749,7 @@ icmp6_input(mp, offp, proto) goto badcode; if (icmp6len < sizeof(struct nd_router_solicit)) goto badlen; - if ((n = m_copym(m, 0, M_COPYALL, M_NOWAIT)) == NULL) { + if ((n = m_copym(m, 0, M_COPYALL, M_DONTWAIT)) == NULL) { /* give up local */ nd6_rs_input(m, off, icmp6len); m = NULL; @@ -765,7 +765,7 @@ icmp6_input(mp, offp, proto) goto badcode; if (icmp6len < sizeof(struct nd_router_advert)) goto badlen; - if ((n = m_copym(m, 0, M_COPYALL, M_NOWAIT)) == NULL) { + if ((n = m_copym(m, 0, M_COPYALL, M_DONTWAIT)) == NULL) { /* give up local */ nd6_ra_input(m, off, icmp6len); m = NULL; @@ -781,7 +781,7 @@ icmp6_input(mp, offp, proto) goto badcode; if (icmp6len < sizeof(struct nd_neighbor_solicit)) goto badlen; - if ((n = m_copym(m, 0, M_COPYALL, M_NOWAIT)) == NULL) { + if ((n = m_copym(m, 0, M_COPYALL, M_DONTWAIT)) == NULL) { /* give up local */ nd6_ns_input(m, off, icmp6len); m = NULL; @@ -797,7 +797,7 @@ icmp6_input(mp, offp, proto) goto badcode; if (icmp6len < sizeof(struct nd_neighbor_advert)) goto badlen; - if ((n = m_copym(m, 0, M_COPYALL, M_NOWAIT)) == NULL) { + if ((n = m_copym(m, 0, M_COPYALL, M_DONTWAIT)) == NULL) { /* give up local */ nd6_na_input(m, off, icmp6len); m = NULL; @@ -813,7 +813,7 @@ icmp6_input(mp, offp, proto) goto badcode; if (icmp6len < sizeof(struct nd_redirect)) goto badlen; - if ((n = m_copym(m, 0, M_COPYALL, M_NOWAIT)) == NULL) { + if ((n = m_copym(m, 0, M_COPYALL, M_DONTWAIT)) == NULL) { /* give up local */ icmp6_redirect_input(m, off); m = NULL; @@ -1395,7 +1395,7 @@ ni6_input(m, off) } /* allocate an mbuf to reply. */ - MGETHDR(n, M_NOWAIT, m->m_type); + MGETHDR(n, M_DONTWAIT, m->m_type); if (n == NULL) { m_freem(m); return(NULL); @@ -1409,7 +1409,7 @@ ni6_input(m, off) */ goto bad; } - MCLGET(n, M_NOWAIT); + MCLGET(n, M_DONTWAIT); if ((n->m_flags & M_EXT) == 0) { goto bad; } @@ -1508,9 +1508,9 @@ ni6_nametodns(name, namelen, old) len = MCLBYTES; /* because MAXHOSTNAMELEN is usually 256, we use cluster mbuf */ - MGET(m, M_NOWAIT, MT_DATA); + MGET(m, M_DONTWAIT, MT_DATA); if (m && len > MLEN) { - MCLGET(m, M_NOWAIT); + MCLGET(m, M_DONTWAIT); if ((m->m_flags & M_EXT) == 0) goto fail; } @@ -2478,9 +2478,9 @@ icmp6_redirect_output(m0, rt) #if IPV6_MMTU >= MCLBYTES # error assumption failed about IPV6_MMTU and MCLBYTES #endif - MGETHDR(m, M_NOWAIT, MT_HEADER); + MGETHDR(m, M_DONTWAIT, MT_HEADER); if (m && IPV6_MMTU >= MHLEN) - MCLGET(m, M_NOWAIT); + MCLGET(m, M_DONTWAIT); if (!m) goto fail; m->m_pkthdr.rcvif = NULL; diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c index 8b4384566dfa..945ab65379ab 100644 --- a/sys/netinet6/in6.c +++ b/sys/netinet6/in6.c @@ -1676,7 +1676,7 @@ in6_addmulti(maddr6, ifp, errorp) if (ifma->ifma_protospec != 0) return ifma->ifma_protospec; - /* XXX - if_addmulti does not use M_NOWAIT. Can this really be called + /* XXX - if_addmulti uses M_WAITOK. Can this really be called at interrupt time? If so, need to fix if_addmulti. XXX */ in6m = (struct in6_multi *)malloc(sizeof(*in6m), M_IPMADDR, M_NOWAIT); if (in6m == NULL) { @@ -2447,7 +2447,7 @@ in6_sin_2_v4mapsin6_in_sock(struct sockaddr **nam) struct sockaddr_in6 *sin6_p; MALLOC(sin6_p, struct sockaddr_in6 *, sizeof *sin6_p, M_SONAME, - 0); + M_WAITOK); sin_p = (struct sockaddr_in *)*nam; in6_sin_2_v4mapsin6(sin_p, sin6_p); FREE(*nam, M_SONAME); diff --git a/sys/netinet6/in6_gif.c b/sys/netinet6/in6_gif.c index 7376d851cfd4..b5600750debb 100644 --- a/sys/netinet6/in6_gif.c +++ b/sys/netinet6/in6_gif.c @@ -145,7 +145,7 @@ in6_gif_output(ifp, family, m) } /* prepend new IP header */ - M_PREPEND(m, sizeof(struct ip6_hdr), M_NOWAIT); + M_PREPEND(m, sizeof(struct ip6_hdr), M_DONTWAIT); if (m && m->m_len < sizeof(struct ip6_hdr)) m = m_pullup(m, sizeof(struct ip6_hdr)); if (m == NULL) { diff --git a/sys/netinet6/in6_ifattach.c b/sys/netinet6/in6_ifattach.c index e92fa79a203d..5abcca1b12aa 100644 --- a/sys/netinet6/in6_ifattach.c +++ b/sys/netinet6/in6_ifattach.c @@ -774,7 +774,7 @@ in6_ifattach(ifp, altifp) /* grow in6_ifstat */ n = if_indexlim * sizeof(struct in6_ifstat *); - q = (caddr_t)malloc(n, M_IFADDR, 0); + q = (caddr_t)malloc(n, M_IFADDR, M_WAITOK); bzero(q, n); if (in6_ifstat) { bcopy((caddr_t)in6_ifstat, q, @@ -786,7 +786,7 @@ in6_ifattach(ifp, altifp) /* grow icmp6_ifstat */ n = if_indexlim * sizeof(struct icmp6_ifstat *); - q = (caddr_t)malloc(n, M_IFADDR, 0); + q = (caddr_t)malloc(n, M_IFADDR, M_WAITOK); bzero(q, n); if (icmp6_ifstat) { bcopy((caddr_t)icmp6_ifstat, q, @@ -864,12 +864,12 @@ in6_ifattach(ifp, altifp) if (in6_ifstat[ifp->if_index] == NULL) { in6_ifstat[ifp->if_index] = (struct in6_ifstat *) - malloc(sizeof(struct in6_ifstat), M_IFADDR, 0); + malloc(sizeof(struct in6_ifstat), M_IFADDR, M_WAITOK); bzero(in6_ifstat[ifp->if_index], sizeof(struct in6_ifstat)); } if (icmp6_ifstat[ifp->if_index] == NULL) { icmp6_ifstat[ifp->if_index] = (struct icmp6_ifstat *) - malloc(sizeof(struct icmp6_ifstat), M_IFADDR, 0); + malloc(sizeof(struct icmp6_ifstat), M_IFADDR, M_WAITOK); bzero(icmp6_ifstat[ifp->if_index], sizeof(struct icmp6_ifstat)); } diff --git a/sys/netinet6/in6_pcb.c b/sys/netinet6/in6_pcb.c index 4a5de69edcfd..963cd9a9a1bb 100644 --- a/sys/netinet6/in6_pcb.c +++ b/sys/netinet6/in6_pcb.c @@ -640,7 +640,7 @@ in6_sockaddr(port, addr_p) { struct sockaddr_in6 *sin6; - MALLOC(sin6, struct sockaddr_in6 *, sizeof *sin6, M_SONAME, 0); + MALLOC(sin6, struct sockaddr_in6 *, sizeof *sin6, M_SONAME, M_WAITOK); bzero(sin6, sizeof *sin6); sin6->sin6_family = AF_INET6; sin6->sin6_len = sizeof(*sin6); @@ -671,7 +671,7 @@ in6_v4mapsin6_sockaddr(port, addr_p) sin.sin_addr = *addr_p; MALLOC(sin6_p, struct sockaddr_in6 *, sizeof *sin6_p, M_SONAME, - 0); + M_WAITOK); in6_sin_2_v4mapsin6(&sin, sin6_p); return (struct sockaddr *)sin6_p; diff --git a/sys/netinet6/ip6_fw.c b/sys/netinet6/ip6_fw.c index b1eb2ff3267b..0ef2c52f2b47 100644 --- a/sys/netinet6/ip6_fw.c +++ b/sys/netinet6/ip6_fw.c @@ -1109,11 +1109,11 @@ ip6_fw_ctl(int stage, struct mbuf **mm) if (stage == IPV6_FW_GET) { struct ip6_fw_chain *fcp = ip6_fw_chain.lh_first; - *mm = m = m_get(0, MT_DATA); /* XXX */ + *mm = m = m_get(M_TRYWAIT, MT_DATA); /* XXX */ if (!m) return(ENOBUFS); if (sizeof *(fcp->rule) > MLEN) { - MCLGET(m, 0); + MCLGET(m, M_TRYWAIT); if ((m->m_flags & M_EXT) == 0) { m_free(m); return(ENOBUFS); @@ -1122,14 +1122,14 @@ ip6_fw_ctl(int stage, struct mbuf **mm) for (; fcp; fcp = fcp->chain.le_next) { bcopy(fcp->rule, m->m_data, sizeof *(fcp->rule)); m->m_len = sizeof *(fcp->rule); - m->m_next = m_get(0, MT_DATA); /* XXX */ + m->m_next = m_get(M_TRYWAIT, MT_DATA); /* XXX */ if (!m->m_next) { m_freem(*mm); return(ENOBUFS); } m = m->m_next; if (sizeof *(fcp->rule) > MLEN) { - MCLGET(m, 0); + MCLGET(m, M_TRYWAIT); if ((m->m_flags & M_EXT) == 0) { m_freem(*mm); return(ENOBUFS); diff --git a/sys/netinet6/ip6_input.c b/sys/netinet6/ip6_input.c index 01b923613198..1f37baec3873 100644 --- a/sys/netinet6/ip6_input.c +++ b/sys/netinet6/ip6_input.c @@ -317,11 +317,11 @@ ip6_input(m) if (m && m->m_next != NULL && m->m_pkthdr.len < MCLBYTES) { struct mbuf *n; - MGETHDR(n, M_NOWAIT, MT_HEADER); + MGETHDR(n, M_DONTWAIT, MT_HEADER); if (n) M_MOVE_PKTHDR(n, m); if (n && n->m_pkthdr.len > MHLEN) { - MCLGET(n, M_NOWAIT); + MCLGET(n, M_DONTWAIT); if ((n->m_flags & M_EXT) == 0) { m_freem(n); n = NULL; @@ -1433,9 +1433,9 @@ ip6_pullexthdr(m, off, nxt) else elen = (ip6e.ip6e_len + 1) << 3; - MGET(n, M_NOWAIT, MT_DATA); + MGET(n, M_DONTWAIT, MT_DATA); if (n && elen >= MLEN) { - MCLGET(n, M_NOWAIT); + MCLGET(n, M_DONTWAIT); if ((n->m_flags & M_EXT) == 0) { m_free(n); n = NULL; @@ -1623,7 +1623,7 @@ ip6_addaux(m) if (!tag) { tag = m_tag_get(PACKET_TAG_IPV6_INPUT, sizeof (struct ip6aux), - M_NOWAIT); + M_DONTWAIT); if (tag) m_tag_prepend(m, tag); } diff --git a/sys/netinet6/ip6_mroute.c b/sys/netinet6/ip6_mroute.c index 20840651d7cd..f1257d35c550 100644 --- a/sys/netinet6/ip6_mroute.c +++ b/sys/netinet6/ip6_mroute.c @@ -1531,7 +1531,7 @@ register_send(ip6, mif, m) ++pim6stat.pim6s_snd_registers; /* Make a copy of the packet to send to the user level process */ - MGETHDR(mm, M_NOWAIT, MT_HEADER); + MGETHDR(mm, M_DONTWAIT, MT_HEADER); if (mm == NULL) return ENOBUFS; mm->m_pkthdr.rcvif = NULL; diff --git a/sys/netinet6/ip6_output.c b/sys/netinet6/ip6_output.c index b4f56a62463a..64b11aa36a26 100644 --- a/sys/netinet6/ip6_output.c +++ b/sys/netinet6/ip6_output.c @@ -1040,7 +1040,7 @@ skip_ipsec2:; */ m0 = m; for (off = hlen; off < tlen; off += len) { - MGETHDR(m, M_NOWAIT, MT_HEADER); + MGETHDR(m, M_DONTWAIT, MT_HEADER); if (!m) { error = ENOBUFS; ip6stat.ip6s_odropped++; @@ -1153,12 +1153,12 @@ ip6_copyexthdr(mp, hdr, hlen) if (hlen > MCLBYTES) return(ENOBUFS); /* XXX */ - MGET(m, M_NOWAIT, MT_DATA); + MGET(m, M_DONTWAIT, MT_DATA); if (!m) return(ENOBUFS); if (hlen > MLEN) { - MCLGET(m, M_NOWAIT); + MCLGET(m, M_DONTWAIT); if ((m->m_flags & M_EXT) == 0) { m_free(m); return(ENOBUFS); @@ -1193,7 +1193,7 @@ ip6_insert_jumboopt(exthdrs, plen) * Otherwise, use it to store the options. */ if (exthdrs->ip6e_hbh == 0) { - MGET(mopt, M_NOWAIT, MT_DATA); + MGET(mopt, M_DONTWAIT, MT_DATA); if (mopt == 0) return(ENOBUFS); mopt->m_len = JUMBOOPTLEN; @@ -1225,9 +1225,9 @@ ip6_insert_jumboopt(exthdrs, plen) * As a consequence, we must always prepare a cluster * at this point. */ - MGET(n, M_NOWAIT, MT_DATA); + MGET(n, M_DONTWAIT, MT_DATA); if (n) { - MCLGET(n, M_NOWAIT); + MCLGET(n, M_DONTWAIT); if ((n->m_flags & M_EXT) == 0) { m_freem(n); n = NULL; @@ -1282,7 +1282,7 @@ ip6_insertfraghdr(m0, m, hlen, frghdrp) if (hlen > sizeof(struct ip6_hdr)) { n = m_copym(m0, sizeof(struct ip6_hdr), - hlen - sizeof(struct ip6_hdr), M_NOWAIT); + hlen - sizeof(struct ip6_hdr), M_DONTWAIT); if (n == 0) return(ENOBUFS); m->m_next = n; @@ -1304,7 +1304,7 @@ ip6_insertfraghdr(m0, m, hlen, frghdrp) /* allocate a new mbuf for the fragment header */ struct mbuf *mfrg; - MGET(mfrg, M_NOWAIT, MT_DATA); + MGET(mfrg, M_DONTWAIT, MT_DATA); if (mfrg == 0) return(ENOBUFS); mfrg->m_len = sizeof(struct ip6_frag); @@ -1496,7 +1496,7 @@ do { \ break; } /* XXX */ - MGET(m, sopt->sopt_td ? 0 : M_NOWAIT, MT_HEADER); + MGET(m, sopt->sopt_td ? M_TRYWAIT : M_DONTWAIT, MT_HEADER); if (m == 0) { error = ENOBUFS; break; @@ -1595,7 +1595,7 @@ do { \ if (in6p->in6p_options) { struct mbuf *m; m = m_copym(in6p->in6p_options, - 0, M_COPYALL, 0); + 0, M_COPYALL, M_TRYWAIT); error = soopt_mcopyout(sopt, m); if (error == 0) m_freem(m); @@ -1776,7 +1776,7 @@ ip6_pcbopts(pktopt, m, so, sopt) #endif ip6_clearpktopts(opt, 1, -1); } else - opt = malloc(sizeof(*opt), M_IP6OPT, 0); + opt = malloc(sizeof(*opt), M_IP6OPT, M_WAITOK); *pktopt = NULL; if (!m || m->m_len == 0) { @@ -1959,7 +1959,7 @@ ip6_setmoptions(optname, im6op, m) * allocate one and initialize to default values. */ im6o = (struct ip6_moptions *) - malloc(sizeof(*im6o), M_IPMOPTS, 0); + malloc(sizeof(*im6o), M_IPMOPTS, M_WAITOK); if (im6o == NULL) return(ENOBUFS); @@ -2129,7 +2129,7 @@ ip6_setmoptions(optname, im6op, m) * Everything looks good; add a new record to the multicast * address list for the given interface. */ - imm = malloc(sizeof(*imm), M_IPMADDR, 0); + imm = malloc(sizeof(*imm), M_IPMADDR, M_WAITOK); if (imm == NULL) { error = ENOBUFS; break; @@ -2234,7 +2234,7 @@ ip6_getmoptions(optname, im6o, mp) { u_int *hlim, *loop, *ifindex; - *mp = m_get(0, MT_HEADER); /* XXX */ + *mp = m_get(M_TRYWAIT, MT_HEADER); /* XXX */ switch (optname) { @@ -2333,7 +2333,7 @@ ip6_setpktoptions(control, opt, priv, needcopy) /* XXX: Is it really WAITOK? */ opt->ip6po_pktinfo = malloc(sizeof(struct in6_pktinfo), - M_IP6OPT, 0); + M_IP6OPT, M_WAITOK); bcopy(CMSG_DATA(cm), opt->ip6po_pktinfo, sizeof(struct in6_pktinfo)); } else @@ -2392,7 +2392,7 @@ ip6_setpktoptions(control, opt, priv, needcopy) if (needcopy) { opt->ip6po_nexthop = malloc(*CMSG_DATA(cm), - M_IP6OPT, 0); + M_IP6OPT, M_WAITOK); bcopy(CMSG_DATA(cm), opt->ip6po_nexthop, *CMSG_DATA(cm)); @@ -2415,7 +2415,7 @@ ip6_setpktoptions(control, opt, priv, needcopy) if (needcopy) { opt->ip6po_hbh = - malloc(hbhlen, M_IP6OPT, 0); + malloc(hbhlen, M_IP6OPT, M_WAITOK); bcopy(hbh, opt->ip6po_hbh, hbhlen); } else opt->ip6po_hbh = hbh; @@ -2453,7 +2453,7 @@ ip6_setpktoptions(control, opt, priv, needcopy) newdest = &opt->ip6po_dest2; if (needcopy) { - *newdest = malloc(destlen, M_IP6OPT, 0); + *newdest = malloc(destlen, M_IP6OPT, M_WAITOK); bcopy(dest, *newdest, destlen); } else *newdest = dest; @@ -2490,7 +2490,7 @@ ip6_setpktoptions(control, opt, priv, needcopy) if (needcopy) { opt->ip6po_rthdr = malloc(rthlen, M_IP6OPT, - 0); + M_WAITOK); bcopy(rth, opt->ip6po_rthdr, rthlen); } else opt->ip6po_rthdr = rth; @@ -2570,7 +2570,7 @@ ip6_splithdr(m, exthdrs) ip6 = mtod(m, struct ip6_hdr *); if (m->m_len > sizeof(*ip6)) { - MGETHDR(mh, M_NOWAIT, MT_HEADER); + MGETHDR(mh, M_DONTWAIT, MT_HEADER); if (mh == 0) { m_freem(m); return ENOBUFS; diff --git a/sys/netinet6/ipcomp_core.c b/sys/netinet6/ipcomp_core.c index e47779af9725..a6cdea5218ef 100644 --- a/sys/netinet6/ipcomp_core.c +++ b/sys/netinet6/ipcomp_core.c @@ -146,9 +146,9 @@ do { \ } \ \ /* get a fresh reply buffer */ \ - MGET(n, M_NOWAIT, MT_DATA); \ + MGET(n, M_DONTWAIT, MT_DATA); \ if (n) { \ - MCLGET(n, M_NOWAIT); \ + MCLGET(n, M_DONTWAIT); \ } \ if (!n) { \ error = ENOBUFS; \ diff --git a/sys/netinet6/ipcomp_output.c b/sys/netinet6/ipcomp_output.c index 17da4545101a..71e5755c986d 100644 --- a/sys/netinet6/ipcomp_output.c +++ b/sys/netinet6/ipcomp_output.c @@ -171,12 +171,12 @@ ipcomp_output(m, nexthdrp, md, isr, af) * compromise two m_copym(). we will be going through every byte of * the payload during compression process anyways. */ - mcopy = m_copym(m, 0, M_COPYALL, M_NOWAIT); + mcopy = m_copym(m, 0, M_COPYALL, M_DONTWAIT); if (mcopy == NULL) { error = ENOBUFS; return 0; } - md0 = m_copym(md, 0, M_COPYALL, M_NOWAIT); + md0 = m_copym(md, 0, M_COPYALL, M_DONTWAIT); if (md0 == NULL) { m_freem(mcopy); error = ENOBUFS; @@ -279,7 +279,7 @@ ipcomp_output(m, nexthdrp, md, isr, af) * after: IP ... ipcomp payload */ if (M_LEADINGSPACE(md) < complen) { - MGET(n, M_NOWAIT, MT_DATA); + MGET(n, M_DONTWAIT, MT_DATA); if (!n) { m_freem(m); error = ENOBUFS; diff --git a/sys/netinet6/ipsec.c b/sys/netinet6/ipsec.c index 4f795fe5f888..f898c0a1cf3c 100644 --- a/sys/netinet6/ipsec.c +++ b/sys/netinet6/ipsec.c @@ -2006,7 +2006,7 @@ ipsec4_encapsulate(m, sav) */ if (M_LEADINGSPACE(m->m_next) < hlen) { struct mbuf *n; - MGET(n, M_NOWAIT, MT_DATA); + MGET(n, M_DONTWAIT, MT_DATA); if (!n) { m_freem(m); return ENOBUFS; @@ -2105,7 +2105,7 @@ ipsec6_encapsulate(m, sav) panic("ipsec6_encapsulate: assumption failed (first mbuf length)"); if (M_LEADINGSPACE(m->m_next) < sizeof(struct ip6_hdr)) { struct mbuf *n; - MGET(n, M_NOWAIT, MT_DATA); + MGET(n, M_DONTWAIT, MT_DATA); if (!n) { m_freem(m); return ENOBUFS; @@ -3119,7 +3119,7 @@ ipsec4_splithdr(m) hlen = ip->ip_hl << 2; #endif if (m->m_len > hlen) { - MGETHDR(mh, M_NOWAIT, MT_HEADER); + MGETHDR(mh, M_DONTWAIT, MT_HEADER); if (!mh) { m_freem(m); return NULL; @@ -3155,7 +3155,7 @@ ipsec6_splithdr(m) ip6 = mtod(m, struct ip6_hdr *); hlen = sizeof(struct ip6_hdr); if (m->m_len > hlen) { - MGETHDR(mh, M_NOWAIT, MT_HEADER); + MGETHDR(mh, M_DONTWAIT, MT_HEADER); if (!mh) { m_freem(m); return NULL; @@ -3366,16 +3366,16 @@ ipsec_copypkt(m) struct mbuf *mm; if (n->m_flags & M_PKTHDR) { - MGETHDR(mnew, M_NOWAIT, MT_HEADER); + MGETHDR(mnew, M_DONTWAIT, MT_HEADER); if (mnew == NULL) goto fail; - if (!m_dup_pkthdr(mnew, n, M_NOWAIT)) { + if (!m_dup_pkthdr(mnew, n, M_DONTWAIT)) { m_free(mnew); goto fail; } } else { - MGET(mnew, M_NOWAIT, MT_DATA); + MGET(mnew, M_DONTWAIT, MT_DATA); if (mnew == NULL) goto fail; } @@ -3399,7 +3399,7 @@ ipsec_copypkt(m) if (remain <= (mm->m_flags & M_PKTHDR ? MHLEN : MLEN)) len = remain; else { /* allocate a cluster */ - MCLGET(mm, M_NOWAIT); + MCLGET(mm, M_DONTWAIT); if (!(mm->m_flags & M_EXT)) { m_free(mm); goto fail; @@ -3419,7 +3419,7 @@ ipsec_copypkt(m) break; /* need another mbuf */ - MGETHDR(mn, M_NOWAIT, MT_HEADER); + MGETHDR(mn, M_DONTWAIT, MT_HEADER); if (mn == NULL) goto fail; mn->m_pkthdr.rcvif = NULL; diff --git a/sys/netinet6/mld6.c b/sys/netinet6/mld6.c index fce6e1bc7b80..61c0e0c0a730 100644 --- a/sys/netinet6/mld6.c +++ b/sys/netinet6/mld6.c @@ -400,10 +400,10 @@ mld6_sendpkt(in6m, type, dst) * We allocate 2 mbufs and make chain in advance because * it is more convenient when inserting the hop-by-hop option later. */ - MGETHDR(mh, M_NOWAIT, MT_HEADER); + MGETHDR(mh, M_DONTWAIT, MT_HEADER); if (mh == NULL) return; - MGET(md, M_NOWAIT, MT_DATA); + MGET(md, M_DONTWAIT, MT_DATA); if (md == NULL) { m_free(mh); return; diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c index 3e1fccf82590..b14fc2446acb 100644 --- a/sys/netinet6/nd6.c +++ b/sys/netinet6/nd6.c @@ -164,7 +164,7 @@ nd6_ifattach(ifp) /* grow nd_ifinfo */ n = nd_ifinfo_indexlim * sizeof(struct nd_ifinfo); - q = (caddr_t)malloc(n, M_IP6NDP, 0); + q = (caddr_t)malloc(n, M_IP6NDP, M_WAITOK); bzero(q, n); if (nd_ifinfo) { bcopy((caddr_t)nd_ifinfo, q, n/2); diff --git a/sys/netinet6/nd6_nbr.c b/sys/netinet6/nd6_nbr.c index 4bf18200515e..16bfbb41aea8 100644 --- a/sys/netinet6/nd6_nbr.c +++ b/sys/netinet6/nd6_nbr.c @@ -362,9 +362,9 @@ nd6_ns_output(ifp, daddr6, taddr6, ln, dad) return; } - MGETHDR(m, M_NOWAIT, MT_DATA); + MGETHDR(m, M_DONTWAIT, MT_DATA); if (m && max_linkhdr + maxlen >= MHLEN) { - MCLGET(m, M_NOWAIT); + MCLGET(m, M_DONTWAIT); if ((m->m_flags & M_EXT) == 0) { m_free(m); m = NULL; @@ -847,9 +847,9 @@ nd6_na_output(ifp, daddr6, taddr6, flags, tlladdr, sdl0) return; } - MGETHDR(m, M_NOWAIT, MT_DATA); + MGETHDR(m, M_DONTWAIT, MT_DATA); if (m && max_linkhdr + maxlen >= MHLEN) { - MCLGET(m, M_NOWAIT); + MCLGET(m, M_DONTWAIT); if ((m->m_flags & M_EXT) == 0) { m_free(m); m = NULL; diff --git a/sys/netinet6/raw_ip6.c b/sys/netinet6/raw_ip6.c index abb7358a5c9d..540533ba019a 100644 --- a/sys/netinet6/raw_ip6.c +++ b/sys/netinet6/raw_ip6.c @@ -372,7 +372,7 @@ rip6_output(m, va_alist) code = icmp6->icmp6_code; } - M_PREPEND(m, sizeof(*ip6), 0); + M_PREPEND(m, sizeof(*ip6), M_TRYWAIT); ip6 = mtod(m, struct ip6_hdr *); /* diff --git a/sys/netinet6/scope6.c b/sys/netinet6/scope6.c index 10637e35444d..0c32da8c4761 100644 --- a/sys/netinet6/scope6.c +++ b/sys/netinet6/scope6.c @@ -75,7 +75,7 @@ scope6_ifattach(ifp) /* grow scope index array */ n = if_indexlim * sizeof(struct scope6_id); /* XXX: need new malloc type? */ - q = (caddr_t)malloc(n, M_IFADDR, 0); + q = (caddr_t)malloc(n, M_IFADDR, M_WAITOK); bzero(q, n); if (scope6_ids) { bcopy((caddr_t)scope6_ids, q, n/2); diff --git a/sys/netinet6/udp6_output.c b/sys/netinet6/udp6_output.c index 659eb0da5ef3..1de45f0b6ddc 100644 --- a/sys/netinet6/udp6_output.c +++ b/sys/netinet6/udp6_output.c @@ -248,7 +248,7 @@ udp6_output(in6p, m, addr6, control, td) * Calculate data length and get a mbuf * for UDP and IP6 headers. */ - M_PREPEND(m, hlen + sizeof(struct udphdr), M_NOWAIT); + M_PREPEND(m, hlen + sizeof(struct udphdr), M_DONTWAIT); if (m == 0) { error = ENOBUFS; goto release; diff --git a/sys/netipsec/ipsec_mbuf.c b/sys/netipsec/ipsec_mbuf.c index 089a4b4e5ca4..7fa291b5a9c7 100644 --- a/sys/netipsec/ipsec_mbuf.c +++ b/sys/netipsec/ipsec_mbuf.c @@ -105,20 +105,20 @@ m_clone(struct mbuf *m0) * because M_MOVE_PKTHDR will smash the data * pointer and drop the M_EXT marker. */ - MGETHDR(n, M_NOWAIT, m->m_type); + MGETHDR(n, M_DONTWAIT, m->m_type); if (n == NULL) { m_freem(m0); return (NULL); } M_MOVE_PKTHDR(n, m); - MCLGET(n, M_NOWAIT); + MCLGET(n, M_DONTWAIT); if ((n->m_flags & M_EXT) == 0) { m_free(n); m_freem(m0); return (NULL); } } else { - n = m_getcl(M_NOWAIT, m->m_type, m->m_flags); + n = m_getcl(M_DONTWAIT, m->m_type, m->m_flags); if (n == NULL) { m_freem(m0); return (NULL); @@ -150,7 +150,7 @@ m_clone(struct mbuf *m0) break; off += cc; - n = m_getcl(M_NOWAIT, m->m_type, m->m_flags); + n = m_getcl(M_DONTWAIT, m->m_type, m->m_flags); if (n == NULL) { m_freem(mfirst); m_freem(m0); @@ -210,7 +210,7 @@ m_makespace(struct mbuf *m0, int skip, int hlen, int *off) * * NB: this ignores mbuf types. */ - MGET(n, M_NOWAIT, MT_DATA); + MGET(n, M_DONTWAIT, MT_DATA); if (n == NULL) return (NULL); n->m_next = m->m_next; /* splice new mbuf */ @@ -238,7 +238,7 @@ m_makespace(struct mbuf *m0, int skip, int hlen, int *off) if (remain + hlen > M_TRAILINGSPACE(n)) { struct mbuf *n2; - MGET(n2, M_NOWAIT, MT_DATA); + MGET(n2, M_DONTWAIT, MT_DATA); /* NB: new mbuf is on chain, let caller free */ if (n2 == NULL) return (NULL); @@ -328,7 +328,7 @@ KASSERT(m0->m_next != NULL, ("m_pad: m0 null, len %u m_len %u", len, m0->m_len)) if (pad > M_TRAILINGSPACE(m0)) { /* Add an mbuf to the chain. */ - MGET(m1, M_NOWAIT, MT_DATA); + MGET(m1, M_DONTWAIT, MT_DATA); if (m1 == 0) { m_freem(m0); DPRINTF(("m_pad: unable to get extra mbuf\n")); diff --git a/sys/netipsec/ipsec_output.c b/sys/netipsec/ipsec_output.c index aa53f9ca3eaa..3748747abe9e 100644 --- a/sys/netipsec/ipsec_output.c +++ b/sys/netipsec/ipsec_output.c @@ -469,7 +469,7 @@ ipsec6_splithdr(struct mbuf *m) ip6 = mtod(m, struct ip6_hdr *); hlen = sizeof(struct ip6_hdr); if (m->m_len > hlen) { - MGETHDR(mh, M_NOWAIT, MT_HEADER); + MGETHDR(mh, M_DONTWAIT, MT_HEADER); if (!mh) { m_freem(m); return NULL; @@ -580,7 +580,7 @@ ipsec6_encapsulate(struct mbuf *m, struct secasvar *sav) plen = m->m_pkthdr.len; if (M_LEADINGSPACE(m->m_next) < sizeof(struct ip6_hdr)) { struct mbuf *n; - MGET(n, M_NOWAIT, MT_DATA); + MGET(n, M_DONTWAIT, MT_DATA); if (!n) { m_freem(m); return ENOBUFS; diff --git a/sys/netipsec/key.c b/sys/netipsec/key.c index af525c305b65..de0362ef3ba1 100644 --- a/sys/netipsec/key.c +++ b/sys/netipsec/key.c @@ -1627,7 +1627,7 @@ key_gather_mbuf(m, mhp, ndeep, nitem, va_alist) if (len > MHLEN) panic("assumption failed"); #endif - MGETHDR(n, M_NOWAIT, MT_DATA); + MGETHDR(n, M_DONTWAIT, MT_DATA); if (!n) goto fail; n->m_len = len; @@ -1646,7 +1646,7 @@ key_gather_mbuf(m, mhp, ndeep, nitem, va_alist) mtod(n, caddr_t)); } else { n = m_copym(m, mhp->extoff[idx], mhp->extlen[idx], - M_NOWAIT); + M_DONTWAIT); } if (n == NULL) goto fail; @@ -2079,9 +2079,9 @@ key_spddelete2(so, m, mhp) if (len > MCLBYTES) return key_senderror(so, m, ENOBUFS); - MGETHDR(n, M_NOWAIT, MT_DATA); + MGETHDR(n, M_DONTWAIT, MT_DATA); if (n && len > MHLEN) { - MCLGET(n, M_NOWAIT); + MCLGET(n, M_DONTWAIT); if ((n->m_flags & M_EXT) == 0) { m_freem(n); n = NULL; @@ -2103,7 +2103,7 @@ key_spddelete2(so, m, mhp) #endif n->m_next = m_copym(m, mhp->extoff[SADB_X_EXT_POLICY], - mhp->extlen[SADB_X_EXT_POLICY], M_NOWAIT); + mhp->extlen[SADB_X_EXT_POLICY], M_DONTWAIT); if (!n->m_next) { m_freem(n); return key_senderror(so, m, ENOBUFS); @@ -3329,7 +3329,7 @@ key_setdumpsa(sav, type, satype, seq, pid) if ((!m && !p) || (m && p)) goto fail; if (p && tres) { - M_PREPEND(tres, l, M_NOWAIT); + M_PREPEND(tres, l, M_DONTWAIT); if (!tres) goto fail; bcopy(p, mtod(tres, caddr_t), l); @@ -3388,9 +3388,9 @@ key_setsadbmsg(type, tlen, satype, seq, pid, reserved) len = PFKEY_ALIGN8(sizeof(struct sadb_msg)); if (len > MCLBYTES) return NULL; - MGETHDR(m, M_NOWAIT, MT_DATA); + MGETHDR(m, M_DONTWAIT, MT_DATA); if (m && len > MHLEN) { - MCLGET(m, M_NOWAIT); + MCLGET(m, M_DONTWAIT); if ((m->m_flags & M_EXT) == 0) { m_freem(m); m = NULL; @@ -4501,9 +4501,9 @@ key_getspi(so, m, mhp) if (len > MCLBYTES) return key_senderror(so, m, ENOBUFS); - MGETHDR(n, M_NOWAIT, MT_DATA); + MGETHDR(n, M_DONTWAIT, MT_DATA); if (len > MHLEN) { - MCLGET(n, M_NOWAIT); + MCLGET(n, M_DONTWAIT); if ((n->m_flags & M_EXT) == 0) { m_freem(n); n = NULL; @@ -5390,7 +5390,7 @@ key_getcomb_esp() KASSERT(l <= MLEN, ("key_getcomb_esp: l=%u > MLEN=%lu", l, (u_long) MLEN)); - MGET(m, M_NOWAIT, MT_DATA); + MGET(m, M_DONTWAIT, MT_DATA); if (m) { M_ALIGN(m, l); m->m_len = l; @@ -5492,14 +5492,14 @@ key_getcomb_ah() KASSERT(l <= MLEN, ("key_getcomb_ah: l=%u > MLEN=%lu", l, (u_long) MLEN)); - MGET(m, M_NOWAIT, MT_DATA); + MGET(m, M_DONTWAIT, MT_DATA); if (m) { M_ALIGN(m, l); m->m_len = l; m->m_next = NULL; } } else - M_PREPEND(m, l, M_NOWAIT); + M_PREPEND(m, l, M_DONTWAIT); if (!m) return NULL; @@ -5537,14 +5537,14 @@ key_getcomb_ipcomp() KASSERT(l <= MLEN, ("key_getcomb_ipcomp: l=%u > MLEN=%lu", l, (u_long) MLEN)); - MGET(m, M_NOWAIT, MT_DATA); + MGET(m, M_DONTWAIT, MT_DATA); if (m) { M_ALIGN(m, l); m->m_len = l; m->m_next = NULL; } } else - M_PREPEND(m, l, M_NOWAIT); + M_PREPEND(m, l, M_DONTWAIT); if (!m) return NULL; @@ -5588,7 +5588,7 @@ key_getprop(saidx) if (!m) return NULL; - M_PREPEND(m, l, M_NOWAIT); + M_PREPEND(m, l, M_DONTWAIT); if (!m) return NULL; @@ -6093,9 +6093,9 @@ key_register(so, m, mhp) if (len > MCLBYTES) return key_senderror(so, m, ENOBUFS); - MGETHDR(n, M_NOWAIT, MT_DATA); + MGETHDR(n, M_DONTWAIT, MT_DATA); if (len > MHLEN) { - MCLGET(n, M_NOWAIT); + MCLGET(n, M_DONTWAIT); if ((n->m_flags & M_EXT) == 0) { m_freem(n); n = NULL; @@ -6659,9 +6659,9 @@ key_parse(m, so) if (m->m_next) { struct mbuf *n; - MGETHDR(n, M_NOWAIT, MT_DATA); + MGETHDR(n, M_DONTWAIT, MT_DATA); if (n && m->m_pkthdr.len > MHLEN) { - MCLGET(n, M_NOWAIT); + MCLGET(n, M_DONTWAIT); if ((n->m_flags & M_EXT) == 0) { m_free(n); n = NULL; @@ -7259,9 +7259,9 @@ key_alloc_mbuf(l) len = l; while (len > 0) { - MGET(n, M_NOWAIT, MT_DATA); + MGET(n, M_DONTWAIT, MT_DATA); if (n && len > MLEN) - MCLGET(n, M_NOWAIT); + MCLGET(n, M_DONTWAIT); if (!n) { m_freem(m); return NULL; diff --git a/sys/netipsec/keysock.c b/sys/netipsec/keysock.c index 7ae835a21d8b..d61c15b4ba1a 100644 --- a/sys/netipsec/keysock.c +++ b/sys/netipsec/keysock.c @@ -152,7 +152,7 @@ key_sendup0(rp, m, promisc) if (promisc) { struct sadb_msg *pmsg; - M_PREPEND(m, sizeof(struct sadb_msg), M_NOWAIT); + M_PREPEND(m, sizeof(struct sadb_msg), M_DONTWAIT); if (m && m->m_len < sizeof(struct sadb_msg)) m = m_pullup(m, sizeof(struct sadb_msg)); if (!m) { @@ -223,10 +223,10 @@ key_sendup(so, msg, len, target) m = mprev = NULL; while (tlen > 0) { if (tlen == len) { - MGETHDR(n, M_NOWAIT, MT_DATA); + MGETHDR(n, M_DONTWAIT, MT_DATA); n->m_len = MHLEN; } else { - MGET(n, M_NOWAIT, MT_DATA); + MGET(n, M_DONTWAIT, MT_DATA); n->m_len = MLEN; } if (!n) { @@ -234,7 +234,7 @@ key_sendup(so, msg, len, target) return ENOBUFS; } if (tlen >= MCLBYTES) { /*XXX better threshold? */ - MCLGET(n, M_NOWAIT); + MCLGET(n, M_DONTWAIT); if ((n->m_flags & M_EXT) == 0) { m_free(n); m_freem(m); @@ -402,7 +402,7 @@ key_attach(struct socket *so, int proto, struct thread *td) if (sotorawcb(so) != 0) return EISCONN; /* XXX panic? */ - kp = (struct keycb *)malloc(sizeof *kp, M_PCB, M_ZERO); /* XXX */ + kp = (struct keycb *)malloc(sizeof *kp, M_PCB, M_WAITOK|M_ZERO); /* XXX */ if (kp == 0) return ENOBUFS; diff --git a/sys/netipsec/xform_esp.c b/sys/netipsec/xform_esp.c index ece649d25496..f91d3cf54b82 100644 --- a/sys/netipsec/xform_esp.c +++ b/sys/netipsec/xform_esp.c @@ -190,7 +190,7 @@ esp_init(struct secasvar *sav, struct xformsw *xsp) * compromise is to force it to zero here. */ sav->ivlen = (txform == &enc_xform_null ? 0 : txform->blocksize); - sav->iv = (caddr_t) malloc(sav->ivlen, M_XDATA, 0); + sav->iv = (caddr_t) malloc(sav->ivlen, M_XDATA, M_WAITOK); if (sav->iv == NULL) { DPRINTF(("esp_init: no memory for IV\n")); return EINVAL; diff --git a/sys/netipsec/xform_ipip.c b/sys/netipsec/xform_ipip.c index 6672b62de4c5..9d49a3e55948 100644 --- a/sys/netipsec/xform_ipip.c +++ b/sys/netipsec/xform_ipip.c @@ -441,7 +441,7 @@ ipip_output( goto bad; } - M_PREPEND(m, sizeof(struct ip), M_NOWAIT); + M_PREPEND(m, sizeof(struct ip), M_DONTWAIT); if (m == 0) { DPRINTF(("ipip_output: M_PREPEND failed\n")); ipipstat.ipips_hdrops++; @@ -529,7 +529,7 @@ ipip_output( if (IN6_IS_SCOPE_LINKLOCAL(&ip6->ip6_dst)) ip6->ip6_dst.s6_addr16[1] = 0; - M_PREPEND(m, sizeof(struct ip6_hdr), M_NOWAIT); + M_PREPEND(m, sizeof(struct ip6_hdr), M_DONTWAIT); if (m == 0) { DPRINTF(("ipip_output: M_PREPEND failed\n")); ipipstat.ipips_hdrops++; diff --git a/sys/netipx/ipx.c b/sys/netipx/ipx.c index 3583670c6bd4..01628312c3bf 100644 --- a/sys/netipx/ipx.c +++ b/sys/netipx/ipx.c @@ -130,7 +130,7 @@ ipx_control(so, cmd, data, ifp, td) if (ia == NULL) { oia = (struct ipx_ifaddr *) malloc(sizeof(*ia), M_IFADDR, - M_ZERO); + M_WAITOK | M_ZERO); if (oia == NULL) return (ENOBUFS); if ((ia = ipx_ifaddr) != NULL) { diff --git a/sys/netipx/ipx_input.c b/sys/netipx/ipx_input.c index b3d95d214ad8..3410a41189d6 100644 --- a/sys/netipx/ipx_input.c +++ b/sys/netipx/ipx_input.c @@ -483,7 +483,7 @@ struct ifnet *ifp; if (m0 != NULL) { register struct ipx *ipx; - M_PREPEND(m0, sizeof(*ipx), M_NOWAIT); + M_PREPEND(m0, sizeof(*ipx), M_DONTWAIT); if (m0 == NULL) continue; ipx = mtod(m0, struct ipx *); diff --git a/sys/netipx/ipx_ip.c b/sys/netipx/ipx_ip.c index 59e769ba1e2f..6f5d74c2ba87 100644 --- a/sys/netipx/ipx_ip.c +++ b/sys/netipx/ipx_ip.c @@ -175,7 +175,7 @@ ipxip_input(m, hlen) if (ipxip_lastin != NULL) { m_freem(ipxip_lastin); } - ipxip_lastin = m_copym(m, 0, (int)M_COPYALL, M_NOWAIT); + ipxip_lastin = m_copym(m, 0, (int)M_COPYALL, M_DONTWAIT); } /* * Get IP and IPX header together in first mbuf. @@ -256,7 +256,7 @@ ipxipoutput(ifp, m, dst, rt) /* following clause not necessary on vax */ if (3 & (intptr_t)m->m_data) { /* force longword alignment of ip hdr */ - struct mbuf *m0 = m_gethdr(MT_HEADER, M_NOWAIT); + struct mbuf *m0 = m_gethdr(MT_HEADER, M_DONTWAIT); if (m0 == NULL) { m_freem(m); return (ENOBUFS); @@ -269,7 +269,7 @@ ipxipoutput(ifp, m, dst, rt) m->m_flags &= ~M_PKTHDR; m = m0; } else { - M_PREPEND(m, sizeof(struct ip), M_NOWAIT); + M_PREPEND(m, sizeof(struct ip), M_DONTWAIT); if (m == NULL) return (ENOBUFS); } diff --git a/sys/netipx/ipx_outputfl.c b/sys/netipx/ipx_outputfl.c index 0436847f237a..9f608dd42bdd 100644 --- a/sys/netipx/ipx_outputfl.c +++ b/sys/netipx/ipx_outputfl.c @@ -244,7 +244,7 @@ ipx_output_type20(m) if(ipx->ipx_sum != 0xffff) ipx->ipx_sum = ipx_cksum(m, ntohs(ipx->ipx_len)); - m1 = m_copym(m, 0, M_COPYALL, M_NOWAIT); + m1 = m_copym(m, 0, M_COPYALL, M_DONTWAIT); if(m1) { error = (*ifp->if_output)(ifp, m1, (struct sockaddr *)&dst, NULL); diff --git a/sys/netipx/ipx_usrreq.c b/sys/netipx/ipx_usrreq.c index bf0580842bba..f0c803a90b9a 100644 --- a/sys/netipx/ipx_usrreq.c +++ b/sys/netipx/ipx_usrreq.c @@ -218,7 +218,7 @@ ipx_output(ipxp, m0) (m->m_len + m->m_data < &m->m_dat[MLEN])) { mtod(m, char*)[m->m_len++] = 0; } else { - struct mbuf *m1 = m_get(M_NOWAIT, MT_DATA); + struct mbuf *m1 = m_get(M_DONTWAIT, MT_DATA); if (m1 == NULL) { m_freem(m0); @@ -239,7 +239,7 @@ ipx_output(ipxp, m0) if (ipxp->ipxp_flags & IPXP_RAWOUT) { ipx = mtod(m, struct ipx *); } else { - M_PREPEND(m, sizeof(struct ipx), M_NOWAIT); + M_PREPEND(m, sizeof(struct ipx), M_DONTWAIT); if (m == NULL) return (ENOBUFS); ipx = mtod(m, struct ipx *); diff --git a/sys/netipx/spx_usrreq.c b/sys/netipx/spx_usrreq.c index 92402c81a8ec..189d741d09fa 100644 --- a/sys/netipx/spx_usrreq.c +++ b/sys/netipx/spx_usrreq.c @@ -579,7 +579,7 @@ register struct spx *si; spx_newchecks[4]++; if (dt != cb->s_rhdr.spx_dt) { struct mbuf *mm = - m_getclr(M_NOWAIT, MT_CONTROL); + m_getclr(M_DONTWAIT, MT_CONTROL); spx_newchecks[0]++; if (mm != NULL) { u_short *s = @@ -755,7 +755,7 @@ spx_output(cb, m0) * from usrreq(), so it is OK to * block. */ - m = m_copym(m0, 0, mtu, 0); + m = m_copym(m0, 0, mtu, M_TRYWAIT); if (cb->s_flags & SF_NEWCALL) { struct mbuf *mm = m; spx_newchecks[7]++; @@ -785,7 +785,7 @@ spx_output(cb, m0) if (M_TRAILINGSPACE(m) >= 1) m->m_len++; else { - struct mbuf *m1 = m_get(M_NOWAIT, MT_DATA); + struct mbuf *m1 = m_get(M_DONTWAIT, MT_DATA); if (m1 == NULL) { m_freem(m0); @@ -796,7 +796,7 @@ spx_output(cb, m0) m->m_next = m1; } } - m = m_gethdr(M_NOWAIT, MT_HEADER); + m = m_gethdr(M_DONTWAIT, MT_HEADER); if (m == NULL) { m_freem(m0); return (ENOBUFS); @@ -1009,7 +1009,7 @@ spx_output(cb, m0) spxstat.spxs_sndprobe++; if (cb->s_flags & SF_ACKNOW) spxstat.spxs_sndacks++; - m = m_gethdr(M_NOWAIT, MT_HEADER); + m = m_gethdr(M_DONTWAIT, MT_HEADER); if (m == NULL) return (ENOBUFS); /* @@ -1342,7 +1342,7 @@ spx_attach(so, proto, td) } sb = &so->so_snd; - mm = m_getclr(M_NOWAIT, MT_HEADER); + mm = m_getclr(M_DONTWAIT, MT_HEADER); if (mm == NULL) { FREE(cb, M_PCB); error = ENOBUFS; diff --git a/sys/netkey/key.c b/sys/netkey/key.c index b987a829e2b3..8a1bc16b3121 100644 --- a/sys/netkey/key.c +++ b/sys/netkey/key.c @@ -1662,7 +1662,7 @@ key_gather_mbuf(m, mhp, ndeep, nitem, va_alist) if (len > MHLEN) panic("assumption failed"); #endif - MGETHDR(n, M_NOWAIT, MT_DATA); + MGETHDR(n, M_DONTWAIT, MT_DATA); if (!n) goto fail; n->m_len = len; @@ -1681,7 +1681,7 @@ key_gather_mbuf(m, mhp, ndeep, nitem, va_alist) mtod(n, caddr_t)); } else { n = m_copym(m, mhp->extoff[idx], mhp->extlen[idx], - M_NOWAIT); + M_DONTWAIT); } if (n == NULL) goto fail; @@ -2117,9 +2117,9 @@ key_spddelete2(so, m, mhp) if (len > MCLBYTES) return key_senderror(so, m, ENOBUFS); - MGETHDR(n, M_NOWAIT, MT_DATA); + MGETHDR(n, M_DONTWAIT, MT_DATA); if (n && len > MHLEN) { - MCLGET(n, M_NOWAIT); + MCLGET(n, M_DONTWAIT); if ((n->m_flags & M_EXT) == 0) { m_freem(n); n = NULL; @@ -2141,7 +2141,7 @@ key_spddelete2(so, m, mhp) #endif n->m_next = m_copym(m, mhp->extoff[SADB_X_EXT_POLICY], - mhp->extlen[SADB_X_EXT_POLICY], M_NOWAIT); + mhp->extlen[SADB_X_EXT_POLICY], M_DONTWAIT); if (!n->m_next) { m_freem(n); return key_senderror(so, m, ENOBUFS); @@ -3488,7 +3488,7 @@ key_setdumpsa(sav, type, satype, seq, pid) if ((!m && !p) || (m && p)) goto fail; if (p && tres) { - M_PREPEND(tres, l, M_NOWAIT); + M_PREPEND(tres, l, M_DONTWAIT); if (!tres) goto fail; bcopy(p, mtod(tres, caddr_t), l); @@ -3547,9 +3547,9 @@ key_setsadbmsg(type, tlen, satype, seq, pid, reserved) len = PFKEY_ALIGN8(sizeof(struct sadb_msg)); if (len > MCLBYTES) return NULL; - MGETHDR(m, M_NOWAIT, MT_DATA); + MGETHDR(m, M_DONTWAIT, MT_DATA); if (m && len > MHLEN) { - MCLGET(m, M_NOWAIT); + MCLGET(m, M_DONTWAIT); if ((m->m_flags & M_EXT) == 0) { m_freem(m); m = NULL; @@ -4682,9 +4682,9 @@ key_getspi(so, m, mhp) if (len > MCLBYTES) return key_senderror(so, m, ENOBUFS); - MGETHDR(n, M_NOWAIT, MT_DATA); + MGETHDR(n, M_DONTWAIT, MT_DATA); if (len > MHLEN) { - MCLGET(n, M_NOWAIT); + MCLGET(n, M_DONTWAIT); if ((n->m_flags & M_EXT) == 0) { m_freem(n); n = NULL; @@ -5573,7 +5573,7 @@ key_getcomb_esp() if (l > MLEN) panic("assumption failed in key_getcomb_esp"); #endif - MGET(m, M_NOWAIT, MT_DATA); + MGET(m, M_DONTWAIT, MT_DATA); if (m) { M_ALIGN(m, l); m->m_len = l; @@ -5657,14 +5657,14 @@ key_getcomb_ah() if (l > MLEN) panic("assumption failed in key_getcomb_ah"); #endif - MGET(m, M_NOWAIT, MT_DATA); + MGET(m, M_DONTWAIT, MT_DATA); if (m) { M_ALIGN(m, l); m->m_len = l; m->m_next = NULL; } } else - M_PREPEND(m, l, M_NOWAIT); + M_PREPEND(m, l, M_DONTWAIT); if (!m) return NULL; @@ -5703,14 +5703,14 @@ key_getcomb_ipcomp() if (l > MLEN) panic("assumption failed in key_getcomb_ipcomp"); #endif - MGET(m, M_NOWAIT, MT_DATA); + MGET(m, M_DONTWAIT, MT_DATA); if (m) { M_ALIGN(m, l); m->m_len = l; m->m_next = NULL; } } else - M_PREPEND(m, l, M_NOWAIT); + M_PREPEND(m, l, M_DONTWAIT); if (!m) return NULL; @@ -5756,7 +5756,7 @@ key_getprop(saidx) if (!m) return NULL; - M_PREPEND(m, l, M_NOWAIT); + M_PREPEND(m, l, M_DONTWAIT); if (!m) return NULL; @@ -6273,9 +6273,9 @@ key_register(so, m, mhp) if (len > MCLBYTES) return key_senderror(so, m, ENOBUFS); - MGETHDR(n, M_NOWAIT, MT_DATA); + MGETHDR(n, M_DONTWAIT, MT_DATA); if (len > MHLEN) { - MCLGET(n, M_NOWAIT); + MCLGET(n, M_DONTWAIT); if ((n->m_flags & M_EXT) == 0) { m_freem(n); n = NULL; @@ -6847,9 +6847,9 @@ key_parse(m, so) if (m->m_next) { struct mbuf *n; - MGETHDR(n, M_NOWAIT, MT_DATA); + MGETHDR(n, M_DONTWAIT, MT_DATA); if (n && m->m_pkthdr.len > MHLEN) { - MCLGET(n, M_NOWAIT); + MCLGET(n, M_DONTWAIT); if ((n->m_flags & M_EXT) == 0) { m_free(n); n = NULL; @@ -7474,9 +7474,9 @@ key_alloc_mbuf(l) len = l; while (len > 0) { - MGET(n, M_NOWAIT, MT_DATA); + MGET(n, M_DONTWAIT, MT_DATA); if (n && len > MLEN) - MCLGET(n, M_NOWAIT); + MCLGET(n, M_DONTWAIT); if (!n) { m_freem(m); return NULL; diff --git a/sys/netkey/keysock.c b/sys/netkey/keysock.c index 13394ac24b06..dbc48a85e111 100644 --- a/sys/netkey/keysock.c +++ b/sys/netkey/keysock.c @@ -148,7 +148,7 @@ key_sendup0(rp, m, promisc) if (promisc) { struct sadb_msg *pmsg; - M_PREPEND(m, sizeof(struct sadb_msg), M_NOWAIT); + M_PREPEND(m, sizeof(struct sadb_msg), M_DONTWAIT); if (m && m->m_len < sizeof(struct sadb_msg)) m = m_pullup(m, sizeof(struct sadb_msg)); if (!m) { @@ -219,10 +219,10 @@ key_sendup(so, msg, len, target) m = mprev = NULL; while (tlen > 0) { if (tlen == len) { - MGETHDR(n, M_NOWAIT, MT_DATA); + MGETHDR(n, M_DONTWAIT, MT_DATA); n->m_len = MHLEN; } else { - MGET(n, M_NOWAIT, MT_DATA); + MGET(n, M_DONTWAIT, MT_DATA); n->m_len = MLEN; } if (!n) { @@ -230,7 +230,7 @@ key_sendup(so, msg, len, target) return ENOBUFS; } if (tlen >= MCLBYTES) { /*XXX better threshold? */ - MCLGET(n, M_NOWAIT); + MCLGET(n, M_DONTWAIT); if ((n->m_flags & M_EXT) == 0) { m_free(n); m_freem(m); @@ -398,7 +398,7 @@ key_attach(struct socket *so, int proto, struct thread *td) if (sotorawcb(so) != 0) return EISCONN; /* XXX panic? */ - kp = (struct keycb *)malloc(sizeof *kp, M_PCB, 0); /* XXX */ + kp = (struct keycb *)malloc(sizeof *kp, M_PCB, M_WAITOK); /* XXX */ if (kp == 0) return ENOBUFS; bzero(kp, sizeof *kp); diff --git a/sys/netnatm/natm.c b/sys/netnatm/natm.c index 24b65edee46c..e0535b6d5fbf 100644 --- a/sys/netnatm/natm.c +++ b/sys/netnatm/natm.c @@ -109,7 +109,7 @@ natm_usr_attach(struct socket *so, int proto, d_thread_t *p) goto out; } - so->so_pcb = (caddr_t) (npcb = npcb_alloc(0)); + so->so_pcb = (caddr_t) (npcb = npcb_alloc(M_WAITOK)); npcb->npcb_socket = so; out: splx(s); @@ -300,7 +300,7 @@ natm_usr_send(struct socket *so, int flags, struct mbuf *m, * send the data. we must put an atm_pseudohdr on first */ - M_PREPEND(m, sizeof(*aph), 0); + M_PREPEND(m, sizeof(*aph), M_TRYWAIT); if (m == NULL) { error = ENOBUFS; goto out; @@ -469,7 +469,7 @@ struct proc *p; break; } - so->so_pcb = (caddr_t) (npcb = npcb_alloc(0)); + so->so_pcb = (caddr_t) (npcb = npcb_alloc(M_WAITOK)); npcb->npcb_socket = so; break; @@ -599,7 +599,7 @@ struct proc *p; * send the data. we must put an atm_pseudohdr on first */ - M_PREPEND(m, sizeof(*aph), 0); + M_PREPEND(m, sizeof(*aph), M_TRYWAIT); if (m == NULL) { error = ENOBUFS; break; diff --git a/sys/netnatm/natm_pcb.c b/sys/netnatm/natm_pcb.c index 9fee1b0f2bfb..7016e33ec2bf 100644 --- a/sys/netnatm/natm_pcb.c +++ b/sys/netnatm/natm_pcb.c @@ -66,7 +66,7 @@ int wait; MALLOC(npcb, struct natmpcb *, sizeof(*npcb), M_PCB, wait | M_ZERO); #ifdef DIAGNOSTIC - if (wait == 0 && npcb == NULL) panic("npcb_alloc: malloc didn't wait"); + if (wait == M_WAITOK && npcb == NULL) panic("npcb_alloc: malloc didn't wait"); #endif if (npcb) diff --git a/sys/netncp/ncp_conn.c b/sys/netncp/ncp_conn.c index a3dbec376392..14b8d7b2d5bc 100644 --- a/sys/netncp/ncp_conn.c +++ b/sys/netncp/ncp_conn.c @@ -233,7 +233,7 @@ ncp_conn_alloc(struct ncp_conn_args *cap, struct proc *p, struct ucred *cred, } else owner = crhold(cred); MALLOC(ncp, struct ncp_conn *, sizeof(struct ncp_conn), - M_NCPDATA, M_ZERO); + M_NCPDATA, M_WAITOK | M_ZERO); error = 0; lockinit(&ncp->nc_lock, PZERO, "ncplck", 0, 0); ncp_conn_cnt++; @@ -522,7 +522,7 @@ ncp_conn_gethandle(struct ncp_conn *conn, struct proc *p, struct ncp_handle **ha return 0; } MALLOC(refp,struct ncp_handle *,sizeof(struct ncp_handle),M_NCPDATA, - M_ZERO); + M_WAITOK | M_ZERO); SLIST_INSERT_HEAD(&lhlist,refp,nh_next); refp->nh_ref++; refp->nh_proc = p; diff --git a/sys/netncp/ncp_rq.c b/sys/netncp/ncp_rq.c index 80d2fd0ca69c..ea707318862b 100644 --- a/sys/netncp/ncp_rq.c +++ b/sys/netncp/ncp_rq.c @@ -63,7 +63,7 @@ ncp_rq_alloc_any(u_int32_t ptype, u_int8_t fn, struct ncp_conn *ncp, struct ncp_rq *rqp; int error; - MALLOC(rqp, struct ncp_rq *, sizeof(*rqp), M_NCPRQ, 0); + MALLOC(rqp, struct ncp_rq *, sizeof(*rqp), M_NCPRQ, M_WAITOK); error = ncp_rq_init_any(rqp, ptype, fn, ncp, p, cred); rqp->nr_flags |= NCPR_ALLOCED; if (error) { diff --git a/sys/netncp/ncp_sock.c b/sys/netncp/ncp_sock.c index d9351e5fe169..4a03565b953c 100644 --- a/sys/netncp/ncp_sock.c +++ b/sys/netncp/ncp_sock.c @@ -163,7 +163,7 @@ ncp_sock_send(struct socket *so, struct mbuf *top, struct ncp_rq *rqp) int sendwait; for(;;) { - m = m_copym(top, 0, M_COPYALL, 0); + m = m_copym(top, 0, M_COPYALL, M_TRYWAIT); /* NCPDDEBUG(m);*/ error = so->so_proto->pr_usrreqs->pru_sosend(so, to, 0, m, 0, flags, p); if (error == 0 || error == EINTR || error == ENETDOWN) diff --git a/sys/netncp/ncp_subr.c b/sys/netncp/ncp_subr.c index 4f7e5f07fdff..a55e53501e13 100644 --- a/sys/netncp/ncp_subr.c +++ b/sys/netncp/ncp_subr.c @@ -69,7 +69,7 @@ ncp_str_dup(char *s) { len++; if (bt == 0) break; } - MALLOC(p, char*, len, M_NCPDATA, 0); + MALLOC(p, char*, len, M_NCPDATA, M_WAITOK); copyin(s, p, len); return p; } diff --git a/sys/netns/idp_usrreq.c b/sys/netns/idp_usrreq.c index be9dd5c91a86..2642d1a0b407 100644 --- a/sys/netns/idp_usrreq.c +++ b/sys/netns/idp_usrreq.c @@ -160,7 +160,7 @@ idp_output(nsp, m0) (m->m_len + m->m_data < &m->m_dat[MLEN])) { m->m_len++; } else { - struct mbuf *m1 = m_get(M_NOWAIT, MT_DATA); + struct mbuf *m1 = m_get(M_DONTWAIT, MT_DATA); if (m1 == 0) { m_freem(m0); @@ -181,7 +181,7 @@ idp_output(nsp, m0) if (nsp->nsp_flags & NSP_RAWOUT) { idp = mtod(m, struct idp *); } else { - M_PREPEND(m, sizeof (struct idp), M_NOWAIT); + M_PREPEND(m, sizeof (struct idp), M_DONTWAIT); if (m == 0) return (ENOBUFS); idp = mtod(m, struct idp *); @@ -273,7 +273,7 @@ idp_ctloutput(req, so, level, name, value) case PRCO_GETOPT: if (value==NULL) return (EINVAL); - m = m_get(M_NOWAIT, MT_DATA); + m = m_get(M_DONTWAIT, MT_DATA); if (m==NULL) return (ENOBUFS); switch (name) { diff --git a/sys/netns/ns.c b/sys/netns/ns.c index 40a8b0c04df5..7af5acf12ac9 100644 --- a/sys/netns/ns.c +++ b/sys/netns/ns.c @@ -128,7 +128,7 @@ ns_control(so, cmd, data, ifp) case SIOCSIFDSTADDR: if (ia == (struct ns_ifaddr *)0) { oia = (struct ns_ifaddr *) - malloc(sizeof *ia, M_IFADDR, 0); + malloc(sizeof *ia, M_IFADDR, M_WAITOK); if (oia == (struct ns_ifaddr *)NULL) return (ENOBUFS); bzero((caddr_t)oia, sizeof(*oia)); diff --git a/sys/netns/ns_error.c b/sys/netns/ns_error.c index 769edf864a34..fc4db94bd69e 100644 --- a/sys/netns/ns_error.c +++ b/sys/netns/ns_error.c @@ -135,7 +135,7 @@ ns_error(om, type, param) /* * First, formulate ns_err message */ - m = m_gethdr(M_NOWAIT, MT_HEADER); + m = m_gethdr(M_DONTWAIT, MT_HEADER); if (m == NULL) goto freeit; m->m_len = sizeof(*ep); diff --git a/sys/netns/ns_input.c b/sys/netns/ns_input.c index 033eae6fb46a..22abe026347d 100644 --- a/sys/netns/ns_input.c +++ b/sys/netns/ns_input.c @@ -470,7 +470,7 @@ struct ifnet *ifp; if (m0) { register struct idp *idp; - M_PREPEND(m0, sizeof (*idp), M_NOWAIT); + M_PREPEND(m0, sizeof (*idp), M_DONTWAIT); if (m0 == NULL) continue; idp = mtod(m0, struct idp *); diff --git a/sys/netns/ns_ip.c b/sys/netns/ns_ip.c index b566196b1704..55d1a9f88b3c 100644 --- a/sys/netns/ns_ip.c +++ b/sys/netns/ns_ip.c @@ -168,7 +168,7 @@ idpip_input(m, ifp) if (nsip_lastin) { m_freem(nsip_lastin); } - nsip_lastin = m_copym(m, 0, (int)M_COPYALL, M_NOWAIT); + nsip_lastin = m_copym(m, 0, (int)M_COPYALL, M_DONTWAIT); } /* * Get IP and IDP header together in first mbuf. @@ -251,7 +251,7 @@ nsipoutput(ifn, m, dst) /* following clause not necessary on vax */ if (3 & (int)m->m_data) { /* force longword alignment of ip hdr */ - struct mbuf *m0 = m_gethdr(MT_HEADER, M_NOWAIT); + struct mbuf *m0 = m_gethdr(MT_HEADER, M_DONTWAIT); if (m0 == 0) { m_freem(m); return (ENOBUFS); @@ -263,7 +263,7 @@ nsipoutput(ifn, m, dst) m0->m_pkthdr.len = m0->m_len + m->m_len; m->m_flags &= ~M_PKTHDR; } else { - M_PREPEND(m, sizeof (struct ip), M_NOWAIT); + M_PREPEND(m, sizeof (struct ip), M_DONTWAIT); if (m == 0) return (ENOBUFS); } diff --git a/sys/netns/ns_pcb.c b/sys/netns/ns_pcb.c index bcccc3a2db3a..01301c087827 100644 --- a/sys/netns/ns_pcb.c +++ b/sys/netns/ns_pcb.c @@ -58,7 +58,7 @@ ns_pcballoc(so, head) struct mbuf *m; register struct nspcb *nsp; - m = m_getclr(M_NOWAIT, MT_PCB); + m = m_getclr(M_DONTWAIT, MT_PCB); if (m == NULL) return (ENOBUFS); nsp = mtod(m, struct nspcb *); diff --git a/sys/netns/spp_usrreq.c b/sys/netns/spp_usrreq.c index 2191d1ab1087..c9428842b101 100644 --- a/sys/netns/spp_usrreq.c +++ b/sys/netns/spp_usrreq.c @@ -161,7 +161,7 @@ spp_input(m, nsp) spp_istat.gonawy++; goto dropwithreset; } - am = m_get(M_NOWAIT, MT_SONAME); + am = m_get(M_DONTWAIT, MT_SONAME); if (am == NULL) goto drop; am->m_len = sizeof (struct sockaddr_ns); @@ -528,7 +528,7 @@ register struct spidp *si; spp_newchecks[4]++; if (dt != cb->s_rhdr.sp_dt) { struct mbuf *mm = - m_getclr(M_NOWAIT, MT_CONTROL); + m_getclr(M_DONTWAIT, MT_CONTROL); spp_newchecks[0]++; if (mm != NULL) { u_short *s = @@ -742,7 +742,7 @@ spp_output(cb, m0) * from usrreq(), so it is OK to * block. */ - m = m_copym(m0, 0, mtu, 0); + m = m_copym(m0, 0, mtu, M_TRYWAIT); if (cb->s_flags & SF_NEWCALL) { struct mbuf *mm = m; spp_newchecks[7]++; @@ -772,7 +772,7 @@ spp_output(cb, m0) if (M_TRAILINGSPACE(m) >= 1) m->m_len++; else { - struct mbuf *m1 = m_get(M_NOWAIT, MT_DATA); + struct mbuf *m1 = m_get(M_DONTWAIT, MT_DATA); if (m1 == 0) { m_freem(m0); @@ -783,7 +783,7 @@ spp_output(cb, m0) m->m_next = m1; } } - m = m_gethdr(M_NOWAIT, MT_HEADER); + m = m_gethdr(M_DONTWAIT, MT_HEADER); if (m == 0) { m_freem(m0); return (ENOBUFS); @@ -996,7 +996,7 @@ spp_output(cb, m0) sppstat.spps_sndprobe++; if (cb->s_flags & SF_ACKNOW) sppstat.spps_sndacks++; - m = m_gethdr(M_NOWAIT, MT_HEADER); + m = m_gethdr(M_DONTWAIT, MT_HEADER); if (m == 0) return (ENOBUFS); /* @@ -1156,7 +1156,7 @@ spp_ctloutput(req, so, level, name, value) case PRCO_GETOPT: if (value == NULL) return (EINVAL); - m = m_get(M_NOWAIT, MT_DATA); + m = m_get(M_DONTWAIT, MT_DATA); if (m == NULL) return (ENOBUFS); switch (name) { @@ -1296,7 +1296,7 @@ spp_usrreq(so, req, m, nam, controlp) } nsp = sotonspcb(so); - mm = m_getclr(M_NOWAIT, MT_PCB); + mm = m_getclr(M_DONTWAIT, MT_PCB); sb = &so->so_snd; if (mm == NULL) { @@ -1304,7 +1304,7 @@ spp_usrreq(so, req, m, nam, controlp) break; } cb = mtod(mm, struct sppcb *); - mm = m_getclr(M_NOWAIT, MT_HEADER); + mm = m_getclr(M_DONTWAIT, MT_HEADER); if (mm == NULL) { (void) m_free(dtom(m)); error = ENOBUFS; diff --git a/sys/netsmb/smb_conn.c b/sys/netsmb/smb_conn.c index 2a1e913595e1..9c52571ed352 100644 --- a/sys/netsmb/smb_conn.c +++ b/sys/netsmb/smb_conn.c @@ -393,7 +393,7 @@ smb_vc_create(struct smb_vcspec *vcspec, if (gid != SMBM_ANY_GROUP && !groupmember(gid, cred) && !isroot) return EPERM; - vcp = smb_zmalloc(sizeof(*vcp), M_SMBCONN, 0); + vcp = smb_zmalloc(sizeof(*vcp), M_SMBCONN, M_WAITOK); smb_co_init(VCTOCP(vcp), SMBL_VC, "smb_vc", td); vcp->obj.co_free = smb_vc_free; vcp->obj.co_gone = smb_vc_gone; @@ -690,7 +690,7 @@ smb_share_create(struct smb_vc *vcp, struct smb_sharespec *shspec, uid = realuid; if (gid == SMBM_ANY_GROUP) gid = cred->cr_groups[0]; - ssp = smb_zmalloc(sizeof(*ssp), M_SMBCONN, 0); + ssp = smb_zmalloc(sizeof(*ssp), M_SMBCONN, M_WAITOK); smb_co_init(SSTOCP(ssp), SMBL_SHARE, "smbss", td); ssp->obj.co_free = smb_share_free; ssp->obj.co_gone = smb_share_gone; diff --git a/sys/netsmb/smb_crypt.c b/sys/netsmb/smb_crypt.c index a6369324d794..8e35207eb64f 100644 --- a/sys/netsmb/smb_crypt.c +++ b/sys/netsmb/smb_crypt.c @@ -73,7 +73,7 @@ smb_E(const u_char *key, u_char *data, u_char *dest) kk[5] = key[4] << 3 | (key[5] >> 5 & 0xfe); kk[6] = key[5] << 2 | (key[6] >> 6 & 0xfe); kk[7] = key[6] << 1; - ksp = malloc(sizeof(des_key_schedule), M_SMBTEMP, 0); + ksp = malloc(sizeof(des_key_schedule), M_SMBTEMP, M_WAITOK); des_set_key((des_cblock *)kk, *ksp); des_ecb_encrypt((des_cblock *)data, (des_cblock *)dest, *ksp, 1); free(ksp, M_SMBTEMP); @@ -87,7 +87,7 @@ smb_encrypt(const u_char *apwd, u_char *C8, u_char *RN) #ifdef NETSMBCRYPTO u_char *p, *P14, *S21; - p = malloc(14 + 21, M_SMBTEMP, 0); + p = malloc(14 + 21, M_SMBTEMP, M_WAITOK); bzero(p, 14 + 21); P14 = p; S21 = p + 14; @@ -120,12 +120,12 @@ smb_ntencrypt(const u_char *apwd, u_char *C8, u_char *RN) int len; len = strlen(apwd); - unipwd = malloc((len + 1) * sizeof(u_int16_t), M_SMBTEMP, 0); + unipwd = malloc((len + 1) * sizeof(u_int16_t), M_SMBTEMP, M_WAITOK); /* * S21 = concat(MD4(U(apwd)), zeros(5)); */ smb_strtouni(unipwd, apwd); - ctxp = malloc(sizeof(MD4_CTX), M_SMBTEMP, 0); + ctxp = malloc(sizeof(MD4_CTX), M_SMBTEMP, M_WAITOK); MD4Init(ctxp); MD4Update(ctxp, (u_char*)unipwd, len * sizeof(u_int16_t)); free(unipwd, M_SMBTEMP); diff --git a/sys/netsmb/smb_dev.c b/sys/netsmb/smb_dev.c index 2fc6a2955dec..50b7e511fa26 100644 --- a/sys/netsmb/smb_dev.c +++ b/sys/netsmb/smb_dev.c @@ -132,7 +132,7 @@ nsmb_dev_open(dev_t dev, int oflags, int devtype, struct thread *td) if (sdp && (sdp->sd_flags & NSMBFL_OPEN)) return EBUSY; if (sdp == NULL) { - sdp = malloc(sizeof(*sdp), M_NSMBDEV, 0); + sdp = malloc(sizeof(*sdp), M_NSMBDEV, M_WAITOK); dev->si_drv1 = (void*)sdp; } /* diff --git a/sys/netsmb/smb_iod.c b/sys/netsmb/smb_iod.c index 12c900015c76..5ae5f146e62b 100644 --- a/sys/netsmb/smb_iod.c +++ b/sys/netsmb/smb_iod.c @@ -248,7 +248,7 @@ smb_iod_sendrq(struct smbiod *iod, struct smb_rq *rqp) } SMBSDEBUG("M:%04x, P:%04x, U:%04x, T:%04x\n", rqp->sr_mid, 0, 0, 0); m_dumpm(rqp->sr_rq.mb_top); - m = m_copym(rqp->sr_rq.mb_top, 0, M_COPYALL, 0); + m = m_copym(rqp->sr_rq.mb_top, 0, M_COPYALL, M_TRYWAIT); error = rqp->sr_lerror = m ? SMB_TRAN_SEND(vcp, m, td) : ENOBUFS; if (error == 0) { getnanotime(&rqp->sr_timesent); @@ -371,7 +371,7 @@ smb_iod_request(struct smbiod *iod, int event, void *ident) int error; SMBIODEBUG("\n"); - evp = smb_zmalloc(sizeof(*evp), M_SMBIOD, 0); + evp = smb_zmalloc(sizeof(*evp), M_SMBIOD, M_WAITOK); evp->ev_type = event; evp->ev_ident = ident; SMB_IOD_EVLOCK(iod); @@ -663,7 +663,7 @@ smb_iod_create(struct smb_vc *vcp) struct smbiod *iod; int error; - iod = smb_zmalloc(sizeof(*iod), M_SMBIOD, 0); + iod = smb_zmalloc(sizeof(*iod), M_SMBIOD, M_WAITOK); iod->iod_id = smb_iod_next++; iod->iod_state = SMBIOD_ST_NOTCONN; iod->iod_vc = vcp; diff --git a/sys/netsmb/smb_rq.c b/sys/netsmb/smb_rq.c index 9fd14a6d5ad3..5e0c7a86d4f2 100644 --- a/sys/netsmb/smb_rq.c +++ b/sys/netsmb/smb_rq.c @@ -67,7 +67,7 @@ smb_rq_alloc(struct smb_connobj *layer, u_char cmd, struct smb_cred *scred, struct smb_rq *rqp; int error; - MALLOC(rqp, struct smb_rq *, sizeof(*rqp), M_SMBRQ, 0); + MALLOC(rqp, struct smb_rq *, sizeof(*rqp), M_SMBRQ, M_WAITOK); if (rqp == NULL) return ENOMEM; error = smb_rq_init(rqp, layer, cmd, scred); @@ -368,7 +368,7 @@ smb_t2_alloc(struct smb_connobj *layer, u_short setup, struct smb_cred *scred, struct smb_t2rq *t2p; int error; - MALLOC(t2p, struct smb_t2rq *, sizeof(*t2p), M_SMBRQ, 0); + MALLOC(t2p, struct smb_t2rq *, sizeof(*t2p), M_SMBRQ, M_WAITOK); if (t2p == NULL) return ENOMEM; error = smb_t2_init(t2p, layer, setup, scred); @@ -418,7 +418,7 @@ smb_t2_placedata(struct mbuf *mtop, u_int16_t offset, u_int16_t count, struct mbuf *m, *m0; int len; - m0 = m_split(mtop, offset, 0); + m0 = m_split(mtop, offset, M_TRYWAIT); if (m0 == NULL) return EBADRPC; len = m_length(m0, &m); diff --git a/sys/netsmb/smb_smb.c b/sys/netsmb/smb_smb.c index 6a24de6e78c3..b5e7c2251989 100644 --- a/sys/netsmb/smb_smb.c +++ b/sys/netsmb/smb_smb.c @@ -280,8 +280,8 @@ smb_smb_ssnsetup(struct smb_vc *vcp, struct smb_cred *scred) error = smb_rq_alloc(VCTOCP(vcp), SMB_COM_SESSION_SETUP_ANDX, scred, &rqp); if (error) return error; - pbuf = malloc(SMB_MAXPASSWORDLEN + 1, M_SMBTEMP, 0); - encpass = malloc(24, M_SMBTEMP, 0); + pbuf = malloc(SMB_MAXPASSWORDLEN + 1, M_SMBTEMP, M_WAITOK); + encpass = malloc(24, M_SMBTEMP, M_WAITOK); if (vcp->vc_sopt.sv_sm & SMB_SM_USER) { /* * We try w/o uppercasing first so Samba mixed case @@ -302,7 +302,7 @@ smb_smb_ssnsetup(struct smb_vc *vcp, struct smb_cred *scred) if (vcp->vc_sopt.sv_sm & SMB_SM_ENCRYPT) { uniplen = plen = 24; smb_encrypt(pbuf, vcp->vc_ch, encpass); - ntencpass = malloc(uniplen, M_SMBTEMP, 0); + ntencpass = malloc(uniplen, M_SMBTEMP, M_WAITOK); if (SMB_UNICODE_STRINGS(vcp)) { strncpy(pbuf, smb_vc_getpass(vcp), SMB_MAXPASSWORDLEN); @@ -318,7 +318,7 @@ smb_smb_ssnsetup(struct smb_vc *vcp, struct smb_cred *scred) plen = strlen(pbuf) + 1; pp = pbuf; uniplen = plen * 2; - ntencpass = malloc(uniplen, M_SMBTEMP, 0); + ntencpass = malloc(uniplen, M_SMBTEMP, M_WAITOK); smb_strtouni(ntencpass, smb_vc_getpass(vcp)); plen--; @@ -500,8 +500,8 @@ smb_smb_treeconnect(struct smb_share *ssp, struct smb_cred *scred) pbuf = NULL; encpass = NULL; } else { - pbuf = malloc(SMB_MAXPASSWORDLEN + 1, M_SMBTEMP, 0); - encpass = malloc(24, M_SMBTEMP, 0); + pbuf = malloc(SMB_MAXPASSWORDLEN + 1, M_SMBTEMP, M_WAITOK); + encpass = malloc(24, M_SMBTEMP, M_WAITOK); /* * We try w/o uppercasing first so Samba mixed case * passwords work. If that fails we come back and try diff --git a/sys/netsmb/smb_subr.c b/sys/netsmb/smb_subr.c index ae21133fda06..55c4c2665794 100644 --- a/sys/netsmb/smb_subr.c +++ b/sys/netsmb/smb_subr.c @@ -94,7 +94,7 @@ smb_strdup(const char *s) int len; len = s ? strlen(s) + 1 : 1; - p = malloc(len, M_SMBSTR, 0); + p = malloc(len, M_SMBSTR, M_WAITOK); if (s) bcopy(s, p, len); else @@ -120,7 +120,7 @@ smb_strdupin(char *s, int maxlen) if (bt == 0) break; } - p = malloc(len, M_SMBSTR, 0); + p = malloc(len, M_SMBSTR, M_WAITOK); copyin(s, p, len); return p; } @@ -135,7 +135,7 @@ smb_memdupin(void *umem, int len) if (len > 8 * 1024) return NULL; - p = malloc(len, M_SMBSTR, 0); + p = malloc(len, M_SMBSTR, M_WAITOK); if (copyin(umem, p, len) == 0) return p; free(p, M_SMBSTR); @@ -152,7 +152,7 @@ smb_memdup(const void *umem, int len) if (len > 8 * 1024) return NULL; - p = malloc(len, M_SMBSTR, 0); + p = malloc(len, M_SMBSTR, M_WAITOK); if (p == NULL) return NULL; bcopy(umem, p, len); diff --git a/sys/netsmb/smb_trantcp.c b/sys/netsmb/smb_trantcp.c index b631a52fa9d7..cf0adcbb3e99 100644 --- a/sys/netsmb/smb_trantcp.c +++ b/sys/netsmb/smb_trantcp.c @@ -514,7 +514,7 @@ smb_nbst_create(struct smb_vc *vcp, struct thread *td) { struct nbpcb *nbp; - MALLOC(nbp, struct nbpcb *, sizeof *nbp, M_NBDATA, 0); + MALLOC(nbp, struct nbpcb *, sizeof *nbp, M_NBDATA, M_WAITOK); bzero(nbp, sizeof *nbp); nbp->nbp_timo.tv_sec = 15; /* XXX: sysctl ? */ nbp->nbp_state = NBST_CLOSED; @@ -648,7 +648,7 @@ smb_nbst_send(struct smb_vc *vcp, struct mbuf *m0, struct thread *td) error = ENOTCONN; goto abort; } - M_PREPEND(m0, 4, 0); + M_PREPEND(m0, 4, M_TRYWAIT); if (m0 == NULL) return ENOBUFS; nb_sethdr(m0, NB_SSN_MESSAGE, m_fixhdr(m0) - 4); diff --git a/sys/nfs/nfs_common.c b/sys/nfs/nfs_common.c index f2a26d90f776..b99c3b0fc388 100644 --- a/sys/nfs/nfs_common.c +++ b/sys/nfs/nfs_common.c @@ -191,7 +191,7 @@ nfsm_disct(struct mbuf **mdp, caddr_t *dposp, int siz, int left) } else if (siz > MHLEN) { panic("nfs S too big"); } else { - MGET(mp2, 0, MT_DATA); + MGET(mp2, M_TRYWAIT, MT_DATA); mp2->m_next = mp->m_next; mp->m_next = mp2; mp->m_len -= left; @@ -254,7 +254,7 @@ nfsm_build_xx(int s, struct mbuf **mb, caddr_t *bpos) void *ret; if (s > M_TRAILINGSPACE(*mb)) { - MGET(mb2, 0, MT_DATA); + MGET(mb2, M_TRYWAIT, MT_DATA); if (s > MLEN) panic("build > MLEN"); (*mb)->m_next = mb2; diff --git a/sys/nfsclient/bootp_subr.c b/sys/nfsclient/bootp_subr.c index 8bd86b2606a7..bfa419ee398c 100644 --- a/sys/nfsclient/bootp_subr.c +++ b/sys/nfsclient/bootp_subr.c @@ -433,7 +433,7 @@ allocifctx(struct bootpc_globalcontext *gctx) { struct bootpc_ifcontext *ifctx; ifctx = (struct bootpc_ifcontext *) malloc(sizeof(*ifctx), - M_TEMP, 0); + M_TEMP, M_WAITOK); if (ifctx == NULL) panic("Failed to allocate bootp interface context structure"); @@ -1675,7 +1675,7 @@ bootpc_init(void) if (nfs_diskless_valid != 0) return; - gctx = malloc(sizeof(*gctx), M_TEMP, 0); + gctx = malloc(sizeof(*gctx), M_TEMP, M_WAITOK); if (gctx == NULL) panic("Failed to allocate bootp global context structure"); @@ -1942,7 +1942,7 @@ md_lookup_swap(struct sockaddr_in *mdsin, char *path, u_char *fhp, int *fhsizep, u_int32_t v3[21]; } fattribs; - m = m_get(0, MT_DATA); + m = m_get(M_TRYWAIT, MT_DATA); if (m == NULL) return ENOBUFS; diff --git a/sys/nfsclient/krpc_subr.c b/sys/nfsclient/krpc_subr.c index e470aebc1747..4690104797fe 100644 --- a/sys/nfsclient/krpc_subr.c +++ b/sys/nfsclient/krpc_subr.c @@ -149,7 +149,7 @@ krpc_portmap(struct sockaddr_in *sin, u_int prog, u_int vers, u_int16_t *portp, return 0; } - m = m_get(0, MT_DATA); + m = m_get(M_TRYWAIT, MT_DATA); if (m == NULL) return ENOBUFS; sdata = mtod(m, struct sdata *); @@ -271,7 +271,7 @@ krpc_call(struct sockaddr_in *sa, u_int prog, u_int vers, u_int func, /* * Prepend RPC message header. */ - mhead = m_gethdr(0, MT_DATA); + mhead = m_gethdr(M_TRYWAIT, MT_DATA); mhead->m_next = *data; call = mtod(mhead, struct rpc_call *); mhead->m_len = sizeof(*call); @@ -311,7 +311,7 @@ krpc_call(struct sockaddr_in *sa, u_int prog, u_int vers, u_int func, timo = 0; for (;;) { /* Send RPC request (or re-send). */ - m = m_copym(mhead, 0, M_COPYALL, 0); + m = m_copym(mhead, 0, M_COPYALL, M_TRYWAIT); if (m == NULL) { error = ENOBUFS; goto out; @@ -465,9 +465,9 @@ xdr_string_encode(char *str, int len) if (mlen > MCLBYTES) /* If too big, we just can't do it. */ return (NULL); - m = m_get(0, MT_DATA); + m = m_get(M_TRYWAIT, MT_DATA); if (mlen > MLEN) { - MCLGET(m, 0); + MCLGET(m, M_TRYWAIT); if ((m->m_flags & M_EXT) == 0) { (void) m_free(m); /* There can be only one. */ return (NULL); diff --git a/sys/nfsclient/nfs_lock.c b/sys/nfsclient/nfs_lock.c index 1e098dbda4c0..67f049abb5b0 100644 --- a/sys/nfsclient/nfs_lock.c +++ b/sys/nfsclient/nfs_lock.c @@ -114,7 +114,7 @@ nfs_dolock(struct vop_advlock_args *ap) */ if (p->p_nlminfo == NULL) { MALLOC(p->p_nlminfo, struct nlminfo *, - sizeof(struct nlminfo), M_LOCKF, M_ZERO); + sizeof(struct nlminfo), M_LOCKF, M_WAITOK | M_ZERO); p->p_nlminfo->pid_start = p->p_stats->p_start; } msg.lm_msg_ident.pid_start = p->p_nlminfo->pid_start; diff --git a/sys/nfsclient/nfs_node.c b/sys/nfsclient/nfs_node.c index b5ee0bdae094..30f4aff3eea9 100644 --- a/sys/nfsclient/nfs_node.c +++ b/sys/nfsclient/nfs_node.c @@ -224,7 +224,7 @@ nfs_nget(struct mount *mntp, nfsfh_t *fhp, int fhsize, struct nfsnode **npp) * might cause a bogus v_data pointer to get dereferenced * elsewhere if zalloc should block. */ - np = uma_zalloc(nfsnode_zone, 0); + np = uma_zalloc(nfsnode_zone, M_WAITOK); error = getnewvnode("nfs", mntp, nfsv2_vnodeop_p, &nvp); if (error) { @@ -255,7 +255,7 @@ nfs_nget(struct mount *mntp, nfsfh_t *fhp, int fhsize, struct nfsnode **npp) } LIST_INSERT_HEAD(nhpp, np, n_hash); if (fhsize > NFS_SMALLFH) { - MALLOC(np->n_fhp, nfsfh_t *, fhsize, M_NFSBIGFH, 0); + MALLOC(np->n_fhp, nfsfh_t *, fhsize, M_NFSBIGFH, M_WAITOK); } else np->n_fhp = &np->n_fh; bcopy((caddr_t)fhp, (caddr_t)np->n_fhp, fhsize); diff --git a/sys/nfsclient/nfs_socket.c b/sys/nfsclient/nfs_socket.c index 12d78d61f2eb..612ed3329a61 100644 --- a/sys/nfsclient/nfs_socket.c +++ b/sys/nfsclient/nfs_socket.c @@ -525,7 +525,7 @@ nfs_receive(struct nfsreq *rep, struct sockaddr **aname, struct mbuf **mp) goto tryagain; } while (rep->r_flags & R_MUSTRESEND) { - m = m_copym(rep->r_mreq, 0, M_COPYALL, 0); + m = m_copym(rep->r_mreq, 0, M_COPYALL, M_TRYWAIT); nfsstats.rpcretries++; error = nfs_send(so, rep->r_nmp->nm_nam, m, rep); if (error) { @@ -864,7 +864,7 @@ nfs_request(struct vnode *vp, struct mbuf *mrest, int procnum, return (ESTALE); } nmp = VFSTONFS(vp->v_mount); - MALLOC(rep, struct nfsreq *, sizeof(struct nfsreq), M_NFSREQ, 0); + MALLOC(rep, struct nfsreq *, sizeof(struct nfsreq), M_NFSREQ, M_WAITOK); rep->r_nmp = nmp; rep->r_vp = vp; rep->r_td = td; @@ -887,7 +887,7 @@ nfs_request(struct vnode *vp, struct mbuf *mrest, int procnum, * For stream protocols, insert a Sun RPC Record Mark. */ if (nmp->nm_sotype == SOCK_STREAM) { - M_PREPEND(m, NFSX_UNSIGNED, 0); + M_PREPEND(m, NFSX_UNSIGNED, M_TRYWAIT); *mtod(m, u_int32_t *) = htonl(0x80000000 | (m->m_pkthdr.len - NFSX_UNSIGNED)); } @@ -928,7 +928,7 @@ nfs_request(struct vnode *vp, struct mbuf *mrest, int procnum, if (nmp->nm_soflags & PR_CONNREQUIRED) error = nfs_sndlock(rep); if (!error) { - m2 = m_copym(m, 0, M_COPYALL, 0); + m2 = m_copym(m, 0, M_COPYALL, M_TRYWAIT); error = nfs_send(nmp->nm_so, nmp->nm_nam, m2, rep); if (nmp->nm_soflags & PR_CONNREQUIRED) nfs_sndunlock(rep); @@ -1127,7 +1127,7 @@ nfs_timer(void *arg) ((nmp->nm_flag & NFSMNT_DUMBTIMR) || (rep->r_flags & R_SENT) || nmp->nm_sent < nmp->nm_cwnd) && - (m = m_copym(rep->r_mreq, 0, M_COPYALL, M_NOWAIT))){ + (m = m_copym(rep->r_mreq, 0, M_COPYALL, M_DONTWAIT))){ if ((nmp->nm_flag & NFSMNT_NOCONN) == 0) error = (*so->so_proto->pr_usrreqs->pru_send) (so, 0, m, NULL, NULL, td); @@ -1378,9 +1378,9 @@ nfs_realign(struct mbuf **pm, int hsiz) ++nfs_realign_test; while ((m = *pm) != NULL) { if ((m->m_len & 0x3) || (mtod(m, intptr_t) & 0x3)) { - MGET(n, 0, MT_DATA); + MGET(n, M_TRYWAIT, MT_DATA); if (m->m_len >= MINCLSIZE) { - MCLGET(n, 0); + MCLGET(n, M_TRYWAIT); } n->m_len = 0; break; diff --git a/sys/nfsclient/nfs_subs.c b/sys/nfsclient/nfs_subs.c index 178cbbb38c81..2318a044892f 100644 --- a/sys/nfsclient/nfs_subs.c +++ b/sys/nfsclient/nfs_subs.c @@ -142,9 +142,9 @@ nfsm_reqhead(struct vnode *vp, u_long procid, int hsiz) { struct mbuf *mb; - MGET(mb, 0, MT_DATA); + MGET(mb, M_TRYWAIT, MT_DATA); if (hsiz >= MINCLSIZE) - MCLGET(mb, 0); + MCLGET(mb, M_TRYWAIT); mb->m_len = 0; return (mb); } @@ -168,9 +168,9 @@ nfsm_rpchead(struct ucred *cr, int nmflag, int procid, int auth_type, int grpsiz, authsiz; authsiz = nfsm_rndup(auth_len); - MGETHDR(mb, 0, MT_DATA); + MGETHDR(mb, M_TRYWAIT, MT_DATA); if ((authsiz + 10 * NFSX_UNSIGNED) >= MINCLSIZE) { - MCLGET(mb, 0); + MCLGET(mb, M_TRYWAIT); } else if ((authsiz + 10 * NFSX_UNSIGNED) < MHLEN) { MH_ALIGN(mb, authsiz + 10 * NFSX_UNSIGNED); } else { @@ -271,9 +271,9 @@ nfsm_uiotombuf(struct uio *uiop, struct mbuf **mq, int siz, caddr_t *bpos) while (left > 0) { mlen = M_TRAILINGSPACE(mp); if (mlen == 0) { - MGET(mp, 0, MT_DATA); + MGET(mp, M_TRYWAIT, MT_DATA); if (clflg) - MCLGET(mp, 0); + MCLGET(mp, M_TRYWAIT); mp->m_len = 0; mp2->m_next = mp; mp2 = mp; @@ -304,7 +304,7 @@ nfsm_uiotombuf(struct uio *uiop, struct mbuf **mq, int siz, caddr_t *bpos) } if (rem > 0) { if (rem > M_TRAILINGSPACE(mp)) { - MGET(mp, 0, MT_DATA); + MGET(mp, M_TRYWAIT, MT_DATA); mp->m_len = 0; mp2->m_next = mp; } @@ -349,9 +349,9 @@ nfsm_strtmbuf(struct mbuf **mb, char **bpos, const char *cp, long siz) } /* Loop around adding mbufs */ while (siz > 0) { - MGET(m1, 0, MT_DATA); + MGET(m1, M_TRYWAIT, MT_DATA); if (siz > MLEN) - MCLGET(m1, 0); + MCLGET(m1, M_TRYWAIT); m1->m_len = NFSMSIZ(m1); m2->m_next = m1; m2 = m1; @@ -716,7 +716,7 @@ nfs_getcookie(struct nfsnode *np, off_t off, int add) if (!dp) { if (add) { MALLOC(dp, struct nfsdmap *, sizeof (struct nfsdmap), - M_NFSDIROFF, 0); + M_NFSDIROFF, M_WAITOK); dp->ndm_eocookie = 0; LIST_INSERT_HEAD(&np->n_cookies, dp, ndm_list); } else @@ -731,7 +731,7 @@ nfs_getcookie(struct nfsnode *np, off_t off, int add) dp = LIST_NEXT(dp, ndm_list); } else if (add) { MALLOC(dp2, struct nfsdmap *, sizeof (struct nfsdmap), - M_NFSDIROFF, 0); + M_NFSDIROFF, M_WAITOK); dp2->ndm_eocookie = 0; LIST_INSERT_AFTER(dp, dp2, ndm_list); dp = dp2; diff --git a/sys/nfsclient/nfs_vfsops.c b/sys/nfsclient/nfs_vfsops.c index 5d43af2465a1..cee1ec897f2c 100644 --- a/sys/nfsclient/nfs_vfsops.c +++ b/sys/nfsclient/nfs_vfsops.c @@ -823,7 +823,7 @@ mountnfs(struct nfs_args *argp, struct mount *mp, struct sockaddr *nam, FREE(nam, M_SONAME); return (0); } else { - nmp = uma_zalloc(nfsmount_zone, 0); + nmp = uma_zalloc(nfsmount_zone, M_WAITOK); bzero((caddr_t)nmp, sizeof (struct nfsmount)); TAILQ_INIT(&nmp->nm_bufq); mp->mnt_data = (qaddr_t)nmp; diff --git a/sys/nfsclient/nfs_vnops.c b/sys/nfsclient/nfs_vnops.c index f47d9da9435d..919f2a3394f2 100644 --- a/sys/nfsclient/nfs_vnops.c +++ b/sys/nfsclient/nfs_vnops.c @@ -404,7 +404,7 @@ nfs_access(struct vop_access_args *ap) error = nfs_readrpc(vp, &auio, ap->a_cred); else if (vp->v_type == VDIR) { char* bp; - bp = malloc(NFS_DIRBLKSIZ, M_TEMP, 0); + bp = malloc(NFS_DIRBLKSIZ, M_TEMP, M_WAITOK); aiov.iov_base = bp; aiov.iov_len = auio.uio_resid = NFS_DIRBLKSIZ; error = nfs_readdirrpc(vp, &auio, ap->a_cred); @@ -2370,7 +2370,7 @@ nfs_sillyrename(struct vnode *dvp, struct vnode *vp, struct componentname *cnp) panic("nfs: sillyrename dir"); #endif MALLOC(sp, struct sillyrename *, sizeof (struct sillyrename), - M_NFSREQ, 0); + M_NFSREQ, M_WAITOK); sp->s_cred = crhold(cnp->cn_cred); sp->s_dvp = dvp; VREF(dvp); @@ -2438,7 +2438,7 @@ nfs_lookitup(struct vnode *dvp, const char *name, int len, struct ucred *cred, free((caddr_t)np->n_fhp, M_NFSBIGFH); np->n_fhp = &np->n_fh; } else if (np->n_fhsize <= NFS_SMALLFH && fhlen>NFS_SMALLFH) - np->n_fhp =(nfsfh_t *)malloc(fhlen, M_NFSBIGFH, 0); + np->n_fhp =(nfsfh_t *)malloc(fhlen, M_NFSBIGFH, M_WAITOK); bcopy((caddr_t)nfhp, (caddr_t)np->n_fhp, fhlen); np->n_fhsize = fhlen; newvp = NFSTOV(np); diff --git a/sys/nfsserver/nfs_serv.c b/sys/nfsserver/nfs_serv.c index 322b1d4ee008..1d953cd564f6 100644 --- a/sys/nfsserver/nfs_serv.c +++ b/sys/nfsserver/nfs_serv.c @@ -656,8 +656,8 @@ nfsrv_readlink(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, len = 0; i = 0; while (len < NFS_MAXPATHLEN) { - MGET(nmp, 0, MT_DATA); - MCLGET(nmp, 0); + MGET(nmp, M_TRYWAIT, MT_DATA); + MCLGET(nmp, M_TRYWAIT); nmp->m_len = NFSMSIZ(nmp); if (len == 0) mp3 = mp = nmp; @@ -899,15 +899,15 @@ nfsrv_read(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, i++; } if (left > 0) { - MGET(m, 0, MT_DATA); - MCLGET(m, 0); + MGET(m, M_TRYWAIT, MT_DATA); + MCLGET(m, M_TRYWAIT); m->m_len = 0; m2->m_next = m; m2 = m; } } MALLOC(iv, struct iovec *, i * sizeof (struct iovec), - M_TEMP, 0); + M_TEMP, M_WAITOK); uiop->uio_iov = iv2 = iv; m = mb; left = len; @@ -1107,7 +1107,7 @@ nfsrv_write(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, if (len > 0) { MALLOC(ivp, struct iovec *, cnt * sizeof (struct iovec), M_TEMP, - 0); + M_WAITOK); uiop->uio_iov = iv = ivp; uiop->uio_iovcnt = cnt; mp = mrep; @@ -1404,7 +1404,7 @@ nfsrv_writegather(struct nfsrv_descript **ndp, struct nfssvc_sock *slp, } uiop->uio_iovcnt = i; MALLOC(iov, struct iovec *, i * sizeof (struct iovec), - M_TEMP, 0); + M_TEMP, M_WAITOK); uiop->uio_iov = ivp = iov; mp = mrep; while (mp) { @@ -2551,7 +2551,7 @@ nfsrv_symlink(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, if (v3) nfsm_srvsattr(vap); nfsm_srvpathsiz(len2); - MALLOC(pathcp, caddr_t, len2 + 1, M_TEMP, 0); + MALLOC(pathcp, caddr_t, len2 + 1, M_TEMP, M_WAITOK); iv.iov_base = pathcp; iv.iov_len = len2; io.uio_resid = len2; @@ -3059,7 +3059,7 @@ nfsrv_readdir(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, /* * end section. Allocate rbuf and continue */ - MALLOC(rbuf, caddr_t, siz, M_TEMP, 0); + MALLOC(rbuf, caddr_t, siz, M_TEMP, M_WAITOK); again: iv.iov_base = rbuf; iv.iov_len = fullsiz; @@ -3337,7 +3337,7 @@ nfsrv_readdirplus(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, goto nfsmout; } VOP_UNLOCK(vp, 0, td); - MALLOC(rbuf, caddr_t, siz, M_TEMP, 0); + MALLOC(rbuf, caddr_t, siz, M_TEMP, M_WAITOK); again: iv.iov_base = rbuf; iv.iov_len = fullsiz; diff --git a/sys/nfsserver/nfs_srvcache.c b/sys/nfsserver/nfs_srvcache.c index a9e84e921167..1986c0b62857 100644 --- a/sys/nfsserver/nfs_srvcache.c +++ b/sys/nfsserver/nfs_srvcache.c @@ -193,7 +193,7 @@ nfsrv_getcache(struct nfsrv_descript *nd, struct mbuf **repp) } else if (rp->rc_flag & RC_REPMBUF) { nfsrvstats.srvcache_nonidemdonehits++; *repp = m_copym(rp->rc_reply, 0, M_COPYALL, - 0); + M_TRYWAIT); ret = RC_REPLY; } else { nfsrvstats.srvcache_idemdonehits++; @@ -212,7 +212,7 @@ nfsrv_getcache(struct nfsrv_descript *nd, struct mbuf **repp) NFS_DPF(RC, ("M%03x", nd->nd_retxid & 0xfff)); if (numnfsrvcache < desirednfsrvcache) { rp = (struct nfsrvcache *)malloc((u_long)sizeof *rp, - M_NFSD, M_ZERO); + M_NFSD, M_WAITOK | M_ZERO); numnfsrvcache++; rp->rc_flag = RC_LOCKED; } else { @@ -303,7 +303,7 @@ nfsrv_updatecache(struct nfsrv_descript *nd, int repvalid, struct mbuf *repmbuf) rp->rc_flag |= RC_REPSTATUS; } else { rp->rc_reply = m_copym(repmbuf, - 0, M_COPYALL, 0); + 0, M_COPYALL, M_TRYWAIT); rp->rc_flag |= RC_REPMBUF; } } diff --git a/sys/nfsserver/nfs_srvsock.c b/sys/nfsserver/nfs_srvsock.c index e17e023e7af3..bf4e98566849 100644 --- a/sys/nfsserver/nfs_srvsock.c +++ b/sys/nfsserver/nfs_srvsock.c @@ -148,7 +148,7 @@ nfs_rephead(int siz, struct nfsrv_descript *nd, int err, nd->nd_repstat = err; if (err && (nd->nd_flag & ND_NFSV3) == 0) /* XXX recheck */ siz = 0; - MGETHDR(mreq, 0, MT_DATA); + MGETHDR(mreq, M_TRYWAIT, MT_DATA); mb = mreq; /* * If this is a big reply, use a cluster else @@ -157,7 +157,7 @@ nfs_rephead(int siz, struct nfsrv_descript *nd, int err, mreq->m_len = 6 * NFSX_UNSIGNED; siz += RPC_REPLYSIZ; if ((max_hdr + siz) >= MINCLSIZE) { - MCLGET(mreq, 0); + MCLGET(mreq, M_TRYWAIT); } else mreq->m_data += min(max_hdr, M_TRAILINGSPACE(mreq)); tl = mtod(mreq, u_int32_t *); @@ -244,9 +244,9 @@ nfs_realign(struct mbuf **pm, int hsiz) /* XXX COMMON */ ++nfs_realign_test; while ((m = *pm) != NULL) { if ((m->m_len & 0x3) || (mtod(m, intptr_t) & 0x3)) { - MGET(n, 0, MT_DATA); + MGET(n, M_TRYWAIT, MT_DATA); if (m->m_len >= MINCLSIZE) { - MCLGET(n, 0); + MCLGET(n, M_TRYWAIT); } n->m_len = 0; break; @@ -403,7 +403,7 @@ nfs_getreq(struct nfsrv_descript *nd, struct nfsd *nfsd, int has_header) * Socket upcall routine for the nfsd sockets. * The caddr_t arg is a pointer to the "struct nfssvc_sock". * Essentially do as much as possible non-blocking, else punt and it will - * be called without M_NOWAIT from an nfsd. + * be called with M_TRYWAIT from an nfsd. */ void nfsrv_rcv(struct socket *so, void *arg, int waitflag) @@ -421,7 +421,7 @@ nfsrv_rcv(struct socket *so, void *arg, int waitflag) /* * Define this to test for nfsds handling this under heavy load. */ - if (waitflag == M_NOWAIT) { + if (waitflag == M_DONTWAIT) { slp->ns_flag |= SLP_NEEDQ; goto dorecs; } @@ -433,7 +433,7 @@ nfsrv_rcv(struct socket *so, void *arg, int waitflag) * to an nfsd so that there is feedback to the TCP layer that * the nfs servers are heavily loaded. */ - if (STAILQ_FIRST(&slp->ns_rec) && waitflag == M_NOWAIT) { + if (STAILQ_FIRST(&slp->ns_rec) && waitflag == M_DONTWAIT) { slp->ns_flag |= SLP_NEEDQ; goto dorecs; } @@ -509,7 +509,7 @@ nfsrv_rcv(struct socket *so, void *arg, int waitflag) * Now try and process the request records, non-blocking. */ dorecs: - if (waitflag == M_NOWAIT && + if (waitflag == M_DONTWAIT && (STAILQ_FIRST(&slp->ns_rec) || (slp->ns_flag & (SLP_NEEDQ | SLP_DISCONN)))) nfsrv_wakenfsd(slp); @@ -667,7 +667,7 @@ nfsrv_dorec(struct nfssvc_sock *slp, struct nfsd *nfsd, m = rec->nr_packet; free(rec, M_NFSRVDESC); MALLOC(nd, struct nfsrv_descript *, sizeof (struct nfsrv_descript), - M_NFSRVDESC, 0); + M_NFSRVDESC, M_WAITOK); nd->nd_md = nd->nd_mrep = m; nd->nd_nam2 = nam; nd->nd_dpos = mtod(m, caddr_t); diff --git a/sys/nfsserver/nfs_srvsubs.c b/sys/nfsserver/nfs_srvsubs.c index 9ad6af12da67..5ac51ad7c1b6 100644 --- a/sys/nfsserver/nfs_srvsubs.c +++ b/sys/nfsserver/nfs_srvsubs.c @@ -605,7 +605,7 @@ nfs_namei(struct nameidata *ndp, fhandle_t *fhp, int len, *retdirp = NULL; cnp->cn_flags |= NOMACCHECK; - cnp->cn_pnbuf = uma_zalloc(namei_zone, 0); + cnp->cn_pnbuf = uma_zalloc(namei_zone, M_WAITOK); /* * Copy the name from the mbuf list to ndp->ni_pnbuf @@ -670,7 +670,7 @@ nfs_namei(struct nameidata *ndp, fhandle_t *fhp, int len, * Oh joy. For WebNFS, handle those pesky '%' escapes, * and the 'native path' indicator. */ - cp = uma_zalloc(namei_zone, 0); + cp = uma_zalloc(namei_zone, M_WAITOK); fromcp = cnp->cn_pnbuf; tocp = cp; if ((unsigned char)*fromcp >= WEBNFS_SPECCHAR_START) { @@ -779,7 +779,7 @@ nfs_namei(struct nameidata *ndp, fhandle_t *fhp, int len, goto badlink2; } if (ndp->ni_pathlen > 1) - cp = uma_zalloc(namei_zone, 0); + cp = uma_zalloc(namei_zone, M_WAITOK); else cp = cnp->cn_pnbuf; aiov.iov_base = cp; @@ -1287,8 +1287,8 @@ nfsm_clget_xx(u_int32_t **tl, struct mbuf *mb, struct mbuf **mp, if (*bp >= *be) { if (*mp == mb) (*mp)->m_len += *bp - bpos; - MGET(nmp, 0, MT_DATA); - MCLGET(nmp, 0); + MGET(nmp, M_TRYWAIT, MT_DATA); + MCLGET(nmp, M_TRYWAIT); nmp->m_len = NFSMSIZ(nmp); (*mp)->m_next = nmp; *mp = nmp; diff --git a/sys/nfsserver/nfs_syscalls.c b/sys/nfsserver/nfs_syscalls.c index b41a5f706a86..cf9bf90b5058 100644 --- a/sys/nfsserver/nfs_syscalls.c +++ b/sys/nfsserver/nfs_syscalls.c @@ -262,7 +262,7 @@ nfssvc_addsock(struct file *fp, struct sockaddr *mynam, struct thread *td) slp = (struct nfssvc_sock *) malloc(sizeof (struct nfssvc_sock), M_NFSSVC, - M_ZERO); + M_WAITOK | M_ZERO); STAILQ_INIT(&slp->ns_rec); TAILQ_INSERT_TAIL(&nfssvc_sockhead, slp, ns_chain); @@ -301,7 +301,7 @@ nfssvc_nfsd(struct thread *td) writes_todo = 0; #endif nfsd = (struct nfsd *) - malloc(sizeof (struct nfsd), M_NFSD, M_ZERO); + malloc(sizeof (struct nfsd), M_NFSD, M_WAITOK | M_ZERO); s = splnet(); nfsd->nfsd_td = td; TAILQ_INSERT_TAIL(&nfsd_head, nfsd, nfsd_chain); @@ -345,7 +345,7 @@ nfssvc_nfsd(struct thread *td) slp->ns_flag &= ~SLP_NEEDQ; (void) nfs_slplock(slp, 1); nfsrv_rcv(slp->ns_so, (caddr_t)slp, - 0); + M_TRYWAIT); nfs_slpunlock(slp); } error = nfsrv_dorec(slp, nfsd, &nd); @@ -471,7 +471,7 @@ nfssvc_nfsd(struct thread *td) * Record Mark. */ if (sotype == SOCK_STREAM) { - M_PREPEND(m, NFSX_UNSIGNED, 0); + M_PREPEND(m, NFSX_UNSIGNED, M_TRYWAIT); *mtod(m, u_int32_t *) = htonl(0x80000000 | siz); } if (slp->ns_so->so_proto->pr_flags & PR_CONNREQUIRED) @@ -671,12 +671,12 @@ nfsrv_init(int terminating) #if 0 nfs_udpsock = (struct nfssvc_sock *) - malloc(sizeof (struct nfssvc_sock), M_NFSSVC, M_ZERO); + malloc(sizeof (struct nfssvc_sock), M_NFSSVC, M_WAITOK | M_ZERO); STAILQ_INIT(&nfs_udpsock->ns_rec); TAILQ_INSERT_HEAD(&nfssvc_sockhead, nfs_udpsock, ns_chain); nfs_cltpsock = (struct nfssvc_sock *) - malloc(sizeof (struct nfssvc_sock), M_NFSSVC, M_ZERO); + malloc(sizeof (struct nfssvc_sock), M_NFSSVC, M_WAITOK | M_ZERO); STAILQ_INIT(&nfs_cltpsock->ns_rec); TAILQ_INSERT_TAIL(&nfssvc_sockhead, nfs_cltpsock, ns_chain); #endif diff --git a/sys/opencrypto/cryptodev.c b/sys/opencrypto/cryptodev.c index 1b8a3381775f..8b51d698a6c0 100644 --- a/sys/opencrypto/cryptodev.c +++ b/sys/opencrypto/cryptodev.c @@ -228,7 +228,7 @@ cryptof_ioctl( } MALLOC(crie.cri_key, u_int8_t *, - crie.cri_klen / 8, M_XDATA, 0); + crie.cri_klen / 8, M_XDATA, M_WAITOK); if ((error = copyin(sop->key, crie.cri_key, crie.cri_klen / 8))) goto bail; @@ -246,7 +246,7 @@ cryptof_ioctl( if (cria.cri_klen) { MALLOC(cria.cri_key, u_int8_t *, - cria.cri_klen / 8, M_XDATA, 0); + cria.cri_klen / 8, M_XDATA, M_WAITOK); if ((error = copyin(sop->mackey, cria.cri_key, cria.cri_klen / 8))) goto bail; @@ -332,7 +332,7 @@ cryptodev_op( cse->uio.uio_iov = cse->iovec; bzero(&cse->iovec, sizeof(cse->iovec)); cse->uio.uio_iov[0].iov_len = cop->len; - cse->uio.uio_iov[0].iov_base = malloc(cop->len, M_XDATA, 0); + cse->uio.uio_iov[0].iov_base = malloc(cop->len, M_XDATA, M_WAITOK); for (i = 0; i < cse->uio.uio_iovcnt; i++) cse->uio.uio_resid += cse->uio.uio_iov[0].iov_len; @@ -512,7 +512,7 @@ cryptodev_key(struct crypt_kop *kop) return (EINVAL); } - krp = (struct cryptkop *)malloc(sizeof *krp, M_XDATA, 0); + krp = (struct cryptkop *)malloc(sizeof *krp, M_XDATA, M_WAITOK); if (!krp) return (ENOMEM); bzero(krp, sizeof *krp); @@ -529,7 +529,7 @@ cryptodev_key(struct crypt_kop *kop) size = (krp->krp_param[i].crp_nbits + 7) / 8; if (size == 0) continue; - MALLOC(krp->krp_param[i].crp_p, caddr_t, size, M_XDATA, 0); + MALLOC(krp->krp_param[i].crp_p, caddr_t, size, M_XDATA, M_WAITOK); if (i >= krp->krp_iparams) continue; error = copyin(kop->crk_param[i].crp_p, krp->krp_param[i].crp_p, size); @@ -719,7 +719,7 @@ cryptoioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) switch (cmd) { case CRIOGET: MALLOC(fcr, struct fcrypt *, - sizeof(struct fcrypt), M_XDATA, 0); + sizeof(struct fcrypt), M_XDATA, M_WAITOK); TAILQ_INIT(&fcr->csessions); fcr->sesn = 0; diff --git a/sys/pc98/cbus/scvtb.c b/sys/pc98/cbus/scvtb.c index 05d5e5e33042..2d0ea3f03284 100644 --- a/sys/pc98/cbus/scvtb.c +++ b/sys/pc98/cbus/scvtb.c @@ -103,7 +103,7 @@ sc_vtb_init(sc_vtb_t *vtb, int type, int cols, int rows, void *buf, int wait) vtb->vtb_buffer = (vm_offset_t)malloc(cols*rows*sizeof(u_int16_t)*2, M_DEVBUF, - ((wait) ? 0 : M_NOWAIT) | M_ZERO); + ((wait) ? M_WAITOK : M_NOWAIT) | M_ZERO); if (vtb->vtb_buffer != 0) { vtb->vtb_flags |= VTB_ALLOCED; } diff --git a/sys/pc98/pc98/scvtbpc98.c b/sys/pc98/pc98/scvtbpc98.c index 05d5e5e33042..2d0ea3f03284 100644 --- a/sys/pc98/pc98/scvtbpc98.c +++ b/sys/pc98/pc98/scvtbpc98.c @@ -103,7 +103,7 @@ sc_vtb_init(sc_vtb_t *vtb, int type, int cols, int rows, void *buf, int wait) vtb->vtb_buffer = (vm_offset_t)malloc(cols*rows*sizeof(u_int16_t)*2, M_DEVBUF, - ((wait) ? 0 : M_NOWAIT) | M_ZERO); + ((wait) ? M_WAITOK : M_NOWAIT) | M_ZERO); if (vtb->vtb_buffer != 0) { vtb->vtb_flags |= VTB_ALLOCED; } diff --git a/sys/pc98/pc98/spkr.c b/sys/pc98/pc98/spkr.c index db60e82890c6..3e3f43767dd3 100644 --- a/sys/pc98/pc98/spkr.c +++ b/sys/pc98/pc98/spkr.c @@ -503,7 +503,7 @@ spkropen(dev, flags, fmt, td) (void) printf("spkropen: about to perform play initialization\n"); #endif /* DEBUG */ playinit(); - spkr_inbuf = malloc(DEV_BSIZE, M_SPKR, 0); + spkr_inbuf = malloc(DEV_BSIZE, M_SPKR, M_WAITOK); spkr_active = TRUE; return(0); } diff --git a/sys/pc98/pc98/syscons.c b/sys/pc98/pc98/syscons.c index 847ec74954ca..55ce644e24c6 100644 --- a/sys/pc98/pc98/syscons.c +++ b/sys/pc98/pc98/syscons.c @@ -315,7 +315,7 @@ sc_attach_unit(int unit, int flags) /* assert(sc_console->ts != NULL); */ kernel_console_ts = sc_console->ts; sc_console->ts = malloc(sc_console->tsw->te_size, - M_DEVBUF, 0); + M_DEVBUF, M_WAITOK); bcopy(kernel_console_ts, sc_console->ts, sc_console->tsw->te_size); (*sc_console->tsw->te_default_attr)(sc_console, user_default.std_color, @@ -2696,9 +2696,9 @@ scinit(int unit, int flags) sc->font_16 = font_16; } else if (sc->font_8 == NULL) { /* assert(sc_malloc) */ - sc->font_8 = malloc(sizeof(font_8), M_DEVBUF, 0); - sc->font_14 = malloc(sizeof(font_14), M_DEVBUF, 0); - sc->font_16 = malloc(sizeof(font_16), M_DEVBUF, 0); + sc->font_8 = malloc(sizeof(font_8), M_DEVBUF, M_WAITOK); + sc->font_14 = malloc(sizeof(font_14), M_DEVBUF, M_WAITOK); + sc->font_16 = malloc(sizeof(font_16), M_DEVBUF, M_WAITOK); } #endif @@ -2725,7 +2725,7 @@ scinit(int unit, int flags) kernel_default.rev_color); } else { /* assert(sc_malloc) */ - sc->dev = malloc(sizeof(dev_t)*sc->vtys, M_DEVBUF, M_ZERO); + sc->dev = malloc(sizeof(dev_t)*sc->vtys, M_DEVBUF, M_WAITOK|M_ZERO); sc->dev[0] = makedev(CDEV_MAJOR, unit*MAXCONS); sc->dev[0]->si_tty = ttymalloc(sc->dev[0]->si_tty); scp = alloc_scp(sc, sc->first_vty); @@ -2945,7 +2945,7 @@ static scr_stat /* assert(sc_malloc) */ - scp = (scr_stat *)malloc(sizeof(scr_stat), M_DEVBUF, 0); + scp = (scr_stat *)malloc(sizeof(scr_stat), M_DEVBUF, M_WAITOK); init_scp(sc, vty, scp); sc_alloc_scr_buffer(scp, TRUE, TRUE); diff --git a/sys/pccard/pccard.c b/sys/pccard/pccard.c index 17e8e9bd5b47..1baabf4152cc 100644 --- a/sys/pccard/pccard.c +++ b/sys/pccard/pccard.c @@ -214,7 +214,7 @@ allocate_driver(struct slot *slt, struct dev_desc *desc) } irq = ffs(desc->irqmask) - 1; MALLOC(devi, struct pccard_devinfo *, sizeof(*devi), M_DEVBUF, - M_ZERO); + M_WAITOK | M_ZERO); strcpy(devi->name, desc->name); /* * Create an entry for the device under this slot. diff --git a/sys/pci/agp.c b/sys/pci/agp.c index 293011c26245..f8210267ccba 100644 --- a/sys/pci/agp.c +++ b/sys/pci/agp.c @@ -357,7 +357,7 @@ agp_generic_alloc_memory(device_t dev, int type, vm_size_t size) return 0; } - mem = malloc(sizeof *mem, M_AGP, 0); + mem = malloc(sizeof *mem, M_AGP, M_WAITOK); mem->am_id = sc->as_nextid++; mem->am_size = size; mem->am_type = 0; diff --git a/sys/pci/agp_i810.c b/sys/pci/agp_i810.c index 7590c501fe09..39890ac4cd64 100644 --- a/sys/pci/agp_i810.c +++ b/sys/pci/agp_i810.c @@ -567,7 +567,7 @@ agp_i810_alloc_memory(device_t dev, int type, vm_size_t size) return 0; } - mem = malloc(sizeof *mem, M_AGP, 0); + mem = malloc(sizeof *mem, M_AGP, M_WAITOK); mem->am_id = sc->agp.as_nextid++; mem->am_size = size; mem->am_type = type; diff --git a/sys/pci/if_dc.c b/sys/pci/if_dc.c index 0fb625d83621..1570ea452602 100644 --- a/sys/pci/if_dc.c +++ b/sys/pci/if_dc.c @@ -2428,11 +2428,11 @@ dc_newbuf(sc, i, m) c = &sc->dc_ldata->dc_rx_list[i]; if (m == NULL) { - MGETHDR(m_new, M_NOWAIT, MT_DATA); + MGETHDR(m_new, M_DONTWAIT, MT_DATA); if (m_new == NULL) return(ENOBUFS); - MCLGET(m_new, M_NOWAIT); + MCLGET(m_new, M_DONTWAIT); if (!(m_new->m_flags & M_EXT)) { m_freem(m_new); return(ENOBUFS); @@ -3192,11 +3192,11 @@ dc_coal(sc, m_head) struct mbuf *m_new, *m; m = *m_head; - MGETHDR(m_new, M_NOWAIT, MT_DATA); + MGETHDR(m_new, M_DONTWAIT, MT_DATA); if (m_new == NULL) return(ENOBUFS); if (m->m_pkthdr.len > MHLEN) { - MCLGET(m_new, M_NOWAIT); + MCLGET(m_new, M_DONTWAIT); if (!(m_new->m_flags & M_EXT)) { m_freem(m_new); return(ENOBUFS); diff --git a/sys/pci/if_de.c b/sys/pci/if_de.c index 9e1e319b2f2b..d1865865a099 100644 --- a/sys/pci/if_de.c +++ b/sys/pci/if_de.c @@ -195,7 +195,7 @@ tulip_txprobe( * either is connected so the transmit is the only way * to verify the connectivity. */ - MGETHDR(m, M_NOWAIT, MT_DATA); + MGETHDR(m, M_DONTWAIT, MT_DATA); if (m == NULL) return 0; /* @@ -3545,12 +3545,12 @@ tulip_rx_intr( */ if (accept || ms == NULL) { struct mbuf *m0; - MGETHDR(m0, M_NOWAIT, MT_DATA); + MGETHDR(m0, M_DONTWAIT, MT_DATA); if (m0 != NULL) { #if defined(TULIP_COPY_RXDATA) if (!accept || total_len >= (MHLEN - 2)) { #endif - MCLGET(m0, M_NOWAIT); + MCLGET(m0, M_DONTWAIT); if ((m0->m_flags & M_EXT) == 0) { m_freem(m0); m0 = NULL; @@ -4061,10 +4061,10 @@ tulip_mbuf_compress( { struct mbuf *m0; #if MCLBYTES >= ETHERMTU + 18 && !defined(BIG_PACKET) - MGETHDR(m0, M_NOWAIT, MT_DATA); + MGETHDR(m0, M_DONTWAIT, MT_DATA); if (m0 != NULL) { if (m->m_pkthdr.len > MHLEN) { - MCLGET(m0, M_NOWAIT); + MCLGET(m0, M_DONTWAIT); if ((m0->m_flags & M_EXT) == 0) { m_freem(m); m_freem(m0); @@ -4081,9 +4081,9 @@ tulip_mbuf_compress( while (len > 0) { if (mlen == MHLEN) { - MGETHDR(*mp, M_NOWAIT, MT_DATA); + MGETHDR(*mp, M_DONTWAIT, MT_DATA); } else { - MGET(*mp, M_NOWAIT, MT_DATA); + MGET(*mp, M_DONTWAIT, MT_DATA); } if (*mp == NULL) { m_freem(m0); @@ -4091,7 +4091,7 @@ tulip_mbuf_compress( break; } if (len > MLEN) { - MCLGET(*mp, M_NOWAIT); + MCLGET(*mp, M_DONTWAIT); if (((*mp)->m_flags & M_EXT) == 0) { m_freem(m0); m0 = NULL; diff --git a/sys/pci/if_mn.c b/sys/pci/if_mn.c index 7ed07d112edd..b809d6bf8961 100644 --- a/sys/pci/if_mn.c +++ b/sys/pci/if_mn.c @@ -695,7 +695,7 @@ ngmn_connect(hook_p hook) /* Setup a transmit chain with one descriptor */ /* XXX: we actually send a 1 byte packet */ dp = mn_alloc_desc(); - MGETHDR(m, 0, MT_DATA); + MGETHDR(m, M_TRYWAIT, MT_DATA); if (m == NULL) return ENOBUFS; m->m_pkthdr.len = 0; @@ -712,12 +712,12 @@ ngmn_connect(hook_p hook) dp = mn_alloc_desc(); m = NULL; - MGETHDR(m, 0, MT_DATA); + MGETHDR(m, M_TRYWAIT, MT_DATA); if (m == NULL) { mn_free_desc(dp); return (ENOBUFS); } - MCLGET(m, 0); + MCLGET(m, M_TRYWAIT); if ((m->m_flags & M_EXT) == 0) { mn_free_desc(dp); m_freem(m); @@ -735,13 +735,13 @@ ngmn_connect(hook_p hook) dp2 = dp; dp = mn_alloc_desc(); m = NULL; - MGETHDR(m, 0, MT_DATA); + MGETHDR(m, M_TRYWAIT, MT_DATA); if (m == NULL) { mn_free_desc(dp); m_freem(m); return (ENOBUFS); } - MCLGET(m, 0); + MCLGET(m, M_TRYWAIT); if ((m->m_flags & M_EXT) == 0) { mn_free_desc(dp); m_freem(m); @@ -839,7 +839,7 @@ mn_create_channel(struct mn_softc *sc, int chan) struct schan *sch; sch = sc->ch[chan] = (struct schan *)malloc(sizeof *sc->ch[chan], - M_MN, M_ZERO); + M_MN, M_WAITOK | M_ZERO); sch->sc = sc; sch->state = DOWN; sch->chan = chan; @@ -1183,12 +1183,12 @@ mn_rx_intr(struct mn_softc *sc, u_int32_t vector) /* Replenish desc + mbuf supplies */ if (!m) { - MGETHDR(m, M_NOWAIT, MT_DATA); + MGETHDR(m, M_DONTWAIT, MT_DATA); if (m == NULL) { mn_free_desc(dp); return; /* ENOBUFS */ } - MCLGET(m, M_NOWAIT); + MCLGET(m, M_DONTWAIT); if((m->m_flags & M_EXT) == 0) { mn_free_desc(dp); m_freem(m); @@ -1340,7 +1340,7 @@ mn_attach (device_t self) once++; } - sc = (struct mn_softc *)malloc(sizeof *sc, M_MN, M_ZERO); + sc = (struct mn_softc *)malloc(sizeof *sc, M_MN, M_WAITOK | M_ZERO); device_set_softc(self, sc); sc->dev = self; diff --git a/sys/pci/if_pcn.c b/sys/pci/if_pcn.c index 1bb5d1854155..c9f961b5e5eb 100644 --- a/sys/pci/if_pcn.c +++ b/sys/pci/if_pcn.c @@ -775,11 +775,11 @@ pcn_newbuf(sc, idx, m) c = &sc->pcn_ldata->pcn_rx_list[idx]; if (m == NULL) { - MGETHDR(m_new, M_NOWAIT, MT_DATA); + MGETHDR(m_new, M_DONTWAIT, MT_DATA); if (m_new == NULL) return(ENOBUFS); - MCLGET(m_new, M_NOWAIT); + MCLGET(m_new, M_DONTWAIT); if (!(m_new->m_flags & M_EXT)) { m_freem(m_new); return(ENOBUFS); diff --git a/sys/pci/if_rl.c b/sys/pci/if_rl.c index 39cc6e87306d..341770f41586 100644 --- a/sys/pci/if_rl.c +++ b/sys/pci/if_rl.c @@ -1500,11 +1500,11 @@ rl_encap(sc, m_head) * per packet. We have to copy pretty much all the time. */ - MGETHDR(m_new, M_NOWAIT, MT_DATA); + MGETHDR(m_new, M_DONTWAIT, MT_DATA); if (m_new == NULL) return(1); if (m_head->m_pkthdr.len > MHLEN) { - MCLGET(m_new, M_NOWAIT); + MCLGET(m_new, M_DONTWAIT); if (!(m_new->m_flags & M_EXT)) { m_freem(m_new); return(1); diff --git a/sys/pci/if_sf.c b/sys/pci/if_sf.c index 7b63a0120518..a148ba575862 100644 --- a/sys/pci/if_sf.c +++ b/sys/pci/if_sf.c @@ -924,11 +924,11 @@ sf_newbuf(sc, c, m) struct mbuf *m_new = NULL; if (m == NULL) { - MGETHDR(m_new, M_NOWAIT, MT_DATA); + MGETHDR(m_new, M_DONTWAIT, MT_DATA); if (m_new == NULL) return(ENOBUFS); - MCLGET(m_new, M_NOWAIT); + MCLGET(m_new, M_DONTWAIT); if (!(m_new->m_flags & M_EXT)) { m_freem(m_new); return(ENOBUFS); @@ -1304,14 +1304,14 @@ sf_encap(sc, c, m_head) if (m != NULL) { struct mbuf *m_new = NULL; - MGETHDR(m_new, M_NOWAIT, MT_DATA); + MGETHDR(m_new, M_DONTWAIT, MT_DATA); if (m_new == NULL) { printf("sf%d: no memory for tx list\n", sc->sf_unit); return(1); } if (m_head->m_pkthdr.len > MHLEN) { - MCLGET(m_new, M_NOWAIT); + MCLGET(m_new, M_DONTWAIT); if (!(m_new->m_flags & M_EXT)) { m_freem(m_new); printf("sf%d: no memory for tx list\n", diff --git a/sys/pci/if_sis.c b/sys/pci/if_sis.c index 3be4b3cfc930..7f72c39f4d3f 100644 --- a/sys/pci/if_sis.c +++ b/sys/pci/if_sis.c @@ -1544,7 +1544,7 @@ sis_newbuf(sc, c, m) return(EINVAL); if (m == NULL) { - m = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR); + m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); if (m == NULL) return(ENOBUFS); } else diff --git a/sys/pci/if_sk.c b/sys/pci/if_sk.c index 3aa40e797070..e58d1c4f2803 100644 --- a/sys/pci/if_sk.c +++ b/sys/pci/if_sk.c @@ -688,7 +688,7 @@ sk_newbuf(sc_if, c, m) if (m == NULL) { caddr_t *buf = NULL; - MGETHDR(m_new, M_NOWAIT, MT_DATA); + MGETHDR(m_new, M_DONTWAIT, MT_DATA); if (m_new == NULL) return(ENOBUFS); diff --git a/sys/pci/if_ste.c b/sys/pci/if_ste.c index 4e5e9b77f83d..370b0f52ae7a 100644 --- a/sys/pci/if_ste.c +++ b/sys/pci/if_ste.c @@ -1142,10 +1142,10 @@ ste_newbuf(sc, c, m) struct mbuf *m_new = NULL; if (m == NULL) { - MGETHDR(m_new, M_NOWAIT, MT_DATA); + MGETHDR(m_new, M_DONTWAIT, MT_DATA); if (m_new == NULL) return(ENOBUFS); - MCLGET(m_new, M_NOWAIT); + MCLGET(m_new, M_DONTWAIT); if (!(m_new->m_flags & M_EXT)) { m_freem(m_new); return(ENOBUFS); @@ -1519,13 +1519,13 @@ ste_encap(sc, c, m_head) * mbuf chain first. Bail out if we can't get the * new buffers. Code borrowed from if_fxp.c */ - MGETHDR(mn, M_NOWAIT, MT_DATA); + MGETHDR(mn, M_DONTWAIT, MT_DATA); if (mn == NULL) { m_freem(m_head); return ENOMEM; } if (m_head->m_pkthdr.len > MHLEN) { - MCLGET(mn, M_NOWAIT); + MCLGET(mn, M_DONTWAIT); if ((mn->m_flags & M_EXT) == 0) { m_freem(mn); m_freem(m_head); diff --git a/sys/pci/if_ti.c b/sys/pci/if_ti.c index 894ac43559a5..a3843223270e 100644 --- a/sys/pci/if_ti.c +++ b/sys/pci/if_ti.c @@ -1130,11 +1130,11 @@ ti_newbuf_std(sc, i, m) struct ti_rx_desc *r; if (m == NULL) { - MGETHDR(m_new, M_NOWAIT, MT_DATA); + MGETHDR(m_new, M_DONTWAIT, MT_DATA); if (m_new == NULL) return(ENOBUFS); - MCLGET(m_new, M_NOWAIT); + MCLGET(m_new, M_DONTWAIT); if (!(m_new->m_flags & M_EXT)) { m_freem(m_new); return(ENOBUFS); @@ -1174,7 +1174,7 @@ ti_newbuf_mini(sc, i, m) struct ti_rx_desc *r; if (m == NULL) { - MGETHDR(m_new, M_NOWAIT, MT_DATA); + MGETHDR(m_new, M_DONTWAIT, MT_DATA); if (m_new == NULL) { return(ENOBUFS); } @@ -1218,7 +1218,7 @@ ti_newbuf_jumbo(sc, i, m) caddr_t *buf = NULL; /* Allocate the mbuf. */ - MGETHDR(m_new, M_NOWAIT, MT_DATA); + MGETHDR(m_new, M_DONTWAIT, MT_DATA); if (m_new == NULL) { return(ENOBUFS); } @@ -1300,19 +1300,19 @@ ti_newbuf_jumbo(sc, idx, m_old) } } else { /* Allocate the mbufs. */ - MGETHDR(m_new, M_NOWAIT, MT_DATA); + MGETHDR(m_new, M_DONTWAIT, MT_DATA); if (m_new == NULL) { printf("ti%d: mbuf allocation failed " "-- packet dropped!\n", sc->ti_unit); goto nobufs; } - MGET(m[NPAYLOAD], M_NOWAIT, MT_DATA); + MGET(m[NPAYLOAD], M_DONTWAIT, MT_DATA); if (m[NPAYLOAD] == NULL) { printf("ti%d: cluster mbuf allocation failed " "-- packet dropped!\n", sc->ti_unit); goto nobufs; } - MCLGET(m[NPAYLOAD], M_NOWAIT); + MCLGET(m[NPAYLOAD], M_DONTWAIT); if ((m[NPAYLOAD]->m_flags & M_EXT) == 0) { printf("ti%d: mbuf allocation failed " "-- packet dropped!\n", sc->ti_unit); @@ -1321,7 +1321,7 @@ ti_newbuf_jumbo(sc, idx, m_old) m[NPAYLOAD]->m_len = MCLBYTES; for (i = 0; i < NPAYLOAD; i++){ - MGET(m[i], M_NOWAIT, MT_DATA); + MGET(m[i], M_DONTWAIT, MT_DATA); if (m[i] == NULL) { printf("ti%d: mbuf allocation failed " "-- packet dropped!\n", sc->ti_unit); diff --git a/sys/pci/if_tl.c b/sys/pci/if_tl.c index 682bbef236f0..0fc990abe644 100644 --- a/sys/pci/if_tl.c +++ b/sys/pci/if_tl.c @@ -1459,11 +1459,11 @@ tl_newbuf(sc, c) { struct mbuf *m_new = NULL; - MGETHDR(m_new, M_NOWAIT, MT_DATA); + MGETHDR(m_new, M_DONTWAIT, MT_DATA); if (m_new == NULL) return(ENOBUFS); - MCLGET(m_new, M_NOWAIT); + MCLGET(m_new, M_DONTWAIT); if (!(m_new->m_flags & M_EXT)) { m_freem(m_new); return(ENOBUFS); @@ -1909,13 +1909,13 @@ tl_encap(sc, c, m_head) if (m != NULL) { struct mbuf *m_new = NULL; - MGETHDR(m_new, M_NOWAIT, MT_DATA); + MGETHDR(m_new, M_DONTWAIT, MT_DATA); if (m_new == NULL) { if_printf(ifp, "no memory for tx list\n"); return(1); } if (m_head->m_pkthdr.len > MHLEN) { - MCLGET(m_new, M_NOWAIT); + MCLGET(m_new, M_DONTWAIT); if (!(m_new->m_flags & M_EXT)) { m_freem(m_new); if_printf(ifp, "no memory for tx list\n"); diff --git a/sys/pci/if_vr.c b/sys/pci/if_vr.c index b6d472d622da..95e4670835a1 100644 --- a/sys/pci/if_vr.c +++ b/sys/pci/if_vr.c @@ -1041,11 +1041,11 @@ vr_newbuf(sc, c, m) struct mbuf *m_new = NULL; if (m == NULL) { - MGETHDR(m_new, M_NOWAIT, MT_DATA); + MGETHDR(m_new, M_DONTWAIT, MT_DATA); if (m_new == NULL) return(ENOBUFS); - MCLGET(m_new, M_NOWAIT); + MCLGET(m_new, M_DONTWAIT); if (!(m_new->m_flags & M_EXT)) { m_freem(m_new); return(ENOBUFS); @@ -1423,13 +1423,13 @@ vr_encap(sc, c, m_head) if (m != NULL) { struct mbuf *m_new = NULL; - MGETHDR(m_new, M_NOWAIT, MT_DATA); + MGETHDR(m_new, M_DONTWAIT, MT_DATA); if (m_new == NULL) { printf("vr%d: no memory for tx list\n", sc->vr_unit); return(1); } if (m_head->m_pkthdr.len > MHLEN) { - MCLGET(m_new, M_NOWAIT); + MCLGET(m_new, M_DONTWAIT); if (!(m_new->m_flags & M_EXT)) { m_freem(m_new); printf("vr%d: no memory for tx list\n", diff --git a/sys/pci/if_wb.c b/sys/pci/if_wb.c index 0ceaecbb7938..30618af8cc70 100644 --- a/sys/pci/if_wb.c +++ b/sys/pci/if_wb.c @@ -1112,7 +1112,7 @@ wb_newbuf(sc, c, m) struct mbuf *m_new = NULL; if (m == NULL) { - MGETHDR(m_new, M_NOWAIT, MT_DATA); + MGETHDR(m_new, M_DONTWAIT, MT_DATA); if (m_new == NULL) return(ENOBUFS); m_new->m_data = c->wb_buf; @@ -1467,11 +1467,11 @@ wb_encap(sc, c, m_head) if (m != NULL) { struct mbuf *m_new = NULL; - MGETHDR(m_new, M_NOWAIT, MT_DATA); + MGETHDR(m_new, M_DONTWAIT, MT_DATA); if (m_new == NULL) return(1); if (m_head->m_pkthdr.len > MHLEN) { - MCLGET(m_new, M_NOWAIT); + MCLGET(m_new, M_DONTWAIT); if (!(m_new->m_flags & M_EXT)) { m_freem(m_new); return(1); diff --git a/sys/pci/if_xl.c b/sys/pci/if_xl.c index c26718874dde..e4c7ad60aba0 100644 --- a/sys/pci/if_xl.c +++ b/sys/pci/if_xl.c @@ -930,7 +930,7 @@ xl_testpacket(sc) ifp = &sc->arpcom.ac_if; - MGETHDR(m, M_NOWAIT, MT_DATA); + MGETHDR(m, M_DONTWAIT, MT_DATA); if (m == NULL) return; @@ -1937,11 +1937,11 @@ xl_newbuf(sc, c) int error; u_int32_t baddr; - MGETHDR(m_new, M_NOWAIT, MT_DATA); + MGETHDR(m_new, M_DONTWAIT, MT_DATA); if (m_new == NULL) return(ENOBUFS); - MCLGET(m_new, M_NOWAIT); + MCLGET(m_new, M_DONTWAIT); if (!(m_new->m_flags & M_EXT)) { m_freem(m_new); return(ENOBUFS); @@ -2441,14 +2441,14 @@ xl_encap(sc, c, m_head) if (error) { struct mbuf *m_new = NULL; - MGETHDR(m_new, M_NOWAIT, MT_DATA); + MGETHDR(m_new, M_DONTWAIT, MT_DATA); if (m_new == NULL) { m_freem(m_head); printf("xl%d: no memory for tx list\n", sc->xl_unit); return(1); } if (m_head->m_pkthdr.len > MHLEN) { - MCLGET(m_new, M_NOWAIT); + MCLGET(m_new, M_DONTWAIT); if (!(m_new->m_flags & M_EXT)) { m_freem(m_new); m_freem(m_head); diff --git a/sys/pci/ncr.c b/sys/pci/ncr.c index e91a39281258..bd7b5c318cd3 100644 --- a/sys/pci/ncr.c +++ b/sys/pci/ncr.c @@ -3602,7 +3602,7 @@ ncr_attach (device_t dev) 0, 0xffffffff, PAGE_SIZE); } else { np->script = (struct script *) - malloc (sizeof (struct script), M_DEVBUF, 0); + malloc (sizeof (struct script), M_DEVBUF, M_WAITOK); } /* XXX JGibbs - Use contigmalloc */ @@ -3613,7 +3613,7 @@ ncr_attach (device_t dev) } else { np->scripth = (struct scripth *) - malloc (sizeof (struct scripth), M_DEVBUF, 0); + malloc (sizeof (struct scripth), M_DEVBUF, M_WAITOK); } #ifdef SCSI_NCR_PCI_CONFIG_FIXUP diff --git a/sys/pci/simos.c b/sys/pci/simos.c index 6b865dda828f..040e042c4fe3 100644 --- a/sys/pci/simos.c +++ b/sys/pci/simos.c @@ -111,7 +111,7 @@ simos_attach(pcici_t config_id, int unit) struct simos_softc* sc; struct cam_devq *devq; - sc = malloc(sizeof(struct simos_softc), M_DEVBUF, M_ZERO); + sc = malloc(sizeof(struct simos_softc), M_DEVBUF, M_WAITOK | M_ZERO); simosp[unit] = sc; sc->sc_unit = unit; diff --git a/sys/pci/xrpu.c b/sys/pci/xrpu.c index 7afa22c242ec..dc218965c189 100644 --- a/sys/pci/xrpu.c +++ b/sys/pci/xrpu.c @@ -164,7 +164,7 @@ xrpu_ioctl(dev_t dev, u_long cmd, caddr_t arg, int flag, struct thread *tdr) /* Name SHALL be zero terminated */ xt->xt_name[sizeof xt->xt_name - 1] = '\0'; i = strlen(xt->xt_name); - sc->tc.tc_name = (char *)malloc(i + 1, M_XRPU, 0); + sc->tc.tc_name = (char *)malloc(i + 1, M_XRPU, M_WAITOK); strcpy(sc->tc.tc_name, xt->xt_name); sc->tc.tc_frequency = xt->xt_frequency; sc->tc.tc_get_timecount = xrpu_get_timecount; diff --git a/sys/posix4/posix4.h b/sys/posix4/posix4.h index 033c1ec46f1b..b17e9270e675 100644 --- a/sys/posix4/posix4.h +++ b/sys/posix4/posix4.h @@ -56,7 +56,7 @@ int SC (struct thread *td, struct SC##_args *uap) \ MALLOC_DECLARE(M_P31B); -#define p31b_malloc(SIZE) malloc((SIZE), M_P31B, 0) +#define p31b_malloc(SIZE) malloc((SIZE), M_P31B, M_WAITOK) #define p31b_free(P) free((P), M_P31B) int p31b_proc(struct proc *, pid_t, struct proc **); diff --git a/sys/powerpc/aim/nexus.c b/sys/powerpc/aim/nexus.c index 7172962c61d1..7472bbeac881 100644 --- a/sys/powerpc/aim/nexus.c +++ b/sys/powerpc/aim/nexus.c @@ -392,7 +392,7 @@ create_device_from_node(device_t parent, phandle_t node) OF_getprop_alloc(node, "compatible", 1, (void **)&compatible); cdev = device_add_child(parent, NULL, -1); if (cdev != NULL) { - dinfo = malloc(sizeof(*dinfo), M_NEXUS, 0); + dinfo = malloc(sizeof(*dinfo), M_NEXUS, M_WAITOK); dinfo->ndi_node = node; dinfo->ndi_name = name; dinfo->ndi_device_type = type; diff --git a/sys/powerpc/powermac/macio.c b/sys/powerpc/powermac/macio.c index 0497ff46f4df..016643e9431c 100644 --- a/sys/powerpc/powermac/macio.c +++ b/sys/powerpc/powermac/macio.c @@ -280,7 +280,7 @@ macio_attach(device_t dev) cdev = device_add_child(dev, NULL, -1); if (cdev != NULL) { - dinfo = malloc(sizeof(*dinfo), M_MACIO, 0); + dinfo = malloc(sizeof(*dinfo), M_MACIO, M_WAITOK); memset(dinfo, 0, sizeof(*dinfo)); resource_list_init(&dinfo->mdi_resources); dinfo->mdi_node = child; diff --git a/sys/powerpc/powerpc/busdma_machdep.c b/sys/powerpc/powerpc/busdma_machdep.c index 6ab1667af103..b7ff1de17c0e 100644 --- a/sys/powerpc/powerpc/busdma_machdep.c +++ b/sys/powerpc/powerpc/busdma_machdep.c @@ -210,7 +210,7 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddr, int flags, if (dmat->maxsize <= PAGE_SIZE) { *vaddr = malloc(dmat->maxsize, M_DEVBUF, - (flags & BUS_DMA_NOWAIT) ? M_NOWAIT : 0); + (flags & BUS_DMA_NOWAIT) ? M_NOWAIT : M_WAITOK); } else { /* * XXX Use Contigmalloc until it is merged into this facility @@ -218,7 +218,7 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddr, int flags, * multi-seg allocations yet though. */ *vaddr = contigmalloc(dmat->maxsize, M_DEVBUF, - (flags & BUS_DMA_NOWAIT) ? M_NOWAIT : 0, + (flags & BUS_DMA_NOWAIT) ? M_NOWAIT : M_WAITOK, 0ul, dmat->lowaddr, dmat->alignment? dmat->alignment : 1ul, dmat->boundary); } diff --git a/sys/powerpc/powerpc/extintr.c b/sys/powerpc/powerpc/extintr.c index 345c593f73fd..48e893dbf5fd 100644 --- a/sys/powerpc/powerpc/extintr.c +++ b/sys/powerpc/powerpc/extintr.c @@ -452,7 +452,7 @@ intr_establish(int irq, int type, int level, int (*ih_fun)(void *), irq = mapirq(irq); /* no point in sleeping unless someone can free memory. */ - ih = malloc(sizeof *ih, M_DEVBUF, cold ? M_NOWAIT : 0); + ih = malloc(sizeof *ih, M_DEVBUF, cold ? M_NOWAIT : M_WAITOK); if (ih == NULL) panic("intr_establish: can't malloc handler info"); diff --git a/sys/powerpc/powerpc/nexus.c b/sys/powerpc/powerpc/nexus.c index 7172962c61d1..7472bbeac881 100644 --- a/sys/powerpc/powerpc/nexus.c +++ b/sys/powerpc/powerpc/nexus.c @@ -392,7 +392,7 @@ create_device_from_node(device_t parent, phandle_t node) OF_getprop_alloc(node, "compatible", 1, (void **)&compatible); cdev = device_add_child(parent, NULL, -1); if (cdev != NULL) { - dinfo = malloc(sizeof(*dinfo), M_NEXUS, 0); + dinfo = malloc(sizeof(*dinfo), M_NEXUS, M_WAITOK); dinfo->ndi_node = node; dinfo->ndi_name = name; dinfo->ndi_device_type = type; diff --git a/sys/powerpc/psim/iobus.c b/sys/powerpc/psim/iobus.c index 21534b3f9479..3428125835b6 100644 --- a/sys/powerpc/psim/iobus.c +++ b/sys/powerpc/psim/iobus.c @@ -215,7 +215,7 @@ iobus_attach(device_t dev) cdev = device_add_child(dev, NULL, -1); if (cdev != NULL) { - dinfo = malloc(sizeof(*dinfo), M_IOBUS, 0); + dinfo = malloc(sizeof(*dinfo), M_IOBUS, M_WAITOK); memset(dinfo, 0, sizeof(*dinfo)); resource_list_init(&dinfo->id_resources); dinfo->id_node = child; diff --git a/sys/security/mac/mac_framework.c b/sys/security/mac/mac_framework.c index b4df06f8964f..e9d9eeb3b51a 100644 --- a/sys/security/mac/mac_framework.c +++ b/sys/security/mac/mac_framework.c @@ -758,7 +758,7 @@ mac_init_pipe(struct pipe *pipe) { struct label *label; - label = malloc(sizeof(struct label), M_MACPIPELABEL, M_ZERO); + label = malloc(sizeof(struct label), M_MACPIPELABEL, M_ZERO|M_WAITOK); pipe->pipe_label = label; pipe->pipe_peer->pipe_label = label; mac_init_pipe_label(label); @@ -1323,7 +1323,7 @@ mac_execve_enter(struct image_params *imgp, struct mac *mac_p, if (error) return (error); - buffer = malloc(mac.m_buflen, M_MACTEMP, 0); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, buffer, mac.m_buflen, NULL); if (error) { free(buffer, M_MACTEMP); @@ -2727,16 +2727,16 @@ mac_ioctl_ifnet_get(struct ucred *cred, struct ifreq *ifr, if (error) return (error); - elements = malloc(mac.m_buflen, M_MACTEMP, 0); + elements = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, elements, mac.m_buflen, NULL); if (error) { free(elements, M_MACTEMP); return (error); } - buffer = malloc(mac.m_buflen, M_MACTEMP, M_ZERO); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK | M_ZERO); error = mac_externalize_ifnet_label(&ifnet->if_label, elements, - buffer, mac.m_buflen, 0); + buffer, mac.m_buflen, M_WAITOK); if (error == 0) error = copyout(buffer, mac.m_string, strlen(buffer)+1); @@ -2763,7 +2763,7 @@ mac_ioctl_ifnet_set(struct ucred *cred, struct ifreq *ifr, if (error) return (error); - buffer = malloc(mac.m_buflen, M_MACTEMP, 0); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, buffer, mac.m_buflen, NULL); if (error) { free(buffer, M_MACTEMP); @@ -2839,14 +2839,14 @@ mac_setsockopt_label_set(struct ucred *cred, struct socket *so, if (error) return (error); - buffer = malloc(mac->m_buflen, M_MACTEMP, 0); + buffer = malloc(mac->m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac->m_string, buffer, mac->m_buflen, NULL); if (error) { free(buffer, M_MACTEMP); return (error); } - mac_init_socket_label(&intlabel, 0); + mac_init_socket_label(&intlabel, M_WAITOK); error = mac_internalize_socket_label(&intlabel, buffer); free(buffer, M_MACTEMP); if (error) { @@ -2893,16 +2893,16 @@ mac_getsockopt_label_get(struct ucred *cred, struct socket *so, if (error) return (error); - elements = malloc(mac->m_buflen, M_MACTEMP, 0); + elements = malloc(mac->m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac->m_string, elements, mac->m_buflen, NULL); if (error) { free(elements, M_MACTEMP); return (error); } - buffer = malloc(mac->m_buflen, M_MACTEMP, M_ZERO); + buffer = malloc(mac->m_buflen, M_MACTEMP, M_WAITOK | M_ZERO); error = mac_externalize_socket_label(&so->so_label, elements, - buffer, mac->m_buflen, 0); + buffer, mac->m_buflen, M_WAITOK); if (error == 0) error = copyout(buffer, mac->m_string, strlen(buffer)+1); @@ -2923,16 +2923,16 @@ mac_getsockopt_peerlabel_get(struct ucred *cred, struct socket *so, if (error) return (error); - elements = malloc(mac->m_buflen, M_MACTEMP, 0); + elements = malloc(mac->m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac->m_string, elements, mac->m_buflen, NULL); if (error) { free(elements, M_MACTEMP); return (error); } - buffer = malloc(mac->m_buflen, M_MACTEMP, M_ZERO); + buffer = malloc(mac->m_buflen, M_MACTEMP, M_WAITOK | M_ZERO); error = mac_externalize_socket_peer_label(&so->so_peerlabel, - elements, buffer, mac->m_buflen, 0); + elements, buffer, mac->m_buflen, M_WAITOK); if (error == 0) error = copyout(buffer, mac->m_string, strlen(buffer)+1); @@ -3040,7 +3040,7 @@ __mac_get_pid(struct thread *td, struct __mac_get_pid_args *uap) if (error) return (error); - elements = malloc(mac.m_buflen, M_MACTEMP, 0); + elements = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, elements, mac.m_buflen, NULL); if (error) { free(elements, M_MACTEMP); @@ -3048,9 +3048,9 @@ __mac_get_pid(struct thread *td, struct __mac_get_pid_args *uap) return (error); } - buffer = malloc(mac.m_buflen, M_MACTEMP, M_ZERO); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK | M_ZERO); error = mac_externalize_cred_label(&tcred->cr_label, elements, - buffer, mac.m_buflen, 0); + buffer, mac.m_buflen, M_WAITOK); if (error == 0) error = copyout(buffer, mac.m_string, strlen(buffer)+1); @@ -3078,16 +3078,16 @@ __mac_get_proc(struct thread *td, struct __mac_get_proc_args *uap) if (error) return (error); - elements = malloc(mac.m_buflen, M_MACTEMP, 0); + elements = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, elements, mac.m_buflen, NULL); if (error) { free(elements, M_MACTEMP); return (error); } - buffer = malloc(mac.m_buflen, M_MACTEMP, M_ZERO); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK | M_ZERO); error = mac_externalize_cred_label(&td->td_ucred->cr_label, - elements, buffer, mac.m_buflen, 0); + elements, buffer, mac.m_buflen, M_WAITOK); if (error == 0) error = copyout(buffer, mac.m_string, strlen(buffer)+1); @@ -3117,7 +3117,7 @@ __mac_set_proc(struct thread *td, struct __mac_set_proc_args *uap) if (error) return (error); - buffer = malloc(mac.m_buflen, M_MACTEMP, 0); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, buffer, mac.m_buflen, NULL); if (error) { free(buffer, M_MACTEMP); @@ -3194,14 +3194,14 @@ __mac_get_fd(struct thread *td, struct __mac_get_fd_args *uap) if (error) return (error); - elements = malloc(mac.m_buflen, M_MACTEMP, 0); + elements = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, elements, mac.m_buflen, NULL); if (error) { free(elements, M_MACTEMP); return (error); } - buffer = malloc(mac.m_buflen, M_MACTEMP, M_ZERO); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK | M_ZERO); mtx_lock(&Giant); /* VFS */ error = fget(td, uap->fd, &fp); if (error) @@ -3241,12 +3241,12 @@ __mac_get_fd(struct thread *td, struct __mac_get_fd_args *uap) case DTYPE_VNODE: if (error == 0) error = mac_externalize_vnode_label(&intlabel, - elements, buffer, mac.m_buflen, 0); + elements, buffer, mac.m_buflen, M_WAITOK); mac_destroy_vnode_label(&intlabel); break; case DTYPE_PIPE: error = mac_externalize_pipe_label(&intlabel, elements, - buffer, mac.m_buflen, 0); + buffer, mac.m_buflen, M_WAITOK); mac_destroy_pipe_label(&intlabel); break; default: @@ -3284,14 +3284,14 @@ __mac_get_file(struct thread *td, struct __mac_get_file_args *uap) if (error) return (error); - elements = malloc(mac.m_buflen, M_MACTEMP, 0); + elements = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, elements, mac.m_buflen, NULL); if (error) { free(elements, M_MACTEMP); return (error); } - buffer = malloc(mac.m_buflen, M_MACTEMP, M_ZERO); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK | M_ZERO); mtx_lock(&Giant); /* VFS */ NDINIT(&nd, LOOKUP, LOCKLEAF | FOLLOW, UIO_USERSPACE, uap->path_p, td); @@ -3302,7 +3302,7 @@ __mac_get_file(struct thread *td, struct __mac_get_file_args *uap) mac_init_vnode_label(&intlabel); mac_copy_vnode_label(&nd.ni_vp->v_label, &intlabel); error = mac_externalize_vnode_label(&intlabel, elements, buffer, - mac.m_buflen, 0); + mac.m_buflen, M_WAITOK); NDFREE(&nd, 0); mac_destroy_vnode_label(&intlabel); @@ -3339,14 +3339,14 @@ __mac_get_link(struct thread *td, struct __mac_get_link_args *uap) if (error) return (error); - elements = malloc(mac.m_buflen, M_MACTEMP, 0); + elements = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, elements, mac.m_buflen, NULL); if (error) { free(elements, M_MACTEMP); return (error); } - buffer = malloc(mac.m_buflen, M_MACTEMP, M_ZERO); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK | M_ZERO); mtx_lock(&Giant); /* VFS */ NDINIT(&nd, LOOKUP, LOCKLEAF | NOFOLLOW, UIO_USERSPACE, uap->path_p, td); @@ -3357,7 +3357,7 @@ __mac_get_link(struct thread *td, struct __mac_get_link_args *uap) mac_init_vnode_label(&intlabel); mac_copy_vnode_label(&nd.ni_vp->v_label, &intlabel); error = mac_externalize_vnode_label(&intlabel, elements, buffer, - mac.m_buflen, 0); + mac.m_buflen, M_WAITOK); NDFREE(&nd, 0); mac_destroy_vnode_label(&intlabel); @@ -3396,7 +3396,7 @@ __mac_set_fd(struct thread *td, struct __mac_set_fd_args *uap) if (error) return (error); - buffer = malloc(mac.m_buflen, M_MACTEMP, 0); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, buffer, mac.m_buflen, NULL); if (error) { free(buffer, M_MACTEMP); @@ -3482,7 +3482,7 @@ __mac_set_file(struct thread *td, struct __mac_set_file_args *uap) if (error) return (error); - buffer = malloc(mac.m_buflen, M_MACTEMP, 0); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, buffer, mac.m_buflen, NULL); if (error) { free(buffer, M_MACTEMP); @@ -3538,7 +3538,7 @@ __mac_set_link(struct thread *td, struct __mac_set_link_args *uap) if (error) return (error); - buffer = malloc(mac.m_buflen, M_MACTEMP, 0); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, buffer, mac.m_buflen, NULL); if (error) { free(buffer, M_MACTEMP); diff --git a/sys/security/mac/mac_internal.h b/sys/security/mac/mac_internal.h index b4df06f8964f..e9d9eeb3b51a 100644 --- a/sys/security/mac/mac_internal.h +++ b/sys/security/mac/mac_internal.h @@ -758,7 +758,7 @@ mac_init_pipe(struct pipe *pipe) { struct label *label; - label = malloc(sizeof(struct label), M_MACPIPELABEL, M_ZERO); + label = malloc(sizeof(struct label), M_MACPIPELABEL, M_ZERO|M_WAITOK); pipe->pipe_label = label; pipe->pipe_peer->pipe_label = label; mac_init_pipe_label(label); @@ -1323,7 +1323,7 @@ mac_execve_enter(struct image_params *imgp, struct mac *mac_p, if (error) return (error); - buffer = malloc(mac.m_buflen, M_MACTEMP, 0); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, buffer, mac.m_buflen, NULL); if (error) { free(buffer, M_MACTEMP); @@ -2727,16 +2727,16 @@ mac_ioctl_ifnet_get(struct ucred *cred, struct ifreq *ifr, if (error) return (error); - elements = malloc(mac.m_buflen, M_MACTEMP, 0); + elements = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, elements, mac.m_buflen, NULL); if (error) { free(elements, M_MACTEMP); return (error); } - buffer = malloc(mac.m_buflen, M_MACTEMP, M_ZERO); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK | M_ZERO); error = mac_externalize_ifnet_label(&ifnet->if_label, elements, - buffer, mac.m_buflen, 0); + buffer, mac.m_buflen, M_WAITOK); if (error == 0) error = copyout(buffer, mac.m_string, strlen(buffer)+1); @@ -2763,7 +2763,7 @@ mac_ioctl_ifnet_set(struct ucred *cred, struct ifreq *ifr, if (error) return (error); - buffer = malloc(mac.m_buflen, M_MACTEMP, 0); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, buffer, mac.m_buflen, NULL); if (error) { free(buffer, M_MACTEMP); @@ -2839,14 +2839,14 @@ mac_setsockopt_label_set(struct ucred *cred, struct socket *so, if (error) return (error); - buffer = malloc(mac->m_buflen, M_MACTEMP, 0); + buffer = malloc(mac->m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac->m_string, buffer, mac->m_buflen, NULL); if (error) { free(buffer, M_MACTEMP); return (error); } - mac_init_socket_label(&intlabel, 0); + mac_init_socket_label(&intlabel, M_WAITOK); error = mac_internalize_socket_label(&intlabel, buffer); free(buffer, M_MACTEMP); if (error) { @@ -2893,16 +2893,16 @@ mac_getsockopt_label_get(struct ucred *cred, struct socket *so, if (error) return (error); - elements = malloc(mac->m_buflen, M_MACTEMP, 0); + elements = malloc(mac->m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac->m_string, elements, mac->m_buflen, NULL); if (error) { free(elements, M_MACTEMP); return (error); } - buffer = malloc(mac->m_buflen, M_MACTEMP, M_ZERO); + buffer = malloc(mac->m_buflen, M_MACTEMP, M_WAITOK | M_ZERO); error = mac_externalize_socket_label(&so->so_label, elements, - buffer, mac->m_buflen, 0); + buffer, mac->m_buflen, M_WAITOK); if (error == 0) error = copyout(buffer, mac->m_string, strlen(buffer)+1); @@ -2923,16 +2923,16 @@ mac_getsockopt_peerlabel_get(struct ucred *cred, struct socket *so, if (error) return (error); - elements = malloc(mac->m_buflen, M_MACTEMP, 0); + elements = malloc(mac->m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac->m_string, elements, mac->m_buflen, NULL); if (error) { free(elements, M_MACTEMP); return (error); } - buffer = malloc(mac->m_buflen, M_MACTEMP, M_ZERO); + buffer = malloc(mac->m_buflen, M_MACTEMP, M_WAITOK | M_ZERO); error = mac_externalize_socket_peer_label(&so->so_peerlabel, - elements, buffer, mac->m_buflen, 0); + elements, buffer, mac->m_buflen, M_WAITOK); if (error == 0) error = copyout(buffer, mac->m_string, strlen(buffer)+1); @@ -3040,7 +3040,7 @@ __mac_get_pid(struct thread *td, struct __mac_get_pid_args *uap) if (error) return (error); - elements = malloc(mac.m_buflen, M_MACTEMP, 0); + elements = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, elements, mac.m_buflen, NULL); if (error) { free(elements, M_MACTEMP); @@ -3048,9 +3048,9 @@ __mac_get_pid(struct thread *td, struct __mac_get_pid_args *uap) return (error); } - buffer = malloc(mac.m_buflen, M_MACTEMP, M_ZERO); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK | M_ZERO); error = mac_externalize_cred_label(&tcred->cr_label, elements, - buffer, mac.m_buflen, 0); + buffer, mac.m_buflen, M_WAITOK); if (error == 0) error = copyout(buffer, mac.m_string, strlen(buffer)+1); @@ -3078,16 +3078,16 @@ __mac_get_proc(struct thread *td, struct __mac_get_proc_args *uap) if (error) return (error); - elements = malloc(mac.m_buflen, M_MACTEMP, 0); + elements = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, elements, mac.m_buflen, NULL); if (error) { free(elements, M_MACTEMP); return (error); } - buffer = malloc(mac.m_buflen, M_MACTEMP, M_ZERO); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK | M_ZERO); error = mac_externalize_cred_label(&td->td_ucred->cr_label, - elements, buffer, mac.m_buflen, 0); + elements, buffer, mac.m_buflen, M_WAITOK); if (error == 0) error = copyout(buffer, mac.m_string, strlen(buffer)+1); @@ -3117,7 +3117,7 @@ __mac_set_proc(struct thread *td, struct __mac_set_proc_args *uap) if (error) return (error); - buffer = malloc(mac.m_buflen, M_MACTEMP, 0); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, buffer, mac.m_buflen, NULL); if (error) { free(buffer, M_MACTEMP); @@ -3194,14 +3194,14 @@ __mac_get_fd(struct thread *td, struct __mac_get_fd_args *uap) if (error) return (error); - elements = malloc(mac.m_buflen, M_MACTEMP, 0); + elements = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, elements, mac.m_buflen, NULL); if (error) { free(elements, M_MACTEMP); return (error); } - buffer = malloc(mac.m_buflen, M_MACTEMP, M_ZERO); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK | M_ZERO); mtx_lock(&Giant); /* VFS */ error = fget(td, uap->fd, &fp); if (error) @@ -3241,12 +3241,12 @@ __mac_get_fd(struct thread *td, struct __mac_get_fd_args *uap) case DTYPE_VNODE: if (error == 0) error = mac_externalize_vnode_label(&intlabel, - elements, buffer, mac.m_buflen, 0); + elements, buffer, mac.m_buflen, M_WAITOK); mac_destroy_vnode_label(&intlabel); break; case DTYPE_PIPE: error = mac_externalize_pipe_label(&intlabel, elements, - buffer, mac.m_buflen, 0); + buffer, mac.m_buflen, M_WAITOK); mac_destroy_pipe_label(&intlabel); break; default: @@ -3284,14 +3284,14 @@ __mac_get_file(struct thread *td, struct __mac_get_file_args *uap) if (error) return (error); - elements = malloc(mac.m_buflen, M_MACTEMP, 0); + elements = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, elements, mac.m_buflen, NULL); if (error) { free(elements, M_MACTEMP); return (error); } - buffer = malloc(mac.m_buflen, M_MACTEMP, M_ZERO); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK | M_ZERO); mtx_lock(&Giant); /* VFS */ NDINIT(&nd, LOOKUP, LOCKLEAF | FOLLOW, UIO_USERSPACE, uap->path_p, td); @@ -3302,7 +3302,7 @@ __mac_get_file(struct thread *td, struct __mac_get_file_args *uap) mac_init_vnode_label(&intlabel); mac_copy_vnode_label(&nd.ni_vp->v_label, &intlabel); error = mac_externalize_vnode_label(&intlabel, elements, buffer, - mac.m_buflen, 0); + mac.m_buflen, M_WAITOK); NDFREE(&nd, 0); mac_destroy_vnode_label(&intlabel); @@ -3339,14 +3339,14 @@ __mac_get_link(struct thread *td, struct __mac_get_link_args *uap) if (error) return (error); - elements = malloc(mac.m_buflen, M_MACTEMP, 0); + elements = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, elements, mac.m_buflen, NULL); if (error) { free(elements, M_MACTEMP); return (error); } - buffer = malloc(mac.m_buflen, M_MACTEMP, M_ZERO); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK | M_ZERO); mtx_lock(&Giant); /* VFS */ NDINIT(&nd, LOOKUP, LOCKLEAF | NOFOLLOW, UIO_USERSPACE, uap->path_p, td); @@ -3357,7 +3357,7 @@ __mac_get_link(struct thread *td, struct __mac_get_link_args *uap) mac_init_vnode_label(&intlabel); mac_copy_vnode_label(&nd.ni_vp->v_label, &intlabel); error = mac_externalize_vnode_label(&intlabel, elements, buffer, - mac.m_buflen, 0); + mac.m_buflen, M_WAITOK); NDFREE(&nd, 0); mac_destroy_vnode_label(&intlabel); @@ -3396,7 +3396,7 @@ __mac_set_fd(struct thread *td, struct __mac_set_fd_args *uap) if (error) return (error); - buffer = malloc(mac.m_buflen, M_MACTEMP, 0); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, buffer, mac.m_buflen, NULL); if (error) { free(buffer, M_MACTEMP); @@ -3482,7 +3482,7 @@ __mac_set_file(struct thread *td, struct __mac_set_file_args *uap) if (error) return (error); - buffer = malloc(mac.m_buflen, M_MACTEMP, 0); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, buffer, mac.m_buflen, NULL); if (error) { free(buffer, M_MACTEMP); @@ -3538,7 +3538,7 @@ __mac_set_link(struct thread *td, struct __mac_set_link_args *uap) if (error) return (error); - buffer = malloc(mac.m_buflen, M_MACTEMP, 0); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, buffer, mac.m_buflen, NULL); if (error) { free(buffer, M_MACTEMP); diff --git a/sys/security/mac/mac_net.c b/sys/security/mac/mac_net.c index b4df06f8964f..e9d9eeb3b51a 100644 --- a/sys/security/mac/mac_net.c +++ b/sys/security/mac/mac_net.c @@ -758,7 +758,7 @@ mac_init_pipe(struct pipe *pipe) { struct label *label; - label = malloc(sizeof(struct label), M_MACPIPELABEL, M_ZERO); + label = malloc(sizeof(struct label), M_MACPIPELABEL, M_ZERO|M_WAITOK); pipe->pipe_label = label; pipe->pipe_peer->pipe_label = label; mac_init_pipe_label(label); @@ -1323,7 +1323,7 @@ mac_execve_enter(struct image_params *imgp, struct mac *mac_p, if (error) return (error); - buffer = malloc(mac.m_buflen, M_MACTEMP, 0); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, buffer, mac.m_buflen, NULL); if (error) { free(buffer, M_MACTEMP); @@ -2727,16 +2727,16 @@ mac_ioctl_ifnet_get(struct ucred *cred, struct ifreq *ifr, if (error) return (error); - elements = malloc(mac.m_buflen, M_MACTEMP, 0); + elements = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, elements, mac.m_buflen, NULL); if (error) { free(elements, M_MACTEMP); return (error); } - buffer = malloc(mac.m_buflen, M_MACTEMP, M_ZERO); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK | M_ZERO); error = mac_externalize_ifnet_label(&ifnet->if_label, elements, - buffer, mac.m_buflen, 0); + buffer, mac.m_buflen, M_WAITOK); if (error == 0) error = copyout(buffer, mac.m_string, strlen(buffer)+1); @@ -2763,7 +2763,7 @@ mac_ioctl_ifnet_set(struct ucred *cred, struct ifreq *ifr, if (error) return (error); - buffer = malloc(mac.m_buflen, M_MACTEMP, 0); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, buffer, mac.m_buflen, NULL); if (error) { free(buffer, M_MACTEMP); @@ -2839,14 +2839,14 @@ mac_setsockopt_label_set(struct ucred *cred, struct socket *so, if (error) return (error); - buffer = malloc(mac->m_buflen, M_MACTEMP, 0); + buffer = malloc(mac->m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac->m_string, buffer, mac->m_buflen, NULL); if (error) { free(buffer, M_MACTEMP); return (error); } - mac_init_socket_label(&intlabel, 0); + mac_init_socket_label(&intlabel, M_WAITOK); error = mac_internalize_socket_label(&intlabel, buffer); free(buffer, M_MACTEMP); if (error) { @@ -2893,16 +2893,16 @@ mac_getsockopt_label_get(struct ucred *cred, struct socket *so, if (error) return (error); - elements = malloc(mac->m_buflen, M_MACTEMP, 0); + elements = malloc(mac->m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac->m_string, elements, mac->m_buflen, NULL); if (error) { free(elements, M_MACTEMP); return (error); } - buffer = malloc(mac->m_buflen, M_MACTEMP, M_ZERO); + buffer = malloc(mac->m_buflen, M_MACTEMP, M_WAITOK | M_ZERO); error = mac_externalize_socket_label(&so->so_label, elements, - buffer, mac->m_buflen, 0); + buffer, mac->m_buflen, M_WAITOK); if (error == 0) error = copyout(buffer, mac->m_string, strlen(buffer)+1); @@ -2923,16 +2923,16 @@ mac_getsockopt_peerlabel_get(struct ucred *cred, struct socket *so, if (error) return (error); - elements = malloc(mac->m_buflen, M_MACTEMP, 0); + elements = malloc(mac->m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac->m_string, elements, mac->m_buflen, NULL); if (error) { free(elements, M_MACTEMP); return (error); } - buffer = malloc(mac->m_buflen, M_MACTEMP, M_ZERO); + buffer = malloc(mac->m_buflen, M_MACTEMP, M_WAITOK | M_ZERO); error = mac_externalize_socket_peer_label(&so->so_peerlabel, - elements, buffer, mac->m_buflen, 0); + elements, buffer, mac->m_buflen, M_WAITOK); if (error == 0) error = copyout(buffer, mac->m_string, strlen(buffer)+1); @@ -3040,7 +3040,7 @@ __mac_get_pid(struct thread *td, struct __mac_get_pid_args *uap) if (error) return (error); - elements = malloc(mac.m_buflen, M_MACTEMP, 0); + elements = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, elements, mac.m_buflen, NULL); if (error) { free(elements, M_MACTEMP); @@ -3048,9 +3048,9 @@ __mac_get_pid(struct thread *td, struct __mac_get_pid_args *uap) return (error); } - buffer = malloc(mac.m_buflen, M_MACTEMP, M_ZERO); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK | M_ZERO); error = mac_externalize_cred_label(&tcred->cr_label, elements, - buffer, mac.m_buflen, 0); + buffer, mac.m_buflen, M_WAITOK); if (error == 0) error = copyout(buffer, mac.m_string, strlen(buffer)+1); @@ -3078,16 +3078,16 @@ __mac_get_proc(struct thread *td, struct __mac_get_proc_args *uap) if (error) return (error); - elements = malloc(mac.m_buflen, M_MACTEMP, 0); + elements = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, elements, mac.m_buflen, NULL); if (error) { free(elements, M_MACTEMP); return (error); } - buffer = malloc(mac.m_buflen, M_MACTEMP, M_ZERO); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK | M_ZERO); error = mac_externalize_cred_label(&td->td_ucred->cr_label, - elements, buffer, mac.m_buflen, 0); + elements, buffer, mac.m_buflen, M_WAITOK); if (error == 0) error = copyout(buffer, mac.m_string, strlen(buffer)+1); @@ -3117,7 +3117,7 @@ __mac_set_proc(struct thread *td, struct __mac_set_proc_args *uap) if (error) return (error); - buffer = malloc(mac.m_buflen, M_MACTEMP, 0); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, buffer, mac.m_buflen, NULL); if (error) { free(buffer, M_MACTEMP); @@ -3194,14 +3194,14 @@ __mac_get_fd(struct thread *td, struct __mac_get_fd_args *uap) if (error) return (error); - elements = malloc(mac.m_buflen, M_MACTEMP, 0); + elements = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, elements, mac.m_buflen, NULL); if (error) { free(elements, M_MACTEMP); return (error); } - buffer = malloc(mac.m_buflen, M_MACTEMP, M_ZERO); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK | M_ZERO); mtx_lock(&Giant); /* VFS */ error = fget(td, uap->fd, &fp); if (error) @@ -3241,12 +3241,12 @@ __mac_get_fd(struct thread *td, struct __mac_get_fd_args *uap) case DTYPE_VNODE: if (error == 0) error = mac_externalize_vnode_label(&intlabel, - elements, buffer, mac.m_buflen, 0); + elements, buffer, mac.m_buflen, M_WAITOK); mac_destroy_vnode_label(&intlabel); break; case DTYPE_PIPE: error = mac_externalize_pipe_label(&intlabel, elements, - buffer, mac.m_buflen, 0); + buffer, mac.m_buflen, M_WAITOK); mac_destroy_pipe_label(&intlabel); break; default: @@ -3284,14 +3284,14 @@ __mac_get_file(struct thread *td, struct __mac_get_file_args *uap) if (error) return (error); - elements = malloc(mac.m_buflen, M_MACTEMP, 0); + elements = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, elements, mac.m_buflen, NULL); if (error) { free(elements, M_MACTEMP); return (error); } - buffer = malloc(mac.m_buflen, M_MACTEMP, M_ZERO); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK | M_ZERO); mtx_lock(&Giant); /* VFS */ NDINIT(&nd, LOOKUP, LOCKLEAF | FOLLOW, UIO_USERSPACE, uap->path_p, td); @@ -3302,7 +3302,7 @@ __mac_get_file(struct thread *td, struct __mac_get_file_args *uap) mac_init_vnode_label(&intlabel); mac_copy_vnode_label(&nd.ni_vp->v_label, &intlabel); error = mac_externalize_vnode_label(&intlabel, elements, buffer, - mac.m_buflen, 0); + mac.m_buflen, M_WAITOK); NDFREE(&nd, 0); mac_destroy_vnode_label(&intlabel); @@ -3339,14 +3339,14 @@ __mac_get_link(struct thread *td, struct __mac_get_link_args *uap) if (error) return (error); - elements = malloc(mac.m_buflen, M_MACTEMP, 0); + elements = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, elements, mac.m_buflen, NULL); if (error) { free(elements, M_MACTEMP); return (error); } - buffer = malloc(mac.m_buflen, M_MACTEMP, M_ZERO); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK | M_ZERO); mtx_lock(&Giant); /* VFS */ NDINIT(&nd, LOOKUP, LOCKLEAF | NOFOLLOW, UIO_USERSPACE, uap->path_p, td); @@ -3357,7 +3357,7 @@ __mac_get_link(struct thread *td, struct __mac_get_link_args *uap) mac_init_vnode_label(&intlabel); mac_copy_vnode_label(&nd.ni_vp->v_label, &intlabel); error = mac_externalize_vnode_label(&intlabel, elements, buffer, - mac.m_buflen, 0); + mac.m_buflen, M_WAITOK); NDFREE(&nd, 0); mac_destroy_vnode_label(&intlabel); @@ -3396,7 +3396,7 @@ __mac_set_fd(struct thread *td, struct __mac_set_fd_args *uap) if (error) return (error); - buffer = malloc(mac.m_buflen, M_MACTEMP, 0); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, buffer, mac.m_buflen, NULL); if (error) { free(buffer, M_MACTEMP); @@ -3482,7 +3482,7 @@ __mac_set_file(struct thread *td, struct __mac_set_file_args *uap) if (error) return (error); - buffer = malloc(mac.m_buflen, M_MACTEMP, 0); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, buffer, mac.m_buflen, NULL); if (error) { free(buffer, M_MACTEMP); @@ -3538,7 +3538,7 @@ __mac_set_link(struct thread *td, struct __mac_set_link_args *uap) if (error) return (error); - buffer = malloc(mac.m_buflen, M_MACTEMP, 0); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, buffer, mac.m_buflen, NULL); if (error) { free(buffer, M_MACTEMP); diff --git a/sys/security/mac/mac_pipe.c b/sys/security/mac/mac_pipe.c index b4df06f8964f..e9d9eeb3b51a 100644 --- a/sys/security/mac/mac_pipe.c +++ b/sys/security/mac/mac_pipe.c @@ -758,7 +758,7 @@ mac_init_pipe(struct pipe *pipe) { struct label *label; - label = malloc(sizeof(struct label), M_MACPIPELABEL, M_ZERO); + label = malloc(sizeof(struct label), M_MACPIPELABEL, M_ZERO|M_WAITOK); pipe->pipe_label = label; pipe->pipe_peer->pipe_label = label; mac_init_pipe_label(label); @@ -1323,7 +1323,7 @@ mac_execve_enter(struct image_params *imgp, struct mac *mac_p, if (error) return (error); - buffer = malloc(mac.m_buflen, M_MACTEMP, 0); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, buffer, mac.m_buflen, NULL); if (error) { free(buffer, M_MACTEMP); @@ -2727,16 +2727,16 @@ mac_ioctl_ifnet_get(struct ucred *cred, struct ifreq *ifr, if (error) return (error); - elements = malloc(mac.m_buflen, M_MACTEMP, 0); + elements = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, elements, mac.m_buflen, NULL); if (error) { free(elements, M_MACTEMP); return (error); } - buffer = malloc(mac.m_buflen, M_MACTEMP, M_ZERO); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK | M_ZERO); error = mac_externalize_ifnet_label(&ifnet->if_label, elements, - buffer, mac.m_buflen, 0); + buffer, mac.m_buflen, M_WAITOK); if (error == 0) error = copyout(buffer, mac.m_string, strlen(buffer)+1); @@ -2763,7 +2763,7 @@ mac_ioctl_ifnet_set(struct ucred *cred, struct ifreq *ifr, if (error) return (error); - buffer = malloc(mac.m_buflen, M_MACTEMP, 0); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, buffer, mac.m_buflen, NULL); if (error) { free(buffer, M_MACTEMP); @@ -2839,14 +2839,14 @@ mac_setsockopt_label_set(struct ucred *cred, struct socket *so, if (error) return (error); - buffer = malloc(mac->m_buflen, M_MACTEMP, 0); + buffer = malloc(mac->m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac->m_string, buffer, mac->m_buflen, NULL); if (error) { free(buffer, M_MACTEMP); return (error); } - mac_init_socket_label(&intlabel, 0); + mac_init_socket_label(&intlabel, M_WAITOK); error = mac_internalize_socket_label(&intlabel, buffer); free(buffer, M_MACTEMP); if (error) { @@ -2893,16 +2893,16 @@ mac_getsockopt_label_get(struct ucred *cred, struct socket *so, if (error) return (error); - elements = malloc(mac->m_buflen, M_MACTEMP, 0); + elements = malloc(mac->m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac->m_string, elements, mac->m_buflen, NULL); if (error) { free(elements, M_MACTEMP); return (error); } - buffer = malloc(mac->m_buflen, M_MACTEMP, M_ZERO); + buffer = malloc(mac->m_buflen, M_MACTEMP, M_WAITOK | M_ZERO); error = mac_externalize_socket_label(&so->so_label, elements, - buffer, mac->m_buflen, 0); + buffer, mac->m_buflen, M_WAITOK); if (error == 0) error = copyout(buffer, mac->m_string, strlen(buffer)+1); @@ -2923,16 +2923,16 @@ mac_getsockopt_peerlabel_get(struct ucred *cred, struct socket *so, if (error) return (error); - elements = malloc(mac->m_buflen, M_MACTEMP, 0); + elements = malloc(mac->m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac->m_string, elements, mac->m_buflen, NULL); if (error) { free(elements, M_MACTEMP); return (error); } - buffer = malloc(mac->m_buflen, M_MACTEMP, M_ZERO); + buffer = malloc(mac->m_buflen, M_MACTEMP, M_WAITOK | M_ZERO); error = mac_externalize_socket_peer_label(&so->so_peerlabel, - elements, buffer, mac->m_buflen, 0); + elements, buffer, mac->m_buflen, M_WAITOK); if (error == 0) error = copyout(buffer, mac->m_string, strlen(buffer)+1); @@ -3040,7 +3040,7 @@ __mac_get_pid(struct thread *td, struct __mac_get_pid_args *uap) if (error) return (error); - elements = malloc(mac.m_buflen, M_MACTEMP, 0); + elements = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, elements, mac.m_buflen, NULL); if (error) { free(elements, M_MACTEMP); @@ -3048,9 +3048,9 @@ __mac_get_pid(struct thread *td, struct __mac_get_pid_args *uap) return (error); } - buffer = malloc(mac.m_buflen, M_MACTEMP, M_ZERO); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK | M_ZERO); error = mac_externalize_cred_label(&tcred->cr_label, elements, - buffer, mac.m_buflen, 0); + buffer, mac.m_buflen, M_WAITOK); if (error == 0) error = copyout(buffer, mac.m_string, strlen(buffer)+1); @@ -3078,16 +3078,16 @@ __mac_get_proc(struct thread *td, struct __mac_get_proc_args *uap) if (error) return (error); - elements = malloc(mac.m_buflen, M_MACTEMP, 0); + elements = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, elements, mac.m_buflen, NULL); if (error) { free(elements, M_MACTEMP); return (error); } - buffer = malloc(mac.m_buflen, M_MACTEMP, M_ZERO); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK | M_ZERO); error = mac_externalize_cred_label(&td->td_ucred->cr_label, - elements, buffer, mac.m_buflen, 0); + elements, buffer, mac.m_buflen, M_WAITOK); if (error == 0) error = copyout(buffer, mac.m_string, strlen(buffer)+1); @@ -3117,7 +3117,7 @@ __mac_set_proc(struct thread *td, struct __mac_set_proc_args *uap) if (error) return (error); - buffer = malloc(mac.m_buflen, M_MACTEMP, 0); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, buffer, mac.m_buflen, NULL); if (error) { free(buffer, M_MACTEMP); @@ -3194,14 +3194,14 @@ __mac_get_fd(struct thread *td, struct __mac_get_fd_args *uap) if (error) return (error); - elements = malloc(mac.m_buflen, M_MACTEMP, 0); + elements = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, elements, mac.m_buflen, NULL); if (error) { free(elements, M_MACTEMP); return (error); } - buffer = malloc(mac.m_buflen, M_MACTEMP, M_ZERO); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK | M_ZERO); mtx_lock(&Giant); /* VFS */ error = fget(td, uap->fd, &fp); if (error) @@ -3241,12 +3241,12 @@ __mac_get_fd(struct thread *td, struct __mac_get_fd_args *uap) case DTYPE_VNODE: if (error == 0) error = mac_externalize_vnode_label(&intlabel, - elements, buffer, mac.m_buflen, 0); + elements, buffer, mac.m_buflen, M_WAITOK); mac_destroy_vnode_label(&intlabel); break; case DTYPE_PIPE: error = mac_externalize_pipe_label(&intlabel, elements, - buffer, mac.m_buflen, 0); + buffer, mac.m_buflen, M_WAITOK); mac_destroy_pipe_label(&intlabel); break; default: @@ -3284,14 +3284,14 @@ __mac_get_file(struct thread *td, struct __mac_get_file_args *uap) if (error) return (error); - elements = malloc(mac.m_buflen, M_MACTEMP, 0); + elements = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, elements, mac.m_buflen, NULL); if (error) { free(elements, M_MACTEMP); return (error); } - buffer = malloc(mac.m_buflen, M_MACTEMP, M_ZERO); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK | M_ZERO); mtx_lock(&Giant); /* VFS */ NDINIT(&nd, LOOKUP, LOCKLEAF | FOLLOW, UIO_USERSPACE, uap->path_p, td); @@ -3302,7 +3302,7 @@ __mac_get_file(struct thread *td, struct __mac_get_file_args *uap) mac_init_vnode_label(&intlabel); mac_copy_vnode_label(&nd.ni_vp->v_label, &intlabel); error = mac_externalize_vnode_label(&intlabel, elements, buffer, - mac.m_buflen, 0); + mac.m_buflen, M_WAITOK); NDFREE(&nd, 0); mac_destroy_vnode_label(&intlabel); @@ -3339,14 +3339,14 @@ __mac_get_link(struct thread *td, struct __mac_get_link_args *uap) if (error) return (error); - elements = malloc(mac.m_buflen, M_MACTEMP, 0); + elements = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, elements, mac.m_buflen, NULL); if (error) { free(elements, M_MACTEMP); return (error); } - buffer = malloc(mac.m_buflen, M_MACTEMP, M_ZERO); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK | M_ZERO); mtx_lock(&Giant); /* VFS */ NDINIT(&nd, LOOKUP, LOCKLEAF | NOFOLLOW, UIO_USERSPACE, uap->path_p, td); @@ -3357,7 +3357,7 @@ __mac_get_link(struct thread *td, struct __mac_get_link_args *uap) mac_init_vnode_label(&intlabel); mac_copy_vnode_label(&nd.ni_vp->v_label, &intlabel); error = mac_externalize_vnode_label(&intlabel, elements, buffer, - mac.m_buflen, 0); + mac.m_buflen, M_WAITOK); NDFREE(&nd, 0); mac_destroy_vnode_label(&intlabel); @@ -3396,7 +3396,7 @@ __mac_set_fd(struct thread *td, struct __mac_set_fd_args *uap) if (error) return (error); - buffer = malloc(mac.m_buflen, M_MACTEMP, 0); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, buffer, mac.m_buflen, NULL); if (error) { free(buffer, M_MACTEMP); @@ -3482,7 +3482,7 @@ __mac_set_file(struct thread *td, struct __mac_set_file_args *uap) if (error) return (error); - buffer = malloc(mac.m_buflen, M_MACTEMP, 0); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, buffer, mac.m_buflen, NULL); if (error) { free(buffer, M_MACTEMP); @@ -3538,7 +3538,7 @@ __mac_set_link(struct thread *td, struct __mac_set_link_args *uap) if (error) return (error); - buffer = malloc(mac.m_buflen, M_MACTEMP, 0); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, buffer, mac.m_buflen, NULL); if (error) { free(buffer, M_MACTEMP); diff --git a/sys/security/mac/mac_process.c b/sys/security/mac/mac_process.c index b4df06f8964f..e9d9eeb3b51a 100644 --- a/sys/security/mac/mac_process.c +++ b/sys/security/mac/mac_process.c @@ -758,7 +758,7 @@ mac_init_pipe(struct pipe *pipe) { struct label *label; - label = malloc(sizeof(struct label), M_MACPIPELABEL, M_ZERO); + label = malloc(sizeof(struct label), M_MACPIPELABEL, M_ZERO|M_WAITOK); pipe->pipe_label = label; pipe->pipe_peer->pipe_label = label; mac_init_pipe_label(label); @@ -1323,7 +1323,7 @@ mac_execve_enter(struct image_params *imgp, struct mac *mac_p, if (error) return (error); - buffer = malloc(mac.m_buflen, M_MACTEMP, 0); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, buffer, mac.m_buflen, NULL); if (error) { free(buffer, M_MACTEMP); @@ -2727,16 +2727,16 @@ mac_ioctl_ifnet_get(struct ucred *cred, struct ifreq *ifr, if (error) return (error); - elements = malloc(mac.m_buflen, M_MACTEMP, 0); + elements = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, elements, mac.m_buflen, NULL); if (error) { free(elements, M_MACTEMP); return (error); } - buffer = malloc(mac.m_buflen, M_MACTEMP, M_ZERO); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK | M_ZERO); error = mac_externalize_ifnet_label(&ifnet->if_label, elements, - buffer, mac.m_buflen, 0); + buffer, mac.m_buflen, M_WAITOK); if (error == 0) error = copyout(buffer, mac.m_string, strlen(buffer)+1); @@ -2763,7 +2763,7 @@ mac_ioctl_ifnet_set(struct ucred *cred, struct ifreq *ifr, if (error) return (error); - buffer = malloc(mac.m_buflen, M_MACTEMP, 0); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, buffer, mac.m_buflen, NULL); if (error) { free(buffer, M_MACTEMP); @@ -2839,14 +2839,14 @@ mac_setsockopt_label_set(struct ucred *cred, struct socket *so, if (error) return (error); - buffer = malloc(mac->m_buflen, M_MACTEMP, 0); + buffer = malloc(mac->m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac->m_string, buffer, mac->m_buflen, NULL); if (error) { free(buffer, M_MACTEMP); return (error); } - mac_init_socket_label(&intlabel, 0); + mac_init_socket_label(&intlabel, M_WAITOK); error = mac_internalize_socket_label(&intlabel, buffer); free(buffer, M_MACTEMP); if (error) { @@ -2893,16 +2893,16 @@ mac_getsockopt_label_get(struct ucred *cred, struct socket *so, if (error) return (error); - elements = malloc(mac->m_buflen, M_MACTEMP, 0); + elements = malloc(mac->m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac->m_string, elements, mac->m_buflen, NULL); if (error) { free(elements, M_MACTEMP); return (error); } - buffer = malloc(mac->m_buflen, M_MACTEMP, M_ZERO); + buffer = malloc(mac->m_buflen, M_MACTEMP, M_WAITOK | M_ZERO); error = mac_externalize_socket_label(&so->so_label, elements, - buffer, mac->m_buflen, 0); + buffer, mac->m_buflen, M_WAITOK); if (error == 0) error = copyout(buffer, mac->m_string, strlen(buffer)+1); @@ -2923,16 +2923,16 @@ mac_getsockopt_peerlabel_get(struct ucred *cred, struct socket *so, if (error) return (error); - elements = malloc(mac->m_buflen, M_MACTEMP, 0); + elements = malloc(mac->m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac->m_string, elements, mac->m_buflen, NULL); if (error) { free(elements, M_MACTEMP); return (error); } - buffer = malloc(mac->m_buflen, M_MACTEMP, M_ZERO); + buffer = malloc(mac->m_buflen, M_MACTEMP, M_WAITOK | M_ZERO); error = mac_externalize_socket_peer_label(&so->so_peerlabel, - elements, buffer, mac->m_buflen, 0); + elements, buffer, mac->m_buflen, M_WAITOK); if (error == 0) error = copyout(buffer, mac->m_string, strlen(buffer)+1); @@ -3040,7 +3040,7 @@ __mac_get_pid(struct thread *td, struct __mac_get_pid_args *uap) if (error) return (error); - elements = malloc(mac.m_buflen, M_MACTEMP, 0); + elements = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, elements, mac.m_buflen, NULL); if (error) { free(elements, M_MACTEMP); @@ -3048,9 +3048,9 @@ __mac_get_pid(struct thread *td, struct __mac_get_pid_args *uap) return (error); } - buffer = malloc(mac.m_buflen, M_MACTEMP, M_ZERO); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK | M_ZERO); error = mac_externalize_cred_label(&tcred->cr_label, elements, - buffer, mac.m_buflen, 0); + buffer, mac.m_buflen, M_WAITOK); if (error == 0) error = copyout(buffer, mac.m_string, strlen(buffer)+1); @@ -3078,16 +3078,16 @@ __mac_get_proc(struct thread *td, struct __mac_get_proc_args *uap) if (error) return (error); - elements = malloc(mac.m_buflen, M_MACTEMP, 0); + elements = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, elements, mac.m_buflen, NULL); if (error) { free(elements, M_MACTEMP); return (error); } - buffer = malloc(mac.m_buflen, M_MACTEMP, M_ZERO); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK | M_ZERO); error = mac_externalize_cred_label(&td->td_ucred->cr_label, - elements, buffer, mac.m_buflen, 0); + elements, buffer, mac.m_buflen, M_WAITOK); if (error == 0) error = copyout(buffer, mac.m_string, strlen(buffer)+1); @@ -3117,7 +3117,7 @@ __mac_set_proc(struct thread *td, struct __mac_set_proc_args *uap) if (error) return (error); - buffer = malloc(mac.m_buflen, M_MACTEMP, 0); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, buffer, mac.m_buflen, NULL); if (error) { free(buffer, M_MACTEMP); @@ -3194,14 +3194,14 @@ __mac_get_fd(struct thread *td, struct __mac_get_fd_args *uap) if (error) return (error); - elements = malloc(mac.m_buflen, M_MACTEMP, 0); + elements = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, elements, mac.m_buflen, NULL); if (error) { free(elements, M_MACTEMP); return (error); } - buffer = malloc(mac.m_buflen, M_MACTEMP, M_ZERO); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK | M_ZERO); mtx_lock(&Giant); /* VFS */ error = fget(td, uap->fd, &fp); if (error) @@ -3241,12 +3241,12 @@ __mac_get_fd(struct thread *td, struct __mac_get_fd_args *uap) case DTYPE_VNODE: if (error == 0) error = mac_externalize_vnode_label(&intlabel, - elements, buffer, mac.m_buflen, 0); + elements, buffer, mac.m_buflen, M_WAITOK); mac_destroy_vnode_label(&intlabel); break; case DTYPE_PIPE: error = mac_externalize_pipe_label(&intlabel, elements, - buffer, mac.m_buflen, 0); + buffer, mac.m_buflen, M_WAITOK); mac_destroy_pipe_label(&intlabel); break; default: @@ -3284,14 +3284,14 @@ __mac_get_file(struct thread *td, struct __mac_get_file_args *uap) if (error) return (error); - elements = malloc(mac.m_buflen, M_MACTEMP, 0); + elements = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, elements, mac.m_buflen, NULL); if (error) { free(elements, M_MACTEMP); return (error); } - buffer = malloc(mac.m_buflen, M_MACTEMP, M_ZERO); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK | M_ZERO); mtx_lock(&Giant); /* VFS */ NDINIT(&nd, LOOKUP, LOCKLEAF | FOLLOW, UIO_USERSPACE, uap->path_p, td); @@ -3302,7 +3302,7 @@ __mac_get_file(struct thread *td, struct __mac_get_file_args *uap) mac_init_vnode_label(&intlabel); mac_copy_vnode_label(&nd.ni_vp->v_label, &intlabel); error = mac_externalize_vnode_label(&intlabel, elements, buffer, - mac.m_buflen, 0); + mac.m_buflen, M_WAITOK); NDFREE(&nd, 0); mac_destroy_vnode_label(&intlabel); @@ -3339,14 +3339,14 @@ __mac_get_link(struct thread *td, struct __mac_get_link_args *uap) if (error) return (error); - elements = malloc(mac.m_buflen, M_MACTEMP, 0); + elements = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, elements, mac.m_buflen, NULL); if (error) { free(elements, M_MACTEMP); return (error); } - buffer = malloc(mac.m_buflen, M_MACTEMP, M_ZERO); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK | M_ZERO); mtx_lock(&Giant); /* VFS */ NDINIT(&nd, LOOKUP, LOCKLEAF | NOFOLLOW, UIO_USERSPACE, uap->path_p, td); @@ -3357,7 +3357,7 @@ __mac_get_link(struct thread *td, struct __mac_get_link_args *uap) mac_init_vnode_label(&intlabel); mac_copy_vnode_label(&nd.ni_vp->v_label, &intlabel); error = mac_externalize_vnode_label(&intlabel, elements, buffer, - mac.m_buflen, 0); + mac.m_buflen, M_WAITOK); NDFREE(&nd, 0); mac_destroy_vnode_label(&intlabel); @@ -3396,7 +3396,7 @@ __mac_set_fd(struct thread *td, struct __mac_set_fd_args *uap) if (error) return (error); - buffer = malloc(mac.m_buflen, M_MACTEMP, 0); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, buffer, mac.m_buflen, NULL); if (error) { free(buffer, M_MACTEMP); @@ -3482,7 +3482,7 @@ __mac_set_file(struct thread *td, struct __mac_set_file_args *uap) if (error) return (error); - buffer = malloc(mac.m_buflen, M_MACTEMP, 0); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, buffer, mac.m_buflen, NULL); if (error) { free(buffer, M_MACTEMP); @@ -3538,7 +3538,7 @@ __mac_set_link(struct thread *td, struct __mac_set_link_args *uap) if (error) return (error); - buffer = malloc(mac.m_buflen, M_MACTEMP, 0); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, buffer, mac.m_buflen, NULL); if (error) { free(buffer, M_MACTEMP); diff --git a/sys/security/mac/mac_syscalls.c b/sys/security/mac/mac_syscalls.c index b4df06f8964f..e9d9eeb3b51a 100644 --- a/sys/security/mac/mac_syscalls.c +++ b/sys/security/mac/mac_syscalls.c @@ -758,7 +758,7 @@ mac_init_pipe(struct pipe *pipe) { struct label *label; - label = malloc(sizeof(struct label), M_MACPIPELABEL, M_ZERO); + label = malloc(sizeof(struct label), M_MACPIPELABEL, M_ZERO|M_WAITOK); pipe->pipe_label = label; pipe->pipe_peer->pipe_label = label; mac_init_pipe_label(label); @@ -1323,7 +1323,7 @@ mac_execve_enter(struct image_params *imgp, struct mac *mac_p, if (error) return (error); - buffer = malloc(mac.m_buflen, M_MACTEMP, 0); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, buffer, mac.m_buflen, NULL); if (error) { free(buffer, M_MACTEMP); @@ -2727,16 +2727,16 @@ mac_ioctl_ifnet_get(struct ucred *cred, struct ifreq *ifr, if (error) return (error); - elements = malloc(mac.m_buflen, M_MACTEMP, 0); + elements = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, elements, mac.m_buflen, NULL); if (error) { free(elements, M_MACTEMP); return (error); } - buffer = malloc(mac.m_buflen, M_MACTEMP, M_ZERO); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK | M_ZERO); error = mac_externalize_ifnet_label(&ifnet->if_label, elements, - buffer, mac.m_buflen, 0); + buffer, mac.m_buflen, M_WAITOK); if (error == 0) error = copyout(buffer, mac.m_string, strlen(buffer)+1); @@ -2763,7 +2763,7 @@ mac_ioctl_ifnet_set(struct ucred *cred, struct ifreq *ifr, if (error) return (error); - buffer = malloc(mac.m_buflen, M_MACTEMP, 0); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, buffer, mac.m_buflen, NULL); if (error) { free(buffer, M_MACTEMP); @@ -2839,14 +2839,14 @@ mac_setsockopt_label_set(struct ucred *cred, struct socket *so, if (error) return (error); - buffer = malloc(mac->m_buflen, M_MACTEMP, 0); + buffer = malloc(mac->m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac->m_string, buffer, mac->m_buflen, NULL); if (error) { free(buffer, M_MACTEMP); return (error); } - mac_init_socket_label(&intlabel, 0); + mac_init_socket_label(&intlabel, M_WAITOK); error = mac_internalize_socket_label(&intlabel, buffer); free(buffer, M_MACTEMP); if (error) { @@ -2893,16 +2893,16 @@ mac_getsockopt_label_get(struct ucred *cred, struct socket *so, if (error) return (error); - elements = malloc(mac->m_buflen, M_MACTEMP, 0); + elements = malloc(mac->m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac->m_string, elements, mac->m_buflen, NULL); if (error) { free(elements, M_MACTEMP); return (error); } - buffer = malloc(mac->m_buflen, M_MACTEMP, M_ZERO); + buffer = malloc(mac->m_buflen, M_MACTEMP, M_WAITOK | M_ZERO); error = mac_externalize_socket_label(&so->so_label, elements, - buffer, mac->m_buflen, 0); + buffer, mac->m_buflen, M_WAITOK); if (error == 0) error = copyout(buffer, mac->m_string, strlen(buffer)+1); @@ -2923,16 +2923,16 @@ mac_getsockopt_peerlabel_get(struct ucred *cred, struct socket *so, if (error) return (error); - elements = malloc(mac->m_buflen, M_MACTEMP, 0); + elements = malloc(mac->m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac->m_string, elements, mac->m_buflen, NULL); if (error) { free(elements, M_MACTEMP); return (error); } - buffer = malloc(mac->m_buflen, M_MACTEMP, M_ZERO); + buffer = malloc(mac->m_buflen, M_MACTEMP, M_WAITOK | M_ZERO); error = mac_externalize_socket_peer_label(&so->so_peerlabel, - elements, buffer, mac->m_buflen, 0); + elements, buffer, mac->m_buflen, M_WAITOK); if (error == 0) error = copyout(buffer, mac->m_string, strlen(buffer)+1); @@ -3040,7 +3040,7 @@ __mac_get_pid(struct thread *td, struct __mac_get_pid_args *uap) if (error) return (error); - elements = malloc(mac.m_buflen, M_MACTEMP, 0); + elements = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, elements, mac.m_buflen, NULL); if (error) { free(elements, M_MACTEMP); @@ -3048,9 +3048,9 @@ __mac_get_pid(struct thread *td, struct __mac_get_pid_args *uap) return (error); } - buffer = malloc(mac.m_buflen, M_MACTEMP, M_ZERO); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK | M_ZERO); error = mac_externalize_cred_label(&tcred->cr_label, elements, - buffer, mac.m_buflen, 0); + buffer, mac.m_buflen, M_WAITOK); if (error == 0) error = copyout(buffer, mac.m_string, strlen(buffer)+1); @@ -3078,16 +3078,16 @@ __mac_get_proc(struct thread *td, struct __mac_get_proc_args *uap) if (error) return (error); - elements = malloc(mac.m_buflen, M_MACTEMP, 0); + elements = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, elements, mac.m_buflen, NULL); if (error) { free(elements, M_MACTEMP); return (error); } - buffer = malloc(mac.m_buflen, M_MACTEMP, M_ZERO); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK | M_ZERO); error = mac_externalize_cred_label(&td->td_ucred->cr_label, - elements, buffer, mac.m_buflen, 0); + elements, buffer, mac.m_buflen, M_WAITOK); if (error == 0) error = copyout(buffer, mac.m_string, strlen(buffer)+1); @@ -3117,7 +3117,7 @@ __mac_set_proc(struct thread *td, struct __mac_set_proc_args *uap) if (error) return (error); - buffer = malloc(mac.m_buflen, M_MACTEMP, 0); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, buffer, mac.m_buflen, NULL); if (error) { free(buffer, M_MACTEMP); @@ -3194,14 +3194,14 @@ __mac_get_fd(struct thread *td, struct __mac_get_fd_args *uap) if (error) return (error); - elements = malloc(mac.m_buflen, M_MACTEMP, 0); + elements = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, elements, mac.m_buflen, NULL); if (error) { free(elements, M_MACTEMP); return (error); } - buffer = malloc(mac.m_buflen, M_MACTEMP, M_ZERO); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK | M_ZERO); mtx_lock(&Giant); /* VFS */ error = fget(td, uap->fd, &fp); if (error) @@ -3241,12 +3241,12 @@ __mac_get_fd(struct thread *td, struct __mac_get_fd_args *uap) case DTYPE_VNODE: if (error == 0) error = mac_externalize_vnode_label(&intlabel, - elements, buffer, mac.m_buflen, 0); + elements, buffer, mac.m_buflen, M_WAITOK); mac_destroy_vnode_label(&intlabel); break; case DTYPE_PIPE: error = mac_externalize_pipe_label(&intlabel, elements, - buffer, mac.m_buflen, 0); + buffer, mac.m_buflen, M_WAITOK); mac_destroy_pipe_label(&intlabel); break; default: @@ -3284,14 +3284,14 @@ __mac_get_file(struct thread *td, struct __mac_get_file_args *uap) if (error) return (error); - elements = malloc(mac.m_buflen, M_MACTEMP, 0); + elements = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, elements, mac.m_buflen, NULL); if (error) { free(elements, M_MACTEMP); return (error); } - buffer = malloc(mac.m_buflen, M_MACTEMP, M_ZERO); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK | M_ZERO); mtx_lock(&Giant); /* VFS */ NDINIT(&nd, LOOKUP, LOCKLEAF | FOLLOW, UIO_USERSPACE, uap->path_p, td); @@ -3302,7 +3302,7 @@ __mac_get_file(struct thread *td, struct __mac_get_file_args *uap) mac_init_vnode_label(&intlabel); mac_copy_vnode_label(&nd.ni_vp->v_label, &intlabel); error = mac_externalize_vnode_label(&intlabel, elements, buffer, - mac.m_buflen, 0); + mac.m_buflen, M_WAITOK); NDFREE(&nd, 0); mac_destroy_vnode_label(&intlabel); @@ -3339,14 +3339,14 @@ __mac_get_link(struct thread *td, struct __mac_get_link_args *uap) if (error) return (error); - elements = malloc(mac.m_buflen, M_MACTEMP, 0); + elements = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, elements, mac.m_buflen, NULL); if (error) { free(elements, M_MACTEMP); return (error); } - buffer = malloc(mac.m_buflen, M_MACTEMP, M_ZERO); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK | M_ZERO); mtx_lock(&Giant); /* VFS */ NDINIT(&nd, LOOKUP, LOCKLEAF | NOFOLLOW, UIO_USERSPACE, uap->path_p, td); @@ -3357,7 +3357,7 @@ __mac_get_link(struct thread *td, struct __mac_get_link_args *uap) mac_init_vnode_label(&intlabel); mac_copy_vnode_label(&nd.ni_vp->v_label, &intlabel); error = mac_externalize_vnode_label(&intlabel, elements, buffer, - mac.m_buflen, 0); + mac.m_buflen, M_WAITOK); NDFREE(&nd, 0); mac_destroy_vnode_label(&intlabel); @@ -3396,7 +3396,7 @@ __mac_set_fd(struct thread *td, struct __mac_set_fd_args *uap) if (error) return (error); - buffer = malloc(mac.m_buflen, M_MACTEMP, 0); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, buffer, mac.m_buflen, NULL); if (error) { free(buffer, M_MACTEMP); @@ -3482,7 +3482,7 @@ __mac_set_file(struct thread *td, struct __mac_set_file_args *uap) if (error) return (error); - buffer = malloc(mac.m_buflen, M_MACTEMP, 0); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, buffer, mac.m_buflen, NULL); if (error) { free(buffer, M_MACTEMP); @@ -3538,7 +3538,7 @@ __mac_set_link(struct thread *td, struct __mac_set_link_args *uap) if (error) return (error); - buffer = malloc(mac.m_buflen, M_MACTEMP, 0); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, buffer, mac.m_buflen, NULL); if (error) { free(buffer, M_MACTEMP); diff --git a/sys/security/mac/mac_system.c b/sys/security/mac/mac_system.c index b4df06f8964f..e9d9eeb3b51a 100644 --- a/sys/security/mac/mac_system.c +++ b/sys/security/mac/mac_system.c @@ -758,7 +758,7 @@ mac_init_pipe(struct pipe *pipe) { struct label *label; - label = malloc(sizeof(struct label), M_MACPIPELABEL, M_ZERO); + label = malloc(sizeof(struct label), M_MACPIPELABEL, M_ZERO|M_WAITOK); pipe->pipe_label = label; pipe->pipe_peer->pipe_label = label; mac_init_pipe_label(label); @@ -1323,7 +1323,7 @@ mac_execve_enter(struct image_params *imgp, struct mac *mac_p, if (error) return (error); - buffer = malloc(mac.m_buflen, M_MACTEMP, 0); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, buffer, mac.m_buflen, NULL); if (error) { free(buffer, M_MACTEMP); @@ -2727,16 +2727,16 @@ mac_ioctl_ifnet_get(struct ucred *cred, struct ifreq *ifr, if (error) return (error); - elements = malloc(mac.m_buflen, M_MACTEMP, 0); + elements = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, elements, mac.m_buflen, NULL); if (error) { free(elements, M_MACTEMP); return (error); } - buffer = malloc(mac.m_buflen, M_MACTEMP, M_ZERO); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK | M_ZERO); error = mac_externalize_ifnet_label(&ifnet->if_label, elements, - buffer, mac.m_buflen, 0); + buffer, mac.m_buflen, M_WAITOK); if (error == 0) error = copyout(buffer, mac.m_string, strlen(buffer)+1); @@ -2763,7 +2763,7 @@ mac_ioctl_ifnet_set(struct ucred *cred, struct ifreq *ifr, if (error) return (error); - buffer = malloc(mac.m_buflen, M_MACTEMP, 0); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, buffer, mac.m_buflen, NULL); if (error) { free(buffer, M_MACTEMP); @@ -2839,14 +2839,14 @@ mac_setsockopt_label_set(struct ucred *cred, struct socket *so, if (error) return (error); - buffer = malloc(mac->m_buflen, M_MACTEMP, 0); + buffer = malloc(mac->m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac->m_string, buffer, mac->m_buflen, NULL); if (error) { free(buffer, M_MACTEMP); return (error); } - mac_init_socket_label(&intlabel, 0); + mac_init_socket_label(&intlabel, M_WAITOK); error = mac_internalize_socket_label(&intlabel, buffer); free(buffer, M_MACTEMP); if (error) { @@ -2893,16 +2893,16 @@ mac_getsockopt_label_get(struct ucred *cred, struct socket *so, if (error) return (error); - elements = malloc(mac->m_buflen, M_MACTEMP, 0); + elements = malloc(mac->m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac->m_string, elements, mac->m_buflen, NULL); if (error) { free(elements, M_MACTEMP); return (error); } - buffer = malloc(mac->m_buflen, M_MACTEMP, M_ZERO); + buffer = malloc(mac->m_buflen, M_MACTEMP, M_WAITOK | M_ZERO); error = mac_externalize_socket_label(&so->so_label, elements, - buffer, mac->m_buflen, 0); + buffer, mac->m_buflen, M_WAITOK); if (error == 0) error = copyout(buffer, mac->m_string, strlen(buffer)+1); @@ -2923,16 +2923,16 @@ mac_getsockopt_peerlabel_get(struct ucred *cred, struct socket *so, if (error) return (error); - elements = malloc(mac->m_buflen, M_MACTEMP, 0); + elements = malloc(mac->m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac->m_string, elements, mac->m_buflen, NULL); if (error) { free(elements, M_MACTEMP); return (error); } - buffer = malloc(mac->m_buflen, M_MACTEMP, M_ZERO); + buffer = malloc(mac->m_buflen, M_MACTEMP, M_WAITOK | M_ZERO); error = mac_externalize_socket_peer_label(&so->so_peerlabel, - elements, buffer, mac->m_buflen, 0); + elements, buffer, mac->m_buflen, M_WAITOK); if (error == 0) error = copyout(buffer, mac->m_string, strlen(buffer)+1); @@ -3040,7 +3040,7 @@ __mac_get_pid(struct thread *td, struct __mac_get_pid_args *uap) if (error) return (error); - elements = malloc(mac.m_buflen, M_MACTEMP, 0); + elements = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, elements, mac.m_buflen, NULL); if (error) { free(elements, M_MACTEMP); @@ -3048,9 +3048,9 @@ __mac_get_pid(struct thread *td, struct __mac_get_pid_args *uap) return (error); } - buffer = malloc(mac.m_buflen, M_MACTEMP, M_ZERO); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK | M_ZERO); error = mac_externalize_cred_label(&tcred->cr_label, elements, - buffer, mac.m_buflen, 0); + buffer, mac.m_buflen, M_WAITOK); if (error == 0) error = copyout(buffer, mac.m_string, strlen(buffer)+1); @@ -3078,16 +3078,16 @@ __mac_get_proc(struct thread *td, struct __mac_get_proc_args *uap) if (error) return (error); - elements = malloc(mac.m_buflen, M_MACTEMP, 0); + elements = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, elements, mac.m_buflen, NULL); if (error) { free(elements, M_MACTEMP); return (error); } - buffer = malloc(mac.m_buflen, M_MACTEMP, M_ZERO); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK | M_ZERO); error = mac_externalize_cred_label(&td->td_ucred->cr_label, - elements, buffer, mac.m_buflen, 0); + elements, buffer, mac.m_buflen, M_WAITOK); if (error == 0) error = copyout(buffer, mac.m_string, strlen(buffer)+1); @@ -3117,7 +3117,7 @@ __mac_set_proc(struct thread *td, struct __mac_set_proc_args *uap) if (error) return (error); - buffer = malloc(mac.m_buflen, M_MACTEMP, 0); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, buffer, mac.m_buflen, NULL); if (error) { free(buffer, M_MACTEMP); @@ -3194,14 +3194,14 @@ __mac_get_fd(struct thread *td, struct __mac_get_fd_args *uap) if (error) return (error); - elements = malloc(mac.m_buflen, M_MACTEMP, 0); + elements = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, elements, mac.m_buflen, NULL); if (error) { free(elements, M_MACTEMP); return (error); } - buffer = malloc(mac.m_buflen, M_MACTEMP, M_ZERO); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK | M_ZERO); mtx_lock(&Giant); /* VFS */ error = fget(td, uap->fd, &fp); if (error) @@ -3241,12 +3241,12 @@ __mac_get_fd(struct thread *td, struct __mac_get_fd_args *uap) case DTYPE_VNODE: if (error == 0) error = mac_externalize_vnode_label(&intlabel, - elements, buffer, mac.m_buflen, 0); + elements, buffer, mac.m_buflen, M_WAITOK); mac_destroy_vnode_label(&intlabel); break; case DTYPE_PIPE: error = mac_externalize_pipe_label(&intlabel, elements, - buffer, mac.m_buflen, 0); + buffer, mac.m_buflen, M_WAITOK); mac_destroy_pipe_label(&intlabel); break; default: @@ -3284,14 +3284,14 @@ __mac_get_file(struct thread *td, struct __mac_get_file_args *uap) if (error) return (error); - elements = malloc(mac.m_buflen, M_MACTEMP, 0); + elements = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, elements, mac.m_buflen, NULL); if (error) { free(elements, M_MACTEMP); return (error); } - buffer = malloc(mac.m_buflen, M_MACTEMP, M_ZERO); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK | M_ZERO); mtx_lock(&Giant); /* VFS */ NDINIT(&nd, LOOKUP, LOCKLEAF | FOLLOW, UIO_USERSPACE, uap->path_p, td); @@ -3302,7 +3302,7 @@ __mac_get_file(struct thread *td, struct __mac_get_file_args *uap) mac_init_vnode_label(&intlabel); mac_copy_vnode_label(&nd.ni_vp->v_label, &intlabel); error = mac_externalize_vnode_label(&intlabel, elements, buffer, - mac.m_buflen, 0); + mac.m_buflen, M_WAITOK); NDFREE(&nd, 0); mac_destroy_vnode_label(&intlabel); @@ -3339,14 +3339,14 @@ __mac_get_link(struct thread *td, struct __mac_get_link_args *uap) if (error) return (error); - elements = malloc(mac.m_buflen, M_MACTEMP, 0); + elements = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, elements, mac.m_buflen, NULL); if (error) { free(elements, M_MACTEMP); return (error); } - buffer = malloc(mac.m_buflen, M_MACTEMP, M_ZERO); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK | M_ZERO); mtx_lock(&Giant); /* VFS */ NDINIT(&nd, LOOKUP, LOCKLEAF | NOFOLLOW, UIO_USERSPACE, uap->path_p, td); @@ -3357,7 +3357,7 @@ __mac_get_link(struct thread *td, struct __mac_get_link_args *uap) mac_init_vnode_label(&intlabel); mac_copy_vnode_label(&nd.ni_vp->v_label, &intlabel); error = mac_externalize_vnode_label(&intlabel, elements, buffer, - mac.m_buflen, 0); + mac.m_buflen, M_WAITOK); NDFREE(&nd, 0); mac_destroy_vnode_label(&intlabel); @@ -3396,7 +3396,7 @@ __mac_set_fd(struct thread *td, struct __mac_set_fd_args *uap) if (error) return (error); - buffer = malloc(mac.m_buflen, M_MACTEMP, 0); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, buffer, mac.m_buflen, NULL); if (error) { free(buffer, M_MACTEMP); @@ -3482,7 +3482,7 @@ __mac_set_file(struct thread *td, struct __mac_set_file_args *uap) if (error) return (error); - buffer = malloc(mac.m_buflen, M_MACTEMP, 0); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, buffer, mac.m_buflen, NULL); if (error) { free(buffer, M_MACTEMP); @@ -3538,7 +3538,7 @@ __mac_set_link(struct thread *td, struct __mac_set_link_args *uap) if (error) return (error); - buffer = malloc(mac.m_buflen, M_MACTEMP, 0); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, buffer, mac.m_buflen, NULL); if (error) { free(buffer, M_MACTEMP); diff --git a/sys/security/mac/mac_vfs.c b/sys/security/mac/mac_vfs.c index b4df06f8964f..e9d9eeb3b51a 100644 --- a/sys/security/mac/mac_vfs.c +++ b/sys/security/mac/mac_vfs.c @@ -758,7 +758,7 @@ mac_init_pipe(struct pipe *pipe) { struct label *label; - label = malloc(sizeof(struct label), M_MACPIPELABEL, M_ZERO); + label = malloc(sizeof(struct label), M_MACPIPELABEL, M_ZERO|M_WAITOK); pipe->pipe_label = label; pipe->pipe_peer->pipe_label = label; mac_init_pipe_label(label); @@ -1323,7 +1323,7 @@ mac_execve_enter(struct image_params *imgp, struct mac *mac_p, if (error) return (error); - buffer = malloc(mac.m_buflen, M_MACTEMP, 0); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, buffer, mac.m_buflen, NULL); if (error) { free(buffer, M_MACTEMP); @@ -2727,16 +2727,16 @@ mac_ioctl_ifnet_get(struct ucred *cred, struct ifreq *ifr, if (error) return (error); - elements = malloc(mac.m_buflen, M_MACTEMP, 0); + elements = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, elements, mac.m_buflen, NULL); if (error) { free(elements, M_MACTEMP); return (error); } - buffer = malloc(mac.m_buflen, M_MACTEMP, M_ZERO); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK | M_ZERO); error = mac_externalize_ifnet_label(&ifnet->if_label, elements, - buffer, mac.m_buflen, 0); + buffer, mac.m_buflen, M_WAITOK); if (error == 0) error = copyout(buffer, mac.m_string, strlen(buffer)+1); @@ -2763,7 +2763,7 @@ mac_ioctl_ifnet_set(struct ucred *cred, struct ifreq *ifr, if (error) return (error); - buffer = malloc(mac.m_buflen, M_MACTEMP, 0); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, buffer, mac.m_buflen, NULL); if (error) { free(buffer, M_MACTEMP); @@ -2839,14 +2839,14 @@ mac_setsockopt_label_set(struct ucred *cred, struct socket *so, if (error) return (error); - buffer = malloc(mac->m_buflen, M_MACTEMP, 0); + buffer = malloc(mac->m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac->m_string, buffer, mac->m_buflen, NULL); if (error) { free(buffer, M_MACTEMP); return (error); } - mac_init_socket_label(&intlabel, 0); + mac_init_socket_label(&intlabel, M_WAITOK); error = mac_internalize_socket_label(&intlabel, buffer); free(buffer, M_MACTEMP); if (error) { @@ -2893,16 +2893,16 @@ mac_getsockopt_label_get(struct ucred *cred, struct socket *so, if (error) return (error); - elements = malloc(mac->m_buflen, M_MACTEMP, 0); + elements = malloc(mac->m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac->m_string, elements, mac->m_buflen, NULL); if (error) { free(elements, M_MACTEMP); return (error); } - buffer = malloc(mac->m_buflen, M_MACTEMP, M_ZERO); + buffer = malloc(mac->m_buflen, M_MACTEMP, M_WAITOK | M_ZERO); error = mac_externalize_socket_label(&so->so_label, elements, - buffer, mac->m_buflen, 0); + buffer, mac->m_buflen, M_WAITOK); if (error == 0) error = copyout(buffer, mac->m_string, strlen(buffer)+1); @@ -2923,16 +2923,16 @@ mac_getsockopt_peerlabel_get(struct ucred *cred, struct socket *so, if (error) return (error); - elements = malloc(mac->m_buflen, M_MACTEMP, 0); + elements = malloc(mac->m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac->m_string, elements, mac->m_buflen, NULL); if (error) { free(elements, M_MACTEMP); return (error); } - buffer = malloc(mac->m_buflen, M_MACTEMP, M_ZERO); + buffer = malloc(mac->m_buflen, M_MACTEMP, M_WAITOK | M_ZERO); error = mac_externalize_socket_peer_label(&so->so_peerlabel, - elements, buffer, mac->m_buflen, 0); + elements, buffer, mac->m_buflen, M_WAITOK); if (error == 0) error = copyout(buffer, mac->m_string, strlen(buffer)+1); @@ -3040,7 +3040,7 @@ __mac_get_pid(struct thread *td, struct __mac_get_pid_args *uap) if (error) return (error); - elements = malloc(mac.m_buflen, M_MACTEMP, 0); + elements = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, elements, mac.m_buflen, NULL); if (error) { free(elements, M_MACTEMP); @@ -3048,9 +3048,9 @@ __mac_get_pid(struct thread *td, struct __mac_get_pid_args *uap) return (error); } - buffer = malloc(mac.m_buflen, M_MACTEMP, M_ZERO); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK | M_ZERO); error = mac_externalize_cred_label(&tcred->cr_label, elements, - buffer, mac.m_buflen, 0); + buffer, mac.m_buflen, M_WAITOK); if (error == 0) error = copyout(buffer, mac.m_string, strlen(buffer)+1); @@ -3078,16 +3078,16 @@ __mac_get_proc(struct thread *td, struct __mac_get_proc_args *uap) if (error) return (error); - elements = malloc(mac.m_buflen, M_MACTEMP, 0); + elements = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, elements, mac.m_buflen, NULL); if (error) { free(elements, M_MACTEMP); return (error); } - buffer = malloc(mac.m_buflen, M_MACTEMP, M_ZERO); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK | M_ZERO); error = mac_externalize_cred_label(&td->td_ucred->cr_label, - elements, buffer, mac.m_buflen, 0); + elements, buffer, mac.m_buflen, M_WAITOK); if (error == 0) error = copyout(buffer, mac.m_string, strlen(buffer)+1); @@ -3117,7 +3117,7 @@ __mac_set_proc(struct thread *td, struct __mac_set_proc_args *uap) if (error) return (error); - buffer = malloc(mac.m_buflen, M_MACTEMP, 0); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, buffer, mac.m_buflen, NULL); if (error) { free(buffer, M_MACTEMP); @@ -3194,14 +3194,14 @@ __mac_get_fd(struct thread *td, struct __mac_get_fd_args *uap) if (error) return (error); - elements = malloc(mac.m_buflen, M_MACTEMP, 0); + elements = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, elements, mac.m_buflen, NULL); if (error) { free(elements, M_MACTEMP); return (error); } - buffer = malloc(mac.m_buflen, M_MACTEMP, M_ZERO); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK | M_ZERO); mtx_lock(&Giant); /* VFS */ error = fget(td, uap->fd, &fp); if (error) @@ -3241,12 +3241,12 @@ __mac_get_fd(struct thread *td, struct __mac_get_fd_args *uap) case DTYPE_VNODE: if (error == 0) error = mac_externalize_vnode_label(&intlabel, - elements, buffer, mac.m_buflen, 0); + elements, buffer, mac.m_buflen, M_WAITOK); mac_destroy_vnode_label(&intlabel); break; case DTYPE_PIPE: error = mac_externalize_pipe_label(&intlabel, elements, - buffer, mac.m_buflen, 0); + buffer, mac.m_buflen, M_WAITOK); mac_destroy_pipe_label(&intlabel); break; default: @@ -3284,14 +3284,14 @@ __mac_get_file(struct thread *td, struct __mac_get_file_args *uap) if (error) return (error); - elements = malloc(mac.m_buflen, M_MACTEMP, 0); + elements = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, elements, mac.m_buflen, NULL); if (error) { free(elements, M_MACTEMP); return (error); } - buffer = malloc(mac.m_buflen, M_MACTEMP, M_ZERO); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK | M_ZERO); mtx_lock(&Giant); /* VFS */ NDINIT(&nd, LOOKUP, LOCKLEAF | FOLLOW, UIO_USERSPACE, uap->path_p, td); @@ -3302,7 +3302,7 @@ __mac_get_file(struct thread *td, struct __mac_get_file_args *uap) mac_init_vnode_label(&intlabel); mac_copy_vnode_label(&nd.ni_vp->v_label, &intlabel); error = mac_externalize_vnode_label(&intlabel, elements, buffer, - mac.m_buflen, 0); + mac.m_buflen, M_WAITOK); NDFREE(&nd, 0); mac_destroy_vnode_label(&intlabel); @@ -3339,14 +3339,14 @@ __mac_get_link(struct thread *td, struct __mac_get_link_args *uap) if (error) return (error); - elements = malloc(mac.m_buflen, M_MACTEMP, 0); + elements = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, elements, mac.m_buflen, NULL); if (error) { free(elements, M_MACTEMP); return (error); } - buffer = malloc(mac.m_buflen, M_MACTEMP, M_ZERO); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK | M_ZERO); mtx_lock(&Giant); /* VFS */ NDINIT(&nd, LOOKUP, LOCKLEAF | NOFOLLOW, UIO_USERSPACE, uap->path_p, td); @@ -3357,7 +3357,7 @@ __mac_get_link(struct thread *td, struct __mac_get_link_args *uap) mac_init_vnode_label(&intlabel); mac_copy_vnode_label(&nd.ni_vp->v_label, &intlabel); error = mac_externalize_vnode_label(&intlabel, elements, buffer, - mac.m_buflen, 0); + mac.m_buflen, M_WAITOK); NDFREE(&nd, 0); mac_destroy_vnode_label(&intlabel); @@ -3396,7 +3396,7 @@ __mac_set_fd(struct thread *td, struct __mac_set_fd_args *uap) if (error) return (error); - buffer = malloc(mac.m_buflen, M_MACTEMP, 0); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, buffer, mac.m_buflen, NULL); if (error) { free(buffer, M_MACTEMP); @@ -3482,7 +3482,7 @@ __mac_set_file(struct thread *td, struct __mac_set_file_args *uap) if (error) return (error); - buffer = malloc(mac.m_buflen, M_MACTEMP, 0); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, buffer, mac.m_buflen, NULL); if (error) { free(buffer, M_MACTEMP); @@ -3538,7 +3538,7 @@ __mac_set_link(struct thread *td, struct __mac_set_link_args *uap) if (error) return (error); - buffer = malloc(mac.m_buflen, M_MACTEMP, 0); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK); error = copyinstr(mac.m_string, buffer, mac.m_buflen, NULL); if (error) { free(buffer, M_MACTEMP); diff --git a/sys/security/mac_biba/mac_biba.c b/sys/security/mac_biba/mac_biba.c index 83ba80409076..4674d0792f35 100644 --- a/sys/security/mac_biba/mac_biba.c +++ b/sys/security/mac_biba/mac_biba.c @@ -505,7 +505,7 @@ static void mac_biba_init_label(struct label *label) { - SLOT(label) = biba_alloc(0); + SLOT(label) = biba_alloc(M_WAITOK); } static int diff --git a/sys/security/mac_bsdextended/mac_bsdextended.c b/sys/security/mac_bsdextended/mac_bsdextended.c index 9231125e4a1e..ba357fffc9c0 100644 --- a/sys/security/mac_bsdextended/mac_bsdextended.c +++ b/sys/security/mac_bsdextended/mac_bsdextended.c @@ -164,7 +164,7 @@ sysctl_rule(SYSCTL_HANDLER_ARGS) if (rules[index] == NULL) { /* printf("addition\n"); */ MALLOC(ruleptr, struct mac_bsdextended_rule *, - sizeof(*ruleptr), M_MACBSDEXTENDED, + sizeof(*ruleptr), M_MACBSDEXTENDED, M_WAITOK | M_ZERO); *ruleptr = temprule; rules[index] = ruleptr; diff --git a/sys/security/mac_lomac/mac_lomac.c b/sys/security/mac_lomac/mac_lomac.c index 8351c0004a3a..ef11d6332a1d 100644 --- a/sys/security/mac_lomac/mac_lomac.c +++ b/sys/security/mac_lomac/mac_lomac.c @@ -621,7 +621,7 @@ static void mac_lomac_init_label(struct label *label) { - SLOT(label) = lomac_alloc(0); + SLOT(label) = lomac_alloc(M_WAITOK); } static int @@ -640,7 +640,7 @@ mac_lomac_init_proc_label(struct label *label) { PSLOT(label) = malloc(sizeof(struct mac_lomac_proc), M_MACLOMAC, - M_ZERO); + M_ZERO | M_WAITOK); mtx_init(&PSLOT(label)->mtx, "MAC/Lomac proc lock", NULL, MTX_DEF); } diff --git a/sys/security/mac_mls/mac_mls.c b/sys/security/mac_mls/mac_mls.c index b4aa3e0c62d6..c9d89272e282 100644 --- a/sys/security/mac_mls/mac_mls.c +++ b/sys/security/mac_mls/mac_mls.c @@ -470,7 +470,7 @@ static void mac_mls_init_label(struct label *label) { - SLOT(label) = mls_alloc(0); + SLOT(label) = mls_alloc(M_WAITOK); } static int diff --git a/sys/sparc64/ebus/ebus.c b/sys/sparc64/ebus/ebus.c index 71470601ff32..42d78c858c1e 100644 --- a/sys/sparc64/ebus/ebus.c +++ b/sys/sparc64/ebus/ebus.c @@ -371,7 +371,7 @@ ebus_setup_dinfo(struct ebus_softc *sc, phandle_t node, char *name) u_int64_t start; int nreg, nintr, i; - edi = malloc(sizeof(*edi), M_DEVBUF, M_ZERO); + edi = malloc(sizeof(*edi), M_DEVBUF, M_ZERO | M_WAITOK); if (edi == NULL) return (NULL); resource_list_init(&edi->edi_rl); diff --git a/sys/sparc64/pci/ofw_pci.c b/sys/sparc64/pci/ofw_pci.c index 3875a290dda1..3787a00bd0d1 100644 --- a/sys/sparc64/pci/ofw_pci.c +++ b/sys/sparc64/pci/ofw_pci.c @@ -94,7 +94,7 @@ ofw_pci_orb_callback(phandle_t node, u_int8_t *pintptr, int pintsz, bcopy(pregptr, &preg, sizeof(preg)); intr = (OFW_PCI_PHYS_HI_DEVICE(preg.phys_hi) + pintr + 3) % 4 + 1; - *rintr = malloc(sizeof(intr), M_OFWPROP, 0); + *rintr = malloc(sizeof(intr), M_OFWPROP, M_WAITOK); bcopy(&intr, *rintr, sizeof(intr)); *terminate = 0; return (sizeof(intr)); @@ -134,7 +134,7 @@ ofw_pci_alloc_busno(phandle_t node) om = pci_bus_map; pci_bus_map_sz = n + PCI_BUS_MAP_INC; pci_bus_map = malloc(sizeof(*pci_bus_map) * pci_bus_map_sz, - M_DEVBUF, M_ZERO); + M_DEVBUF, M_WAITOK | M_ZERO); if (om != NULL) { bcopy(om, pci_bus_map, sizeof(*om) * osz); free(om, M_DEVBUF); diff --git a/sys/sparc64/pci/psycho.c b/sys/sparc64/pci/psycho.c index 6413fd3e2a64..9fd83e222a41 100644 --- a/sys/sparc64/pci/psycho.c +++ b/sys/sparc64/pci/psycho.c @@ -617,7 +617,7 @@ psycho_attach(device_t dev) */ if (INTVEC(mr) != 0x7e6 && INTVEC(mr) != 0x7e7 && INTVEC(mr) != 0) { - sclr = malloc(sizeof(*sclr), M_DEVBUF, 0); + sclr = malloc(sizeof(*sclr), M_DEVBUF, M_WAITOK); sclr->psc_sc = sc; sclr->psc_clr = clr; intr_setup(PIL_LOW, intr_fast, INTVEC(mr), diff --git a/sys/sparc64/sbus/sbus.c b/sys/sparc64/sbus/sbus.c index 9df93a7d7179..46648291f4f8 100644 --- a/sys/sparc64/sbus/sbus.c +++ b/sys/sparc64/sbus/sbus.c @@ -486,7 +486,7 @@ sbus_setup_dinfo(struct sbus_softc *sc, phandle_t node, char *name) u_int32_t base, iv, *intr; int i, nreg, nintr, slot, rslot; - sdi = malloc(sizeof(*sdi), M_DEVBUF, M_ZERO); + sdi = malloc(sizeof(*sdi), M_DEVBUF, M_ZERO | M_WAITOK); if (sdi == NULL) return (NULL); resource_list_init(&sdi->sdi_rl); diff --git a/sys/sparc64/sparc64/bus_machdep.c b/sys/sparc64/sparc64/bus_machdep.c index 0c26023a22d0..71e1d0b8f967 100644 --- a/sys/sparc64/sparc64/bus_machdep.c +++ b/sys/sparc64/sparc64/bus_machdep.c @@ -623,7 +623,7 @@ nexus_dmamem_alloc_size(bus_dma_tag_t pdmat, bus_dma_tag_t ddmat, void **vaddr, if ((size <= PAGE_SIZE)) { *vaddr = malloc(size, M_DEVBUF, - (flags & BUS_DMA_NOWAIT) ? M_NOWAIT : 0); + (flags & BUS_DMA_NOWAIT) ? M_NOWAIT : M_WAITOK); } else { /* * XXX: Use contigmalloc until it is merged into this facility @@ -631,7 +631,7 @@ nexus_dmamem_alloc_size(bus_dma_tag_t pdmat, bus_dma_tag_t ddmat, void **vaddr, * allocations yet though. */ *vaddr = contigmalloc(size, M_DEVBUF, - (flags & BUS_DMA_NOWAIT) ? M_NOWAIT : 0, + (flags & BUS_DMA_NOWAIT) ? M_NOWAIT : M_WAITOK, 0ul, ddmat->dt_lowaddr, ddmat->dt_alignment ? ddmat->dt_alignment : 1UL, ddmat->dt_boundary); diff --git a/sys/sparc64/sparc64/counter.c b/sys/sparc64/sparc64/counter.c index d90b89f286c3..19bffef94f43 100644 --- a/sys/sparc64/sparc64/counter.c +++ b/sys/sparc64/sparc64/counter.c @@ -83,8 +83,8 @@ sparc64_counter_init(bus_space_tag_t tag, bus_space_handle_t handle, bus_space_write_8(tag, handle, offset + CTR_CT1 + CTR_LIMIT, COUNTER_MASK); /* Register as a time counter. */ - tc = malloc(sizeof(*tc), M_DEVBUF, 0); - sc = malloc(sizeof(*sc), M_DEVBUF, 0); + tc = malloc(sizeof(*tc), M_DEVBUF, M_WAITOK); + sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK); sc->sc_tag = tag; sc->sc_handle = handle; sc->sc_offset = offset + CTR_CT0; diff --git a/sys/sparc64/sparc64/iommu.c b/sys/sparc64/sparc64/iommu.c index 6332ca996293..605946061af0 100644 --- a/sys/sparc64/sparc64/iommu.c +++ b/sys/sparc64/sparc64/iommu.c @@ -684,7 +684,7 @@ iommu_dvmamem_alloc_size(bus_dma_tag_t pt, bus_dma_tag_t dt, if ((error = sparc64_dmamem_alloc_map(dt, mapp)) != 0) return (error); if ((*vaddr = malloc(size, M_IOMMU, - (flags & BUS_DMA_NOWAIT) ? M_NOWAIT : 0)) == NULL) { + (flags & BUS_DMA_NOWAIT) ? M_NOWAIT : M_WAITOK)) == NULL) { error = ENOMEM; sparc64_dmamem_free_map(dt, *mapp); return (error); diff --git a/sys/sparc64/sparc64/mem.c b/sys/sparc64/sparc64/mem.c index 1edb50e3b705..cb20e6a65450 100644 --- a/sys/sparc64/sparc64/mem.c +++ b/sys/sparc64/sparc64/mem.c @@ -150,7 +150,7 @@ mmrw(dev_t dev, struct uio *uio, int flags) case 0: /* mem (physical memory) */ if (buf == NULL) { - buf = malloc(PAGE_SIZE, M_DEVBUF, 0); + buf = malloc(PAGE_SIZE, M_DEVBUF, M_WAITOK); if (buf == NULL) { error = ENOMEM; break; diff --git a/sys/sparc64/sparc64/nexus.c b/sys/sparc64/sparc64/nexus.c index 0a1ee91fced1..cf70ced52f70 100644 --- a/sys/sparc64/sparc64/nexus.c +++ b/sys/sparc64/sparc64/nexus.c @@ -234,7 +234,7 @@ nexus_probe(device_t dev) } cdev = device_add_child(dev, NULL, -1); if (cdev != NULL) { - dinfo = malloc(sizeof(*dinfo), M_NEXUS, 0); + dinfo = malloc(sizeof(*dinfo), M_NEXUS, M_WAITOK); dinfo->ndi_node = child; dinfo->ndi_name = name; dinfo->ndi_device_type = type; diff --git a/sys/sparc64/sparc64/ofw_bus.c b/sys/sparc64/sparc64/ofw_bus.c index 3d5736e7359d..605a347d7940 100644 --- a/sys/sparc64/sparc64/ofw_bus.c +++ b/sys/sparc64/sparc64/ofw_bus.c @@ -108,7 +108,7 @@ ofw_bus_find_intr(u_int8_t *intr, int intrsz, u_int8_t *regs, int physsz, int i, rsz, tsz; rsz = -1; - ref = malloc(physsz + intrsz, M_TEMP, 0); + ref = malloc(physsz + intrsz, M_TEMP, M_WAITOK); if (imapmsk != NULL) { for (i = 0; i < physsz; i++) ref[i] = regs[i] & imapmsk[i]; @@ -131,7 +131,7 @@ ofw_bus_find_intr(u_int8_t *intr, int intrsz, u_int8_t *regs, int physsz, KASSERT(i >= physsz + intrsz + sizeof(parent) + pintrsz, ("ofw_bus_find_intr: truncated map")); if (bcmp(ref, mptr, physsz + intrsz) == 0) { - *result = malloc(pintrsz, M_OFWPROP, 0); + *result = malloc(pintrsz, M_OFWPROP, M_WAITOK); bcopy(mptr + physsz + intrsz + sizeof(parent), *result, pintrsz); rsz = pintrsz; @@ -177,7 +177,7 @@ ofw_bus_route_intr(phandle_t node, int intrp, obr_callback_t *cb) } else { ic = intrp; isz = sizeof(ic); - intr = malloc(isz, M_OFWPROP, 0); + intr = malloc(isz, M_OFWPROP, M_WAITOK); bcopy(&ic, intr, isz); } /* diff --git a/sys/sparc64/sparc64/sys_machdep.c b/sys/sparc64/sparc64/sys_machdep.c index 4a0b51e11335..34be95acf580 100644 --- a/sys/sparc64/sparc64/sys_machdep.c +++ b/sys/sparc64/sparc64/sys_machdep.c @@ -117,7 +117,7 @@ sparc_utrap_install(struct thread *td, char *args) if (ua.type != UTH_NOCHANGE) { if (ut == NULL) { ut = malloc(sizeof *ut, M_SUBPROC, - M_ZERO); + M_WAITOK | M_ZERO); ut->ut_refcnt = 1; td->td_proc->p_md.md_utrap = ut; } diff --git a/sys/sys/malloc.h b/sys/sys/malloc.h index 57b3071df71f..f61043995af6 100644 --- a/sys/sys/malloc.h +++ b/sys/sys/malloc.h @@ -46,9 +46,8 @@ /* * flags to malloc. */ -#ifndef M_NOWAIT +#define M_WAITOK 0x0000 #define M_NOWAIT 0x0001 /* do not block */ -#endif /* M_NOWAIT */ #define M_USE_RESERVE 0x0002 /* can alloc out of reserve memory */ #define M_ZERO 0x0004 /* bzero the allocation */ #define M_NOVM 0x0008 /* don't ask VM for pages */ diff --git a/sys/sys/mbuf.h b/sys/sys/mbuf.h index a66c1fba81cb..0ad8664466ef 100644 --- a/sys/sys/mbuf.h +++ b/sys/sys/mbuf.h @@ -263,13 +263,13 @@ struct mbstat { /* * Flags specifying how an allocation should be made. - * M_NOWAIT means "don't block if nothing is available" whereas - * 0 means "block for mbuf_wait ticks at most if nothing is + * M_DONTWAIT means "don't block if nothing is available" whereas + * M_TRYWAIT means "block for mbuf_wait ticks at most if nothing is * available." */ -#ifndef M_NOWAIT /* malloc.h also defines this. */ -#define M_NOWAIT 0x0001 -#endif +#define M_DONTWAIT 1 +#define M_TRYWAIT 0 +#define M_WAIT M_TRYWAIT /* XXX: Deprecated. */ #ifdef _KERNEL /*- @@ -404,7 +404,7 @@ struct mbstat { #define M_COPYALL 1000000000 /* Compatibility with 4.3. */ -#define m_copy(m, o, l) m_copym((m), (o), (l), M_NOWAIT) +#define m_copy(m, o, l) m_copym((m), (o), (l), M_DONTWAIT) extern int max_datalen; /* MHLEN - max_hdr */ extern int max_hdr; /* Largest link + protocol header */ diff --git a/sys/sys/posix4.h b/sys/sys/posix4.h index 033c1ec46f1b..b17e9270e675 100644 --- a/sys/sys/posix4.h +++ b/sys/sys/posix4.h @@ -56,7 +56,7 @@ int SC (struct thread *td, struct SC##_args *uap) \ MALLOC_DECLARE(M_P31B); -#define p31b_malloc(SIZE) malloc((SIZE), M_P31B, 0) +#define p31b_malloc(SIZE) malloc((SIZE), M_P31B, M_WAITOK) #define p31b_free(P) free((P), M_P31B) int p31b_proc(struct proc *, pid_t, struct proc **); diff --git a/sys/sys/socketvar.h b/sys/sys/socketvar.h index 6b715f228fc1..6b22cfdf8413 100644 --- a/sys/sys/socketvar.h +++ b/sys/sys/socketvar.h @@ -253,7 +253,7 @@ struct xsocket { * Returns error without lock if sleep is interrupted. */ #define sblock(sb, wf) ((sb)->sb_flags & SB_LOCK ? \ - (((wf) == 0) ? sb_lock(sb) : EWOULDBLOCK) : \ + (((wf) == M_WAITOK) ? sb_lock(sb) : EWOULDBLOCK) : \ ((sb)->sb_flags |= SB_LOCK), 0) /* release lock on sockbuf sb */ diff --git a/sys/ufs/ffs/ffs_inode.c b/sys/ufs/ffs/ffs_inode.c index 7af8b6998583..ed4e04c461dc 100644 --- a/sys/ufs/ffs/ffs_inode.c +++ b/sys/ufs/ffs/ffs_inode.c @@ -573,7 +573,7 @@ ffs_indirtrunc(ip, lbn, dbn, lastbn, level, countp) else bap2 = (ufs2_daddr_t *)bp->b_data; if (lastbn != -1) { - MALLOC(copy, caddr_t, fs->fs_bsize, M_TEMP, 0); + MALLOC(copy, caddr_t, fs->fs_bsize, M_TEMP, M_WAITOK); bcopy((caddr_t)bp->b_data, copy, (u_int)fs->fs_bsize); for (i = last + 1; i < NINDIR(fs); i++) BAP(ip, i) = 0; diff --git a/sys/ufs/ffs/ffs_snapshot.c b/sys/ufs/ffs/ffs_snapshot.c index b26d10bd70d6..7fe373d7bcaf 100644 --- a/sys/ufs/ffs/ffs_snapshot.c +++ b/sys/ufs/ffs/ffs_snapshot.c @@ -269,7 +269,7 @@ ffs_snapshot(mp, snapfile) * the suspension period. */ len = howmany(fs->fs_ncg, NBBY); - MALLOC(fs->fs_active, int *, len, M_DEVBUF, 0); + MALLOC(fs->fs_active, int *, len, M_DEVBUF, M_WAITOK); bzero(fs->fs_active, len); for (cg = 0; cg < fs->fs_ncg; cg++) { error = UFS_BALLOC(vp, (off_t)(cgtod(fs, cg)) << fs->fs_fshift, @@ -359,7 +359,7 @@ ffs_snapshot(mp, snapfile) size = blkroundup(fs, fs->fs_cssize); if (fs->fs_contigsumsize > 0) size += fs->fs_ncg * sizeof(int32_t); - space = malloc((u_long)size, M_UFSMNT, 0); + space = malloc((u_long)size, M_UFSMNT, M_WAITOK); copy_fs->fs_csp = space; bcopy(fs->fs_csp, copy_fs->fs_csp, fs->fs_cssize); (char *)space += fs->fs_cssize; @@ -473,7 +473,7 @@ ffs_snapshot(mp, snapfile) VI_UNLOCK(devvp); MALLOC(lkp, struct lock *, sizeof(struct lock), M_UFSMNT, - 0); + M_WAITOK); lockinit(lkp, PVFS, "snaplk", VLKTIMEOUT, LK_CANRECURSE | LK_NOPAUSE); VI_LOCK(vp); @@ -536,7 +536,7 @@ ffs_snapshot(mp, snapfile) snaplistsize = fs->fs_ncg + howmany(fs->fs_cssize, fs->fs_bsize) + FSMAXSNAP + 1 /* superblock */ + 1 /* last block */ + 1 /* size */; MALLOC(snapblklist, daddr_t *, snaplistsize * sizeof(daddr_t), - M_UFSMNT, 0); + M_UFSMNT, M_WAITOK); ip->i_snapblklist = &snapblklist[1]; /* * Expunge the blocks used by the snapshots from the set of @@ -872,7 +872,7 @@ indiracct_ufs1(snapvp, cancelvp, level, blkno, lbn, rlbn, remblks, last = howmany(remblks, blksperindir); if (last > NINDIR(fs)) last = NINDIR(fs); - MALLOC(bap, ufs1_daddr_t *, fs->fs_bsize, M_DEVBUF, 0); + MALLOC(bap, ufs1_daddr_t *, fs->fs_bsize, M_DEVBUF, M_WAITOK); bcopy(bp->b_data, (caddr_t)bap, fs->fs_bsize); bqrelse(bp); error = (*acctfunc)(snapvp, &bap[0], &bap[last], fs, @@ -1147,7 +1147,7 @@ indiracct_ufs2(snapvp, cancelvp, level, blkno, lbn, rlbn, remblks, last = howmany(remblks, blksperindir); if (last > NINDIR(fs)) last = NINDIR(fs); - MALLOC(bap, ufs2_daddr_t *, fs->fs_bsize, M_DEVBUF, 0); + MALLOC(bap, ufs2_daddr_t *, fs->fs_bsize, M_DEVBUF, M_WAITOK); bcopy(bp->b_data, (caddr_t)bap, fs->fs_bsize); bqrelse(bp); error = (*acctfunc)(snapvp, &bap[0], &bap[last], fs, @@ -1731,7 +1731,7 @@ ffs_snapshot_mount(mp) VI_UNLOCK(devvp); MALLOC(lkp, struct lock *, sizeof(struct lock), - M_UFSMNT, 0); + M_UFSMNT, M_WAITOK); lockinit(lkp, PVFS, "snaplk", VLKTIMEOUT, LK_CANRECURSE | LK_NOPAUSE); VI_LOCK(vp); @@ -1779,7 +1779,7 @@ ffs_snapshot_mount(mp) return; } MALLOC(snapblklist, void *, snaplistsize * sizeof(daddr_t), - M_UFSMNT, 0); + M_UFSMNT, M_WAITOK); auio.uio_iovcnt = 1; aiov.iov_base = snapblklist; aiov.iov_len = snaplistsize * sizeof (daddr_t); diff --git a/sys/ufs/ffs/ffs_softdep.c b/sys/ufs/ffs/ffs_softdep.c index fcc892948b8c..872433d14461 100644 --- a/sys/ufs/ffs/ffs_softdep.c +++ b/sys/ufs/ffs/ffs_softdep.c @@ -96,7 +96,7 @@ static MALLOC_DEFINE(M_MKDIR, "mkdir","New directory"); static MALLOC_DEFINE(M_DIRREM, "dirrem","Directory entry deleted"); static MALLOC_DEFINE(M_NEWDIRBLK, "newdirblk","Unclaimed new directory block"); -#define M_SOFTDEP_FLAGS (M_USE_RESERVE) +#define M_SOFTDEP_FLAGS (M_WAITOK | M_USE_RESERVE) #define D_PAGEDEP 0 #define D_INODEDEP 1 diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c index de01977e8457..17e9a401253e 100644 --- a/sys/ufs/ffs/ffs_vfsops.c +++ b/sys/ufs/ffs/ffs_vfsops.c @@ -686,9 +686,9 @@ ffs_mountfs(devvp, mp, td) fs->fs_pendingblocks = 0; fs->fs_pendinginodes = 0; } - ump = malloc(sizeof *ump, M_UFSMNT, M_ZERO); + ump = malloc(sizeof *ump, M_UFSMNT, M_WAITOK | M_ZERO); ump->um_fs = malloc((u_long)fs->fs_sbsize, M_UFSMNT, - 0); + M_WAITOK); if (fs->fs_magic == FS_UFS1_MAGIC) { ump->um_fstype = UFS1; ump->um_balloc = ffs_balloc_ufs1; @@ -715,7 +715,7 @@ ffs_mountfs(devvp, mp, td) if (fs->fs_contigsumsize > 0) size += fs->fs_ncg * sizeof(int32_t); size += fs->fs_ncg * sizeof(u_int8_t); - space = malloc((u_long)size, M_UFSMNT, 0); + space = malloc((u_long)size, M_UFSMNT, M_WAITOK); fs->fs_csp = space; for (i = 0; i < blks; i += fs->fs_frag) { size = fs->fs_bsize; @@ -1248,7 +1248,7 @@ ffs_vget(mp, ino, flags, vpp) * which will cause a panic because ffs_sync() blindly * dereferences vp->v_data (as well it should). */ - ip = uma_zalloc(uma_inode, 0); + ip = uma_zalloc(uma_inode, M_WAITOK); /* Allocate a new vnode/inode. */ error = getnewvnode("ufs", mp, ffs_vnodeop_p, &vp); @@ -1315,9 +1315,9 @@ ffs_vget(mp, ino, flags, vpp) return (error); } if (ip->i_ump->um_fstype == UFS1) - ip->i_din1 = uma_zalloc(uma_ufs1, 0); + ip->i_din1 = uma_zalloc(uma_ufs1, M_WAITOK); else - ip->i_din2 = uma_zalloc(uma_ufs2, 0); + ip->i_din2 = uma_zalloc(uma_ufs2, M_WAITOK); ffs_load_inode(bp, ip, fs, ino); if (DOINGSOFTDEP(vp)) softdep_load_inodeblock(ip); diff --git a/sys/ufs/ffs/ffs_vnops.c b/sys/ufs/ffs/ffs_vnops.c index 4cba12f890c3..66fc2fe18513 100644 --- a/sys/ufs/ffs/ffs_vnops.c +++ b/sys/ufs/ffs/ffs_vnops.c @@ -1381,7 +1381,7 @@ ffs_rdextattr(u_char **p, struct vnode *vp, struct thread *td, int extra) dp = ip->i_din2; easize = dp->di_extsize; - eae = malloc(easize + extra, M_TEMP, 0); + eae = malloc(easize + extra, M_TEMP, M_WAITOK); liovec.iov_base = eae; liovec.iov_len = easize; @@ -1706,7 +1706,7 @@ vop_setextattr { ealength += eapad1 + ealen + eapad2; } - eae = malloc(ip->i_ea_len + ealength, M_TEMP, 0); + eae = malloc(ip->i_ea_len + ealength, M_TEMP, M_WAITOK); bcopy(ip->i_ea_area, eae, ip->i_ea_len); easize = ip->i_ea_len; diff --git a/sys/ufs/ufs/ufs_dirhash.c b/sys/ufs/ufs/ufs_dirhash.c index 27d32efc157d..f2d3a70ff914 100644 --- a/sys/ufs/ufs/ufs_dirhash.c +++ b/sys/ufs/ufs/ufs_dirhash.c @@ -187,7 +187,7 @@ ufsdirhash_build(struct inode *ip) goto fail; for (i = 0; i < narrays; i++) { if ((dh->dh_hash[i] = uma_zalloc(ufsdirhash_zone, - 0)) == NULL) + M_WAITOK)) == NULL) goto fail; for (j = 0; j < DH_NBLKOFF; j++) dh->dh_hash[i][j] = DIRHASH_EMPTY; diff --git a/sys/ufs/ufs/ufs_extattr.c b/sys/ufs/ufs/ufs_extattr.c index 4d5ec66f3e83..b9d7b8941271 100644 --- a/sys/ufs/ufs/ufs_extattr.c +++ b/sys/ufs/ufs/ufs_extattr.c @@ -252,7 +252,7 @@ ufs_extattr_lookup(struct vnode *start_dvp, int lockparent, char *dirname, cnp.cn_flags |= LOCKPARENT; cnp.cn_thread = td; cnp.cn_cred = td->td_ucred; - cnp.cn_pnbuf = uma_zalloc(namei_zone, 0); + cnp.cn_pnbuf = uma_zalloc(namei_zone, M_WAITOK); cnp.cn_nameptr = cnp.cn_pnbuf; error = copystr(dirname, cnp.cn_pnbuf, MAXPATHLEN, (size_t *) &cnp.cn_namelen); @@ -381,7 +381,7 @@ ufs_extattr_iterate_directory(struct ufsmount *ump, struct vnode *dvp, if (dvp->v_type != VDIR) return (ENOTDIR); - MALLOC(dirbuf, char *, DIRBLKSIZ, M_TEMP, 0); + MALLOC(dirbuf, char *, DIRBLKSIZ, M_TEMP, M_WAITOK); auio.uio_iov = &aiov; auio.uio_iovcnt = 1; @@ -592,7 +592,7 @@ ufs_extattr_enable(struct ufsmount *ump, int attrnamespace, return (EINVAL); MALLOC(attribute, struct ufs_extattr_list_entry *, - sizeof(struct ufs_extattr_list_entry), M_UFS_EXTATTR, 0); + sizeof(struct ufs_extattr_list_entry), M_UFS_EXTATTR, M_WAITOK); if (attribute == NULL) return (ENOMEM); diff --git a/sys/ufs/ufs/ufs_quota.c b/sys/ufs/ufs/ufs_quota.c index 683c6bd6139d..258241293e3f 100644 --- a/sys/ufs/ufs/ufs_quota.c +++ b/sys/ufs/ufs/ufs_quota.c @@ -822,7 +822,7 @@ dqget(vp, id, ump, type, dqp) desireddquot += DQUOTINC; if (numdquot < desireddquot) { dq = (struct dquot *)malloc(sizeof *dq, M_DQUOT, - M_ZERO); + M_WAITOK | M_ZERO); numdquot++; } else { if ((dq = TAILQ_FIRST(&dqfreelist)) == NULL) { diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c index de56eece5285..af65b36d80be 100644 --- a/sys/ufs/ufs/ufs_vnops.c +++ b/sys/ufs/ufs/ufs_vnops.c @@ -368,7 +368,7 @@ ufs_access(ap) #ifdef UFS_ACL if ((vp->v_mount->mnt_flag & MNT_ACLS) != 0) { - MALLOC(acl, struct acl *, sizeof(*acl), M_ACL, 0); + MALLOC(acl, struct acl *, sizeof(*acl), M_ACL, M_WAITOK); len = sizeof(*acl); error = VOP_GETACL(vp, ACL_TYPE_ACCESS, acl, ap->a_cred, ap->a_td); @@ -1442,8 +1442,8 @@ ufs_mkdir(ap) #ifdef UFS_ACL acl = dacl = NULL; if ((dvp->v_mount->mnt_flag & MNT_ACLS) != 0) { - MALLOC(acl, struct acl *, sizeof(*acl), M_ACL, 0); - MALLOC(dacl, struct acl *, sizeof(*dacl), M_ACL, 0); + MALLOC(acl, struct acl *, sizeof(*acl), M_ACL, M_WAITOK); + MALLOC(dacl, struct acl *, sizeof(*dacl), M_ACL, M_WAITOK); /* * Retrieve default ACL from parent, if any. @@ -1845,7 +1845,7 @@ ufs_readdir(ap) auio.uio_iovcnt = 1; auio.uio_segflg = UIO_SYSSPACE; aiov.iov_len = count; - MALLOC(dirbuf, caddr_t, count, M_TEMP, 0); + MALLOC(dirbuf, caddr_t, count, M_TEMP, M_WAITOK); aiov.iov_base = dirbuf; error = VOP_READ(ap->a_vp, &auio, 0, ap->a_cred); if (error == 0) { @@ -1889,7 +1889,7 @@ ufs_readdir(ap) dp = (struct dirent *)((caddr_t) dp + dp->d_reclen)) ncookies++; MALLOC(cookies, u_long *, ncookies * sizeof(u_long), M_TEMP, - 0); + M_WAITOK); for (dp = dpStart, cookiep = cookies; dp < dpEnd; dp = (struct dirent *)((caddr_t) dp + dp->d_reclen)) { @@ -2422,7 +2422,7 @@ ufs_makeinode(mode, dvp, vpp, cnp) #ifdef UFS_ACL acl = NULL; if ((dvp->v_mount->mnt_flag & MNT_ACLS) != 0) { - MALLOC(acl, struct acl *, sizeof(*acl), M_ACL, 0); + MALLOC(acl, struct acl *, sizeof(*acl), M_ACL, M_WAITOK); /* * Retrieve default ACL for parent, if any. diff --git a/sys/vm/device_pager.c b/sys/vm/device_pager.c index a0cf5283fba7..e7acedcdbfb1 100644 --- a/sys/vm/device_pager.c +++ b/sys/vm/device_pager.c @@ -266,7 +266,7 @@ dev_pager_getfake(paddr) { vm_page_t m; - m = uma_zalloc(fakepg_zone, 0); + m = uma_zalloc(fakepg_zone, M_WAITOK); m->flags = PG_BUSY | PG_FICTITIOUS; m->valid = VM_PAGE_BITS_ALL; diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c index 58568a2e0298..0fb5d2203113 100644 --- a/sys/vm/swap_pager.c +++ b/sys/vm/swap_pager.c @@ -337,7 +337,7 @@ swap_pager_swap_init() */ for (n = 1; n < n2 / 8; n *= 2) ; - swhash = malloc(sizeof(struct swblock *) * n, M_VMPGDATA, M_ZERO); + swhash = malloc(sizeof(struct swblock *) * n, M_VMPGDATA, M_WAITOK | M_ZERO); swhash_mask = n - 1; } diff --git a/sys/vm/uma.h b/sys/vm/uma.h index 988b79f8867a..769d81af4d12 100644 --- a/sys/vm/uma.h +++ b/sys/vm/uma.h @@ -209,7 +209,7 @@ void uma_zdestroy(uma_zone_t zone); * * Returns: * A non null pointer to an initialized element from the zone is - * garanteed if the wait flag is not M_NOWAIT, otherwise null may be + * garanteed if the wait flag is M_WAITOK, otherwise a null pointer may be * returned if the zone is empty or the ctor failed. */ diff --git a/sys/vm/uma_core.c b/sys/vm/uma_core.c index e7c3f68b986b..1fa83df699a4 100644 --- a/sys/vm/uma_core.c +++ b/sys/vm/uma_core.c @@ -354,7 +354,7 @@ hash_alloc(struct uma_hash *hash) } else { alloc = sizeof(hash->uh_slab_hash[0]) * UMA_HASH_SIZE_INIT; hash->uh_slab_hash = uma_zalloc_internal(hashzone, NULL, - 0); + M_WAITOK); hash->uh_hashsize = UMA_HASH_SIZE_INIT; } if (hash->uh_slab_hash) { @@ -1300,7 +1300,7 @@ uma_zcreate(char *name, size_t size, uma_ctor ctor, uma_dtor dtor, args.align = align; args.flags = flags; - return (uma_zalloc_internal(zones, &args, 0)); + return (uma_zalloc_internal(zones, &args, M_WAITOK)); } /* See uma.h */ @@ -1326,7 +1326,7 @@ uma_zalloc_arg(uma_zone_t zone, void *udata, int flags) if (!(flags & M_NOWAIT)) { KASSERT(curthread->td_intr_nesting_level == 0, - ("malloc without M_NOWAIT in interrupt context")); + ("malloc(M_WAITOK) in interrupt context")); WITNESS_SLEEP(1, NULL); } @@ -1609,7 +1609,7 @@ uma_zalloc_bucket(uma_zone_t zone, int flags) * Arguments * zone The zone to alloc for. * udata The data to be passed to the constructor. - * flags M_NOWAIT, M_ZERO. + * flags M_WAITOK, M_NOWAIT, M_ZERO. * * Returns * NULL if there is no memory and M_NOWAIT is set @@ -1964,7 +1964,7 @@ uma_prealloc(uma_zone_t zone, int items) slabs++; while (slabs > 0) { - slab = slab_zalloc(zone, 0); + slab = slab_zalloc(zone, M_WAITOK); LIST_INSERT_HEAD(&zone->uz_free_slab, slab, us_link); slabs--; } @@ -2074,7 +2074,7 @@ sysctl_vm_zone(SYSCTL_HANDLER_ARGS) cnt++; mtx_unlock(&uma_mtx); MALLOC(tmpbuf, char *, (cnt == 0 ? 1 : cnt) * linesize, - M_TEMP, 0); + M_TEMP, M_WAITOK); len = snprintf(tmpbuf, linesize, "\nITEM SIZE LIMIT USED FREE REQUESTS\n\n"); if (cnt == 0) diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c index 08828159f124..cd3b2e7e54eb 100644 --- a/sys/vm/vm_map.c +++ b/sys/vm/vm_map.c @@ -255,7 +255,7 @@ vmspace_alloc(min, max) struct vmspace *vm; GIANT_REQUIRED; - vm = uma_zalloc(vmspace_zone, 0); + vm = uma_zalloc(vmspace_zone, M_WAITOK); CTR1(KTR_VM, "vmspace_alloc: %p", vm); _vm_map_init(&vm->vm_map, min, max); pmap_pinit(vmspace_pmap(vm)); @@ -513,7 +513,7 @@ vm_map_create(pmap_t pmap, vm_offset_t min, vm_offset_t max) { vm_map_t result; - result = uma_zalloc(mapzone, 0); + result = uma_zalloc(mapzone, M_WAITOK); CTR1(KTR_VM, "vm_map_create: %p", result); _vm_map_init(result, min, max); result->pmap = pmap; @@ -572,7 +572,7 @@ vm_map_entry_create(vm_map_t map) if (map->system_map) new_entry = uma_zalloc(kmapentzone, M_NOWAIT); else - new_entry = uma_zalloc(mapentzone, 0); + new_entry = uma_zalloc(mapentzone, M_WAITOK); if (new_entry == NULL) panic("vm_map_entry_create: kernel resources exhausted"); return (new_entry); diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c index 5f4a04c16678..2fe605d52e9d 100644 --- a/sys/vm/vm_object.c +++ b/sys/vm/vm_object.c @@ -353,7 +353,7 @@ vm_object_allocate_wait(objtype_t type, vm_pindex_t size, int flags) vm_object_t vm_object_allocate(objtype_t type, vm_pindex_t size) { - return(vm_object_allocate_wait(type, size, 0)); + return(vm_object_allocate_wait(type, size, M_WAITOK)); }