delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/10/29/14:01:35

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Message-Id: <4.3.2.7.2.20021029113744.01f012d8@smtphost-cod.intra.kyocera-wireless.com>
X-Sender: tcurtiss AT smtphost-cod DOT intra DOT kyocera-wireless DOT com
Date: Tue, 29 Oct 2002 12:01:02 -0700
To: cygwin AT cygwin DOT com
From: Troy Curtiss <tcurtiss AT qcpi DOT com>
Subject: open() not handling previously opened serial port gracefully?
Mime-Version: 1.0

Hi,
   I recently ran into a problem where my cygwin-based program was trying 
to open a serial port that was already opened by another windows 
app.  Instead of the open() call failing & returning -1, the cygwin program 
dumped stack (tracing w/ gdb indicated that the failure was within the 
open() call - an access violation of some sort.)  I don't remember this 
happening in the past (but don't have my older cygwin1.dll versions to test 
with) - can anyone verify this (and thus prove that I'm not doing anything 
silly at my end :)  Thanks,

-Troy

Using:  Windows 2000, cygwin.dll 1.3.14-1 or cygwin.dll 1.3.13-2, seems to 
only affect serial ports

Code is as follows:

#include <stdio.h>
#include <fcntl.h>

int main(void)
{
   int fd1,fd2;
   fd1 = open("COM1",O_RDWR);
   sleep(1);
   fd2 = open("COM1",O_RDWR);
   sleep(1);
   close(fd2);
   close(fd1);
   return(0);
}

Stackdump is as follows:

Exception: STATUS_ACCESS_VIOLATION at eip=61015D6A
eax=00000000 ebx=00000003 ecx=00000000 edx=00000000 esi=615B0968 edi=40000080
ebp=0022FA88 esp=0022FA20 program=C:\projects\tools\xxx.exe
cs=001B ds=0023 es=0023 fs=0038 gs=0000 ss=0023
Stack trace:
Frame     Function  Args
0022FA88  61015D6A  (615B0968, 00000000, 00000002, 00000094)
0022FB08  61028668  (615B0968, 0022FB40, 00000002, 00000094)
0022FEB8  61076E61  (00401090, 00000002, 00000094, 0000002F)
0022FEE0  004010EB  (00000001, 0A040330, 0A040288, 00000001)
0022FF40  61007288  (610C7A34, FFFFFFFE, 0000002C, 610C7958)
0022FF90  6100753D  (00000000, 00000000, 80430F47, 00000000)
0022FFB0  004026E2  (00401096, 037F0009, 0022FFF0, 77E9CA90)
0022FFC0  0040103C  (00000000, 00000000, 7FFDF000, 00000000)
0022FFF0  77E9CA90  (00401000, 00000000, 000000C8, 00000100)
End of stack trace


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


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