mirror of
https://github.com/0intro/libtask
synced 2024-11-21 21:31:30 +03:00
remove trailing spaces
This commit is contained in:
parent
cf7e56655b
commit
cbb722db29
6
asm.S
6
asm.S
@ -131,7 +131,7 @@ GET:
|
||||
movq %rcx, 160(%rdi)
|
||||
leaq 8(%rsp), %rcx /* %rsp */
|
||||
movq %rcx, 184(%rdi)
|
||||
|
||||
|
||||
movq 32(%rdi), %rcx /* restore %rcx */
|
||||
movq $0, %rax
|
||||
ret
|
||||
@ -305,14 +305,14 @@ SET:
|
||||
lw $28, 120($4) /* gp */
|
||||
lw $29, 124($4) /* sp */
|
||||
lw $30, 128($4) /* fp */
|
||||
|
||||
|
||||
/*
|
||||
* If we set $31 directly and j $31,
|
||||
* we would loose the outer return address.
|
||||
* Use a temporary register, then.
|
||||
*/
|
||||
lw $8, 132($4) /* ra */
|
||||
|
||||
|
||||
/* bug: not setting the pc causes a bus error */
|
||||
lw $25, 132($4) /* pc */
|
||||
|
||||
|
@ -43,7 +43,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);
|
||||
@ -98,7 +98,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<argc; i++)
|
||||
@ -115,7 +115,7 @@ makecontext(ucontext_t *uc, void (*fn)(void), int argc, ...)
|
||||
{
|
||||
int i, *sp;
|
||||
va_list arg;
|
||||
|
||||
|
||||
va_start(arg, argc);
|
||||
sp = (int*)uc->uc_stack.ss_sp+uc->uc_stack.ss_size/4;
|
||||
for(i=0; i<4 && i<argc; i++)
|
||||
|
12
fd.c
12
fd.c
@ -143,7 +143,7 @@ taskdelay(uint ms)
|
||||
{
|
||||
uvlong when, now;
|
||||
Task *t;
|
||||
|
||||
|
||||
if(!startedfdtask){
|
||||
startedfdtask = 1;
|
||||
#if USE_EPOLL
|
||||
@ -166,7 +166,7 @@ taskdelay(uint ms)
|
||||
taskrunning->prev = sleeping.tail;
|
||||
taskrunning->next = nil;
|
||||
}
|
||||
|
||||
|
||||
t = taskrunning;
|
||||
t->alarmtime = when;
|
||||
if(t->prev)
|
||||
@ -246,7 +246,7 @@ fdwait(int fd, int rw)
|
||||
fprint(2, "too many poll file descriptors\n");
|
||||
abort();
|
||||
}
|
||||
|
||||
|
||||
taskstate("fdwait for %s", rw=='r' ? "read" : rw=='w' ? "write" : "error");
|
||||
bits = 0;
|
||||
switch(rw){
|
||||
@ -273,7 +273,7 @@ int
|
||||
fdread1(int fd, void *buf, int n)
|
||||
{
|
||||
int m;
|
||||
|
||||
|
||||
do
|
||||
fdwait(fd, 'r');
|
||||
while((m = read(fd, buf, n)) < 0 && errno == EAGAIN);
|
||||
@ -284,7 +284,7 @@ int
|
||||
fdread(int fd, void *buf, int n)
|
||||
{
|
||||
int m;
|
||||
|
||||
|
||||
while((m=read(fd, buf, n)) < 0 && errno == EAGAIN)
|
||||
fdwait(fd, 'r');
|
||||
return m;
|
||||
@ -294,7 +294,7 @@ int
|
||||
fdwrite(int fd, void *buf, int n)
|
||||
{
|
||||
int m, tot;
|
||||
|
||||
|
||||
for(tot=0; tot<n; tot+=m){
|
||||
while((m=write(fd, (char*)buf+tot, n-tot)) < 0 && errno == EAGAIN)
|
||||
fdwait(fd, 'w');
|
||||
|
@ -19,7 +19,7 @@ void
|
||||
taskmain(int argc, char **argv)
|
||||
{
|
||||
int i, n;
|
||||
|
||||
|
||||
if(argc != 4){
|
||||
fprintf(stderr, "usage: httpload n server url\n");
|
||||
taskexitall(1);
|
||||
@ -41,7 +41,7 @@ fetchtask(void *v)
|
||||
{
|
||||
int fd, n;
|
||||
char buf[512];
|
||||
|
||||
|
||||
fprintf(stderr, "starting...\n");
|
||||
for(;;){
|
||||
if((fd = netdial(TCP, server, 80)) < 0){
|
||||
|
16
net.c
16
net.c
@ -57,7 +57,7 @@ netannounce(int istcp, char *server, int port)
|
||||
taskstate("socket failed");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
/* set reuse flag for tcp */
|
||||
sn = sizeof n;
|
||||
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;
|
||||
struct sockaddr_storage ss;
|
||||
socklen_t len;
|
||||
|
||||
|
||||
fdwait(fd, 'r');
|
||||
|
||||
taskstate("netaccept");
|
||||
@ -124,7 +124,7 @@ netlookup(char *name, unsigned char *ip)
|
||||
|
||||
if(parseip(ip, name) == 0)
|
||||
return 0;
|
||||
|
||||
|
||||
/* BUG - Name resolution blocks. Need a non-blocking DNS. */
|
||||
taskstate("netlookup");
|
||||
if((he = gethostbyname(name)) != 0){
|
||||
@ -143,7 +143,7 @@ netlookup(char *name, unsigned char *ip)
|
||||
taskstate("netlookup succeeded");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
taskstate("netlookup failed");
|
||||
return -1;
|
||||
}
|
||||
@ -155,7 +155,7 @@ netdial(int istcp, char *server, int port)
|
||||
unsigned char ip[IPaddrlen];
|
||||
struct sockaddr_storage ss;
|
||||
socklen_t sn;
|
||||
|
||||
|
||||
if(netlookup(server, ip) < 0)
|
||||
return -1;
|
||||
|
||||
@ -172,7 +172,7 @@ netdial(int istcp, char *server, int port)
|
||||
n = 1;
|
||||
setsockopt(fd, SOL_SOCKET, SO_BROADCAST, &n, sizeof n);
|
||||
}
|
||||
|
||||
|
||||
/* start connecting */
|
||||
memset(&ss, 0, sizeof ss);
|
||||
ss.ss_family = family(ip);
|
||||
@ -193,14 +193,14 @@ netdial(int istcp, char *server, int port)
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* wait for finish */
|
||||
/* wait for finish */
|
||||
fdwait(fd, 'w');
|
||||
sn = sizeof ss;
|
||||
if(getpeername(fd, (struct sockaddr*)&ss, &sn) >= 0){
|
||||
taskstate("connect succeeded");
|
||||
return fd;
|
||||
}
|
||||
|
||||
|
||||
/* report error */
|
||||
sn = sizeof n;
|
||||
getsockopt(fd, SOL_SOCKET, SO_ERROR, (void*)&n, &sn);
|
||||
|
10
print.c
10
print.c
@ -45,7 +45,7 @@ printstr(char *dst, char *edst, char *s, int size)
|
||||
}
|
||||
return dst+n;
|
||||
}
|
||||
|
||||
|
||||
char*
|
||||
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;
|
||||
int zero;
|
||||
uvlong luv;
|
||||
|
||||
|
||||
if(fl&FlagLongLong){
|
||||
if(fl&FlagUnsigned)
|
||||
luv = va_arg(arg, uvlong);
|
||||
@ -124,7 +124,7 @@ vseprint(char *dst, char *edst, char *fmt, va_list arg)
|
||||
luv = va_arg(arg, int);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
p = buf+sizeof buf;
|
||||
zero = 0;
|
||||
if(!(fl&FlagUnsigned) && (vlong)luv < 0){
|
||||
@ -157,7 +157,7 @@ vseprint(char *dst, char *edst, char *fmt, va_list arg)
|
||||
case 'r':
|
||||
w = printstr(w, edst, strerror(errno), size*sign);
|
||||
goto break2;
|
||||
default:
|
||||
default:
|
||||
p = "X*verb*";
|
||||
goto break2;
|
||||
}
|
||||
@ -166,7 +166,7 @@ vseprint(char *dst, char *edst, char *fmt, va_list arg)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
assert(w < edst);
|
||||
*w = 0;
|
||||
return dst;
|
||||
|
4
qlock.c
4
qlock.c
@ -38,7 +38,7 @@ void
|
||||
qunlock(QLock *l)
|
||||
{
|
||||
Task *ready;
|
||||
|
||||
|
||||
if(l->owner == 0){
|
||||
fprint(2, "qunlock: owner=0\n");
|
||||
abort();
|
||||
@ -119,7 +119,7 @@ void
|
||||
wunlock(RWLock *l)
|
||||
{
|
||||
Task *t;
|
||||
|
||||
|
||||
if(l->writer == nil){
|
||||
fprint(2, "wunlock: not locked\n");
|
||||
abort();
|
||||
|
2
task.c
2
task.c
@ -182,7 +182,7 @@ int
|
||||
taskyield(void)
|
||||
{
|
||||
int n;
|
||||
|
||||
|
||||
n = tasknswitch;
|
||||
taskready(taskrunning);
|
||||
taskstate("yield");
|
||||
|
@ -108,7 +108,7 @@ extern void makecontext(ucontext_t*, void(*)(), int, ...);
|
||||
# include "amd64-ucontext.h"
|
||||
# else
|
||||
# include "power-ucontext.h"
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(__OpenBSD__)
|
||||
|
@ -22,7 +22,7 @@ int*
|
||||
mkfd2(int fd1, int fd2)
|
||||
{
|
||||
int *a;
|
||||
|
||||
|
||||
a = malloc(2*sizeof a[0]);
|
||||
if(a == 0){
|
||||
fprintf(stderr, "out of memory\n");
|
||||
@ -39,7 +39,7 @@ taskmain(int argc, char **argv)
|
||||
int cfd, fd;
|
||||
int rport;
|
||||
char remote[46];
|
||||
|
||||
|
||||
if(argc != 4){
|
||||
fprintf(stderr, "usage: tcpproxy localport server remoteport\n");
|
||||
taskexitall(1);
|
||||
@ -87,7 +87,7 @@ rwtask(void *v)
|
||||
rfd = a[0];
|
||||
wfd = a[1];
|
||||
free(a);
|
||||
|
||||
|
||||
while((n = fdread(rfd, buf, sizeof buf)) > 0)
|
||||
fdwrite(wfd, buf, n);
|
||||
shutdown(wfd, SHUT_WR);
|
||||
|
@ -21,7 +21,7 @@ void
|
||||
taskmain(int argc, char **argv)
|
||||
{
|
||||
int i, n;
|
||||
|
||||
|
||||
c = chancreate(sizeof(unsigned long), 0);
|
||||
|
||||
n = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user