delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/06/24/18:02:22

Xref: news-dnh.mv.net comp.os.msdos.djgpp:562
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 1.12m4 (?)
Sender: news AT city DOT ac DOT uk (Unix Network News)
Nntp-Posting-Host: paddington
Reply-To: M DOT Lewis AT city DOT ac DOT uk
Organization: The City University
Date: Sat, 24 Jun 95 18:49:51 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 <stdio.h>
#include <fcntl.h>

#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+xfm7+exwC8S2+xAQFoegQAjB4oXoPkRC7vZETMbjVpb1tKnqIGUqVM
AEiUnfXXeo/I8wWmZNeWI7YZJfmC3C998ae48IjNX4uVOGEW6Ci3QQuHY0KUluOw
At0tmlXoVR1Bva1Fl+q3KA3ns9lkV/WsOw6l9OIuLjI1jihBwNg8ZsbBmNm3bwBL
eAgHlM8w2qk=
=5J/h
-----END PGP SIGNATURE-----

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019