Beispiel #1
0
/* The central entry point for the emulator interrupt. This is used by
 * different special programs to call the emulator from VM86 space. 
 * Look at emuint.h for definitions and a list of the currently defined
 * subfunctions.
 * To call emuint from VM86 space do:
 *	push ax		   Save original ax value (*must be done* !)
 *	mov  ah, funcnum   Emuint function number to ah
 *	mov  al, subfunc   Subfunction number, optional, depening on func
 *	int  0xff		
 *	..
 *	..
 * Emuint saves the function and subfunction numbers internally, then
 * pops ax off the stack and calls the function handler with the original
 * value in ax.
 */
void
emuint(regcontext_t *REGS)
{
    u_short func, subfunc;

    /* Remove function number from stack */
    func = R_AH;
    subfunc = R_AL;

    R_AX = POP(REGS);

    /* Call the function handler, subfunction is ignored, if unused */
    switch (func)
    {
	/* The redirector call */
	case EMU_REDIR:
	    intff(REGS);
	    break;

	/* EMS call, used by emsdriv.sys */
	case EMU_EMS:
	{
	    switch (subfunc) 
	    {
	    	case EMU_EMS_CTL:
		    R_AX = (u_short)ems_init();
		    break;

	    	case EMU_EMS_CALL:
		    ems_entry(REGS);
		    break;

		default:
		    debug(D_ALWAYS, "Undefined subfunction for EMS call\n");
		    break;
	    }
	    break;
	}

	default:
	    debug(D_ALWAYS, "Emulator interrupt called with undefined function %02x\n", func);

            /* 
             * XXX
             * temporary backwards compatibility with instbsdi.exe
             * remove after a while.
             */
            fprintf(stderr, "***\n*** WARNING - unknown emuint function\n");
            fprintf(stderr, "*** Continuing; assuming instbsdi redirector.\n");
            fprintf(stderr, "*** Please install the new redirector");
            fprintf(stderr, " `redir.com' as soon as possible.\n");
            fprintf(stderr, "*** This compatibility hack is not permanent.\n");
            fprintf(stderr, "***\n");
            PUSH(R_AX, REGS);
            R_BX = R_ES;
            R_DX = R_DI;
            R_DI = R_DS;
            intff(REGS);
	    break;
    }
}
Beispiel #2
0
int main(int argc, char **argv)
{

   if (argc == 1)
     {
        pid_t pid;
        pid_t sid;
        int fp;
        char str[32];

        pid = fork();
        if (pid < 0)
          return EXIT_FAILURE;

        if (pid > 0)
           return EXIT_SUCCESS;
 
        umask(027);

        sid = setsid();
        if (sid < 0)
          return EXIT_FAILURE;
        
        
        if ((chdir("/")) < 0)
          return EXIT_FAILURE;
        
        /* Close out the standard file descriptors */
        close(STDIN_FILENO);
        close(STDOUT_FILENO);
        close(STDERR_FILENO);


        fp = open("/run/lock/enna-media-server.lock", 
                  O_RDWR|O_CREAT, 0640);
        printf("Fp : %d\n", fp);
	if (fp < 0)
          return EXIT_FAILURE;

	if (lockf(fp, F_TLOCK, 0) < 0) 
          return EXIT_FAILURE;

        snprintf(str, sizeof(str), "%d\n", getpid());
	write(fp, str, strlen(str)); /* record pid to lockfile */

        if (!ems_init(NULL))
          return EXIT_FAILURE;
        
        ems_run();
        ems_shutdown();
        return EXIT_SUCCESS;

  
     }

   if (!ems_init(NULL))
     return EXIT_FAILURE;

   argv++;
   argc--;

   _handle_options(argc, argv);


   return EXIT_SUCCESS;
}
Beispiel #3
0
EAPI_MAIN int
elm_main(int argc, char **argv)
{
   char *theme = NULL;
   int args;
   unsigned char quit_option = 0;
   Eina_Rectangle geometry = {0, 0, 0, 0};
   Eina_Bool is_fullscreen = 0;
   Enna *enna;

   Ecore_Getopt_Value values[] =
   {
      ECORE_GETOPT_VALUE_BOOL(is_fullscreen),
      ECORE_GETOPT_VALUE_PTR_CAST(geometry),
      ECORE_GETOPT_VALUE_BOOL(quit_option),
      ECORE_GETOPT_VALUE_BOOL(quit_option),
      ECORE_GETOPT_VALUE_BOOL(quit_option),
      ECORE_GETOPT_VALUE_BOOL(quit_option),
      ECORE_GETOPT_VALUE_STR(theme),
      ECORE_GETOPT_VALUE_NONE
   };

   eina_init();

   ecore_app_args_set(argc, (const char **) argv);
   args = ecore_getopt_parse(&_options, values, argc, argv);

   if (args < 0)
     {
        ERR("Could not parse options !");
        return EXIT_FAILURE;
     }

   if (quit_option)
     return EXIT_SUCCESS;

   if (!enna_init())
     goto shutdown;

   if (!enna_config_init())
     goto shutdown_enna;

   if (theme)
     enna_config_theme_set(theme);

   if (!ems_init(enna_config_config_get(), EINA_FALSE))
     goto shutdown_config;

   enna = enna_add(is_fullscreen, geometry);
   if (!enna)
     goto shutdown_config;

   //   INF("Start scanner");
   //   ems_scanner_start();
   INF("Start services annoucement");
   ems_avahi_start();

   ems_run();

   ems_shutdown();
   enna_config_shutdown();
   enna_shutdown();
   elm_shutdown();

   return EXIT_SUCCESS;

 shutdown_config:
   enna_config_shutdown();
 shutdown_enna:
   enna_shutdown();
 shutdown:
   enna_shutdown();
   return -1;
}