delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1999/12/04/06:36:51

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT sourceware DOT cygnus DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT sourceware DOT cygnus DOT com>
List-Archive: <http://sourceware.cygnus.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sourceware DOT cygnus DOT com>
List-Help: <mailto:cygwin-help AT sourceware DOT cygnus DOT com>, <http://sourceware.cygnus.com/ml/#faqs>
Sender: cygwin-owner AT sourceware DOT cygnus DOT com
Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com
Message-Id: <199912041135.FAA03836@dagda.sunflower.com>
From: "Doug Wyatt" <dwyatt AT sunflower DOT com>
To: Eric Christopher <echristo AT cygnus DOT com>, cygwin AT sourceware DOT cygnus DOT com,
XEmacs NT <xemacs-nt AT xemacs DOT org>
Date: Sat, 4 Dec 1999 05:35:31 -0600
MIME-Version: 1.0
Subject: Re: cygwin-1999-12-01: Prototypes in system headers not standard-compliant
Reply-to: dwyatt AT sunflower DOT com
In-reply-to: <3848C72F.2F05B5C0@cygnus.com>
X-mailer: Pegasus Mail for Win32 (v3.12a)

http://www.unix-systems.org/unix98.html

> I'll test these out.  Does anyone have a pointer to the full Unix 98 spec?
> 
> -eric
> 
> > The prototype for read() and write() in Unix98 don't match those in
> > the Cygwin header files.
> >
> > http://www.opengroup.org/onlinepubs/007908799/xsh/read.html
> > http://www.opengroup.org/onlinepubs/007908799/xsh/write.html
> >
> > The standard return type for these functions is `ssize_t'.
> > The traditional return type for these functions is `int'.
> > The return type in Cygwin is `int'.
> >
> > On 32-bit platforms, like Cygwin, the best choice is probably to use
> > `ssize_t' in the prototypes (they are standard, after all, right?),
> > but to then have
> >
> > typedef int ssize_t;
> >
> > This is effectively what Linux does.
> >
> > Here's the obvious untested patch (I've never used Cygwin):
> >
> > --- sys/unistd.h~       Wed Dec  1 21:25:48 1999
> > +++ sys/unistd.h        Fri Dec  3 20:07:58 1999
> > @@ -75,10 +75,10 @@
> >  pid_t   _EXFUN(_getpid, (void ));
> >  int     _EXFUN(_link, (const char *__path1, const char *__path2 ));
> >  off_t   _EXFUN(_lseek, (int __fildes, off_t __offset, int __whence ));
> > -int     _EXFUN(_read, (int __fildes, void *__buf, size_t __nbyte ));
> > +ssize_t _EXFUN(_read, (int __fildes, void *__buf, size_t __nbyte ));
> >  void *  _EXFUN(_sbrk,  (size_t __incr));
> >  int     _EXFUN(_unlink, (const char *__path ));
> > -int     _EXFUN(_write, (int __fildes, const void *__buf, size_t __nbyte ));
> > +ssize_t _EXFUN(_write, (int __fildes, const void *__buf, size_t __nbyte ));
> >
> >  #if defined(__CYGWIN32__) || defined(__rtems__)
> >  unsigned _EXFUN(usleep, (unsigned int __useconds));
> >
> > --- sys/types.h~        Wed Dec  1 21:25:48 1999
> > +++ sys/types.h Fri Dec  3 20:09:24 1999
> > @@ -110,7 +110,7 @@
> >  typedef        unsigned short  gid_t;
> >  typedef int pid_t;
> >  typedef        long key_t;
> > -typedef long ssize_t;
> > +typedef int ssize_t;
> >
> >  #ifdef __MS_types__
> >  typedef        char *  addr_t;
> >
> > --- sys/_types.h~       Wed Dec  1 21:25:42 1999
> > +++ sys/_types.h        Fri Dec  3 20:09:10 1999
> > @@ -10,6 +10,6 @@
> >  #define _SYS__TYPES_H
> >
> >  typedef long _off_t;
> > -typedef long _ssize_t;
> > +typedef int _ssize_t;
> >
> >  #endif /* _SYS__TYPES_H */
> >
> > P.S. If you do this, check all other functions for Unix98-compliance.
> 
> 
> --
> Want to unsubscribe from this list?
> Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com
> 



--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com

- Raw text -


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