cleanups spotted by irix cc

This commit is contained in:
Russ Cox
2005-12-29 23:15:58 +00:00
parent 3c84c725ef
commit 21b830b1ac
8 changed files with 22 additions and 42 deletions

View File

@ -72,7 +72,7 @@ so_connect(int fd, unsigned long raddr, unsigned short rport)
void
so_getsockname(int fd, unsigned long *laddr, unsigned short *lport)
{
uint len;
socklen_t len;
struct sockaddr_in sin;
len = sizeof(sin);
@ -97,7 +97,7 @@ int
so_accept(int fd, unsigned long *raddr, unsigned short *rport)
{
int nfd;
uint len;
socklen_t len;
struct sockaddr_in sin;
len = sizeof(sin);

View File

@ -126,6 +126,7 @@ tramp(void *vp)
/* BUG: leaks Proc */
pthread_setspecific(prdakey, 0);
pthread_exit(0);
return 0;
}
void
@ -161,20 +162,32 @@ int randfd;
void
randominit(void)
{
#ifdef USE_RANDOM
srandom(getpid()+fastticks(nil)+ticks());
#else
if((randfd = open("/dev/urandom", OREAD)) < 0)
if((randfd = open("/dev/random", OREAD)) < 0)
panic("open /dev/random: %r");
#endif
}
#undef read
ulong
randomread(void *v, ulong n)
{
#ifdef USE_RANDOM
int i;
for(i=0; i<n; i++)
((uchar*)v)[i] = random();
return n;
#else
int m;
if((m = read(randfd, v, n)) != n)
panic("short read from /dev/random: %d but %d", n, m);
return m;
#endif
}
#undef time

View File

@ -1159,7 +1159,6 @@ long
qbwrite(Queue *q, Block *b)
{
int n, dowakeup;
Proc *p;
n = BLEN(b);
@ -1222,10 +1221,11 @@ qbwrite(Queue *q, Block *b)
/* wakeup anyone consuming at the other end */
if(dowakeup){
p = wakeup(&q->rr);
wakeup(&q->rr);
/* if we just wokeup a higher priority process, let it run */
/*
p = wakeup(&q->rr);
if(p != nil && p->priority > up->priority)
sched();
*/

View File

@ -27,10 +27,9 @@ extern Memimage *gscreen;
static Rectangle flushr;
static Rectangle window;
static Point curpos;
static int h, w;
static int h;
static void termscreenputs(char*, int);
Point ZP;
static void
screenflush(void)
@ -51,7 +50,7 @@ addflush(Rectangle r)
static void
screenwin(void)
{
Point p, q;
Point p;
char *greet;
Memimage *grey;
@ -60,7 +59,6 @@ screenwin(void)
conscol = memblack;
memfillcolor(gscreen, 0x444488FF);
w = memdefont->info[' '].width;
h = memdefont->height;
window.min = addpt(gscreen->r.min, Pt(20,20));
@ -83,7 +81,6 @@ screenwin(void)
greet = " Plan 9 Console ";
p = addpt(window.min, Pt(10, 0));
q = memsubfontwidth(memdefont, greet);
memimagestring(gscreen, p, conscol, ZP, memdefont, greet);
window.min.y += h+6;
curpos = window.min;