Determine whether Open Server supports a platform-dependent service.
CS_BOOL srv_capability(capability)
CS_INT capability;
A constant that represents the Open Server services to test. The following table describes the legal values for capability:
Value |
Description |
---|---|
SRV_C_DEBUG |
srv_dbg_stack and srv_dbg_switch are supported. |
SRV_C_EXIT |
A callback routine can be invoked when a thread terminates. |
SRV_C_RESUME |
A callback routine can be invoked when a thread resumes execution. |
SRV_C_PREEMPT |
Preemptive scheduling is supported. |
SRV_C_SELECT |
srv_select is supported. |
SRV_C_SUSPEND |
A callback routine can be invoked when a thread is suspended. |
SRV_C_TIMESLICE |
A callback routine can be invoked when a thread exceeds the maximum number of clock ticks. |
SRV_POLL |
srv_poll is supported. |
Returns |
To indicate |
---|---|
CS_TRUE |
Open Server supports the service. |
CS_FALSE |
Open Server does not support the service. |
#include <ospublic.h>
/*
** Local Prototype
*/
extern CS_RETCODE ex_srv_capability PROTOTYPE((void));
/*
** EX_SRV_CAPABILITY
**
** Example routine to determine whether srv_poll is supported
** on this platform.
**
** Arguments:
** None.
**
** Returns:
**
** CS_SUCCEED srv_poll is supported on this platform.
** CS_FAIL srv_poll is not supported on this platform.
*/
CS_RETCODE ex_srv_capability()
{
CS_BOOL supported;
/*
** Check to see whether srv_poll is supported on this
** platform.
*/
supported = srv_capability(SRV_C_POLL);
/*
** If “supported” is CS_TRUE, we return CS_SUCCEED, if it is
** CS_FALSE we return CS_FAIL.
*/
return(supported ? CS_SUCCEED : CS_FAIL);
}
srv_capability allows you to write a portable Open Server application program and still use services that are not available on all platforms.
Open Server has two types of capabilities: platform capabilities and protocol capabilities. The srv_capability routine pertains to platform capabilities. The srv_capability_info routine pertains to protocol capabilities. See the srv_capability_info reference page, for details.
srv_callback, srv_capability, srv_dbg_stack, srv_dbg_switch, srv_poll (UNIX only), srv_select (UNIX only), srv_capability_info