Xref: news-dnh.mv.net comp.os.msdos.djgpp:563 Newsgroups: comp.os.msdos.djgpp Path: news-dnh.mv.net!mv!news.sprintlink.net!cam.news.pipex.net!pipex!soap.news.pipex.net!pipex!edi.news.pipex.net!pipex!sunsite.doc.ic.ac.uk!cs.city.ac.uk!city!sl323 From: sl323 AT city DOT ac DOT uk (Mark Lewis) Subject: Bug: read() in v1.12m4 (?) Sender: news AT city DOT ac DOT uk (Unix Network News) Nntp-Posting-Host: swindon Reply-To: M DOT Lewis AT city DOT ac DOT uk Organization: The City University Date: Sat, 24 Jun 95 18:43:23 GMT Lines: 96 To: djgpp AT sun DOT soe DOT clarkson DOT edu Dj-Gateway: from newsgroup comp.os.msdos.djgpp -----BEGIN PGP SIGNED MESSAGE----- HELP ! I've managed to get this go32 error from a simple bit of code. Apologies for the ridiculously stupid nature of the code; I've been using it to test low-level I/O stuff since I've been having problems with some real code crashing and burning badly for no apparent reason. Looks like read() could be the problem, but fixing this is beyond me. I've appended the error message and the test code that produced it. Compile with 'gcc $(CFLAGS) test.c test2.c'. I'd be happy to send the real code that's causing me problems to anyone who's interested, but it's considerably bigger! It doesn't give a nice error like this either -- just crashes out during a read() call with segmentation faults or GPF's. Please reply via email as well as posting so I don't miss anything. Thanks in advance, Mark. - -- ..--------------------------{ From: Mark Lewis }--------------------------. | Computing Services | http://www.city.ac.uk/~sl323/home.html | | City University | PGP public key available by WWW, or by | | London, England | fingering sl323 AT finger DOT city DOT ac DOT uk | `--------{ M DOT Lewis AT city DOT ac DOT uk (MIME) | nostra AT city DOT ac DOT uk (MIME) }---------' - ----{ err.out }---- go32 version 1.12.maint3 Copyright (C) 1994 DJ Delorie This image has a buggy read.s module. Run DPMIFIX on it and try again. Unsupported DOS request at eip=1967 eax=00003f08 ebx=00000008 ecx=00004000 edx=00000000 esi=00000000 edi=00000000 ebp=7ffffd90 esp=7ffffd68 cs=d8 ds=48 es=48 fs=48 gs=38 ss=48 cr2=00009000 Call frame traceback EIPs: 0x00001967 0x0000128d - ----{ test.h }---- #define FNAME "c:/tmp/test.c" #define BUF_SIZE (2*8192) void do_read(void); - ----{ test.c }---- #include #include #include "test.h" extern char *buf; /* char buf[BUF_SIZE]; */ void do_read() { FILE *fp; int fd, len; if ((fp = fopen(FNAME, "rb")) == NULL) { fprintf(stderr, "Couldn't open file.\n"); exit(1); } fseek(fp, 0, SEEK_SET); fd = fileno(fp); lseek(fd, 0L, SEEK_END); lseek(fd, 0L, SEEK_SET); while((len = read(fd, buf, BUF_SIZE)) > 0) write(1, buf, len); } - ----{ test2.c }---- #include "test.h" char buf[BUF_SIZE]; int main() { do_read(); exit(0); } - ----{ EOF }---- -----BEGIN PGP SIGNATURE----- Version: 2.6.2i iQCVAgUBL+xeG7+exwC8S2+xAQFXbQQAm8nhrp4duzdckX19JJmYHeGg4Q+tPI6K Va8xGnd2mCyiYbmr+C6NwjZxWZ2Fm9TVKcP54WuEEwJv/dJ10grmCyqYc10fucf4 RTFPRI/k5eGYepeItRWm6P7/fSGES/dF2d629CCBqpHikZzY+9/IN5vM78dsPGhB guhlLHH9NJs= =PFdZ -----END PGP SIGNATURE-----