diff options
-rw-r--r-- | ChangeLog-98b | 17 | ||||
-rw-r--r-- | examples/OS/Process/imore.cpp | 10 | ||||
-rw-r--r-- | examples/Service_Configurator/IPC-tests/client/local_dgram_client_test.cpp | 85 |
3 files changed, 74 insertions, 38 deletions
diff --git a/ChangeLog-98b b/ChangeLog-98b index cb45472586c..8ade3c0af80 100644 --- a/ChangeLog-98b +++ b/ChangeLog-98b @@ -1,3 +1,13 @@ +Wed May 6 23:28:47 1998 Douglas C. Schmidt <schmidt@tango.cs.wustl.edu> + + * examples/Service_Configurator/IPC-tests/client/local_dgram_client_test.cpp: + Fixed a couple of mistakes that were causing the UNIX domain + sockets not to work. Thanks to Sandro Doro + <doros@aureus.sublink.org> for recommending this. + + * performance-tests/Misc/context_switch_time.cpp (svc): An 'i' + was being defined twice, gorp! It's fixed now! + Wed May 06 22:00:14 1998 David L. Levine <levine@cs.wustl.edu> * ace/config-linux-common.h: only #define @@ -22,8 +32,6 @@ Wed May 06 16:32:53 1998 Nanbor Wang <nanbor@cs.wustl.edu> ACE_EXPORT_DECLARE and specified ACE_Export directly for ACE_Filecache_Handle and ACE_Filecache in calss declarations. -Wed May 6 02:57:40 1998 Nanbor Wang <nanbor@cs.wustl.edu> - * ace/Thread_Manager.{h,i,cpp}: A bug was found by Arturo Montes <mitosys@colomsat.net.co> who noticed that when a thread was spawned and then exited immediately, its thread descriptor might @@ -77,11 +85,6 @@ Wed May 6 02:57:40 1998 Nanbor Wang <nanbor@cs.wustl.edu> ACE_HAS_THREADS down to avoid compilation error on non-threaded platforms. -Wed May 6 00:15:39 1998 Douglas C. Schmidt <schmidt@tango.cs.wustl.edu> - - * performance-tests/Misc/context_switch_time.cpp (svc): An 'i' - was being defined twice, gorp! It's fixed now! - Tue May 5 14:12:08 1998 Douglas C. Schmidt <schmidt@flamenco.cs.wustl.edu> * include/makeinclude/platform_sco5.0.0-fsu-pthread.GNU: Added a diff --git a/examples/OS/Process/imore.cpp b/examples/OS/Process/imore.cpp index 6c01734dbc6..09c841e2569 100644 --- a/examples/OS/Process/imore.cpp +++ b/examples/OS/Process/imore.cpp @@ -92,12 +92,14 @@ setup_named_pipes (ACE_Process_Options &opt) // Create a unique temporary name for named pipe. char *rendezvous = ACE_OS::tempnam (rendezvous_dir, rendezvous_pfx); - if (rendezvous == NULL) // out of memory? + + // Out of memory? + if (rendezvous == NULL) return -1; - // Alright, this is indeed strange. Named pipes are meant to - // be used for unrelated processes. Because of the constraints - // in ACE_Process, I have to pre-open the named pipes here. + // Alright, this is indeed strange. Named pipes are meant to be + // used for unrelated processes. Because of the constraints in + // ACE_Process, I have to pre-open the named pipes here. ACE_FIFO_Recv rfifo; // read end fifo. ACE_FIFO_Send wfifo; // write end fifo. diff --git a/examples/Service_Configurator/IPC-tests/client/local_dgram_client_test.cpp b/examples/Service_Configurator/IPC-tests/client/local_dgram_client_test.cpp index a9c62bba081..8c0be1c0e58 100644 --- a/examples/Service_Configurator/IPC-tests/client/local_dgram_client_test.cpp +++ b/examples/Service_Configurator/IPC-tests/client/local_dgram_client_test.cpp @@ -1,27 +1,28 @@ -/* Tests out the UNIX domain IPC-SAP abstraction. */ // $Id$ +// Tests out the UNIX domain IPC-SAP abstraction. #include "ace/LSOCK_CODgram.h" #include "ace/LSOCK_Dgram.h" #include "ace/UNIX_Addr.h" - #include "ace/Get_Opt.h" #if defined (ACE_HAS_MSG) && !defined (ACE_LACKS_UNIX_DOMAIN_SOCKETS) -/* Name of the program. */ +// Name of the program. static char *program_name; -/* Name of rendezvous point. */ +// Name of rendezvous point. static char *rendezvous_codgram = "/tmp/foo_codgram"; -static char *rendezvous_dgram = "/tmp/foo_dgram"; +static char *rendezvous_dgram = "/tmp/foo_dgram"; -/* Name of file to send. */ +// Name of file to send. static char *file_name = "local_data"; static void print_usage_and_die (void) { - ACE_ERROR ((LM_ERROR, "usage: %s [-r rendezvous_dgram] [-c rendezvous_codgram] [-f file]\n%a", - program_name, -1)); + ACE_ERROR ((LM_ERROR, + "usage: %s [-r rendezvous_dgram] [-c rendezvous_codgram] [-f file]\n%a", + program_name, + -1)); } void @@ -54,34 +55,64 @@ main (int argc, char *argv[]) parse_args (argc, argv); - ACE_LSOCK_Dgram sd (ACE_Addr::sap_any); - ACE_LSOCK_CODgram sc; - int fd; - - if (sc.open (ACE_UNIX_Addr (rendezvous_codgram), ACE_Addr::sap_any) < 0) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "open"), -1); - - if ((fd = ACE_OS::open (file_name, O_RDONLY)) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "open"), -1); + char *sock_client = ACE_OS::tempnam (0, 0); - /* Send the open file descriptor to the server! */ + if (ACE_OS::unlink (sock_client)) + ACE_ERROR_RETURN ((LM_ERROR, + "%p\n", + "unlink"), + -1); + ACE_LSOCK_Dgram sd ((ACE_UNIX_Addr) (sock_client)); + ACE_OS::free ((void *) sock_client); - if (sc.send_handle (fd) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "send"), -1); + ACE_LSOCK_CODgram sc; + ACE_HANDLE handle; + + if (sc.open (ACE_UNIX_Addr (rendezvous_codgram), + ACE_Addr::sap_any) == -1) + ACE_ERROR_RETURN ((LM_ERROR, + "%p\n", + "open"), + -1); + + handle = ACE_OS::open (file_name, O_RDONLY); + + if (handle == -1) + ACE_ERROR_RETURN ((LM_ERROR, + "%p\n", + "open"), + -1); + + // Send the open file descriptor to the server! + + if (sc.send_handle (handle) == -1) + ACE_ERROR_RETURN ((LM_ERROR, + "%p\n", + "send"), + -1); char *name = ACE_OS::cuserid (0); - if (sd.send (name, strlen (name) + 1, ACE_UNIX_Addr (rendezvous_dgram)) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "send"), -1); - - if (ACE_OS::close (fd) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "close"), -1); - + if (sd.send (name, + ACE_OS::strlen (name) + 1, + ACE_UNIX_Addr (rendezvous_dgram)) == -1) + ACE_ERROR_RETURN ((LM_ERROR, + "%p\n", + "send"), + -1); + + if (ACE_OS::close (handle) == -1) + ACE_ERROR_RETURN ((LM_ERROR, + "%p\n", + "close"), + -1); return 0; } #else int main (int, char *[]) { - ACE_ERROR_RETURN ((LM_ERROR, "your platform must support sendmsg/recvmsg to run this test\n"), -1); + ACE_ERROR_RETURN ((LM_ERROR, + "your platform must support sendmsg/recvmsg to run this test\n"), + -1); } #endif /* ACE_HAS_MSG */ |