import winsup-2000-02-17 snapshot
This commit is contained in:
93
winsup/cygwin/include/asm/byteorder.h
Normal file
93
winsup/cygwin/include/asm/byteorder.h
Normal file
@@ -0,0 +1,93 @@
|
||||
#ifndef _I386_BYTEORDER_H
|
||||
#define _I386_BYTEORDER_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
#undef ntohl
|
||||
#undef ntohs
|
||||
#undef htonl
|
||||
#undef htons
|
||||
#endif
|
||||
|
||||
#ifndef __LITTLE_ENDIAN
|
||||
#define __LITTLE_ENDIAN 1234
|
||||
#endif
|
||||
|
||||
#ifndef __LITTLE_ENDIAN_BITFIELD
|
||||
#define __LITTLE_ENDIAN_BITFIELD
|
||||
#endif
|
||||
|
||||
#if 1
|
||||
extern unsigned long int ntohl(unsigned long int);
|
||||
extern unsigned short int ntohs(unsigned short int);
|
||||
extern unsigned long int htonl(unsigned long int);
|
||||
extern unsigned short int htons(unsigned short int);
|
||||
|
||||
extern __inline__ unsigned long int __ntohl(unsigned long int);
|
||||
extern __inline__ unsigned short int __ntohs(unsigned short int);
|
||||
extern __inline__ unsigned long int __constant_ntohl(unsigned long int);
|
||||
extern __inline__ unsigned short int __constant_ntohs(unsigned short int);
|
||||
|
||||
extern __inline__ unsigned long int
|
||||
__ntohl(unsigned long int x)
|
||||
{
|
||||
__asm__("xchgb %b0,%h0\n\t" /* swap lower bytes */
|
||||
"rorl $16,%0\n\t" /* swap words */
|
||||
"xchgb %b0,%h0" /* swap higher bytes */
|
||||
:"=q" (x)
|
||||
: "0" (x));
|
||||
return x;
|
||||
}
|
||||
|
||||
#define __constant_ntohl(x) \
|
||||
((unsigned long int)((((unsigned long int)(x) & 0x000000ffU) << 24) | \
|
||||
(((unsigned long int)(x) & 0x0000ff00U) << 8) | \
|
||||
(((unsigned long int)(x) & 0x00ff0000U) >> 8) | \
|
||||
(((unsigned long int)(x) & 0xff000000U) >> 24)))
|
||||
|
||||
extern __inline__ unsigned short int
|
||||
__ntohs(unsigned short int x)
|
||||
{
|
||||
__asm__("xchgb %b0,%h0" /* swap bytes */
|
||||
: "=q" (x)
|
||||
: "0" (x));
|
||||
return x;
|
||||
}
|
||||
|
||||
#define __constant_ntohs(x) \
|
||||
((unsigned short int)((((unsigned short int)(x) & 0x00ff) << 8) | \
|
||||
(((unsigned short int)(x) & 0xff00) >> 8))) \
|
||||
|
||||
#define __htonl(x) __ntohl(x)
|
||||
#define __htons(x) __ntohs(x)
|
||||
#define __constant_htonl(x) __constant_ntohl(x)
|
||||
#define __constant_htons(x) __constant_ntohs(x)
|
||||
|
||||
#ifdef __OPTIMIZE__
|
||||
# define ntohl(x) \
|
||||
(__builtin_constant_p((long)(x)) ? \
|
||||
__constant_ntohl((x)) : \
|
||||
__ntohl((x)))
|
||||
# define ntohs(x) \
|
||||
(__builtin_constant_p((short)(x)) ? \
|
||||
__constant_ntohs((x)) : \
|
||||
__ntohs((x)))
|
||||
# define htonl(x) \
|
||||
(__builtin_constant_p((long)(x)) ? \
|
||||
__constant_htonl((x)) : \
|
||||
__htonl((x)))
|
||||
# define htons(x) \
|
||||
(__builtin_constant_p((short)(x)) ? \
|
||||
__constant_htons((x)) : \
|
||||
__htons((x)))
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
58
winsup/cygwin/include/asm/socket.h
Normal file
58
winsup/cygwin/include/asm/socket.h
Normal file
@@ -0,0 +1,58 @@
|
||||
#ifndef _ASM_SOCKET_H
|
||||
#define _ASM_SOCKET_H
|
||||
|
||||
#include <cygwin/if.h>
|
||||
|
||||
#define IOCPARM_MASK 0x7f /* parameters must be < 128 bytes */
|
||||
#define IOC_VOID 0x20000000 /* no parameters */
|
||||
#define IOC_OUT 0x40000000 /* copy out parameters */
|
||||
#define IOC_IN 0x80000000 /* copy in parameters */
|
||||
|
||||
#define _IO(x,y) (IOC_VOID|(x<<8)|y)
|
||||
#define _IOR(x,y,t) (IOC_OUT|(((long)sizeof(t)&IOCPARM_MASK)<<16)|(x<<8)|y)
|
||||
#define _IOW(x,y,t) (IOC_IN|(((long)sizeof(t)&IOCPARM_MASK)<<16)|(x<<8)|y)
|
||||
|
||||
#define SIOCATMARK _IOR('s', 7, u_long) /* at oob mark? */
|
||||
#define FIONREAD _IOR('f', 127, u_long) /* get # bytes to read */
|
||||
#define FIONBIO 0x8004667e /* To be compatible with termiost version */
|
||||
#define REAL_FIONBIO _IOW('f', 126, u_long) /* set/clear non-blocking i/o */
|
||||
#define FIOASYNC _IOW('f', 125, u_long) /* set/clear async i/o */
|
||||
#define SIOCSHIWAT _IOW('s', 0, u_long) /* set high watermark */
|
||||
#define SIOCGHIWAT _IOR('s', 1, u_long) /* get high watermark */
|
||||
#define SIOCSLOWAT _IOW('s', 2, u_long) /* set low watermark */
|
||||
#define SIOCGLOWAT _IOR('s', 3, u_long) /* get low watermark */
|
||||
|
||||
/* Needed for if queries */
|
||||
#define SIOCGIFCONF _IOW('s', 100, struct ifconf) /* get if list */
|
||||
#define SIOCGIFFLAGS _IOW('s', 101, struct ifreq) /* Get if flags */
|
||||
#define SIOCGIFADDR _IOW('s', 102, struct ifreq) /* Get if addr */
|
||||
#define SIOCGIFBRDADDR _IOW('s', 103, struct ifreq) /* Get if broadcastaddr */
|
||||
#define SIOCGIFNETMASK _IOW('s', 104, struct ifreq) /* Get if netmask */
|
||||
|
||||
#define SOL_SOCKET 0xffff /* options for socket level */
|
||||
|
||||
#define SO_DEBUG 0x0001 /* turn on debugging info recording */
|
||||
#define SO_ACCEPTCONN 0x0002 /* socket has had listen() */
|
||||
#define SO_REUSEADDR 0x0004 /* allow local address reuse */
|
||||
#define SO_KEEPALIVE 0x0008 /* keep connections alive */
|
||||
#define SO_DONTROUTE 0x0010 /* just use interface addresses */
|
||||
#define SO_BROADCAST 0x0020 /* permit sending of broadcast msgs */
|
||||
#define SO_USELOOPBACK 0x0040 /* bypass hardware when possible */
|
||||
#define SO_LINGER 0x0080 /* linger on close if data present */
|
||||
#define SO_OOBINLINE 0x0100 /* leave received OOB data in line */
|
||||
#define SO_DONTLINGER (u_int)(~SO_LINGER)
|
||||
|
||||
/*
|
||||
* Additional options.
|
||||
*/
|
||||
#define SO_SNDBUF 0x1001 /* send buffer size */
|
||||
#define SO_RCVBUF 0x1002 /* receive buffer size */
|
||||
#define SO_SNDLOWAT 0x1003 /* send low-water mark */
|
||||
#define SO_RCVLOWAT 0x1004 /* receive low-water mark */
|
||||
#define SO_SNDTIMEO 0x1005 /* send timeout */
|
||||
#define SO_RCVTIMEO 0x1006 /* receive timeout */
|
||||
#define SO_ERROR 0x1007 /* get error status and clear */
|
||||
#define SO_TYPE 0x1008 /* get socket type */
|
||||
|
||||
#endif /* _ASM_SOCKET_H */
|
||||
|
13
winsup/cygwin/include/asm/types.h
Normal file
13
winsup/cygwin/include/asm/types.h
Normal file
@@ -0,0 +1,13 @@
|
||||
#ifndef _ASM_TYPES_H
|
||||
#define _ASM_TYPES_H
|
||||
|
||||
typedef __signed__ char __s8;
|
||||
typedef unsigned char __u8;
|
||||
|
||||
typedef __signed__ short __s16;
|
||||
typedef unsigned short __u16;
|
||||
|
||||
typedef __signed__ int __s32;
|
||||
typedef unsigned int __u32;
|
||||
|
||||
#endif /* _ASM_TYPES_H */
|
Reference in New Issue
Block a user