From owner-freebsd-arch Tue Jun 20 14:25:41 2000 Delivered-To: freebsd-arch@freebsd.org Received: from alcanet.com.au (mail.alcanet.com.au [203.62.196.10]) by hub.freebsd.org (Postfix) with ESMTP id A7B5A37BE0D for ; Tue, 20 Jun 2000 14:25:35 -0700 (PDT) (envelope-from jeremyp@gsmx07.alcatel.com.au) Received: by border.alcanet.com.au id <115222>; Wed, 21 Jun 2000 07:25:27 +1000 Content-return: prohibited Date: Wed, 21 Jun 2000 07:25:19 +1000 From: Peter Jeremy Subject: Re: kblob discussion. In-reply-to: <20000619111309.E26801@fw.wintelcom.net>; from bright@wintelcom.net on Tue, Jun 20, 2000 at 04:15:17AM +1000 To: Alfred Perlstein Cc: arch@FreeBSD.ORG Message-Id: <00Jun21.072527est.115222@border.alcanet.com.au> MIME-version: 1.0 X-Mailer: Mutt 1.0i Content-type: text/plain; charset=us-ascii References: <20000619111309.E26801@fw.wintelcom.net> Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On 2000-Jun-20 04:15:17 +1000, Alfred Perlstein 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