From owner-p4-projects@FreeBSD.ORG Sun Jun 14 15:19:50 2009 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 7297E1065675; Sun, 14 Jun 2009 15:19:50 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 32877106566B for ; Sun, 14 Jun 2009 15:19:50 +0000 (UTC) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 9E7CA8FC1F for ; Sun, 14 Jun 2009 15:19:49 +0000 (UTC) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id n5EFJkCL030469 for ; Sun, 14 Jun 2009 15:19:46 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id n5EFJhnr030467 for perforce@freebsd.org; Sun, 14 Jun 2009 15:19:43 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Date: Sun, 14 Jun 2009 15:19:43 GMT Message-Id: <200906141519.n5EFJhnr030467@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to bb+lists.freebsd.perforce@cyrus.watson.org using -f From: Robert Watson To: Perforce Change Reviews Cc: Subject: PERFORCE change 164345 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Jun 2009 15:19:51 -0000 http://perforce.freebsd.org/chv.cgi?CH=164345 Change 164345 by rwatson@rwatson_freebsd_capabilities on 2009/06/14 15:19:29 Define '_rights' versions of libcapability IPC interfaces in order to send file descriptor rights with messages or RPCs. Affected files ... .. //depot/projects/trustedbsd/capabilities/src/lib/libcapability/libcapability.h#14 edit Differences ... ==== //depot/projects/trustedbsd/capabilities/src/lib/libcapability/libcapability.h#14 (text+ko) ==== @@ -30,7 +30,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $P4: //depot/projects/trustedbsd/capabilities/src/lib/libcapability/libcapability.h#13 $ + * $P4: //depot/projects/trustedbsd/capabilities/src/lib/libcapability/libcapability.h#14 $ */ #ifndef _LIBCAPABILITY_H_ @@ -70,27 +70,52 @@ int lch_getprocdesc(struct lc_sandbox *lcsp, int *fdp); /* - * I/O interfaces for the host environment. + * Message-passing APIs for the host environment. */ struct iovec; ssize_t lch_recv(struct lc_sandbox *lcsp, void *buf, size_t len, int flags); +ssize_t lch_recv_rights(struct lc_sandbox *lcsp, void *buf, size_t len, + int flags, int *fdp, int *fdcountp); +ssize_t lch_send(struct lc_sandbox *lcsp, const void *msg, size_t len, + int flags); +ssize_t lch_send_rights(struct lc_sandbox *lcsp, const void *msg, size_t len, + int flags, int *fdp, int fdcount); + +/* + * RPC APIs for the host environment. + */ int lch_rpc(struct lc_sandbox *lcsp, u_int32_t opno, struct iovec *req, int reqcount, struct iovec *rep, int repcount, size_t *replenp); -ssize_t lch_send(struct lc_sandbox *lcsp, const void *msg, size_t len, - int flags); +int lch_rpc_rights(struct lc_sandbox *lcsp, u_int32_t opno, + struct iovec *req, int reqcount, int *req_fdp, int *req_fdcount, + struct iovec *rep, int repcount, int *rep_fdp, int *rep_fdcount); /* - * Capability mode sandbox APIs. + * Interfaces to query state from within capability mode sandboxes. */ int lcs_get(struct lc_host **lchpp); int lcs_getsock(struct lc_host *lchp, int *fdp); + +/* + * Message-passing APIs for the sandbox environment. + */ ssize_t lcs_recv(struct lc_host *lchp, void *buf, size_t len, int flags); +ssize_t lcs_send(struct lc_host *lchp, const void *msg, size_t len, + int flags); + +/* + * RPC APIs for the sandbox environment. + */ int lcs_recvrpc(struct lc_host *lchp, u_int32_t *opnop, u_int32_t *seqnop, u_char **bufferp, size_t *lenp); -ssize_t lcs_send(struct lc_host *lchp, const void *msg, size_t len, - int flags); +int lcs_recvrpc_rights(struct lc_host *lchp, u_int32_t *opnop, + u_int32_t *seqnop, u_char **bufferp, size_t *lenp, int *fdp, + int *fdcountp); int lcs_sendrpc(struct lc_host *lchp, u_int32_t opno, u_int32_t seqno, struct iovec *rep, int repcount); +int lcs_sendrpc_rights(struct lc_host *lchp, u_int32_t opno, + u_int32_t seqno, struct iovec *rep, int repcount, int *fdp, + int *fdcountp); /* * Actually an rtld-elf-cap symbol, but declared here so it is available to