summaryrefslogtreecommitdiff
path: root/ace
diff options
context:
space:
mode:
authornw1 <nw1@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1997-10-20 18:33:11 +0000
committernw1 <nw1@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1997-10-20 18:33:11 +0000
commit8616de7e2c6251faef4a9b88cb4b3ec3eabd4bb1 (patch)
tree27270cb30bc40f06521f1755284179c868581ca7 /ace
parentbbb149d818f5cfe70fd4379701b85a5b9b5881d5 (diff)
downloadATCD-8616de7e2c6251faef4a9b88cb4b3ec3eabd4bb1.tar.gz
Added LPSECURITY_ATTRIBUTES to a bunch of methods.
Diffstat (limited to 'ace')
-rw-r--r--ace/FIFO.cpp10
-rw-r--r--ace/FIFO.h6
-rw-r--r--ace/FIFO_Recv.cpp13
-rw-r--r--ace/FIFO_Recv.h6
-rw-r--r--ace/FIFO_Recv_Msg.cpp12
-rw-r--r--ace/FIFO_Recv_Msg.h6
-rw-r--r--ace/FIFO_Send.cpp10
-rw-r--r--ace/FIFO_Send.h6
-rw-r--r--ace/FIFO_Send_Msg.cpp10
-rw-r--r--ace/FIFO_Send_Msg.h6
-rw-r--r--ace/Filecache.cpp26
-rw-r--r--ace/Filecache.h11
-rw-r--r--ace/Mem_Map.cpp28
-rw-r--r--ace/Mem_Map.h21
-rw-r--r--ace/Mem_Map.i10
-rw-r--r--ace/Memory_Pool.cpp17
-rw-r--r--ace/Memory_Pool.h9
17 files changed, 136 insertions, 71 deletions
diff --git a/ace/FIFO.cpp b/ace/FIFO.cpp
index 8c1f4d1b980..bd6ca63c695 100644
--- a/ace/FIFO.cpp
+++ b/ace/FIFO.cpp
@@ -23,7 +23,8 @@ ACE_FIFO::dump (void) const
}
int
-ACE_FIFO::open (const char *r, int flags, int perms)
+ACE_FIFO::open (const char *r, int flags, int perms,
+ LPSECURITY_ATTRIBUTES sa)
{
ACE_TRACE ("ACE_FIFO::open");
ACE_OS::strncpy (this->rendezvous_, r, MAXPATHLEN);
@@ -33,16 +34,17 @@ ACE_FIFO::open (const char *r, int flags, int perms)
&& !(errno == EEXIST))
return -1;
- this->set_handle (ACE_OS::open (this->rendezvous_, flags));
+ this->set_handle (ACE_OS::open (this->rendezvous_, flags, 0, sa));
return this->get_handle () == ACE_INVALID_HANDLE ? -1 : 0;
}
ACE_FIFO::ACE_FIFO (const char *fifo_name,
int flags,
- int perms)
+ int perms,
+ LPSECURITY_ATTRIBUTES sa)
{
ACE_TRACE ("ACE_FIFO::ACE_FIFO");
- if (this->open (fifo_name, flags, perms) == -1)
+ if (this->open (fifo_name, flags, perms, sa) == -1)
ACE_ERROR ((LM_ERROR, "%p\n", "ACE_FIFO"));
}
diff --git a/ace/FIFO.h b/ace/FIFO.h
index dc4ffac7f40..4d4ba938932 100644
--- a/ace/FIFO.h
+++ b/ace/FIFO.h
@@ -25,7 +25,8 @@ class ACE_Export ACE_FIFO : public ACE_IPC_SAP
// Abstract base class for UNIX FIFOs (a.k.a. Named Pipes).
{
public:
- int open (const char *rendezvous, int flags, int perms);
+ int open (const char *rendezvous, int flags, int perms,
+ LPSECURITY_ATTRIBUTES sa = 0);
// Open up the named pipe on the <rendezvous> in accordance with the
// flags.
@@ -50,7 +51,8 @@ protected:
ACE_FIFO (void);
// Default constructor.
- ACE_FIFO (const char *rendezvous, int flags, int perms);
+ ACE_FIFO (const char *rendezvous, int flags, int perms,
+ LPSECURITY_ATTRIBUTES sa = 0);
// Open up the named pipe on the <rendezvous> in accordance with the
// flags.
diff --git a/ace/FIFO_Recv.cpp b/ace/FIFO_Recv.cpp
index c30cdcab937..cfa7ae5e99a 100644
--- a/ace/FIFO_Recv.cpp
+++ b/ace/FIFO_Recv.cpp
@@ -38,16 +38,17 @@ int
ACE_FIFO_Recv::open (const char *fifo_name,
int flags,
int perms,
- int persistent)
+ int persistent,
+ LPSECURITY_ATTRIBUTES sa)
{
ACE_TRACE ("ACE_FIFO_Recv::open");
- if (ACE_FIFO::open (fifo_name, ACE_NONBLOCK | flags, perms) == -1)
+ if (ACE_FIFO::open (fifo_name, ACE_NONBLOCK | flags, perms, sa) == -1)
return -1;
else if (this->disable (ACE_NONBLOCK) == -1)
return -1;
else if (persistent
- && (this->aux_handle_ = ACE_OS::open (fifo_name, O_WRONLY)) == ACE_INVALID_HANDLE)
+ && (this->aux_handle_ = ACE_OS::open (fifo_name, O_WRONLY, 0, sa)) == ACE_INVALID_HANDLE)
return -1;
else
return this->get_handle () == ACE_INVALID_HANDLE ? -1 : 0;
@@ -62,7 +63,8 @@ ACE_FIFO_Recv::ACE_FIFO_Recv (void)
ACE_FIFO_Recv::ACE_FIFO_Recv (const char *fifo_name,
int flags,
int perms,
- int persistent)
+ int persistent,
+ LPSECURITY_ATTRIBUTES sa)
: aux_handle_ (ACE_INVALID_HANDLE)
{
ACE_TRACE ("ACE_FIFO_Recv::ACE_FIFO_Recv");
@@ -70,7 +72,8 @@ ACE_FIFO_Recv::ACE_FIFO_Recv (const char *fifo_name,
if (this->ACE_FIFO_Recv::open (fifo_name,
flags,
perms,
- persistent) == -1)
+ persistent,
+ sa) == -1)
ACE_ERROR ((LM_ERROR, "%p\n", "ACE_FIFO_Recv"));
}
diff --git a/ace/FIFO_Recv.h b/ace/FIFO_Recv.h
index 923b2644725..a404d1e3b81 100644
--- a/ace/FIFO_Recv.h
+++ b/ace/FIFO_Recv.h
@@ -32,13 +32,15 @@ public:
ACE_FIFO_Recv (const char *rendezvous,
int flags = O_CREAT | O_RDONLY,
int perms = ACE_DEFAULT_FILE_PERMS,
- int persistent = 1);
+ int persistent = 1,
+ LPSECURITY_ATTRIBUTES sa = 0);
// Open up a bytestream named pipe for reading.
int open (const char *rendezvous,
int flags = O_CREAT | O_RDONLY,
int perms = ACE_DEFAULT_FILE_PERMS,
- int persistent = 1);
+ int persistent = 1,
+ LPSECURITY_ATTRIBUTES sa = 0);
// Open up a bytestream named pipe for reading.
int close (void);
diff --git a/ace/FIFO_Recv_Msg.cpp b/ace/FIFO_Recv_Msg.cpp
index 879df61cb8e..3cfc8d8f682 100644
--- a/ace/FIFO_Recv_Msg.cpp
+++ b/ace/FIFO_Recv_Msg.cpp
@@ -23,14 +23,16 @@ int
ACE_FIFO_Recv_Msg::open (const char *fifo_name,
int flags,
int perms,
- int persistent)
+ int persistent,
+ LPSECURITY_ATTRIBUTES sa)
{
ACE_TRACE ("ACE_FIFO_Recv_Msg::open");
return ACE_FIFO_Recv::open (fifo_name,
flags,
perms,
- persistent);
+ persistent,
+ sa);
}
ACE_FIFO_Recv_Msg::ACE_FIFO_Recv_Msg (void)
@@ -41,13 +43,15 @@ ACE_FIFO_Recv_Msg::ACE_FIFO_Recv_Msg (void)
ACE_FIFO_Recv_Msg::ACE_FIFO_Recv_Msg (const char *fifo_name,
int flags,
int perms,
- int persistent)
+ int persistent,
+ LPSECURITY_ATTRIBUTES sa)
{
ACE_TRACE ("ACE_FIFO_Recv_Msg::ACE_FIFO_Recv_Msg");
if (this->ACE_FIFO_Recv_Msg::open (fifo_name,
flags,
perms,
- persistent) == -1)
+ persistent,
+ sa) == -1)
ACE_ERROR ((LM_ERROR, "%p\n", "ACE_FIFO_Recv_Msg"));
}
diff --git a/ace/FIFO_Recv_Msg.h b/ace/FIFO_Recv_Msg.h
index ad6418c26d6..2626cceca7f 100644
--- a/ace/FIFO_Recv_Msg.h
+++ b/ace/FIFO_Recv_Msg.h
@@ -31,13 +31,15 @@ public:
ACE_FIFO_Recv_Msg (const char *rendezvous,
int flags = O_CREAT | O_RDONLY,
int perms = ACE_DEFAULT_FILE_PERMS,
- int persistent = 1);
+ int persistent = 1,
+ LPSECURITY_ATTRIBUTES sa = 0);
// Open up a record-oriented named pipe for reading.
int open (const char *rendezvous,
int flags = O_CREAT | O_RDONLY,
int perms = ACE_DEFAULT_FILE_PERMS,
- int persistent = 1);
+ int persistent = 1,
+ LPSECURITY_ATTRIBUTES sa = 0);
// Open up a record-oriented named pipe for reading.
ssize_t recv (ACE_Str_Buf &msg);
diff --git a/ace/FIFO_Send.cpp b/ace/FIFO_Send.cpp
index 61280a590a9..e1c3d67fdbf 100644
--- a/ace/FIFO_Send.cpp
+++ b/ace/FIFO_Send.cpp
@@ -21,15 +21,17 @@ ACE_FIFO_Send::ACE_FIFO_Send (void)
}
int
-ACE_FIFO_Send::open (const char *rendezvous_name, int flags, int perms)
+ACE_FIFO_Send::open (const char *rendezvous_name, int flags, int perms,
+ LPSECURITY_ATTRIBUTES sa)
{
ACE_TRACE ("ACE_FIFO_Send::open");
- return ACE_FIFO::open (rendezvous_name, flags | O_WRONLY, perms);
+ return ACE_FIFO::open (rendezvous_name, flags | O_WRONLY, perms, sa);
}
-ACE_FIFO_Send::ACE_FIFO_Send (const char *fifo_name, int flags, int perms)
+ACE_FIFO_Send::ACE_FIFO_Send (const char *fifo_name, int flags, int perms,
+ LPSECURITY_ATTRIBUTES sa)
{
ACE_TRACE ("ACE_FIFO_Send::ACE_FIFO_Send");
- if (this->ACE_FIFO_Send::open (fifo_name, flags, perms) == -1)
+ if (this->ACE_FIFO_Send::open (fifo_name, flags, perms, sa) == -1)
ACE_ERROR ((LM_ERROR, "%p\n", "ACE_FIFO_Send::ACE_FIFO_Send"));
}
diff --git a/ace/FIFO_Send.h b/ace/FIFO_Send.h
index c32d2827060..8b3ee6a8052 100644
--- a/ace/FIFO_Send.h
+++ b/ace/FIFO_Send.h
@@ -31,12 +31,14 @@ public:
ACE_FIFO_Send (const char *rendezvous,
int flags = O_WRONLY,
- int perms = ACE_DEFAULT_FILE_PERMS);
+ int perms = ACE_DEFAULT_FILE_PERMS,
+ LPSECURITY_ATTRIBUTES sa = 0);
// Open up a bytestream named pipe for writing.
int open (const char *rendezvous,
int flags = O_WRONLY,
- int perms = ACE_DEFAULT_FILE_PERMS);
+ int perms = ACE_DEFAULT_FILE_PERMS,
+ LPSECURITY_ATTRIBUTES sa = 0);
// Open up a bytestream named pipe for writing.
ssize_t send (const void *buf, size_t len);
diff --git a/ace/FIFO_Send_Msg.cpp b/ace/FIFO_Send_Msg.cpp
index bcda2951f7d..272462d9527 100644
--- a/ace/FIFO_Send_Msg.cpp
+++ b/ace/FIFO_Send_Msg.cpp
@@ -45,17 +45,19 @@ ACE_FIFO_Send_Msg::ACE_FIFO_Send_Msg (void)
int
ACE_FIFO_Send_Msg::open (const char *fifo_name,
int flags,
- int perms)
+ int perms,
+ LPSECURITY_ATTRIBUTES sa)
{
ACE_TRACE ("ACE_FIFO_Send_Msg::open");
- return ACE_FIFO_Send::open (fifo_name, flags | O_WRONLY, perms);
+ return ACE_FIFO_Send::open (fifo_name, flags | O_WRONLY, perms, sa);
}
ACE_FIFO_Send_Msg::ACE_FIFO_Send_Msg (const char *fifo_name,
int flags,
- int perms)
+ int perms,
+ LPSECURITY_ATTRIBUTES sa)
{
ACE_TRACE ("ACE_FIFO_Send_Msg::ACE_FIFO_Send_Msg");
- if (this->ACE_FIFO_Send_Msg::open (fifo_name, flags, perms) == -1)
+ if (this->ACE_FIFO_Send_Msg::open (fifo_name, flags, perms, sa) == -1)
ACE_ERROR ((LM_ERROR, "%p\n", "ACE_FIFO_Send_Msg"));
}
diff --git a/ace/FIFO_Send_Msg.h b/ace/FIFO_Send_Msg.h
index 1bf0fb0c5f2..94a8a4cabe9 100644
--- a/ace/FIFO_Send_Msg.h
+++ b/ace/FIFO_Send_Msg.h
@@ -32,12 +32,14 @@ public:
ACE_FIFO_Send_Msg (const char *rendezvous,
int flags = O_WRONLY,
- int perms = ACE_DEFAULT_FILE_PERMS);
+ int perms = ACE_DEFAULT_FILE_PERMS,
+ LPSECURITY_ATTRIBUTES sa = 0);
// Open up a record-oriented named pipe for writing.
int open (const char *rendezvous,
int flags = O_WRONLY,
- int perms = ACE_DEFAULT_FILE_PERMS);
+ int perms = ACE_DEFAULT_FILE_PERMS,
+ LPSECURITY_ATTRIBUTES sa = 0);
// Open up a record-oriented named pipe for writing.
ssize_t send (const ACE_Str_Buf &msg);
diff --git a/ace/Filecache.cpp b/ace/Filecache.cpp
index 7d5a2dcbd6e..2cd2ed22a19 100644
--- a/ace/Filecache.cpp
+++ b/ace/Filecache.cpp
@@ -448,8 +448,10 @@ ACE_Filecache_Object::ACE_Filecache_Object (void)
}
ACE_Filecache_Object::ACE_Filecache_Object (const char *filename,
- ACE_SYNCH_RW_MUTEX &lock)
+ ACE_SYNCH_RW_MUTEX &lock,
+ LPSECURITY_ATTRIBUTES sa)
: stale_ (0),
+ sa_ (sa),
lock_ (lock)
{
this->init ();
@@ -477,7 +479,7 @@ ACE_Filecache_Object::ACE_Filecache_Object (const char *filename,
this->tempname_ = (char *) this->filename_;
// Can we open the file?
- this->handle_ = ACE_OS::open (this->tempname_, READ_FLAGS, R_MASK);
+ this->handle_ = ACE_OS::open (this->tempname_, READ_FLAGS, R_MASK, this->sa_);
if (this->handle_ == ACE_INVALID_HANDLE)
{
this->error_i (ACE_Filecache_Object::OPEN_FAILED,
@@ -487,7 +489,7 @@ ACE_Filecache_Object::ACE_Filecache_Object (const char *filename,
// Can we map the file?
if (this->mmap_.map (this->handle_, -1,
- PROT_READ, MAP_PRIVATE) != 0)
+ PROT_READ, MAP_PRIVATE, 0, 0, this->sa_) != 0)
{
this->error_i (ACE_Filecache_Object::MEMMAP_FAILED,
"ACE_Filecache_Object::acquire: map");
@@ -502,8 +504,10 @@ ACE_Filecache_Object::ACE_Filecache_Object (const char *filename,
ACE_Filecache_Object::ACE_Filecache_Object (const char *filename,
int size,
- ACE_SYNCH_RW_MUTEX &lock)
+ ACE_SYNCH_RW_MUTEX &lock,
+ LPSECURITY_ATTRIBUTES sa)
: stale_ (0),
+ sa_ (sa),
lock_ (lock)
{
this->init ();
@@ -525,7 +529,7 @@ ACE_Filecache_Object::ACE_Filecache_Object (const char *filename,
this->tempname_ = this->filename_;
// Can we open the file?
- this->handle_ = ACE_OS::open (this->tempname_, WRITE_FLAGS, W_MASK);
+ this->handle_ = ACE_OS::open (this->tempname_, WRITE_FLAGS, W_MASK, this->sa_);
if (this->handle_ == ACE_INVALID_HANDLE)
{
this->error_i (ACE_Filecache_Object::OPEN_FAILED,
@@ -552,7 +556,8 @@ ACE_Filecache_Object::ACE_Filecache_Object (const char *filename,
}
// Can we map?
- if (this->mmap_.map (this->handle_, this->size_, PROT_RDWR, MAP_SHARED) != 0)
+ if (this->mmap_.map (this->handle_, this->size_, PROT_RDWR, MAP_SHARED,
+ 0, 0, this->sa_) != 0)
{
this->error_i (ACE_Filecache_Object::MEMMAP_FAILED,
"ACE_Filecache_Object::acquire: map");
@@ -585,7 +590,8 @@ ACE_Filecache_Object::release (void)
{
// We are safe since only one thread has a writable Filecache_Object
- ACE_HANDLE original = ACE_OS::open (this->filename_, WRITE_FLAGS, W_MASK);
+ ACE_HANDLE original = ACE_OS::open (this->filename_, WRITE_FLAGS, W_MASK,
+ this->sa_);
if (original == ACE_INVALID_HANDLE)
this->error_ = ACE_Filecache_Object::OPEN_FAILED;
else if (ACE_OS::write (original, this->mmap_.addr (),
@@ -610,7 +616,11 @@ ACE_Filecache_Object::release (void)
"ACE_Filecache_Object::acquire: open");
}
else if (this->mmap_.map (this->handle_, -1,
- PROT_READ, MAP_PRIVATE) != 0)
+ PROT_READ,
+ MAP_PRIVATE,
+ 0,
+ 0,
+ this->sa_) != 0)
{
this->error_i (ACE_Filecache_Object::MEMMAP_FAILED,
"ACE_Filecache_Object::acquire: map");
diff --git a/ace/Filecache.h b/ace/Filecache.h
index 9b76c56341d..5f456541a67 100644
--- a/ace/Filecache.h
+++ b/ace/Filecache.h
@@ -89,7 +89,7 @@ public:
// opened for reading.
ACE_Filecache_Handle (const char *filename,
- int size);
+ int size);
// Create new entry, and acquire it. Presence of SIZE assumes the
// file is being opened for writing.
@@ -230,12 +230,14 @@ class ACE_Filecache_Object
public:
ACE_Filecache_Object (const char *filename,
- ACE_SYNCH_RW_MUTEX &lock);
+ ACE_SYNCH_RW_MUTEX &lock,
+ LPSECURITY_ATTRIBUTES sa = 0);
// Creates a file for reading.
ACE_Filecache_Object (const char *filename,
int size,
- ACE_SYNCH_RW_MUTEX &lock);
+ ACE_SYNCH_RW_MUTEX &lock,
+ LPSECURITY_ATTRIBUTES sa = 0);
// Creates a file for writing.
~ACE_Filecache_Object (void);
@@ -320,6 +322,9 @@ private:
int stale_;
// If set to 1, means the object is flagged for removal.
+ LPSECURITY_ATTRIBUTES sa_;
+ // Security attribute object.
+
ACE_SYNCH_RW_MUTEX junklock_;
ACE_SYNCH_RW_MUTEX &lock_;
// lock_ provides a bookkeeping mechanism for users of this object.
diff --git a/ace/Mem_Map.cpp b/ace/Mem_Map.cpp
index db77c013710..182680a8b54 100644
--- a/ace/Mem_Map.cpp
+++ b/ace/Mem_Map.cpp
@@ -58,7 +58,8 @@ ACE_Mem_Map::map_it (ACE_HANDLE handle,
int prot,
int share,
void *addr,
- off_t pos)
+ off_t pos,
+ LPSECURITY_ATTRIBUTES sa)
{
ACE_TRACE ("ACE_Mem_Map::map_it");
this->base_addr_ = addr;
@@ -111,7 +112,8 @@ ACE_Mem_Map::map_it (ACE_HANDLE handle,
share,
this->handle_,
off_t (ACE::round_to_pagesize (pos)),
- &this->file_mapping_);
+ &this->file_mapping_,
+ sa);
return this->base_addr_ == MAP_FAILED ? -1 : 0;
}
@@ -119,13 +121,14 @@ ACE_Mem_Map::map_it (ACE_HANDLE handle,
int
ACE_Mem_Map::open (LPCTSTR file_name,
int flags,
- int mode)
+ int mode,
+ LPSECURITY_ATTRIBUTES sa)
{
ACE_TRACE ("ACE_Mem_Map::open");
ACE_OS::strncpy (this->filename_, file_name, MAXPATHLEN);
- this->handle_ = ACE_OS::open (file_name, flags, mode);
+ this->handle_ = ACE_OS::open (file_name, flags, mode, sa);
if (this->handle_ == ACE_INVALID_HANDLE)
return -1;
@@ -144,15 +147,16 @@ ACE_Mem_Map::map (LPCTSTR file_name,
int prot,
int share,
void *addr,
- off_t pos)
+ off_t pos,
+ LPSECURITY_ATTRIBUTES sa)
{
ACE_TRACE ("ACE_Mem_Map::map");
this->length_ = 0;
- if (this->open (file_name, flags, mode) == -1)
+ if (this->open (file_name, flags, mode, sa) == -1)
return -1;
else
- return this->map_it (this->handle (), len, prot, share, addr, pos);
+ return this->map_it (this->handle (), len, prot, share, addr, pos, sa);
}
ACE_Mem_Map::ACE_Mem_Map (void)
@@ -175,7 +179,8 @@ ACE_Mem_Map::ACE_Mem_Map (LPCTSTR file_name,
int prot,
int share,
void *addr,
- off_t pos)
+ off_t pos,
+ LPSECURITY_ATTRIBUTES sa)
: base_addr_ (MAP_FAILED),
length_ (0),
handle_ (ACE_INVALID_HANDLE),
@@ -183,7 +188,7 @@ ACE_Mem_Map::ACE_Mem_Map (LPCTSTR file_name,
close_handle_ (0)
{
ACE_TRACE ("ACE_Mem_Map::ACE_Mem_Map");
- if (this->map (file_name, len, flags, mode, prot, share, addr, pos) < 0)
+ if (this->map (file_name, len, flags, mode, prot, share, addr, pos, sa) < 0)
ACE_ERROR ((LM_ERROR, "%p\n", "ACE_Mem_Map::ACE_Mem_Map"));
}
@@ -195,7 +200,8 @@ ACE_Mem_Map::ACE_Mem_Map (ACE_HANDLE handle,
int prot,
int share,
void *addr,
- off_t pos)
+ off_t pos,
+ LPSECURITY_ATTRIBUTES sa)
: base_addr_ (MAP_FAILED),
length_ (0),
handle_ (ACE_INVALID_HANDLE),
@@ -206,7 +212,7 @@ ACE_Mem_Map::ACE_Mem_Map (ACE_HANDLE handle,
ACE_OS::memset (this->filename_, 0, sizeof this->filename_);
- if (this->map (handle, len, prot, share, addr, pos) < 0)
+ if (this->map (handle, len, prot, share, addr, pos, sa) < 0)
ACE_ERROR ((LM_ERROR, "%p\n", "ACE_Mem_Map::ACE_Mem_Map"));
}
diff --git a/ace/Mem_Map.h b/ace/Mem_Map.h
index 511351800f2..aa5bdd71029 100644
--- a/ace/Mem_Map.h
+++ b/ace/Mem_Map.h
@@ -34,7 +34,8 @@ public:
int prot = PROT_RDWR,
int share = MAP_PRIVATE,
void *addr = 0,
- off_t pos = 0);
+ off_t pos = 0,
+ LPSECURITY_ATTRIBUTES sa = 0);
// Map a file from an open file descriptor <handle>. This function
// will lookup the length of the file if it is not given.
@@ -45,7 +46,8 @@ public:
int prot = PROT_RDWR,
int share = MAP_PRIVATE,
void *addr = 0,
- off_t pos = 0);
+ off_t pos = 0,
+ LPSECURITY_ATTRIBUTES sa = 0);
// Map a file specified by <file_name>.
int map (ACE_HANDLE handle,
@@ -53,7 +55,8 @@ public:
int prot = PROT_RDWR,
int share = MAP_PRIVATE,
void *addr = 0,
- off_t pos = 0);
+ off_t pos = 0,
+ LPSECURITY_ATTRIBUTES sa = 0);
// Map a file from an open file descriptor <handle>. This function
// will lookup the length of the file if it is not given.
@@ -61,7 +64,8 @@ public:
int prot = PROT_RDWR,
int share = MAP_PRIVATE,
void *addr = 0,
- off_t pos = 0);
+ off_t pos = 0,
+ LPSECURITY_ATTRIBUTES sa = 0);
// Remap the file associated with <handle_>.
int map (LPCTSTR filename,
@@ -71,7 +75,8 @@ public:
int prot = PROT_RDWR,
int share = MAP_PRIVATE,
void *addr = 0,
- off_t pos = 0);
+ off_t pos = 0,
+ LPSECURITY_ATTRIBUTES sa = 0);
// Map a file specified by <filename>.
~ACE_Mem_Map (void);
@@ -79,7 +84,8 @@ public:
int open (LPCTSTR filename,
int flags = O_RDWR | O_CREAT,
- int mode = ACE_DEFAULT_FILE_PERMS);
+ int mode = ACE_DEFAULT_FILE_PERMS,
+ LPSECURITY_ATTRIBUTES sa = 0);
// Open the file without mapping it.
int close (void);
@@ -163,7 +169,8 @@ private:
int prot = PROT_RDWR,
int share = MAP_SHARED,
void *addr = 0,
- off_t pos = 0);
+ off_t pos = 0,
+ LPSECURITY_ATTRIBUTES sa = 0);
// This method does the dirty work of actually calling ::mmap to map
// the file into memory.
diff --git a/ace/Mem_Map.i b/ace/Mem_Map.i
index 6598146fbf6..6dae08d1373 100644
--- a/ace/Mem_Map.i
+++ b/ace/Mem_Map.i
@@ -24,10 +24,11 @@ ACE_Mem_Map::map (ACE_HANDLE handle,
int prot,
int share,
void *addr,
- off_t pos)
+ off_t pos,
+ LPSECURITY_ATTRIBUTES sa)
{
ACE_TRACE ("ACE_Mem_Map::map");
- return this->map_it (handle, len, prot, share, addr, pos);
+ return this->map_it (handle, len, prot, share, addr, pos, sa);
}
// Remap the file associated with <this->handle_>.
@@ -37,11 +38,12 @@ ACE_Mem_Map::map (int len,
int prot,
int share,
void *addr,
- off_t pos)
+ off_t pos,
+ LPSECURITY_ATTRIBUTES sa)
{
ACE_TRACE ("ACE_Mem_Map::map");
return this->map_it (this->handle (), len, prot,
- share, addr, pos);
+ share, addr, pos, sa);
}
// This operator passes back the starting address of the mapped file.
diff --git a/ace/Memory_Pool.cpp b/ace/Memory_Pool.cpp
index 633c69f5ae1..878d6f38322 100644
--- a/ace/Memory_Pool.cpp
+++ b/ace/Memory_Pool.cpp
@@ -106,7 +106,8 @@ ACE_MMAP_Memory_Pool::ACE_MMAP_Memory_Pool (LPCTSTR backing_store_name,
: base_addr_ (0),
flags_ (MAP_SHARED),
write_each_page_ (0),
- minimum_bytes_ (0)
+ minimum_bytes_ (0),
+ sa_ (options->sa_)
{
ACE_TRACE ("ACE_MMAP_Memory_Pool::ACE_MMAP_Memory_Pool");
@@ -201,7 +202,7 @@ ACE_MMAP_Memory_Pool::map_file (off_t file_offset)
// Remap the file.
if (this->mmap_.map (file_offset, PROT_RDWR,
- this->flags_, this->base_addr_, 0) == -1
+ this->flags_, this->base_addr_, 0, this->sa_) == -1
|| this->base_addr_ != 0 && this->mmap_.addr () != this->base_addr_)
ACE_ERROR_RETURN ((LM_ERROR,
"(%P|%t) base_addr = %u, addr = %u, file_offset = %u, %p\n",
@@ -257,7 +258,7 @@ ACE_MMAP_Memory_Pool::init_acquire (size_t nbytes,
if (this->mmap_.open (this->backing_store_name_,
O_RDWR | O_CREAT | O_TRUNC | O_EXCL,
- ACE_DEFAULT_FILE_PERMS) != -1)
+ ACE_DEFAULT_FILE_PERMS, this->sa_) != -1)
{
// First time in, so need to acquire memory.
first_time = 1;
@@ -273,7 +274,9 @@ ACE_MMAP_Memory_Pool::init_acquire (size_t nbytes,
ACE_DEFAULT_FILE_PERMS,
PROT_RDWR,
this->flags_,
- this->base_addr_) == -1)
+ this->base_addr_,
+ 0,
+ this->sa_) == -1)
ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "open"), 0);
return this->mmap_.addr ();
@@ -303,13 +306,15 @@ ACE_MMAP_Memory_Pool_Options::ACE_MMAP_Memory_Pool_Options (void *base_addr,
int write_each_page,
off_t minimum_bytes,
u_int flags,
- int guess_on_fault)
+ int guess_on_fault,
+ LPSECURITY_ATTRIBUTES sa)
: base_addr_ (base_addr),
use_fixed_addr_ (use_fixed_addr),
write_each_page_ (write_each_page),
minimum_bytes_ (minimum_bytes),
flags_ (flags),
- guess_on_fault_ (guess_on_fault)
+ guess_on_fault_ (guess_on_fault),
+ sa_ (sa)
{
ACE_TRACE ("ACE_MMAP_Memory_Pool_Options::ACE_MMAP_Memory_Pool_Options");
}
diff --git a/ace/Memory_Pool.h b/ace/Memory_Pool.h
index 6955f37f134..43dd09e69f3 100644
--- a/ace/Memory_Pool.h
+++ b/ace/Memory_Pool.h
@@ -311,7 +311,8 @@ public:
int write_each_page = 1,
off_t minimum_bytes = 0,
u_int flags = 0,
- int guess_on_fault = 1);
+ int guess_on_fault = 1,
+ LPSECURITY_ATTRIBUTES sa = 0);
void *base_addr_;
// Base address of the memory-mapped backing store.
@@ -333,6 +334,9 @@ public:
// Try to remap without knowing the faulting address. This
// parameter is ignored on platforms that know the faulting address
// (UNIX with SI_ADDR and Win32).
+
+ LPSECURITY_ATTRIBUTES sa_;
+ // Pointer to a security attributes object. Only used on NT.
};
class ACE_Export ACE_MMAP_Memory_Pool : public ACE_Event_Handler
@@ -441,6 +445,9 @@ protected:
// Try to remap without knowing the faulting address. This
// parameter is ignored on platforms that know the faulting address
// (UNIX with SI_ADDR and Win32).
+
+ LPSECURITY_ATTRIBUTES sa_;
+ // Security attributes object, only used on NT.
};
class ACE_Export ACE_Lite_MMAP_Memory_Pool : public ACE_MMAP_Memory_Pool