source: sock.h @ bb09b3c

Last change on this file since bb09b3c was 823de9d, checked in by Sven Moritz Hallberg <pesco@…>, at 2009-03-12T19:10:06Z

commit updates by ashish shukla <wahjava@…>

  • Property mode set to 100644
File size: 1.1 KB
RevLine 
[8a9afe4]1#include <errno.h>
2#include <fcntl.h>
3
[b7d3cc34]4#ifndef _WIN32
5#include <unistd.h>
6#include <sys/socket.h>
7#include <netinet/in.h>
8#include <arpa/inet.h>
9#include <netdb.h>
10#define sock_make_nonblocking(fd) fcntl(fd, F_SETFL, O_NONBLOCK)
[701acdd4]11#define sock_make_blocking(fd) fcntl(fd, F_SETFL, 0)
[b7d3cc34]12#define sockerr_again() (errno == EINPROGRESS || errno == EINTR)
[3f199fc]13#ifndef EVENTS_LIBEVENT
[b7d3cc34]14#define closesocket(a) close(a)
[3f199fc]15#endif
[b7d3cc34]16#else
17# include <winsock2.h>
[823de9d]18# ifndef _MSC_VER
19#  include <ws2tcpip.h>
20# endif
[b7d3cc34]21# if !defined(BITLBEE_CORE) && defined(_MSC_VER)
22#   pragma comment(lib,"bitlbee.lib")
23# endif
24# include <io.h>
[823de9d]25# define read(a,b,c) recv(a,b,c,0)
26# define write(a,b,c) send(a,b,c,0)
27# define umask _umask
28# define mode_t int
[b7d3cc34]29# define sock_make_nonblocking(fd) { int non_block = 1; ioctlsocket(fd, FIONBIO, &non_block); }
[701acdd4]30# define sock_make_blocking(fd) { int non_block = 0; ioctlsocket(fd, FIONBIO, &non_block); }
[b7d3cc34]31# define sockerr_again() (WSAGetLastError() == WSAEINTR || WSAGetLastError() == WSAEINPROGRESS || WSAGetLastError() == WSAEWOULDBLOCK)
32# define ETIMEDOUT WSAETIMEDOUT
33# define sleep(a) Sleep(a*1000)
34#endif
Note: See TracBrowser for help on using the repository browser.