Re: [RFC v5][PATCH 9/9] Restore open file descriprtors

Dave Hansen
2008-09-22T16:02:28Z

On Tue, 2008-09-16 at 20:11 -0400, Oren Laadan wrote:
>
> No. (this was discussed earlier already).
>
> cr_hbuf_get() "allocates" space inside a dedicated buffer for headers
> in the checkpoint context (ctx->hbuf). It does not allocate new kernel
> memory. Instead, it returns the current position in that buffer
> ctx->hbuf[ctx->hpos], and advances ctx->hpos appropriately. On the
> other side, cr_hbuf_put() reverses that effect, reducing ctx->hpos
> accordingly.
>
> If an error occurs, the checkpoint (or restart) operation is aborted,
> and eventually the context (ctx) will be cleaned up; at that point the
> special purpose buffer will be freed.

I think this is like claiming that my malloc() will get freed if my
applications exits, so I don't have to worry about free(). It is messy,
it makes lifetime rules and use less explicit, and it makes bugs harder
to find. If I were a good programmer (which I'm not) I probably
wouldn't do that.

-- Dave