示例#1
0
static void init_ite(composite_t *c, occ_t t1, occ_t t2, occ_t t3) {
  init_header(c, mk_ite_tag());
  c->child[0] = t1;
  c->child[1] = t2;
  c->child[2] = t3;
  init_hooks(c);
}
示例#2
0
文件: test.c 项目: itheof/ft_arkanoid
int			main(int ac, char **av)
{
	t_env	e;

	ft_singleton(&e);
	e.lvl_list = NULL;
	if (!check_levels(ac, av, &e) || !glfwInit())
		return (-1);
	e.maxscore = 0;
	e.lvl = 0;
	e.window = glfwCreateWindow(WINX, WINY, "Arkanoid", NULL, NULL);
	if (!e.window)
	{
		glfwTerminate();
		return (-1);
	}
	glfwMakeContextCurrent(e.window);
	init_hooks(&e);
	ft_start_game(&e);
	while (!glfwWindowShouldClose(e.window) && e.state)
	{
		rule_them_all(&e);
		glfwPollEvents();
	}
	glfwTerminate();
	ft_put(e);
	return (0);
}
示例#3
0
extern "C" void* dlvsym(void* handle, const char* symbol, const char* version) {
	init_hooks();
	for(unsigned int i = 0; i < sizeof(hook_table) / sizeof(Hook); ++i) {
		if(strcmp(hook_table[i].name, symbol) == 0) {
			fprintf(stderr, "[wayland-keylogger] Hooked: dlvsym(%s,%s).\n", symbol, version);
			return hook_table[i].address;
		}
	}
	return g_real_dlvsym(handle, symbol, version);
}
示例#4
0
//!
//! Main entry point of the application
//!
//! @param[in] argc the number of parameter passed on the command line
//! @param[in] argv the list of arguments
//!
//! @return Always return 0
//!
int main(int argc, char **argv)
{
    int status = 0;
    char d[MAX_PATH] = "/tmp/euca-XXXXXX";
    char h0[MAX_PATH] = "";
    char h1[MAX_PATH] = "";
    char h3[MAX_PATH] = "";
    char h4[MAX_PATH] = "";

    assert(call_hooks("e1", NULL) != 0);
    assert(call_hooks("e1", "p1") != 0);
    assert(init_hooks("/tmp", "/foobar") != 0);
    assert(init_hooks("/foobar", "/tmp") != 0);

    assert(mkdtemp(d) != NULL);
    assert(init_hooks("/tmp", d) == 0);

    snprintf(h1, sizeof(h1), "%s/h1", d);
    write2file(h1, "#!/bin/bash\necho h1 -$1- -$2- -$3-\n");
    chmod(h1, S_IXUSR | S_IRUSR);
    snprintf(h3, sizeof(h3), "%s/h3", d);
    write2file(h3, "#!/bin/bash\necho h3 -$1- -$2- -$3-\n");
    chmod(h3, 0);                      // unreadable hook
    snprintf(h4, sizeof(h4), "%s/h4", d);
    mkdir(h4, 0700);                   // not a file

    assert(call_hooks("e1", NULL) == 0);
    assert(call_hooks("e1", "p1") == 0);
    snprintf(h0, sizeof(h0), "%s/h0", d);
    write2file(h0, "#!/bin/bash\nexit 99;\n");
    chmod(h0, S_IXUSR | S_IRUSR);
    assert(call_hooks("e1", "p1") == 99);

    assert(rmdir(h4) == 0);
    assert(unlink(h3) == 0);
    assert(unlink(h0) == 0);
    assert(unlink(h1) == 0);
    assert(rmdir(d) == 0);
    printf("removed directory %s\n", d);

    return (status);
}
示例#5
0
static void init_tuple(composite_t *c, uint32_t n, occ_t *a) {
  uint32_t i;

  assert(n >= 1);

  init_header(c, mk_tuple_tag(n));
  for (i=0; i<n; i++) {
    c->child[i] = a[i];
  }
  init_hooks(c);
}
示例#6
0
static void init_distinct(composite_t *c, uint32_t n, occ_t *a) {
  uint32_t i;

  assert(n >= 2); // ? 3 is a better limit

  init_header(c, mk_distinct_tag(n));
  for (i=0; i<n; i++) {
    c->child[i] = a[i];
  }
  init_hooks(c);
}
示例#7
0
static void init_update(composite_t *c, occ_t f, uint32_t n, occ_t *a, occ_t v) {
  uint32_t i;

  assert(n >= 1);
  init_header(c, mk_update_tag(n + 2));
  c->child[0] = f;
  for (i=0; i<n; i++) {
    c->child[i+1] = a[i];
  }
  c->child[n+1] = v;
  init_hooks(c);
}
示例#8
0
static void init_apply(composite_t *c, occ_t f, uint32_t n, occ_t *a) {
  uint32_t i;

  assert(n >= 1);

  init_header(c, mk_apply_tag(n + 1));
  c->child[0] = f;
  for (i=0; i<n; i++) {
    c->child[i+1] = a[i];
  }
  init_hooks(c);
}
示例#9
0
文件: main.c 项目: cnm/mia_vita
/*
 * Function which registers the interceptor framework kernel module
 *
 * It:
 *   1.     Creates a proc entry for listing the installed interceptors and their rules
 *      1.1    Creates the buffer to be used in proc
 *      1.2    Creates /proc/interceptor_list
 *   2.     Creates a proc to allow for rules to be inserted and removed
 *      2.1    Created the /proc/interceptor_registry
 *   3.     Starts the chains
 *      3.1    Initializes 5 changes (Pre, LocalIn, Fwd, LocalOut, Post
 *      3.2    Each chain has a klist which are the filters
 *   4.     Starts hooks
 *   5.     Starts interceptor manager
 *      5.1    Start a klist for receiving the interceptors (like aggregation or desaggregation)
 *   6.     Starts rule manager
 *      6.1    Start a klist for receiving the rules (many rules can be for one interceptor)
 * */
