* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
- * $Id: main.c 3445 2005-09-15 08:35:44Z yael $
+ * $Id: main.c 1632 2006-08-29 09:01:07Z tzachid $
*/
typedef struct _osm_main_args_t
{
int argc;
- char** argv;
+ char** argv;
+ boolean_t is_service;
} osm_main_args_t;
osm_main_args_t osm_main_args;
**********************************************************************/
ib_net64_t
get_port_guid(
- IN osm_opensm_t *p_osm, uint64_t port_guid )
+ IN osm_opensm_t *p_osm, uint64_t port_guid,
+ IN boolean_t is_service)
{
uint32_t i;
uint32_t choice = 0;
return( attr_array[i].port_guid );
}
}
+ /* If we are running as a service, and all ports are doen we return the
+ first port (we can't open a window, as a service)*/
+ if (is_service) {
+ return( attr_array[0].port_guid );
+ }
}
/* More than one possible port - list all ports and let the user to choose. */
status = osm_opensm_init( &osm, &opt );
if( status != IB_SUCCESS )
{
+ char buffer[LOG_ENTRY_SIZE_MAX];
const char *err_str = ib_get_err_str( status );
if (err_str == NULL)
{
}
printf( "\nError from osm_opensm_init: %s.\n",
err_str);
+ sprintf(buffer, "Error from osm_opensm_init: %s. See opensm log file for more details", err_str);
/* We will just exit, and not go to Exit, since we don't
want the destroy to be called. */
+ cl_log_event("OpenSM", LOG_ERR, buffer , NULL, 0);
+ g_service_state = SERVICE_STATE_START_FAILED;
return( status );
}
then get a port GUID value with which to bind.
*/
if( opt.guid == 0 || cl_hton64(opt.guid) == CL_HTON64(INVALID_GUID))
- opt.guid = get_port_guid( &osm, opt.guid );
+ opt.guid = get_port_guid( &osm, opt.guid, ((osm_main_args_t*)osm_main_args)->is_service );
if ( opt.guid == 0 )
{
if (!strcmp(argv[i], "--service"))
{
run_as_service = TRUE;
+ osm_main_args.is_service = TRUE;
break;
}
osm_exit_event = CreateEvent(NULL, FALSE, FALSE, NULL);
if (!run_as_service)
{
/* Running as executable */
+ osm_main_args.is_service = FALSE;
return opensm_main(&osm_main_args);
}
else