public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Anurag Sharma <anurag@proximity.com.au>
To: cygwin@cygwin.com
Subject: errno reset when using thread enabled gcc
Date: Thu, 17 Oct 2002 00:13:00 -0000	[thread overview]
Message-ID: <20021017141643.0356fc8a.anurag@proximity.com.au> (raw)

Hi All,

I have come across a strange behaviour using native gcc on cygwin. I
understand that this issue is not 100% relevant to this list, but I am
hoping some one might have come across this issue before. Apologies for
any incovinience. I have posted the same on newlib mailing list too.

Consider this short code:

   int fd = ::open("/tmp/errnotest", O_RDONLY | O_BINARY);
    
    if (fd == -1) {
	std::cerr << "open failed, errno=" << errno << ", strerror=" <<
strerror(errno) << std::endl;
	std::cerr << "open failed, errno=" << errno << ", strerror=" <<
strerror(errno) << std::endl;
    }

If I build the gcc compiler by providing --enable-threads=single option
in the configure stage, following is the output :

open failed, errno=2, strerror=No such file or directory
open failed, errno=2, strerror=No such file or directory
 
This is of course expected.

Hoewever if I build the compiler by providing --enable-threads=posix
option in the configure stage, the output is as follows :

open failed, errno=2, strerror=No such file or directory
open failed, errno=0, strerror=No error

That is , after the first call to errno, it is reset!!

Has anyone else experiened this before? Can anyone please help find out
what exactly is going wrong?

Regards,

Anurag

--
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/

             reply	other threads:[~2002-10-17  4:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-17  0:13 Anurag Sharma [this message]
2002-10-17  7:15 ` Igor Pechtchanski
2002-10-17 18:26   ` Anurag Sharma

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20021017141643.0356fc8a.anurag@proximity.com.au \
    --to=anurag@proximity.com.au \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).