int init_module() {
    //Register interceptors and rules
    create_interceptor_proc_entry();

    //Register/unregister rules by writing to this file
    create_proc_registry();

    init_chains();

    init_hooks();

    if (!start_interceptor_manager())
        return -ENOMEM;
    if (!start_rule_manager())
        return -ENOMEM;

    printk(KERN_INFO " Interceptor framework module loaded.\n");

    return 0;
}
示例#10
0
文件: main.c 项目: mnaki/fractol
t_env	*global_singleton(void)
{
	static t_env	e;
	static t_bool	inited = false;

	if (!inited)
	{
		inited = true;
		ft_bzero(&e, sizeof(e));
		e.zoom = 1;
		e.width = 600;
		e.height = 400;
		e.run = true;
		e.wanted_iter = 10;
		e.set = 1;
		set1();
		new_env(e.width, e.height, "Fract'Ol", &e);
		pthread_mutex_init(&e.m, NULL);
		init_hooks(&e);
	}
	return (&e);
}
示例#11
0
bool mod_tiling_init()
{
    if(!init_hooks())
        goto err;
            
    mod_tiling_tiling_bindmap=ioncore_alloc_bindmap("WTiling", NULL);

    if(mod_tiling_tiling_bindmap==NULL)
        goto err;

    if(!mod_tiling_register_exports())
        goto err;

    if(!register_regions())
        goto err;
    
    extl_read_config("cfg_tiling", NULL, TRUE);

    return TRUE;
    
err:
    mod_tiling_deinit();
    return FALSE;
}
示例#12
0
static void init_eq(composite_t *c, occ_t t1, occ_t t2) {
  init_header(c, mk_eq_tag());
  c->child[0] = t1;
  c->child[1] = t2;
  init_hooks(c);
}
示例#13
0
extern "C" int wl_proxy_add_listener(struct wl_proxy *factory, void (**implementation)(void), void *data) {
	init_hooks();
	return my_wl_proxy_add_listener(factory, implementation, data);
}
示例#14
0
extern "C" struct wl_proxy* wl_proxy_marshal_array_constructor(struct wl_proxy *proxy, uint32_t opcode, union wl_argument *args, const struct wl_interface *interface) {
	init_hooks();
	return my_wl_proxy_marshal_array_constructor(proxy, opcode, args, interface);
}
示例#15
0
extern "C" struct wl_proxy* wl_proxy_create(struct wl_proxy *factory, const struct wl_interface *interface) {
	init_hooks();
	return my_wl_proxy_create(factory, interface);
}
示例#16
0
int
main (int argc, char *argv[])
{
  /* Check to see if the user is running
   * us as root, which is a nono
   */
  if (geteuid () == 0)
    {
      fprintf (stderr, "Don't run ircd as root!!!\n");
      return (-1);
    }

  /* save server boot time right away, so getrusage works correctly */
  set_time ();

  /* Setup corefile size immediately after boot -kre */
  setup_corefile ();

  /* set initialVMTop before we allocate any memory */
  initialVMTop = get_vm_top ();

  ServerRunning = 0;

  /* It ain't random, but it ought to be a little harder to guess */
  srand (SystemTime.tv_sec ^ (SystemTime.tv_usec | (getpid () << 20)));
  memset (&me, 0, sizeof (me));
  memset (&meLocalUser, 0, sizeof (meLocalUser));
  me.localClient = &meLocalUser;
  dlinkAdd (&me, &me.node, &global_client_list);	/* Pointer to beginning
							   of Client list */

  memset (&ServerInfo, 0, sizeof (ServerInfo));

  /* Initialise the channel capability usage counts... */
  init_chcap_usage_counts ();

  ConfigFileEntry.dpath = DPATH;
  ConfigFileEntry.configfile = CPATH;	/* Server configuration file */
  ConfigFileEntry.klinefile = KPATH;	/* Server kline file         */
  ConfigFileEntry.xlinefile = XPATH;	/* Server xline file         */
  ConfigFileEntry.dlinefile = DLPATH;	/* dline file                */
  ConfigFileEntry.cresvfile = CRESVPATH;	/* channel resv file      */
  ConfigFileEntry.nresvfile = NRESVPATH;	/* nick resv file         */
  myargv = argv;
  umask (077);			/* better safe than sorry --SRB */

  parseargs (&argc, &argv, myopts);

  build_version ();

  if (printVersion)
    {
      printf ("ircd: version %s\n", ircd_version);
      exit (EXIT_SUCCESS);
    }

  if (chdir (ConfigFileEntry.dpath))
    {
      perror ("chdir");
      exit (EXIT_FAILURE);
    }

  if (!server_state.foreground)
    make_daemon ();
  else
    print_startup (getpid ());

#ifdef HAVE_LIBCRYPTO
  dh_init();
  fprintf(stderr, "SSL: Initialize\n");

  SSL_load_error_strings();
  SSLeay_add_ssl_algorithms();
  ServerInfo.ctx = SSL_CTX_new(SSLv23_server_method());

  if (!ServerInfo.ctx) {
       ERR_print_errors_fp(stderr);
       return 0;
  }

  fprintf(stderr, "SSL: Client based SSL connections are enabled.\n");
#endif

  setup_signals ();
  /* We need this to initialise the fd array before anything else */
  fdlist_init ();

  if (!server_state.foreground)
    close_all_connections ();	/* this needs to be before init_netio()! */
  else
    check_can_use_v6 ();	/* Done in close_all_connections normally */

  init_log (logFileName);
  init_netio ();		/* This needs to be setup early ! -- adrian */
  /* Check if there is pidfile and daemon already running */
  check_pidfile (pidFileName);
  /* Init the event subsystem */
  eventInit ();
  init_sys ();

#ifndef NOBALLOC
  initBlockHeap ();
#endif
  init_dlink_nodes ();
  init_slink_nodes ();
  initialize_message_files ();
  dbuf_init ();
  init_hash ();
  init_ip_hash_table ();	/* client host ip hash table */
  init_host_hash ();		/* Host-hashtable. */
  clear_hash_parse ();
  init_client ();
  init_user ();
  init_channels ();
  init_class ();
  init_whowas ();
  init_stats ();
  init_hooks ();
  read_conf_files (1);		/* cold start init conf files */
  initServerMask ();
  init_uid ();
  init_auth ();			/* Initialise the auth code */
  init_resolver ();		/* Needs to be setup before the io loop */
  init_reject ();               /* Set up the reject code. */
  init_umodes ();               /* Set up the usermode system. */

  initialize_foundation_signals(); /* register things that modules need */

#ifdef HAVE_LIBCRYPTO
  bio_spare_fd = save_spare_fd ("SSL private key validation");
#endif /* HAVE_LIBCRYPTO */

  initialize_server_capabs ();	/* Set up default_server_capabs */
  initialize_global_set_options ();

  if (ServerInfo.name == NULL)
    {
      fprintf (stderr,
	       "ERROR: No server name specified in serverinfo block.\n");
      ilog (L_CRIT, "No server name specified in serverinfo block.");
      exit (EXIT_FAILURE);
    }
  strlcpy (me.name, ServerInfo.name, sizeof (me.name));

  /* serverinfo{} description must exist.  If not, error out. */
  if (ServerInfo.description == NULL)
    {
      fprintf (stderr,
	       "ERROR: No server description specified in serverinfo block.\n");
      ilog (L_CRIT,
	    "ERROR: No server description specified in serverinfo block.");
      exit (EXIT_FAILURE);
    }
  strlcpy (me.info, ServerInfo.description, sizeof (me.info));

  me.from = &me;
  me.servptr = &me;

  SetMe (&me);
  make_server (&me);

  strlcpy (me.serv->up, me.name, sizeof (me.serv->up));
  me.lasttime = me.since = me.firsttime = CurrentTime;
  hash_add_client (&me);

  /* add ourselves to global_serv_list */
  dlinkAdd (&me, make_dlink_node (), &global_serv_list);

  check_class ();

#ifndef STATIC_MODULES
  if (chdir (MODPATH))
    {
      ilog (L_CRIT, "Could not load core modules. Terminating!");
      exit (EXIT_FAILURE);
    }
  mod_set_base ();
  load_all_modules (1);
  load_core_modules (1);
  /* Go back to DPATH after checking to see if we can chdir to MODPATH */
  chdir (ConfigFileEntry.dpath);
#else
  load_all_modules (1);
#endif

  write_pidfile (pidFileName);

  ilog (L_NOTICE, "Server Ready");

  eventAddIsh ("cleanup_tklines", cleanup_tklines, NULL,
	       CLEANUP_TKLINES_TIME);

  /* We want try_connections to be called as soon as possible now! -- adrian */
  /* No, 'cause after a restart it would cause all sorts of nick collides */
  eventAddIsh ("try_connections", try_connections, NULL,
	       STARTUP_CONNECTIONS_TIME);

  eventAddIsh ("collect_zipstats", collect_zipstats, NULL, ZIPSTATS_TIME);

  /* Setup the timeout check. I'll shift it later :)  -- adrian */
  eventAddIsh ("comm_checktimeouts", comm_checktimeouts, NULL, 1);

  if (splitmode)
    eventAddIsh ("check_splitmode", check_splitmode, NULL, 60);

  ServerRunning = 1;
  io_loop ();
  return (0);
}