Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing compilation on Debian GNU/Hurd #1342

Merged
merged 1 commit into from
Dec 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions cmake/XRootDFindLibs.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ if( ENABLE_KRB5 )
endif()

# mac fuse not supported
if( ENABLE_FUSE AND Linux )
if( ENABLE_FUSE AND LINUX )
find_package( fuse )
if( FUSE_FOUND )
add_definitions( -DHAVE_FUSE )
Expand Down Expand Up @@ -111,7 +111,7 @@ else()
set( BUILD_SCITOKENS FALSE )
endif()

if( ENABLE_PYTHON AND (Linux OR APPLE) )
if( ENABLE_PYTHON AND (LINUX OR Hurd OR MacOSX) )
find_package( PythonInterp ${XRD_PYTHON_REQ_VERSION} )
find_package( PythonLibs ${XRD_PYTHON_REQ_VERSION} )
if( PYTHONINTERP_FOUND AND PYTHONLIBS_FOUND )
Expand All @@ -122,7 +122,7 @@ if( ENABLE_PYTHON AND (Linux OR APPLE) )
endif()
endif()

if( ENABLE_VOMS AND Linux )
if( ENABLE_VOMS AND (LINUX OR Hurd) )
find_package( VOMS )
if( VOMS_FOUND )
set( BUILD_VOMS TRUE )
Expand Down
16 changes: 12 additions & 4 deletions cmake/XRootDOSDefs.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

include( CheckCXXSourceRuns )

set( Linux FALSE )
set( LINUX FALSE )
set( Hurd FALSE )
set( MacOSX FALSE )
set( Solaris FALSE )

Expand Down Expand Up @@ -77,9 +78,17 @@ endif()
# Linux
#-------------------------------------------------------------------------------
if( ${CMAKE_SYSTEM_NAME} STREQUAL "Linux" )
set( Linux TRUE )
set( LINUX TRUE )
include( GNUInstallDirs )
set( EXTRA_LIBS rt )
endif()

#-------------------------------------------------------------------------------
# GNU/Hurd
#-------------------------------------------------------------------------------
if( ${CMAKE_SYSTEM_NAME} STREQUAL "GNU" )
set( Hurd TRUE )
include( GNUInstallDirs )
add_definitions( -D__linux__=1 )
set( EXTRA_LIBS rt )
endif()

Expand All @@ -97,7 +106,6 @@ if( APPLE )
# this is here because of Apple deprecating openssl and krb5
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations" )

