Date: Wed, 21 Jun 2000 07:25:19 +1000 From: Peter Jeremy <peter.jeremy@alcatel.com.au> To: Alfred Perlstein <bright@wintelcom.net> Cc: arch@FreeBSD.ORG Subject: Re: kblob discussion. Message-ID: <00Jun21.072527est.115222@border.alcanet.com.au> In-Reply-To: <20000619111309.E26801@fw.wintelcom.net>; from bright@wintelcom.net on Tue, Jun 20, 2000 at 04:15:17AM %2B1000 References: <20000619111309.E26801@fw.wintelcom.net>
next in thread | previous in thread | raw e-mail | index | archive | help
On 2000-Jun-20 04:15:17 +1000, Alfred Perlstein <bright@wintelcom.net> wrote:
>It's a new syscall, less overhead than sendfile and useful for
>serving small chunks of data very quickly.
What is the behaviour of kblobs across fork() and exec()?
Can that be controlled (along the lines of fcntl(...,F_[SG]ETFD,...))?
How do you destroy a kblob when it's no longer needed?
>/*
> * see sendfile(2), but instead of the fd referencing a vnode it
> * references a fd returned from kblob
> */
>int kblobsend __P((int, int, off_t, size_t, struct sf_hdtr *,
> off_t *, int));
Wouldn't it be easier for kblob(2) to return an fd from the same
pool as files/sockets - in which case it could just be passed to
sendfile(2) which would internally distiguish between a file and
a kblob.
Also it seems that the current API (for both sendfile(2) and
kblobsend(2)) contains an unnecessarily arbitrary restriction
that you want to send an optional header, a single object, then
an optional trailer. Using writev(2) as a model, how about the
following:
struct io_obj {
enum { OBJ_FILE, OBJ_KBLOB, OBJ_DATA } obj_type;
union {
const void *obj_data; /* OBJ_DATA */
int obj_fd; /* OBJ_FILE, OBJ_KBLOB */
} u;
size_t obj_size; /* 0 for entire file/kblob */
off_t obj_offset; /* start offset in object */
};
ssize_t writeobj(int sock, const struct io_obj *objp, int nobj);
This would allow an arbitrary assortment of objects to be written
in a single syscall. It also offers a possible path to readobj(2)
(which would be able to read directly into a file, user memory, or
create a kblob()).
Peter
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?00Jun21.072527est.115222>
