summaryrefslogtreecommitdiff
path: root/ace/FILE.cpp
diff options
context:
space:
mode:
authorlevine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1996-10-21 21:41:34 +0000
committerlevine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1996-10-21 21:41:34 +0000
commita5fdebc5f6375078ec1763850a4ca23ec7fe6458 (patch)
treebcf0a25c3d45a209a6e3ac37b233a4812f29c732 /ace/FILE.cpp
downloadATCD-a5fdebc5f6375078ec1763850a4ca23ec7fe6458.tar.gz
Initial revision
Diffstat (limited to 'ace/FILE.cpp')
-rw-r--r--ace/FILE.cpp72
1 files changed, 72 insertions, 0 deletions
diff --git a/ace/FILE.cpp b/ace/FILE.cpp
new file mode 100644
index 00000000000..a6928173f98
--- /dev/null
+++ b/ace/FILE.cpp
@@ -0,0 +1,72 @@
+// FILE.cpp
+// $Id$
+
+/* Defines the member functions for the base class of the ACE_IO_SAP
+ ACE_FILE abstraction. */
+
+#define ACE_BUILD_DLL
+#include "ace/FILE.h"
+
+ACE_ALLOC_HOOK_DEFINE(ACE_FILE)
+
+void
+ACE_FILE::dump (void) const
+{
+ ACE_TRACE ("ACE_FILE::dump");
+ ACE_IO_SAP::dump ();
+}
+
+/* This is the do-nothing constructor. */
+
+ACE_FILE::ACE_FILE (void)
+{
+ ACE_TRACE ("ACE_FILE::ACE_FILE");
+}
+
+// Close the file
+
+int
+ACE_FILE::close (void)
+{
+ ACE_TRACE ("ACE_FILE::close");
+ int result = ACE_OS::close (this->get_handle ());
+ this->set_handle (ACE_INVALID_HANDLE);
+ return result;
+}
+
+int
+ACE_FILE::get_info (ACE_FILE_Info *finfo)
+{
+ ACE_TRACE ("ACE_FILE::get_info");
+ struct stat filestatus;
+ int result = ACE_OS::fstat (this->get_handle (), &filestatus);
+
+ if (result == 0)
+ {
+ finfo->mode_ = filestatus.st_mode;
+ finfo->nlink_ = filestatus.st_nlink;
+ finfo->size_ = filestatus.st_size;
+ }
+ return result;
+}
+
+int
+ACE_FILE::truncate (off_t length)
+{
+ ACE_TRACE ("ACE_FILE::truncate");
+ return ACE_OS::ftruncate (this->get_handle(), length);
+}
+
+off_t
+ACE_FILE::position (long offset, int startpos)
+{
+ ACE_TRACE ("ACE_FILE::position");
+ return ACE_OS::lseek (this->get_handle (), offset, startpos);
+}
+
+off_t
+ACE_FILE::position (void)
+{
+ ACE_TRACE ("ACE_FILE::position");
+ return ACE_OS::lseek (this->get_handle (), 0, SEEK_CUR);
+}