void install_drivers() { dev_t console; // Register /proc/units register_proc_inode("units", units_proc, NULL); register_proc_inode("devices", devices_proc, NULL); register_proc_inode("devstat", devstat_proc, NULL); // Parse driver binding database parse_bindings(); // Match bindings to units bind_units(); // Install legacy drivers install_legacy_drivers(); // Make sure we have a console device console = dev_open("console"); if (console == NODEV) { initialize_driver(NULL, "krnl.dll!console"); } else { dev_close(console); } }
static void install_legacy_drivers() { struct section *sect; struct property *prop; int buflen; char *buf; int rc; sect = find_section(krnlcfg, "drivers"); if (!sect) return; prop = sect->properties; while (prop) { buflen = strlen(prop->name) + 1; if (prop->value) buflen += strlen(prop->value) + 1; buf = kmalloc(buflen); if (buf) { strcpy(buf, prop->name); if (prop->value) { strcat(buf, ":"); strcat(buf, prop->value); } rc = initialize_driver(NULL, buf); if (rc < 0) { kprintf(KERN_ERR "dev: error %d initializing driver %s\n", rc, prop->name); } kfree(buf); } prop = prop->next; } }
static int __init ibmuftian_init(void) { int err = ZERO; PRINT(DBG_PRAM({IBMUFTIAN_DBG, ERR_DBG}), "loading the IBMUFTIAN driver"); if(unlikely(err = initialize_driver())) { PRINT(DBG_PRAM({ERR_DBG}), "Driver initialization failed"); return -1; } //initialize performance attr ibmuftian.performance.total_time.tv_sec = 0; ibmuftian.performance.total_time.tv_usec = 0; PRINT(DBG_PRAM({IBMUFTIAN_DBG}), "intializing sysfs done"); err = ibmuftian_pci_register(); if(unlikely(err != ZERO)) { PRINT(DBG_PRAM({ERR_DBG}),"failed to regster pci devices"); err = -ENOMEM; } PRINT(DBG_PRAM({IBMUFTIAN_DBG, LOAD_DBG}), "driver initialization done"); return err; }
int main (int argc, char **argv) { GMainLoop *loop; GIOChannel *sock; /* Initialize signal handlers */ signal(SIGPIPE, SIG_IGN); signal(SIGINT, handle_sigint); /* read nocat.conf */ read_conf_file( NC_CONF_PATH "/nocat.conf" ); initialize_driver(); /* initialize the firewall */ fw_init( nocat_conf ); /* initialize the peer table */ peer_tab = g_hash_new(); /* initialize the listen socket */ sock = http_bind_socket( CONF("GatewayAddr"), CONFd("GatewayPort"), CONFd("ListenQueue") ); /* initialize the main loop and handlers */ loop = g_main_new(FALSE); g_io_add_watch( sock, G_IO_IN, (GIOFunc) handle_accept, NULL ); g_timeout_add( 30000, (GSourceFunc) check_peers, NULL ); g_timeout_add( 1000, (GSourceFunc) check_sigint, loop ); /* Go! */ g_message("starting main loop"); g_main_run( loop ); g_message("exiting main loop"); return 0; }
static void install_driver(struct unit *unit, struct binding *bind) { int rc; rc = initialize_driver(unit, bind->module); if (rc < 0) { kprintf(KERN_ERR "dev: driver '%s' failed with error %d for unit %08X '%s'\n", bind->module, rc, unit->unitcode, get_unit_name(unit)); } }
int main (int argc, char **argv) { GMainLoop *loop; GIOChannel *sock; /* read nocat.conf */ read_conf_file( NC_CONF_PATH "/nocat.conf" ); if (argc < 2 || strncmp(argv[1], "-D", 2) != 0) daemonize(); /* initalize the log */ initialize_log(); /* set network parameters */ set_network_defaults( nocat_conf ); /* initialize the gateway type driver */ initialize_driver(); /* initialize the firewall */ fw_init( nocat_conf ); /* initialize the peer table */ peer_tab = g_hash_new(); /* initialize the listen socket */ sock = http_bind_socket( CONF("GatewayAddr"), CONFd("GatewayPort"), CONFd("ListenQueue") ); /* initialize the main loop and handlers */ loop = g_main_new(FALSE); g_io_add_watch( sock, G_IO_IN, (GIOFunc) handle_accept, NULL ); g_timeout_add( 30000, (GSourceFunc) check_peers, NULL ); g_timeout_add( 1000, (GSourceFunc) check_exit_signal, loop ); /* Go! */ g_message("starting main loop"); g_main_run( loop ); g_message("exiting main loop"); return 0; }
/*********************************************************************** * GDI_Init * * GDI initialization. */ BOOL GDI_Init(void) { HINSTANCE16 instance; HKEY hkey; GDIOBJHDR *ptr; int i; create_gdi_syslevel_cs(); initialize_driver(); if (RegOpenKeyA(HKEY_LOCAL_MACHINE, "Software\\Wine\\Wine\\Config\\Tweak.Fonts", &hkey)) hkey = 0; /* create GDI heap */ if ((instance = LoadLibrary16( "GDI.EXE" )) < 32) return FALSE; GDI_HeapSel = instance | 7; /* create stock objects */ stock_objects[WHITE_BRUSH] = CreateBrushIndirect( &WhiteBrush ); stock_objects[LTGRAY_BRUSH] = CreateBrushIndirect( &LtGrayBrush ); stock_objects[GRAY_BRUSH] = CreateBrushIndirect( &GrayBrush ); stock_objects[DKGRAY_BRUSH] = CreateBrushIndirect( &DkGrayBrush ); stock_objects[BLACK_BRUSH] = CreateBrushIndirect( &BlackBrush ); stock_objects[NULL_BRUSH] = CreateBrushIndirect( &NullBrush ); stock_objects[WHITE_PEN] = CreatePenIndirect( &WhitePen ); stock_objects[BLACK_PEN] = CreatePenIndirect( &BlackPen ); stock_objects[NULL_PEN] = CreatePenIndirect( &NullPen ); stock_objects[DEFAULT_PALETTE] = PALETTE_Init(); stock_objects[DEFAULT_BITMAP] = CreateBitmap( 1, 1, 1, 1, NULL ); stock_objects[OEM_FIXED_FONT] = create_stock_font( "OEMFixed", &OEMFixedFont, hkey ); stock_objects[ANSI_FIXED_FONT] = create_stock_font( "AnsiFixed", &AnsiFixedFont, hkey ); stock_objects[ANSI_VAR_FONT] = create_stock_font( "AnsiVar", &AnsiVarFont, hkey ); stock_objects[SYSTEM_FONT] = create_stock_font( "System", &SystemFont, hkey ); stock_objects[DEVICE_DEFAULT_FONT] = create_stock_font( "DeviceDefault", &DeviceDefaultFont, hkey ); stock_objects[SYSTEM_FIXED_FONT] = create_stock_font( "SystemFixed", &SystemFixedFont, hkey ); stock_objects[DEFAULT_GUI_FONT] = create_stock_font( "DefaultGui", &DefaultGuiFont, hkey ); /* clear the NOSYSTEM bit on all stock objects*/ for (i = 0; i < NB_STOCK_OBJECTS; i++) { if (!stock_objects[i]) { if (i == 9) continue; /* there's no stock object 9 */ ERR( "could not create stock object %d\n", i ); return FALSE; } ptr = GDI_GetObjPtr( stock_objects[i], MAGIC_DONTCARE ); ptr->wMagic &= ~OBJECT_NOSYSTEM; GDI_ReleaseObj( stock_objects[i] ); } if (hkey) RegCloseKey( hkey ); WineEngInit(); return TRUE; }