diff --git a/src/include/os/Linux/osiSock.h b/src/include/os/Linux/osiSock.h new file mode 100644 index 000000000..f8d3afbc4 --- /dev/null +++ b/src/include/os/Linux/osiSock.h @@ -0,0 +1,59 @@ + +/* + * Linux specific socket include + * + * Under Linux if we dont define _POSIX_C_SOURCE or _XOPEN_SOURCE + * then none of the POSIX stuff (such as signals) can be used + * with cc -v. However if one of _POSIX_C_SOURCE or _XOPEN_SOURCE + * are defined then we cant use the socket library. Therefore I + * have been adding the following in order to use POSIX signals + * and also sockets on Linux with cc -v. What a pain.... + * + * #ifdef LINUX + * #define __EXTENSIONS__ + * #endif + */ + +#ifndef osiSockH +#define osiSockH + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#include +#include /* for MAXHOSTNAMELEN */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include /* close() and others */ + +/* + * as far as I can tell there is no header file for these + */ +int gethostname(char *name, int namelen); +int sethostname(char *name, int namelen); + +#ifdef __cplusplus +} +#endif + +typedef int SOCKET; +#define INVALID_SOCKET (-1) +#define SOCKERRNO errno +#define socket_close(S) close(S) +#define socket_ioctl(A,B,C) ioctl(A,B,C) + +#define FD_IN_FDSET(FD) ((FD)=0) + +#endif /*osiSockH*/ + diff --git a/src/libCom/osi/os/Linux/osdSock.h b/src/libCom/osi/os/Linux/osdSock.h new file mode 100644 index 000000000..f8d3afbc4 --- /dev/null +++ b/src/libCom/osi/os/Linux/osdSock.h @@ -0,0 +1,59 @@ + +/* + * Linux specific socket include + * + * Under Linux if we dont define _POSIX_C_SOURCE or _XOPEN_SOURCE + * then none of the POSIX stuff (such as signals) can be used + * with cc -v. However if one of _POSIX_C_SOURCE or _XOPEN_SOURCE + * are defined then we cant use the socket library. Therefore I + * have been adding the following in order to use POSIX signals + * and also sockets on Linux with cc -v. What a pain.... + * + * #ifdef LINUX + * #define __EXTENSIONS__ + * #endif + */ + +#ifndef osiSockH +#define osiSockH + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#include +#include /* for MAXHOSTNAMELEN */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include /* close() and others */ + +/* + * as far as I can tell there is no header file for these + */ +int gethostname(char *name, int namelen); +int sethostname(char *name, int namelen); + +#ifdef __cplusplus +} +#endif + +typedef int SOCKET; +#define INVALID_SOCKET (-1) +#define SOCKERRNO errno +#define socket_close(S) close(S) +#define socket_ioctl(A,B,C) ioctl(A,B,C) + +#define FD_IN_FDSET(FD) ((FD)=0) + +#endif /*osiSockH*/ +