Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
dCache
cta
Commits
867f5d98
Commit
867f5d98
authored
Jul 09, 2015
by
Steven Murray
Browse files
Added Utils::serrnoToString()
parent
32336b6f
Changes
3
Hide whitespace changes
Inline
Side-by-side
common/CMakeLists.txt
View file @
867f5d98
cmake_minimum_required
(
VERSION 2.6
)
include_directories
(
/usr/include/shift
)
set
(
COMMON_LIB_SRC_FILES
ArchiveDirEntry.cpp
ArchiveDirIterator.cpp
...
...
@@ -25,8 +27,9 @@ add_library (ctacommon SHARED
${
COMMON_LIB_SRC_FILES
}
)
target_link_libraries
(
ctacommon
${
SQLITE3_LIBRARY_RELEASE
}
castorcommon
pthread
${
SQLITE3_LIBRARY_RELEASE
}
uuid
)
set
(
COMMON_UNIT_TESTS_LIB_SRC_FILES
...
...
common/Utils.cpp
View file @
867f5d98
...
...
@@ -22,6 +22,7 @@
#include
<attr/xattr.h>
#include
<memory>
#include
<shift/serrno.h>
#include
<sstream>
#include
<stdlib.h>
#include
<strings.h>
...
...
@@ -325,6 +326,21 @@ std::string cta::Utils::errnoToString(const int errnoValue) throw() {
}
}
//------------------------------------------------------------------------------
// serrnoToString
//------------------------------------------------------------------------------
std
::
string
cta
::
Utils
::
serrnoToString
(
const
int
serrnoValue
)
throw
()
{
char
buf
[
100
];
if
(
!
sstrerror_r
(
serrnoValue
,
buf
,
sizeof
(
buf
)))
{;
return
buf
;
}
else
{
std
::
ostringstream
oss
;
oss
<<
"Failed to convert serrnoValue to string"
": sstrerror_r returned -1: serrnoValue="
<<
serrnoValue
;
return
oss
.
str
();
}
}
//------------------------------------------------------------------------------
// toUint16
//------------------------------------------------------------------------------
...
...
common/Utils.hpp
View file @
867f5d98
...
...
@@ -162,6 +162,18 @@ public:
*/
static
std
::
string
errnoToString
(
const
int
errnoValue
)
throw
();
/**
* Determines the string representation of the specified SHIFT/CASTOR error
* number.
*
* Please note this method is thread safe.
*
* @param serrnoValue The serrno value.
* @return The string representation of the specified SHIFT/CASTOR error
* number.
*/
std
::
string
serrnoToString
(
const
int
serrnoValue
)
throw
();
/**
* Converts the specified string to an unsigned integer.
*
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment