remove trailing spaces

This commit is contained in:
David du Colombier 2014-08-03 18:28:37 +02:00
parent cf7e56655b
commit cbb722db29
11 changed files with 35 additions and 35 deletions

6
asm.S
View File

@ -131,7 +131,7 @@ GET:
movq %rcx, 160(%rdi) movq %rcx, 160(%rdi)
leaq 8(%rsp), %rcx /* %rsp */ leaq 8(%rsp), %rcx /* %rsp */
movq %rcx, 184(%rdi) movq %rcx, 184(%rdi)
movq 32(%rdi), %rcx /* restore %rcx */ movq 32(%rdi), %rcx /* restore %rcx */
movq $0, %rax movq $0, %rax
ret ret
@ -305,14 +305,14 @@ SET:
lw $28, 120($4) /* gp */ lw $28, 120($4) /* gp */
lw $29, 124($4) /* sp */ lw $29, 124($4) /* sp */
lw $30, 128($4) /* fp */ lw $30, 128($4) /* fp */
/* /*
* If we set $31 directly and j $31, * If we set $31 directly and j $31,
* we would loose the outer return address. * we would loose the outer return address.
* Use a temporary register, then. * Use a temporary register, then.
*/ */
lw $8, 132($4) /* ra */ lw $8, 132($4) /* ra */
/* bug: not setting the pc causes a bus error */ /* bug: not setting the pc causes a bus error */
lw $25, 132($4) /* pc */ lw $25, 132($4) /* pc */

View File

