Example #1
0
int monitor_init(void) {
  int rc;

  /* Registering device */
  rc = register_chrdev(monitor_major, "badmonitor", &monitor_fops);
  if (rc < 0) {
    printk(
      "<1>badmonitor: cannot obtain major number %d\n", monitor_major);
    return rc;
  }

  /* Allocating monitor_buffer */
  monitor_buffer = kmalloc(MAX_SIZE, GFP_KERNEL); 
  if (!monitor_buffer) { 
    rc = -ENOMEM;
    goto fail; 
  } 
  memset(monitor_buffer, 0, MAX_SIZE);
  curr_size= 0;
  curr_pos= 0;
  m_init(&mutex);
  c_init(&wait_queue);

  printk("<1>Inserting badmonitor module\n"); 
  return 0;

  fail: 
    monitor_exit(); 
    return rc;
}
Example #2
0
int syncread_init(void) {
  int rc;

  /* Registering device */
  rc = register_chrdev(syncread_major, "syncread", &syncread_fops);
  if (rc < 0) {
    printk(
      "<1>syncread: cannot obtain major number %d\n", syncread_major);
    return rc;
  }

  readers= 0;
  writing= FALSE;
  pend_open_write= 0;
  curr_size= 0;
  m_init(&mutex);
  c_init(&cond);

  /* Allocating syncread_buffer */
  syncread_buffer = kmalloc(MAX_SIZE, GFP_KERNEL);
  if (syncread_buffer==NULL) {
    syncread_exit();
    return -ENOMEM;
  }
  memset(syncread_buffer, 0, MAX_SIZE);

  printk("<1>Inserting syncread module\n");
  return 0;
}
Example #3
0
/*
 * The "packet" keg constructor.
 */
static int
mb_ctor_pack(void *mem, int size, void *arg, int how)
{
	struct mbuf *m;
	struct mb_args *args;
	int error, flags;
	short type;

	m = (struct mbuf *)mem;
	args = (struct mb_args *)arg;
	flags = args->flags;
	type = args->type;

#ifdef INVARIANTS
	trash_ctor(m->m_ext.ext_buf, MCLBYTES, arg, how);
#endif

	error = m_init(m, NULL, size, how, type, flags);

	/* m_ext is already initialized. */
	m->m_data = m->m_ext.ext_buf;
 	m->m_flags = (flags | M_EXT);

	return (error);
}
Example #4
0
template <class T> TypeBase<T>::TypeBase(const char *name, const char *doc)
  : id (register_type(m_type_object))
{
  PYHROL_TRACE(pyhrol::tpInternal, this, __PRETTY_FUNCTION__);

  m_init(name, doc);
}
Example #5
0
Widget init_application(int *argc, char **argv )
{
    m_init();
    XtAppContext app;
    XtSetLanguageProc (NULL, NULL, NULL);
    XawInitializeWidgetSet();
    /*  -- Intialize Toolkit creating the application shell
     */
    Widget appShell = XtOpenApplication (&app, APP_NAME,
	     options, XtNumber(options),  /* resources: can be set from argv */
	     argc, argv,
	     fallback_resources,
	     sessionShellWidgetClass,
	     NULL, 0
	   );
    /* enable Editres support */
    XtAddEventHandler(appShell, (EventMask) 0, True, _XEditResCheckMessages, NULL);
    XtAddCallback( appShell, XtNdieCallback, quit_gui, NULL );

    /* not parsed options are removed by XtOpenApplication
       the only entry left should be the program name
    */
    if (*argc != 1) { m_destruct(); syntax(); exit(1); }
    TopLevel = appShell;
    RAC( appShell, wm_quit );
    RCB( appShell, quit_gui );

    /*  -- Register all Athena and Public widget classes, CBs, ACTs
     */
    XpRegisterAll ( app );
    return appShell;

}
Example #6
0
int main(int argc, char *argv[]) {
	int kb_input;

	strcpy(game_server_ip, DEFAULT_SERVER_IP);
	game_server_port = DEFAULT_SERVER_PORT;

	ai_height_weight = 3.0;
	ai_line_weight = -2.0;
	ai_empty_blocks_weight = 5.0;

	auto_mode = 1;

	if (argc > 1) {
		// Manage commandline arguments
		m_manageArgs(argc, argv);
	}

	m_init();

	g_new_game();

	while (done == 0) {
		g_draw();
		kb_input = getch();
		g_cycle(kb_input);
	}

	m_deinit();

	return EXIT_SUCCESS;
}
Example #7
0
int slirp_init(void)
{
    //    debug_init("/tmp/slirp.log", DEBUG_DEFAULT);
    
#ifdef _WIN32
    {
        WSADATA Data;
        WSAStartup(MAKEWORD(2,0), &Data);
	atexit(slirp_cleanup);
    }
#endif

    link_up = 1;

    if_init();
    ip_init();

    /* Initialise mbufs *after* setting the MTU */
    m_init();

    /* set default addresses */
    inet_aton("127.0.0.1", &loopback_addr);

    if (get_dns_addr(&dns_addr) < 0)
        return -1;

    inet_aton(CTL_SPECIAL, &special_addr);
	alias_addr.s_addr = special_addr.s_addr | htonl(CTL_ALIAS);
	getouraddr();
    return 0;
}
Example #8
0
/*
 * Constructor for Mbuf master zone.
 *
 * The 'arg' pointer points to a mb_args structure which
 * contains call-specific information required to support the
 * mbuf allocation API.  See mbuf.h.
 */
static int
mb_ctor_mbuf(void *mem, int size, void *arg, int how)
{
	struct mbuf *m;
	struct mb_args *args;
	int error;
	int flags;
	short type;

#ifdef INVARIANTS
	trash_ctor(mem, size, arg, how);
#endif
	args = (struct mb_args *)arg;
	type = args->type;

	/*
	 * The mbuf is initialized later.  The caller has the
	 * responsibility to set up any MAC labels too.
	 */
	if (type == MT_NOINIT)
		return (0);

	m = (struct mbuf *)mem;
	flags = args->flags;

	error = m_init(m, NULL, size, how, type, flags);

	return (error);
}
Example #9
0
    bool Container::init()
    {
        DPRINTF("Task %s, init\n", m_name);

        m_dll = dlopen(m_appname, RTLD_LAZY);
        if(NULL == m_dll) {
            EPRINTF("Error loading %s\n\t%s\n", m_appname, dlerror());
            return false;
        }

        m_init = reinterpret_cast<bfunc_t>(dlsym(m_dll, "init"));
        if(NULL == m_init) {
            EPRINTF("Error finding init() function\n");
            return false;
        }

        m_execute = reinterpret_cast<bfunc_t>(dlsym(m_dll, "execute"));
        if(NULL == m_execute) {
            EPRINTF("Error finding execute() function\n");
            return false;
        }

        m_terminate = reinterpret_cast<vfunc_t>(dlsym(m_dll, "terminate"));
        if(NULL == m_terminate) {
            EPRINTF("Error finding terminate() function\n");
            return false;
        }

        return m_init();
    }
Example #10
0
tDecAES::tDecAES(nOperationModeAES opmode, const u8 key[], nKeyLengthAES keylen)
{
    // See if this CPU supports the Intel AES-NI instruction set (implemented in assembly (ASM)).
    bool useFastASM = check_for_aes_instructions();

    // Call init.
    m_init(opmode, key, keylen, useFastASM);
}
Example #11
0
void slirp_init(int restricted, const char *special_ip)
{
#if DEBUG
    int   slirp_logmask = 0;
    char  slirp_logfile[512];
    {
        const char*  env = getenv( "ANDROID_SLIRP_LOGMASK" );
        if (env != NULL)
            slirp_logmask = atoi(env);
         else if (VERBOSE_CHECK(slirp))
            slirp_logmask = DEBUG_DEFAULT;
    }

    {
        char*  p   = slirp_logfile;
        char*  end = p + sizeof(slirp_logfile);

        p = bufprint_temp_file( p, end, "slirp.log" );
        if (p >= end) {
            dprint( "cannot create slirp log file in temporary directory" );
            slirp_logmask = 0;
        }
    }
    if (slirp_logmask) {
        dprint( "sending slirp logs with mask %x to %s", slirp_logmask, slirp_logfile );
        debug_init( slirp_logfile, slirp_logmask );
    }
#endif

    link_up = 1;
    slirp_restrict = restricted;

    if_init();
    ip_init();

    
    m_init();

    
    inet_strtoip("127.0.0.1", &loopback_addr_ip);

    if (dns_addr_count == 0) {
        if (slirp_get_system_dns_servers() < 0) {
            dns_addr[0]    = loopback_addr_ip;
            dns_addr_count = 1;
            fprintf (stderr, "Warning: No DNS servers found\n");
        }
    }

    inet_strtoip(CTL_SPECIAL, &special_addr_ip);

    alias_addr_ip = special_addr_ip | CTL_ALIAS;
    getouraddr();
    register_savevm("slirp", 0, 1, slirp_state_save, slirp_state_load, NULL);

    slirp_net_forward_init();
}
Example #12
0
	Log::Log() {
		if(!m_instance) {
			m_file = nullptr;
			m_instance = this;
			m_init();
		} else {
			err("Log уже был создан");
		}
	}
