Subject: re: UVM patch: sys_swapctl split
To: enami tsugutomo <enami@sm.sony.co.jp>
From: matthew green <mrg@eterna.com.au>
List: tech-kern
Date: 03/18/2002 14:05:53
> @@ -495,51 +495,13 @@
> #endif
> ) {
> - sep = (struct swapent *)SCARG(uap, arg);
> - count = 0;
> + misc = MIN(uvmexp.nswapdev, misc);
> + len = sizeof(struct swapent) * misc;
> + sep = (struct swapent *)malloc(len, M_TEMP, M_WAITOK);
>
> - LIST_FOREACH(spp, &swap_priority, spi_swappri) {
> - for (sdp = CIRCLEQ_FIRST(&spp->spi_swapdev);
> - sdp != (void *)&spp->spi_swapdev && misc-- > 0;
> - sdp = CIRCLEQ_NEXT(sdp, swd_next)) {
> - /*
> - * backwards compatibility for system call.
> - * note that we use 'struct oswapent' as an
> - * overlay into both 'struct swapdev' and
> - * the userland 'struct swapent', as we
> - * want to retain backwards compatibility
> - * with NetBSD 1.3.
> - */
> - sdp->swd_ose.ose_inuse =
> - btodb((u_int64_t)sdp->swd_npginuse <<
> - PAGE_SHIFT);
> - error = copyout(&sdp->swd_ose, sep,
> - sizeof(struct oswapent));
> + uvm_swap_stats(SCARG(uap, cmd), sep, misc, retval);
> + error = copyout(sep, (void *)SCARG(uap, arg), len);
Does old 1.3 binary prepare `sizeof(struct swapent) * misc' bytes
space? I guess you should copyout up to the length just
uvm_swap_stats() copied.
ah, well spotted enami. perhaps change uvm_swap_stats() to return
a size_t length?
emmanuel, it would be really nice if you could get a 1.3 swapctl
binary and test with it, just to make sure.