after discussions with beck deraadt kettenis.
-/* $OpenBSD: exec_elf.c,v 1.98 2014/07/08 17:19:25 deraadt Exp $ */
+/* $OpenBSD: exec_elf.c,v 1.99 2014/07/12 18:43:32 tedu Exp $ */
/*
* Copyright (c) 1996 Per Fogelstrom
bad1:
VOP_CLOSE(nd.ni_vp, FREAD, p->p_ucred, p);
bad:
- free(ph, M_TEMP);
+ free(ph, M_TEMP, 0);
*last = addr;
vput(nd.ni_vp);
epp->ep_interp_pos = pos;
}
- free(ph, M_TEMP);
+ free(ph, M_TEMP, 0);
vn_marktext(epp->ep_vp);
return (exec_setup_stack(p, epp));
bad:
if (interp)
pool_put(&namei_pool, interp);
- free(ph, M_TEMP);
+ free(ph, M_TEMP, 0);
kill_vmcmds(&epp->ep_vmcmds);
return (ENOEXEC);
}
ap = epp->ep_emul_arg;
if ((error = ELFNAME(load_file)(p, interp, epp, ap, &pos)) != 0) {
- free(ap, M_TEMP);
+ free(ap, M_TEMP, 0);
pool_put(&namei_pool, interp);
kill_vmcmds(&epp->ep_vmcmds);
return (error);
error = copyout(ai, epp->ep_emul_argp, sizeof ai);
}
- free(ap, M_TEMP);
+ free(ap, M_TEMP, 0);
pool_put(&namei_pool, interp);
return (error);
}
#if 0
if (np->type != ELF_NOTE_TYPE_OSVERSION) {
- free(np, M_TEMP);
+ free(np, M_TEMP, 0);
np = NULL;
continue;
}
out3:
error = ENOEXEC;
out2:
- free(np, M_TEMP);
+ free(np, M_TEMP, 0);
out1:
- free(hph, M_TEMP);
+ free(hph, M_TEMP, 0);
return error;
}
}
out:
- free(psections, M_TEMP);
+ free(psections, M_TEMP, 0);
return (error);
#endif
}
-/* $OpenBSD: exec_script.c,v 1.29 2014/07/08 17:19:25 deraadt Exp $ */
+/* $OpenBSD: exec_script.c,v 1.30 2014/07/12 18:43:32 tedu Exp $ */
/* $NetBSD: exec_script.c,v 1.13 1996/02/04 02:15:06 christos Exp $ */
/*
/* free the fake arg list, because we're not returning it */
if ((tmpsap = shellargp) != NULL) {
while (*tmpsap != NULL) {
- free(*tmpsap, M_EXEC);
+ free(*tmpsap, M_EXEC, 0);
tmpsap++;
}
- free(shellargp, M_EXEC);
+ free(shellargp, M_EXEC, 0);
}
/*
-/* $OpenBSD: exec_subr.c,v 1.35 2014/07/08 17:19:25 deraadt Exp $ */
+/* $OpenBSD: exec_subr.c,v 1.36 2014/07/12 18:43:32 tedu Exp $ */
/* $NetBSD: exec_subr.c,v 1.9 1994/12/04 03:10:42 mycroft Exp $ */
/*
M_WAITOK);
bcopy(evsp->evs_cmds, nvcp, (ocnt * sizeof(struct exec_vmcmd)));
if (evsp->evs_cmds != evsp->evs_start)
- free(evsp->evs_cmds, M_EXEC);
+ free(evsp->evs_cmds, M_EXEC, 0);
evsp->evs_cmds = nvcp;
}
*/
evsp->evs_used = 0;
if (evsp->evs_cmds != evsp->evs_start)
- free(evsp->evs_cmds, M_EXEC);
+ free(evsp->evs_cmds, M_EXEC, 0);
evsp->evs_cmds = evsp->evs_start;
evsp->evs_cnt = EXEC_DEFAULT_VMCMD_SETSIZE;
}
buf = malloc(cmd->ev_len, M_TEMP, M_WAITOK);
arc4random_buf(buf, cmd->ev_len);
error = copyout(buf, (void *)cmd->ev_addr, cmd->ev_len);
- free(buf, M_TEMP);
+ free(buf, M_TEMP, 0);
return (error);
}
-/* $OpenBSD: kern_bufq.c,v 1.27 2014/06/27 16:38:03 miod Exp $ */
+/* $OpenBSD: kern_bufq.c,v 1.28 2014/07/12 18:43:32 tedu Exp $ */
/*
* Copyright (c) 2010 Thordur I. Bjornsson <thib@openbsd.org>
* Copyright (c) 2010 David Gwynne <dlg@openbsd.org>
void
bufq_fifo_destroy(void *data)
{
- free(data, M_DEVBUF);
+ free(data, M_DEVBUF, 0);
}
void
void
bufq_nscan_destroy(void *vdata)
{
- free(vdata, M_DEVBUF);
+ free(vdata, M_DEVBUF, 0);
}
void
-/* $OpenBSD: kern_descrip.c,v 1.110 2014/07/08 17:19:25 deraadt Exp $ */
+/* $OpenBSD: kern_descrip.c,v 1.111 2014/07/12 18:43:32 tedu Exp $ */
/* $NetBSD: kern_descrip.c,v 1.42 1996/03/30 22:24:38 christos Exp $ */
/*
memset(newofileflags + copylen, 0, nfiles * sizeof(char) - copylen);
if (fdp->fd_nfiles > NDFILE)
- free(fdp->fd_ofiles, M_FILEDESC);
+ free(fdp->fd_ofiles, M_FILEDESC, 0);
if (NDHISLOTS(nfiles) > NDHISLOTS(fdp->fd_nfiles)) {
newhimap = malloc(NDHISLOTS(nfiles) * sizeof(u_int),
NDLOSLOTS(nfiles) * sizeof(u_int) - copylen);
if (NDHISLOTS(fdp->fd_nfiles) > NDHISLOTS(NDFILE)) {
- free(fdp->fd_himap, M_FILEDESC);
- free(fdp->fd_lomap, M_FILEDESC);
+ free(fdp->fd_himap, M_FILEDESC, 0);
+ free(fdp->fd_lomap, M_FILEDESC, 0);
}
fdp->fd_himap = newhimap;
fdp->fd_lomap = newlomap;
}
p->p_fd = NULL;
if (fdp->fd_nfiles > NDFILE)
- free(fdp->fd_ofiles, M_FILEDESC);
+ free(fdp->fd_ofiles, M_FILEDESC, 0);
if (NDHISLOTS(fdp->fd_nfiles) > NDHISLOTS(NDFILE)) {
- free(fdp->fd_himap, M_FILEDESC);
- free(fdp->fd_lomap, M_FILEDESC);
+ free(fdp->fd_himap, M_FILEDESC, 0);
+ free(fdp->fd_lomap, M_FILEDESC, 0);
}
if (fdp->fd_cdir)
vrele(fdp->fd_cdir);
if (fdp->fd_rdir)
vrele(fdp->fd_rdir);
if (fdp->fd_knlist)
- free(fdp->fd_knlist, M_TEMP);
+ free(fdp->fd_knlist, M_TEMP, 0);
if (fdp->fd_knhash)
- free(fdp->fd_knhash, M_TEMP);
+ free(fdp->fd_knhash, M_TEMP, 0);
pool_put(&fdesc_pool, fdp);
}
-/* $OpenBSD: kern_event.c,v 1.57 2014/05/15 04:43:25 guenther Exp $ */
+/* $OpenBSD: kern_event.c,v 1.58 2014/07/12 18:43:32 tedu Exp $ */
/*-
* Copyright (c) 1999,2000,2001 Jonathan Lemon <jlemon@FreeBSD.org>
to = (struct timeout *)kn->kn_hook;
timeout_del(to);
- free(to, M_KEVENT);
+ free(to, M_KEVENT, 0);
kq_ntimeouts--;
}
memset(&list[fdp->fd_knlistsize], 0,
(size - fdp->fd_knlistsize) * sizeof(struct klist));
if (fdp->fd_knlist != NULL)
- free(fdp->fd_knlist, M_TEMP);
+ free(fdp->fd_knlist, M_TEMP, 0);
fdp->fd_knlistsize = size;
fdp->fd_knlist = list;
}
-/* $OpenBSD: kern_exec.c,v 1.143 2014/07/08 17:19:25 deraadt Exp $ */
+/* $OpenBSD: kern_exec.c,v 1.144 2014/07/12 18:43:32 tedu Exp $ */
/* $NetBSD: kern_exec.c,v 1.75 1996/02/09 18:59:28 christos Exp $ */
/*-
*dp++ = *cp++;
*dp++ = '\0';
- free(*tmpfap, M_EXEC);
+ free(*tmpfap, M_EXEC, 0);
tmpfap++; argc++;
}
- free(pack.ep_fa, M_EXEC);
+ free(pack.ep_fa, M_EXEC, 0);
pack.ep_flags &= ~EXEC_HASARGL;
}
if (pr->ps_flags & PS_TRACED)
psignal(p, SIGTRAP);
- free(pack.ep_hdr, M_EXEC);
+ free(pack.ep_hdr, M_EXEC, 0);
/*
* Call emulation specific exec hook. This can setup per-process
if (pack.ep_interp != NULL)
pool_put(&namei_pool, pack.ep_interp);
if (pack.ep_emul_arg != NULL)
- free(pack.ep_emul_arg, M_TEMP);
+ free(pack.ep_emul_arg, M_TEMP, 0);
/* close and put the exec'd file */
vn_close(pack.ep_vp, FREAD, cred, p);
pool_put(&namei_pool, nid.ni_cnd.cn_pnbuf);
uvm_km_free_wakeup(exec_map, (vaddr_t) argp, NCARGS);
freehdr:
- free(pack.ep_hdr, M_EXEC);
+ free(pack.ep_hdr, M_EXEC, 0);
#if NSYSTRACE > 0
clrflag:
#endif
if (pack.ep_interp != NULL)
pool_put(&namei_pool, pack.ep_interp);
if (pack.ep_emul_arg != NULL)
- free(pack.ep_emul_arg, M_TEMP);
+ free(pack.ep_emul_arg, M_TEMP, 0);
pool_put(&namei_pool, nid.ni_cnd.cn_pnbuf);
vn_close(pack.ep_vp, FREAD, cred, p);
uvm_km_free_wakeup(exec_map, (vaddr_t) argp, NCARGS);
free_pack_abort:
- free(pack.ep_hdr, M_EXEC);
+ free(pack.ep_hdr, M_EXEC, 0);
exit1(p, W_EXITCODE(0, SIGABRT), EXIT_NORMAL);
/* NOTREACHED */
-/* $OpenBSD: kern_exit.c,v 1.146 2014/07/11 08:18:31 guenther Exp $ */
+/* $OpenBSD: kern_exit.c,v 1.147 2014/07/12 18:43:32 tedu Exp $ */
/* $NetBSD: kern_exit.c,v 1.39 1996/04/22 01:38:25 christos Exp $ */
/*
KASSERT(pr->ps_refcnt == 1);
if (pr->ps_ptstat != NULL)
- free(pr->ps_ptstat, M_SUBPROC);
+ free(pr->ps_ptstat, M_SUBPROC, 0);
pool_put(&rusage_pool, pr->ps_ru);
KASSERT(TAILQ_EMPTY(&pr->ps_threads));
limfree(pr->ps_limit);
-/* $OpenBSD: kern_fork.c,v 1.171 2014/07/11 08:20:42 guenther Exp $ */
+/* $OpenBSD: kern_fork.c,v 1.172 2014/07/12 18:43:32 tedu Exp $ */
/* $NetBSD: kern_fork.c,v 1.29 1996/02/09 18:59:34 christos Exp $ */
/*
p->p_cpu = arg;
if (newptstat)
- free(newptstat, M_SUBPROC);
+ free(newptstat, M_SUBPROC, 0);
/*
* Notify any interested parties about the new process.
-/* $OpenBSD: kern_kthread.c,v 1.35 2014/05/04 05:03:26 guenther Exp $ */
+/* $OpenBSD: kern_kthread.c,v 1.36 2014/07/12 18:43:32 tedu Exp $ */
/* $NetBSD: kern_kthread.c,v 1.3 1998/12/22 21:21:36 kleink Exp $ */
/*-
while ((kq = SIMPLEQ_FIRST(&kthread_q)) != NULL) {
SIMPLEQ_REMOVE_HEAD(&kthread_q, kq_q);
(*kq->kq_func)(kq->kq_arg);
- free(kq, M_TEMP);
+ free(kq, M_TEMP, 0);
}
}
-/* $OpenBSD: kern_ktrace.c,v 1.66 2014/07/08 17:19:25 deraadt Exp $ */
+/* $OpenBSD: kern_ktrace.c,v 1.67 2014/07/12 18:43:32 tedu Exp $ */
/* $NetBSD: kern_ktrace.c,v 1.23 1996/02/09 18:59:36 christos Exp $ */
/*
memset(argp, 0, nargs * sizeof(int));
kth.ktr_len = len;
ktrwrite(p, &kth, ktp);
- free(ktp, M_TEMP);
+ free(ktp, M_TEMP, 0);
atomic_clearbits_int(&p->p_flag, P_INKTR);
}
len -= count;
}
- free(ktp, M_TEMP);
+ free(ktp, M_TEMP, 0);
atomic_clearbits_int(&p->p_flag, P_INKTR);
}
kth.ktr_len = buflen;
ktrwrite(p, &kth, buf);
- free(buf, M_TEMP);
+ free(buf, M_TEMP, 0);
atomic_clearbits_int(&p->p_flag, P_INKTR);
}
ktrwrite(p, &kth, ktp);
out:
if (memp != NULL)
- free(memp, M_TEMP);
+ free(memp, M_TEMP, 0);
atomic_clearbits_int(&p->p_flag, P_INKTR);
return (error);
}
-/* $OpenBSD: kern_lkm.c,v 1.47 2014/01/21 01:48:44 tedu Exp $ */
+/* $OpenBSD: kern_lkm.c,v 1.48 2014/07/12 18:43:32 tedu Exp $ */
/* $NetBSD: kern_lkm.c,v 1.31 1996/03/31 21:40:27 christos Exp $ */
/*
{
TAILQ_REMOVE(&lkmods, p, list);
- free(p, M_DEVBUF);
+ free(p, M_DEVBUF, 0);
curp = NULL;
}
-/* $OpenBSD: kern_malloc.c,v 1.112 2014/07/10 22:16:48 tedu Exp $ */
+/* $OpenBSD: kern_malloc.c,v 1.113 2014/07/12 18:43:32 tedu Exp $ */
/* $NetBSD: kern_malloc.c,v 1.15.4.2 1996/06/13 17:10:56 cgd Exp $ */
/*
* Free a block of memory allocated by malloc.
*/
void
-free(void *addr, int type)
+free(void *addr, int type, size_t fauxsize)
{
struct kmembuckets *kbp;
struct kmemusage *kup;
-/* $OpenBSD: kern_proc.c,v 1.59 2014/07/04 05:58:30 guenther Exp $ */
+/* $OpenBSD: kern_proc.c,v 1.60 2014/07/12 18:43:32 tedu Exp $ */
/* $NetBSD: kern_proc.c,v 1.14 1996/02/09 18:59:41 christos Exp $ */
/*
if (uip->ui_uid == uid)
break;
if (uip) {
- free(nuip, M_PROC);
+ free(nuip, M_PROC, 0);
return (uip);
}
nuip->ui_uid = uid;
-/* $OpenBSD: kern_sensors.c,v 1.27 2013/12/09 17:39:08 mikeb Exp $ */
+/* $OpenBSD: kern_sensors.c,v 1.28 2014/07/12 18:43:32 tedu Exp $ */
/*
* Copyright (c) 2005 David Gwynne <dlg@openbsd.org>
rw_exit_write(&st->lock);
if (period == 0)
- free(st, M_DEVBUF);
+ free(st, M_DEVBUF, 0);
else
timeout_add_sec(&st->timeout, period);
}
-/* $OpenBSD: kern_subr.c,v 1.37 2013/10/19 09:24:57 reyk Exp $ */
+/* $OpenBSD: kern_subr.c,v 1.38 2014/07/12 18:43:32 tedu Exp $ */
/* $NetBSD: kern_subr.c,v 1.15 1996/04/09 17:21:56 ragge Exp $ */
/*
#endif
hdp = vhook;
TAILQ_REMOVE(head, hdp, hd_list);
- free(hdp, M_DEVBUF);
+ free(hdp, M_DEVBUF, 0);
}
/*
TAILQ_REMOVE(head, hdp, hd_list);
(*hdp->hd_fn)(hdp->hd_arg);
if ((flags & HOOK_FREE) != 0)
- free(hdp, M_DEVBUF);
+ free(hdp, M_DEVBUF, 0);
}
}
}
-/* $OpenBSD: kern_sysctl.c,v 1.255 2014/07/08 17:19:25 deraadt Exp $ */
+/* $OpenBSD: kern_sysctl.c,v 1.256 2014/07/12 18:43:32 tedu Exp $ */
/* $NetBSD: kern_sysctl.c,v 1.17 1996/05/20 17:49:05 mrg Exp $ */
/*-
error = EINVAL;
break;
}
- free(kf, M_TEMP);
+ free(kf, M_TEMP, 0);
if (!error) {
if (where == NULL)
}
err:
if (kproc)
- free(kproc, M_TEMP);
+ free(kproc, M_TEMP, 0);
return (error);
}
out:
uvmspace_free(vm);
- free(buf, M_TEMP);
+ free(buf, M_TEMP, 0);
return (error);
}
}
vrele(vp);
- free(path, M_TEMP);
+ free(path, M_TEMP, 0);
return (error);
}
tlen++;
if (disknames)
- free(disknames, M_SYSCTL);
+ free(disknames, M_SYSCTL, 0);
if (diskstats)
- free(diskstats, M_SYSCTL);
+ free(diskstats, M_SYSCTL, 0);
diskstats = NULL;
disknames = NULL;
diskstats = malloc(disk_count * sizeof(struct diskstats),
}
*sizep -= buflen;
error = copyout(buf, where, *sizep);
- free(buf, M_TEMP);
+ free(buf, M_TEMP, 0);
/* If copyout succeeded, use return code set earlier. */
return (error ? error : ret);
}
ret = sysctl_rdstruct(oldp, oldlenp, newp, usd,
sizeof(struct sensordev));
- free(usd, M_TEMP);
+ free(usd, M_TEMP, 0);
return (ret);
}
ret = sysctl_rdstruct(oldp, oldlenp, newp, us,
sizeof(struct sensor));
- free(us, M_TEMP);
+ free(us, M_TEMP, 0);
return (ret);
}
-/* $OpenBSD: kern_task.c,v 1.9 2014/06/11 08:47:53 blambert Exp $ */
+/* $OpenBSD: kern_task.c,v 1.10 2014/07/12 18:43:32 tedu Exp $ */
/*
* Copyright (c) 2013 David Gwynne <dlg@openbsd.org>
}
mtx_leave(&tq->tq_mtx);
- free(tq, M_DEVBUF);
+ free(tq, M_DEVBUF, 0);
}
void
switch (tq->tq_state) {
case TQ_S_DESTROYED:
mtx_leave(&tq->tq_mtx);
- free(tq, M_DEVBUF);
+ free(tq, M_DEVBUF, 0);
return;
case TQ_S_CREATED:
-/* $OpenBSD: kern_tc.c,v 1.24 2014/04/03 17:58:31 beck Exp $ */
+/* $OpenBSD: kern_tc.c,v 1.25 2014/07/12 18:43:32 tedu Exp $ */
/*
* Copyright (c) 2000 Poul-Henning Kamp <phk@FreeBSD.org>
strlcat(choices, buf, maxlen);
}
error = sysctl_rdstring(oldp, oldlenp, newp, choices);
- free(choices, M_TEMP);
+ free(choices, M_TEMP, 0);
return (error);
}
-/* $OpenBSD: kern_workq.c,v 1.14 2013/11/26 20:33:19 deraadt Exp $ */
+/* $OpenBSD: kern_workq.c,v 1.15 2014/07/12 18:43:32 tedu Exp $ */
/*
* Copyright (c) 2007 David Gwynne <dlg@openbsd.org>
}
mtx_leave(&wq->wq_mtx);
- free(wq, M_DEVBUF);
+ free(wq, M_DEVBUF, 0);
}
int
switch (wq->wq_state) {
case WQ_S_DESTROYED:
mtx_leave(&wq->wq_mtx);
- free(wq, M_DEVBUF);
+ free(wq, M_DEVBUF, 0);
return;
case WQ_S_CREATED:
-/* $OpenBSD: subr_autoconf.c,v 1.76 2014/07/12 13:43:08 mpi Exp $ */
+/* $OpenBSD: subr_autoconf.c,v 1.77 2014/07/12 18:43:32 tedu Exp $ */
/* $NetBSD: subr_autoconf.c,v 1.21 1996/04/04 06:06:18 cgd Exp $ */
/*
if (pri > m->pri) {
if (m->indirect && m->match)
- free(m->match, M_DEVBUF);
+ free(m->match, M_DEVBUF, 0);
m->match = match;
m->pri = pri;
} else {
if (m->indirect)
- free(match, M_DEVBUF);
+ free(match, M_DEVBUF, 0);
}
}
old != 0 ? "expand" : "creat");
if (old != 0) {
bcopy(cd->cd_devs, nsp, old * sizeof(void *));
- free(cd->cd_devs, M_DEVBUF);
+ free(cd->cd_devs, M_DEVBUF, 0);
}
cd->cd_devs = nsp;
}
if (cd->cd_devs[i] != NULL)
break;
if (i == cd->cd_ndevs) { /* nothing found; deallocate */
- free(cd->cd_devs, M_DEVBUF);
+ free(cd->cd_devs, M_DEVBUF, 0);
cd->cd_devs = NULL;
cd->cd_ndevs = 0;
cf->cf_unit = 0;
if (dc->dc_dev->dv_parent == parent) {
TAILQ_REMOVE(&deferred_config_queue, dc, dc_queue);
(*dc->dc_func)(dc->dc_dev);
- free(dc, M_DEVBUF);
+ free(dc, M_DEVBUF, 0);
config_pending_decr();
}
}
{
dv->dv_ref--;
if (dv->dv_ref == 0) {
- free(dv, M_DEVBUF);
+ free(dv, M_DEVBUF, 0);
}
}
-/* $OpenBSD: subr_disk.c,v 1.166 2014/07/12 17:50:36 jsing Exp $ */
+/* $OpenBSD: subr_disk.c,v 1.167 2014/07/12 18:43:32 tedu Exp $ */
/* $NetBSD: subr_disk.c,v 1.17 1996/03/16 23:17:08 christos Exp $ */
/*
/*
* Free the space used by the disklabel structures.
*/
- free(diskp->dk_label, M_DEVBUF);
+ free(diskp->dk_label, M_DEVBUF, 0);
/*
* Remove from the disklist.
-/* $OpenBSD: subr_extent.c,v 1.50 2014/01/21 21:45:58 kettenis Exp $ */
+/* $OpenBSD: subr_extent.c,v 1.51 2014/07/12 18:43:32 tedu Exp $ */
/* $NetBSD: subr_extent.c,v 1.7 1996/11/21 18:46:34 cgd Exp $ */
/*-
rp = extent_alloc_region_descriptor(ex, flags);
if (rp == NULL) {
if (!fixed_extent)
- free(ex, mtype);
+ free(ex, mtype, 0);
return (NULL);
}
rp->er_start = start;
/* If we're not a fixed extent, free the extent descriptor itself. */
if ((ex->ex_flags & EXF_FIXED) == 0)
- free(ex, ex->ex_mtype);
+ free(ex, ex->ex_mtype, 0);
}
/*
-/* $OpenBSD: subr_log.c,v 1.20 2014/07/10 08:55:35 deraadt Exp $ */
+/* $OpenBSD: subr_log.c,v 1.21 2014/07/12 18:43:32 tedu Exp $ */
/* $NetBSD: subr_log.c,v 1.11 1996/03/30 22:24:44 christos Exp $ */
/*
if (ktriov != NULL) {
if (error == 0)
ktrgenio(p, 0, UIO_WRITE, ktriov, aiov.iov_len);
- free(ktriov, M_TEMP);
+ free(ktriov, M_TEMP, 0);
}
#endif
FRELE(f, p);
-/* $OpenBSD: subr_userconf.c,v 1.39 2014/01/21 01:48:44 tedu Exp $ */
+/* $OpenBSD: subr_userconf.c,v 1.40 2014/07/12 18:43:32 tedu Exp $ */
/*
* Copyright (c) 1996-2001 Mats O Jansson <moj@stacken.kth.se>
if (memcmp(cd->cf_loc, lk, sizeof(int) * i))
cd->cf_loc = lk;
else
- free(lk, M_TEMP);
+ free(lk, M_TEMP, 0);
}
printf("%3d ", devno);
-/* $OpenBSD: sys_generic.c,v 1.88 2014/07/08 17:42:50 miod Exp $ */
+/* $OpenBSD: sys_generic.c,v 1.89 2014/07/12 18:43:32 tedu Exp $ */
/* $NetBSD: sys_generic.c,v 1.24 1996/03/29 00:25:32 cgd Exp $ */
/*
if (ktriov != NULL) {
if (error == 0)
ktrgenio(p, fd, UIO_READ, ktriov, cnt);
- free(ktriov, M_TEMP);
+ free(ktriov, M_TEMP, 0);
}
#endif
*retval = cnt;
done:
if (needfree)
- free(needfree, M_IOV);
+ free(needfree, M_IOV, 0);
out:
FRELE(fp, p);
return (error);
if (ktriov != NULL) {
if (error == 0)
ktrgenio(p, fd, UIO_WRITE, ktriov, cnt);
- free(ktriov, M_TEMP);
+ free(ktriov, M_TEMP, 0);
}
#endif
*retval = cnt;
done:
if (needfree)
- free(needfree, M_IOV);
+ free(needfree, M_IOV, 0);
out:
FRELE(fp, p);
return (error);
out:
FRELE(fp, p);
if (memp)
- free(memp, M_IOCTLOPS);
+ free(memp, M_IOCTLOPS, 0);
return (error);
}
}
if (pibits[0] != (fd_set *)&bits[0])
- free(pibits[0], M_TEMP);
+ free(pibits[0], M_TEMP, 0);
return (error);
}
}
bad:
if (pl != pfds)
- free(pl, M_TEMP);
+ free(pl, M_TEMP, 0);
return (error);
}
-/* $OpenBSD: sys_process.c,v 1.62 2014/07/11 08:18:31 guenther Exp $ */
+/* $OpenBSD: sys_process.c,v 1.63 2014/07/12 18:43:32 tedu Exp $ */
/* $NetBSD: sys_process.c,v 1.55 1996/05/15 06:17:47 tls Exp $ */
/*-
if (error == 0) {
error = process_write_regs(t, regs);
}
- free(regs, M_TEMP);
+ free(regs, M_TEMP, 0);
return (error);
case PT_GETREGS:
KASSERT((p->p_flag & P_SYSTEM) == 0);
if (error == 0)
error = copyout(regs,
SCARG(uap, addr), sizeof (*regs));
- free(regs, M_TEMP);
+ free(regs, M_TEMP, 0);
return (error);
#ifdef PT_SETFPREGS
case PT_SETFPREGS:
if (error == 0) {
error = process_write_fpregs(t, fpregs);
}
- free(fpregs, M_TEMP);
+ free(fpregs, M_TEMP, 0);
return (error);
#endif
#ifdef PT_GETFPREGS
if (error == 0)
error = copyout(fpregs,
SCARG(uap, addr), sizeof(*fpregs));
- free(fpregs, M_TEMP);
+ free(fpregs, M_TEMP, 0);
return (error);
#endif
#ifdef PT_SETXMMREGS
if (error == 0) {
error = process_write_xmmregs(t, xmmregs);
}
- free(xmmregs, M_TEMP);
+ free(xmmregs, M_TEMP, 0);
return (error);
#endif
#ifdef PT_GETXMMREGS
if (error == 0)
error = copyout(xmmregs,
SCARG(uap, addr), sizeof(*xmmregs));
- free(xmmregs, M_TEMP);
+ free(xmmregs, M_TEMP, 0);
return (error);
#endif
#ifdef PT_WCOOKIE
-/* $OpenBSD: sysv_msg.c,v 1.27 2014/03/18 06:59:00 guenther Exp $ */
+/* $OpenBSD: sysv_msg.c,v 1.28 2014/07/12 18:43:32 tedu Exp $ */
/* $NetBSD: sysv_msg.c,v 1.19 1996/02/09 19:00:18 christos Exp $ */
/*
* Copyright (c) 2009 Bret S. Lambert <blambert@openbsd.org>
/* if malloc slept, a queue with the same key may have been created */
if (que_key_lookup(key)) {
- free(que, M_TEMP);
+ free(que, M_TEMP, 0);
return (NULL);
}
TAILQ_REMOVE(&que->que_msgs, msg, msg_next);
msg_free(msg);
}
- free(que, M_TEMP);
+ free(que, M_TEMP, 0);
num_ques--;
}
msginfo.msgmni * sizeof(struct msqid_ds);
if (*sizep < infolen) {
- free(info, M_TEMP);
+ free(info, M_TEMP, 0);
return (ENOMEM);
}
error = copyout(info, where, infolen);
- free(info, M_TEMP);
+ free(info, M_TEMP, 0);
return (error);
-/* $OpenBSD: sysv_sem.c,v 1.46 2014/03/18 06:59:00 guenther Exp $ */
+/* $OpenBSD: sysv_sem.c,v 1.47 2014/07/12 18:43:32 tedu Exp $ */
/* $NetBSD: sysv_sem.c,v 1.26 1996/02/09 19:00:25 christos Exp $ */
/*
semaptr->sem_perm.cuid = cred->cr_uid;
semaptr->sem_perm.uid = cred->cr_uid;
semtot -= semaptr->sem_nsems;
- free(semaptr->sem_base, M_SEM);
+ free(semaptr->sem_base, M_SEM, 0);
pool_put(&sema_pool, semaptr);
sema[ix] = NULL;
semundo_clear(ix, -1);
error:
if (semval)
- free(semval, M_TEMP);
+ free(semval, M_TEMP, 0);
return (error);
}
goto error;
}
if (semaptr_new != NULL) {
- free(semaptr_new->sem_base, M_SEM);
+ free(semaptr_new->sem_base, M_SEM, 0);
pool_put(&sema_pool, semaptr_new);
}
goto found;
return (0);
error:
if (semaptr_new != NULL) {
- free(semaptr_new->sem_base, M_SEM);
+ free(semaptr_new->sem_base, M_SEM, 0);
pool_put(&sema_pool, semaptr_new);
}
return (error);
*retval = 0;
done2:
if (sops != sopbuf)
- free(sops, M_SEM);
+ free(sops, M_SEM, 0);
return (error);
}
M_WAITOK|M_ZERO);
bcopy(semseqs, newseqs,
seminfo.semmni * sizeof(unsigned short));
- free(sema, M_SEM);
- free(semseqs, M_SEM);
+ free(sema, M_SEM, 0);
+ free(semseqs, M_SEM, 0);
sema = sema_new;
semseqs = newseqs;
seminfo.semmni = val;
-/* $OpenBSD: sysv_shm.c,v 1.56 2014/03/18 06:59:00 guenther Exp $ */
+/* $OpenBSD: sysv_shm.c,v 1.57 2014/07/12 18:43:32 tedu Exp $ */
/* $NetBSD: sysv_shm.c,v 1.50 1998/10/21 22:24:29 tron Exp $ */
/*
i++, shmmap_s++)
if (shmmap_s->shmid != -1)
shm_delete_mapping(vm, shmmap_s);
- free(vm->vm_shm, M_SHM);
+ free(vm->vm_shm, M_SHM, 0);
vm->vm_shm = NULL;
}
M_SHM, M_WAITOK|M_ZERO);
bcopy(shmsegs, newsegs,
shminfo.shmmni * sizeof(struct shmid_ds *));
- free(shmsegs, M_SHM);
+ free(shmsegs, M_SHM, 0);
shmsegs = newsegs;
newseqs = malloc(val * sizeof(unsigned short), M_SHM,
M_WAITOK|M_ZERO);
bcopy(shmseqs, newseqs,
shminfo.shmmni * sizeof(unsigned short));
- free(shmseqs, M_SHM);
+ free(shmseqs, M_SHM, 0);
shmseqs = newseqs;
shminfo.shmmni = val;
return (0);
-/* $OpenBSD: tty.c,v 1.110 2014/07/08 17:19:25 deraadt Exp $ */
+/* $OpenBSD: tty.c,v 1.111 2014/07/12 18:43:32 tedu Exp $ */
/* $NetBSD: tty.c,v 1.68.4.2 1996/06/06 16:04:52 thorpej Exp $ */
/*-
out:
if (stime) {
timeout_del(stime);
- free(stime, M_TEMP);
+ free(stime, M_TEMP, 0);
}
return (error);
}
clfree(&tp->t_rawq);
clfree(&tp->t_canq);
clfree(&tp->t_outq);
- free(tp, M_TTYS);
+ free(tp, M_TTYS, 0);
}
void
ttystats_init(&ttystats);
err = sysctl_rdstruct(oldp, oldlenp, newp, ttystats,
tty_count * sizeof(struct itty));
- free(ttystats, M_SYSCTL);
+ free(ttystats, M_SYSCTL, 0);
return (err);
}
default:
-/* $OpenBSD: tty_endrun.c,v 1.3 2010/04/12 12:57:52 tedu Exp $ */
+/* $OpenBSD: tty_endrun.c,v 1.4 2014/07/12 18:43:32 tedu Exp $ */
/*
* Copyright (c) 2008 Marc Balmer <mbalmer@openbsd.org>
error = linesw[TTYDISC].l_open(dev, tp, p);
if (error) {
- free(np, M_DEVBUF);
+ free(np, M_DEVBUF, 0);
tp->t_sc = NULL;
} else {
sensordev_install(&np->timedev);
tp->t_line = TTYDISC; /* switch back to termios */
timeout_del(&np->endrun_tout);
sensordev_deinstall(&np->timedev);
- free(np, M_DEVBUF);
+ free(np, M_DEVBUF, 0);
tp->t_sc = NULL;
endrun_count--;
if (endrun_count == 0)
-/* $OpenBSD: tty_msts.c,v 1.16 2010/04/12 12:57:52 tedu Exp $ */
+/* $OpenBSD: tty_msts.c,v 1.17 2014/07/12 18:43:32 tedu Exp $ */
/*
* Copyright (c) 2008 Marc Balmer <mbalmer@openbsd.org>
error = linesw[TTYDISC].l_open(dev, tp, p);
if (error) {
- free(np, M_DEVBUF);
+ free(np, M_DEVBUF, 0);
tp->t_sc = NULL;
} else {
sensordev_install(&np->timedev);
tp->t_line = TTYDISC; /* switch back to termios */
timeout_del(&np->msts_tout);
sensordev_deinstall(&np->timedev);
- free(np, M_DEVBUF);
+ free(np, M_DEVBUF, 0);
tp->t_sc = NULL;
msts_count--;
if (msts_count == 0)
-/* $OpenBSD: tty_nmea.c,v 1.41 2014/03/21 21:54:14 andre Exp $ */
+/* $OpenBSD: tty_nmea.c,v 1.42 2014/07/12 18:43:32 tedu Exp $ */
/*
* Copyright (c) 2006, 2007, 2008 Marc Balmer <mbalmer@openbsd.org>
error = linesw[TTYDISC].l_open(dev, tp, p);
if (error) {
- free(np, M_DEVBUF);
+ free(np, M_DEVBUF, 0);
tp->t_sc = NULL;
} else {
sensordev_install(&np->timedev);
tp->t_line = TTYDISC; /* switch back to termios */
timeout_del(&np->nmea_tout);
sensordev_deinstall(&np->timedev);
- free(np, M_DEVBUF);
+ free(np, M_DEVBUF, 0);
tp->t_sc = NULL;
nmea_count--;
if (nmea_count == 0)
-/* $OpenBSD: tty_pty.c,v 1.66 2014/07/09 15:46:22 tedu Exp $ */
+/* $OpenBSD: tty_pty.c,v 1.67 2014/07/12 18:43:32 tedu Exp $ */
/* $NetBSD: tty_pty.c,v 1.33.4.1 1996/06/02 09:08:11 mrg Exp $ */
/*
newpt = ptyarralloc(newnpty);
memcpy(newpt, pt_softc, npty * sizeof(struct pt_softc *));
- free(pt_softc, M_DEVBUF);
+ free(pt_softc, M_DEVBUF, 0);
pt_softc = newpt;
npty = newnpty;
}
-/* $OpenBSD: tty_subr.c,v 1.27 2014/07/09 15:46:22 tedu Exp $ */
+/* $OpenBSD: tty_subr.c,v 1.28 2014/07/12 18:43:32 tedu Exp $ */
/* $NetBSD: tty_subr.c,v 1.13 1996/02/09 19:00:43 christos Exp $ */
/*
{
if (clp->c_cs) {
explicit_bzero(clp->c_cs, clp->c_cn);
- free(clp->c_cs, M_TTYS);
+ free(clp->c_cs, M_TTYS, 0);
}
if (clp->c_cq) {
explicit_bzero(clp->c_cq, QMEM(clp->c_cn));
- free(clp->c_cq, M_TTYS);
+ free(clp->c_cq, M_TTYS, 0);
}
clp->c_cs = clp->c_cq = NULL;
}
-/* $OpenBSD: uipc_syscalls.c,v 1.89 2013/09/14 02:28:02 guenther Exp $ */
+/* $OpenBSD: uipc_syscalls.c,v 1.90 2014/07/12 18:43:32 tedu Exp $ */
/* $NetBSD: uipc_syscalls.c,v 1.19 1996/02/09 19:00:48 christos Exp $ */
/*
error = sendit(p, SCARG(uap, s), &msg, SCARG(uap, flags), retval);
done:
if (iov != aiov)
- free(iov, M_IOV);
+ free(iov, M_IOV, 0);
return (error);
}
if (ktriov != NULL) {
if (error == 0)
ktrgenio(p, s, UIO_WRITE, ktriov, *retsize);
- free(ktriov, M_TEMP);
+ free(ktriov, M_TEMP, 0);
}
#endif
bad:
}
done:
if (iov != aiov)
- free(iov, M_IOV);
+ free(iov, M_IOV, 0);
return (error);
}
if (ktriov != NULL) {
if (error == 0)
ktrgenio(p, s, UIO_READ, ktriov, len - auio.uio_resid);
- free(ktriov, M_TEMP);
+ free(ktriov, M_TEMP, 0);
}
#endif
if (error)
-/* $OpenBSD: uipc_usrreq.c,v 1.73 2014/03/18 06:59:00 guenther Exp $ */
+/* $OpenBSD: uipc_usrreq.c,v 1.74 2014/07/12 18:43:32 tedu Exp $ */
/* $NetBSD: uipc_usrreq.c,v 1.18 1996/02/09 19:00:50 christos Exp $ */
/*
* gets them (resulting in a "panic: closef: count < 0").
*/
sorflush(unp->unp_socket);
- free(unp, M_PCB);
+ free(unp, M_PCB, 0);
unp_gc();
} else
- free(unp, M_PCB);
+ free(unp, M_PCB, 0);
}
int
so->so_pcb = NULL;
sofree(so);
m_freem(unp->unp_addr);
- free(unp, M_PCB);
+ free(unp, M_PCB, 0);
}
}
out:
fdpunlock(p->p_fd);
if (fdp)
- free(fdp, M_TEMP);
+ free(fdp, M_TEMP, 0);
return (error);
}
/* allocate a cluster and try again */
MCLGET(control, M_WAIT);
if ((control->m_flags & M_EXT) == 0) {
- free(tmp, M_TEMP);
+ free(tmp, M_TEMP, 0);
return (ENOBUFS); /* allocation failed */
}
/* copy the data back into the cluster */
cm = mtod(control, struct cmsghdr *);
memcpy(cm, tmp, control->m_len);
- free(tmp, M_TEMP);
+ free(tmp, M_TEMP, 0);
goto morespace;
}
sorflush((*fpp)->f_data);
for (i = nunref, fpp = extra_ref; --i >= 0; ++fpp)
(void) closef(*fpp, NULL);
- free(extra_ref, M_FILE);
+ free(extra_ref, M_FILE, 0);
unp_gcing = 0;
}
-/* $OpenBSD: vfs_bio.c,v 1.157 2014/07/11 03:06:08 mlarkin Exp $ */
+/* $OpenBSD: vfs_bio.c,v 1.158 2014/07/12 18:43:32 tedu Exp $ */
/* $NetBSD: vfs_bio.c,v 1.44 1996/06/11 11:15:36 pk Exp $ */
/*
biodone(xbpp[i]);
}
- free(xbpp, M_TEMP);
+ free(xbpp, M_TEMP, 0);
if (ISSET(bp->b_flags, B_ASYNC)) {
brelse(bp);
SET(xbpp[i]->b_flags, B_INVAL);
brelse(xbpp[i]);
}
- free(xbpp, M_TEMP);
+ free(xbpp, M_TEMP, 0);
goto out;
}
}
-/* $OpenBSD: vfs_cluster.c,v 1.41 2014/07/08 17:19:25 deraadt Exp $ */
+/* $OpenBSD: vfs_cluster.c,v 1.42 2014/07/12 18:43:32 tedu Exp $ */
/* $NetBSD: vfs_cluster.c,v 1.12 1996/04/22 01:39:05 christos Exp $ */
/*
for (bpp = buflist->bs_children;
bpp < endbp; bpp++)
brelse(*bpp);
- free(buflist, M_VCLUSTER);
+ free(buflist, M_VCLUSTER, 0);
cluster_wbuild(vp, NULL, bp->b_bcount,
ci->ci_cstart, cursize, lbn);
} else {
for (bpp = buflist->bs_children;
bpp <= endbp; bpp++)
bdwrite(*bpp);
- free(buflist, M_VCLUSTER);
+ free(buflist, M_VCLUSTER, 0);
ci->ci_lastw = lbn;
ci->ci_lasta = bp->b_blkno;
return;
-/* $OpenBSD: vfs_getcwd.c,v 1.21 2013/08/13 05:52:24 guenther Exp $ */
+/* $OpenBSD: vfs_getcwd.c,v 1.22 2014/07/12 18:43:32 tedu Exp $ */
/* $NetBSD: vfs_getcwd.c,v 1.3.2.3 1999/07/11 10:24:09 sommerfeld Exp $ */
/*
vrele(lvp);
*lvpp = NULL;
- free(dirbuf, M_TEMP);
+ free(dirbuf, M_TEMP, 0);
return (error);
}
error = copyout(bp, SCARG(uap, buf), lenused);
out:
- free(path, M_TEMP);
+ free(path, M_TEMP, 0);
return (error);
}
-/* $OpenBSD: vfs_subr.c,v 1.216 2014/07/10 12:21:08 mpi Exp $ */
+/* $OpenBSD: vfs_subr.c,v 1.217 2014/07/12 18:43:32 tedu Exp $ */
/* $NetBSD: vfs_subr.c,v 1.53 1996/04/22 01:39:13 christos Exp $ */
/*
vx->v_flag &= ~VALIASED;
vp->v_flag &= ~VALIASED;
}
- free(vp->v_specinfo, M_VNODE);
+ free(vp->v_specinfo, M_VNODE, 0);
vp->v_specinfo = NULL;
}
/*
ret = sysctl_rdstruct(oldp, oldlenp, newp, tmpvfsp,
sizeof(struct vfsconf));
- free(tmpvfsp, M_TEMP);
+ free(tmpvfsp, M_TEMP, 0);
return (ret);
case VFS_BCACHESTAT: /* buffer cache statistics */
ret = sysctl_rdstruct(oldp, oldlenp, newp, &bcstats,
crfromxucred(&np->netc_anon, &argp->ex_anon);
return (0);
out:
- free(np, M_NETADDR);
+ free(np, M_NETADDR, 0);
return (error);
}
struct radix_node_head *rnh = (struct radix_node_head *)w;
(*rnh->rnh_deladdr)(rn->rn_key, rn->rn_mask, rnh, NULL);
- free(rn, M_NETADDR);
+ free(rn, M_NETADDR, 0);
return (0);
}
if ((rnh = nep->ne_rtable_inet) != NULL) {
(*rnh->rnh_walktree)(rnh, vfs_free_netcred, rnh);
- free(rnh, M_RTABLE);
+ free(rnh, M_RTABLE, 0);
nep->ne_rtable_inet = NULL;
}
}
-/* $OpenBSD: vfs_syscalls.c,v 1.207 2014/07/08 17:19:25 deraadt Exp $ */
+/* $OpenBSD: vfs_syscalls.c,v 1.208 2014/07/12 18:43:32 tedu Exp $ */
/* $NetBSD: vfs_syscalls.c,v 1.71 1996/04/23 10:29:02 mycroft Exp $ */
/*
} else {
mp->mnt_vnodecovered->v_mountedhere = NULL;
vfs_unbusy(mp);
- free(mp, M_MOUNT);
+ free(mp, M_MOUNT, 0);
vput(vp);
}
return (error);
panic("unmount: dangling vnode");
vfs_unbusy(mp);
- free(mp, M_MOUNT);
+ free(mp, M_MOUNT, 0);
return (0);
}
-/* $OpenBSD: vfs_vnops.c,v 1.76 2014/07/08 17:19:25 deraadt Exp $ */
+/* $OpenBSD: vfs_vnops.c,v 1.77 2014/07/12 18:43:32 tedu Exp $ */
/* $NetBSD: vfs_vnops.c,v 1.20 1996/02/04 02:18:41 christos Exp $ */
/*
VOP_UNLOCK(vp, 0, p); /* keep a reference */
vp = ndp->ni_vp; /* for the increment below */
- free(cip, M_TEMP);
+ free(cip, M_TEMP, 0);
}
if (fmode & FWRITE)
-/* $OpenBSD: malloc.h,v 1.110 2014/07/12 10:51:35 tedu Exp $ */
+/* $OpenBSD: malloc.h,v 1.111 2014/07/12 18:43:32 tedu Exp $ */
/* $NetBSD: malloc.h,v 1.39 1998/07/12 19:52:01 augustss Exp $ */
/*
void *malloc(size_t, int, int);
void *mallocarray(size_t, size_t, int, int);
-void free(void *, int);
+void free(void *, int, size_t);
int sysctl_malloc(int *, u_int, void *, size_t *, void *, size_t,
struct proc *);