Example #13
0
static void start_client() {
    extern struct commands_t cmdlist[];
    int nreg;
    
    /* system init */
    currmode = 0;
    
    signal(SIGHUP, abort_bbs);
    signal(SIGTERM, abort_bbs);
    signal(SIGPIPE, abort_bbs);

    signal(SIGINT, abort_bbs_debug);
    signal(SIGQUIT, abort_bbs_debug);
    signal(SIGILL, abort_bbs_debug);
    signal(SIGABRT, abort_bbs_debug);
    signal(SIGFPE, abort_bbs_debug);
    signal(SIGBUS, abort_bbs_debug);
    signal(SIGSEGV, abort_bbs_debug);
    
    signal_restart(SIGUSR1, talk_request);
    signal_restart(SIGUSR2, write_request);
    
    dup2(0, 1);
    
    do_term_init();
    signal(SIGALRM, abort_bbs);
    alarm(600);
    login_query();		/* Ptt 加上login time out */
    user_login();
    m_init();

#if FORCE_PROCESS_REGISTER_FORM    
    if (HAS_PERM(PERM_SYSOP) && (nreg = dashs(fn_register)/163) > 100)
    {
    	char cpu_load[30];
    	if(cpuload(cpu_load) > MAX_CPULOAD*2/3)	/* DickG: 根據目前的 load 來 */
	    scan_register_form(fn_register, 1, nreg/20); /* 決定要審核的數目 */
	else
	    scan_register_form(fn_register, 1, nreg/10);
    }
#endif
    if(HAVE_PERM(PERM_SYSOP | PERM_BM))
	b_closepolls();
    if(!(cuser.uflag & COLOR_FLAG))
	showansi = 0;
#ifdef DOTIMEOUT
    /* init_alarm();*/ // cause strange logout with saving post.
    signal(SIGALRM, SIG_IGN);
#else
    signal(SIGALRM, SIG_IGN);
#endif
    if(chkmailbox())
	m_read();
    
    domenu(MMENU, "主功\能表", (chkmail(0) ? 'M' : 'C'), cmdlist);
}
Example #14
0
matrix *m_slice(matrix *m, long r_start, long r_stop, long c_start, long c_stop) {
    matrix *temp = m_init(r_stop-r_start, c_stop-c_start);
    for (long i = r_start; i < r_stop; i++) {
        for (long j = c_start; j < c_stop; j++) {
            temp->data[i-r_start][j-c_start] = m->data[i][j];
        }
    }

    return temp;
}
Example #15
0
Flock::Flock(BasicObject* a_pObj, cpt3f& a_trgtPos) :
	v_trgtPt(a_trgtPos)
{
	assert((BasicObject*)0 != a_pObj);

	v_pObj = a_pObj;

	v_velHistory.clear();

	m_init();
}
Example #16
0
/*===========================================================================*
 *				   main 				     *
 *===========================================================================*/
