Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!cs.utexas.edu!uunet!mcsun!hp4nl!utrcu1!mi.eltn.utwente.nl!klamer From: klamer@mi.eltn.utwente.nl (Klamer Schutte) Newsgroups: comp.os.minix Subject: 32 bits read/write on 16 bits kernel Keywords: minix 68k, long integers Message-ID: Date: 8 Apr 91 12:37:29 GMT Sender: news@utrcu1.UUCP Organization: University of Twente, BSC-El Lines: 136 Here come two files, read.c and write.c to allow anyone who uses a compiler with longer ints than the kernel compiler has to issue read(2) and write(2) calls. define INTIS32 if you want this. If you don't want this, you get the minix-st 1.5.10#3 version. Klamer echo x - read.c sed '/^X/s///' > read.c << '/' X/* X * read.c X * X * original: minix-st 1.5.10 #3 X * changed for long ints KS 2/4/91 X */ X X#include X X#define IO_BLK 0x4000 /* smaller than 32k */ X XPUBLIC int read(fd, buffer, nbytes) Xint fd; Xchar *buffer; Xunsigned nbytes; X{ X#ifdef INTIS32 X int ret_val, call_val; X X for(ret_val = 0;nbytes > IO_BLK;nbytes -= IO_BLK) X { X call_val = callm1(FS, READ, fd, IO_BLK, 0, buffer, NIL_PTR, NIL_PTR); X ret_val += call_val; X if (call_val != IO_BLK) /* whole request cannot be satisfied */ X if (call_val >= 0) /* is there an error? */ X return ret_val; X else X return call_val; X buffer += call_val; X } X X return(ret_val + callm1(FS, READ, fd, nbytes, 0, buffer, NIL_PTR, NIL_PTR)); X#else X return(callm1(FS, READ, fd, nbytes, 0, buffer, NIL_PTR, NIL_PTR)); X#endif X} / echo x - read.uue sed '/^X/s///' > read.uue << '/' Xtable X !"#$%&'()*+,-./0123456789:;<=>? X@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_ Xbegin 644 read.c.Z XM'YV-+U0H *$B@9PR8>D&Q P9:P@N50"ERMDD0WBZ"7DP(0HS9%B $%/'C!F\DMV(R4.Gw XMS)P4"GK6)+-#@550MHRW=!TW(WTP>u XM1(OO9,VB!0T"A.Z6TKE[!Q&=#9LV,:!@Q!2225%$$$1(!IED\:4G&0R2K7:9t XM')(YD0037T!!A1057ICAABF4IMQV%X&PPG?]L3$=&R+R!@(**:X(0@CPH3!92=&ZX\49(8E U1QATI#$'6+2IL!1<+L*87XD^? =#r XM"G&IP--/>^%%%4P@X"5'1#\(I@!<(]8A1U_:K2AB F6P,4<9:\*EG9M]Q write.c << '/' X/* X * write.c X * X * original: minix-st 1.5.10 #3 X * changed for long ints KS 2/4/91 X */ X X#include X X#define IO_BLK 0x4000 /* smaller than 32k */ X XPUBLIC int write(fd, buffer, nbytes) Xint fd; Xchar *buffer; Xunsigned nbytes; X{ X#ifdef INTIS32 X int ret_val, call_val; X X for(ret_val = 0;nbytes > IO_BLK;nbytes -= IO_BLK) X { X call_val = callm1(FS, WRITE, fd, IO_BLK, 0, buffer, NIL_PTR, NIL_PTR); X ret_val += call_val; X if (call_val != IO_BLK) /* whole request cannot be satisfied */ X if (call_val >= 0) /* is there an error? */ X return ret_val; X else X return call_val; X buffer += call_val; X } X X return(ret_val + callm1(FS, WRITE, fd, nbytes, 0, buffer, NIL_PTR, NIL_PTR)); X#else X return(callm1(FS, WRITE, fd, nbytes, 0, buffer, NIL_PTR, NIL_PTR)); X#endif X} / echo x - write.uue sed '/^X/s///' > write.uue << '/' Xtable X !"#$%&'()*+,-./0123456789:;<=>? X@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_ Xbegin 644 write.c.Z XM'YV-+U0H *$BP1TY:>B4<3%FH$"""=X@/)/&31@V.D"TJ9@&3XLY=$#$<%'#z XM10P8($;,<)A@#)HP;LZ4(0/"C$00;-[$!%&1SAP02Z: D/&"QHL<,1R^4*!@y XM1,4Q;.J0*0."!YLT8ER@\<%TQ%0S%>D&Q P9:P@N50"ERMDD0WBZ"7DP81D49LBP "&FCADS>">[$9-'w XMX9P4"GK6)+-#@554OHRW=!TW<]*<<3,3Q.;.9>:4WM,T3>0R9D D<4(Ev XMR92_ Q7322"G#)TO=BY.'F,7^L72R6W*0='\>70V('J @+'CMF<0/H27/;NDu XM/.?S+<23-8L6- @0O%M6_QX>!'4V;+01 PI&3#'9%5(D0441DT4VV7SL30;#t XM9*MA)L=D3B3!Q!=04"$%AAIRZ&$*I3'GG'7@K2#>?VR@6*)O(*# (HH@A"#?s XM>O7!)=<=:+QQ%PC-Q5%';B%1YX8;;X0D!E5SA$%'&G. 59L*2\$%HXS[782>r XM>#"D$)<*//VT%UY4P00"7G)(](-@"L!E(AUUR-%7=RZVF4 9;,Q1AIUOQMG7q XMC-^56"%>(*CH7Y9LE'9?'VTFUYV?W)W(WPJ' B@@@0:"@*""#(ZFV7NY24BAp XM91:"N&&''X*0X:DCDM@4GGHZZARD+%Y:X($)+MB@9+:!.H>HE)&:F:HAHFJJo X.B%*DX.H(9;A!AF\*, H4n X m Xend / -- Klamer Schutte Faculty of electrical engineering -- University of Twente, The Netherlands klamer@mi.eltn.utwente.nl {backbone}!mcsun!mi.eltn.utwente.nl!klamer