Mail Archives: cygwin-developers/1998/05/21/11:49:45
> > - Windows32/Sockets.h does not have all of the winsock definitions
> > that are defined. For example the setsockopt options are missing.
> > Here are some missing defines:
> >
> > +/* socket options for {set,get}sockopt() */
> > +#define SO_DEBUG 0x0001
> > +#define SO_ACCEPTCONN 0x0002
> > +#define SO_REUSEADDR 0x0004
> > +#define SO_KEEPALIVE 0x0008
> > +#define SO_DONTROUTE 0x0010
> > +#define SO_BROADCAST 0x0020
> > +#define SO_USELOOPBACK 0x0040
> > +#define SO_LINGER 0x0080
> > +#define SO_OOBINLINE 0x0100
> > +
> > +#define SO_DONTLINGER (u_int)(~SO_LINGER)
> > +
> > +#define SO_SNDBUF 0x1001
> > +#define SO_RCVBUF 0x1002
> > +#define SO_SNDLOWAT 0x1003 /* unsup */
> > +#define SO_RCVLOWAT 0x1004 /* unsup */
> > +#define SO_SNDTIMEO 0x1005 /* unsup */
> > +#define SO_RCVTIMEO 0x1006 /* unsup */
> > +#define SO_ERROR 0x1007
> > +#define SO_TYPE 0x1008
>
> These are all defined in my copy of
> winsup/include/Windows32/Sockets.h...
My analysis must have been wrong. The problem is that these aren't
getting defined when you include <sys/socket.h> and <netinet/in.h>. I
was under the impression that socket definitions were pulled in from
<Windows32/Sockets.h>. At any rate, I had to add these to my personal
<sys/socket.h> for building some networking software.
> > - several machine-dependant types are not defined, probably should
> > go in {asm,machine}/types.h and be included by sys/types.h. These
> > are (possibly not all necessary):
> >
> > +typedef unsigned long vm_offset_t;
> > +typedef unsigned long vm_size_t;
> > +
> > +#define __BIT_TYPES_DEFINED__
> > +typedef char int8_t;
> > +typedef unsigned char u_int8_t;
> > +typedef short int16_t;
> > +typedef unsigned short u_int16_t;
> > +typedef int int32_t;
> > +typedef unsinged int u_int32_t;
> > +typedef long long int64_t;
> > +typedef unsigned long long u_int64_t;
> > +
> > +typedef int32_t register_t;
>
> newlib/libc/include/sys/types.h already has MS-specific defines, so
> I'm going to add these there (for now, at least).
btw, <sys/types.h> could be cleaned up a bit if these generic (bit-types)
were defined per-arch prior to all the other types being defined. I don't
know how close you are to newlib or if you want to bother touching it at
all. Right now the headers just assume "long" is 32 bits and leave it
at that.
> 2) Is it really a good idea to add a CYGWIN/CYGWINb_19 define? Cygwin
> versions are currently in winsup/version.h. I like having these
> defined in the winsup directory somewhere...
Not sure. This gives a fine grained way to #ifdef code, but this is
rarely needed. I have no strong opinion either way.
> 3) <sys/signal.h> isn't included in param.h in either Linux or Solaris.
I'm not quite sure why bsd includes these. If its not common, then
it should probably be left out.
> 4) NOFILE_MAX isn't defined in any Linux or Solaris include files. Is
> it really needed?
These were the comments:
#define NOFILE OPEN_MAX /* max open files per process (soft) */
#define NOFILE_MAX 1024 /* max open files per process (hard) */
We don't really have any hard limits I guess. If its not common I
guess it should be left out.
> 5) Under Linux, MIN and MAX are defined in compat.h. Solaris defines
> them in sys/sysmacros.h. Where should we put them?
do sys/sysmacros or compat get included by sys/param?
> 6) Under Solaris, bitmap macros are defined in fs/ufs_fs.h. Under
> Linux, they're only to be found in the g++ headers. Do we want them
> defined under Cygwin32?
They're useful. Don't recall seeing much software use them though.
> 7) Solaris defines howmany in sysmacros.h and select.h. Linux defines
> it in sys/param.h and sys/types.h. Where should we put them?
howmany is in both sys/params and sys/types in BSD, which I guess is
redudant since sys/types is included by sys/param (perhaps it's in
a conditional?). At any rate, it should at least be defined around
the select defines in sys/types
> > - sys/time.h does not define the POSIX timespec structure or operations
> > on it, and does not define the CLOCK_{RELTIME,VIRTUAL,PROF} constants.
>
> Linux doesn't seem to define the CLOCK_ constants or the timespec
> structure. Solaris does. Do we want them?
timespec is a posix thing, how much of posix do we want? I can't
recall seeing code use timespecs.
> > It is also missing some common timeval macros:
> >
> > +/* timeval operations */
> > +#define timerclear(tvp) (tvp)->tv_sec = 0; (tvp)->tv_usec = 0
> > +#define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec)
> > +#define timercmp(tvp, uvp, cmp) \
> > + (((tvp)->tv_sec == (uvp)->tv_sec) ? \
> > + ((tvp)->tv_usec cmp (uvp)->tv_usec) : \
> > + ((tvp)->tv_sec cmp (uvp->tv_sec))
> > +#define timeradd(tvp, uvp, vvp) \
> > + do { \
> > + (vvp)->tv_sec = (tvp)->tv_sec + (uvp)->tv_sec; \
> > + (vvp)->tv_usec = (tvp)->tv_usec + (uvp)->tv_usec; \
> > + if((vvp)->tv_usec >= 1000000) { \
> > + (vvp)->tv_sec ++; \
> > + (vvp)->tv_usec -= 1000000; \
> > + } \
> > + } while(0)
> > +#define timersub(tvp, uvp, vvp) \
> > + do {
> > + (vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec; \
> > + (vvp)->tv_usec = (tvp)->tv_usec - (uvp)->tv_usec; \
> > + if((vvp)->tv_usec < 0) { \
> > + (vvp)->tv_sec --; \
> > + (vvp)->tv_usec += 1000000; \
> > + } \
> > + } while(0)
>
> Linux and Solaris don't define timeradd or timersub in time.h. They
> do define the others. Are timeradd and timersub worth adding?
I use timeradd and timersub all the time, so my preference is obvious :)
> > +/* XXX these were outside of !POSIX in BSD - is this right? */
> > +typedef u_int64_t u_quad_t;
> > +typedef int64_t quad_t;
> > +typedef quad_t * quaddr_t;
>
> These aren't defined by Solaris or Linux. Probably should leave them
> out?
sounds fine to me.
> Geoffrey Noer
> noer AT cygnus DOT com
Tim N.
- Raw text -