@ -43,7 +43,7 @@ makecontext(ucontext_t *ucp, void (*func)(void), int argc, ...)
va_list arg; va_list arg;
tos = (ulong*)ucp->uc_stack.ss_sp+ucp->uc_stack.ss_size/sizeof(ulong); 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.pc = (long)func;
ucp->mc.sp = (long)sp; ucp->mc.sp = (long)sp;
va_start(arg, argc); va_start(arg, argc);
@ -98,7 +98,7 @@ makecontext(ucontext_t *uc, void (*fn)(void), int argc, ...)
{ {
int i, *sp; int i, *sp;
va_list arg; va_list arg;
sp = (int*)uc->uc_stack.ss_sp+uc->uc_stack.ss_size/4; sp = (int*)uc->uc_stack.ss_sp+uc->uc_stack.ss_size/4;
va_start(arg, argc); va_start(arg, argc);
for(i=0; i<4 && i<argc; i++) for(i=0; i<4 && i<argc; i++)
@ -115,7 +115,7 @@ makecontext(ucontext_t *uc, void (*fn)(void), int argc, ...)
{ {
int i, *sp; int i, *sp;
va_list arg; va_list arg;
va_start(arg, argc); va_start(arg, argc);
sp = (int*)uc->uc_stack.ss_sp+uc->uc_stack.ss_size/4; sp = (int*)uc->uc_stack.ss_sp+uc->uc_stack.ss_size/4;
for(i=0; i<4 && i<argc; i++) for(i=0; i<4 && i<argc; i++)

12
fd.c
View File

@ -143,7 +143,7 @@ taskdelay(uint ms)
{ {
uvlong when, now; uvlong when, now;
Task *t; Task *t;
if(!startedfdtask){ if(!startedfdtask){
startedfdtask = 1; startedfdtask = 1;
#if USE_EPOLL #if USE_EPOLL
@ -166,7 +166,7 @@ taskdelay(uint ms)
taskrunning->prev = sleeping.tail; taskrunning->prev = sleeping.tail;
taskrunning->next = nil; taskrunning->next = nil;
} }
t = taskrunning; t = taskrunning;
t->alarmtime = when; t->alarmtime = when;
if(t->prev) if(t->prev)
@ -246,7 +246,7 @@ fdwait(int fd, int rw)
fprint(2, "too many poll file descriptors\n"); fprint(2, "too many poll file descriptors\n");
abort(); abort();
} }
taskstate("fdwait for %s", rw=='r' ? "read" : rw=='w' ? "write" : "error"); taskstate("fdwait for %s", rw=='r' ? "read" : rw=='w' ? "write" : "error");
bits = 0; bits = 0;
switch(rw){ switch(rw){
@ -273,7 +273,7 @@ int
fdread1(int fd, void *buf, int n) fdread1(int fd, void *buf, int n)
{ {
int m; int m;
do do
fdwait(fd, 'r'); fdwait(fd, 'r');
while((m = read(fd, buf, n)) < 0 && errno == EAGAIN); while((m = read(fd, buf, n)) < 0 && errno == EAGAIN);
@ -284,7 +284,7 @@ int
fdread(int fd, void *buf, int n) fdread(int fd, void *buf, int n)
{ {
int m; int m;
while((m=read(fd, buf, n)) < 0 && errno == EAGAIN) while((m=read(fd, buf, n)) < 0 && errno == EAGAIN)
fdwait(fd, 'r'); fdwait(fd, 'r');
return m; return m;
@ -294,7 +294,7 @@ int
fdwrite(int fd, void *buf, int n) fdwrite(int fd, void *buf, int n)
{ {
int m, tot; int m, tot;
for(tot=0; tot<n; tot+=m){ for(tot=0; tot<n; tot+=m){
while((m=write(fd, (char*)buf+tot, n-tot)) < 0 && errno == EAGAIN) while((m=write(fd, (char*)buf+tot, n-tot)) < 0 && errno == EAGAIN)
fdwait(fd, 'w'); fdwait(fd, 'w');

View File

@ -19,7 +19,7 @@ void
taskmain(int argc, char **argv) taskmain(int argc, char **argv)
{ {
int i, n; int i, n;
if(argc != 4){ if(argc != 4){
fprintf(stderr, "usage: httpload n server url\n"); fprintf(stderr, "usage: httpload n server url\n");
taskexitall(1); taskexitall(1);
@ -41,7 +41,7 @@ fetchtask(void *v)
{ {
int fd, n; int fd, n;
char buf[512]; char buf[512];
fprintf(stderr, "starting...\n"); fprintf(stderr, "starting...\n");
for(;;){ for(;;){
if((fd = netdial(TCP, server, 80)) < 0){ if((fd = netdial(TCP, server, 80)) < 0){

16
net.c
View File

@ -57,7 +57,7 @@ netannounce(int istcp, char *server, int port)
taskstate("socket failed"); taskstate("socket failed");
return -1; return -1;
} }
/* set reuse flag for tcp */ /* set reuse flag for tcp */
sn = sizeof n; sn = sizeof n;
if(istcp && getsockopt(fd, SOL_SOCKET, SO_TYPE, (void*)&n, &sn) >= 0){ if(istcp && getsockopt(fd, SOL_SOCKET, SO_TYPE, (void*)&n, &sn) >= 0){
@ -85,7 +85,7 @@ netaccept(int fd, char *server, int *port)
int cfd, one; int cfd, one;
struct sockaddr_storage ss; struct sockaddr_storage ss;
socklen_t len; socklen_t len;
fdwait(fd, 'r'); fdwait(fd, 'r');
taskstate("netaccept"); taskstate("netaccept");
@ -124,7 +124,7 @@ netlookup(char *name, unsigned char *ip)
if(parseip(ip, name) == 0) if(parseip(ip, name) == 0)
return 0; return 0;
/* BUG - Name resolution blocks. Need a non-blocking DNS. */ /* BUG - Name resolution blocks. Need a non-blocking DNS. */
taskstate("netlookup"); taskstate("netlookup");
if((he = gethostbyname(name)) != 0){ if((he = gethostbyname(name)) != 0){
@ -143,7 +143,7 @@ netlookup(char *name, unsigned char *ip)
taskstate("netlookup succeeded"); taskstate("netlookup succeeded");
return 0; return 0;
} }
taskstate("netlookup failed"); taskstate("netlookup failed");
return -1; return -1;
} }
@ -155,7 +155,7 @@ netdial(int istcp, char *server, int port)
unsigned char ip[IPaddrlen]; unsigned char ip[IPaddrlen];
struct sockaddr_storage ss; struct sockaddr_storage ss;
socklen_t sn; socklen_t sn;
if(netlookup(server, ip) < 0) if(netlookup(server, ip) < 0)
return -1; return -1;
@ -172,7 +172,7 @@ netdial(int istcp, char *server, int port)
n = 1; n = 1;
setsockopt(fd, SOL_SOCKET, SO_BROADCAST, &n, sizeof n); setsockopt(fd, SOL_SOCKET, SO_BROADCAST, &n, sizeof n);
} }
/* start connecting */ /* start connecting */
memset(&ss, 0, sizeof ss); memset(&ss, 0, sizeof ss);
ss.ss_family = family(ip); ss.ss_family = family(ip);
@ -193,14 +193,14 @@ netdial(int istcp, char *server, int port)
return -1; return -1;
} }
/* wait for finish */ /* wait for finish */
fdwait(fd, 'w'); fdwait(fd, 'w');
sn = sizeof ss; sn = sizeof ss;
if(getpeername(fd, (struct sockaddr*)&ss, &sn) >= 0){ if(getpeername(fd, (struct sockaddr*)&ss, &sn) >= 0){
taskstate("connect succeeded"); taskstate("connect succeeded");
return fd; return fd;
} }
/* report error */ /* report error */
sn = sizeof n; sn = sizeof n;
getsockopt(fd, SOL_SOCKET, SO_ERROR, (void*)&n, &sn); getsockopt(fd, SOL_SOCKET, SO_ERROR, (void*)&n, &sn);

10
print.c
View File

@ -45,7 +45,7 @@ printstr(char *dst, char *edst, char *s, int size)
} }
return dst+n; return dst+n;
} }
char* char*
vseprint(char *dst, char *edst, char *fmt, va_list arg) vseprint(char *dst, char *edst, char *fmt, va_list arg)
{ {
@ -105,7 +105,7 @@ vseprint(char *dst, char *edst, char *fmt, va_list arg)
char buf[30], *p; char buf[30], *p;
int zero; int zero;
uvlong luv; uvlong luv;
if(fl&FlagLongLong){ if(fl&FlagLongLong){
if(fl&FlagUnsigned) if(fl&FlagUnsigned)
luv = va_arg(arg, uvlong); luv = va_arg(arg, uvlong);
@ -124,7 +124,7 @@ vseprint(char *dst, char *edst, char *fmt, va_list arg)
luv = va_arg(arg, int); luv = va_arg(arg, int);
} }
} }
p = buf+sizeof buf; p = buf+sizeof buf;
zero = 0; zero = 0;
if(!(fl&FlagUnsigned) && (vlong)luv < 0){ if(!(fl&FlagUnsigned) && (vlong)luv < 0){
@ -157,7 +157,7 @@ vseprint(char *dst, char *edst, char *fmt, va_list arg)
case 'r': case 'r':
w = printstr(w, edst, strerror(errno), size*sign); w = printstr(w, edst, strerror(errno), size*sign);
goto break2; goto break2;
default: default:
p = "X*verb*"; p = "X*verb*";
goto break2; goto break2;
} }
@ -166,7 +166,7 @@ vseprint(char *dst, char *edst, char *fmt, va_list arg)
break; break;
} }
} }
assert(w < edst); assert(w < edst);
*w = 0; *w = 0;
return dst; return dst;

View File

@ -38,7 +38,7 @@ void
qunlock(QLock *l) qunlock(QLock *l)
{ {
Task *ready; Task *ready;
if(l->owner == 0){ if(l->owner == 0){
fprint(2, "qunlock: owner=0\n"); fprint(2, "qunlock: owner=0\n");
abort(); abort();
@ -119,7 +119,7 @@ void
wunlock(RWLock *l) wunlock(RWLock *l)
{ {
Task *t; Task *t;
if(l->writer == nil){ if(l->writer == nil){
fprint(2, "wunlock: not locked\n"); fprint(2, "wunlock: not locked\n");
abort(); abort();

2
task.c
View File

@ -182,7 +182,7 @@ int
taskyield(void) taskyield(void)
{ {
int n; int n;
n = tasknswitch; n = tasknswitch;
taskready(taskrunning); taskready(taskrunning);
taskstate("yield"); taskstate("yield");

View File

@ -108,7 +108,7 @@ extern void makecontext(ucontext_t*, void(*)(), int, ...);
# include "amd64-ucontext.h" # include "amd64-ucontext.h"
# else # else
# include "power-ucontext.h" # include "power-ucontext.h"
# endif # endif
#endif #endif
#if defined(__OpenBSD__) #if defined(__OpenBSD__)

View File

@ -22,7 +22,7 @@ int*
mkfd2(int fd1, int fd2) mkfd2(int fd1, int fd2)
{ {
int *a; int *a;
a = malloc(2*sizeof a[0]); a = malloc(2*sizeof a[0]);
if(a == 0){ if(a == 0){
fprintf(stderr, "out of memory\n"); fprintf(stderr, "out of memory\n");
@ -39,7 +39,7 @@ taskmain(int argc, char **argv)
int cfd, fd; int cfd, fd;
int rport; int rport;
char remote[46]; char remote[46];
if(argc != 4){ if(argc != 4){
fprintf(stderr, "usage: tcpproxy localport server remoteport\n"); fprintf(stderr, "usage: tcpproxy localport server remoteport\n");
taskexitall(1); taskexitall(1);
@ -87,7 +87,7 @@ rwtask(void *v)
rfd = a[0]; rfd = a[0];
wfd = a[1]; wfd = a[1];
free(a); free(a);
while((n = fdread(rfd, buf, sizeof buf)) > 0) while((n = fdread(rfd, buf, sizeof buf)) > 0)
fdwrite(wfd, buf, n); fdwrite(wfd, buf, n);
shutdown(wfd, SHUT_WR); shutdown(wfd, SHUT_WR);

View File

@ -21,7 +21,7 @@ void
taskmain(int argc, char **argv) taskmain(int argc, char **argv)
{ {
int i, n; int i, n;
c = chancreate(sizeof(unsigned long), 0); c = chancreate(sizeof(unsigned long), 0);
n = 0; n = 0;