Print this page
XXXX introduce drv_sectohz


 256         }
 257 
 258         /* check signature */
 259         if (IBMF_VERIFY_CLIENT_SIGNATURE(clientp) == B_FALSE) {
 260                 (void) sprintf(errmsg, "bad client signature");
 261                 error = B_TRUE;
 262                 status = IBMF_BAD_HANDLE;
 263                 goto bail;
 264         }
 265 
 266         /*
 267          * Verify the client does not have a receive callback registered.
 268          * If there are messages, give some time for the messages to be
 269          * cleaned up.
 270          */
 271         secs = 60;
 272         mutex_enter(&clientp->ic_mutex);
 273         while (clientp->ic_recv_cb == NULL && clientp->ic_msgs_alloced != 0 &&
 274             secs > 0) {
 275                 mutex_exit(&clientp->ic_mutex);
 276                 delay(drv_usectohz(1000000)); /* one second delay */
 277                 secs--;
 278                 mutex_enter(&clientp->ic_mutex);
 279         }
 280 
 281         if (clientp->ic_recv_cb != NULL || clientp->ic_msgs_alloced != 0) {
 282                 IBMF_TRACE_4(IBMF_TNF_NODEBUG, DPRINT_L1,
 283                     ibmf_unregister_err, IBMF_TNF_ERROR, "",
 284                     "ibmf_unregister(): %s, flags = 0x%x, recv_cb = 0x%p, "
 285                     "msgs_alloced = %d\n",
 286                     tnf_string, msg, "busy with resources", tnf_uint, ic_flags,
 287                     clientp->ic_flags, tnf_opaque, recv_cb, clientp->ic_recv_cb,
 288                     tnf_uint, msgs_allocd, clientp->ic_msgs_alloced);
 289                 IBMF_TRACE_0(IBMF_TNF_DEBUG, DPRINT_L4, ibmf_unregister_end,
 290                     IBMF_TNF_TRACE, "", "ibmf_unregister() exit\n");
 291                 mutex_exit(&clientp->ic_mutex);
 292                 return (IBMF_BUSY);
 293         }
 294 
 295         mutex_exit(&clientp->ic_mutex);
 296 




 256         }
 257 
 258         /* check signature */
 259         if (IBMF_VERIFY_CLIENT_SIGNATURE(clientp) == B_FALSE) {
 260                 (void) sprintf(errmsg, "bad client signature");
 261                 error = B_TRUE;
 262                 status = IBMF_BAD_HANDLE;
 263                 goto bail;
 264         }
 265 
 266         /*
 267          * Verify the client does not have a receive callback registered.
 268          * If there are messages, give some time for the messages to be
 269          * cleaned up.
 270          */
 271         secs = 60;
 272         mutex_enter(&clientp->ic_mutex);
 273         while (clientp->ic_recv_cb == NULL && clientp->ic_msgs_alloced != 0 &&
 274             secs > 0) {
 275                 mutex_exit(&clientp->ic_mutex);
 276                 delay(drv_sectohz(1)); /* one second delay */
 277                 secs--;
 278                 mutex_enter(&clientp->ic_mutex);
 279         }
 280 
 281         if (clientp->ic_recv_cb != NULL || clientp->ic_msgs_alloced != 0) {
 282                 IBMF_TRACE_4(IBMF_TNF_NODEBUG, DPRINT_L1,
 283                     ibmf_unregister_err, IBMF_TNF_ERROR, "",
 284                     "ibmf_unregister(): %s, flags = 0x%x, recv_cb = 0x%p, "
 285                     "msgs_alloced = %d\n",
 286                     tnf_string, msg, "busy with resources", tnf_uint, ic_flags,
 287                     clientp->ic_flags, tnf_opaque, recv_cb, clientp->ic_recv_cb,
 288                     tnf_uint, msgs_allocd, clientp->ic_msgs_alloced);
 289                 IBMF_TRACE_0(IBMF_TNF_DEBUG, DPRINT_L4, ibmf_unregister_end,
 290                     IBMF_TNF_TRACE, "", "ibmf_unregister() exit\n");
 291                 mutex_exit(&clientp->ic_mutex);
 292                 return (IBMF_BUSY);
 293         }
 294 
 295         mutex_exit(&clientp->ic_mutex);
 296