341 (buf)[__offs] = __intVal(rA); \ |
341 (buf)[__offs] = __intVal(rA); \ |
342 __INST(readAhead) = nil; \ |
342 __INST(readAhead) = nil; \ |
343 (ret) = 1; \ |
343 (ret) = 1; \ |
344 } else { \ |
344 } else { \ |
345 CLEAR_ERRNO; \ |
345 CLEAR_ERRNO; \ |
346 READ(ret, f, (buf)+__offs, (cnt)-__offs, handleType); \ |
346 READ((ret), f, (buf)+__offs, (cnt)-__offs, handleType); \ |
347 if ((ret) <= 0) { \ |
347 if ((ret) <= 0) { \ |
348 if ((ret) < 0 && __threadErrno == EINTR) { \ |
348 if ((ret) < 0 && __threadErrno == EINTR) { \ |
349 continue; \ |
349 continue; \ |
350 } \ |
350 } \ |
351 break; \ |
351 break; \ |
395 CLEAR_ERRNO; \ |
394 CLEAR_ERRNO; \ |
396 { \ |
395 { \ |
397 int res = 0; \ |
396 int res = 0; \ |
398 if ((handleType == @symbol(socketFilePointer) && (ioctlsocket((SOCKET)_get_osfhandle(fileno(f)),FIONREAD,&res), 1)) \ |
397 if ((handleType == @symbol(socketFilePointer) && (ioctlsocket((SOCKET)_get_osfhandle(fileno(f)),FIONREAD,&res), 1)) \ |
399 || (handleType == @symbol(socketHandle) && (ioctlsocket((SOCKET)(f), FIONREAD, &res), 1)) \ |
398 || (handleType == @symbol(socketHandle) && (ioctlsocket((SOCKET)(f), FIONREAD, &res), 1)) \ |
400 || (handleType == @symbol(pipeFilePointer) && (PeekNamedPipe((HANDLE)_get_osfhandle(fileno(f)),0, 0,0,&res,0)), 1)) { \ |
399 || (handleType == @symbol(pipeFilePointer) && (PeekNamedPipe((HANDLE)_get_osfhandle(fileno(f)),0, 0,0,&res,0), 1))) { \ |
401 if (res > 0) { \ |
400 if (res > 0) { \ |
402 if (res > ((cnt)-__offs)) \ |
401 if (res > ((cnt)-__offs)) \ |
403 res = (cnt)-__offs; \ |
402 res = (cnt)-__offs; \ |
404 READ(ret, f, (buf)+__offs, res, handleType); \ |
403 READ((ret), f, (buf)+__offs, res, handleType); \ |
405 } else { \ |
404 } else { \ |
406 (ret) = 0; \ |
405 (ret) = 0; \ |
407 break; \ |
406 break; \ |
408 } \ |
407 } \ |
409 } else { \ |
408 } else { \ |
410 READ(ret, f, (buf)+__offs, (cnt)-__offs, handleType); \ |
409 READ((ret), f, (buf)+__offs, (cnt)-__offs, handleType); \ |
411 } \ |
410 } \ |
412 } \ |
411 } \ |
413 if ((ret) < 0 && __threadErrno == EINTR) \ |
412 if ((ret) <= 0) { \ |
414 continue; \ |
413 if (ret < 0 && __threadErrno == EINTR) \ |
|
414 continue; \ |
|
415 break; \ |
|
416 } \ |
415 __offs += (ret); \ |
417 __offs += (ret); \ |
416 } \ |
418 } \ |
417 if (__offs > 0) \ |
419 (ret) = __offs; \ |
418 (ret) = __offs; \ |
|
419 } \ |
420 } \ |
420 } |
421 } |
421 |
422 |
422 # define IO_BUFFER_SIZE (8*1024) |
423 # define IO_BUFFER_SIZE (8*1024) |
423 |
424 |
462 int l; \ |
463 int l; \ |
463 CLEAR_ERRNO; \ |
464 CLEAR_ERRNO; \ |
464 l = (cnt)-__offs; \ |
465 l = (cnt)-__offs; \ |
465 if ( l > IO_BUFFER_SIZE) \ |
466 if ( l > IO_BUFFER_SIZE) \ |
466 l = IO_BUFFER_SIZE; \ |
467 l = IO_BUFFER_SIZE; \ |
467 READ(ret,f, __buf, l, handleType); \ |
468 READ((ret),f, __buf, l, handleType); \ |
468 if ((ret) <= 0) { \ |
469 if ((ret) <= 0) { \ |
469 if ((ret) < 0 && __threadErrno == EINTR) { \ |
470 if ((ret) < 0 && __threadErrno == EINTR) { \ |
470 continue; \ |
471 continue; \ |
471 } \ |
472 } \ |
472 break; \ |
473 break; \ |
535 if ((handleType == @symbol(socketFilePointer) && (ioctlsocket((SOCKET)_get_osfhandle(fileno(f)), FIONREAD, &res), 1)) \ |
536 if ((handleType == @symbol(socketFilePointer) && (ioctlsocket((SOCKET)_get_osfhandle(fileno(f)), FIONREAD, &res), 1)) \ |
536 || (handleType == @symbol(socketHandle) && (ioctlsocket((SOCKET)(f), FIONREAD, &res), 1)) \ |
537 || (handleType == @symbol(socketHandle) && (ioctlsocket((SOCKET)(f), FIONREAD, &res), 1)) \ |
537 || (handleType == @symbol(pipeFilePointer) && (PeekNamedPipe((HANDLE)_get_osfhandle(fileno(f)),0,0,0,&res,0), 1))) { \ |
538 || (handleType == @symbol(pipeFilePointer) && (PeekNamedPipe((HANDLE)_get_osfhandle(fileno(f)),0,0,0,&res,0), 1))) { \ |
538 if (res > 0) { \ |
539 if (res > 0) { \ |
539 if (res > l) res = l; \ |
540 if (res > l) res = l; \ |
540 READ(ret, f, __buf, res, handleType); \ |
541 READ((ret), f, __buf, res, handleType); \ |
541 } else { \ |
542 } else { \ |
542 (ret) = 0; \ |
543 (ret) = 0; \ |
543 break; \ |
544 break; \ |
544 } \ |
545 } \ |
545 } else { \ |
546 } else { \ |
546 READ(ret, f, __buf, l, handleType); \ |
547 READ((ret), f, __buf, l, handleType); \ |
547 } \ |
548 } \ |
548 if ((ret) < 0 && __threadErrno == EINTR) \ |
549 if ((ret) < 0 && __threadErrno == EINTR) \ |
549 continue; \ |
550 continue; \ |
550 } \ |
551 } \ |
551 if ((ret) > 0) { \ |
552 if ((ret) > 0) { \ |
5884 ! ! |
5885 ! ! |
5885 |
5886 |
5886 !ExternalStream class methodsFor:'documentation'! |
5887 !ExternalStream class methodsFor:'documentation'! |
5887 |
5888 |
5888 version |
5889 version |
5889 ^ '$Header: /cvs/stx/stx/libbasic/ExternalStream.st,v 1.388 2014-05-22 12:24:44 stefan Exp $' |
5890 ^ '$Header: /cvs/stx/stx/libbasic/ExternalStream.st,v 1.389 2014-05-26 18:25:27 stefan Exp $' |
5890 ! |
5891 ! |
5891 |
5892 |
5892 version_CVS |
5893 version_CVS |
5893 ^ '$Header: /cvs/stx/stx/libbasic/ExternalStream.st,v 1.388 2014-05-22 12:24:44 stefan Exp $' |
5894 ^ '$Header: /cvs/stx/stx/libbasic/ExternalStream.st,v 1.389 2014-05-26 18:25:27 stefan Exp $' |
5894 ! ! |
5895 ! ! |
5895 |
5896 |
5896 |
5897 |
5897 ExternalStream initialize! |
5898 ExternalStream initialize! |