add_definitions( -D__macos__=1 )
add_definitions( -DLT_MODULE_EXT=".dylib" )
set( CMAKE_INSTALL_LIBDIR "lib" )
set( CMAKE_INSTALL_BINDIR "bin" )
Expand Down
2 changes: 0 additions & 2 deletions src/XProtocol/XProtocol.hh
Original file line number Diff line number Diff line change
Expand Up @@ -1284,10 +1284,8 @@ struct ALIGN_CHECK {char chkszreq[25-sizeof(ClientRequest)];
#endif

#ifndef EBADRQC
#if defined(__APPLE__)
#define EBADRQC EBADRPC
#endif
#endif

#ifndef EAUTH
#define EAUTH EBADE
Expand Down
6 changes: 3 additions & 3 deletions src/Xrd/XrdConfig.cc
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
#include "XrdTls/XrdTls.hh"
#include "XrdTls/XrdTlsContext.hh"

#ifdef __linux__
#if defined(__linux__) || defined(__GNU__)
#include <netinet/tcp.h>
#endif
#ifdef __APPLE__
Expand Down Expand Up @@ -1143,7 +1143,7 @@ int XrdConfig::setFDL()

// The scheduler will have already set the thread limit. We just report it
//
#if defined(__linux__) && defined(RLIMIT_NPROC)
#if ( defined(__linux__) || defined(__GNU__) ) && defined(RLIMIT_NPROC)

// Obtain the actual limit now (Scheduler construction sets this to rlim_max)
//
Expand Down Expand Up @@ -1177,7 +1177,7 @@ int XrdConfig::Setup(char *dfltp, char *libProt)

// Special handling for Linux sendfile()
//
#if defined(__linux__) && defined(TCP_CORK)
#if ( defined(__linux__) || defined(__GNU__) ) && defined(TCP_CORK)
{ int sokFD, setON = 1;
if ((sokFD = socket(PF_INET, SOCK_STREAM, 0)) >= 0)
{setsockopt(sokFD, XrdNetUtils::ProtoID("tcp"), TCP_NODELAY,
Expand Down
2 changes: 1 addition & 1 deletion src/Xrd/XrdLink.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#include <sys/types.h>
#include <sys/uio.h>

#ifdef __linux__
#if defined(__linux__) || defined(__GNU__)
#include <netinet/tcp.h>
#if !defined(TCP_CORK)
#undef HAVE_SENDFILE
Expand Down
22 changes: 14 additions & 8 deletions src/Xrd/XrdLinkXeq.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
#include <sys/types.h>
#include <sys/uio.h>

#ifdef __linux__
#if defined(__linux__) || defined(__GNU__)
#include <netinet/tcp.h>
#if !defined(TCP_CORK)
#undef HAVE_SENDFILE
Expand Down Expand Up @@ -79,12 +79,6 @@ extern XrdScheduler Sched;
extern XrdTlsContext *tlsCtx;
XrdTcpMonPin *TcpMonPin = 0;
extern int devNull;

#ifdef IOV_MAX
int maxIOV = IOV_MAX;
#else
int maxIOV = sysconf(_SC_IOV_MAX);
#endif
};

using namespace XrdGlobal;
Expand Down Expand Up @@ -554,6 +548,18 @@ int XrdLinkXeq::Send(const char *Buff, int Blen)
int XrdLinkXeq::Send(const struct iovec *iov, int iocnt, int bytes)
{
int retc;
static int maxIOV = -1;
if (maxIOV == -1) {
#ifdef _SC_IOV_MAX
maxIOV = sysconf(_SC_IOV_MAX);
if (maxIOV == -1)
#endif
#ifdef IOV_MAX
maxIOV = IOV_MAX;
#else
maxIOV = 1024;
#endif
}

// Get a lock and assume we will be successful (statistically we are)
//
Expand Down Expand Up @@ -668,7 +674,7 @@ do{retc = sendfilev(LinkInfo.FD, vecSFP, sfN, &xframt);
Log.Emsg("Link", retc, "send file to", ID);
return -1;

#elif defined(__linux__)
#elif defined(__linux__) || defined(__GNU__)

static const int setON = 1, setOFF = 0;
ssize_t retc = 0, bytesleft;
Expand Down
4 changes: 2 additions & 2 deletions src/Xrd/XrdScheduler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ XrdScheduler::XrdScheduler(XrdSysError *eP, XrdOucTrace *tP,

// Make sure we are using the maximum number of threads allowed (Linux only)
//
#if defined(__linux__) && defined(RLIMIT_NPROC)
#if ( defined(__linux__) || defined(__GNU__) ) && defined(RLIMIT_NPROC)

struct rlimit rlim;

Expand Down Expand Up @@ -165,7 +165,7 @@ XrdScheduler::XrdScheduler(int minw, int maxw, int maxi)

// Get a file descriptor mirroring standard error
//
#if defined(__linux__) && defined(O_CLOEXEC)
#if ( defined(__linux__) || defined(__GNU__) ) && defined(F_DUPFD_CLOEXEC)
eFD = fcntl(STDERR_FILENO, F_DUPFD_CLOEXEC, 0);
#else
eFD = dup(STDERR_FILENO);
Expand Down
3 changes: 2 additions & 1 deletion src/XrdAcc/XrdAccAuthFile.hh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include <netdb.h>
#include <sys/param.h>
#include "XrdSys/XrdSysError.hh"
#include "XrdSys/XrdSysPlatform.hh"
#include "XrdSys/XrdSysPthread.hh"
#include "XrdOuc/XrdOucStream.hh"
#include "XrdAcc/XrdAccAuthDB.hh"
Expand Down Expand Up @@ -75,6 +76,6 @@ time_t modtime;
XrdSysMutex DBcontext;

char recname_buff[MAXHOSTNAMELEN+1]; // Max record name by default
char path_buff[PATH_MAX+2]; // Max path name
char path_buff[MAXPATHLEN+2]; // Max path name
};
#endif
1 change: 1 addition & 0 deletions src/XrdAcc/XrdAccGroups.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#include <sys/types.h>

#include "XrdSys/XrdSysHeaders.hh"
#include "XrdSys/XrdSysPlatform.hh"
#include "XrdSys/XrdSysPwd.hh"
#include "XrdAcc/XrdAccCapability.hh"
#include "XrdAcc/XrdAccGroups.hh"
Expand Down
6 changes: 3 additions & 3 deletions src/XrdApps/Xrdadler32.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#ifdef __linux__
#if defined(__linux__) || defined(__GNU__)
#include <sys/xattr.h>
#endif
#include <zlib.h>
Expand Down Expand Up @@ -71,7 +71,7 @@ void fSetXattrAdler32(const char *path, int fd, const char* attr, char *value)

// Remove any old attribute at this point
//
#if defined(__linux__)
#if defined(__linux__) || defined(__GNU__)
fremovexattr(fd, attr);
#elif defined(__solaris__)
int attrfd;
Expand All @@ -90,7 +90,7 @@ int fGetXattrAdler32(int fd, const char* attr, char *value)
if (fstat(fd, &st)) return 0;
sprintf(mtime, "%ld", st.st_mtime);

#if defined(__linux__)
#if defined(__linux__) || defined(__GNU__)
rc = fgetxattr(fd, attr, attr_val, 25);
#elif defined(__solaris__)
int attrfd;
Expand Down
1 change: 1 addition & 0 deletions src/XrdCks/XrdCksConfig.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
#include "XrdOuc/XrdOucStream.hh"
#include "XrdOuc/XrdOucUtils.hh"
#include "XrdSys/XrdSysError.hh"
#include "XrdSys/XrdSysPlatform.hh"
#include "XrdSys/XrdSysPlugin.hh"

/******************************************************************************/
Expand Down
1 change: 1 addition & 0 deletions src/XrdCks/XrdCksManOss.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
#include "XrdOss/XrdOss.hh"
#include "XrdOuc/XrdOucEnv.hh"
#include "XrdSys/XrdSysError.hh"
#include "XrdSys/XrdSysPlatform.hh"

/******************************************************************************/
/* L o c a l S t a t i c s */
Expand Down
2 changes: 2 additions & 0 deletions src/XrdCks/XrdCksManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,8 @@ int XrdCksManager::Calc(const char *Pfn, time_t &MTime, XrdCksCalc *csP)
{if ((inBuff = (char *)mmap(0, ioSize, PROT_READ,
#if defined(__FreeBSD__)
MAP_RESERVED0040|MAP_PRIVATE, In.FD, Offset)) == MAP_FAILED)
#elif defined(__GNU__)
MAP_PRIVATE, In.FD, Offset)) == MAP_FAILED)
#else
MAP_NORESERVE|MAP_PRIVATE, In.FD, Offset)) == MAP_FAILED)
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/XrdCl/XrdClAsyncSocketHandler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ namespace XrdCl
log->Error( AsyncSockMsg, "[%s] Unable to turn on keepalive: %s",
st.ToString().c_str() );

