www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1999/07/07/14:22:13

From: Alain Magloire <alainm AT rcsm DOT ece DOT mcgill DOT ca>
Message-Id: <199907071822.OAA09914@spock2.ECE.McGill.CA>
Subject: Re: Request: S_IFSOCK & S_ISSOCK in sys/stat.h
To: djgpp-workers AT delorie DOT com
Date: Wed, 7 Jul 1999 14:22:25 -0400 (EDT)
In-Reply-To: <Pine.SUN.3.91.990707153019.2851Q-100000@is> from "Eli Zaretskii" at Jul 7, 99 03:30:36 pm
X-Mailer: ELM [version 2.4 PL25]
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

Bonjour M. Eli Zaretskii

> On Tue, 6 Jul 1999, Richard Dawe wrote:
> 
> > libsocket is not near that goal yet. No code exists to support S_IFSOCK or
> > S_ISSOCK(). I hope to add stat() support for sockets sometime.
> 
> What does `stat' need to do with sockets?

Nothing, I think Richard meant fstat().

> > I'm confused what you mean about 'mknode' (mknod() in
> > libc/compat/sys/stat/mknod.c?).
> 
> I guess the example with mknod was a bad idea.  I think I tried to
> explain it better with S_ISLNK and the symlink function.

8-)
We agree, a socket doesn't have any equivalent in the file system space, so
fucntion like stat() mknod() etc .. is meaningless.  Still sometimes one
have to find a way to identified the type of file desc. So programmers
usually use fstat(socketfd, &buf_stat) and passing the result of
st_mode from the struct stat to S_ISSOCK().
Posix.1g defines isfdtype() to hide does implemention details.

So S_I{F,S}SOCK if defined needs support from two functions
fstat() and isfdtype()

- fstat():
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
I don't think it will crash or anything ..
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.

- isfdtype() :
Brand new from Posix.1g, a configure script should check before
using it .. ok.

> 
> So perhaps I should add S_ISSOCK and see if it actually breaks things
> during v2.03 beta.

I like betas ;-).  But since you have always consider v2.03 to be
a bug fix release, if you decide to delay those changes for 2.04, is
fine by me .. of course IMHO.

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

> 
> The important question is: do you think that libsocket will be ready
> with the necessary features in the next few months?  If not, then we
> can wait until v2.04.
> 

I can not answer for Richard, but a few months is awfully vague ;-)
But one thing is sure they will be other changes requested by the libsocket
group. For example a wider range of errno to cover networking errors
new signal macros SIGURG, SIGPOLL, SIGIO etc ..

I agree that those changes should be scrutinize and filter to make
sure that they fit and that they are not a specificity of one lib.
But I'm also please to see the openness, thanks.

In case, you've missed it, libsocket maintainer is 
actively (hmm..it is the summer, so take the word actively lightly)
working to make it work on DOS.

-- 
au revoir, alain
----
Aussi haut que l'on soit assis, on est toujours assis que sur son cul !!!

- Raw text -


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