当前位置: 首页>>代码示例>>C++>>正文


C++ saHpiSessionClose函数代码示例

本文整理汇总了C++中saHpiSessionClose函数的典型用法代码示例。如果您正苦于以下问题:C++ saHpiSessionClose函数的具体用法?C++ saHpiSessionClose怎么用?C++ saHpiSessionClose使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了saHpiSessionClose函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: exechandlercreate

static SaErrorT exechandlercreate (int argc, char **argv, int i)
{
   SaErrorT rv = SA_OK;
   oHpiHandlerIdT handlerid = 0;
   GHashTable * createparams = g_hash_table_new_full (
      g_str_hash, g_str_equal, g_free, g_free);
   SaHpiBoolT pluginnamegiven = SAHPI_FALSE;

   if (copt.debug) DBG ("createhandler started\n");

   while (i<argc){
      if (strcmp(argv[i],"-f")==0) {
         CRIT("input from file not implemented yet");
         return (SA_OK);
      }
      else if (++i<argc) {
         if (strcmp(argv[i-1],"plugin")==0) pluginnamegiven = SAHPI_TRUE;
         g_hash_table_insert( createparams,
            g_strdup( argv[i-1] ), 
            g_strdup( argv[i] ));
          if (copt.debug) DBG ("Pair of arguments: %s - %s\n",
            g_strdup( argv[i-1] ), 
            g_strdup( argv[i] ));
      }
      else // parameters not in pairs
         return (SA_ERR_HPI_INVALID_PARAMS);
      i++;
   }

   if (!pluginnamegiven) {
      CRIT("You must enter a valid plugin name");
      return (SA_ERR_HPI_INVALID_PARAMS);
   }

   rv = ohc_session_open_by_option ( &copt, &sessionid);
   if (rv != SA_OK) return rv;

   if (copt.debug) DBG("Calling oHpiHandlerCreate!");
   rv = oHpiHandlerCreate(sessionid, createparams, &handlerid );

   if ( rv != SA_OK ) {
      CRIT("oHpiHandlerCreate returned %s", oh_lookup_error(rv));
      saHpiSessionClose(sessionid);
      return(rv);
   }
   
   printf("Handler %u successfully created!\n", handlerid);

   rv = saHpiSessionClose(sessionid);
        
   return(SA_OK);

}
开发者ID:openhpi1,项目名称:openhpitest,代码行数:53,代码来源:ohhandler.c

示例2: main

int main (int argc, char *argv []) {
	SaErrorT 		err;
	SaHpiSessionIdT 	session_id;

	err =  saHpiSessionOpen(SAHPI_UNSPECIFIED_DOMAIN_ID, &session_id, NULL);
	if (err != SA_OK) {
		printf("%s: saHpiSessionOpen failed\n", argv[0]);
		printf("%s: the daemon may not be running\n", argv[0]);
		return (-1);
	}

	err =  saHpiDiscover(session_id);
	if (err != SA_OK) {
		printf("%s: saHpiDiscover failed\n", argv[0]);
		return (-1);
	}

	err =  saHpiSessionClose(session_id);
	if (err != SA_OK) {
		printf("%s: saHpiSessionClose failed\n", argv[0]);
		return (-1);
	}

	return 0;
}
开发者ID:openhpi1,项目名称:testrepo,代码行数:25,代码来源:ctest_01.cpp

示例3: main

int main(int argc, char **argv)
{
    SaHpiSessionIdT sid = 0;
    SaErrorT rc = SA_OK;
    int retc;

    rc = saHpiSessionOpen(SAHPI_UNSPECIFIED_DOMAIN_ID, &sid, NULL);
	if(rc != SA_OK)
		return -1;

	rc = saHpiDiscover(sid);
	if (rc != SA_OK)
		return -1;

    /* inject an event */
    retc = inject_event("simulator");
    if (retc != 0) {
        return -1;
    }

    /* sleep so the msg thread gets a chance to process the msg */
    g_usleep(100000);

    saHpiSessionClose(sid);

    return 0;
}
开发者ID:openhpi1,项目名称:testrepo,代码行数:27,代码来源:sim_sanity_047.c

示例4: bladehpi_destroy

static void
bladehpi_destroy(StonithPlugin *s)
{
	struct pluginDevice *	dev;

	if (Debug) {
		LOG(PIL_DEBUG, "%s: called", __FUNCTION__);
	}

	VOIDERRIFWRONGDEV(s);

	dev = (struct pluginDevice *)s;

	dev->pluginid = NOTpluginID;
	if (dev->device) {
		FREE(dev->device);
		dev->device = NULL;
	}
	if (dev->idinfo) {
		FREE(dev->idinfo);
		dev->idinfo = NULL;
	}
	free_bladehpi_hostlist(dev);

	if (dev->ohsession) {
		saHpiSessionClose(dev->ohsession);
		dev->ohsession = 0;
	}
	
	FREE(dev);
}
开发者ID:sipwise,项目名称:heartbeat,代码行数:31,代码来源:bladehpi.c

