M alphapc/mem.h => alphapc/mem.h +0 -1
@@ 29,7 29,6 @@
#define HZ 100 /* clock frequency */
#define MS2HZ (1000/HZ)
#define TK2SEC(t) ((t)/HZ) /* ticks to seconds */
-#define MS2TK(t) (((t)*HZ+500)/1000) /* milliseconds to closest tick */
/*
* Magic registers
M bitsy/mem.h => bitsy/mem.h +0 -1
@@ 24,7 24,6 @@
#define HZ (20) /* clock frequency */
#define MS2HZ (1000/HZ) /* millisec per clock tick */
#define TK2SEC(t) ((t)/HZ) /* ticks to seconds */
-#define MS2TK(t) ((((ulong)(t))*HZ)/1000) /* milliseconds to ticks */
/*
* Virtual addresses:
M mtx/mem.h => mtx/mem.h +0 -1
@@ 35,7 35,6 @@
#define MS2HZ (1000/HZ)
#define TK2SEC(t) ((t)/HZ) /* ticks to seconds */
#define TK2MS(t) ((t)*MS2HZ) /* ticks to milliseconds */
-#define MS2TK(t) (((t)*HZ+500)/1000) /* milliseconds to closest tick */
/*
* Standard PPC Special Purpose Registers (OEA and VEA)
M pc/mem.h => pc/mem.h +0 -1
@@ 25,7 25,6 @@
#define HZ (100) /* clock frequency */
#define MS2HZ (1000/HZ) /* millisec per clock tick */
#define TK2SEC(t) ((t)/HZ) /* ticks to seconds */
-#define MS2TK(t) (((t)*HZ+500)/1000) /* milliseconds to closest tick */
/*
* Fundamental addresses
M port/alarm.c => port/alarm.c +1 -1
@@ 89,7 89,7 @@ procalarm(ulong time)
up->alarm = 0;
return old;
}
- when = MS2TK(time)+MACHP(0)->ticks;
+ when = ms2tk(time)+MACHP(0)->ticks;
qlock(&alarms);
l = &alarms.head;
M port/devsdp.c => port/devsdp.c +9 -9
@@ 955,7 955,7 @@ static void
convsetstate(Conv *c, int state)
{
-if(1)print("convsetstate %d: %s -> %s\n", c->id, convstatename[c->state], convstatename[state]);
+if(0)print("convsetstate %d: %s -> %s\n", c->id, convstatename[c->state], convstatename[state]);
switch(state) {
default:
@@ 1224,14 1224,14 @@ conviput(Conv *c, Block *b, int control)
if(seqdiff <= 0) {
if(seqdiff <= -SeqWindow) {
-print("old sequence number: %ld (%ld %ld)\n", seq, c->in.seqwrap, seqdiff);
+if(0)print("old sequence number: %ld (%ld %ld)\n", seq, c->in.seqwrap, seqdiff);
c->lstats.inBadSeq++;
freeb(b);
return nil;
}
if(c->in.window & (1<<-seqdiff)) {
-print("dup sequence number: %ld (%ld %ld)\n", seq, c->in.seqwrap, seqdiff);
+if(0)print("dup sequence number: %ld (%ld %ld)\n", seq, c->in.seqwrap, seqdiff);
c->lstats.inDup++;
freeb(b);
return nil;
@@ 1244,7 1244,7 @@ print("dup sequence number: %ld (%ld %ld)\n", seq, c->in.seqwrap, seqdiff);
if(0) print("coniput seq=%ulx\n", seq);
if(c->in.auth != 0) {
if(!(*c->in.auth)(&c->in, b->rp-4, BLEN(b)+4)) {
-print("bad auth %ld\n", BLEN(b)+4);
+if(0)print("bad auth %ld\n", BLEN(b)+4);
c->lstats.inBadAuth++;
freeb(b);
return nil;
@@ 1254,7 1254,7 @@ print("bad auth %ld\n", BLEN(b)+4);
if(c->in.cipher != 0) {
if(!(*c->in.cipher)(&c->in, b->rp, BLEN(b))) {
-print("bad cipher\n");
+if(0)print("bad cipher\n");
c->lstats.inBadOther++;
freeb(b);
return nil;
@@ 1263,7 1263,7 @@ print("bad cipher\n");
if(c->in.cipherblklen > 1) {
pad = b->wp[-1];
if(pad > BLEN(b)) {
-print("pad too big\n");
+if(0)print("pad too big\n");
c->lstats.inBadOther++;
freeb(b);
return nil;
@@ 1314,7 1314,7 @@ print("pad too big\n");
break;
return b;
}
-print("dropping packet id=%d: type=%d n=%ld control=%d\n", c->id, type, BLEN(b), control);
+if(0)print("dropping packet id=%d: type=%d n=%ld control=%d\n", c->id, type, BLEN(b), control);
c->lstats.inBadOther++;
freeb(b);
return nil;
@@ 1441,7 1441,7 @@ convicontrol(Conv *c, int subtype, Block *b)
switch(subtype){
case ControlMesg:
if(cseq == c->in.controlseq) {
-print("duplicate control packet: %ulx\n", cseq);
+if(0)print("duplicate control packet: %ulx\n", cseq);
// duplicate control packet
freeb(b);
if(c->in.controlpkt == nil)
@@ 2285,7 2285,7 @@ thwackuncomp(Conv *c, int subtype, ulong seq, Block **bp)
n = unthwack(c->in.compstate, b->wp, ThwMaxBlock, bb->rp, BLEN(bb), seq);
freeb(bb);
if(n < 0) {
-print("unthwack failed: %d\n", n);
+if(0)print("unthwack failed: %d\n", n);
freeb(b);
return 0;
}
M port/portfns.h => port/portfns.h +1 -0
@@ 171,6 171,7 @@ Chan* mntauth(Chan*, char*);
void mntdump(void);
long mntversion(Chan*, char*, int, int);
void mountfree(Mount*);
+ulong ms2tk(ulong);
ulong msize(void*);
void muxclose(Mnt*);
Chan* namec(char*, int, int, ulong);
M port/proc.c => port/proc.c +10 -6
@@ 507,18 507,22 @@ tfn(void *arg)
return MACHP(0)->ticks >= up->twhen || up->tfn(arg);
}
+ulong
+ms2tk(ulong ms)
+{
+ /* avoid overflows at the cost of precision */
+ if(ms >= 1000000000/HZ)
+ return (ms/1000)*HZ;
+ return (ms+500)*HZ/1000;
+}
+
void
tsleep(Rendez *r, int (*fn)(void*), void *arg, int ms)
{
ulong when;
Proc *f, **l;
- /* avoid overflows at the cost of precision */
- if(ms >= 1000000)
- when = ms/(1000/HZ);
- else
- when = MS2TK(ms);
- when += MACHP(0)->ticks;
+ when = ms2tk(ms) + MACHP(0)->ticks;
lock(&talarm);
/* take out of list if checkalarm didn't */