int main(void)
{
    /* Main program. Initialize the memory driver and start the main loop. */
    struct sigaction sa;

    sa.sa_handler = SIG_MESS;
    sigemptyset(&sa.sa_mask);
    sa.sa_flags = 0;
    if (sigaction(SIGTERM,&sa,NULL)<0) panic("MEM","sigaction failed", errno);

    m_init();
    driver_task(&m_dtab, DRIVER_STD);
    return(0);
}
Example #17
0
void g_clear(gameOverReason_t r)
{
	int i;
	boolean newHighScore = false;
	SDL_Surface * image;
	
	if (r == REASON_LOSS)
	{
		SDL_Delay(500);
		
		printf("Game over...\n");
		image = g_loadImage("./pictures/GAME_OVER.bmp");
		g_addSurface(TEXT_GAMEOVER_X, TEXT_GAMEOVER_Y, image, screen, NULL);
		SDL_FreeSurface(image);
		SDL_Flip(screen);
		
		SDL_Delay(GAME_OVER_PAUSE);
		
		for ( i = 0; i < HIGH_SCORES_LIST_SIZE; i++ )
		{
			if (game.score > highScores.scores[i])
			{
				newHighScore = true;
				game.highScoreIndexToReplace = i;
				break;
			}
		}
	}
	
	//clear tetrominoz
	tetro_clear(game.next);
	tetro_clear(game.current);
	g_clearGrid();
			
	game.state = STATE_MENU;
	
	if (newHighScore)
	{
		menu.nextMoveDir = DIR_NONE;
		menu.menuLoc = M_NEWHIGH;
		menu.currentSelection = S_IDLE,
		game.newHighScore[0] = ' ';
		game.newHighScore[1] = 0;
		game.newHighScore[2] = 0;
		game.newHighScore[3] = 0;
	}
	else
		m_init();
}
Example #18
0
File: main.c Project: UzixLS/ehs5fs
int main( int argc, char *argv[] )
{
    struct fuse_args args = FUSE_ARGS_INIT(argc, argv);

    if( fuse_opt_parse( &args, NULL, opts, opt_proc ) ) return 1;
    fuse_opt_add_arg( &args, "-s" );
    if( options.debug ) fuse_opt_add_arg( &args, "-d" );
    if( options.readonly ) fuse_opt_add_arg( &args, "-oro" );
    if( options.point ) fuse_opt_add_arg( &args, options.point );
    if( !options.point || !options.dev  ) {
        printf( usage );
        return -2;
    }

    if( m_init( &M, options.dev ) < 0 ) {
        printf( "m_init failed!\n" );
        return -1;
	}

    return fuse_main( args.argc, args.argv, &fuse_ops, NULL );
}
Example #19
0
int main(int argc,char* args[]) {
	// if(!m_init(3,1)) {return 1;}
	if(!m_init(3,0)) {return 1;}

	// gWindow = m_newWindow(640,480,"hello",FALSE);
	gWindow = m_newWindow(640,480,"hello",TRUE);
	
	initGL();

	m_setTypingFunction(handleKeys);
	m_setKeyStateFunction(keystate_function);
	m_setMainLoopFunction(render);

	m_MainLoop();

	//Deallocate program
	glDeleteProgram( gProgramID );
	m_close();

	return 0;
}
Example #20
0
void slirp_init(int restricted, char *special_ip)
{
#if defined(DEBUG)
    debug_init("/tmp/slirp.log", DEBUG_DEFAULT);
#endif

#ifdef _WIN32
    {
        WSADATA Data;
        WSAStartup(MAKEWORD(2,0), &Data);
	atexit(slirp_cleanup);
    }
#endif

    link_up = 1;
    slirp_restrict = restricted;

    if_init();
    ip_init();

    /* Initialise mbufs *after* setting the MTU */
    m_init();

    /* set default addresses */
    inet_aton("127.0.0.1", &loopback_addr);

    if (get_dns_addr(&dns_addr) < 0) {
        dns_addr = loopback_addr;
        fprintf (stderr, "Warning: No DNS servers found\n");
    }

    if (special_ip)
        slirp_special_ip = special_ip;

    inet_aton(slirp_special_ip, &special_addr);
    alias_addr.s_addr = special_addr.s_addr | htonl(CTL_ALIAS);
    getouraddr();
    register_savevm("slirp", 0, 1, slirp_state_save, slirp_state_load, NULL);
}
Example #21
0
int bano_init(void) {
  int b;

  /* Registering device */
  b = register_chrdev(bano_major, "bano", &bano_fops);
  if (b < 0) {
    printk("<1>Bano: cannot obtain major number %d\n", bano_major);
    return b;
  }

  damas = 0;
  varones = 0;
  curr_size_d = 0;
  curr_size_v = 0;
  damas_pos = 0;
  varones_pos = 0;
  m_init(&mutex);
  c_init(&cond);

  /* Allocating syncread_buffer */
  buffer_d = kmalloc(MAX_SIZE, GFP_KERNEL);
  if (buffer_d == NULL) {
    bano_exit();
    return -ENOMEM;
  }
  memset(buffer_d, 0, MAX_SIZE);

  buffer_v = kmalloc(MAX_SIZE, GFP_KERNEL);
  if (buffer_v == NULL) {
    bano_exit();
    return -ENOMEM;
  }
  memset(buffer_v, 0, MAX_SIZE);

  printk("<1>Inserting bano module varones y damas\n");
  return 0;
}
Example #22
0
void slirp_init(int restricted, const char *special_ip)
{
    

#ifdef _WIN32
    {
        WSADATA Data;
        WSAStartup(MAKEWORD(2,0), &Data);
	atexit(slirp_cleanup);
    }
#endif

    link_up = 1;
    slirp_restrict = restricted;

    if_init();
    ip_init();

    
    m_init();

    
    inet_aton("127.0.0.1", &loopback_addr);

    if (get_dns_addr(&dns_addr) < 0) {
        dns_addr = loopback_addr;
        fprintf (stderr, "Warning: No DNS servers found\n");
    }

    if (special_ip)
        slirp_special_ip = special_ip;

    inet_aton(slirp_special_ip, &special_addr);
    alias_addr.s_addr = special_addr.s_addr | htonl(CTL_ALIAS);
    getouraddr();
    register_savevm("slirp", 0, 1, slirp_state_save, slirp_state_load, NULL);
}
Example #23
0
int32 EventLoop::init() {
    int32 ret = 0;

    m_epl = epoll_create(m_max_fds);
    if(m_epl < 0) {
        NLogError << "EventLoop:" << std::hex
                  << this << " init epoll_create fail!";
        return -1;

    }

    ret = startCtl();
    if(ret < 0) {
        NLogError << "EventLoop:" << std::hex
                  << this << " init startCtl fail!";
        return -4;
    }

    if(m_init) {
        m_init(this, m_obj);
    }

    return 0;
}
Example #24
0
/******************************************************************************
*   MAIN function
******************************************************************************/
int main ( int argc, char **argv )
{
    trace_main = TRACE_MAIN;

    XtAppContext app;
    signal(SIGPIPE, SIG_IGN); /* ignore broken pipe on write */
    m_init();
    trace_level = trace_main;

    XtSetLanguageProc (NULL, NULL, NULL);
    XawInitializeWidgetSet();
    /*  -- Intialize Toolkit creating the application shell
     */
    Widget appShell = XtOpenApplication (&app, APP_NAME,
	     options, XtNumber(options),  /* resources: can be set from argv */
	     &argc, argv,
	     fallback_resources,
	     sessionShellWidgetClass,
	     NULL, 0
	   );

    /* enable Editres support */
    XtAddEventHandler(appShell, (EventMask) 0, True, _XEditResCheckMessages, NULL);

    XtAddCallback( appShell, XtNdieCallback, quit_gui, NULL );

    /* not parsed options are removed by XtOpenApplication
       the only entry left should be the program name
    */
    if (argc != 1) { m_destruct(); syntax(); exit(1); }

    TopLevel = appShell;


    /*  -- Register all application specific callbacks and widget classes
     */
    RegisterApplication ( appShell );

    /*  -- Register all Athena and Public widget classes, CBs, ACTs
     */
    XpRegisterAll ( app );

    /*  -- Create widget tree below toplevel shell using Xrm database
     */
    WcWidgetCreation ( appShell );

    /* get application resources and widget ptr */
    XtGetApplicationResources(	appShell, (XtPointer)&CONFIG,
				basicSettingRes,
				XtNumber(basicSettingRes),
				(ArgList)0, 0 );


    InitializeApplication(appShell);

    /*  -- Realize the widget tree and enter the main application loop
     */
    XtRealizeWidget ( appShell );
    grab_window_quit( appShell );


    XtAppMainLoop ( app ); /* use XtAppSetExitFlag */
    XtDestroyWidget(appShell);

    v_free(CONFIG.vset);
    m_destruct();

    return EXIT_SUCCESS;
}
		virtual void
		init()
		{
			m_init( *this );
		}
