aix gcc librados port

Signed-off-by: Rohan Mars <code@rohanmars.com>
This commit is contained in:
Rohan Mars 2015-11-22 15:52:02 -05:00
parent 90a37c7205
commit a3a0e1cb30
18 changed files with 394 additions and 20 deletions

97
README.aix Normal file
View File

@ -0,0 +1,97 @@
The AIX build will only build the librados library.
Build Prerequisites
===================
The following AIX packages are required for developing and compilation, they have been installed via the AIX-rpm (rpm) packages:
AIX-rpm
tcl
tk
expect
curl
readline
libpng
mpfr
m4
autoconf
gettext
less
perl
gdbm
pcre
rsync
zlib
gcc-cpp
libffi
pkg-config
libiconv
glib2
info
libidn
openldap
python-tools
bzip2
python
sed
grep
libtool
nspr
nss-util
sqlite
nss-softokn
nss-softokn-freebl
libstdc++
gmp
coreutils
nss
nss-tools
nss-sysinit
nspr-devel
nss-util-devel
nss-softokn-devel
nss-softokn-freebl-devel
nss-devel
make
libsigsegv
automake
libmpc
libgcc
gcc
libstdc++-devel
gcc-c++
adns
tcsh
bash
getopt
db4
expat
tcl
freetype2
fontconfig
libXrender
libXft
tk
python-libs
tkinter
gdb
git
Download and Compile Boost 1.59 (or higher)
Building Ceph
=============
export CXX="c++ -maix64"
export CFLAGS="-g -maix64"
export OBJECT_MODE=64
export LDFLAGS="-L/usr/lib64 -L/opt/freeware/lib64 -L<pathtoboost>/boost_1_59_0/stage/lib -Wl,-brtl -Wl,-bbigtoc"
export CXXFLAGS="-I/opt/freeware/include -I<pathtoboost>/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

View File

@ -20,8 +20,10 @@ 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"
export LDFLAGS="-m64 -L<pathtoboost>/stage/lib -L/usr/lib/mps/64"
export CPPFLAGS="-m64 -I<pathtoboost>"
export CXXFLAGS="-m64"
export CFLAGS="-m64"
./autogen.sh
./configure --disable-server --without-fuse --without-tcmalloc --without-libatomic-ops --without-libaio --without-libxfs

View File

@ -70,11 +70,15 @@ freebsd*)
solaris*)
solaris="yes"
;;
aix*)
aix="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")
AM_CONDITIONAL(AIX, test x"$aix" = x"yes")
# Checks for programs.
AC_PROG_CXX
@ -266,6 +270,8 @@ AC_CHECK_CC_FLAG([-Wtype-limits], [WARN_TYPE_LIMITS])
AC_CHECK_CC_FLAG([-Wignored-qualifiers], [WARN_IGNORED_QUALIFIERS])
AC_CHECK_CC_FLAG([-Werror=format-security], [WARN_ERROR_FORMAT_SECURITY])
AC_CHECK_CC_FLAG([-rdynamic], [RDYNAMIC_FLAG])
# Check for compiler VTA support
AX_CHECK_COMPILE_FLAG([-fvar-tracking-assignments], [HAS_VTA_SUPPORT=1], [HAS_VTA_SUPPORT=0])
AM_CONDITIONAL(COMPILER_HAS_VTA, [test "$HAS_VTA_SUPPORT" = 1])
@ -963,6 +969,7 @@ AC_CHECK_HEADERS([ \
sys/cdefs.h \
syslog.h \
utime.h \
execinfo.h
])
# name_to_handle_at
@ -1000,9 +1007,16 @@ AC_CHECK_MEMBER([struct stat.st_mtimespec.tv_nsec],
[Define if you have struct stat.st_mtimespec.tv_nsec])])
# splice/tee
AC_CHECK_FUNC([splice],
[AC_DEFINE([CEPH_HAVE_SPLICE], [], [splice(2) is supported])],
[])
case "${target_os}" in
aix*)
# AIX splice() is something else
;;
*)
AC_CHECK_FUNC([splice],
[AC_DEFINE([CEPH_HAVE_SPLICE], [], [splice(2) is supported])],
[])
;;
esac
# F_SETPIPE_SZ in fcntl.h
AC_MSG_CHECKING([for F_SETPIPE_SZ in fcntl.h])

