delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1999/07/08/02:54:07

Date: Thu, 8 Jul 1999 09:51:54 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Alain Magloire <alainm AT rcsm DOT ece DOT mcgill DOT ca>
cc: djgpp-workers AT delorie DOT com
Subject: Re: Request: S_IFSOCK & S_ISSOCK in sys/stat.h
In-Reply-To: <199907071822.OAA09914@spock2.ECE.McGill.CA>
Message-ID: <Pine.SUN.3.91.990708095131.21287H-100000@is>
MIME-Version: 1.0
Reply-To: djgpp-workers AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Wed, 7 Jul 1999, Alain Magloire wrote:

> So programmers
> usually use fstat(socketfd, &buf_stat) and passing the result of
> st_mode from the struct stat to S_ISSOCK().

Where does the handle for sockets come from?  Is it created using
FSEXT?  If so, the current `fstat' is okay as long as libsocket isn't
linked in, since `fstat' will never set the S_IFSOCK bits on any
handle.  We only need to update `fstat' when libsocket is linked into
a program.

> if you don't use libsocket or a socket library that doesn't catch the call
> in FSEXT_fstat it should technically fail i.e fstat() != 0

No, it won't fail, since the handle is created by FSEXT and is
connected to the null device, as far as DOS is concerned.  So `fstat'
will succeed and return info for the null device.  The socket support
will not work, of course, but otherwise I don't think this is too bad.

> This can be a problem if you use a socket lib with DJGPP that has a
> BSD socket API but no support for FSEXT_fstat.  And If I understand,
> support for fstat in FSEXT was added only in 2.02.

Yes, __FSEXT_fstat was introduced in v2.02.  But I don't see a problem
here, since libsocket can require v2.02 or later.

> BTW, is there  a branch for 2.04 so we could start adding features
> snprintf, getconf, etc .. and break the world ?

I don't think there's a branch, and I don't think creating one is
worth the hassle.  DJ?

Anyway, the original intent was to get v2.03 out the door quickly
enough to eliminate the need for branching.  Obviously, I failed in
making that happen...

- Raw text -


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