示例5: tsetup

SaErrorT tsetup (SaHpiSessionIdT *sessionid_ptr)
{

        SaErrorT err = SA_OK;	
        /* ************************	 	 
	 * Hook in simulation environment
	 * ***********************/
        
        err = saHpiSessionOpen(SAHPI_UNSPECIFIED_DOMAIN_ID, sessionid_ptr, NULL);
        if (err != SA_OK) {
                printf("Error! Can not open session.\n");
		printf("  File=%s, Line=%d\n", __FILE__, __LINE__);
                printf("  Received error=%s\n", oh_lookup_error(err));
        }
        
        if (!err) err = saHpiDiscover(*sessionid_ptr);
        if (err != SA_OK) {
                printf("Error! Can not discover resources.\n");
		printf("   File=%s, Line=%d\n", __FILE__, __LINE__);
                printf("   Received error=%s\n", oh_lookup_error(err));
                err = saHpiSessionClose(*sessionid_ptr);
        }
        
        return err;	 
}
开发者ID:openhpi1,项目名称:testrepo,代码行数:25,代码来源:tsetup.c

示例6: main

int main(int argc, char **argv)
{
        SaErrorT err;
        SaHpiSessionIdT sessionid;

        err = saHpiSessionOpen(SAHPI_UNSPECIFIED_DOMAIN_ID, &sessionid, NULL);
        if (err) {
	  printf("  Error! Testcase failed. Line=%d\n", __LINE__);
	  printf("  Received error=%s\n", oh_lookup_error(err));
	  return -1;
        }
	// regular sim_init is part of saHpiSessionOpen, here we close it
	sim_close();
	// env variable OPENHPI_SIMTEST_FILE is now defined in Makefile.am
	// setenv("OPENHPI_SIMTEST_FILE","./sim_test_file", 1);
	// create hash table based on input file
	err = sim_file();
	if (err != SA_OK) {
	  printf(" Error! sim_file failed\n");
	  return -1;
	} 

	/****************** 
	 * End of testcases 
         ******************/

        err = saHpiSessionClose(sessionid);
        if (err) {
	  printf("Error! saHpiSessionClose: err=%d\n", err);
	  return -1;
        }

        return 0;
}
开发者ID:openhpi1,项目名称:openhpitest,代码行数:34,代码来源:tsim_file.c

示例7: close_hpi_session

static void
close_hpi_session(struct pluginDevice *dev)
{
	if (dev && dev->ohsession) {
		saHpiSessionClose(dev->ohsession);
		dev->ohsession = 0;
	}
}
开发者ID:ystk,项目名称:debian-cluster-glue,代码行数:8,代码来源:bladehpi.c

示例8: closeSession

SaErrorT closeSession(SaHpiSessionIdT sessionId)
{
	SaErrorT status;

	status = saHpiSessionClose(sessionId);
	if (status != SA_OK) {
		e_print(saHpiSessionClose, SA_OK, status);
	}
	return status;
}
开发者ID:basheerk,项目名称:autotest-client-tests,代码行数:10,代码来源:12.c

示例9: tcleanup

SaErrorT tcleanup(SaHpiSessionIdT *sessionid_ptr)
{

	SaErrorT err = SA_OK;
	/***************************
	 * Close session, free memory
	 ***************************/
	 err = saHpiSessionClose(*sessionid_ptr);
	 return(err);

}
开发者ID:openhpi1,项目名称:testrepo,代码行数:11,代码来源:tsetup.c

示例10: close_session

int close_session()
{
	SaErrorT rv;

	pthread_kill(ge_thread, SIGKILL);
	
	rv = saHpiSessionClose(sessionid);
	if (rv != SA_OK) {
                printf("saHpiSessionClose error %s\n", oh_lookup_error(rv));
                return -1;
        }
	return 0;
}
开发者ID:openhpi1,项目名称:testrepo,代码行数:13,代码来源:session.c

示例11: main