Example #26
0
void
tcp_pcap_add(struct tcphdr *th, struct mbuf *m, struct mbufq *queue)
{
	struct mbuf *n = NULL, *mhead;

	KASSERT(th, ("%s: called with th == NULL", __func__));
	KASSERT(m, ("%s: called with m == NULL", __func__));
	KASSERT(queue, ("%s: called with queue == NULL", __func__));

	/* We only care about data packets. */
	while (m && m->m_type != MT_DATA)
		m = m->m_next;

	/* We only need to do something if we still have an mbuf. */
	if (!m)
		return;

	/* If we are not saving mbufs, return now. */
	if (queue->mq_maxlen == 0)
		return;

	/*
	 * Check to see if we will need to recycle mbufs.
	 *
	 * If we need to get rid of mbufs to stay below
	 * our packet count, try to reuse the mbuf. Once
	 * we already have a new mbuf (n), then we can
	 * simply free subsequent mbufs.
	 *
	 * Note that most of the logic in here is to deal
	 * with the reuse. If we are fine with constant
	 * mbuf allocs/deallocs, we could ditch this logic.
	 * But, it only seems to make sense to reuse
	 * mbufs we already have.
	 */
	while (mbufq_full(queue)) {
		mhead = mbufq_dequeue(queue);

		if (n) {
			tcp_pcap_m_freem(mhead);
		}
		else {
			/*
			 * If this held an external cluster, try to
			 * detach the cluster. But, if we held the
			 * last reference, go through the normal
			 * free-ing process.
			 */
			if (mhead->m_flags & M_EXT) {
				switch (mhead->m_ext.ext_type) {
				case EXT_SFBUF:
					/* Don't mess around with these. */
					tcp_pcap_m_freem(mhead);
					continue;
				default:
					if (atomic_fetchadd_int(
						mhead->m_ext.ext_cnt, -1) == 1)
					{
						/*
						 * We held the last reference
						 * on this cluster. Restore
						 * the reference count and put
						 * it back in the pool.
				 		 */
						*(mhead->m_ext.ext_cnt) = 1;
						tcp_pcap_m_freem(mhead);
						continue;
					}
					/*
					 * We were able to cleanly free the
					 * reference.
				 	 */
					atomic_subtract_int(
					    &tcp_pcap_clusters_referenced_cur,
					    1);
					tcp_pcap_alloc_reuse_ext++;
					break;
				}
			}
			else {
				tcp_pcap_alloc_reuse_mbuf++;
			}

			n = mhead;
			tcp_pcap_m_freem(n->m_next);
			m_init(n, NULL, 0, M_NOWAIT, MT_DATA, 0);
		}
	}

	/* Check to see if we need to get a new mbuf. */
	if (!n) {
		if (!(n = m_get(M_NOWAIT, MT_DATA)))
			return;
		tcp_pcap_alloc_new_mbuf++;
	}

	/*
	 * What are we dealing with? If a cluster, attach it. Otherwise,
	 * try to copy the data from the beginning of the mbuf to the
	 * end of data. (There may be data between the start of the data
	 * area and the current data pointer. We want to get this, because
	 * it may contain header information that is useful.)
	 * In cases where that isn't possible, settle for what we can
	 * get.
	 */
	if ((m->m_flags & M_EXT) && tcp_pcap_take_cluster_reference()) {
		n->m_data = m->m_data;
		n->m_len = m->m_len;
		mb_dupcl(n, m);
	}
	else if (((m->m_data + m->m_len) - M_START(m)) <= M_SIZE(n)) {
		/*
		 * At this point, n is guaranteed to be a normal mbuf
		 * with no cluster and no packet header. Because the
		 * logic in this code block requires this, the assert
		 * is here to catch any instances where someone
		 * changes the logic to invalidate that assumption.
		 */
		KASSERT((n->m_flags & (M_EXT | M_PKTHDR)) == 0,
			("%s: Unexpected flags (%#x) for mbuf",
			__func__, n->m_flags));
		n->m_data = n->m_dat + M_LEADINGSPACE_NOWRITE(m);
		n->m_len = m->m_len;
		bcopy(M_START(m), n->m_dat,
			m->m_len + M_LEADINGSPACE_NOWRITE(m));
	}
	else {
		/*
		 * This is the case where we need to "settle for what
		 * we can get". The most probable way to this code
		 * path is that we've already taken references to the
		 * maximum number of mbuf clusters we can, and the data
		 * is too long to fit in an mbuf's internal storage.
		 * Try for a "best fit".
		 */
		tcp_pcap_copy_bestfit(th, m, n);

		/* Don't try to get additional data. */
		goto add_to_queue;
	}

	if (m->m_next) {
		n->m_next = m_copym(m->m_next, 0, M_COPYALL, M_NOWAIT);
		tcp_pcap_adj_cluster_reference(n->m_next, 1);
	}

add_to_queue:
	/* Add the new mbuf to the list. */
	if (mbufq_enqueue(queue, n)) {
		/* This shouldn't happen. If INVARIANTS is defined, panic. */
		KASSERT(0, ("%s: mbufq was unexpectedly full!", __func__));
		tcp_pcap_m_freem(n);
	}
}
Example #27
0
tDecAES::tDecAES(nOperationModeAES opmode, const u8 key[], nKeyLengthAES keylen,
                 bool useFastASM)
{
    // Call init.
    m_init(opmode, key, keylen, useFastASM);
}
Example #28
0
quadCopter::quadCopter()
{
	m_init();
}
Example #29
0
/******************************************************************************
*   MAIN function
******************************************************************************/
int main ( int argc, char **argv )
{
    trace_main = TRACE_MAIN;

    XtAppContext app;
    m_init();
    XtSetLanguageProc (NULL, NULL, NULL);
    XawInitializeWidgetSet();

    /*  --  Intialize Toolkit creating the application shell
     */
    Widget appShell = XtOpenApplication (&app, APP_NAME,
             /* resources: can be set from argv */
             options, XtNumber(options),
	     &argc, argv,
	     fallback_resources,
	     sessionShellWidgetClass,
	     NULL, 0
	   );
    load_icon(XtDisplay(appShell));
    //    load_icon_default();

    /*  --  Enable Editres support
     */
    XtAddEventHandler(appShell, (EventMask) 0, True, _XEditResCheckMessages, NULL);

    XtAddCallback( appShell, XtNdieCallback, quit_cb, NULL );

    /*  --  not parsed options are removed by XtOpenApplication
            the only entry left should be the program name
    */
    if (argc != 1) { m_destruct(); syntax(); exit(1); }
    TopLevel = appShell;


    /*  --  Register all application specific
            callbacks and widget classes
    */
    RegisterApplication ( appShell );

    /*  --  Register all Athena and Public
            widget classes, CBs, ACTs
    */
    XpRegisterAll ( app );

    /*  --  Create widget tree below toplevel shell
            using Xrm database
    */
    WcWidgetCreation ( appShell );


    /*  -- Get application resources and widget ptrs
     */
    XtGetApplicationResources(	appShell, (XtPointer)&CWRI,
				CWRI_CONFIG_RES,
				XtNumber(CWRI_CONFIG_RES),
				(ArgList)0, 0 );

    InitializeApplication(appShell);

    /*  --  Realize the widget tree and enter
            the main application loop  */
    XtRealizeWidget ( appShell );
    /*  --  Set Icon for Window */
    set_app_icon(appShell);

    grab_window_quit( appShell );

    XtAppMainLoop ( app ); /* use XtAppSetExitFlag */
    XtDestroyWidget(appShell);
    m_destruct();

    return EXIT_SUCCESS;
}
Example #30
0
 void init() { m_init(); }