View File

@ -118,28 +118,30 @@ AM_COMMON_CFLAGS = \
-fno-strict-aliasing \
-fsigned-char
if !CLANG
AM_COMMON_CFLAGS += -rdynamic
AM_COMMON_CFLAGS += ${RDYNAMIC_FLAG}
endif
if SOLARIS
AM_COMMON_CFLAGS += -Wno-unused-local-typedefs
endif
AM_CFLAGS = $(AM_COMMON_CFLAGS) $(HARDENING_CFLAGS)
AM_CFLAGS = $(AM_COMMON_CFLAGS)
if LINUX
AM_CFLAGS += $(HARDENING_CFLAGS)
endif
AM_CPPFLAGS = $(AM_COMMON_CPPFLAGS)
AM_CXXFLAGS = \
@AM_CXXFLAGS@ \
$(AM_COMMON_CFLAGS) \
-ftemplate-depth-1024 \
-Wnon-virtual-dtor \
-Wno-invalid-offsetof $(HARDENING_CFLAGS)
-Wno-invalid-offsetof
if LINUX
AM_CXXFLAGS += $(HARDENING_CFLAGS)
endif
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
@ -153,6 +155,9 @@ AM_LDFLAGS =
if LINUX
AM_LDFLAGS += -Wl,--as-needed $(HARDENING_LDFLAGS)
endif
if AIX
AM_LDFLAGS += -Wl,-brtl -Wl,-bexpfull
endif
if USE_BOOST_SPIRIT_OLD_HDR
AM_CXXFLAGS += -DUSE_BOOST_SPIRIT_OLD_HDR

View File

