summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschmidt <douglascraigschmidt@users.noreply.github.com>1997-04-13 20:57:34 +0000
committerschmidt <douglascraigschmidt@users.noreply.github.com>1997-04-13 20:57:34 +0000
commit20a8ea1ca64dda222f61f2c45890f0e0ec67aa2a (patch)
tree4515b7dc9dfe53cc71f37fbd2086386e960eabc7
parent69bf6c211a76a5ba861cfc347cb31140a58952d7 (diff)
downloadATCD-20a8ea1ca64dda222f61f2c45890f0e0ec67aa2a.tar.gz
*** empty log message ***
-rw-r--r--ace/Stream_Modules.cpp6
-rw-r--r--ace/Task_T.i6
-rw-r--r--examples/IPC_SAP/SPIPE_SAP/server.cpp96
-rw-r--r--examples/Misc/test_dump.cpp12
4 files changed, 61 insertions, 59 deletions
diff --git a/ace/Stream_Modules.cpp b/ace/Stream_Modules.cpp
index 9bbea1b0ae2..1d9dfee20c4 100644
--- a/ace/Stream_Modules.cpp
+++ b/ace/Stream_Modules.cpp
@@ -202,10 +202,10 @@ ACE_Stream_Tail<ACE_SYNCH_2>::control (ACE_Message_Block *mb)
case ACE_IO_Cntl_Msg::SET_LWM:
case ACE_IO_Cntl_Msg::SET_HWM:
{
- size_t size = *(size_t *) mb->cont ()->rd_ptr ();
+ size_t wm_size = *(size_t *) mb->cont ()->rd_ptr ();
- this->water_marks (cmd, size);
- this->sibling ()->water_marks (cmd, size);
+ this->water_marks (cmd, wm_size);
+ this->sibling ()->water_marks (cmd, wm_size);
ioc->rval (0);
break;
}
diff --git a/ace/Task_T.i b/ace/Task_T.i
index 1a8837f24a3..f1a1ce29a06 100644
--- a/ace/Task_T.i
+++ b/ace/Task_T.i
@@ -5,13 +5,13 @@
template <ACE_SYNCH_1> ACE_INLINE void
ACE_Task<ACE_SYNCH_2>::water_marks (ACE_IO_Cntl_Msg::ACE_IO_Cntl_Cmds cmd,
- size_t size)
+ size_t wm_size)
{
ACE_TRACE ("ACE_Task<ACE_SYNCH_2>::water_marks");
if (cmd == ACE_IO_Cntl_Msg::SET_LWM)
- this->msg_queue_->low_water_mark (size);
+ this->msg_queue_->low_water_mark (wm_size);
else /* cmd == ACE_IO_Cntl_Msg::SET_HWM */
- this->msg_queue_->high_water_mark (size);
+ this->msg_queue_->high_water_mark (wm_size);
}
template <ACE_SYNCH_1> ACE_INLINE int
diff --git a/examples/IPC_SAP/SPIPE_SAP/server.cpp b/examples/IPC_SAP/SPIPE_SAP/server.cpp
index 2d46a882f8a..d1d86f5ca74 100644
--- a/examples/IPC_SAP/SPIPE_SAP/server.cpp
+++ b/examples/IPC_SAP/SPIPE_SAP/server.cpp
@@ -6,33 +6,35 @@
#if defined (ACE_HAS_STREAM_PIPES)
-/* Maximum per-process open I/O descriptors */
-const int MAX_FDS = 200;
-const int PERMS = 0666;
+// Maximum per-process open I/O descriptors.
+const int MAX_HANDLES = 200;
+const int PERMS = 0666;
int
main (int argc, char *argv[])
{
ACE_SPIPE_Acceptor peer_acceptor;
ACE_SPIPE_Stream new_stream;
- int s_handle;
- struct pollfd poll_array[MAX_FDS];
+ struct pollfd poll_array[MAX_HANDLES];
+
+ for (handle = 0; handle < MAX_HANDLES; handle++)
+ {
+ poll_array[handle].fd = -1;
+ poll_array[handle].events = POLLIN;
+ }
if (argc > 1)
rendezvous = argv[1];
ACE_OS::fdetach (rendezvous);
-
ACE_SPIPE_Addr addr (rendezvous);
- if ((s_handle = peer_acceptor.open (addr)) == -1)
- ACE_OS::perror ("peer_acceptor.open"), ACE_OS::exit (1);
+ ACE_HANDLE s_handle = peer_acceptor.open (addr);
- for (int fd = 0; fd < MAX_FDS; fd++)
- {
- poll_array[fd].fd = -1;
- poll_array[fd].events = POLLIN;
- }
+ if (s_handle == -1)
+ ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "peer_acceptor.open"), -1);
+
+ ACE_HANDLE handle;
poll_array[0].fd = s_handle;
@@ -42,63 +44,63 @@ main (int argc, char *argv[])
while (ACE_OS::poll (poll_array, width) == -1 && errno == EINTR)
continue;
- /* Handle pending logging messages first (s_handle + 1
- is guaranteed to be lowest client descriptor) */
+ // Handle pending logging messages first (s_handle + 1 is
+ // guaranteed to be lowest client descriptor).
- for (int fd = s_handle + 1; fd < width; fd++)
- if ((poll_array[fd].revents & POLLIN)
- || (poll_array[fd].revents & POLLHUP))
+ for (handle = s_handle + 1; handle < width; handle++)
+ if (ACE_BIT_ENABLED (poll_array[handle].revents, POLLIN)
+ || ACE_BIT_ENABLED (poll_array[handle].revents, POLLHUP))
{
char buf[BUFSIZ];
- int n;
+ ssize_t n = ACE_OS::read (handle, buf, sizeof buf);
- /* recv will not block in this case! */
- if ((n = ACE_OS::read (fd, buf, sizeof buf)) == -1)
- ACE_OS::perror ("read failed");
+ // recv will not block in this case!
+ if (n == -1)
+ ACE_DEBUG ((LM_DEBUG, "%p\n", "read failed"));
else if (n == 0)
{
- /* Handle client connection shutdown */
- if (ACE_OS::close (poll_array[fd].fd) == -1)
- ACE_OS::perror ("close");
- poll_array[fd].fd = -1;
+ // Handle client connection shutdown.
+ if (ACE_OS::close (poll_array[handle].fd) == -1)
+ ACE_DEBUG ((LM_DEBUG, "%p\n", "close"));
+ poll_array[handle].fd = -1;
- if (fd + 1 == width)
+ if (handle + 1 == width)
{
- while (poll_array[fd].fd == -1)
- fd--;
- width = fd + 1;
+ while (poll_array[handle].fd == -1)
+ handle--;
+ width = handle + 1;
}
}
else
- {
- ::printf ("%*s\n", n, buf);
- fflush (stdout);
- }
+ ACE_DEBUG ((LM_DEBUG, "%*s\n", n, buf));
}
- if (poll_array[0].revents & POLLIN)
+ if (ACE_BIT_ENABLED (poll_array[0].revents, POLLIN))
{
- int arg;
- int n_handle;
- ACE_SPIPE_Addr client;
-
if (peer_acceptor.accept (new_stream) == -1)
- ACE_OS::perror ("local_accept");
+ ACE_DEBUG ((LM_DEBUG, "%p\n", "accept failed"));
- n_handle = new_stream.get_handle ();
+ ACE_SPIPE_Addr client;
+ ACE_HANDLE n_handle = new_stream.get_handle ();
if (new_stream.get_remote_addr (client) == -1)
- ACE_OS::perror ("get_remote_addr");
+ ACE_DEBUG ((LM_DEBUG, "%p\n",
+ "get_remote_addr failed"));
- ACE_OS::printf ("n_handle = %d, uid = %d, gid = %d\n",
- n_handle, client.user_id (), client.group_id ());
+ ACE_DEBUG ((LM_DEBUG,
+ "n_handle = %d, uid = %d, gid = %d\n",
+ n_handle,
+ client.user_id (),
+ client.group_id ()));
- arg = RMSGN | RPROTDAT;
+ int arg = RMSGN | RPROTDAT;
- if (ACE_OS::ioctl (n_handle, I_SRDOPT, (void *) arg) == -1)
- ACE_OS::perror ("I_RRDOPT");
+ if (ACE_OS::ioctl (n_handle,
+ I_SRDOPT, (void *) arg) == -1)
+ ACE_DEBUG ((LM_DEBUG, "%p\n", "ioctl failed"));
poll_array[n_handle].fd = n_handle;
+
if (n_handle >= width)
width = n_handle + 1;
}
diff --git a/examples/Misc/test_dump.cpp b/examples/Misc/test_dump.cpp
index 4a736efd2cd..5b67488b405 100644
--- a/examples/Misc/test_dump.cpp
+++ b/examples/Misc/test_dump.cpp
@@ -48,16 +48,16 @@ public:
int
main (void)
{
- SOCK sock;
+ SOCK outer_sock;
// Note that the SOCK superclass is *not* printed.
- SOCK_Stream stream;
- SOCK_Acceptor acceptor;
+ SOCK_Stream outer_stream;
+ SOCK_Acceptor outer_acceptor;
ACE_ODB::instance ()->dump_objects ();
{
- SOCK sock;
+ SOCK inner_sock;
// Note that the SOCK superclass is *not* printed.
- SOCK_Stream stream;
- SOCK_Acceptor acceptor;
+ SOCK_Stream inner_stream;
+ SOCK_Acceptor inner_acceptor;
ACE_ODB::instance ()->dump_objects ();
}
ACE_ODB::instance ()->dump_objects ();