PERFORCE change 164277 for review
Robert Watson
rwatson at FreeBSD.org
Sat Jun 13 14:45:37 UTC 2009
http://perforce.freebsd.org/chv.cgi?CH=164277
Change 164277 by rwatson at rwatson_freebsd_capabilities on 2009/06/13 14:44:57
Rename variable to track data structure rename: lc_agent ->
lc_sandbox.
Affected files ...
.. //depot/projects/trustedbsd/capabilities/src/lib/libcapability/libcapability_host.c#12 edit
Differences ...
==== //depot/projects/trustedbsd/capabilities/src/lib/libcapability/libcapability_host.c#12 (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_host.c#11 $
+ * $P4: //depot/projects/trustedbsd/capabilities/src/lib/libcapability/libcapability_host.c#12 $
*/
#include <sys/param.h>
@@ -218,9 +218,9 @@
int
lch_startfd_flags(int fd_sandbox, const char *binname, char *const argv[],
- u_int flags, struct lc_sandbox **lcapp)
+ u_int flags, struct lc_sandbox **lcspp)
{
- struct lc_sandbox *lcap;
+ struct lc_sandbox *lcsp;
int fd_devnull, fd_ldso, fd_libc, fd_libcapabilitym, fd_libz;
int fd_procdesc, fd_sockpair[2];
int error, val;
@@ -229,10 +229,10 @@
fd_devnull = fd_ldso = fd_libc = fd_libz = fd_libcapabilitym =
fd_procdesc = fd_sockpair[0] = fd_sockpair[1] = -1;
- lcap = malloc(sizeof(*lcap));
- if (lcap == NULL)
+ lcsp = malloc(sizeof(*lcsp));
+ if (lcsp == NULL)
return (-1);
- bzero(lcap, sizeof(*lcap));
+ bzero(lcsp, sizeof(*lcsp));
#ifdef IN_CAP_MODE
if (ld_caplibindex_lookup(LD_ELF_CAP_SO, &fd_ldso) < 0)
@@ -298,10 +298,10 @@
#endif
close(fd_sockpair[1]);
- lcap->lcs_fd_procdesc = fd_procdesc;
- lcap->lcs_fd_sock = fd_sockpair[0];
- lcap->lcs_pid = pid;
- *lcapp = lcap;
+ lcsp->lcs_fd_procdesc = fd_procdesc;
+ lcsp->lcs_fd_sock = fd_sockpair[0];
+ lcsp->lcs_pid = pid;
+ *lcspp = lcsp;
return (0);
@@ -323,24 +323,24 @@
if (fd_ldso != -1)
close(fd_ldso);
#endif
- if (lcap != NULL)
- free(lcap);
+ if (lcsp != NULL)
+ free(lcsp);
errno = error;
return (-1);
}
int
lch_startfd(int fd_sandbox, const char *binname, char *const argv[],
- struct lc_sandbox **lcapp)
+ struct lc_sandbox **lcspp)
{
- return (lch_startfd_flags(fd_sandbox, binname, argv, 0, lcapp));
+ return (lch_startfd_flags(fd_sandbox, binname, argv, 0, lcspp));
}
#ifndef IN_CAP_MODE
int
lch_start_flags(const char *sandbox, char *const argv[], u_int flags,
- struct lc_sandbox **lcapp)
+ struct lc_sandbox **lcspp)
{
char binname[MAXPATHLEN];
int error, fd_sandbox, ret;
@@ -352,7 +352,7 @@
if (fd_sandbox < 0)
return (-1);
- ret = lch_startfd_flags(fd_sandbox, binname, argv, flags, lcapp);
+ ret = lch_startfd_flags(fd_sandbox, binname, argv, flags, lcspp);
error = errno;
close(fd_sandbox);
errno = error;
@@ -360,45 +360,45 @@
}
int
-lch_start(const char *sandbox, char *const argv[], struct lc_sandbox **lcapp)
+lch_start(const char *sandbox, char *const argv[], struct lc_sandbox **lcspp)
{
- return (lch_start_flags(sandbox, argv, 0, lcapp));
+ return (lch_start_flags(sandbox, argv, 0, lcspp));
}
#endif
void
-lch_stop(struct lc_sandbox *lcap)
+lch_stop(struct lc_sandbox *lcsp)
{
- close(lcap->lcs_fd_sock);
- close(lcap->lcs_fd_procdesc);
- lcap->lcs_fd_sock = -1;
- lcap->lcs_fd_procdesc = -1;
- lcap->lcs_pid = -1;
+ close(lcsp->lcs_fd_sock);
+ close(lcsp->lcs_fd_procdesc);
+ lcsp->lcs_fd_sock = -1;
+ lcsp->lcs_fd_procdesc = -1;
+ lcsp->lcs_pid = -1;
}
int
-lch_getsock(struct lc_sandbox *lcap, int *fdp)
+lch_getsock(struct lc_sandbox *lcsp, int *fdp)
{
- *fdp = lcap->lcs_fd_sock;
+ *fdp = lcsp->lcs_fd_sock;
return (0);
}
int
-lch_getpid(struct lc_sandbox *lcap, pid_t *pidp)
+lch_getpid(struct lc_sandbox *lcsp, pid_t *pidp)
{
- *pidp = lcap->lcs_pid;
+ *pidp = lcsp->lcs_pid;
return (0);
}
int
-lch_getprocdesc(struct lc_sandbox *lcap, int *fdp)
+lch_getprocdesc(struct lc_sandbox *lcsp, int *fdp)
{
- *fdp = lcap->lcs_fd_procdesc;
+ *fdp = lcsp->lcs_fd_procdesc;
return (0);
}
@@ -407,27 +407,27 @@
* on the worker should take place here.
*/
ssize_t
-lch_send(struct lc_sandbox *lcap, const void *msg, size_t len, int flags)
+lch_send(struct lc_sandbox *lcsp, const void *msg, size_t len, int flags)
{
- if (lcap->lcs_fd_sock == -1 ||
- lcap->lcs_fd_sock == 0) {
+ if (lcsp->lcs_fd_sock == -1 ||
+ lcsp->lcs_fd_sock == 0) {
errno = ECHILD;
return (-1);
}
- return (send(lcap->lcs_fd_sock, msg, len, flags));
+ return (send(lcsp->lcs_fd_sock, msg, len, flags));
}
ssize_t
-lch_recv(struct lc_sandbox *lcap, void *buf, size_t len, int flags)
+lch_recv(struct lc_sandbox *lcsp, void *buf, size_t len, int flags)
{
- if (lcap->lcs_fd_sock == -1 ||
- lcap->lcs_fd_sock == 0) {
+ if (lcsp->lcs_fd_sock == -1 ||
+ lcsp->lcs_fd_sock == 0) {
errno = ESRCH;
return (-1);
}
- return (recv(lcap->lcs_fd_sock, buf, len, flags));
+ return (recv(lcsp->lcs_fd_sock, buf, len, flags));
}
/*
@@ -440,7 +440,7 @@
* a bad idea to use them anyway.
*/
int
-lch_rpc(struct lc_sandbox *lcap, u_int32_t opno, struct iovec *req,
+lch_rpc(struct lc_sandbox *lcsp, u_int32_t opno, struct iovec *req,
int reqcount, struct iovec *rep, int repcount, size_t *replenp)
{
struct lcrpc_request_hdr req_hdr;
@@ -461,7 +461,7 @@
/*
* Send our header.
*/
- len = lch_send(lcap, &req_hdr, sizeof(req_hdr), 0);
+ len = lch_send(lcsp, &req_hdr, sizeof(req_hdr), 0);
if (len < 0)
return (-1);
if (len != sizeof(req_hdr)) {
@@ -473,7 +473,7 @@
* Send the user request.
*/
for (i = 0; i < reqcount; i++) {
- len = lch_send(lcap, req[i].iov_base, req[i].iov_len, 0);
+ len = lch_send(lcsp, req[i].iov_base, req[i].iov_len, 0);
if (len < 0)
return (-1);
if ((size_t)len != req[i].iov_len) {
@@ -485,7 +485,7 @@
/*
* Receive our header and validate.
*/
- len = lch_recv(lcap, &rep_hdr, sizeof(rep_hdr), MSG_WAITALL);
+ len = lch_recv(lcsp, &rep_hdr, sizeof(rep_hdr), MSG_WAITALL);
if (len < 0)
return (-1);
if (len != sizeof(rep_hdr)) {
@@ -512,7 +512,7 @@
space = rep[i].iov_len - off;
left = rep_hdr.lcrpc_rephdr_datalen - totlen;
want = (space > left) ? space : left;
- len = lch_recv(lcap,
+ len = lch_recv(lcsp,
(u_char *)((uintptr_t)rep[i].iov_base + off),
want, MSG_WAITALL);
if (len < 0)
More information about the p4-projects
mailing list