Author: kpvdr
Date: 2008-05-21 11:12:59 -0400 (Wed, 21 May 2008)
New Revision: 2075
Modified:
store/trunk/cpp/lib/jrnl/file_hdr.hpp
store/trunk/cpp/lib/jrnl/jcntl.cpp
store/trunk/cpp/lib/jrnl/jdir.cpp
store/trunk/cpp/lib/jrnl/nlfh.cpp
store/trunk/cpp/lib/jrnl/pmgr.cpp
store/trunk/cpp/lib/jrnl/rmgr.cpp
store/trunk/cpp/lib/jrnl/wmgr.cpp
Log:
Changed all error messages involving std::errno to use the FORMAT_SYSERR macro in
jexception to give more helpful error messages.
Modified: store/trunk/cpp/lib/jrnl/file_hdr.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/file_hdr.hpp 2008-05-20 22:27:45 UTC (rev 2074)
+++ store/trunk/cpp/lib/jrnl/file_hdr.hpp 2008-05-21 15:12:59 UTC (rev 2075)
@@ -177,7 +177,7 @@
if (::clock_gettime(CLOCK_REALTIME, &ts))
{
std::ostringstream oss;
- oss << "errno=" << errno;
+ oss << FORMAT_SYSERR(errno);
throw jexception(jerrno::JERR__RTCLOCK, oss.str(), "file_hdr",
"set_time");
}
_ts_sec = ts.tv_sec;
Modified: store/trunk/cpp/lib/jrnl/jcntl.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jcntl.cpp 2008-05-20 22:27:45 UTC (rev 2074)
+++ store/trunk/cpp/lib/jrnl/jcntl.cpp 2008-05-21 15:12:59 UTC (rev 2075)
@@ -501,7 +501,7 @@
if (::clock_gettime(CLOCK_REALTIME, &ts))
{
std::ostringstream oss;
- oss << "errno=" << errno;
+ oss << FORMAT_SYSERR(errno);
throw jexception(jerrno::JERR__RTCLOCK, oss.str(), "jcntl",
"write_infofile");
}
jinf ji(_jid, _jdir.dirname(), _base_filename, _num_jfiles, _jfsize_sblks,
Modified: store/trunk/cpp/lib/jrnl/jdir.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jdir.cpp 2008-05-20 22:27:45 UTC (rev 2074)
+++ store/trunk/cpp/lib/jrnl/jdir.cpp 2008-05-21 15:12:59 UTC (rev 2075)
@@ -86,7 +86,7 @@
if (::mkdir(dirname.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH))
{
std::ostringstream oss;
- oss << "dir=\"" << dirname << "\"
errno=" << errno;
+ oss << "dir=\"" << dirname <<
"\"" << FORMAT_SYSERR(errno);
throw jexception(jerrno::JERR_JDIR_MKDIR, oss.str(), "jdir",
"create_dir");
}
}
@@ -124,7 +124,7 @@
return;
}
std::ostringstream oss;
- oss << "dir=\"" << dirname << "\"
errno=" << errno;
+ oss << "dir=\"" << dirname <<
"\"" << FORMAT_SYSERR(errno);
throw jexception(jerrno::JERR_JDIR_OPENDIR, oss.str(), "jdir",
"clear_dir");
}
#ifndef RHM_JOWRITE
@@ -153,7 +153,7 @@
{
std::ostringstream oss;
oss << "file=\"" << oldname.str()
<< "\" dest=\"" <<
- newname.str() << "\" errno="
<< errno;
+ newname.str() << "\"" <<
FORMAT_SYSERR(errno);
throw jexception(jerrno::JERR_JDIR_FMOVE, oss.str(),
"jdir", "clear_dir");
}
}
@@ -165,7 +165,7 @@
// if (errno)
// {
// std::ostringstream oss;
-// oss << "dir=\"" << dirname << "\"
errno=" << errno;
+// oss << "dir=\"" << dirname <<
"\"" << FORMAT_SYSERR(errno);
// ::closedir(dir); // Try to close, it makes no sense to trap errors here...
// throw jexception(jerrno::JERR_JDIR_READDIR, oss.str(), "jdir",
"clear_dir");
// }
@@ -173,7 +173,7 @@
if (::closedir(dir))
{
std::ostringstream oss;
- oss << "dir=\"" << dirname << "\"
errno=" << errno;
+ oss << "dir=\"" << dirname <<
"\"" << FORMAT_SYSERR(errno);
throw jexception(jerrno::JERR_JDIR_CLOSEDIR, oss.str(), "jdir",
"clear_dir");
}
}
@@ -244,7 +244,7 @@
return;
std::ostringstream oss;
- oss << "dir=\"" << dirname << "\"
errno=" << errno;
+ oss << "dir=\"" << dirname <<
"\"" << FORMAT_SYSERR(errno);
throw jexception(jerrno::JERR_JDIR_OPENDIR, oss.str(), "jdir",
"delete_dir");
}
else
@@ -258,7 +258,7 @@
if (::stat(full_name.c_str(), &s))
{
std::ostringstream oss;
- oss << "stat: file=\"" << full_name
<< "\" errno=" << errno;
+ oss << "stat: file=\"" << full_name
<< "\"" << FORMAT_SYSERR(errno);
throw jexception(jerrno::JERR_JDIR_STAT, oss.str(), "jdir",
"delete_dir");
}
// FIXME: This fn does not handle symbolic links correctly and throws up
@@ -268,7 +268,7 @@
if(::unlink(full_name.c_str()))
{
std::ostringstream oss;
- oss << "unlink: file=\"" <<
entry->d_name << "\" errno=" << errno;
+ oss << "unlink: file=\"" <<
entry->d_name << "\"" << FORMAT_SYSERR(errno);
throw jexception(jerrno::JERR_JDIR_UNLINK, oss.str(),
"jdir", "delete_dir");
}
}
@@ -290,7 +290,7 @@
// if (errno)
// {
// std::ostringstream oss;
-// oss << "dir=\"" << dirname <<
"\" errno=" << errno;
+// oss << "dir=\"" << dirname <<
"\"" << FORMAT_SYSERR(errno);
// ::closedir(dir); // Try to close, it makes no sense to trap errors
here...
// throw jexception(jerrno::JERR_JDIR_READDIR, oss.str(), "jdir",
"delete_dir");
// }
@@ -299,7 +299,7 @@
if (::closedir(dir))
{
std::ostringstream oss;
- oss << "dir=\"" << dirname << "\"
errno=" << errno;
+ oss << "dir=\"" << dirname <<
"\"" << FORMAT_SYSERR(errno);
throw jexception(jerrno::JERR_JDIR_CLOSEDIR, oss.str(), "jdir",
"delete_dir");
}
@@ -307,7 +307,7 @@
if (::rmdir(dirname.c_str()))
{
std::ostringstream oss;
- oss << "dir=\"" << dirname << "\"
errno=" << errno;
+ oss << "dir=\"" << dirname <<
"\"" << FORMAT_SYSERR(errno);
throw jexception(jerrno::JERR_JDIR_RMDIR, oss.str(), "jdir",
"delete_dir");
}
}
@@ -321,7 +321,7 @@
if (!dir)
{
std::ostringstream oss;
- oss << "dir=\"" << dirname << "\"
errno=" << errno;
+ oss << "dir=\"" << dirname <<
"\"" << FORMAT_SYSERR(errno);
throw jexception(jerrno::JERR_JDIR_OPENDIR, oss.str(), "jdir",
"create_bak_dir");
}
struct dirent* entry;
@@ -348,14 +348,14 @@
// if (errno)
// {
// std::ostringstream oss;
-// oss << "dir=\"" << dirname << "\"
errno=" << errno;
+// oss << "dir=\"" << dirname <<
"\"" << FORMAT_SYSERR(errno);
// ::closedir(dir); // Try to close, it makes no sense to trap errors here...
// throw jexception(jerrno::JERR_JDIR_READDIR, oss.str(), "jdir",
"clear_dir");
// }
if (::closedir(dir))
{
std::ostringstream oss;
- oss << "dir=\"" << dirname << "\"
errno=" << errno;
+ oss << "dir=\"" << dirname <<
"\"" << FORMAT_SYSERR(errno);
throw jexception(jerrno::JERR_JDIR_CLOSEDIR, oss.str(), "jdir",
"create_bak_dir");
}
std::ostringstream dn;
@@ -364,7 +364,7 @@
if (::mkdir(dn.str().c_str(), S_IRWXU | S_IRWXG | S_IROTH))
{
std::ostringstream oss;
- oss << "dir=\"" << dn.str() << "\"
errno=" << errno;
+ oss << "dir=\"" << dn.str() <<
"\"" << FORMAT_SYSERR(errno);
throw jexception(jerrno::JERR_JDIR_MKDIR, oss.str(), "jdir",
"create_bak_dir");
}
return std::string(dn.str());
@@ -377,7 +377,7 @@
if (::stat(name, &s))
{
std::ostringstream oss;
- oss << "file=\"" << name << "\"
errno=" << errno;
+ oss << "file=\"" << name << "\""
<< FORMAT_SYSERR(errno);
throw jexception(jerrno::JERR_JDIR_STAT, oss.str(), "jdir",
"is_dir");
}
return S_ISDIR(s.st_mode);
@@ -399,7 +399,7 @@
return false;
// Throw for any other condition
std::ostringstream oss;
- oss << "file=\"" << name << "\"
errno=" << errno;
+ oss << "file=\"" << name << "\""
<< FORMAT_SYSERR(errno);
throw jexception(jerrno::JERR_JDIR_STAT, oss.str(), "jdir",
"is_dir");
}
return true;
Modified: store/trunk/cpp/lib/jrnl/nlfh.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/nlfh.cpp 2008-05-20 22:27:45 UTC (rev 2074)
+++ store/trunk/cpp/lib/jrnl/nlfh.cpp 2008-05-21 15:12:59 UTC (rev 2075)
@@ -296,7 +296,7 @@
if (_rd_fh < 0)
{
std::ostringstream oss;
- oss << "file=\"" << _fname << "\"
errno=" << errno;
+ oss << "file=\"" << _fname <<
"\"" << FORMAT_SYSERR(errno);
throw jexception(jerrno::JERR_NLFH_OPENRD, oss.str(), "nlfh",
"open_fh");
}
_wr_fh = ::open(_fname.c_str(), O_WRONLY | O_DIRECT,
@@ -304,7 +304,7 @@
if (_wr_fh < 0)
{
std::ostringstream oss;
- oss << "file=\"" << _fname << "\"
errno=" << errno;
+ oss << "file=\"" << _fname <<
"\"" << FORMAT_SYSERR(errno);
throw jexception(jerrno::JERR_NLFH_OPENWR, oss.str(), "nlfh",
"open_fh");
}
}
@@ -356,7 +356,7 @@
{
std::ostringstream oss;
oss << ": posix_memalign() failed: size=" << nullbuffsize
<< " blk_size=" << sblksize;
- oss << " errno=" << errno;
+ oss << FORMAT_SYSERR(errno);
throw jexception(jerrno::JERR__MALLOC, oss.str(), "nlfh",
"clean_file");
}
std::memset(nullbuf, 0, nullbuffsize);
@@ -367,7 +367,7 @@
{
std::free(nullbuf);
std::ostringstream oss;
- oss << ": open() failed:" << "\" errno="
<< errno;
+ oss << ": open() failed:" << "\"" <<
FORMAT_SYSERR(errno);
throw jexception(jerrno::JERR_NLFH_OPENWR, oss.str(), "nlfh",
"clean_file");
}
@@ -379,7 +379,7 @@
::close(fh);
std::free(nullbuf);
std::ostringstream oss;
- oss << ": wr_size=" << (this_write_sblks * sblksize)
<< " errno=" << errno;
+ oss << ": wr_size=" << (this_write_sblks * sblksize)
<< FORMAT_SYSERR(errno);
throw jexception(jerrno::JERR_NLFH_WRITE, oss.str(), "nlfh",
"clean_file");
}
nsblks -= this_write_sblks;
@@ -390,7 +390,7 @@
if (::close(fh))
{
std::ostringstream oss;
- oss << ": errno=" << errno;
+ oss << FORMAT_SYSERR(errno);
throw jexception(jerrno::JERR_NLFH_CLOSE, oss.str(), "nlfh",
"clean_file");
}
}
Modified: store/trunk/cpp/lib/jrnl/pmgr.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/pmgr.cpp 2008-05-20 22:27:45 UTC (rev 2074)
+++ store/trunk/cpp/lib/jrnl/pmgr.cpp 2008-05-21 15:12:59 UTC (rev 2075)
@@ -119,7 +119,7 @@
clean();
std::ostringstream oss;
oss << "posix_memalign(): blksize=" << _sblksize <<
" size=" << cache_pgsize;
- oss << " errno=" << errno;
+ oss << FORMAT_SYSERR(errno);
throw jexception(jerrno::JERR__MALLOC, oss.str(), "pmgr",
"initialize");
}
// 2. Allocate array of page pointers
Modified: store/trunk/cpp/lib/jrnl/rmgr.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/rmgr.cpp 2008-05-20 22:27:45 UTC (rev 2074)
+++ store/trunk/cpp/lib/jrnl/rmgr.cpp 2008-05-21 15:12:59 UTC (rev 2075)
@@ -68,7 +68,7 @@
{
std::ostringstream oss;
oss << "posix_memalign(): blksize=" << _sblksize <<
" size=" << _sblksize;
- oss << " errno=" << errno;
+ oss << FORMAT_SYSERR(errno);
throw jexception(jerrno::JERR__MALLOC, oss.str(), "rmgr",
"initialize");
}
_iocbp = new iocb;
Modified: store/trunk/cpp/lib/jrnl/wmgr.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/wmgr.cpp 2008-05-20 22:27:45 UTC (rev 2074)
+++ store/trunk/cpp/lib/jrnl/wmgr.cpp 2008-05-21 15:12:59 UTC (rev 2075)
@@ -922,7 +922,7 @@
wmgr::clean();
std::ostringstream oss;
oss << "posix_memalign(): blksize=" << _sblksize <<
" size=" << _sblksize;
- oss << " errno=" << errno;
+ oss << FORMAT_SYSERR(errno);
throw jexception(jerrno::JERR__MALLOC, oss.str(), "wmgr",
"initialize");
}
_fhdr_ptr_arr = (void**)std::malloc(_num_jfiles * sizeof(void*));