1 /* Copyright (C) 2021 Free Software Foundation, Inc.
4 This file is part of GNU Binutils.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3, or (at your option)
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, 51 Franklin Street - Fifth Floor, Boston,
19 MA 02110-1301, USA. */
33 #include "DbeThread.h"
34 #include "Experiment.h"
36 #define ipc_trace if (ipc_flags) ipc_default_log
37 #define ipc_request_trace if (ipc_flags) ipc_request_log
38 #define ipc_response_trace if (ipc_flags) ipc_response_log
43 static const int L_PROGRESS
= 0;
44 static const int L_INTEGER
= 1;
45 static const int L_BOOLEAN
= 2;
46 static const int L_LONG
= 3;
47 static const int L_STRING
= 4;
48 static const int L_DOUBLE
= 5;
49 static const int L_ARRAY
= 6;
50 static const int L_OBJECT
= 7;
51 static const int L_CHAR
= 8;
57 extern int cancellableChannelID
;
58 extern int error_flag
;
59 extern int ipc_delay_microsec
;
60 extern FILE *responseLogFileP
;
62 IPCresponse
*IPCresponseGlobal
;
64 BufferPool
*responseBufferPool
;
66 IPCrequest::IPCrequest (int sz
, int reqID
, int chID
)
73 buf
= (char *) malloc (size
);
74 cancelImmediate
= false;
77 IPCrequest::~IPCrequest ()
83 IPCrequest::read (void)
85 for (int i
= 0; i
< size
; i
++)
88 ipc_request_trace (TRACE_LVL_4
, " IPCrequest:getc(stdin): %02x\n", c
);
94 IPCrequest::getStatus (void)
100 IPCrequest::setStatus (IPCrequestStatus newStatus
)
106 readByte (IPCrequest
* req
)
110 for (int i
= 0; i
< 2; i
++)
115 ipc_request_trace (TRACE_LVL_4
, " readByte:getc(stdin): %02x\n", c
);
121 case '0': case '1': case '2': case '3':
122 case '4': case '5': case '6': case '7':
124 val
= val
* 16 + c
- '0';
126 case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
127 val
= val
* 16 + c
- 'a' + 10;
133 fprintf (stderr
, "readByte: Unknown byte: %d\n", c
);
141 readIVal (IPCrequest
*req
)
143 int val
= readByte (req
);
144 for (int i
= 0; i
< 3; i
++)
145 val
= val
* 256 + readByte (req
);
146 ipc_trace (" readIVal: %d\n", val
);
151 readSVal (IPCrequest
*req
)
153 int len
= readIVal (req
);
156 ipc_trace (" readSVal: <NULL>\n");
159 char *str
= (char *) malloc (len
+ 1);
163 *s
++ = req
->rgetc ();
165 ipc_trace (" readSVal: '%s'\n", str
);
170 readLVal (IPCrequest
*req
)
172 long long val
= readByte (req
);
173 for (int i
= 0; i
< 7; i
++)
174 val
= val
* 256 + readByte (req
);
175 ipc_trace (" readLVal: %lld\n", val
);
180 readBVal (IPCrequest
*req
)
182 int val
= readByte (req
);
183 ipc_trace (" readBVal: %s\n", val
== 0 ? "true" : "false");
188 readCVal (IPCrequest
*req
)
190 int val
= readByte (req
);
191 ipc_trace (" readCVal: %d\n", val
);
196 readDVal (IPCrequest
*req
)
198 String s
= readSVal (req
);
205 readAVal (IPCrequest
*req
)
208 int type
= readByte (req
);
212 type
= readByte (req
);
214 ipc_trace ("readAVal: twoD=%s type=%d\n", twoD
? "true" : "false", type
);
216 int len
= readIVal (req
);
224 Vector
<Vector
<int>*> *array
= new Vector
<Vector
<int>*>(len
);
225 for (int i
= 0; i
< len
; i
++)
226 array
->store (i
, (Vector
<int>*)readAVal (req
));
231 Vector
<int> *array
= new Vector
<int>(len
);
232 for (int i
= 0; i
< len
; i
++)
233 array
->store (i
, readIVal (req
));
240 Vector
<Vector
<long long>*> *array
= new Vector
<Vector
<long long>*>(len
);
241 for (int i
= 0; i
< len
; i
++)
242 array
->store (i
, (Vector
<long long>*)readAVal (req
));
247 Vector
<long long> *array
= new Vector
<long long>(len
);
248 for (int i
= 0; i
< len
; i
++)
249 array
->store (i
, readLVal (req
));
256 Vector
<Vector
<double>*> *array
= new Vector
<Vector
<double>*>(len
);
257 for (int i
= 0; i
< len
; i
++)
258 array
->store (i
, (Vector
<double>*)readAVal (req
));
263 Vector
<double> *array
= new Vector
<double>(len
);
264 for (int i
= 0; i
< len
; i
++)
265 array
->store (i
, readDVal (req
));
272 Vector
< Vector
<bool>*> *array
= new Vector
< Vector
<bool>*>(len
);
273 for (int i
= 0; i
< len
; i
++)
274 array
->store (i
, (Vector
<bool>*)readAVal (req
));
279 Vector
<bool> *array
= new Vector
<bool>(len
);
280 for (int i
= 0; i
< len
; i
++)
281 array
->store (i
, readBVal (req
));
288 Vector
<Vector
<char>*> *array
= new Vector
<Vector
<char>*>(len
);
289 for (int i
= 0; i
< len
; i
++)
290 array
->store (i
, (Vector
<char>*)readAVal (req
));
295 Vector
<char> *array
= new Vector
<char>(len
);
296 for (int i
= 0; i
< len
; i
++)
297 array
->store (i
, readCVal (req
));
304 Vector
<Vector
<String
>*> *array
= new Vector
<Vector
<String
>*>(len
);
305 for (int i
= 0; i
< len
; i
++)
306 array
->store (i
, (Vector
<String
>*)readAVal (req
));
311 Vector
<String
> *array
= new Vector
<String
>(len
);
312 for (int i
= 0; i
< len
; i
++)
313 array
->store (i
, readSVal (req
));
320 Vector
<Vector
<Object
>*> *array
= new Vector
<Vector
<Object
>*>(len
);
321 for (int i
= 0; i
< len
; i
++)
322 array
->store (i
, (Vector
<Object
>*)readAVal (req
));
327 Vector
<Object
> *array
= new Vector
<Object
>(len
);
328 for (int i
= 0; i
< len
; i
++)
329 array
->store (i
, readAVal (req
));
334 fprintf (stderr
, "readAVal: Unknown code: %d\n", type
);
342 static long long lVal
;
348 readResult (int type
, IPCrequest
*req
)
350 int tVal
= readByte (req
);
354 iVal
= readIVal (req
);
357 lVal
= readLVal (req
);
360 bVal
= readBVal (req
);
363 dVal
= readDVal (req
);
366 sVal
= readSVal (req
);
369 aVal
= readAVal (req
);
372 fprintf (stderr
, "EOF read in readResult\n");
376 fprintf (stderr
, "Unknown code: %d\n", tVal
);
381 fprintf (stderr
, "Internal error: readResult: parameter mismatch: type=%d should be %d\n", tVal
, type
);
387 readInt (IPCrequest
*req
)
389 readResult (L_INTEGER
, req
);
394 readString (IPCrequest
*req
)
396 readResult (L_STRING
, req
);
401 readLong (IPCrequest
*req
)
403 readResult (L_LONG
, req
);
408 readDouble (IPCrequest
*req
)
410 readResult (L_DOUBLE
, req
);
415 readBoolean (IPCrequest
*req
)
417 readResult (L_BOOLEAN
, req
);
422 readObject (IPCrequest
*req
)
424 readResult (L_LONG
, req
);
425 return (DbeObj
) lVal
;
429 readArray (IPCrequest
*req
)
431 readResult (L_ARRAY
, req
);
436 IPCresponse::IPCresponse (int sz
)
441 responseStatus
= RESPONSE_STATUS_SUCCESS
;
442 sb
= new StringBuilder (sz
);
446 IPCresponse::~IPCresponse ()
452 IPCresponse::reset ()
457 responseStatus
= RESPONSE_STATUS_SUCCESS
;
462 IPCresponse::sendByte (int b
)
464 ipc_trace ("sendByte: %02x %d\n", b
, b
);
465 sb
->appendf ("%02x", b
);
469 IPCresponse::sendIVal (int i
)
471 ipc_trace ("sendIVal: %08x %d\n", i
, i
);
472 sb
->appendf ("%08x", i
);
476 IPCresponse::sendLVal (long long l
)
478 ipc_trace ("sendLVal: %016llx %lld\n", l
, l
);
479 sb
->appendf ("%016llx", l
);
483 IPCresponse::sendSVal (const char *s
)
490 sendIVal ((int) strlen (s
));
491 ipc_trace ("sendSVal: %s\n", s
);
492 sb
->appendf ("%s", s
);
496 IPCresponse::sendBVal (bool b
)
498 sendByte (b
? 1 : 0);
502 IPCresponse::sendCVal (char c
)
508 IPCresponse::sendDVal (double d
)
511 snprintf (str
, sizeof (str
), "%.12f", d
);
516 IPCresponse::sendAVal (void *ptr
)
520 sendByte (L_INTEGER
);
525 VecType type
= ((Vector
<void*>*)ptr
)->type ();
530 sendByte (L_INTEGER
);
531 Vector
<int> *array
= (Vector
<int>*)ptr
;
532 sendIVal (array
->size ());
533 for (int i
= 0; i
< array
->size (); i
++)
534 sendIVal (array
->fetch (i
));
539 sendByte (L_BOOLEAN
);
540 Vector
<bool> *array
= (Vector
<bool>*)ptr
;
541 sendIVal (array
->size ());
542 for (int i
= 0; i
< array
->size (); i
++)
543 sendBVal (array
->fetch (i
));
549 Vector
<char> *array
= (Vector
<char>*)ptr
;
550 sendIVal (array
->size ());
551 for (int i
= 0; i
< array
->size (); i
++)
552 sendCVal (array
->fetch (i
));
558 Vector
<long long> *array
= (Vector
<long long>*)ptr
;
559 sendIVal (array
->size ());
560 for (int i
= 0; i
< array
->size (); i
++)
561 sendLVal (array
->fetch (i
));
567 Vector
<double> *array
= (Vector
<double>*)ptr
;
568 sendIVal (array
->size ());
569 for (int i
= 0; i
< array
->size (); i
++)
570 sendDVal (array
->fetch (i
));
576 Vector
<String
> *array
= (Vector
<String
>*)ptr
;
577 sendIVal (array
->size ());
578 for (int i
= 0; i
< array
->size (); i
++)
579 sendSVal (array
->fetch (i
));
586 Vector
<void*> *array
= (Vector
<void*>*)ptr
;
587 sendIVal (array
->size ());
588 for (int i
= 0; i
< array
->size (); i
++)
589 sendAVal (array
->fetch (i
));
595 sendByte (L_INTEGER
);
596 Vector
<void*> *array
= (Vector
<void*>*)ptr
;
597 sendIVal (array
->size ());
598 for (int i
= 0; i
< array
->size (); i
++)
599 sendAVal (array
->fetch (i
));
606 Vector
<void*> *array
= (Vector
<void*>*)ptr
;
607 sendIVal (array
->size ());
608 for (int i
= 0; i
< array
->size (); i
++)
609 sendAVal (array
->fetch (i
));
615 Vector
<void*> *array
= (Vector
<void*>*)ptr
;
616 sendIVal (array
->size ());
617 for (int i
= 0; i
< array
->size (); i
++)
618 sendAVal (array
->fetch (i
));
622 fprintf (stderr
, "sendAVal: Unknown type: %d\n", type
);
628 writeResponseHeader (int requestID
, int responseType
, int responseStatus
, int nBytes
)
630 if (responseType
== RESPONSE_TYPE_HANDSHAKE
)
631 nBytes
= IPC_VERSION_NUMBER
;
633 ipc_response_trace (TRACE_LVL_1
, "ResponseHeaderBegin----- %x ---- %x ----- %x -----%x -------\n", requestID
, responseType
, responseStatus
, nBytes
);
640 snprintf (buf
+ i
, 3, "%2x", HEADER_MARKER
);
642 snprintf (buf
+ i
, 9, "%8x", requestID
);
644 snprintf (buf
+ i
, 3, "%2x", responseType
);
646 snprintf (buf
+ i
, 3, "%2x", responseStatus
);
648 snprintf (buf
+ i
, 9, "%8x", nBytes
);
651 snprintf (buf
, 23, "%02x%08x%02x%02x%08x", HEADER_MARKER
, requestID
,
652 responseType
, responseStatus
, nBytes
);
658 cout
<< setfill ('0') << setw (2) << hex
<< HEADER_MARKER
;
659 cout
<< setfill ('0') << setw (8) << hex
<< requestID
;
660 cout
<< setfill ('0') << setw (2) << hex
<< responseType
;
661 cout
<< setfill ('0') << setw (2) << hex
<< responseStatus
;
662 cout
<< setfill ('0') << setw (8) << hex
<< nBytes
;
665 ipc_response_trace (TRACE_LVL_1
, "----------------------------ResponseHeaderEnd\n");
666 if (nBytes
> maxSize
)
669 ipc_trace ("New maxsize %ld\n", maxSize
);
674 cancelNeeded (int chID
)
676 if (chID
== cancellableChannelID
&& chID
== cancelRequestedChannelID
)
683 writeResponseWithHeader (int requestID
, int channelID
, int responseType
,
684 int responseStatus
, IPCresponse
* os
)
686 if (cancelNeeded (channelID
))
688 responseStatus
= RESPONSE_STATUS_CANCELLED
;
689 ipc_trace ("CANCELLING %d %d\n", requestID
, channelID
);
690 // This is for gracefully cancelling regular ops like openExperiment - getFiles should never reach here
692 os
->setRequestID (requestID
);
693 os
->setChannelID (channelID
);
694 os
->setResponseType (responseType
);
695 os
->setResponseStatus (responseStatus
);
698 responseBufferPool
->recycle (os
);
702 writeAckFast (int requestID
)
704 writeResponseHeader (requestID
, RESPONSE_TYPE_ACK
, RESPONSE_STATUS_SUCCESS
, 0);
708 writeAck (int requestID
, int channelID
)
711 char *s
= getenv (NTXT ("SP_NO_IPC_ACK"));
719 ipc_request_trace (TRACE_LVL_4
, "ACK skipped: requestID=%d channelID=%d\n", i
, j
);
723 IPCresponse
*OUTS
= responseBufferPool
->getNewResponse (BUFFER_SIZE_SMALL
);
724 writeResponseWithHeader (requestID
, channelID
, RESPONSE_TYPE_ACK
,
725 RESPONSE_STATUS_SUCCESS
, OUTS
);
730 writeHandshake (int requestID
, int channelID
)
732 IPCresponse
*OUTS
= responseBufferPool
->getNewResponse (BUFFER_SIZE_SMALL
);
733 writeResponseWithHeader (requestID
, channelID
, RESPONSE_TYPE_HANDSHAKE
, RESPONSE_STATUS_SUCCESS
, OUTS
);
734 // writeResponseHeader(requestID, RESPONSE_TYPE_HANDSHAKE, RESPONSE_STATUS_SUCCESS, IPC_VERSION_NUMBER);
738 writeResponseGeneric (int responseStatus
, int requestID
, int channelID
)
740 IPCresponse
*OUTS
= responseBufferPool
->getNewResponse (BUFFER_SIZE_SMALL
);
741 writeResponseWithHeader (requestID
, channelID
, RESPONSE_TYPE_COMPLETE
, responseStatus
, OUTS
);
744 BufferPool::BufferPool ()
746 pthread_mutex_init (&p_mutex
, NULL
);
751 BufferPool::~BufferPool ()
753 for (IPCresponse
*p
= smallBuf
; p
;)
755 IPCresponse
*tmp
= p
;
759 for (IPCresponse
*p
= largeBuf
; p
;)
761 IPCresponse
*tmp
= p
;
768 BufferPool::getNewResponse (int size
)
770 pthread_mutex_lock (&p_mutex
);
771 if (ipc_single_threaded_mode
&& size
< BUFFER_SIZE_LARGE
)
772 size
= BUFFER_SIZE_LARGE
;
773 IPCresponse
*newResponse
= NULL
;
774 if (size
>= BUFFER_SIZE_LARGE
)
778 newResponse
= largeBuf
;
779 largeBuf
= largeBuf
->next
;
784 newResponse
= smallBuf
;
785 smallBuf
= smallBuf
->next
;
788 newResponse
->reset ();
791 newResponse
= new IPCresponse (size
);
792 ipc_trace ("GETNEWBUFFER %d\n", size
);
794 pthread_mutex_unlock (&p_mutex
);
799 BufferPool::recycle (IPCresponse
*respB
)
801 pthread_mutex_lock (&p_mutex
);
802 if (respB
->getCurBufSize () >= BUFFER_SIZE_LARGE
)
804 respB
->next
= largeBuf
;
809 respB
->next
= smallBuf
;
812 pthread_mutex_unlock (&p_mutex
);
816 writeArray (void *ptr
, IPCrequest
* req
)
818 if (req
->getStatus () == CANCELLED_IMMEDIATE
)
820 IPCresponse
*OUTS
= responseBufferPool
->getNewResponse (BUFFER_SIZE_LARGE
);
821 OUTS
->sendByte (L_ARRAY
);
822 OUTS
->sendAVal (ptr
);
823 writeResponseWithHeader (req
->getRequestID (), req
->getChannelID (),
824 RESPONSE_TYPE_COMPLETE
, RESPONSE_STATUS_SUCCESS
, OUTS
);
828 writeString (const char *s
, IPCrequest
* req
)
830 if (req
->getStatus () == CANCELLED_IMMEDIATE
)
832 IPCresponse
*OUTS
= responseBufferPool
->getNewResponse (BUFFER_SIZE_LARGE
);
833 OUTS
->sendByte (L_STRING
);
835 writeResponseWithHeader (req
->getRequestID (), req
->getChannelID (),
836 RESPONSE_TYPE_COMPLETE
, RESPONSE_STATUS_SUCCESS
, OUTS
);
840 writeObject (DbeObj obj
, IPCrequest
* req
)
842 writeLong ((long long) obj
, req
);
846 writeBoolean (bool b
, IPCrequest
* req
)
848 if (req
->getStatus () == CANCELLED_IMMEDIATE
)
850 IPCresponse
*OUTS
= responseBufferPool
->getNewResponse (BUFFER_SIZE_MEDIUM
);
851 OUTS
->sendByte (L_BOOLEAN
);
853 writeResponseWithHeader (req
->getRequestID (), req
->getChannelID (),
854 RESPONSE_TYPE_COMPLETE
, RESPONSE_STATUS_SUCCESS
, OUTS
);
858 writeInt (int i
, IPCrequest
* req
)
860 if (req
->getStatus () == CANCELLED_IMMEDIATE
)
862 IPCresponse
*OUTS
= responseBufferPool
->getNewResponse (BUFFER_SIZE_MEDIUM
);
863 OUTS
->sendByte (L_INTEGER
);
865 writeResponseWithHeader (req
->getRequestID (), req
->getChannelID (), RESPONSE_TYPE_COMPLETE
, RESPONSE_STATUS_SUCCESS
, OUTS
);
869 writeChar (char c
, IPCrequest
* req
)
871 if (req
->getStatus () == CANCELLED_IMMEDIATE
)
873 IPCresponse
*OUTS
= responseBufferPool
->getNewResponse (BUFFER_SIZE_MEDIUM
);
874 OUTS
->sendByte (L_CHAR
);
876 writeResponseWithHeader (req
->getRequestID (), req
->getChannelID (), RESPONSE_TYPE_COMPLETE
, RESPONSE_STATUS_SUCCESS
, OUTS
);
880 writeLong (long long l
, IPCrequest
* req
)
882 if (req
->getStatus () == CANCELLED_IMMEDIATE
)
884 IPCresponse
*OUTS
= responseBufferPool
->getNewResponse (BUFFER_SIZE_MEDIUM
);
885 OUTS
->sendByte (L_LONG
);
887 writeResponseWithHeader (req
->getRequestID (), req
->getChannelID (), RESPONSE_TYPE_COMPLETE
, RESPONSE_STATUS_SUCCESS
, OUTS
);
891 writeDouble (double d
, IPCrequest
* req
)
893 if (req
->getStatus () == CANCELLED_IMMEDIATE
) return;
894 IPCresponse
*OUTS
= responseBufferPool
->getNewResponse (BUFFER_SIZE_MEDIUM
);
895 OUTS
->sendByte (L_DOUBLE
);
897 writeResponseWithHeader (req
->getRequestID (), req
->getChannelID (), RESPONSE_TYPE_COMPLETE
, RESPONSE_STATUS_SUCCESS
, OUTS
);
901 setProgress (int percentage
, const char *proc_str
)
903 if (cancelNeeded (currentChannelID
))
905 // ExperimentLoadCancelException *e1 = new ExperimentLoadCancelException();
909 if (NULL
== proc_str
)
911 int size
= strlen (proc_str
) + 100; // 100 bytes for additional data
912 int bs
= BUFFER_SIZE_MEDIUM
;
913 if (size
> BUFFER_SIZE_MEDIUM
)
915 if (size
> BUFFER_SIZE_LARGE
) return 1; // This should never happen
916 bs
= BUFFER_SIZE_LARGE
;
918 IPCresponse
*OUTS
= responseBufferPool
->getNewResponse (bs
);
919 OUTS
->sendByte (L_PROGRESS
);
920 OUTS
->sendIVal (percentage
);
921 OUTS
->sendSVal (proc_str
);
922 writeResponseWithHeader (currentRequestID
, currentChannelID
, RESPONSE_TYPE_PROGRESS
, RESPONSE_STATUS_SUCCESS
, OUTS
);
927 IPCresponse::print (void)
929 if (ipc_delay_microsec
)
930 usleep (ipc_delay_microsec
);
931 int stringSize
= sb
->length ();
932 writeResponseHeader (requestID
, responseType
, responseStatus
, stringSize
);
935 char *s
= sb
->toString ();
936 hrtime_t start_time
= gethrtime ();
939 write (1, s
, stringSize
); // write(1, sb->toString(), stringSize);
945 hrtime_t end_time
= gethrtime ();
946 unsigned long long time_stamp
= end_time
- start_time
;
947 ipc_response_log (TRACE_LVL_3
, "ReqID %x flush time %llu nanosec \n", requestID
, time_stamp
);
953 setCancelRequestedCh (int chID
)
955 cancelRequestedChannelID
= chID
;
961 int marker
= readByte (NULL
);
962 if (marker
!= HEADER_MARKER
)
964 fprintf (stderr
, "Internal error: received request (%d) without header marker\n", marker
);
969 ipc_request_trace (TRACE_LVL_1
, "RequestHeaderBegin------------------------\n");
970 int requestID
= readIVal (NULL
);
971 int requestType
= readByte (NULL
);
972 int channelID
= readIVal (NULL
);
973 int nBytes
= readIVal (NULL
);
974 if (requestType
== REQUEST_TYPE_HANDSHAKE
)
976 // write the ack directly to the wire, not through the response queue
977 // writeAckFast(requestID);
978 writeAck (requestID
, channelID
);
980 writeHandshake (requestID
, channelID
);
981 ipc_request_trace (TRACE_LVL_1
, "RQ: HANDSHAKE --- %x ----- %x ---- %x --- %x -RequestHeaderEnd\n", requestID
, requestType
, channelID
, nBytes
);
983 else if (requestType
== REQUEST_TYPE_CANCEL
)
985 writeAck (requestID
, channelID
);
986 ipc_request_trace (TRACE_LVL_1
, "RQ: CANCEL --- RQ: %x ----- %x --- CH: %x --- %x -RequestHeaderEnd\n", requestID
, requestType
, channelID
, nBytes
);
987 if (channelID
== cancellableChannelID
)
989 // we have worked on at least one request belonging to this channel
990 writeResponseGeneric (RESPONSE_STATUS_SUCCESS
, requestID
, channelID
);
991 setCancelRequestedCh (channelID
);
992 ipc_trace ("CANCELLABLE %x %x\n", channelID
, currentChannelID
);
993 if (channelID
== currentChannelID
)
994 // request for this channel is currently in progress
995 ipc_request_trace (TRACE_LVL_1
, "IN PROGRESS REQUEST NEEDS CANCELLATION");
996 // ssp_post_cond(waitingToFinish);
1001 // it is possible that a request for this channel is on the requestQ
1002 // or has been submitted to the work group queue but is waiting for a thread to pick it up
1003 writeResponseGeneric (RESPONSE_STATUS_FAILURE
, requestID
, channelID
);
1004 setCancelRequestedCh (channelID
);
1005 ipc_request_trace (TRACE_LVL_1
, "RETURNING FAILURE TO CANCEL REQUEST channel %d\n", channelID
);
1010 writeAck (requestID
, channelID
);
1011 ipc_request_trace (TRACE_LVL_1
, "RQ: --- %x ----- %x ---- %x --- %x -RequestHeaderEnd\n", requestID
, requestType
, channelID
, nBytes
);
1012 IPCrequest
*nreq
= new IPCrequest (nBytes
, requestID
, channelID
);
1014 ipc_request_trace (TRACE_LVL_1
, "RQ: --- %x Read from stream \n", requestID
);
1015 if (cancelNeeded (channelID
))
1017 ipc_request_trace (TRACE_LVL_1
, "CANCELLABLE REQ RECVD %x %x\n", channelID
, requestID
);
1018 writeResponseGeneric (RESPONSE_STATUS_CANCELLED
, requestID
, channelID
);
1022 DbeQueue
*q
= new DbeQueue (ipc_doWork
, nreq
);
1023 ipcThreadPool
->put_queue (q
);