Commit cc5abe68 authored by unknown's avatar unknown

Merge willster.(none):/home/stewart/Documents/MySQL/5.0/ndb

into  willster.(none):/home/stewart/Documents/MySQL/5.0/ndb-mgm-work


ndb/include/logger/FileLogHandler.hpp:
  Auto merged
ndb/include/util/File.hpp:
  Auto merged
ndb/include/util/Vector.hpp:
  Auto merged
ndb/src/common/logger/FileLogHandler.cpp:
  Auto merged
ndb/src/common/util/File.cpp:
  Auto merged
parents 655650f5 45cbd3c1
...@@ -101,7 +101,7 @@ private: ...@@ -101,7 +101,7 @@ private:
bool setMaxFiles(const BaseString &files); bool setMaxFiles(const BaseString &files);
int m_maxNoFiles; int m_maxNoFiles;
long m_maxFileSize; off_t m_maxFileSize;
unsigned int m_maxLogEntries; unsigned int m_maxLogEntries;
File_class* m_pLogFile; File_class* m_pLogFile;
}; };
......
...@@ -49,7 +49,7 @@ public: ...@@ -49,7 +49,7 @@ public:
* @param f a pointer to a FILE descriptor. * @param f a pointer to a FILE descriptor.
* @return the size of the file. * @return the size of the file.
*/ */
static long size(FILE* f); static off_t size(FILE* f);
/** /**
* Renames a file. * Renames a file.
...@@ -181,7 +181,7 @@ public: ...@@ -181,7 +181,7 @@ public:
* *
* @return the file size. * @return the file size.
*/ */
long size() const; off_t size() const;
/** /**
* Returns the filename. * Returns the filename.
......
...@@ -93,6 +93,8 @@ void ...@@ -93,6 +93,8 @@ void
Vector<T>::push_back(const T & t){ Vector<T>::push_back(const T & t){
if(m_size == m_arraySize){ if(m_size == m_arraySize){
T * tmp = new T [m_arraySize + m_incSize]; T * tmp = new T [m_arraySize + m_incSize];
if(!tmp)
abort();
for (unsigned k = 0; k < m_size; k++) for (unsigned k = 0; k < m_size; k++)
tmp[k] = m_items[k]; tmp[k] = m_items[k];
delete[] m_items; delete[] m_items;
......
...@@ -124,8 +124,6 @@ FileLogHandler::writeFooter() ...@@ -124,8 +124,6 @@ FileLogHandler::writeFooter()
} }
callCount++; callCount++;
// Needed on Cello since writes to the flash disk does not happen until
// we flush and fsync.
m_pLogFile->flush(); m_pLogFile->flush();
} }
......
...@@ -44,17 +44,16 @@ File_class::exists(const char* aFileName) ...@@ -44,17 +44,16 @@ File_class::exists(const char* aFileName)
return (my_stat(aFileName, &stmp, MYF(0))!=NULL); return (my_stat(aFileName, &stmp, MYF(0))!=NULL);
} }
long off_t
File_class::size(FILE* f) File_class::size(FILE* f)
{ {
long cur_pos = 0, length = 0; MY_STAT s;
cur_pos = ::ftell(f); // Note that my_fstat behaves *differently* than my_stat. ARGGGHH!
::fseek(f, 0, SEEK_END); if(my_fstat(::fileno(f), &s, MYF(0)))
length = ::ftell(f); return 0;
::fseek(f, cur_pos, SEEK_SET); // restore original position
return length; return s.st_size;
} }
bool bool
...@@ -179,8 +178,8 @@ File_class::writeChar(const char* buf) ...@@ -179,8 +178,8 @@ File_class::writeChar(const char* buf)
{ {
return writeChar(buf, 0, ::strlen(buf)); return writeChar(buf, 0, ::strlen(buf));
} }
long off_t
File_class::size() const File_class::size() const
{ {
return File_class::size(m_file); return File_class::size(m_file);
...@@ -199,10 +198,6 @@ File_class::flush() const ...@@ -199,10 +198,6 @@ File_class::flush() const
::fflush(m_file); ::fflush(m_file);
return ::fsync(::fileno(m_file)); return ::fsync(::fileno(m_file));
#else #else
return 0; return ::fflush(m_file);;
#endif #endif
} }
//
// PRIVATE
//
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment