Ejemplo n.º 1
0
static DFBResult
system_shutdown( bool emergency )
{
     DFBResult   ret;

     // for now just crash until we implement a clean shutdown
     crashme();

     AndroidDataShared *shared;
     D_ASSERT( m_data != NULL );

     shared = m_data->shared;
     D_ASSERT( shared != NULL );

     dfb_surface_pool_destroy( shared->pool );

     /* cleanup EGL related stuff */
     eglDestroyContext( m_data->dpy, m_data->ctx );
     eglTerminate( m_data->dpy );

     SHFREE( shared->shmpool, shared );

     D_FREE( m_data );
     m_data = NULL;

     return DFB_OK;
}
Ejemplo n.º 2
0
static int do_fork(void)
{
	int pid, status;
	int argc;

	switch (pid = fork()) {
	case -1:
		internal_assert(0);
	case 0:
		if (simple) {
			argc = 1;
			igt_simple_init(argc, argv_run);
			crashme();

			igt_exit();
		} else {

			argc = 1;
			igt_subtest_init(argc, argv_run);

			if(runa)
				igt_subtest("A")
					;

			igt_subtest("B")
				crashme();

			if(runc)
				igt_subtest("C")
					;

			igt_exit();
		}
	default:
		while (waitpid(pid, &status, 0) == -1 &&
		       errno == EINTR)
			;

		if(WIFSIGNALED(status))
			return WTERMSIG(status) + 128;

		return WEXITSTATUS(status);
	}
}
Ejemplo n.º 3
0
CMPIStatus
TestMethodProviderInvokeMethod(CMPIMethodMI * mi,
                               const CMPIContext *ctx,
                               const CMPIResult *rslt,
                               const CMPIObjectPath * ref,
                               const char *methodName,
                               const CMPIArgs * in, CMPIArgs * out)
{
  CMPIStatus      rc = { CMPI_RC_OK, NULL };
  CMPIString     *className;
  CMPIData        data;
  char            result[80] = "Hello,";
  const char     *strCat;
  const char     *name;
  char           *argName = "Message";
  CMPIString     *str1;
  CMPIString     *str2;
  CMPIValue       val1,
                  val2;

  /*
   * get the class name from object-path 
   */
  className = CMGetClassName(ref, &rc);
  /*
   * get a pointer to a C char* representation of this String. 
   */
  name = CMGetCharsPtr(className, &rc);

  if (!strcmp(name, _ClassName)) {
    if (!strcmp("SayHello", methodName)) {
      /*
       * gets the number of arguments contained in "in" Args. 
       */
      if (CMGetArgCount(in, &rc) > 0) {
        /*
         * gets a Name argument value 
         */
        data = CMGetArg(in, "Name", &rc);
        /*
         * check for data type and not null value of argument value
         * recieved 
         */
        if (data.type == CMPI_string && !(CMIsNullValue(data))) {
          strCat = CMGetCharsPtr(data.value.string, &rc);
          strcat(result, strCat);
          // strcat(result, "!");
          /*
           * create the new string to return to client 
           */
          str1 = CMNewString(_broker, result, &rc);
          val1.string = str1;
        }
      } else {
        str1 = CMNewString(_broker, result, &rc);
        val1.string = str1;
      }
      /*
       * create string to add to an array 
       */
      str2 = CMNewString(_broker, "Have a good day", &rc);
      val2.string = str2;
      /*
       * Adds a value of str2 string to out array argument 
       */
      rc = CMAddArg(out, argName, &val2, CMPI_string);

    /*
     * For: 3048960 method array types not filled in Test provider. 
     */
    } else if (!strcmp("CheckArrayNoType", methodName)) {
      data = CMGetArg(in, "IntArray", &rc);
      CMPIType atype=data.value.array->ft->getSimpleType(data.value.array,&rc); 
      sprintf(result,"Datatype is %s",paramType(atype));
      str1 = CMNewString(_broker, result, &rc);
      val1.string = str1;

    /*
     * This method simulates various provider problems for testing. 
     */
    } else if (!strcmp("Misbehave", methodName)) {
      data = CMGetArg(in, "Action", &rc);

      const char *strval = NULL;
      if (data.type == CMPI_string && !(CMIsNullValue(data))) {
        strval = CMGetCharsPtr(data.value.string, &rc);
        sprintf(result, "data type is %s, value = %s", paramType(data.type),
            strval);
        
        if (!strcmp(strval,"hang")) {
          while(sleep(60)); /* to test req handler timeout, etc. */
        }
        else if (!strcmp(strval,"abort")) {
          abort();
        }
        else if (!strcmp(strval,"fpe")) {
          #pragma GCC diagnostic ignored "-Wdiv-by-zero"
          fprintf(stderr,"ouch! %d\n",1/0);
          #pragma GCC diagnostic warning "-Wdiv-by-zero"
        }
        else if (!strcmp(strval,"segfault")) {
          void (*crashme)(void) = NULL;
          crashme();
        }
        /*
         * These tend to behave as if the condition were raised internally
         */
        else if (!strcmp(strval,"sigabrt")) {
          kill(getpid(), SIGABRT);
          while(sleep(3)); /* slight pause to ensure we catch signal */
        }
        else if (!strcmp(strval,"sigfpe")) {
          kill(getpid(), SIGFPE);
          while(sleep(3));
        }
        else if (!strcmp(strval,"sigsegv")) {
          kill(getpid(), SIGSEGV);
          while(sleep(3));
        }
        else if (!strcmp(strval,"sigusr1")) {
          kill(getpid(), SIGUSR1); /* as if we received a signal from stopBroker() */
          while(sleep(3));
        }
        else if (!strcmp(strval,"sigkill")) {
          kill(getpid(), SIGKILL); /* this is currently not handled by providerDrv*/
          while(sleep(3));
        } else {
          sprintf(result, "Action not recognized: %s", strval);
          fprintf(stderr,
              "+++ cmpiTestMethodProvider: Action not recognized \"%s\"\n",
              strval);
        }
        /*
         * create the new string to return to client 
         */
        str1 = CMNewString(_broker, result, &rc);
        val1.string = str1;
      }

    } else {
      sprintf(result, "Unknown method name: %s", methodName);
      fprintf(stderr,
          "+++ cmpiTestMethodProvider: Unknown method name \"%s\"\n",
          methodName);
      
      str1 = CMNewString(_broker, result, &rc);
      val1.string = str1;
    }
  }
  CMReturnData(rslt, (CMPIValue *) & val1, CMPI_string);
  CMReturnDone(rslt);
  return rc;
}