#if defined(__linux__) && defined( TCP_KEEPIDLE ) && \
#if ( defined(__linux__) || defined(__GNU__) ) && defined( TCP_KEEPIDLE ) && \
defined( TCP_KEEPINTVL ) && defined( TCP_KEEPCNT )

param = DefaultTCPKeepAliveTime;
Expand Down
2 changes: 1 addition & 1 deletion src/XrdCl/XrdClSocket.cc
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ namespace XrdCl
//--------------------------------------------------------------------------
// We use send with MSG_NOSIGNAL to avoid SIGPIPEs on Linux
//--------------------------------------------------------------------------
#ifdef __linux__
#if defined(__linux__) || defined(__GNU__)
int status = ::send( pSocket, buffer, size, MSG_NOSIGNAL );
#else
int status = ::write( pSocket, buffer, size );
Expand Down
1 change: 1 addition & 0 deletions src/XrdCl/XrdClTaskManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ namespace XrdCl
// Enable the cancelation and go to sleep
//------------------------------------------------------------------------
pthread_setcancelstate( PTHREAD_CANCEL_ENABLE, 0 );
pthread_testcancel();
XrdSysTimer::Wait( pResolution*1000 );
}
}
Expand Down
7 changes: 2 additions & 5 deletions src/XrdClient/XrdClientSock.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,6 @@
#include "XrdSys/XrdWin32.hh"
#endif

#ifdef __FreeBSD__
#include <sys/types.h>
#endif

#if __cplusplus >= 201103L
#define XRDCL_SMART_PTR_T std::unique_ptr
#else
Expand Down Expand Up @@ -460,7 +456,8 @@ int XrdClientSock::TryConnect_low(bool isUnix, int altport, int windowsz)
if( XrdNetSocket::setOpts( sock, XRDNET_KEEPALIVE, 0 ) != 0 )
Error( "ClientSock::TryConnect_low", "Unable to set the TCP Keep Alive option" );

