From d6063103d6405c54dea81cc19633b48d7619418e Mon Sep 17 00:00:00 2001 From: Oliver Lehmann Date: Fri, 30 May 2008 19:56:26 +0000 Subject: [PATCH] STATUS: 83% 0000 T _bmap not compatible 0274 T _passc compatible 0306 T _cpass compatible 03a2 T _nodev compatible 03ac T _nulldev compatible 03ae T _timeout compatible --- WEGA/src/uts/sys/subr.c | 88 +++++++++++++++++++++++++---------------- 1 file changed, 53 insertions(+), 35 deletions(-) diff --git a/WEGA/src/uts/sys/subr.c b/WEGA/src/uts/sys/subr.c index b796fce..be568ad 100644 --- a/WEGA/src/uts/sys/subr.c +++ b/WEGA/src/uts/sys/subr.c @@ -139,6 +139,37 @@ daddr_t bn; return(nb); } +/* + * Pass back c to the user at his location u_base; + * update u_base, u_count, and u_offset. Return -1 + * on the last character of the user's read. + * u_base is in the user address space unless u_segflg is set. + */ +passc(c) +register char c; +{ + if(u.u_segflg == 1) { + *u.u_base.l = c; + } else { + if(!u.u_segflg || u.u_segmented) { + if(subyte(u.u_base.l,c)) { + u.u_error = EFAULT; + return(-1); + } + } else { + if(suibyte(u.u_base.right,c)) { + u.u_error = EFAULT; + return(-1); + } + } + } + + u.u_count--; + u.u_offset++; + u.u_base.l++; + return(u.u_count == 0? -1: 0); +} + /* * Pick up and return the next character from the user's * write call at location u_base; @@ -148,20 +179,30 @@ daddr_t bn; */ cpass() { - register c, id; + char c; - if(u.u_count == 0) + if(!u.u_count) return(-1); - if((id = u.u_segflg) == 1) - c = *u.u_base; - else - if((c = id==0?fubyte(u.u_base):fuibyte(u.u_base)) < 0) { - u.u_error = EFAULT; - return(-1); - } + + if(u.u_segflg == 1) { + c = *u.u_base.l; + } else { + if(!u.u_segflg || u.u_segmented) { + if(fubyte(u.u_base.l,&c)) { + u.u_error = EFAULT; + return(-1); + } + } else { + if(fuibyte(u.u_base.right,&c)) { + u.u_error = EFAULT; + return(-1); + } + } + } + u.u_count--; u.u_offset++; - u.u_base++; + u.u_base.l++; return(c&0377); } @@ -182,30 +223,6 @@ nulldev() { } -/* - * Pass back c to the user at his location u_base; - * update u_base, u_count, and u_offset. Return -1 - * on the last character of the user's read. - * u_base is in the user address space unless u_segflg is set. - */ -passc(c) -register c; -{ - register id; - - if((id = u.u_segflg) == 1) - *u.u_base = c; - else - if(id?suibyte(u.u_base, c):subyte(u.u_base, c) < 0) { - u.u_error = EFAULT; - return(-1); - } - u.u_count--; - u.u_offset++; - u.u_base++; - return(u.u_count == 0? -1: 0); -} - /* * timeout is called to arrange that fun(arg) is called in tim/HZ seconds. * An entry is sorted into the callout structure. @@ -222,7 +239,8 @@ caddr_t arg; { register struct callo *p1, *p2; register int t; - int s; + register int s; + long foo1,foo2; t = tim; p1 = &callout[0];