Commit 76ad5f3a authored by Eric Cano's avatar Eric Cano
Browse files

Catching up with master branch

parents 58bf6de4 f280dff9
......@@ -27,7 +27,17 @@ cmake_minimum_required (VERSION 2.6)
project(castor)
set(CMAKE_BUILD_TYPE Debug)
IF(DEFINED CMAKE_BUILD_TYPE)
# If the user specifies -DCMAKE_BUILD_TYPE on the command line, take their definition and dump it in the cache
SET(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "Choose the type of build.")
ELSE()
# log choosen default (RelWithDebInfo) and set it
message(STATUS "Setting build type to 'Debug' as none was specified.")
message (STATUS "Override with -DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo")
set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build." FORCE)
# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
ENDIF(DEFINED CMAKE_BUILD_TYPE)
if ("${CMAKE_SOURCE_DIR}" MATCHES "${CMAKE_BINARY_DIR}")
message (SEND_ERROR "In source building not supported. Please run something like: \"mkdir ../build; ( src=`pwd`; cd ../build; cmake $src ); make -C ../build\"")
......
......@@ -282,9 +282,7 @@ if (${COMPILE_SERVER} STREQUAL "1")
CastorInstallExample (castor.conf /etc/castor)
CastorInstallExample (rsyslog.conf.client /etc/castor)
CastorInstallExample (rsyslog.conf.server /etc/castor)
endif (${COMPILE_SERVER} STREQUAL "1")
if (${COMPILE_SERVER} STREQUAL "1")
################################################################################
# Installation of header files for package castor-build-headers
################################################################################
......@@ -321,9 +319,14 @@ if (${COMPILE_SERVER} STREQUAL "1")
exception/Exception.hpp
exception/Internal.hpp
exception/InvalidNbArguments.hpp
exception/AlreadyInitialized.hpp
exception/InvalidArgument.hpp
exception/NoEntry.hpp
exception/OutOfMemory.hpp
exception/SQLError.hpp
DESTINATION ${CASTOR_DEST_CPP_HEADERS_DIR}/exception
PERMISSIONS ${CASTOR_HEADER_PERMS})
install(FILES
io/ServerSocket.hpp
DESTINATION ${CASTOR_DEST_CPP_HEADERS_DIR}/io
......@@ -409,15 +412,6 @@ if (${COMPILE_SERVER} STREQUAL "1")
DESTINATION ${CASTOR_DEST_CPP_HEADERS_DIR}/db/ora
PERMISSIONS ${CASTOR_HEADER_PERMS})
install(FILES
exception/AlreadyInitialized.hpp
exception/InvalidArgument.hpp
exception/NoEntry.hpp
exception/OutOfMemory.hpp
exception/SQLError.hpp
DESTINATION ${CASTOR_DEST_CPP_HEADERS_DIR}/exception
PERMISSIONS ${CASTOR_HEADER_PERMS})
install(FILES
io/ClientSocket.hpp
DESTINATION ${CASTOR_DEST_CPP_HEADERS_DIR}/io
......
......@@ -391,7 +391,7 @@ EXCEPTION WHEN OTHERS THEN
END;
/
/* A wrapper procedure to execute alertSignalNoLock() without taking a lock if
/* A wrapper procedure to execute DBMS_ALERT.SIGNAL() without taking a lock if
* already another session did it. Helps reducing contention on DBMS_ALERT_INFO.
*/
CREATE OR REPLACE PROCEDURE alertSignalNoLock(inName IN VARCHAR2) AS
......
......@@ -217,8 +217,9 @@ AS
LVL_DEBUG CONSTANT PLS_INTEGER := 7; /* LOG_DEBUG Debug-level messages */
/* messages */
FILE_DROPPED_BY_CLEANING CONSTANT VARCHAR2(2048) := 'File was dropped by internal cleaning';
PUTDONE_ENFORCED_BY_CLEANING CONSTANT VARCHAR2(2048) := 'PutDone enforced by internal cleaning';
FILE_DROPPED_BY_CLEANING CONSTANT VARCHAR2(2048) := 'deleteOutOfDateStageOutDCs: File was dropped by internal cleaning';
PUTDONE_ENFORCED_BY_CLEANING CONSTANT VARCHAR2(2048) := 'deleteOutOfDateStageOutDCs: PutDone enforced by internal cleaning';
DELETING_REQUESTS CONSTANT VARCHAR2(2048) := 'deleteTerminatedRequests: Cleaning up completed requests';
DBJOB_UNEXPECTED_EXCEPTION CONSTANT VARCHAR2(2048) := 'Unexpected exception caught in DB job';
......
......@@ -592,11 +592,10 @@ END;
/
/* A generic method to delete requests of a given type */
CREATE OR REPLACE Procedure bulkDeleteRequests(reqType IN VARCHAR, timeOut IN INTEGER) AS
CREATE OR REPLACE Procedure bulkDeleteRequests(reqType IN VARCHAR) AS
BEGIN
bulkDelete('SELECT id FROM '|| reqType ||' R WHERE
NOT EXISTS (SELECT 1 FROM SubRequest WHERE request = R.id) AND lastModificationTime < getTime() - '
|| timeOut ||';',
NOT EXISTS (SELECT 1 FROM SubRequest WHERE request = R.id);',
reqType);
END;
/
......@@ -604,31 +603,47 @@ END;
/* Search and delete old archived/failed subrequests and their requests */
CREATE OR REPLACE PROCEDURE deleteTerminatedRequests AS
timeOut INTEGER;
rateDependentTimeOut INTEGER;
rate INTEGER;
srIds "numList";
ct NUMBER;
BEGIN
-- select requested timeout from configuration table
timeout := 3600*TO_NUMBER(getConfigOption('cleaning', 'terminatedRequestsTimeout', '120'));
-- get a rough estimate of the current request processing rate
SELECT count(*) INTO rate
timeOut := 3600*TO_NUMBER(getConfigOption('cleaning', 'terminatedRequestsTimeout', '120'));
-- compute a rate-dependent timeout for the successful requests by looking at the
-- last half-hour of activity: keep max 1M of them regardless the above configured timeOut.
SELECT 1800 * 1000000 / (count(*)+1) INTO rateDependentTimeOut
FROM SubRequest
WHERE status IN (9, 11) -- FAILED_FINISHED, ARCHIVED
WHERE status = dconst.SUBREQUEST_ARCHIVED
AND lastModificationTime > getTime() - 1800;
IF rate > 0 AND (1000000 / rate * 1800) < timeOut THEN
timeOut := 1000000 / rate * 1800; -- keep 1M requests max
IF rateDependentTimeOut > timeOut THEN
rateDependentTimeOut := timeOut;
END IF;
-- delete castorFiles if nothing is left for them. Here we use
-- Delete castorFiles if nothing is left for them. Here we use
-- a temporary table as we need to commit every ~1000 operations
-- and keeping a cursor opened on the original select may take
-- too long, leading to ORA-01555 'snapshot too old' errors.
EXECUTE IMMEDIATE 'TRUNCATE TABLE DeleteTermReqHelper';
INSERT /*+ APPEND */ INTO DeleteTermReqHelper (srId, cfId)
(SELECT id, castorFile FROM SubRequest
WHERE status IN (9, 11)
AND lastModificationTime < getTime() - timeOut);
(SELECT SR.id, castorFile FROM SubRequest SR
WHERE (SR.status = dconst.SUBREQUEST_ARCHIVED
AND SR.lastModificationTime < getTime() - rateDependentTimeOut)
-- failed subrequests are kept according to the configured timeout
OR (SR.status = dconst.SUBREQUEST_FAILED_FINISHED
AND reqType != 119 AND SR.lastModificationTime < getTime() - timeOut)); -- StageRepackRequest
-- 2nd part, separated from above for efficiency reasons
INSERT /*+ APPEND */ INTO DeleteTermReqHelper (srId, cfId)
(SELECT SR.id, castorFile FROM SubRequest SR, StageRepackRequest R
WHERE SR.status = dconst.SUBREQUEST_FAILED_FINISHED
-- only for the Repack case, we keep all failed subrequests around until
-- the whole Repack request is over for more than <timeOut> seconds
AND reqType = 119 AND R.lastModificationTime < getTime() - timeOut -- StageRepackRequest
AND R.id = SR.request);
COMMIT;
SELECT count(*) INTO ct FROM DeleteTermReqHelper;
logToDLF(NULL, dlf.LVL_SYSTEM, dlf.DELETING_REQUESTS, 0, '', 'stagerd',
'SubRequestsCount=' || ct);
ct := 0;
FOR cf IN (SELECT UNIQUE cfId FROM DeleteTermReqHelper) LOOP
deleteCastorFile(cf.cfId);
......@@ -639,7 +654,7 @@ BEGIN
END IF;
END LOOP;
-- now delete all old subRequest. We reuse here the
-- Now delete all old subRequests. We reuse here the
-- temporary table, which serves as a snapshot of the
-- entries to be deleted, and we use the FORALL logic
-- (cf. bulkDelete) instead of a simple DELETE ...
......@@ -666,30 +681,33 @@ BEGIN
EXECUTE IMMEDIATE 'TRUNCATE TABLE DeleteTermReqHelper';
-- And then related Requests, now orphaned.
-- The timeout makes sure we keep very recent requests,
-- even if they have no subrequests. This may actually
-- be the case only for Repack requests, as they're
-- created empty and filled after querying the NS.
---- Get ----
bulkDeleteRequests('StageGetRequest', timeOut);
bulkDeleteRequests('StageGetRequest');
---- Put ----
bulkDeleteRequests('StagePutRequest', timeOut);
bulkDeleteRequests('StagePutRequest');
---- Update ----
bulkDeleteRequests('StageUpdateRequest', timeOut);
bulkDeleteRequests('StageUpdateRequest');
---- PrepareToGet -----
bulkDeleteRequests('StagePrepareToGetRequest', timeOut);
bulkDeleteRequests('StagePrepareToGetRequest');
---- PrepareToPut ----
bulkDeleteRequests('StagePrepareToPutRequest', timeOut);
bulkDeleteRequests('StagePrepareToPutRequest');
---- PrepareToUpdate ----
bulkDeleteRequests('StagePrepareToUpdateRequest', timeOut);
bulkDeleteRequests('StagePrepareToUpdateRequest');
---- PutDone ----
bulkDeleteRequests('StagePutDoneRequest', timeOut);
bulkDeleteRequests('StagePutDoneRequest');
---- Rm ----
bulkDeleteRequests('StageRmRequest', timeOut);
---- Repack ----
bulkDeleteRequests('StageRepackRequest', timeOut);
bulkDeleteRequests('StageRmRequest');
---- SetGCWeight ----
bulkDeleteRequests('SetFileGCWeight', timeOut);
bulkDeleteRequests('SetFileGCWeight');
-- Finally deal with Repack: this case is different because StageRepackRequests may be empty
-- at the beginning. Therefore we only drop repacks that are in a completed state
-- for more than <timeOut> seconds. FINISHED, FAILED, ABORTED
bulkDelete('SELECT id FROM StageRepackRequest R WHERE status IN (2, 3, 5)
AND NOT EXISTS (SELECT 1 FROM SubRequest WHERE request = R.id)
AND lastModificationTime < getTime() - ' || timeOut,
'StageRepackRequest');
END;
/
......
......@@ -28,6 +28,15 @@
#include <stdlib.h>
#include "Backtrace.hpp"
#ifdef COLLECTEXTRABACKTRACEINFOS
// Forward declaration for extracting more information in the backtraces
namespace castor {
namespace exception {
std::string collectExtraInfos(const std::string &address);
}
}
#endif // COLLECTEXTRABACKTRACEINFOS
castor::exception::Backtrace::Backtrace(): m_trace() {
void * array[200];
g_lock.lock();
......@@ -44,21 +53,27 @@ castor::exception::Backtrace::Backtrace(): m_trace() {
* between a '(' and a +
* line format: /usr/lib/somelib.so.1(_Mangle2Mangle3Ev+0x123) [0x12345] */
if ((std::string::npos != line.find("(")) && (std::string::npos != line.find("+"))) {
std::string before, theFunc, after;
std::string before, theFunc, after, addr;
before = line.substr(0, line.find("(")+1);
theFunc = line.substr(line.find("(")+1, line.find("+") - (line.find("(") + 1));
after = line.substr(line.find("+"), std::string::npos);
theFunc = line.substr(line.find("(")+1, line.find("+")-line.find("(")-1);
after = line.substr(line.find("+"), line.find("[")-line.find("+")+1);
addr = line.substr(line.find("[")+1, line.find("]")-line.find("[")-1);
int status(-1);
char * demangled = abi::__cxa_demangle(theFunc.c_str(), NULL, NULL, &status);
if (0 == status) {
m_trace += before;
m_trace += demangled;
m_trace += after;
m_trace += "\n";
#ifdef COLLECTEXTRABACKTRACEINFOS
m_trace += collectExtraInfos(addr);
#else
m_trace += addr;
#endif // COLLECTEXTRABACKTRACEINFOS
m_trace += "]";
} else {
m_trace += strings[i];
m_trace += "\n";
}
m_trace += "\n";
free(demangled);
} else {
m_trace += strings[i];
......@@ -71,3 +86,73 @@ castor::exception::Backtrace::Backtrace(): m_trace() {
/* Implementation of the singleton lock */
castor::exception::Backtrace::mutex castor::exception::Backtrace::g_lock;
#ifdef COLLECTEXTRABACKTRACEINFOS
/// code dedicated to extracting more information in the backtraces, typically
/// resolving line numbers from adresses
/// This code is compiled only in debug mode (where COLLECTEXTRABACKTRACEINFOS will be defined)
/// as it's pretty heavy
#include <bfd.h>
#include <sstream>
namespace castor {
namespace exception {
/// code dedicated to collecting extra infos on the backtrace (typically line numbers)
/// compiled only in debug mode (where RESOLVELINENUMBERS will be defined)
/// as it's pretty heavy
static bfd* s_abfd = 0;
static asymbol **s_syms = 0;
static asection *s_text = 0;
static pthread_mutex_t s_mutex;
static bool s_mutex_is_initialized = false;
std::string collectExtraInfos(const std::string &address) {
std::ostringstream result;
// if mutex not yet initilize, initialize it
if (!s_mutex_is_initialized) {
pthread_mutex_init(&s_mutex, NULL);
s_mutex_is_initialized = true;
}
pthread_mutex_lock(&s_mutex);
// if debug symbols were not yet analyzed, let's do it
if (!s_abfd) {
char ename[1024];
int l = readlink("/proc/self/exe",ename,sizeof(ename));
if (l != -1) {
ename[l] = 0;
bfd_init();
s_abfd = bfd_openr(ename, 0);
if (s_abfd) {
/* oddly, this is required for it to work... */
bfd_check_format(s_abfd,bfd_object);
unsigned storage_needed = bfd_get_symtab_upper_bound(s_abfd);
s_syms = (asymbol **) malloc(storage_needed);
bfd_canonicalize_symtab(s_abfd, s_syms);
s_text = bfd_get_section_by_name(s_abfd, ".text");
}
}
}
if (s_abfd && s_text && s_syms) {
std::stringstream ss;
long offset;
ss << std::hex << address;
ss >> offset;
offset -= s_text->vma;
if (offset > 0) {
const char *file;
const char *func;
unsigned line;
if (bfd_find_nearest_line(s_abfd, s_text, s_syms, offset, &file, &func, &line) && file) {
int status(-1);
char * demangledFunc = abi::__cxa_demangle(func, NULL, NULL, &status);
result << "line " << line << " of file " << file
<< " in " << (status?func:demangledFunc) << " (" << address << ")";
}
}
}
pthread_mutex_unlock(&s_mutex);
return result.str();
}
}
}
#endif // COLLECTEXTRABACKTRACEINFOS
......@@ -33,7 +33,7 @@
// constructor
//------------------------------------------------------------------------------
castor::server::MultiThreadedDaemon::MultiThreadedDaemon(log::Logger &logger):
Daemon(logger) {
Daemon(logger), m_signalMutex(NULL) {
}
//------------------------------------------------------------------------------
......@@ -186,6 +186,16 @@ void castor::server::MultiThreadedDaemon::start()
//------------------------------------------------------------------------------
void castor::server::MultiThreadedDaemon::setupMultiThreadedSignalHandling()
throw (castor::exception::Internal) {
// Initialize mutex variable in case of a signal. Timeout = 10 seconds
try {
m_signalMutex = new Mutex(0);
} catch(castor::exception::Internal &ie) {
castor::exception::Internal ex;
ex.getMessage() << "Failed to create m_signalMutex: " <<
ie.getMessage().str();
throw ex;
}
// Mask all signals so that user threads are not unpredictably
// interrupted by them
sigemptyset(&m_signalSet);
......
......@@ -47,7 +47,7 @@
//------------------------------------------------------------------------------
castor::tape::tapebridge::TapeBridgeDaemon::TapeBridgeDaemon(
log::Logger &logger) throw(castor::exception::Exception) :
castor::server::BaseDaemon(logger),
castor::server::MultiThreadedDaemon(logger),
m_vdqmRequestHandlerThreadPool(0) {
}
......@@ -69,7 +69,7 @@ int castor::tape::tapebridge::TapeBridgeDaemon::main(const int argc,
// to stderr if the initialization fails
try {
castor::server::BaseServer::dlfInit(s_dlfMessages);
castor::server::Daemon::dlfInit(s_dlfMessages);
} catch(castor::exception::Exception &ex) {
std::cerr << std::endl <<
......
......@@ -27,7 +27,7 @@
#include "castor/exception/Exception.hpp"
#include "castor/exception/InvalidConfigEntry.hpp"
#include "castor/server/BaseDaemon.hpp"
#include "castor/server/MultiThreadedDaemon.hpp"
#include "castor/server/BaseThreadPool.hpp"
#include "castor/tape/tapebridge/BulkRequestConfigParams.hpp"
#include "castor/tape/tapebridge/TapeFlushConfigParams.hpp"
......@@ -47,7 +47,7 @@ namespace tapebridge {
* The daemon which acts as a protocol bridge between the tape-gateway daemon
* and the legacy rtcpd daemon.
*/
class TapeBridgeDaemon : public castor::server::BaseDaemon {
class TapeBridgeDaemon : public castor::server::MultiThreadedDaemon {
public:
......
......@@ -67,6 +67,10 @@ set (COMMON_LIB_SRC_FILES
../castor/common/CastorConfiguration.cpp)
add_library (castorcommon SHARED ${COMMON_LIB_SRC_FILES})
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set_property(SOURCE ../castor/exception/Backtrace.cpp APPEND PROPERTY COMPILE_FLAGS -DCOLLECTEXTRABACKTRACEINFOS)
endif(CMAKE_BUILD_TYPE STREQUAL "Debug")
target_link_libraries(castorcommon debug bfd)
CastorSetLibraryVersions (castorcommon)
target_link_libraries (castorcommon dl ${UUID_LIB})
install (TARGETS castorcommon DESTINATION ${CASTOR_DEST_LIB_DIR})
......
......@@ -231,7 +231,7 @@ void Cglobals_getTid(int *Tid)
int *C__serrno() {
int rc;
int *addr;
void *addr;
if ( local_setspec == NULL ) {
return(&serrno);
......@@ -240,10 +240,10 @@ int *C__serrno() {
/*
* We re-use the old single thread serrno as key
*/
rc = local_getspec(&serrno,(void **)&addr);
rc = local_getspec(&serrno,&addr);
if ( rc == -1 || addr == NULL ) {
addr = (int *)calloc(1,sizeof(int));
rc = local_setspec(&serrno,(void *)addr);
rc = local_setspec(&serrno,addr);
}
/*
* If memory allocation failed, we can still
......@@ -259,7 +259,7 @@ int *C__serrno() {
int *C__rfio_errno() {
int rc;
int *addr;
void *addr;
if ( local_setspec == NULL ) {
return(&rfio_errno);
......@@ -268,10 +268,10 @@ int *C__rfio_errno() {
/*
* We re-use the old single thread rfio_errno as key
*/
rc = local_getspec(&rfio_errno,(void **)&addr);
rc = local_getspec(&rfio_errno,&addr);
if ( rc == -1 || addr == NULL ) {
addr = (int *)calloc(1,sizeof(int));
rc = local_setspec(&rfio_errno,(void *)addr);
rc = local_setspec(&rfio_errno,addr);
}
/*
* If memory allocation failed, we can still
......@@ -287,7 +287,7 @@ int *C__rfio_errno() {
int *C__Copterr() {
int rc;
int *addr;
void *addr;
if ( local_setspec == NULL ) {
return(&Copterr);
......@@ -296,10 +296,10 @@ int *C__Copterr() {
/*
* We re-use the old single thread Copterr as key
*/
rc = local_getspec(&Copterr,(void **)&addr);
rc = local_getspec(&Copterr,&addr);
if ( rc == -1 || addr == NULL ) {
addr = (int *)calloc(1,sizeof(int));
rc = local_setspec(&Copterr,(void *)addr);
rc = local_setspec(&Copterr,addr);
}
/*
* If memory allocation failed, we can still
......@@ -315,7 +315,7 @@ int *C__Copterr() {
int *C__Coptind() {
int rc;
int *addr;
void *addr;
if ( local_setspec == NULL ) {
return(&Coptind);
......@@ -324,10 +324,10 @@ int *C__Coptind() {
/*
* We re-use the old single thread rfio_errno as key
*/
rc = local_getspec(&Coptind,(void **)&addr);
rc = local_getspec(&Coptind,&addr);
if ( rc == -1 || addr == NULL ) {
addr = (int *)calloc(1,sizeof(int));
rc = local_setspec(&Coptind,(void *)addr);
rc = local_setspec(&Coptind,addr);
}
/*
* If memory allocation failed, we can still
......@@ -343,7 +343,7 @@ int *C__Coptind() {
int *C__Coptopt() {
int rc;
int *addr;
void *addr;
if ( local_setspec == NULL ) {
return(&Coptopt);
......@@ -352,10 +352,10 @@ int *C__Coptopt() {
/*
* We re-use the old single thread rfio_errno as key
*/
rc = local_getspec(&Coptopt,(void **)&addr);
rc = local_getspec(&Coptopt,&addr);
if ( rc == -1 || addr == NULL ) {
addr = (int *)calloc(1,sizeof(int));
rc = local_setspec(&Coptopt,(void *)addr);
rc = local_setspec(&Coptopt,addr);
}
/*
* If memory allocation failed, we can still
......@@ -371,7 +371,7 @@ int *C__Coptopt() {
int *C__Coptreset() {
int rc;
int *addr;
void *addr;
if ( local_setspec == NULL ) {
return(&Coptreset);
......@@ -380,10 +380,10 @@ int *C__Coptreset() {
/*
* We re-use the old single thread rfio_errno as key
*/
rc = local_getspec(&Coptreset,(void **)&addr);
rc = local_getspec(&Coptreset,&addr);
if ( rc == -1 || addr == NULL ) {
addr = (int *)calloc(1,sizeof(int));
rc = local_setspec(&Coptreset,(void *)addr);
rc = local_setspec(&Coptreset,addr);
}
/*
* If memory allocation failed, we can still
......@@ -399,7 +399,7 @@ int *C__Coptreset() {
char **C__Coptarg() {
int rc;
char **addr;
void *addr;
if ( local_setspec == NULL ) {
return(&Coptarg);
......@@ -408,10 +408,10 @@ char **C__Coptarg() {
/*
* We re-use the old single thread rfio_errno as key
*/
rc = local_getspec(&Coptarg_key,(void **)&addr);
rc = local_getspec(&Coptarg_key,&addr);
if ( rc == -1 || addr == NULL ) {
addr = (char **)calloc(1,sizeof(char *));
rc = local_setspec(&Coptarg_key,(void *)addr);
rc = local_setspec(&Coptarg_key,addr);
}
/*
* If memory allocation failed, we can still
......
......@@ -29,14 +29,14 @@ const char *name;
*/
static int grp_key = -1;
static int grpbuf_key = -1;
struct group *grp = NULL;
void *grp = NULL;
struct group *result = NULL;
char *grpbuf = NULL;
void *grpbuf = NULL;
size_t grpbuflen = BUFSIZ;
int rc;
Cglobals_get(&grp_key,(void **)&grp,sizeof(struct group));
Cglobals_get(&grpbuf_key,(void **)&grpbuf,grpbuflen);
Cglobals_get(&grp_key,&grp,sizeof(struct group));
Cglobals_get(&grpbuf_key,&grpbuf,grpbuflen);
if ( grp == NULL || grpbuf == NULL ) {
serrno = SEINTERNAL;
......@@ -60,14 +60,14 @@ gid_t gid;
*/
static int grp_key = -1;
static int grpbuf_key = -1;
struct group *grp = NULL;
void *grp = NULL;
struct group *result = NULL;
char *grpbuf = NULL;
void *grpbuf = NULL;
size_t grpbuflen = BUFSIZ;
int rc;
Cglobals_get(&grp_key,(void **)&grp,sizeof(struct group));
Cglobals_get(&grpbuf_key,(void **)&grpbuf,grpbuflen);
Cglobals_get(&grp_key,&grp,sizeof(struct group));
Cglobals_get(&grpbuf_key,&grpbuf,grpbuflen);
if ( grp == NULL || grpbuf == NULL ) {
serrno = SEINTERNAL;
......
......@@ -33,15 +33,15 @@ const char *name;
static int hostdata_key = -1;
int rc;
struct hostent *hp;
struct hostent *result = (struct hostent *)NULL;
char *buffer = (char *)NULL;
void *result = NULL;
void *buffer = NULL;
int bufsize = 1024;
int h_errnoop = 0;