diff options
Diffstat (limited to 'sys/kern')
65 files changed, 312 insertions, 312 deletions
diff --git a/sys/kern/imgact_aout.c b/sys/kern/imgact_aout.c index e96054a..a11c17d 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_WAITOK | M_ZERO); + 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 f6b0cb2..e0d49d4 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, M_WAITOK); + tempdata = malloc(sizeof(*tempdata), M_TEMP, 0); 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, M_WAITOK); + path = malloc(MAXPATHLEN, M_TEMP, 0); 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, M_WAITOK); + elf_auxargs = malloc(sizeof(Elf_Auxargs), M_TEMP, 0); 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, M_WAITOK); + hdr = malloc(hdrsize, M_TEMP, 0); 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 | M_WAITOK); + tempdata = malloc(sizeof(*tempdata), M_TEMP, M_ZERO | 0); status = &tempdata->status; fpregset = &tempdata->fpregset; psinfo = &tempdata->psinfo; diff --git a/sys/kern/inflate.c b/sys/kern/inflate.c index 2a16ba2..e814294 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, M_WAITOK)) == + if ((q = (struct huft *) malloc((z + 1) * sizeof(struct huft), M_GZIP, 0)) == (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, M_WAITOK); + p = glbl->gz_slide = malloc(GZ_WSIZE, M_GZIP, 0); #endif if (!glbl->gz_slide) #ifdef _KERNEL diff --git a/sys/kern/kern_alq.c b/sys/kern/kern_alq.c index 7ddacc8..7e86b55 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_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 = 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->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 835ec39..a05eb25 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -667,7 +667,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, M_WAITOK); + MALLOC(sigio, struct sigio *, sizeof(struct sigio), M_SIGIO, 0); sigio->sio_pgid = pgid; sigio->sio_ucred = crhold(curthread->td_ucred); sigio->sio_myref = sigiop; @@ -1052,7 +1052,7 @@ fdalloc(td, want, result) * than KMEM_ZMAX bytes. uma_large_malloc() requires Giant. */ mtx_lock(&Giant); - newofile = malloc(nfiles * OFILESIZE, M_FILEDESC, M_WAITOK); + newofile = malloc(nfiles * OFILESIZE, M_FILEDESC, 0); mtx_unlock(&Giant); /* @@ -1143,7 +1143,7 @@ falloc(td, resultfp, resultfd) struct file *fp, *fq; int error, i; - fp = uma_zalloc(file_zone, M_WAITOK | M_ZERO); + fp = uma_zalloc(file_zone, M_ZERO); sx_xlock(&filelist_lock); if (nfiles >= maxfiles) { sx_xunlock(&filelist_lock); @@ -1213,7 +1213,7 @@ fdinit(fdp) struct filedesc0 *newfdp; MALLOC(newfdp, struct filedesc0 *, sizeof(struct filedesc0), - M_FILEDESC, M_WAITOK | M_ZERO); + M_FILEDESC, 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) @@ -1269,7 +1269,7 @@ fdcopy(fdp) FILEDESC_UNLOCK(fdp); MALLOC(newfdp, struct filedesc *, sizeof(struct filedesc0), - M_FILEDESC, M_WAITOK); + M_FILEDESC, 0); FILEDESC_LOCK(fdp); bcopy(fdp, newfdp, sizeof(struct filedesc)); FILEDESC_UNLOCK(fdp); @@ -1309,7 +1309,7 @@ retry: i /= 2; FILEDESC_UNLOCK(fdp); MALLOC(newfdp->fd_ofiles, struct file **, i * OFILESIZE, - M_FILEDESC, M_WAITOK); + M_FILEDESC, 0); 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 98f5fc6..70ba635 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, M_WAITOK); + name = malloc(KENV_MNAMELEN, M_TEMP, 0); 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, M_WAITOK); + value = malloc(len, M_TEMP, 0); 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_WAITOK | M_ZERO); + kenvp = malloc(KENV_SIZE * sizeof(char *), M_KENV, M_ZERO); i = 0; for (cp = kern_envp; cp != NULL; cp = kernenv_next(cp)) { len = strlen(cp) + 1; - kenvp[i] = malloc(len, M_KENV, M_WAITOK); + kenvp[i] = malloc(len, M_KENV, 0); 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, M_WAITOK); + ret = malloc(len, M_KENV, 0); 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, M_WAITOK); + buf = malloc(namelen + vallen, M_KENV, 0); 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 d360c5c..aecb9f9 100644 --- a/sys/kern/kern_event.c +++ b/sys/kern/kern_event.c @@ -329,7 +329,7 @@ filt_timerattach(struct knote *kn) kn->kn_flags |= EV_CLEAR; /* automatically set */ MALLOC(calloutp, struct callout *, sizeof(*calloutp), - M_KQUEUE, M_WAITOK); + M_KQUEUE, 0); callout_init(calloutp, 0); callout_reset(calloutp, tticks, filt_timerexpire, kn); kn->kn_hook = calloutp; @@ -371,7 +371,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_WAITOK | M_ZERO); + kq = malloc(sizeof(struct kqueue), M_KQUEUE, M_ZERO); TAILQ_INIT(&kq->kq_head); FILE_LOCK(fp); fp->f_flag = FREAD | FWRITE; @@ -979,7 +979,7 @@ knote_attach(struct knote *kn, struct filedesc *fdp) size += KQEXTENT; FILEDESC_UNLOCK(fdp); MALLOC(list, struct klist *, - size * sizeof(struct klist *), M_KQUEUE, M_WAITOK); + size * sizeof(struct klist *), M_KQUEUE, 0); FILEDESC_LOCK(fdp); if (fdp->fd_knlistsize > kn->kn_id) { FREE(list, M_KQUEUE); @@ -1073,7 +1073,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, M_WAITOK)); + return ((struct knote *)uma_zalloc(knote_zone, 0)); } static void diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index 17e18b2..33a0764 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -428,7 +428,7 @@ interpret: oldprocsig = p->p_procsig; PROC_UNLOCK(p); MALLOC(newprocsig, struct procsig *, sizeof(struct procsig), - M_SUBPROC, M_WAITOK); + M_SUBPROC, 0); bcopy(oldprocsig, newprocsig, sizeof(*newprocsig)); newprocsig->ps_refcnt = 1; oldprocsig->ps_refcnt--; @@ -1174,7 +1174,7 @@ exec_register(execsw_arg) if (execsw) for (es = execsw; *es; es++) count++; - newexecsw = malloc(count * sizeof(*es), M_TEMP, M_WAITOK); + newexecsw = malloc(count * sizeof(*es), M_TEMP, 0); if (newexecsw == NULL) return (ENOMEM); xs = newexecsw; @@ -1208,7 +1208,7 @@ exec_unregister(execsw_arg) for (es = execsw; *es; es++) if (*es != execsw_arg) count++; - newexecsw = malloc(count * sizeof(*es), M_TEMP, M_WAITOK); + newexecsw = malloc(count * sizeof(*es), M_TEMP, 0); if (newexecsw == NULL) return (ENOMEM); xs = newexecsw; diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c index c34f26f..0b2c2e8 100644 --- a/sys/kern/kern_exit.c +++ b/sys/kern/kern_exit.c @@ -241,7 +241,7 @@ exit1(td, rv) stopprofclock(p); MALLOC(p->p_ru, struct rusage *, sizeof(struct rusage), - M_ZOMBIE, M_WAITOK); + M_ZOMBIE, 0); /* * 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 7361757..f84afa8 100644 --- a/sys/kern/kern_fork.c +++ b/sys/kern/kern_fork.c @@ -306,7 +306,7 @@ fork1(td, flags, pages, procp) } /* Allocate new proc. */ - newproc = uma_zalloc(proc_zone, M_WAITOK); + newproc = uma_zalloc(proc_zone, 0); #ifdef MAC mac_init_proc(newproc); #endif @@ -431,12 +431,12 @@ again: */ if (flags & RFSIGSHARE) { MALLOC(newsigacts, struct sigacts *, - sizeof(struct sigacts), M_SUBPROC, M_WAITOK); + sizeof(struct sigacts), M_SUBPROC, 0); newprocsig = NULL; } else { newsigacts = NULL; MALLOC(newprocsig, struct procsig *, sizeof(struct procsig), - M_SUBPROC, M_WAITOK); + M_SUBPROC, 0); } /* diff --git a/sys/kern/kern_intr.c b/sys/kern/kern_intr.c index cf59169..75b0627 100644 --- a/sys/kern/kern_intr.c +++ b/sys/kern/kern_intr.c @@ -176,7 +176,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_WAITOK | M_ZERO); + ithd = malloc(sizeof(struct ithd), M_ITHREAD, M_ZERO); ithd->it_vector = vector; ithd->it_disable = disable; ithd->it_enable = enable; @@ -248,7 +248,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_WAITOK | M_ZERO); + ih = malloc(sizeof(struct intrhand), M_ITHREAD, 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 15f4b36..f367d4f 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_WAITOK | M_ZERO); + MALLOC(pr, struct prison *, sizeof *pr , M_PRISON, 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 31ed03e..78bce30 100644 --- a/sys/kern/kern_kse.c +++ b/sys/kern/kern_kse.c @@ -729,7 +729,7 @@ thread_reap(void) struct ksegrp * ksegrp_alloc(void) { - return (uma_zalloc(ksegrp_zone, M_WAITOK)); + return (uma_zalloc(ksegrp_zone, 0)); } /* @@ -738,7 +738,7 @@ ksegrp_alloc(void) struct kse * kse_alloc(void) { - return (uma_zalloc(kse_zone, M_WAITOK)); + return (uma_zalloc(kse_zone, 0)); } /* @@ -748,7 +748,7 @@ struct thread * thread_alloc(void) { thread_reap(); /* check if any zombies to get */ - return (uma_zalloc(thread_zone, M_WAITOK)); + return (uma_zalloc(thread_zone, 0)); } /* diff --git a/sys/kern/kern_ktrace.c b/sys/kern/kern_ktrace.c index bb4642c..23f6f7b 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, M_WAITOK); + req = malloc(sizeof(struct ktr_request), M_KTRACE, 0); 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, - M_WAITOK); + 0); 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, M_WAITOK); + buf = malloc(buflen, M_KTRACE, 0); 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, M_WAITOK); + buf = malloc(namelen, M_KTRACE, 0); 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, M_WAITOK); + buf = malloc(datalen, M_KTRACE, 0); 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, M_WAITOK); + cp = malloc(uap->len, M_KTRACE, 0); 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 3c38bac..fcecdd9 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, M_WAITOK)) != NULL) + if ((result = malloc((strlen(str) + 1), M_LINKER, 0)) != 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, M_WAITOK); + koname = malloc(strlen(filename) + 4, M_LINKER, 0); 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, M_WAITOK); + lf = (linker_file_t)kobj_create((kobj_class_t)lc, M_LINKER, 0); 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_WAITOK | M_ZERO); + M_LINKER, 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_WAITOK | M_ZERO); + 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, M_WAITOK); + pathname = malloc(MAXPATHLEN, M_TEMP, 0); 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, M_WAITOK); + pathname = malloc(MAXPATHLEN, M_TEMP, 0); 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, M_WAITOK); + symstr = malloc(MAXPATHLEN, M_TEMP, 0); 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, M_WAITOK); + result = malloc(reclen, M_LINKER, 0); 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, M_WAITOK); + pathbuf = malloc(reclen, M_LINKER, 0); 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, M_WAITOK); + hints = malloc(vattr.va_size, M_TEMP, 0); 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 cb1fad4..b5d4204 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, M_WAITOK); + MALLOC(lock, struct lockf *, sizeof *lock, M_LOCKF, 0); 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, M_WAITOK); + MALLOC(splitlock, struct lockf *, sizeof *splitlock, M_LOCKF, 0); 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 e9d9eeb..b4df06f 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|M_WAITOK); + label = malloc(sizeof(struct label), M_MACPIPELABEL, M_ZERO); 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, M_WAITOK); + buffer = malloc(mac.m_buflen, M_MACTEMP, 0); 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, M_WAITOK); + elements = malloc(mac.m_buflen, M_MACTEMP, 0); 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_WAITOK | M_ZERO); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_ZERO); error = mac_externalize_ifnet_label(&ifnet->if_label, elements, - buffer, mac.m_buflen, M_WAITOK); + buffer, mac.m_buflen, 0); 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, M_WAITOK); + buffer = malloc(mac.m_buflen, M_MACTEMP, 0); 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, M_WAITOK); + buffer = malloc(mac->m_buflen, M_MACTEMP, 0); error = copyinstr(mac->m_string, buffer, mac->m_buflen, NULL); if (error) { free(buffer, M_MACTEMP); return (error); } - mac_init_socket_label(&intlabel, M_WAITOK); + mac_init_socket_label(&intlabel, 0); 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, M_WAITOK); + elements = malloc(mac->m_buflen, M_MACTEMP, 0); 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_WAITOK | M_ZERO); + buffer = malloc(mac->m_buflen, M_MACTEMP, M_ZERO); error = mac_externalize_socket_label(&so->so_label, elements, - buffer, mac->m_buflen, M_WAITOK); + buffer, mac->m_buflen, 0); 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, M_WAITOK); + elements = malloc(mac->m_buflen, M_MACTEMP, 0); 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_WAITOK | M_ZERO); + buffer = malloc(mac->m_buflen, M_MACTEMP, M_ZERO); error = mac_externalize_socket_peer_label(&so->so_peerlabel, - elements, buffer, mac->m_buflen, M_WAITOK); + elements, buffer, mac->m_buflen, 0); 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, M_WAITOK); + elements = malloc(mac.m_buflen, M_MACTEMP, 0); 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_WAITOK | M_ZERO); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_ZERO); error = mac_externalize_cred_label(&tcred->cr_label, elements, - buffer, mac.m_buflen, M_WAITOK); + buffer, mac.m_buflen, 0); 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, M_WAITOK); + elements = malloc(mac.m_buflen, M_MACTEMP, 0); 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_WAITOK | M_ZERO); + buffer = malloc(mac.m_buflen, M_MACTEMP, M_ZERO); error = mac_externalize_cred_label(&td->td_ucred->cr_label, - elements, buffer, mac.m_buflen, M_WAITOK); + elements, buffer, mac.m_buflen, 0); 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, M_WAITOK); + buffer = malloc(mac.m_buflen, M_MACTEMP, 0); 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, M_WAITOK); + elements = malloc(mac.m_buflen, M_MACTEMP, 0); 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_WAITOK | M_ZERO); + buffer = malloc(mac.m_buflen, M_MACTEMP, 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, M_WAITOK); + elements, buffer, mac.m_buflen, 0); mac_destroy_vnode_label(&intlabel); break; case DTYPE_PIPE: error = mac_externalize_pipe_label(&intlabel, elements, - buffer, mac.m_buflen, M_WAITOK); + buffer, mac.m_buflen, 0); 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, M_WAITOK); + elements = malloc(mac.m_buflen, M_MACTEMP, 0); 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_WAITOK | M_ZERO); + buffer = malloc(mac.m_buflen, M_MACTEMP, 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, M_WAITOK); + mac.m_buflen, 0); 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, M_WAITOK); + elements = malloc(mac.m_buflen, M_MACTEMP, 0); 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_WAITOK | M_ZERO); + buffer = malloc(mac.m_buflen, M_MACTEMP, 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, M_WAITOK); + mac.m_buflen, 0); 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, M_WAITOK); + buffer = malloc(mac.m_buflen, M_MACTEMP, 0); 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, M_WAITOK); + buffer = malloc(mac.m_buflen, M_MACTEMP, 0); 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, M_WAITOK); + buffer = malloc(mac.m_buflen, M_MACTEMP, 0); 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 577b5da..6122a52 100644 --- a/sys/kern/kern_malloc.c +++ b/sys/kern/kern_malloc.c @@ -170,7 +170,7 @@ malloc(size, type, flags) #endif if (!(flags & M_NOWAIT)) KASSERT(curthread->td_intr_nesting_level == 0, - ("malloc(M_WAITOK) in interrupt context")); + ("malloc() without M_NOWAIT in interrupt context")); if (size <= KMEM_ZMAX) { if (size & KMEM_ZMASK) size = (size & ~KMEM_ZMASK) + KMEM_ZBASE; @@ -203,7 +203,7 @@ out: mtx_unlock(&ksp->ks_mtx); if (!(flags & M_NOWAIT)) - KASSERT(va != NULL, ("malloc(M_WAITOK) returned NULL")); + KASSERT(va != NULL, ("malloc() without M_NOWAIT returned NULL")); if (va == NULL) { t_malloc_fail = time_uptime; } @@ -493,7 +493,7 @@ sysctl_kern_malloc(SYSCTL_HANDLER_ARGS) mtx_unlock(&malloc_mtx); bufsize = linesize * (cnt + 1); - p = buf = (char *)malloc(bufsize, M_TEMP, M_WAITOK|M_ZERO); + p = buf = (char *)malloc(bufsize, M_TEMP, M_ZERO); mtx_lock(&malloc_mtx); len = snprintf(p, linesize, @@ -573,7 +573,7 @@ sysctl_kern_mprof(SYSCTL_HANDLER_ARGS) waste = 0; mem = 0; - p = buf = (char *)malloc(bufsize, M_TEMP, M_WAITOK|M_ZERO); + p = buf = (char *)malloc(bufsize, M_TEMP, 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 677d9f1..84ad1c6 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, M_WAITOK); + newmod = malloc(sizeof(struct module) + namelen, M_MODULE, 0); if (newmod == NULL) return (ENOMEM); MOD_XLOCK; diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c index 00f6186..73062c2 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, - M_WAITOK); + 0); 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 1e21b9e..0d8865a 100644 --- a/sys/kern/kern_prot.c +++ b/sys/kern/kern_prot.c @@ -345,8 +345,8 @@ setsid(register struct thread *td, struct setsid_args *uap) error = 0; pgrp = NULL; - 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); + MALLOC(newpgrp, struct pgrp *, sizeof(struct pgrp), M_PGRP, M_ZERO); + MALLOC(newsess, struct session *, sizeof(struct session), M_SESSION, M_ZERO); sx_xlock(&proctree_lock); @@ -408,7 +408,7 @@ setpgid(struct thread *td, register struct setpgid_args *uap) error = 0; - MALLOC(newpgrp, struct pgrp *, sizeof(struct pgrp), M_PGRP, M_WAITOK | M_ZERO); + MALLOC(newpgrp, struct pgrp *, sizeof(struct pgrp), M_PGRP, M_ZERO); sx_xlock(&proctree_lock); if (uap->pid != 0 && uap->pid != curp->p_pid) { @@ -1687,7 +1687,7 @@ crget(void) { register struct ucred *cr; - MALLOC(cr, struct ucred *, sizeof(*cr), M_CRED, M_WAITOK | M_ZERO); + MALLOC(cr, struct ucred *, sizeof(*cr), M_CRED, 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 a0f263d..4ade890 100644 --- a/sys/kern/kern_resource.c +++ b/sys/kern/kern_resource.c @@ -839,7 +839,7 @@ limcopy(lim) register struct plimit *copy; MALLOC(copy, struct plimit *, sizeof(struct plimit), - M_SUBPROC, M_WAITOK); + M_SUBPROC, 0); bcopy(lim->pl_rlimit, copy->pl_rlimit, sizeof(struct plimit)); copy->p_lflags = 0; copy->p_refcnt = 1; @@ -896,7 +896,7 @@ uifind(uid) struct uidinfo *old_uip; mtx_unlock(&uihashtbl_mtx); - uip = malloc(sizeof(*uip), M_UIDINFO, M_WAITOK | M_ZERO); + uip = malloc(sizeof(*uip), M_UIDINFO, 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 154b6e03..dca389f 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, M_WAITOK); + hashtbl = malloc((u_long)hashsize * sizeof(*hashtbl), type, 0); 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, M_WAITOK); + hashtbl = malloc((u_long)hashsize * sizeof(*hashtbl), type, 0); 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 08d1f80..0a0d94c 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, M_WAITOK); + e = malloc(sizeof(struct sysctl_ctx_entry), M_SYSCTLOID, 0); 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_WAITOK|M_ZERO); + oidp = malloc(sizeof(struct sysctl_oid), M_SYSCTLOID, 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, M_WAITOK); + newname = malloc(len + 1, M_SYSCTLOID, 0); 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, M_WAITOK); + M_SYSCTLOID, 0); 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, M_WAITOK); + oidp->descr = malloc(len, M_SYSCTLOID, 0); 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, M_WAITOK); + p = malloc(req->newlen+1, M_SYSCTL, 0); 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, M_WAITOK); + tmparg = malloc(outlen, M_SYSCTLTMP, 0); 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, M_WAITOK); + tmparg = malloc(arg2, M_SYSCTLTMP, 0); 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 31ed03e..78bce30 100644 --- a/sys/kern/kern_thread.c +++ b/sys/kern/kern_thread.c @@ -729,7 +729,7 @@ thread_reap(void) struct ksegrp * ksegrp_alloc(void) { - return (uma_zalloc(ksegrp_zone, M_WAITOK)); + return (uma_zalloc(ksegrp_zone, 0)); } /* @@ -738,7 +738,7 @@ ksegrp_alloc(void) struct kse * kse_alloc(void) { - return (uma_zalloc(kse_zone, M_WAITOK)); + return (uma_zalloc(kse_zone, 0)); } /* @@ -748,7 +748,7 @@ struct thread * thread_alloc(void) { thread_reap(); /* check if any zombies to get */ - return (uma_zalloc(thread_zone, M_WAITOK)); + return (uma_zalloc(thread_zone, 0)); } /* diff --git a/sys/kern/link_elf.c b/sys/kern/link_elf.c index f15803f..6c3e4d4 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, M_WAITOK); + newfilename = malloc(strlen(lf->filename) + 1, M_LINKER, 0); 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, M_WAITOK); + firstpage = malloc(PAGE_SIZE, M_LINKER, 0); 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, M_WAITOK); + ef->address = malloc(mapsize, M_LINKER, 0); 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_WAITOK | M_ZERO); + shdr = malloc(nbytes, M_LINKER, 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, M_WAITOK); + ef->symbase = malloc(symcnt, M_LINKER, 0); strcnt = shdr[symstrindex].sh_size; - ef->strbase = malloc(strcnt, M_LINKER, M_WAITOK); + ef->strbase = malloc(strcnt, M_LINKER, 0); 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, M_WAITOK); + setsym = malloc(len, M_LINKER, 0); if (setsym == NULL) return ENOMEM; diff --git a/sys/kern/link_elf_obj.c b/sys/kern/link_elf_obj.c index f15803f..6c3e4d4 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, M_WAITOK); + newfilename = malloc(strlen(lf->filename) + 1, M_LINKER, 0); 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, M_WAITOK); + firstpage = malloc(PAGE_SIZE, M_LINKER, 0); 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, M_WAITOK); + ef->address = malloc(mapsize, M_LINKER, 0); 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_WAITOK | M_ZERO); + shdr = malloc(nbytes, M_LINKER, 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, M_WAITOK); + ef->symbase = malloc(symcnt, M_LINKER, 0); strcnt = shdr[symstrindex].sh_size; - ef->strbase = malloc(strcnt, M_LINKER, M_WAITOK); + ef->strbase = malloc(strcnt, M_LINKER, 0); 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, M_WAITOK); + setsym = malloc(len, M_LINKER, 0); if (setsym == NULL) return ENOMEM; diff --git a/sys/kern/subr_blist.c b/sys/kern/subr_blist.c index a58e548..8acf5f5 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_WAITOK | M_ZERO); + bl = malloc(sizeof(struct blist), M_SWAP, 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, M_WAITOK); + bl->bl_root = malloc(sizeof(blmeta_t) * bl->bl_rootblks, M_SWAP, 0); #if defined(BLIST_DEBUG) printf( diff --git a/sys/kern/subr_clist.c b/sys/kern/subr_clist.c index 165f628..e4da151 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 M_WAITOK\n"); - cbp = malloc(sizeof *cbp, M_TTYS, M_WAITOK); +"cblock_alloc_cblocks: M_NOWAIT malloc failed, trying blocking malloc\n"); + cbp = malloc(sizeof *cbp, M_TTYS, 0); } /* * Freed cblocks have zero quotes and garbage elsewhere. diff --git a/sys/kern/subr_disk.c b/sys/kern/subr_disk.c index 4d2a02d..8eb6f1a 100644 --- a/sys/kern/subr_disk.c +++ b/sys/kern/subr_disk.c @@ -176,7 +176,7 @@ disk_create(int unit, struct disk *dp, int flags, struct cdevsw *cdevsw, struct } bzero(dp, sizeof(*dp)); - dp->d_label = malloc(sizeof *dp->d_label, M_DEVBUF, M_WAITOK|M_ZERO); + dp->d_label = malloc(sizeof *dp->d_label, M_DEVBUF, M_ZERO); if (proto->d_open != diskopen) { *proto = *cdevsw; diff --git a/sys/kern/subr_diskslice.c b/sys/kern/subr_diskslice.c index ee2f236..f674c37 100644 --- a/sys/kern/subr_diskslice.c +++ b/sys/kern/subr_diskslice.c @@ -97,7 +97,7 @@ clone_label(lp) { struct disklabel *lp1; - lp1 = malloc(sizeof *lp1, M_DEVBUF, M_WAITOK); + lp1 = malloc(sizeof *lp1, M_DEVBUF, 0); *lp1 = *lp; lp = NULL; if (lp1->d_typename[0] == '\0') @@ -254,7 +254,7 @@ dscheck(bp, ssp) && sp->ds_offset != 0) { struct iodone_chain *ic; - ic = malloc(sizeof *ic , M_DEVBUF, M_WAITOK); + ic = malloc(sizeof *ic , M_DEVBUF, 0); ic->ic_prev_flags = bp->bio_flags; ic->ic_prev_iodone = bp->bio_done; ic->ic_prev_iodone_chain = bp->bio_done_chain; @@ -394,7 +394,7 @@ dsioctl(dev, cmd, data, flags, sspp) return (ENODEV); if (!(flags & FWRITE)) return (EBADF); - lp = malloc(sizeof *lp, M_DEVBUF, M_WAITOK); + lp = malloc(sizeof *lp, M_DEVBUF, 0); if (sp->ds_label == NULL) bzero(lp, sizeof *lp); else @@ -450,7 +450,7 @@ dsioctl(dev, cmd, data, flags, sspp) * complete, then lock out future accesses and opens. */ *sspp = NULL; - lp = malloc(sizeof *lp, M_DEVBUF, M_WAITOK); + lp = malloc(sizeof *lp, M_DEVBUF, 0); *lp = *ssp->dss_slices[WHOLE_DISK_SLICE].ds_label; error = dsopen(dev, S_IFCHR, ssp->dss_oflags, sspp, lp); if (error != 0) { @@ -567,7 +567,7 @@ dsmakeslicestruct(nslices, lp) struct diskslices *ssp; ssp = malloc(offsetof(struct diskslices, dss_slices) + - nslices * sizeof *sp, M_DEVBUF, M_WAITOK); + nslices * sizeof *sp, M_DEVBUF, 0); ssp->dss_first_bsd_slice = COMPATIBILITY_SLICE; ssp->dss_nslices = nslices; ssp->dss_oflags = 0; diff --git a/sys/kern/subr_mbuf.c b/sys/kern/subr_mbuf.c index 21e1a40..7f3f960 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_DONTWAIT, pcpu_cnt) + if (mb_pop_cont(&mb_list_mbuf, M_NOWAIT, 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_DONTWAIT, pcpu_cnt) + if (mb_pop_cont(&mb_list_clust, M_NOWAIT, 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 == M_TRYWAIT ? M_WAITOK : M_NOWAIT); + how == 0 ? 0 : M_NOWAIT); if (bucket == NULL) return (NULL); p = (caddr_t)kmem_malloc(mb_list->ml_map, PAGE_SIZE, - how == M_TRYWAIT ? M_WAITOK : M_NOWAIT); + how == 0 ? 0 : M_NOWAIT); if (p == NULL) { free(bucket, M_MBUF); - if (how == M_TRYWAIT) + if (how == 0) 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 (M_TRYWAIT). + * in our map; then we try to block if we're willing to wait. */ 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 == M_TRYWAIT) { + if (how == 0) { /* * 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 - * M_TRYWAIT. We first drain all the protocols, then try to find an mbuf + * 0. 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: M_TRYWAIT to try to block for kern.ipc.mbuf_wait number of ticks - * if really starved for memory. M_DONTWAIT to never block. + * - how: 0 to try to block for kern.ipc.mbuf_wait number of ticks + * if really starved for memory. M_NOWAIT 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: M_TRYWAIT to try to block for kern.ipc.mbuf_wait number of ticks - * if really starved for memory. M_DONTWAIT to never block. + * - how: 0 to try to block for kern.ipc.mbuf_wait number of ticks + * if really starved for memory. M_NOWAIT to never block. * - type: the type of the mbuf being allocated. */ struct mbuf * @@ -1248,8 +1248,8 @@ failed: * Allocate and return a single M_PKTHDR mbuf. NULL is returned on failure. * * Arguments: - * - 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. + * - how: 0 to try to block for kern.ipc.mbuf_wait number of ticks + * if really starved for memory. M_NOWAIT to never block. * - type: the type of the mbuf being allocated. */ struct mbuf * @@ -1275,8 +1275,8 @@ m_gethdr(int how, short type) * returned on failure. * * Arguments: - * - 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. + * - how: 0 to try to block for kern.ipc.mbuf_wait number of ticks + * if really starved for memory. M_NOWAIT to never block. * - type: the type of the mbuf being allocated. */ struct mbuf * @@ -1297,8 +1297,8 @@ m_get_clrd(int how, short type) * returned on failure. * * Arguments: - * - 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. + * - how: 0 to try to block for kern.ipc.mbuf_wait number of ticks + * if really starved for memory. M_NOWAIT to never block. * - type: the type of the mbuf being allocated. */ struct mbuf * @@ -1421,8 +1421,8 @@ m_freem(struct mbuf *mb) * NULL on failure. * * Arguments: - * - 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. + * - how: 0 to try to block for kern.ipc.mbuf_wait number of ticks + * if really starved for memory. M_NOWAIT 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. @@ -1473,8 +1473,8 @@ m_getcl(int how, short type, int flags) * * Arguments: * - mb: the existing mbuf to which to attach the allocated cluster. - * - 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. + * - how: 0 to try to block for kern.ipc.mbuf_wait number of ticks + * if really starved for memory. M_NOWAIT 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 b0aef5c..851bc7a 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(M_TRYWAIT, MT_DATA); + m = m_gethdr(0, 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(M_TRYWAIT, MT_DATA); + mn = m_get(0, 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, M_TRYWAIT, MT_DATA); + m = m_getm(m, size, 0, MT_DATA); if (m == NULL) return ENOBUFS; } @@ -293,7 +293,7 @@ md_init(struct mdchain *mdp) { struct mbuf *m; - m = m_gethdr(M_TRYWAIT, MT_DATA); + m = m_gethdr(0, MT_DATA); if (m == NULL) return ENOBUFS; m->m_len = 0; @@ -501,7 +501,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, M_TRYWAIT); + rm = m_copym(m, mdp->md_pos - mtod(m, u_char*), size, 0); 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 5f299f9..56f0c2e 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, M_WAITOK); - MALLOC(consbuffer, char *, CONSCHUNK, M_TEMP, M_WAITOK); + MALLOC(miov, struct iovec *, iovlen, M_TEMP, 0); + MALLOC(consbuffer, char *, CONSCHUNK, M_TEMP, 0); 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 4959595..2c22a92 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, M_WAITOK); + M_GPROF, 0); /* * 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_WAITOK | M_ZERO); + M_GPROF, 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 9e63e8e..f4ec519 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, M_WAITOK) +#define SBMALLOC(size) malloc(size, M_SBUF, 0) #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 c26cf47..9e3ccff 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, M_WAITOK); + MALLOC(iov, struct iovec *, iovlen, M_IOV, 0); 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, M_WAITOK); + MALLOC(ktriov, struct iovec *, iovlen, M_TEMP, 0); 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, M_WAITOK); + MALLOC(iov, struct iovec *, iovlen, M_IOV, 0); 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, M_WAITOK); + MALLOC(ktriov, struct iovec *, iovlen, M_TEMP, 0); 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, M_WAITOK); + memp = malloc((u_long)size, M_IOCTLOPS, 0); 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, M_WAITOK); + selbits = malloc(nbufbytes, M_SELECT, 0); /* * 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, M_WAITOK); + bits = malloc(ni, M_TEMP, 0); else bits = smallbits; error = copyin(uap->fds, bits, ni); diff --git a/sys/kern/sys_pipe.c b/sys/kern/sys_pipe.c index 915ee3e..937e909 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_WAITOK | M_ZERO); + pmtx = malloc(sizeof(*pmtx), M_TEMP, 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, M_WAITOK); + *cpipep = uma_zalloc(pipe_zone, 0); if (*cpipep == NULL) return (ENOMEM); diff --git a/sys/kern/sysv_msg.c b/sys/kern/sysv_msg.c index d85cf29..00d0fbb 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, M_WAITOK); + msgpool = malloc(msginfo.msgmax, M_MSG, 0); if (msgpool == NULL) panic("msgpool is NULL"); - msgmaps = malloc(sizeof(struct msgmap) * msginfo.msgseg, M_MSG, M_WAITOK); + msgmaps = malloc(sizeof(struct msgmap) * msginfo.msgseg, M_MSG, 0); if (msgmaps == NULL) panic("msgmaps is NULL"); - msghdrs = malloc(sizeof(struct msg) * msginfo.msgtql, M_MSG, M_WAITOK); + msghdrs = malloc(sizeof(struct msg) * msginfo.msgtql, M_MSG, 0); if (msghdrs == NULL) panic("msghdrs is NULL"); - msqids = malloc(sizeof(struct msqid_ds) * msginfo.msgmni, M_MSG, M_WAITOK); + msqids = malloc(sizeof(struct msqid_ds) * msginfo.msgmni, M_MSG, 0); if (msqids == NULL) panic("msqids is NULL"); diff --git a/sys/kern/sysv_sem.c b/sys/kern/sysv_sem.c index 737ddba..f27d167 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, M_WAITOK); + sem = malloc(sizeof(struct sem) * seminfo.semmns, M_SEM, 0); sema = malloc(sizeof(struct semid_ds) * seminfo.semmni, M_SEM, - M_WAITOK); + 0); sema_mtx = malloc(sizeof(struct mtx) * seminfo.semmni, M_SEM, - M_WAITOK | M_ZERO); - semu = malloc(seminfo.semmnu * seminfo.semusz, M_SEM, M_WAITOK); + M_ZERO); + semu = malloc(seminfo.semmnu * seminfo.semusz, M_SEM, 0); 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, - M_WAITOK); + 0); mtx_lock(sema_mtxp); if ((error = semvalid(uap->semid, semaptr)) != 0) goto done2; @@ -702,7 +702,7 @@ raced: mtx_unlock(sema_mtxp); if ((error = copyin(arg, &real_arg, sizeof(real_arg))) != 0) goto done2; - array = malloc(sizeof(*array) * count, M_TEMP, M_WAITOK); + array = malloc(sizeof(*array) * count, M_TEMP, 0); copyin(real_arg.array, array, count * sizeof(*array)); if (error) break; @@ -897,7 +897,7 @@ semop(td, uap) nsops)); return (E2BIG); } - sops = malloc(nsops * sizeof(sops[0]), M_SEM, M_WAITOK); + sops = malloc(nsops * sizeof(sops[0]), M_SEM, 0); 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 04c9b2a..e045310 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, M_WAITOK); + shmmap_s = malloc(size, M_SHM, 0); 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, M_WAITOK); + malloc(sizeof(struct shm_handle), M_SHM, 0); 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, M_WAITOK); + shmmap_s = malloc(size, M_SHM, 0); 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, M_WAITOK); + newsegs = malloc(shminfo.shmmni * sizeof(*newsegs), M_SHM, 0); if (newsegs == NULL) return; for (i = 0; i < shmalloced; i++) @@ -818,7 +818,7 @@ shminit() TUNABLE_INT_FETCH("kern.ipc.shm_use_phys", &shm_use_phys); shmalloced = shminfo.shmmni; - shmsegs = malloc(shmalloced * sizeof(shmsegs[0]), M_SHM, M_WAITOK); + shmsegs = malloc(shmalloced * sizeof(shmsegs[0]), M_SHM, 0); 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 e749020..4a223ff 100644 --- a/sys/kern/tty.c +++ b/sys/kern/tty.c @@ -2594,7 +2594,7 @@ ttymalloc(struct tty *tp) if (tp) return(tp); - tp = malloc(sizeof *tp, M_TTYS, M_WAITOK | M_ZERO); + tp = malloc(sizeof *tp, M_TTYS, M_ZERO); ttyregister(tp); return (tp); } diff --git a/sys/kern/tty_cons.c b/sys/kern/tty_cons.c index 361a5dd..9d487b7 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_WAITOK | M_ZERO); + MALLOC(name, char *, len, M_TEMP, 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 098108c..d954ac7 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_WAITOK | M_ZERO); + pt = malloc(sizeof(*pt), M_PTY, 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 165f628..e4da151 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 M_WAITOK\n"); - cbp = malloc(sizeof *cbp, M_TTYS, M_WAITOK); +"cblock_alloc_cblocks: M_NOWAIT malloc failed, trying blocking malloc\n"); + cbp = malloc(sizeof *cbp, M_TTYS, 0); } /* * Freed cblocks have zero quotes and garbage elsewhere. diff --git a/sys/kern/uipc_accf.c b/sys/kern/uipc_accf.c index b31026a..6580e1d 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, M_WAITOK); + MALLOC(p, struct accept_filter *, sizeof(*p), M_ACCF, 0); 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 bc6aa71..4ea316c 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 M_TRYWAIT/M_DONTWAIT from caller. + * The wait parameter is a choice of 0/M_NOWAIT 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_DONTWAIT, n->m_type); + MGET(m, M_NOWAIT, 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_DONTWAIT, MT_DATA); + MGETHDR(m, M_NOWAIT, 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_DONTWAIT, MT_DATA); + MGET(m, M_NOWAIT, 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_DONTWAIT); + MCLGET(m, M_NOWAIT); 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_DONTWAIT, m->m_type); + n = m_get_clrd(M_NOWAIT, 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_DONTWAIT, m->m_type); + n = m_get(M_NOWAIT, 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 50b37f5..336ffa5 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_DONTWAIT); + o = m_dup1(n, off, n->m_len - off, M_NOWAIT); 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_DONTWAIT, m->m_type); + MGET(o, M_NOWAIT, m->m_type); if (o && len > MLEN) { - MCLGET(o, M_DONTWAIT); + MCLGET(o, M_NOWAIT); 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 e3912e1..3d9d5b55 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_WAITOK | M_ZERO); + ret = malloc(sizeof(*ret), M_SEM, 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, M_WAITOK); + ret->ks_name = malloc(len + 1, M_SEM, 0); 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, M_WAITOK); + ku = malloc(sizeof(*ku), M_SEM, 0); 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 3283b58..d2f1d51 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_DONTWAIT); + (*so->so_upcall)(so, so->so_upcallarg, M_NOWAIT); 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_DONTWAIT, MT_SONAME); + MGET(m, M_NOWAIT, 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_DONTWAIT, MT_CONTROL)) == NULL) + if ((m = m_get(M_NOWAIT, MT_CONTROL)) == NULL) return ((struct mbuf *) NULL); if (CMSG_SPACE((u_int)size) > MLEN) { - MCLGET(m, M_DONTWAIT); + MCLGET(m, M_NOWAIT); 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 ? M_WAITOK : M_NOWAIT); + canwait ? 0 : 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 4163f2e..1ab2885 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 = M_WAITOK; + flag = 0; else flag = M_NOWAIT; flag |= M_ZERO; @@ -482,7 +482,7 @@ bad: return (error); } -#define SBLOCKWAIT(f) (((f) & MSG_DONTWAIT) ? M_NOWAIT : M_WAITOK) +#define SBLOCKWAIT(f) (((f) & MSG_DONTWAIT) ? M_NOWAIT : 0) /* * Send on a socket. * If send must go all at once and message is larger than @@ -626,7 +626,7 @@ restart: cow_send = 0; #endif /* ZERO_COPY_SOCKETS */ if (top == 0) { - MGETHDR(m, M_TRYWAIT, MT_DATA); + MGETHDR(m, 0, MT_DATA); if (m == NULL) { error = ENOBUFS; goto release; @@ -635,7 +635,7 @@ restart: m->m_pkthdr.len = 0; m->m_pkthdr.rcvif = (struct ifnet *)0; } else { - MGET(m, M_TRYWAIT, MT_DATA); + MGET(m, 0, MT_DATA); if (m == NULL) { error = ENOBUFS; goto release; @@ -657,7 +657,7 @@ restart: } if (!cow_send){ #endif /* ZERO_COPY_SOCKETS */ - MCLGET(m, M_TRYWAIT); + MCLGET(m, 0); 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(M_TRYWAIT, MT_DATA); + m = m_get(0, MT_DATA); if (m == NULL) return (ENOBUFS); error = (*pr->pr_usrreqs->pru_rcvoob)(so, m, flags & MSG_PEEK); @@ -1025,7 +1025,7 @@ dontblock: moff += len; else { if (mp) - *mp = m_copym(m, 0, len, M_TRYWAIT); + *mp = m_copym(m, 0, len, 0); 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, M_WAITOK); + (void) sblock(sb, 0); 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, M_WAITOK); + MALLOC(afap, struct accept_filter_arg *, sizeof(*afap), M_TEMP, 0); 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_WAITOK | M_ZERO); + MALLOC(af, struct so_accf *, sizeof(*af), M_ACCF, 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, M_WAITOK); + MALLOC(af->so_accept_filter_str, char *, len, M_ACCF, 0); 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_WAITOK | M_ZERO); + M_TEMP, 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 ? M_TRYWAIT : M_DONTWAIT, MT_DATA); + MGET(m, sopt->sopt_td ? 0 : M_NOWAIT, MT_DATA); if (m == 0) return ENOBUFS; if (sopt_size > MLEN) { - MCLGET(m, sopt->sopt_td ? M_TRYWAIT : M_DONTWAIT); + MCLGET(m, sopt->sopt_td ? 0 : M_NOWAIT); 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 ? M_TRYWAIT : M_DONTWAIT, MT_DATA); + MGET(m, sopt->sopt_td ? 0 : M_NOWAIT, MT_DATA); if (m == 0) { m_freem(*mp); return ENOBUFS; } if (sopt_size > MLEN) { - MCLGET(m, sopt->sopt_td ? M_TRYWAIT : M_DONTWAIT); + MCLGET(m, sopt->sopt_td ? 0 : M_NOWAIT); 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 3283b58..d2f1d51 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_DONTWAIT); + (*so->so_upcall)(so, so->so_upcallarg, M_NOWAIT); 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_DONTWAIT, MT_SONAME); + MGET(m, M_NOWAIT, 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_DONTWAIT, MT_CONTROL)) == NULL) + if ((m = m_get(M_NOWAIT, MT_CONTROL)) == NULL) return ((struct mbuf *) NULL); if (CMSG_SPACE((u_int)size) > MLEN) { - MCLGET(m, M_DONTWAIT); + MCLGET(m, M_NOWAIT); 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 ? M_WAITOK : M_NOWAIT); + canwait ? 0 : 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 2bd0c9f0..8fd69e7 100644 --- a/sys/kern/uipc_syscalls.c +++ b/sys/kern/uipc_syscalls.c @@ -648,7 +648,7 @@ sendit(td, s, mp, flags) if (mp->msg_flags == MSG_COMPAT) { register struct cmsghdr *cm; - M_PREPEND(control, sizeof(*cm), M_TRYWAIT); + M_PREPEND(control, sizeof(*cm), 0); if (control == 0) { error = ENOBUFS; goto bad; @@ -666,7 +666,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, M_WAITOK); + MALLOC(ktriov, struct iovec *, iovlen, M_TEMP, 0); bcopy(auio.uio_iov, ktriov, iovlen); ktruio = auio; } @@ -798,7 +798,7 @@ osendmsg(td, uap) } MALLOC(iov, struct iovec *, sizeof(struct iovec) * (u_int)msg.msg_iovlen, M_IOV, - M_WAITOK); + 0); } else { iov = aiov; } @@ -845,7 +845,7 @@ sendmsg(td, uap) } MALLOC(iov, struct iovec *, sizeof(struct iovec) * (u_int)msg.msg_iovlen, M_IOV, - M_WAITOK); + 0); } else { iov = aiov; } @@ -915,7 +915,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, M_WAITOK); + MALLOC(ktriov, struct iovec *, iovlen, M_TEMP, 0); bcopy(auio.uio_iov, ktriov, iovlen); ktruio = auio; } @@ -1148,7 +1148,7 @@ orecvmsg(td, uap) } MALLOC(iov, struct iovec *, sizeof(struct iovec) * (u_int)msg.msg_iovlen, M_IOV, - M_WAITOK); + 0); } else { iov = aiov; } @@ -1199,7 +1199,7 @@ recvmsg(td, uap) } MALLOC(iov, struct iovec *, sizeof(struct iovec) * (u_int)msg.msg_iovlen, M_IOV, - M_WAITOK); + 0); } else { iov = aiov; } @@ -1535,7 +1535,7 @@ sockargs(mp, buf, buflen, type) #endif return (EINVAL); } - m = m_get(M_TRYWAIT, type); + m = m_get(0, type); if (m == NULL) return (ENOBUFS); m->m_len = buflen; @@ -1568,7 +1568,7 @@ getsockaddr(namp, uaddr, len) if (len > SOCK_MAXADDRLEN) return ENAMETOOLONG; - MALLOC(sa, struct sockaddr *, len, M_SONAME, M_WAITOK); + MALLOC(sa, struct sockaddr *, len, M_SONAME, 0); error = copyin(uaddr, sa, len); if (error) { FREE(sa, M_SONAME); @@ -1782,7 +1782,7 @@ do_sendfile(struct thread *td, struct sendfile_args *uap, int compat) /* * Protect against multiple writers to the socket. */ - (void) sblock(&so->so_snd, M_WAITOK); + (void) sblock(&so->so_snd, 0); /* * Loop through the pages in the file, starting with the requested @@ -1926,7 +1926,7 @@ retry_lookup: /* * Get an mbuf header and set it up as having external storage. */ - MGETHDR(m, M_TRYWAIT, MT_DATA); + MGETHDR(m, 0, 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 04b4c6d..2907cf2 100644 --- a/sys/kern/uipc_usrreq.c +++ b/sys/kern/uipc_usrreq.c @@ -533,7 +533,7 @@ unp_attach(so) if (error) return (error); } - unp = uma_zalloc(unp_zone, M_WAITOK); + unp = uma_zalloc(unp_zone, 0); if (unp == NULL) return (ENOBUFS); bzero(unp, sizeof *unp); @@ -605,7 +605,7 @@ unp_bind(unp, nam, td) if (namelen <= 0) return EINVAL; - buf = malloc(namelen + 1, M_TEMP, M_WAITOK); + buf = malloc(namelen + 1, M_TEMP, 0); strlcpy(buf, soun->sun_path, namelen + 1); restart: @@ -848,7 +848,7 @@ unp_pcblist(SYSCTL_HANDLER_ARGS) /* * OK, now we're committed to doing something. */ - xug = malloc(sizeof(*xug), M_TEMP, M_WAITOK); + xug = malloc(sizeof(*xug), M_TEMP, 0); gencnt = unp_gencnt; n = unp_count; @@ -862,7 +862,7 @@ unp_pcblist(SYSCTL_HANDLER_ARGS) return error; } - unp_list = malloc(n * sizeof *unp_list, M_TEMP, M_WAITOK); + unp_list = malloc(n * sizeof *unp_list, M_TEMP, 0); for (unp = LIST_FIRST(head), i = 0; unp && i < n; unp = LIST_NEXT(unp, unp_link)) { @@ -876,7 +876,7 @@ unp_pcblist(SYSCTL_HANDLER_ARGS) n = i; /* in case we lost some during malloc */ error = 0; - xu = malloc(sizeof(*xu), M_TEMP, M_WAITOK); + xu = malloc(sizeof(*xu), M_TEMP, 0); for (i = 0; i < n; i++) { unp = unp_list[i]; if (unp->unp_gencnt <= gencnt) { @@ -1379,7 +1379,7 @@ unp_gc() * * 91/09/19, bsy@cs.cmu.edu */ - extra_ref = malloc(nfiles * sizeof(struct file *), M_TEMP, M_WAITOK); + extra_ref = malloc(nfiles * sizeof(struct file *), M_TEMP, 0); 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 9532ff2..5cee627 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, M_WAITOK); + ki = uma_zalloc(kaio_zone, 0); 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, M_WAITOK); + aiop = uma_zalloc(aiop_zone, 0); 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_WAITOK | M_ZERO); + M_ZERO); MALLOC(newsess, struct session *, sizeof(struct session), M_SESSION, - M_WAITOK | M_ZERO); + 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, M_WAITOK); + aiocbe = uma_zalloc(aiocb_zone, 0); 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, M_WAITOK); - ujoblist = uma_zalloc(aiol_zone, M_WAITOK); + ijoblist = uma_zalloc(aiol_zone, 0); + ujoblist = uma_zalloc(aiol_zone, 0); 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, M_WAITOK); + lj = uma_zalloc(aiolio_zone, 0); if (!lj) return (EAGAIN); diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index 9de4fd1..0f8830a 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -2641,7 +2641,7 @@ allocbuf(struct buf *bp, int size) (bp->b_bufsize == 0) && (mbsize <= PAGE_SIZE/2)) { - bp->b_data = malloc(mbsize, M_BIOBUF, M_WAITOK); + bp->b_data = malloc(mbsize, M_BIOBUF, 0); 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 80ea2f0..c74f4ee 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -413,7 +413,7 @@ cache_enter(dvp, vp, cnp) } ncp = (struct namecache *) - malloc(sizeof *ncp + cnp->cn_namelen, M_VFSCACHE, M_WAITOK); + malloc(sizeof *ncp + cnp->cn_namelen, M_VFSCACHE, 0); bzero((char *)ncp, sizeof *ncp); numcache++; if (!vp) { @@ -729,7 +729,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, M_WAITOK); + tmpbuf = bp = malloc(buflen, M_TEMP, 0); bp += buflen - 1; *bp = '\0'; fdp = td->td_proc->p_fd; @@ -840,7 +840,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, M_WAITOK); + buf = malloc(MAXPATHLEN, M_TEMP, 0); 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 7fd0402..da84419 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, M_WAITOK); + M_SEGMENT, 0); 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 b909b83..80158a3 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_WAITOK | M_ZERO); + np = (struct netcred *) malloc(i, M_NETADDR, 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_WAITOK | M_ZERO); + nep = malloc(sizeof(struct netexport), M_MOUNT, 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, - M_WAITOK); + 0); 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 432ebed..2fbdcfe 100644 --- a/sys/kern/vfs_extattr.c +++ b/sys/kern/vfs_extattr.c @@ -1104,7 +1104,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, M_WAITOK); + syspath = uma_zalloc(namei_zone, 0); if ((error = copyinstr(path, syspath, MAXPATHLEN, NULL)) != 0) goto out; } @@ -3110,7 +3110,7 @@ unionread: kuio.uio_iov = &kiov; kuio.uio_segflg = UIO_SYSSPACE; kiov.iov_len = uap->count; - MALLOC(dirbuf, caddr_t, uap->count, M_TEMP, M_WAITOK); + MALLOC(dirbuf, caddr_t, uap->count, M_TEMP, 0); 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 b221cd3..24ae27a 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, M_WAITOK); + num_op_descs * sizeof(int), M_TEMP, 0); 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_WAITOK | M_ZERO); + 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, M_WAITOK); + (vnodeopv_num + 1) * sizeof(*newopv), M_VNODE, 0); 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, M_WAITOK); + M_VNODE, 0); /* new reference count (for unload) */ MALLOC(newref, int *, (num_op_descs + 1) * sizeof(*newref), - M_VNODE, M_WAITOK); + M_VNODE, 0); 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, M_WAITOK); + M_VNODE, 0); /* new reference count (for unload) */ MALLOC(newref, int *, (num_op_descs - 1) * sizeof(*newref), - M_VNODE, M_WAITOK); + M_VNODE, 0); 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, M_WAITOK); + (vnodeopv_num - 1) * sizeof(*newopv), M_VNODE, 0); 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 f064b64..e33e2c6 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, M_WAITOK); + cnp->cn_pnbuf = uma_zalloc(namei_zone, 0); 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, M_WAITOK); + cp = uma_zalloc(namei_zone, 0); else cp = cnp->cn_pnbuf; aiov.iov_base = cp; diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c index a5e5989..52937c9 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, M_WAITOK); + opts = malloc(sizeof(struct vfsoptlist), M_MOUNT, 0); TAILQ_INIT(opts); for (i = 0; i < iovcnt; i += 2) { - opt = malloc(sizeof(struct vfsopt), M_MOUNT, M_WAITOK); + opt = malloc(sizeof(struct vfsopt), M_MOUNT, 0); namelen = auio->uio_iov[i].iov_len; optlen = auio->uio_iov[i + 1].iov_len; - opt->name = malloc(namelen, M_MOUNT, M_WAITOK); + opt->name = malloc(namelen, M_MOUNT, 0); 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, M_WAITOK); + opt->value = malloc(optlen, M_MOUNT, 0); 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, M_WAITOK); - new->name = malloc(strlen(opt->name) + 1, M_MOUNT, M_WAITOK); + new = malloc(sizeof(struct vfsopt), M_MOUNT, 0); + new->name = malloc(strlen(opt->name) + 1, M_MOUNT, 0); strcpy(new->name, opt->name); if (opt->len != 0) { - new->value = malloc(opt->len, M_MOUNT, M_WAITOK); + new->value = malloc(opt->len, M_MOUNT, 0); 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, M_WAITOK); + MALLOC(iov, struct iovec *, iovlen, M_IOV, 0); 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, M_WAITOK); - MALLOC(buf, char *, len, M_MOUNT, M_WAITOK); + MALLOC(iovp, struct iovec *, iovlen, M_MOUNT, 0); + MALLOC(buf, char *, len, M_MOUNT, 0); 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_WAITOK | M_ZERO); + mp = malloc(sizeof(struct mount), M_MOUNT, 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, M_WAITOK); - fspath = malloc(MNAMELEN, M_TEMP, M_WAITOK); + fstype = malloc(MFSNAMELEN, M_TEMP, 0); + fspath = malloc(MNAMELEN, M_TEMP, 0); /* * 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_WAITOK | M_ZERO); + mp = malloc(sizeof(struct mount), M_MOUNT, 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_WAITOK | M_ZERO); + mp = malloc((u_long)sizeof(struct mount), M_MOUNT, 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, M_WAITOK); - path = malloc(MNAMELEN, M_MOUNT, M_WAITOK); + vfsname = malloc(MFSNAMELEN, M_MOUNT, 0); + path = malloc(MNAMELEN, M_MOUNT, 0); 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 8e954eb..7f3af03 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, M_WAITOK); + vp->v_pollinfo = uma_zalloc(vnodepoll_zone, 0); 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_WAITOK|M_ZERO); + vp = (struct vnode *) uma_zalloc(vnode_zone, 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, M_WAITOK); + xvfsp = malloc(sizeof(struct xvfsconf) * cnt, M_TEMP, 0); /* * 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 | M_WAITOK); + xvn = malloc(len, M_TEMP, M_ZERO | 0); 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 432ebed..2fbdcfe 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -1104,7 +1104,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, M_WAITOK); + syspath = uma_zalloc(namei_zone, 0); if ((error = copyinstr(path, syspath, MAXPATHLEN, NULL)) != 0) goto out; } @@ -3110,7 +3110,7 @@ unionread: kuio.uio_iov = &kiov; kuio.uio_segflg = UIO_SYSSPACE; kiov.iov_len = uap->count; - MALLOC(dirbuf, caddr_t, uap->count, M_TEMP, M_WAITOK); + MALLOC(dirbuf, caddr_t, uap->count, M_TEMP, 0); kiov.iov_base = dirbuf; error = VOP_READDIR(vp, &kuio, fp->f_cred, &eofflag, NULL, NULL); |