@ -2,7 +2,9 @@
#define CEPH_BACKTRACE_H
#include <iosfwd>
#ifdef HAVE_EXECINFO_H
#include <execinfo.h>
#endif
#include <stdlib.h>
namespace ceph {
@ -16,8 +18,10 @@ struct BackTrace {
char **strings;
BackTrace(int s) : skip(s) {
#ifdef HAVE_EXECINFO_H
size = backtrace(array, max);
strings = backtrace_symbols(array, size);
#endif
}
~BackTrace() {
free(strings);

View File

@ -89,6 +89,11 @@ libcommon_internal_la_SOURCES += \
common/solaris_errno.cc
endif
if AIX
libcommon_internal_la_SOURCES += \
common/aix_errno.cc
endif
if WITH_RBD
if LINUX
libcommon_internal_la_SOURCES += \

View File

@ -4,6 +4,7 @@
#include "MemoryModel.h"
#include "common/config.h"
#include "debug.h"
#include <malloc.h>
#include <fstream>

View File

@ -16,7 +16,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#if defined(__FreeBSD__)
#if defined(__FreeBSD__) || defined(_AIX)
#include <sys/socket.h>
#include <netinet/in.h>
#endif

225
src/common/aix_errno.cc Normal file
View File

@ -0,0 +1,225 @@
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab
/*
* Ceph - scalable distributed file system
*
* Copyright (C) 2011 New Dream Network
*
* This is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software
* Foundation. See file COPYING.
*
*/
#include <errno.h>
#include "include/types.h"
// converts from linux errno values to host values
__s32 ceph_to_host_errno(__s32 r)
{
if (r < -34) {
switch (r) {
case -35:
return -EDEADLK;
case -36:
return -ENAMETOOLONG;
case -37:
return -ENOLCK;
case -38:
return -ENOSYS;
case -39:
return -ENOTEMPTY;
case -40:
return -ELOOP;
case -42:
return -ENOMSG;
case -43:
return -EIDRM;
case -44:
return -ECHRNG;
case -45:
return -EL2NSYNC;
case -46:
return -EL3HLT;
case -47:
return -EL3RST;
case -48:
return -ELNRNG;
case -49:
return -EUNATCH;
case -51:
return -EL2HLT;
case -52:
return -EPERM; //TODO EBADE
case -53:
return -EPERM; //TODO EBADR
case -54:
return -EPERM; //TODO EXFULL
case -55:
return -EPERM; //TODO ENOANO
case -56:
return -EPERM; //TODO EBADRQC
case -57:
return -EPERM; //TODO EBADSLT
case -59:
return -EPERM; //TODO EBFONT
case -60:
return -ENOSTR;
case -61:
return -ENODATA;
case -62:
return -ETIME;
case -63:
return -ENOSR;
case -64:
return -EPERM; //TODO ENONET
case -65:
return -EPERM; //TODO ENOPKG
case -66:
return -EREMOTE;
case -67:
return -ENOLINK;
case -68:
return -EPERM; //TODO EADV
case -69:
return -EPERM; //TODO ESRMNT
case -70:
return -EPERM; //TODO ECOMM
case -71:
return -EPROTO;
case -72:
return -EMULTIHOP;
case -73:
return -EPERM; //TODO EDOTDOT
case -74:
return -EBADMSG;
case -75:
return -EOVERFLOW;
case -76:
return -EPERM; //TODO ENOTUNIQ
case -77:
return -EPERM; //TODO EBADFD
case -78:
return -EPERM; //TODO EREMCHG
case -79:
return -EPERM; //TODO ELIBACC
case -80:
return -EPERM; //TODO ELIBBAD
case -81:
return -EPERM; //TODO ELIBSCN
case -82:
return -EPERM; //TODO ELIBMAX
case -83:
return -EPERM; // TODO ELIBEXEC
case -84:
return -EILSEQ;
case -85:
return -ERESTART;
case -86:
return -EPERM; //ESTRPIPE;
case -87:
return -EUSERS;
case -88:
return -ENOTSOCK;
case -89:
return -EDESTADDRREQ;
case -90:
return -EMSGSIZE;
case -91:
return -EPROTOTYPE;
case -92:
return -ENOPROTOOPT;
case -93:
return -EPROTONOSUPPORT;
case -94:
return -ESOCKTNOSUPPORT;
case -95:
return -EOPNOTSUPP;
case -96:
return -EPFNOSUPPORT;
case -97:
return -EAFNOSUPPORT;
case -98:
return -EADDRINUSE;
case -99:
return -EADDRNOTAVAIL;
case -100:
return -ENETDOWN;
case -101:
return -ENETUNREACH;
case -102:
return -ENETRESET;
case -103:
return -ECONNABORTED;
case -104:
return -ECONNRESET;
case -105:
return -ENOBUFS;
case -106:
return -EISCONN;
case -107:
return -ENOTCONN;
case -108:
return -ESHUTDOWN;
case -109:
return -ETOOMANYREFS;
case -110:
return -ETIMEDOUT;
case -111:
return -ECONNREFUSED;
case -112:
return -EHOSTDOWN;
case -113:
return -EHOSTUNREACH;
case -114:
return -EALREADY;
case -115:
return -EINPROGRESS;
case -116:
return -ESTALE;
case -117:
return -EPERM; //TODO EUCLEAN
case -118:
return -EPERM; //TODO ENOTNAM
case -119:
return -EPERM; //TODO ENAVAIL
case -120:
return -EPERM; //TODO EISNAM
case -121:
return -EPERM; //TODO EREMOTEIO
case -122:
return -EDQUOT;
case -123:
return -EPERM; //TODO ENOMEDIUM
case -124:
return -EPERM; //TODO EMEDIUMTYPE - not used
case -125:
return -ECANCELED;
case -126:
return -EPERM; //TODO ENOKEY
case -127:
return -EPERM; //TODO EKEYEXPIRED
case -128:
return -EPERM; //TODO EKEYREVOKED
case -129:
return -EPERM; //TODO EKEYREJECTED
case -130:
return -EOWNERDEAD;
case -131:
return -ENOTRECOVERABLE;
case -132:
return -EPERM; //TODO ERFKILL
case -133:
return -EPERM; //TODO EHWPOISON
default: {
break;
}
}
}
return r; // otherwise return original value
}

View File

@ -14,7 +14,9 @@
#include <sys/types.h>
#include <unistd.h>
#ifdef __linux__
#include <sys/syscall.h> /* For SYS_xxx definitions */
#endif
#include <algorithm>
#include <errno.h>

View File

@ -1,6 +1,10 @@
#include "CrushCompiler.h"
#if defined(_AIX)
#define EBADE ECORRUPT
#endif
#ifndef EBADE
#define EBADE EFTYPE
#endif

View File

@ -284,6 +284,7 @@ void global_init_daemonize(CephContext *cct)
if (global_init_prefork(cct) < 0)
return;
#if !defined(_AIX)
int ret = daemon(1, 1);
if (ret) {
ret = errno;
@ -294,6 +295,7 @@ void global_init_daemonize(CephContext *cct)
global_init_postfork_start(cct);
global_init_postfork_finish(cct);
#endif
}
void global_init_postfork_start(CephContext *cct)

View File

@ -26,6 +26,11 @@
#include <sys/stat.h>
#include <sys/types.h>
#if defined(_AIX)
extern char *sys_siglist[];
#endif
void install_sighandler(int signum, signal_handler_t handler, int flags)
{
int ret;
@ -40,7 +45,7 @@ void install_sighandler(int signum, signal_handler_t handler, int flags)
ret = sigaction(signum, &act, &oldact);
if (ret != 0) {
char buf[1024];
#if defined(__sun)
#if defined(__sun)
char message[SIG2STR_MAX];
sig2str(signum,message);
snprintf(buf, sizeof(buf), "install_sighandler: sigaction returned "

View File

@ -11,7 +11,7 @@
#elif defined(__FreeBSD__)
#include <sys/cdefs.h>
#define __GNUC_PREREQ(minor, major) __GNUC_PREREQ__(minor, major)
#elif defined(__sun)
#elif defined(__sun) || defined(_AIX)
#include "include/compat.h"
#include <assert.h>
#endif

View File

@ -42,6 +42,10 @@
# endif
#endif
#if defined(_AIX)
# define CEPH_BIG_ENDIAN
#endif

View File

@ -53,11 +53,15 @@
#define lseek64(fd, offset, whence) lseek(fd, offset, whence)
#endif
#if defined(__sun)
#if defined(__sun) || defined(_AIX)
#define LOG_AUTHPRIV (10<<3)
#define LOG_FTP (11<<3)
#define __STRING(x) "x"
#define IFTODT(mode) (((mode) & 0170000) >> 12)
#endif
#if defined(_AIX)
#define MSG_DONTWAIT MSG_NONBLOCK
#endif
#endif /* !CEPH_COMPAT_H */

View File

@ -83,7 +83,7 @@ typedef off_t loff_t;
typedef off_t off64_t;
#endif
#ifdef __sun
#if defined(__sun) || defined(_AIX)
typedef off_t loff_t;
#endif
@ -520,7 +520,7 @@ WRITE_EQ_OPERATORS_1(shard_id_t, id)
WRITE_CMP_OPERATORS_1(shard_id_t, id)
ostream &operator<<(ostream &lhs, const shard_id_t &rhs);
#if defined(__sun)
#if defined(__sun) || defined(_AIX)
__s32 ceph_to_host_errno(__s32 e);
#else
#define ceph_to_host_errno(e) (e)

View File

@ -1638,9 +1638,9 @@ static int rados_tool_common(const std::map < std::string, std::string > &opts,
if (wildcard)
io_ctx.set_namespace(all_nspaces);
bool stdout = (nargs.size() < 2) || (strcmp(nargs[1], "-") == 0);
bool use_stdout = (nargs.size() < 2) || (strcmp(nargs[1], "-") == 0);
ostream *outstream;
if(stdout)
if(use_stdout)
outstream = &cout;
else
outstream = new ofstream(nargs[1]);