From ce7d19470fc5d7dd384fe157a7e6a7b0b08ecc8e Mon Sep 17 00:00:00 2001 From: schmidt Date: Fri, 29 Jun 2001 14:41:33 +0000 Subject: ChangeLogTag:Wed Jun 27 12:00:34 2001 Douglas C. Schmidt --- ace/FIFO_Recv_Msg.i | 35 ++++++++++++++++++++++------------- ace/FIFO_Send_Msg.i | 25 ++++++++++++++++--------- ace/Log_Priority.h | 5 ++--- ace/Log_Record.cpp | 32 +++++++++++++++++++++++++++++++- ace/Log_Record.h | 4 ++++ 5 files changed, 75 insertions(+), 26 deletions(-) (limited to 'ace') diff --git a/ace/FIFO_Recv_Msg.i b/ace/FIFO_Recv_Msg.i index dce1d06e29a..e47c0beef3e 100644 --- a/ace/FIFO_Recv_Msg.i +++ b/ace/FIFO_Recv_Msg.i @@ -13,10 +13,13 @@ ACE_FIFO_Recv_Msg::recv (ACE_Str_Buf &recv_msg) ACE_TRACE ("ACE_FIFO_Recv_Msg::recv"); #if defined (ACE_HAS_STREAM_PIPES) int i = 0; - return ACE_OS::getmsg (this->get_handle (), - (strbuf *) 0, - (strbuf *) &recv_msg, - &i); + if (ACE_OS::getmsg (this->get_handle (), + (strbuf *) 0, + (strbuf *) &recv_msg, + &i) == -1) + return -1; + else + return recv_msg.len; #else /* Do the ol' 2-read trick... */ if (ACE_OS::read (this->get_handle (), (char *) &recv_msg.len, @@ -45,10 +48,13 @@ ACE_FIFO_Recv_Msg::recv (ACE_Str_Buf *data, int *flags) { ACE_TRACE ("ACE_FIFO_Recv_Msg::recv"); - return ACE_OS::getmsg (this->get_handle (), - (strbuf *) cntl, - (strbuf *) data, - flags); + if (ACE_OS::getmsg (this->get_handle (), + (strbuf *) cntl, + (strbuf *) data, + flags) == -1) + return -1; + else + return (cntl == 0 ? 0 : cntl->len) + (data == 0 ? 0 : data->len); } ASYS_INLINE ssize_t @@ -58,10 +64,13 @@ ACE_FIFO_Recv_Msg::recv (int *band, int *flags) { ACE_TRACE ("ACE_FIFO_Recv_Msg::recv"); - return ACE_OS::getpmsg (this->get_handle (), - (strbuf *) cntl, - (strbuf *) data, - band, - flags); + if (ACE_OS::getpmsg (this->get_handle (), + (strbuf *) cntl, + (strbuf *) data, + band, + flags) == -1) + return -1; + else + return (cntl == 0 ? 0 : cntl->len) + (data == 0 ? 0 : data->len); } #endif /* ACE_HAS_STREAM_PIPES */ diff --git a/ace/FIFO_Send_Msg.i b/ace/FIFO_Send_Msg.i index e81484983c2..07b7de5e195 100644 --- a/ace/FIFO_Send_Msg.i +++ b/ace/FIFO_Send_Msg.i @@ -19,10 +19,13 @@ ACE_FIFO_Send_Msg::send (const ACE_Str_Buf *data, int flags) { ACE_TRACE ("ACE_FIFO_Send_Msg::send"); - return ACE_OS::putmsg (this->get_handle (), - (strbuf *) cntl, - (strbuf *) data, - flags); + if (ACE_OS::putmsg (this->get_handle (), + (strbuf *) cntl, + (strbuf *) data, + flags) == -1) + return-1; + else + return (cntl == 0 ? 0 : cntl->len) + (data == 0 ? 0 : data->len); } ASYS_INLINE ssize_t @@ -32,10 +35,14 @@ ACE_FIFO_Send_Msg::send (int band, int flags) { ACE_TRACE ("ACE_FIFO_Send_Msg::send"); - return ACE_OS::putpmsg (this->get_handle (), - (strbuf *) cntl, - (strbuf *) data, - band, - flags); + + if (ACE_OS::putpmsg (this->get_handle (), + (strbuf *) cntl, + (strbuf *) data, + band, + flags) == -1) + return -1; + else + return (cntl == 0 ? 0 : cntl->len) + (data == 0 ? 0 : data->len); } #endif /* ACE_HAS_STREAM_PIPES */ diff --git a/ace/Log_Priority.h b/ace/Log_Priority.h index e8bd08ce9cd..52c68acb918 100644 --- a/ace/Log_Priority.h +++ b/ace/Log_Priority.h @@ -20,13 +20,12 @@ * * These values are defined using powers of two so that it's * possible to form a mask to turn them on or off dynamically. + * We only use 12 bits, however, so users are free to use the + * remaining 19 bits to define their own priority masks. */ enum ACE_Log_Priority { - // = Note, this first argument *must* start at 1! - // We only use 12 bits, however, so users are free to use the - // remaining bits to define their own priority masks. /// Shutdown the logger (decimal 1). LM_SHUTDOWN = 01, diff --git a/ace/Log_Record.cpp b/ace/Log_Record.cpp index 5e34592fd47..b29d09e8993 100644 --- a/ace/Log_Record.cpp +++ b/ace/Log_Record.cpp @@ -29,7 +29,29 @@ const ACE_TCHAR *ACE_Log_Record::priority_names_[] = ACE_LIB_TEXT ("LM_ERROR"), ACE_LIB_TEXT ("LM_CRITICAL"), ACE_LIB_TEXT ("LM_ALERT"), - ACE_LIB_TEXT ("LM_EMERGENCY")}; + ACE_LIB_TEXT ("LM_EMERGENCY"), + ACE_LIB_TEXT ("LM_UNK(04000)") + ACE_LIB_TEXT ("LM_UNK(010000)") + ACE_LIB_TEXT ("LM_UNK(020000)") + ACE_LIB_TEXT ("LM_UNK(040000)") + ACE_LIB_TEXT ("LM_UNK(0100000)") + ACE_LIB_TEXT ("LM_UNK(0200000)") + ACE_LIB_TEXT ("LM_UNK(0400000)") + ACE_LIB_TEXT ("LM_UNK(01000000)") + ACE_LIB_TEXT ("LM_UNK(02000000)") + ACE_LIB_TEXT ("LM_UNK(04000000)") + ACE_LIB_TEXT ("LM_UNK(010000000)") + ACE_LIB_TEXT ("LM_UNK(020000000)") + ACE_LIB_TEXT ("LM_UNK(040000000)") + ACE_LIB_TEXT ("LM_UNK(0100000000)") + ACE_LIB_TEXT ("LM_UNK(0200000000)") + ACE_LIB_TEXT ("LM_UNK(0400000000)") + ACE_LIB_TEXT ("LM_UNK(01000000000)") + ACE_LIB_TEXT ("LM_UNK(02000000000)") + ACE_LIB_TEXT ("LM_UNK(04000000000)") + ACE_LIB_TEXT ("LM_UNK(010000000000)") + ACE_LIB_TEXT ("LM_UNK(020000000000)") +}; const ACE_TCHAR * ACE_Log_Record::priority_name (ACE_Log_Priority p) @@ -37,6 +59,14 @@ ACE_Log_Record::priority_name (ACE_Log_Priority p) return ACE_Log_Record::priority_names_[ACE::log2 (p)]; } +void +ACE_Log_Record::priority_name (ACE_Log_Priority p, + const ACE_TCHAR *name) +{ + // Name must be a statically allocated string + ACE_Log_Record::priority_names_[ACE::log2 (p)] = name; +} + u_long ACE_Log_Record::priority (void) const { diff --git a/ace/Log_Record.h b/ace/Log_Record.h index 17fdfda3925..131db76d129 100644 --- a/ace/Log_Record.h +++ b/ace/Log_Record.h @@ -103,6 +103,10 @@ public: */ static const ACE_TCHAR *priority_name (ACE_Log_Priority p); + // IMPORTANT: must be a statically allocated const ACE_TCHAR* + static void priority_name (ACE_Log_Priority p, + const ACE_TCHAR *name); + // = Marshall/demarshall /// Encode the for transmission on the network. void encode (void); -- cgit v1.2.1