cerr cerr - 1 year ago 111
C Question

why is there a errno S_objLib_OBJ_UNAVAILABLE?

I want to send some data to a queue but get errno S_objLib_OBJ_UNAVAILABLE (3997698) for some reason and I don't know why. Here's what I have:

static MSG_Q_ID bfd_to_alm_data = NULL;
// in bfd_queues_create(void)
if (!bfd_to_alm_data) {
bfd_to_alm_data = msgQCreate
MAX_BFD_MSGS, /* max messages that can be queued */
sizeof(bfd_report_t), /* max bytes in a message */
MSG_Q_FIFO /* message queue options */
if (!bfd_to_alm_data) {
jpax_logMsg(LOG_ERROR, LOGSTREAM_SWITCH, "ERROR: Failed to create queue for bfd messages to alarm engine. errno %d\n",errno,0,0,0,0);
return ERROR;
// and this is where I get the error:
if (!bfd_to_alm_data)
rv = bfd_queues_create();
if (rv < 0) {
jpax_logMsg(LOG_ERROR, LOGSTREAM_SWITCH, "ERROR: Could not initialize bfd_to_alm_data! errcode %d \n",rv,0,0,0,0);

rv = msgQSend(bfd_to_alm_data,
if (rv < 0) {
jpax_logMsg(LOG_ERROR, LOGSTREAM_SWITCH, "ERROR: Could not push Bfd alarm data onto queue! errno %d\n",errno,0,0,0,0);

What might be going on here?

I can confirm, the Qeue handle stays the same between the calls to

mjs mjs
Answer Source

From the manual (specifically the Kernel API reference guide), we can see that errno will be set to S_objLib_OBJ_UNAVAILABLE when there was no room in the queue, and you have specified NO_WAIT as the timeout value.

S_objLib_OBJ_UNAVAILABLE No free buffer space was available and the NO_WAIT timeout was specified.

We can see in your code that you have specified NO_WAIT. There is nothing to indicate that the msgQ should be full - but perhaps you haven't shown all the code.

Things to check:

  1. Definition of MAX_BFD_MSGS - make sure it is large enough
  2. Ensure that something is reading from the queue.
  3. Consider using WAIT_FOREVER. This will cause the msgQSend operation to block until there is space in the queue.
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download