#if defined(__linux__) && defined( TCP_KEEPIDLE ) && defined( TCP_KEEPINTVL ) && defined( TCP_KEEPCNT )
#if ( defined(__linux__) || defined(__GNU__) ) && defined( TCP_KEEPIDLE ) && \
defined( TCP_KEEPINTVL ) && defined( TCP_KEEPCNT )

int val = EnvGetLong( NAME_TCP_KEEPALIVE_TIME );
if( setsockopt( sock, SOL_TCP, TCP_KEEPIDLE, (char *)&val, sizeof( val ) ) < 0 )
Expand Down
19 changes: 16 additions & 3 deletions src/XrdCms/XrdCmsLogin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
/******************************************************************************/

#include <netinet/in.h>
#include <unistd.h>

#include "XProtocol/YProtocol.hh"

Expand Down Expand Up @@ -210,6 +211,18 @@ int XrdCmsLogin::sendData(XrdLink *Link, CmsLoginData &Data)
char Work[xNum*12];
struct iovec Liov[xNum];
CmsRRHdr Resp={0, kYR_login, 0, 0};
static int iovmax = -1;
if (iovmax == -1) {
#ifdef _SC_IOV_MAX
iovmax = sysconf(_SC_IOV_MAX);
if (iovmax == -1)
#endif
#ifdef IOV_MAX
iovmax = IOV_MAX;
#else
iovmax = 1024;
#endif
}

// Pack the response (ignore the auth token for now)
//
Expand All @@ -225,11 +238,11 @@ int XrdCmsLogin::sendData(XrdLink *Link, CmsLoginData &Data)
// Send off the data *break it up to IOV_MAX chunks, mostly for Solaris)
//
n = 0; iovcnt++;
if (iovcnt <= IOV_MAX) Link->Send(Liov, iovcnt);
if (iovcnt <= iovmax) Link->Send(Liov, iovcnt);
else while(iovcnt > 0)
{iovnum = (iovcnt > IOV_MAX ? IOV_MAX : iovcnt);
{iovnum = (iovcnt > iovmax ? iovmax : iovcnt);
Link->Send(&Liov[n], iovnum);
n += IOV_MAX; iovcnt -= IOV_MAX;
n += iovmax; iovcnt -= iovmax;
}

// Return success
Expand Down
2 changes: 1 addition & 1 deletion src/XrdDig/XrdDigFS.cc
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ const char *XrdDigDirectory::nextEntry()

// Read the next directory entry
//
#ifdef __linux__
#if defined(__linux__) || defined(__GNU__)
do{errno = 0;
rp = readdir(dh);
if (!rp)
Expand Down
1 change: 1 addition & 0 deletions src/XrdFrm/XrdFrmAdmin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
#include "XrdOuc/XrdOucTList.hh"
#include "XrdOuc/XrdOucTokenizer.hh"
#include "XrdSys/XrdSysE2T.hh"
#include "XrdSys/XrdSysPlatform.hh"
#include "XrdSys/XrdSysTimer.hh"

using namespace XrdFrc;
Expand Down
1 change: 1 addition & 0 deletions src/XrdFrm/XrdFrmAdminUnlink.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
#include "XrdOss/XrdOss.hh"
#include "XrdOss/XrdOssPath.hh"
#include "XrdOuc/XrdOucNSWalk.hh"
#include "XrdSys/XrdSysPlatform.hh"

using namespace XrdFrc;
using namespace XrdFrm;
Expand Down
1 change: 1 addition & 0 deletions src/XrdFrm/XrdFrmCns.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
#include "XrdFrm/XrdFrmConfig.hh"
#include "XrdOuc/XrdOucSxeq.hh"
#include "XrdOuc/XrdOucUtils.hh"
#include "XrdSys/XrdSysPlatform.hh"
#include "XrdSys/XrdSysPthread.hh"
#include "XrdSys/XrdSysTimer.hh"

Expand Down
1 change: 1 addition & 0 deletions src/XrdFrm/XrdFrmXfrJob.hh
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

#include <sys/param.h>
#include "XrdFrc/XrdFrcRequest.hh"
#include "XrdSys/XrdSysPlatform.hh"

class XrdFrcReqFile;
class XrdOucTList;
Expand Down