static int __init kernel_init(void * unused) { /* * Wait until kthreadd is all set-up. */ wait_for_completion(&kthreadd_done); lock_kernel(); /* * init can allocate pages on any node */ set_mems_allowed(node_states[N_HIGH_MEMORY]); /* * init can run on any cpu. */ set_cpus_allowed_ptr(current, cpu_all_mask); /* * Tell the world that we're going to be the grim * reaper of innocent orphaned children. * * We don't want people to have to make incorrect * assumptions about where in the task array this * can be found. */ init_pid_ns.child_reaper = current; cad_pid = task_pid(current); smp_prepare_cpus(setup_max_cpus); do_pre_smp_initcalls(); start_boot_trace(); smp_init(); sched_init_smp(); do_basic_setup(); /* * check if there is an early userspace init. If yes, let it do all * the work */ if (!ramdisk_execute_command) ramdisk_execute_command = "/init"; if (sys_access((const char __user *) ramdisk_execute_command, 0) != 0) { ramdisk_execute_command = NULL; prepare_namespace(); } /* * Ok, we have completed the initial bootup, and * we're essentially up and running. Get rid of the * initmem segments and start the user-mode stuff.. */ init_post(); return 0; }
static int __init kernel_init(void * unused) { #ifndef __LINSCHED__ lock_kernel(); /* * init can run on any cpu. */ set_cpus_allowed(current, CPU_MASK_ALL); /* * Tell the world that we're going to be the grim * reaper of innocent orphaned children. * * We don't want people to have to make incorrect * assumptions about where in the task array this * can be found. */ init_pid_ns.child_reaper = current; __set_special_pids(1, 1); cad_pid = task_pid(current); smp_prepare_cpus(max_cpus); do_pre_smp_initcalls(); smp_init(); #endif /* __LINSCHED__ */ sched_init_smp(); #ifndef __LINSCHED__ cpuset_init_smp(); do_basic_setup(); /* * check if there is an early userspace init. If yes, let it do all * the work */ if (!ramdisk_execute_command) ramdisk_execute_command = "/init"; if (sys_access((const char __user *) ramdisk_execute_command, 0) != 0) { ramdisk_execute_command = NULL; prepare_namespace(); } /* * Ok, we have completed the initial bootup, and * we're essentially up and running. Get rid of the * initmem segments and start the user-mode stuff.. */ init_post(); #endif /* __LINSCHED__ */ return 0; }
static int __init init(void * unused) { lock_kernel(); /* * init can run on any cpu. */ set_cpus_allowed(current, CPU_MASK_ALL); /* * Tell the world that we're going to be the grim * reaper of innocent orphaned children. * * We don't want people to have to make incorrect * assumptions about where in the task array this * can be found. */ child_reaper = current; smp_prepare_cpus(max_cpus); do_pre_smp_initcalls(); smp_init(); sched_init_smp(); cpuset_init_smp(); /* * Do this before initcalls, because some drivers want to access * firmware files. */ populate_rootfs(); do_basic_setup(); /* * check if there is an early userspace init. If yes, let it do all * the work */ if (!ramdisk_execute_command) ramdisk_execute_command = "/init"; if (sys_access((const char __user *) ramdisk_execute_command, 0) != 0) { ramdisk_execute_command = NULL; prepare_namespace(); } /* * Ok, we have completed the initial bootup, and * we're essentially up and running. Get rid of the * initmem segments and start the user-mode stuff.. */ init_post(); return 0; }
// Get POST data char * post(char * name) { if(! post_state) init_post(); int i; for(i = 0; (i < post_index) && strncmp(name, POST[i].name, QUERY_NAME_LIM); i++); if(i == post_index) return NULL; return POST[i].value; }
/** * gst_init_check: * @argc: (inout) (allow-none): pointer to application's argc * @argv: (inout) (array length=argc) (allow-none): pointer to application's argv * @err: pointer to a #GError to which a message will be posted on error * * Initializes the GStreamer library, setting up internal path lists, * registering built-in elements, and loading standard plugins. * * This function will return %FALSE if GStreamer could not be initialized * for some reason. If you want your program to fail fatally, * use gst_init() instead. * * This function should be called before calling any other GLib functions. If * this is not an option, your program must initialise the GLib thread system * using g_thread_init() before any other GLib functions are called. * * Returns: %TRUE if GStreamer could be initialized. */ gboolean gst_init_check (int *argc, char **argv[], GError ** err) { #ifndef GST_DISABLE_OPTION_PARSING GOptionGroup *group; GOptionContext *ctx; #endif gboolean res; if (!g_thread_get_initialized ()) g_thread_init (NULL); if (gst_initialized) { GST_DEBUG ("already initialized gst"); return TRUE; } #ifndef GST_DISABLE_OPTION_PARSING ctx = g_option_context_new ("- GStreamer initialization"); g_option_context_set_ignore_unknown_options (ctx, TRUE); group = gst_init_get_option_group (); g_option_context_add_group (ctx, group); res = g_option_context_parse (ctx, argc, argv, err); g_option_context_free (ctx); #else init_pre (NULL, NULL, NULL, NULL); init_post (NULL, NULL, NULL, NULL); res = TRUE; #endif gst_initialized = res; if (res) { GST_INFO ("initialized GStreamer successfully"); } else { GST_INFO ("failed to initialize GStreamer"); } return res; }
/** * gst_init_check: * @argc: (inout) (allow-none): pointer to application's argc * @argv: (inout) (array length=argc) (allow-none): pointer to application's argv * @err: pointer to a #GError to which a message will be posted on error * * Initializes the GStreamer library, setting up internal path lists, * registering built-in elements, and loading standard plugins. * * This function will return %FALSE if GStreamer could not be initialized * for some reason. If you want your program to fail fatally, * use gst_init() instead. * * Returns: %TRUE if GStreamer could be initialized. */ gboolean gst_init_check (int *argc, char **argv[], GError ** err) { static GMutex init_lock; #ifndef GST_DISABLE_OPTION_PARSING GOptionGroup *group; GOptionContext *ctx; #endif gboolean res; g_mutex_lock (&init_lock); if (gst_initialized) { GST_DEBUG ("already initialized gst"); g_mutex_unlock (&init_lock); return TRUE; } #ifndef GST_DISABLE_OPTION_PARSING ctx = g_option_context_new ("- GStreamer initialization"); g_option_context_set_ignore_unknown_options (ctx, TRUE); g_option_context_set_help_enabled (ctx, FALSE); group = gst_init_get_option_group (); g_option_context_add_group (ctx, group); res = g_option_context_parse (ctx, argc, argv, err); g_option_context_free (ctx); #else init_pre (NULL, NULL, NULL, NULL); init_post (NULL, NULL, NULL, NULL); res = TRUE; #endif gst_initialized = res; g_mutex_unlock (&init_lock); return res; }
int main(int argc, char *argv[]) { char *ptr; char option; struct stat st; char *conffile = NULL; const char *const myname = "rnews"; ln_log_open(myname); if (!initvars(argv[0], 0)) init_failed(myname); while ((option = getopt(argc, argv, GLOBALOPTS "")) != -1) { if (parseopt(myname, option, optarg, &conffile)) continue; switch(option) { default: usage(); exit(EXIT_FAILURE); } } if (readconfig(conffile) != 0) { ln_log(LNLOG_SERR, LNLOG_CTOP, "Reading configuration failed: %m.\n"); exit(2); } if (conffile) free(conffile); if (filterfile && !readfilter(filterfile)) { ln_log(LNLOG_SERR, LNLOG_CTOP, "%s: Cannot read filterfile %s, aborting.", argv[0], filterfile); log_unlink(lockfile, 0); exit(EXIT_FAILURE); } if (!init_post()) init_failed(myname); umask((mode_t) 077); if (attempt_lock(LOCKWAIT)) { exit(EXIT_FAILURE); } rereadactive(); readlocalgroups(); if (!argv[optind]) fprocessfile(stdin); /* process stdin */ while ((ptr = argv[optind++])) { if (stat(ptr, &st) == 0) { if (S_ISDIR(st.st_mode)) processdir(ptr); else if (S_ISREG(st.st_mode)) processfile(ptr); else ln_log(LNLOG_SERR, LNLOG_CTOP, "%s: cannot open %s\n", argv[0], ptr); } else ln_log(LNLOG_SERR, LNLOG_CTOP, "%s: cannot stat %s\n", argv[0], ptr); } writeactive(); /* write groupinfo file */ freeallfilter(filter); log_unlink(lockfile, 0); exit(0); }
static int __init kernel_init(void * unused) { lock_kernel(); /* * init can allocate pages on any node */ set_mems_allowed(node_possible_map); /* * init can run on any cpu. */ set_cpus_allowed_ptr(current, cpu_all_mask); /* * Tell the world that we're going to be the grim * reaper of innocent orphaned children. * * We don't want people to have to make incorrect * assumptions about where in the task array this * can be found. */ init_pid_ns.child_reaper = current; cad_pid = task_pid(current); smp_prepare_cpus(setup_max_cpus); do_pre_smp_initcalls(); start_boot_trace(); smp_init(); sched_init_smp(); do_basic_setup(); /* * check if there is an early userspace init. If yes, let it do all * the work */ if (!ramdisk_execute_command) ramdisk_execute_command = "/init"; if (sys_access((const char __user *) ramdisk_execute_command, 0) != 0) { ramdisk_execute_command = NULL; prepare_namespace(); } #ifdef CONFIG_PREEMPT_RT WARN_ON(irqs_disabled()); #endif #define DEBUG_COUNT (defined(CONFIG_DEBUG_RT_MUTEXES) + defined(CONFIG_IRQSOFF_TRACER) + defined(CONFIG_PREEMPT_TRACER) + defined(CONFIG_STACK_TRACER) + defined(CONFIG_INTERRUPT_OFF_HIST) + defined(CONFIG_PREEMPT_OFF_HIST) + defined(CONFIG_WAKEUP_LATENCY_HIST) + defined(CONFIG_DEBUG_SLAB) + defined(CONFIG_DEBUG_PAGEALLOC) + defined(CONFIG_LOCKDEP) + (defined(CONFIG_FTRACE) - defined(CONFIG_FTRACE_MCOUNT_RECORD))) #if DEBUG_COUNT > 0 printk(KERN_ERR "*****************************************************************************\n"); printk(KERN_ERR "* *\n"); #if DEBUG_COUNT == 1 printk(KERN_ERR "* REMINDER, the following debugging option is turned on in your .config: *\n"); #else printk(KERN_ERR "* REMINDER, the following debugging options are turned on in your .config: *\n"); #endif printk(KERN_ERR "* *\n"); #ifdef CONFIG_DEBUG_RT_MUTEXES printk(KERN_ERR "* CONFIG_DEBUG_RT_MUTEXES *\n"); #endif #ifdef CONFIG_IRQSOFF_TRACER printk(KERN_ERR "* CONFIG_IRQSOFF_TRACER *\n"); #endif #ifdef CONFIG_PREEMPT_TRACER printk(KERN_ERR "* CONFIG_PREEMPT_TRACER *\n"); #endif #if defined(CONFIG_FTRACE) && !defined(CONFIG_FTRACE_MCOUNT_RECORD) printk(KERN_ERR "* CONFIG_FTRACE *\n"); #endif #ifdef CONFIG_INTERRUPT_OFF_HIST printk(KERN_ERR "* CONFIG_INTERRUPT_OFF_HIST *\n"); #endif #ifdef CONFIG_PREEMPT_OFF_HIST printk(KERN_ERR "* CONFIG_PREEMPT_OFF_HIST *\n"); #endif #ifdef CONFIG_WAKEUP_LATENCY_HIST printk(KERN_ERR "* CONFIG_WAKEUP_LATENCY_HIST *\n"); #endif #ifdef CONFIG_DEBUG_SLAB printk(KERN_ERR "* CONFIG_DEBUG_SLAB *\n"); #endif #ifdef CONFIG_DEBUG_PAGEALLOC printk(KERN_ERR "* CONFIG_DEBUG_PAGEALLOC *\n"); #endif #ifdef CONFIG_LOCKDEP printk(KERN_ERR "* CONFIG_LOCKDEP *\n"); #endif printk(KERN_ERR "* *\n"); #if DEBUG_COUNT == 1 printk(KERN_ERR "* it may increase runtime overhead and latencies. *\n"); #else printk(KERN_ERR "* they may increase runtime overhead and latencies. *\n"); #endif printk(KERN_ERR "* *\n"); printk(KERN_ERR "*****************************************************************************\n"); #endif /* * Ok, we have completed the initial bootup, and * we're essentially up and running. Get rid of the * initmem segments and start the user-mode stuff.. */ init_post(); return 0; }
static int __init kernel_init(void * unused) { /* * Wait until kthreadd is all set-up. */ wait_for_completion(&kthreadd_done); lock_kernel(); /* * init can run on any cpu. */ set_cpus_allowed(current, CPU_MASK_ALL); /* * Tell the world that we're going to be the grim * reaper of innocent orphaned children. * * We don't want people to have to make incorrect * assumptions about where in the task array this * can be found. */ init_pid_ns.child_reaper = current; __set_special_pids(1, 1); cad_pid = task_pid(current); smp_prepare_cpus(max_cpus); do_pre_smp_initcalls(); smp_init(); sched_init_smp(); cpuset_init_smp(); do_basic_setup(); /* Open the /dev/console on the rootfs, this should never fail */ if (sys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0) printk(KERN_WARNING "Warning: unable to open an initial console.\n"); (void) sys_dup(0); (void) sys_dup(0); /* * check if there is an early userspace init. If yes, let it do all * the work */ if (!ramdisk_execute_command) ramdisk_execute_command = "/init"; if (sys_access((const char __user *) ramdisk_execute_command, 0) != 0) { ramdisk_execute_command = NULL; prepare_namespace(); } /* * Ok, we have completed the initial bootup, and * we're essentially up and running. Get rid of the * initmem segments and start the user-mode stuff.. */ init_post(); return 0; }
static void gst_debug_help (void) { GSList *list, *walk; GList *list2, *g; /* Need to ensure the registry is loaded to get debug categories */ if (!init_post (NULL, NULL, NULL, NULL)) exit (1); list2 = gst_registry_plugin_filter (gst_registry_get (), select_all, FALSE, NULL); /* FIXME this is gross. why don't debug have categories PluginFeatures? */ for (g = list2; g; g = g_list_next (g)) { GstPlugin *plugin = GST_PLUGIN_CAST (g->data); gst_plugin_load (plugin); } g_list_free (list2); list = gst_debug_get_all_categories (); walk = list = g_slist_sort (list, sort_by_category_name); g_print ("\n"); g_print ("name level description\n"); g_print ("---------------------+--------+--------------------------------\n"); while (walk) { gboolean on_unix; GstDebugCategory *cat = (GstDebugCategory *) walk->data; GstDebugColorMode coloring = gst_debug_get_color_mode (); #ifdef G_OS_UNIX on_unix = TRUE; #else on_unix = FALSE; #endif if (GST_DEBUG_COLOR_MODE_UNIX == coloring || (on_unix && GST_DEBUG_COLOR_MODE_ON == coloring)) { gchar *color = gst_debug_construct_term_color (cat->color); g_print ("%s%-20s\033[00m %1d %s %s%s\033[00m\n", color, gst_debug_category_get_name (cat), gst_debug_category_get_threshold (cat), gst_debug_level_get_name (gst_debug_category_get_threshold (cat)), color, gst_debug_category_get_description (cat)); g_free (color); } else if (GST_DEBUG_COLOR_MODE_ON == coloring && !on_unix) { #ifdef G_OS_WIN32 gint color = gst_debug_construct_win_color (cat->color); const gint clear = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE; SetConsoleTextAttribute (GetStdHandle (STD_OUTPUT_HANDLE), color); g_print ("%-20s", gst_debug_category_get_name (cat)); SetConsoleTextAttribute (GetStdHandle (STD_OUTPUT_HANDLE), clear); g_print (" %1d %s ", gst_debug_category_get_threshold (cat), gst_debug_level_get_name (gst_debug_category_get_threshold (cat))); SetConsoleTextAttribute (GetStdHandle (STD_OUTPUT_HANDLE), color); g_print ("%s", gst_debug_category_get_description (cat)); SetConsoleTextAttribute (GetStdHandle (STD_OUTPUT_HANDLE), clear); g_print ("\n"); #endif /* G_OS_WIN32 */ } else { g_print ("%-20s %1d %s %s\n", gst_debug_category_get_name (cat), gst_debug_category_get_threshold (cat), gst_debug_level_get_name (gst_debug_category_get_threshold (cat)), gst_debug_category_get_description (cat)); } walk = g_slist_next (walk); } g_slist_free (list); g_print ("\n"); }
static int __init kernel_init(void * unused) { lock_kernel(); /* * init can allocate pages on any node */ set_mems_allowed(node_possible_map); #ifdef CONFIG_SYS_HAS_CONTROL_CPU /* * init can run on cpu0 only . */ set_cpus_allowed_ptr(current, cpumask_of(0)); #else /* * init can run on any cpu . */ set_cpus_allowed_ptr(current, cpu_all_mask); #endif /* * Tell the world that we're going to be the grim * reaper of innocent orphaned children. * * We don't want people to have to make incorrect * assumptions about where in the task array this * can be found. */ init_pid_ns.child_reaper = current; cad_pid = task_pid(current); smp_prepare_cpus(setup_max_cpus); do_pre_smp_initcalls(); start_boot_trace(); smp_init(); sched_init_smp(); #ifdef CONFIG_SYS_HAS_CONTROL_CPU /* HeJianjun modified for bug 148, * we run linux local processes on only cpu0, other cpu's are just for running dapp */ set_cpus_allowed_ptr(current, cpumask_of(0)); #endif do_basic_setup(); /* * check if there is an early userspace init. If yes, let it do all * the work */ if (!ramdisk_execute_command) ramdisk_execute_command = "/init"; if (sys_access((const char __user *) ramdisk_execute_command, 0) != 0) { ramdisk_execute_command = NULL; prepare_namespace(); } /* * Ok, we have completed the initial bootup, and * we're essentially up and running. Get rid of the * initmem segments and start the user-mode stuff.. */ init_post(); return 0; }