Skip to content

Commit

Permalink
Merge pull request #6416 from rohanmars/wip-solaris-port
Browse files Browse the repository at this point in the history
librados: Solaris port

Reviewed-by: Sage Weil <sage@redhat.com>
  • Loading branch information
liewegas committed Nov 15, 2015
2 parents b9251b4 + 131deb3 commit 3a5e0a3
Show file tree
Hide file tree
Showing 35 changed files with 687 additions and 84 deletions.
5 changes: 5 additions & 0 deletions COPYING
Original file line number Diff line number Diff line change
Expand Up @@ -149,3 +149,8 @@ Files: src/include/timegm.h
Copyright (C) Copyright Howard Hinnant
Copyright (C) Copyright 2010-2011 Vicente J. Botet Escriba
License: Boost Software License, Version 1.0

Files: src/msg/async/AsyncConnection.cc, src/msg/simple/Pipe.cc (sigpipe suppression)
Copyright (C) 2010 Tomash Brechko. All rights reserved.
License: GPL3

30 changes: 30 additions & 0 deletions README.solaris
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@

The Solaris build will only build the librados library.

Build Prerequisites
===================

The following Solaris packages are required for compilation:

git
autoconf
libtool
automake
gcc-c++-48
gnu-make

(use the "pkg install <packagename>" command to install, as root)

Download and Compile Boost 1.59 (or higher)

Building Ceph
=============

export LDFLAGS="-L<pathtoboost>/boost_1_59_0/stage/lib"
export CPPFLAGS="-I<pathtoboost>/boost/boost_1_59_0"

./autogen.sh
./configure --disable-server --without-fuse --without-tcmalloc --without-libatomic-ops --without-libaio --without-libxfs
cd src
gmake librados.la

5 changes: 5 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,14 @@ linux*)
freebsd*)
freebsd="yes"
;;
solaris*)
solaris="yes"
;;
esac
AM_CONDITIONAL(LINUX, test x"$linux" = x"yes")
AM_CONDITIONAL(FREEBSD, test x"$freebsd" = x"yes")
AM_CONDITIONAL(DARWIN, test x"$darwin" = x"yes")
AM_CONDITIONAL(SOLARIS, test x"$solaris" = x"yes")

# Checks for programs.
AC_PROG_CXX
Expand Down Expand Up @@ -956,6 +960,7 @@ AC_CHECK_HEADERS([ \
sys/time.h \
sys/vfs.h \
sys/xattr.h \
sys/cdefs.h \
syslog.h \
utime.h \
])
Expand Down
30 changes: 29 additions & 1 deletion src/Makefile-env.am
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,34 @@ HARDENING_LDFLAGS = \
AM_COMMON_CPPFLAGS = \
-D__CEPH__ \
-D_FILE_OFFSET_BITS=64 \
-D_REENTRANT \
-D_THREAD_SAFE \
-D__STDC_FORMAT_MACROS \
-D_GNU_SOURCE \
-DCEPH_LIBDIR=\"${libdir}\" \
-DCEPH_PKGLIBDIR=\"${pkglibdir}\" \
-DGTEST_USE_OWN_TR1_TUPLE=0

if LINUX
AM_COMMON_CPPFLAGS += \
-D_REENTRANT
endif

if FREEBSD
AM_COMMON_CPPFLAGS += \
-D_REENTRANT
endif

if DARWIN
AM_COMMON_CPPFLAGS += \
-D_REENTRANT
endif

if SOLARIS
AM_COMMON_CPPFLAGS += \
-D_PTHREADS \
-D_POSIX_C_SOURCE
endif

AM_COMMON_CFLAGS = \
-Wall \
${WARN_TYPE_LIMITS} \
Expand All @@ -100,6 +120,9 @@ AM_COMMON_CFLAGS = \
if !CLANG
AM_COMMON_CFLAGS += -rdynamic
endif
if SOLARIS
AM_COMMON_CFLAGS += -Wno-unused-local-typedefs
endif

AM_CFLAGS = $(AM_COMMON_CFLAGS) $(HARDENING_CFLAGS)
AM_CPPFLAGS = $(AM_COMMON_CPPFLAGS)
Expand All @@ -113,6 +136,11 @@ if !CLANG
AM_CXXFLAGS += -Wstrict-null-sentinel
endif

# solaris harding
if SOLARIS
AM_CXXFLAGS += -lssp_nonshared
endif

