Skip to content

Commit

Permalink
Merge pull request #14 from linmajia/master
Browse files Browse the repository at this point in the history
FreeBSD support.
  • Loading branch information
imzhenyu committed Jun 4, 2015
2 parents b052a1f + 6c1c237 commit 2b7f118
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 23 deletions.
Binary file added bin/Darwin/protoc
Binary file not shown.
Binary file added bin/Darwin/thrift
Binary file not shown.
Binary file modified bin/FreeBSD/protoc
Binary file not shown.
Binary file modified bin/FreeBSD/thrift
Binary file not shown.
5 changes: 3 additions & 2 deletions bin/dsn.cg.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/bash
#!/bin/sh

SOURCE="${BASH_SOURCE[0]}"
#SOURCE="${BASH_SOURCE[0]}"
SOURCE="$0"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
Expand Down
2 changes: 2 additions & 0 deletions bin/dsn.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,8 @@ function(dsn_setup_install)
install(PROGRAMS "bin/dsn.cg.sh" DESTINATION bin)
install(PROGRAMS "bin/Linux/thrift" DESTINATION bin/Linux)
install(PROGRAMS "bin/Linux/protoc" DESTINATION bin/Linux)
install(PROGRAMS "bin/Darwin/thrift" DESTINATION bin/Darwin)
install(PROGRAMS "bin/Darwin/protoc" DESTINATION bin/Darwin)
install(PROGRAMS "bin/FreeBSD/thrift" DESTINATION bin/FreeBSD)
install(PROGRAMS "bin/FreeBSD/protoc" DESTINATION bin/FreeBSD)
endif()
Expand Down
14 changes: 5 additions & 9 deletions include/dsn/internal/dsn_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,14 @@ __pragma(warning(disable:4127))
#define __selectany __declspec(selectany) extern
typedef HANDLE handle_t;

#elif defined(__linux__)
# elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)

#define __selectany __attribute__((weak)) extern
# define __selectany __attribute__((weak)) extern
typedef int handle_t;

#define O_BINARY 0

#elif defined(__MACH__)

#define __selectany __attribute__((weak)) extern
typedef int handle_t;
#define O_BINARY 0
# ifndef O_BINARY
# define O_BINARY 0
#endif

#else

Expand Down
5 changes: 2 additions & 3 deletions src/core/coredump.posix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@
# include <dsn/internal/coredump.h>

//#ifdef _WIN32
#if defined(__MACH__) || defined(__linux__)

# if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)

# define __TITLE__ "coredump"

Expand All @@ -53,5 +52,5 @@ namespace dsn {
}
}

# endif // #if defined(__MACH__) || defined(__linux__)
# endif // #if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)

7 changes: 6 additions & 1 deletion src/core/end_point.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@
# include <sys/socket.h>
# include <netdb.h>
# include <arpa/inet.h>

# if defined(__FreeBSD__)
# include <netinet/in.h>
# endif

# endif

# include <mutex>
Expand Down Expand Up @@ -62,7 +67,7 @@ end_point::end_point(const char* str, uint16_t p)

sockaddr_in addr;
memset(&addr,0,sizeof(addr));
addr.sin_family=AF_INET;
addr.sin_family = AF_INET;

if ((addr.sin_addr.s_addr = inet_addr(str)) == (unsigned int)(-1))
{
Expand Down
12 changes: 6 additions & 6 deletions src/tools/common/native_aio_provider.posix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@
* THE SOFTWARE.
*/

#include "native_aio_provider.posix.h"
# include "native_aio_provider.posix.h"

#if defined(__MACH__) || defined(__linux__)
# if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)

#include <aio.h>
#include <fcntl.h>
#include <cstdlib>
# include <aio.h>
# include <fcntl.h>
# include <cstdlib>

#define __TITLE__ "aio.provider.posix"
# define __TITLE__ "aio.provider.posix"

namespace dsn {
namespace tools {
Expand Down
4 changes: 2 additions & 2 deletions src/tools/common/native_aio_provider.posix.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

# include <dsn/tool_api.h>
# include <dsn/internal/synchronize.h>
# if defined(__MACH__) || defined(__linux__)
# if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)
# include <aio.h>
# include <fcntl.h>
# endif
Expand All @@ -49,7 +49,7 @@ namespace dsn {
error_code aio_internal(aio_task_ptr& aio, bool async, __out_param uint32_t* pbytes = nullptr);

private:
# if defined(__MACH__) || defined(__linux__)
# if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)
friend void aio_completed(sigval sigval);
# endif
};
Expand Down

0 comments on commit 2b7f118

Please sign in to comment.