From fa325e9b42b0bdfb48857d1958d9fb7ceac55151 Mon Sep 17 00:00:00 2001 From: Dan Cross Date: Fri, 10 Jan 2020 14:44:21 +0000 Subject: Trivial changes: whitespace and modes. Remote whitespace at the ends of lines. Remove blank lines from the ends of files. Change modes on source files so that they are not executable. Signed-off-by: Dan Cross --- src/libthread/386-ucontext.h | 6 ++---- src/libthread/BSD.c | 3 +-- src/libthread/Darwin-386.c | 1 - src/libthread/Darwin-power.c | 3 +-- src/libthread/Darwin-x86_64-swapcontext.c | 2 -- src/libthread/Linux-arm-swapcontext.c | 2 -- src/libthread/Linux-sparc64-swapcontext.c | 1 - src/libthread/Linux.c | 13 ++++++------- src/libthread/NetBSD.c | 1 - src/libthread/OpenBSD-386.c | 1 - src/libthread/OpenBSD-power.c | 1 - src/libthread/OpenBSD-x86_64.c | 2 -- src/libthread/channel.c | 5 ++--- src/libthread/daemonize.c | 6 +++--- src/libthread/exec.c | 1 - src/libthread/ioproc.h | 1 - src/libthread/power-ucontext.h | 1 - src/libthread/sparc-ucontext.h | 1 - src/libthread/test/thello.c | 1 - src/libthread/thread.c | 24 +++++++++++------------- src/libthread/threadimpl.h | 2 +- src/libthread/wait.c | 4 ++-- src/libthread/x86_64-ucontext.h | 1 - 23 files changed, 29 insertions(+), 54 deletions(-) (limited to 'src/libthread') diff --git a/src/libthread/386-ucontext.h b/src/libthread/386-ucontext.h index 21327d9b..b1ee81b3 100644 --- a/src/libthread/386-ucontext.h +++ b/src/libthread/386-ucontext.h @@ -16,7 +16,7 @@ extern void setmcontext(mcontext_t*); * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer + * notice, this list of conditions and the following disclaimer * in this position and unchanged. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the @@ -48,7 +48,7 @@ extern void setmcontext(mcontext_t*); * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer + * notice, this list of conditions and the following disclaimer * in this position and unchanged. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the @@ -117,5 +117,3 @@ struct ucontext { stack_t uc_stack; int __spare__[8]; }; - - diff --git a/src/libthread/BSD.c b/src/libthread/BSD.c index b9e8888e..737c0a63 100644 --- a/src/libthread/BSD.c +++ b/src/libthread/BSD.c @@ -288,7 +288,7 @@ threadexitsall(char *msg) if(msg == nil) msg = ""; - /* + /* * Only one guy, ever, gets to run this. * If two guys do it, inevitably they end up * tripping over each other in the underlying @@ -401,4 +401,3 @@ _threadpexit(void) { _exit(0); } - diff --git a/src/libthread/Darwin-386.c b/src/libthread/Darwin-386.c index 3ad1941c..b138e420 100644 --- a/src/libthread/Darwin-386.c +++ b/src/libthread/Darwin-386.c @@ -28,4 +28,3 @@ swapcontext(ucontext_t *oucp, ucontext_t *ucp) setcontext(ucp); return 0; } - diff --git a/src/libthread/Darwin-power.c b/src/libthread/Darwin-power.c index efcdb18c..3f2bf566 100644 --- a/src/libthread/Darwin-power.c +++ b/src/libthread/Darwin-power.c @@ -7,7 +7,7 @@ makecontext(ucontext_t *ucp, void (*func)(void), int argc, ...) va_list arg; tos = (ulong*)ucp->uc_stack.ss_sp+ucp->uc_stack.ss_size/sizeof(ulong); - sp = tos - 16; + sp = tos - 16; ucp->mc.pc = (long)func; ucp->mc.sp = (long)sp; va_start(arg, argc); @@ -22,4 +22,3 @@ swapcontext(ucontext_t *oucp, ucontext_t *ucp) setcontext(ucp); return 0; } - diff --git a/src/libthread/Darwin-x86_64-swapcontext.c b/src/libthread/Darwin-x86_64-swapcontext.c index 0593e481..27931456 100644 --- a/src/libthread/Darwin-x86_64-swapcontext.c +++ b/src/libthread/Darwin-x86_64-swapcontext.c @@ -28,5 +28,3 @@ swapcontext(ucontext_t *oucp, ucontext_t *ucp) setcontext(ucp); return 0; } - - diff --git a/src/libthread/Linux-arm-swapcontext.c b/src/libthread/Linux-arm-swapcontext.c index 907fb0c3..fc0dfdda 100644 --- a/src/libthread/Linux-arm-swapcontext.c +++ b/src/libthread/Linux-arm-swapcontext.c @@ -22,5 +22,3 @@ swapcontext(ucontext_t *oucp, const ucontext_t *ucp) setcontext(ucp); return 0; } - - diff --git a/src/libthread/Linux-sparc64-swapcontext.c b/src/libthread/Linux-sparc64-swapcontext.c index a621b7a1..e4800c19 100644 --- a/src/libthread/Linux-sparc64-swapcontext.c +++ b/src/libthread/Linux-sparc64-swapcontext.c @@ -47,4 +47,3 @@ __swapcontext_ret: \n\ clr %o0 \n\ .size __swapcontext_ret, .-__swapcontext_ret \n\ "); - diff --git a/src/libthread/Linux.c b/src/libthread/Linux.c index 17e8c12b..31577e87 100644 --- a/src/libthread/Linux.c +++ b/src/libthread/Linux.c @@ -6,13 +6,13 @@ static int timefmt(Fmt *fmt) { - static char *mon[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", + static char *mon[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; vlong ns; Tm tm; ns = nsec(); tm = *localtime(time(0)); - return fmtprint(fmt, "%s %2d %02d:%02d:%02d.%03d", + return fmtprint(fmt, "%s %2d %02d:%02d:%02d.%03d", mon[tm.mon], tm.mday, tm.hour, tm.min, tm.sec, (int)(ns%1000000000)/1000000); } @@ -246,8 +246,8 @@ startprocfn(void *v) /* * indirect through here so that parent need not wait for child zombie - * - * slight race - if child exits and then another process starts before we + * + * slight race - if child exits and then another process starts before we * manage to exit, we'll be running on a freed stack. */ static int @@ -314,7 +314,7 @@ threadexitsall(char *msg) if(msg == nil) msg = ""; - /* + /* * Only one guy, ever, gets to run this. * If two guys do it, inevitably they end up * tripping over each other in the underlying @@ -442,7 +442,7 @@ makecontext(ucontext_t *uc, void (*fn)(void), int argc, ...) { int i, *sp; va_list arg; - + sp = (int*)uc->uc_stack.ss_sp+uc->uc_stack.ss_size/4; va_start(arg, argc); for(i=0; i<4 && i= 0) threadexits("threadexecl"); } - diff --git a/src/libthread/ioproc.h b/src/libthread/ioproc.h index f3a488d3..831beade 100644 --- a/src/libthread/ioproc.h +++ b/src/libthread/ioproc.h @@ -11,4 +11,3 @@ struct Ioproc char err[ERRMAX]; Ioproc *next; }; - diff --git a/src/libthread/power-ucontext.h b/src/libthread/power-ucontext.h index 27ed3390..1985d98d 100644 --- a/src/libthread/power-ucontext.h +++ b/src/libthread/power-ucontext.h @@ -34,4 +34,3 @@ void makecontext(ucontext_t*, void(*)(void), int, ...); int swapcontext(ucontext_t*, ucontext_t*); int _getmcontext(mcontext_t*); void _setmcontext(mcontext_t*); - diff --git a/src/libthread/sparc-ucontext.h b/src/libthread/sparc-ucontext.h index 0031d2a4..36b88171 100644 --- a/src/libthread/sparc-ucontext.h +++ b/src/libthread/sparc-ucontext.h @@ -21,4 +21,3 @@ void makecontext(ucontext_t*, void(*)(void), int, ...); int swapcontext(ucontext_t*, ucontext_t*); int _getmcontext(mcontext_t*); void _setmcontext(mcontext_t*); - diff --git a/src/libthread/test/thello.c b/src/libthread/test/thello.c index c5732165..c237b7cd 100644 --- a/src/libthread/test/thello.c +++ b/src/libthread/test/thello.c @@ -7,4 +7,3 @@ threadmain(int argc, char **argv) { print("hello, world\n"); } - diff --git a/src/libthread/thread.c b/src/libthread/thread.c index 542a2437..cbad185c 100644 --- a/src/libthread/thread.c +++ b/src/libthread/thread.c @@ -137,7 +137,7 @@ threadalloc(void (*fn)(void*), void *arg, uint stack) t->context.uc.uc_stack.ss_size = t->stksize-64; #if defined(__sun__) && !defined(__MAKECONTEXT_V2_SOURCE) /* sigh */ /* can avoid this with __MAKECONTEXT_V2_SOURCE but only on SunOS 5.9 */ - t->context.uc.uc_stack.ss_sp = + t->context.uc.uc_stack.ss_sp = (char*)t->context.uc.uc_stack.ss_sp +t->context.uc.uc_stack.ss_size; #endif @@ -164,7 +164,7 @@ _threadcreate(Proc *p, void (*fn)(void*), void *arg, uint stack) /* defend against bad C libraries */ if(stack < (256<<10)) stack = 256<<10; - + t = threadalloc(fn, arg, stack); t->proc = p; addthreadinproc(p, t); @@ -228,7 +228,7 @@ threadidle(void) { int n; Proc *p; - + p = proc(); n = p->nswitch; lock(&p->lock); @@ -466,7 +466,7 @@ int threadid(void) { _Thread *t; - + t = proc()->thread; return t->id; } @@ -534,7 +534,7 @@ static void threadqunlock(QLock *l, ulong pc) { _Thread *ready; - + lock(&l->l); /*print("qlock unlock %p @%#x by %p (owner %p)\n", l, pc, (*threadnow)(), l->owner); */ if(l->owner == 0){ @@ -578,7 +578,7 @@ threadrlock(RWLock *l, int block, ulong pc) addthread(&l->rwaiting, (*threadnow)()); unlock(&l->l); _threadswitch(); - return 1; + return 1; } static int @@ -677,7 +677,7 @@ threadrwakeup(Rendez *r, int all, ulong pc) if((t = r->waiting.head) == nil) break; delthread(&r->waiting, t); - _threadready(t); + _threadready(t); } return i; } @@ -865,7 +865,7 @@ delproc(Proc *p) unlock(&_threadprocslock); } -/* +/* * notify - for now just use the usual mechanisms */ void @@ -901,14 +901,12 @@ threadinfo(void *v, char *s) fprint(2, "proc %p %s%s\n", (void*)p->osprocid, p->msg, p->sysproc ? " (sysproc)": ""); for(t=p->allthreads.head; t; t=t->allnext){ - fprint(2, "\tthread %d %s: %s %s\n", - t->id, - t == p->thread ? "Running" : + fprint(2, "\tthread %d %s: %s %s\n", + t->id, + t == p->thread ? "Running" : onrunqueue(p, t) ? "Ready" : "Sleeping", t->state, t->name); } } return 1; } - - diff --git a/src/libthread/threadimpl.h b/src/libthread/threadimpl.h index 144a2136..a8d52704 100644 --- a/src/libthread/threadimpl.h +++ b/src/libthread/threadimpl.h @@ -28,7 +28,7 @@ extern void makecontext(ucontext_t*, void(*)(), int, ...); /* * OS X before 10.5 (Leopard) does not provide * swapcontext nor makecontext, so we have to use our own. - * In theory, Leopard does provide them, but when we use + * In theory, Leopard does provide them, but when we use * them, they seg fault. Maybe we're using them wrong. * So just use our own versions, even on Leopard. */ diff --git a/src/libthread/wait.c b/src/libthread/wait.c index 24538e58..ba2301f5 100644 --- a/src/libthread/wait.c +++ b/src/libthread/wait.c @@ -29,11 +29,11 @@ procwait(int pid) Waiter me; Waitmsg *msg; int i; - + memset(&me, 0, sizeof me); me.pid = pid; me.r.l = &waiting.lk; - + qlock(&waiting.lk); for(i=0; ipid == pid){ diff --git a/src/libthread/x86_64-ucontext.h b/src/libthread/x86_64-ucontext.h index 08c6d9a8..e0640761 100644 --- a/src/libthread/x86_64-ucontext.h +++ b/src/libthread/x86_64-ucontext.h @@ -40,4 +40,3 @@ void makecontext(ucontext_t*, void(*)(void), int, ...); int swapcontext(ucontext_t*, ucontext_t*); int libthread_getmcontext(mcontext_t*); void libthread_setmcontext(mcontext_t*); - -- cgit v1.2.3