aboutsummaryrefslogtreecommitdiff
path: root/src/compat/osx.h
blob: ae55507066547ff24ed86326f14acadd98a7c5da (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*
 * Copyright (C) 2007-2013 Xagasoft, All rights reserved.
 *
 * This file is part of the libbu++ library and is released under the
 * terms of the license contained in the file LICENSE.
 */

#ifndef OSX_COMPATIBILITY__H
#define OSX_COMPATIBILITY__H

#ifdef __APPLE__

#ifndef TEMP_FAILURE_RETRY
#define TEMP_FAILURE_RETRY(expression)            \
  (__extension__                                  \
    ({ long int __result;                         \
      do __result = (long int) (expression);      \
      while (__result == -1L && errno == EINTR);  \
      __result; }))
#endif

#include <sched.h>

#define bu_inet_ntoa inet_ntoa
#define bu_inet_addr inet_addr
#define bu_select select
#define bu_socket socket
#define bu_shutdown shutdown
#define bu_htons htons
#define bu_htonl htonl
#define bu_gethostbyname gethostbyname
#define bu_freeaddrinfo freeaddrinfo
#define bu_getaddrinfo getaddrinfo
#define bu_connect connect
#define bu_getpeername getpeername
#define bu_setsockopt setsockopt
#define bu_bind bind
#define bu_listen listen
#define bu_accept accept
#define bu_send send
#define bu_recv recv
#define open64 open
#define lseek64 lseek

#define bu_gai_strerror gai_strerror

#define pthread_yield() sched_yield()
#endif /* __APPLE__ */
#endif