int main(int argc, char **argv)
{
	int		c, i;
	SaErrorT	rv;
	char		buf[READ_BUF_SIZE];
	char		*S;

	printf("%s  ver %s\n", argv[0], progver);
	while ( (c = getopt( argc, argv,"x?")) != EOF )
		switch(c)  {
			case 'x':
				fdebug = 1;
				break;
			default:
				printf("Usage: %s [-x]\n", argv[0]);
				printf("   -x  Display debug messages\n");
				return(1);
		}

	rv = saHpiSessionOpen(SAHPI_UNSPECIFIED_DOMAIN_ID, &sessionid, NULL);

	if (rv != SA_OK) {
		printf("saHpiSessionOpen: %s\n", oh_lookup_error(rv));
		return(-1);
	}
 
	rv = saHpiDiscover(sessionid);

	if (fdebug) printf("saHpiDiscover: %s\n", oh_lookup_error(rv));

	rv = saHpiSubscribe(sessionid);
	if (rv != SA_OK) {
		printf( "saHpiSubscribe error %d\n",rv);
		return(-1);
	}	
	
	/* make the RPT list */
	get_rpts();
	/* get rdrs for the RPT list */
	for (i = 0; i < nrpts; i++)
		get_rdrs(Rpts + i);

	help();
	for (;;) {
		printf("==> ");
		S = fgets(buf, READ_BUF_SIZE, stdin);
		if (parse_command(S) < 0) break;
	};
	rv = saHpiSessionClose(sessionid);
	return(0);
}
开发者ID:openhpi1,项目名称:testrepo,代码行数:51,代码来源:hpithres.c

示例12: main

/* 
 * Main                
 */
int
main(int argc, char **argv)
{
	SaErrorT 	rv = SA_OK;
	SaHpiSessionIdT sessionid;
        GOptionContext *context;
	    
        /* Print version strings */
        oh_prog_version(argv[0]);

        /* Parsing options */
        static char usetext[]="- Display system topology\n  "
                              OH_SVN_REV; 
        OHC_PREPARE_REVISION(usetext);
        context = g_option_context_new (usetext);
        g_option_context_add_main_entries (context, my_options, NULL);

        if (!ohc_option_parse(&argc, argv, 
                context, &copt, 
                OHC_ALL_OPTIONS 
                    - OHC_ENTITY_PATH_OPTION  //TODO: Feature 880127?
                    - OHC_VERBOSE_OPTION )) { // no verbose mode implemented
                g_option_context_free (context);
		return 1;
	}
        g_option_context_free (context);
 
	if (f_rpt || f_sensor || f_inv || f_ctrl || f_rdr || f_wdog) 
           f_listall = TRUE;
	if (f_resourceid != 0) f_allres = FALSE;

        rv = ohc_session_open_by_option ( &copt, &sessionid);
	if (rv != SA_OK) return rv;

	/*
	 * Resource discovery
	 */
	if (copt.debug) DBG("saHpiDiscover");
	rv = saHpiDiscover(sessionid);
	if (rv != SA_OK) {
		CRIT("saHpiDiscover returns %s",oh_lookup_error(rv));
		return rv;
	}

	printf("Discovery done\n");
	list_resources(sessionid, (SaHpiResourceIdT) f_resourceid);

	rv = saHpiSessionClose(sessionid);
	
	return 0;
}
开发者ID:openhpi1,项目名称:testrepo,代码行数:54,代码来源:hpitree.c

示例13: close_session

int close_session()
{
	SaErrorT rv;

	/* Bug 2171901, replace pthread_kill(ge_thread, SIGKILL); */
	pthread_cancel(ge_thread);
	
	rv = saHpiSessionClose(Domain->sessionId);
	if (rv != SA_OK) {
                printf("saHpiSessionClose error %s\n", oh_lookup_error(rv));
                return -1;
        }
	return 0;
}
开发者ID:openhpi1,项目名称:testrepo,代码行数:14,代码来源:session.c

示例14: close_session

int close_session()
{
	SaErrorT rv;

	Domain->session_opened = 0;
	rv = saHpiSessionClose(Domain->sessionId);
	if (rv != SA_OK) {
                printf("saHpiSessionClose error %s\n", oh_lookup_error(rv));
                return -1;
        }
	// Wait a bit for get_event thread completion
	g_usleep(G_USEC_PER_SEC / 4);
	return 0;
}
开发者ID:openhpi1,项目名称:testrepo,代码行数:14,代码来源:session.c

示例15: ServerConnectionClose

cConnection::~cConnection()
{
  if ( m_con )
       ServerConnectionClose( m_con );

  while( m_sessions )
     {
       cSession *s = (cSession *)m_sessions->data;
       saHpiSessionClose( s->SessionId() );

       m_sessions = g_list_remove( m_sessions, s );
       delete s;
     }
}
开发者ID:openhpi1,项目名称:testrepo,代码行数:14,代码来源:openhpid.cpp


注:本文中的saHpiSessionClose函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。