# note: this is position dependant, it affects the -l options that
# come after it on the command line. when you use ${AM_LDFLAGS} in
# later rules, take care where you place it. for more information, see
Expand Down
5 changes: 3 additions & 2 deletions src/auth/cephx/CephxSessionHandler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@ int CephxSessionHandler::_calc_signature(Message *m, uint64_t *psig)
__le32 middle_crc;
__le32 data_crc;
} __attribute__ ((packed)) sigblock = {
1, AUTH_ENC_MAGIC, 4*4,
header.crc, footer.front_crc, footer.middle_crc, footer.data_crc
1, mswab64(AUTH_ENC_MAGIC), mswab32(4*4),
mswab32(header.crc), mswab32(footer.front_crc),
mswab32(footer.middle_crc), mswab32(footer.data_crc)
};
bufferlist bl_plaintext;
bl_plaintext.append(buffer::create_static(sizeof(sigblock), (char*)&sigblock));
Expand Down
27 changes: 21 additions & 6 deletions src/common/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ libcommon_internal_la_SOURCES = \
common/MemoryModel.cc \
common/armor.c \
common/fd.cc \
common/xattr.c \
common/safe_io.c \
common/snap_types.cc \
common/str_list.cc \
Expand Down Expand Up @@ -57,10 +56,6 @@ libcommon_internal_la_SOURCES = \
common/entity_name.cc \
common/ceph_crypto.cc \
common/ceph_crypto_cms.cc \
common/ceph_json.cc \
common/ipaddr.cc \
common/pick_address.cc \
common/util.cc \
common/TextTable.cc \
common/ceph_fs.cc \
common/ceph_hash.cc \
Expand All @@ -69,17 +64,37 @@ libcommon_internal_la_SOURCES = \
common/addr_parsing.c \
common/hobject.cc \
common/bloom_filter.cc \
common/linux_version.c \
common/module.c \
common/Readahead.cc \
common/Cycles.cc \
common/ContextCompletion.cc \
common/TracepointProvider.cc

if ENABLE_SERVER
libcommon_internal_la_SOURCES += \
common/xattr.c \
common/ipaddr.cc \
common/ceph_json.cc \
common/util.cc \
common/pick_address.cc
endif

if LINUX
libcommon_internal_la_SOURCES += \
common/linux_version.c
endif

if SOLARIS
libcommon_internal_la_SOURCES += \
common/solaris_errno.cc
endif

if WITH_RBD
if LINUX
libcommon_internal_la_SOURCES += \
common/blkdev.cc
endif
endif

if ENABLE_XIO
libcommon_internal_la_SOURCES += \
Expand Down
25 changes: 13 additions & 12 deletions src/common/SubProcess.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <signal.h>

#include <sstream>
#include <vector>
Expand All @@ -44,9 +45,9 @@
* std::cerr << "cat failed: " << cat.err() << std::endl;
* return false;
* }
* write_to_fd(cat.stdout(), "hello world!\n");
* write_to_fd(cat.get_stdout(), "hello world!\n");
* cat.close_stdout();
* read_from_fd(cat.stdin(), buf);
* read_from_fd(cat.get_stdin(), buf);
* if (cat.join() != 0) {
* std::cerr << cat.err() << std::endl;
* return false;
Expand All @@ -67,9 +68,9 @@ class SubProcess {

bool is_spawned() const { return pid > 0; }

int stdin() const;
int stdout() const;
int stderr() const;
int get_stdin() const;
int get_stdout() const;
int get_stderr() const;

void close_stdin();
void close_stdout();
Expand Down Expand Up @@ -113,12 +114,12 @@ class SubProcessTimed : public SubProcess {
int sigkill;
};

SubProcess::SubProcess(const char *cmd_, bool stdin, bool stdout, bool stderr) :
SubProcess::SubProcess(const char *cmd_, bool use_stdin, bool use_stdout, bool use_stderr) :
cmd(cmd_),
cmd_args(),
pipe_stdin(stdin),
pipe_stdout(stdout),
pipe_stderr(stderr),
pipe_stdin(use_stdin),
pipe_stdout(use_stdout),
pipe_stderr(use_stderr),
stdin_pipe_out_fd(-1),
stdout_pipe_in_fd(-1),
stderr_pipe_in_fd(-1),
Expand Down Expand Up @@ -152,21 +153,21 @@ void SubProcess::add_cmd_arg(const char *arg) {
cmd_args.push_back(arg);
}

int SubProcess::stdin() const {
int SubProcess::get_stdin() const {
assert(is_spawned());
assert(pipe_stdin);

return stdin_pipe_out_fd;
}

int SubProcess::stdout() const {
int SubProcess::get_stdout() const {
assert(is_spawned());
assert(pipe_stdout);

return stdout_pipe_in_fd;
}

int SubProcess::stderr() const {
int SubProcess::get_stderr() const {
assert(is_spawned());
assert(pipe_stderr);

Expand Down
3 changes: 2 additions & 1 deletion src/common/sctp_crc32.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@

/* $KAME: sctp_crc32.c,v 1.12 2005/03/06 16:04:17 itojun Exp $ */


#ifdef HAVE_SYS_TYPES_H
#include <sys/cdefs.h>
#endif
#if 0
__FBSDID("$FreeBSD: src/sys/netinet/sctp_crc32.c,v 1.8 2007/05/08 17:01:10 rrs Exp $");

Expand Down

0 comments on commit 3a5e0a3

Please sign in to comment.