remove trailing whitespace

This commit is contained in:
Love Hornquist Astrand
2011-05-21 11:57:31 -07:00
parent 25e86d6f4d
commit 0879b9831a
539 changed files with 6825 additions and 6825 deletions

View File

@@ -73,14 +73,14 @@ set_timer(void)
dispatch_source_set_timer(timer,
dispatch_time(DISPATCH_TIME_NOW,
timeoutvalue * NSEC_PER_SEC),
timeoutvalue * NSEC_PER_SEC, 1000000);
timeoutvalue * NSEC_PER_SEC, 1000000);
}
static void
init_globals(void)
{
static dispatch_once_t once;
dispatch_once(&once, ^{
dispatch_once(&once, ^{
timerq = dispatch_queue_create("hiem-sipc-timer-q", NULL);
timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, timerq);
dispatch_source_set_event_handler(timer, ^{ timer_ev(); } );
@@ -138,7 +138,7 @@ mach_complete_sync(heim_sipc_call ctx, int returnvalue, heim_idata *reply)
kr = KERN_SUCCESS;
} else {
replyinCnt = 0;
kr = vm_read(mach_task_self(),
kr = vm_read(mach_task_self(),
(vm_address_t)reply->data, reply->length,
(vm_address_t *)&replyout, &replyoutCnt);
}
@@ -175,7 +175,7 @@ mach_complete_async(heim_sipc_call ctx, int returnvalue, heim_idata *reply)
kr = KERN_SUCCESS;
} else {
replyinCnt = 0;
kr = vm_read(mach_task_self(),
kr = vm_read(mach_task_self(),
(vm_address_t)reply->data, reply->length,
(vm_address_t *)&replyout, &replyoutCnt);
}
@@ -219,19 +219,19 @@ mheim_do_call(mach_port_t server_port,
s = malloc(sizeof(*s));
if (s == NULL)
return KERN_MEMORY_FAILURE; /* XXX */
s->reply_port = reply_port;
audit_token_to_au32(client_creds, NULL, &uid, &gid, NULL, NULL, &pid, &session, NULL);
kr = _heim_ipc_create_cred(uid, gid, pid, session, &s->cred);
if (kr) {
free(s);
return kr;
}
suspend_timer();
if (requestinCnt) {
s->req.data = malloc(requestinCnt);
memcpy(s->req.data, requestin, requestinCnt);
@@ -241,7 +241,7 @@ mheim_do_call(mach_port_t server_port,
memcpy(s->req.data, requestout, requestoutCnt);
s->req.length = requestoutCnt;
}
dispatch_async(workq, ^{
(ctx->callback)(ctx->userctx, &s->req, s->cred,
mach_complete_sync, (heim_sipc_call)s);
@@ -266,23 +266,23 @@ mheim_do_call_request(mach_port_t server_port,
gid_t gid;
pid_t pid;
au_asid_t session;
s = malloc(sizeof(*s));
if (s == NULL)
return KERN_MEMORY_FAILURE; /* XXX */
s->reply_port = reply_port;
audit_token_to_au32(client_creds, NULL, &uid, &gid, NULL, NULL, &pid, &session, NULL);
kr = _heim_ipc_create_cred(uid, gid, pid, session, &s->cred);
if (kr) {
free(s);
return kr;
}
suspend_timer();
if (requestinCnt) {
s->req.data = malloc(requestinCnt);
memcpy(s->req.data, requestin, requestinCnt);
@@ -292,12 +292,12 @@ mheim_do_call_request(mach_port_t server_port,
memcpy(s->req.data, requestout, requestoutCnt);
s->req.length = requestoutCnt;
}
dispatch_async(workq, ^{
(ctx->callback)(ctx->userctx, &s->req, s->cred,
mach_complete_async, (heim_sipc_call)s);
});
return KERN_SUCCESS;
}
@@ -319,7 +319,7 @@ mach_init(const char *service, mach_port_t sport, heim_sipc ctx)
free(name);
s->sport = sport;
s->source = dispatch_source_create(DISPATCH_SOURCE_TYPE_MACH_RECV,
s->source = dispatch_source_create(DISPATCH_SOURCE_TYPE_MACH_RECV,
s->sport, 0, s->queue);
if (s->source == NULL) {
dispatch_release(s->queue);
@@ -338,7 +338,7 @@ mach_init(const char *service, mach_port_t sport, heim_sipc ctx)
dispatch_source_set_cancel_handler(s->source, ^{
heim_sipc ctx = dispatch_get_context(dispatch_get_current_queue());
struct mach_service *st = ctx->mech;
mach_port_mod_refs(mach_task_self(), st->sport,
mach_port_mod_refs(mach_task_self(), st->sport,
MACH_PORT_RIGHT_RECEIVE, -1);
dispatch_release(st->queue);
dispatch_release(st->source);
@@ -376,7 +376,7 @@ mach_checkin_or_register(const char *service)
if (kr != KERN_SUCCESS)
return MACH_PORT_NULL;
kr = mach_port_insert_right(mach_task_self(), mp, mp,
kr = mach_port_insert_right(mach_task_self(), mp, mp,
MACH_MSG_TYPE_MAKE_SEND);
if (kr != KERN_SUCCESS) {
mach_port_destroy(mach_task_self(), mp);
@@ -425,7 +425,7 @@ heim_sipc_launchd_mach_init(const char *service,
c->release = mach_release;
c->userctx = user;
c->callback = callback;
ret = mach_init(service, sport, c);
if (ret)
goto error;
@@ -436,7 +436,7 @@ heim_sipc_launchd_mach_init(const char *service,
if (c)
free(c);
if (sport != MACH_PORT_NULL)
mach_port_mod_refs(mach_task_self(), sport,
mach_port_mod_refs(mach_task_self(), sport,
MACH_PORT_RIGHT_RECEIVE, -1);
return ret;
#else /* !(__APPLE__ && HAVE_GCD) */
@@ -501,7 +501,7 @@ update_client_creds(struct client *c)
/* Solaris 10 */
{
ucred_t *peercred;
if (getpeerucred(c->fd, &peercred) != 0) {
c->unixrights.uid = ucred_geteuid(peercred);
c->unixrights.gid = ucred_getegid(peercred);
@@ -563,7 +563,7 @@ update_client_creds(struct client *c)
void *crmsg;
struct cmsghdr *cmp;
struct sockcred *sc;
memset(&msg, 0, sizeof(msg));
crmsgsize = CMSG_SPACE(SOCKCREDSIZE(NGROUPS));
if (crmsgsize == 0)
@@ -574,32 +574,32 @@ update_client_creds(struct client *c)
goto failed_scm_creds;
memset(crmsg, 0, crmsgsize);
msg.msg_control = crmsg;
msg.msg_controllen = crmsgsize;
if (recvmsg(c->fd, &msg, 0) < 0) {
free(crmsg);
goto failed_scm_creds;
}
}
if (msg.msg_controllen == 0 || (msg.msg_flags & MSG_CTRUNC) != 0) {
free(crmsg);
goto failed_scm_creds;
}
}
cmp = CMSG_FIRSTHDR(&msg);
if (cmp->cmsg_level != SOL_SOCKET || cmp->cmsg_type != SCM_CREDS) {
free(crmsg);
goto failed_scm_creds;
}
}
sc = (struct sockcred *)(void *)CMSG_DATA(cmp);
c->unixrights.uid = sc->sc_euid;
c->unixrights.gid = sc->sc_egid;
c->unixrights.pid = 0;
free(crmsg);
return 1;
} else {
@@ -624,7 +624,7 @@ add_new_socket(int fd,
c = calloc(1, sizeof(*c));
if (c == NULL)
return NULL;
if (flags & LISTEN_SOCKET) {
c->fd = fd;
} else {
@@ -644,13 +644,13 @@ add_new_socket(int fd,
#ifdef HAVE_GCD
init_globals();
c->in = dispatch_source_create(DISPATCH_SOURCE_TYPE_READ,
c->in = dispatch_source_create(DISPATCH_SOURCE_TYPE_READ,
c->fd, 0, eventq);
c->out = dispatch_source_create(DISPATCH_SOURCE_TYPE_WRITE,
c->fd, 0, eventq);
dispatch_source_set_event_handler(c->in, ^{
dispatch_source_set_event_handler(c->in, ^{
int rw = (c->flags & WAITING_WRITE);
handle_read(c);
if (rw == 0 && (c->flags & WAITING_WRITE))
@@ -666,7 +666,7 @@ add_new_socket(int fd,
}
maybe_close(c);
});
dispatch_resume(c->in);
#else
clients = erealloc(clients, sizeof(clients[0]) * (num_clients + 1));
@@ -882,7 +882,7 @@ handle_read(struct client *c)
c->len + 1024);
c->len += 1024;
}
len = read(c->fd, c->inmsg + c->ptr, c->len - c->ptr);
if (len <= 0) {
c->flags |= WAITING_CLOSE;
@@ -892,10 +892,10 @@ handle_read(struct client *c)
c->ptr += len;
if (c->ptr > c->len)
abort();
while (c->ptr >= sizeof(dlen)) {
struct socket_call *cs;
if((c->flags & ALLOW_HTTP) && c->ptr >= 4 &&
strncmp((char *)c->inmsg, "GET ", 4) == 0 &&
strncmp((char *)c->inmsg + c->ptr - 4, "\r\n\r\n", 4) == 0) {
@@ -923,24 +923,24 @@ handle_read(struct client *c)
if (dlen > c->ptr - sizeof(dlen)) {
break;
}
cs = emalloc(sizeof(*cs));
cs->c = c;
cs->in.data = emalloc(dlen);
memcpy(cs->in.data, c->inmsg + sizeof(dlen), dlen);
cs->in.length = dlen;
c->ptr -= sizeof(dlen) + dlen;
memmove(c->inmsg,
c->inmsg + sizeof(dlen) + dlen,
c->ptr);
}
c->calls++;
if ((c->flags & UNIX_SOCKET) != 0) {
if (update_client_creds(c))
_heim_ipc_create_cred(c->unixrights.uid, c->unixrights.gid,
_heim_ipc_create_cred(c->unixrights.uid, c->unixrights.gid,
c->unixrights.pid, -1, &cs->cred);
}
@@ -995,7 +995,7 @@ process_loop(void)
fds[n].events |= POLLIN;
if (clients[n]->flags & WAITING_WRITE)
fds[n].events |= POLLOUT;
fds[n].revents = 0;
}