static status_t socket_std_ops(int32 op, ...) { switch (op) { case B_MODULE_INIT: { new (&sSocketList) SocketList; mutex_init(&sSocketLock, "socket list"); #if ENABLE_DEBUGGER_COMMANDS add_debugger_command("sockets", dump_sockets, "lists all sockets"); add_debugger_command("socket", dump_socket, "dumps a socket"); #endif return B_OK; } case B_MODULE_UNINIT: ASSERT(sSocketList.IsEmpty()); mutex_destroy(&sSocketLock); #if ENABLE_DEBUGGER_COMMANDS remove_debugger_command("socket", dump_socket); remove_debugger_command("sockets", dump_sockets); #endif return B_OK; default: return B_ERROR; } }
// RemoveDebuggerCommands void KernelDebug::RemoveDebuggerCommands() { if (atomic_add(&sCommandsAdded, -1) > 1) return; PRINT(("KernelDebug::RemoveDebuggerCommands(): removing debugger " "commands\n")); remove_debugger_command("ufs_port", DebugPort); remove_debugger_command("ufs_portpool", DebugPortPool); remove_debugger_command("ufs", DebugUFS); }
status_t uninit_interfaces() { #if ENABLE_DEBUGGER_COMMANDS remove_debugger_command("net_interface", &dump_interface); remove_debugger_command("net_interfaces", &dump_interfaces); remove_debugger_command("net_local", &dump_local); remove_debugger_command("net_route", &dump_route); #endif recursive_lock_destroy(&sLock); mutex_destroy(&sHashLock); return B_OK; }
static status_t tcp_uninit() { remove_debugger_command("tcp_endpoint", dump_endpoint); remove_debugger_command("tcp_endpoints", dump_endpoints); rw_lock_destroy(&sEndpointManagersLock); for (int i = 0; i < AF_MAX; i++) { delete sEndpointManagers[i]; } return B_OK; }
static status_t std_ops(int32 op, ...) { if (op == B_MODULE_INIT) { sRequestSem = create_sem(0, "run_on_exit_request"); if (sRequestSem < B_OK) return sRequestSem; thread_id thread = spawn_kernel_thread(&run_on_exit_loop, "run_on_exit_loop", B_NORMAL_PRIORITY, NULL); if (thread < B_OK) return thread; send_signal_etc(thread, SIGCONT, B_DO_NOT_RESCHEDULE); add_debugger_command_etc("on_exit", &add_run_on_exit_command, "Adds a command to be run when leaving the kernel debugger", "<command> [<arguments>]\n" "Adds a command to be run when leaving the kernel debugger.\n", 0); return B_OK; } else if (op == B_MODULE_UNINIT) { remove_debugger_command("on_exit", &add_run_on_exit_command); // deleting the sem will also cause the thread to exit delete_sem(sRequestSem); sRequestSem = -1; return B_OK; } return B_BAD_VALUE; }
static status_t bcd_std_ops(int32 op, ...) { status_t status; switch (op) { case B_MODULE_INIT: new (&sConnectionList) DoublyLinkedList<HciConnection>; add_debugger_command("btConnections", &DumpHciConnections, "Lists Bluetooth Connections with RemoteDevices & channels"); status = get_module(NET_BUFFER_MODULE_NAME, (module_info **)&gBufferModule); if (status < B_OK) return status; return B_OK; break; case B_MODULE_UNINIT: remove_debugger_command("btConnections", &DumpHciConnections); put_module(NET_BUFFER_MODULE_NAME); return B_OK; break; } return B_ERROR; }
// called just before the kernel unloads the driver void uninit_driver(void) { CALLED(); int32 j; for (j = 0; j < MAX_BT_GENERIC_USB_DEVICES; j++) { if (publish_names[j] != NULL) free(publish_names[j]); if (bt_usb_devices[j] != NULL) { // if (connected_dev != NULL) { // debugf("Device %p still exists.\n", connected_dev); // } ERROR("%s: %s still present?\n", __func__, bt_usb_devices[j]->name); kill_device(bt_usb_devices[j]); } } usb->uninstall_notify(BLUETOOTH_DEVICE_DEVFS_NAME); remove_debugger_command("bth2generic", &dump_driver); // Releasing modules put_module(usb_name); put_module(hci_name); // TODO: netbuffers delete_sem(dev_table_sem); }
static status_t std_ops(int32 op, ...) { if (op == B_MODULE_INIT) { status_t err = disasm_arch_init(); if (err != B_OK) return err; err = add_debugger_command_etc("dis", disasm_command, "Print disassembly at address", "[ -b <back count> ] [ <address> [ <count> ] ]\n" "Prints disassembly at address.\n" " <address> - Address at which to start disassembling\n" " (defaults to current PC).\n" " <count> - Number of instructions to disassemble\n" " starting at <address>.\n" " -b <back count> - Number of instruction to disassemble before\n" " <address>.\n", 0); if (err != B_OK) disasm_arch_fini(); return err; } else if (op == B_MODULE_UNINIT) { remove_debugger_command("dis", disasm_command); return disasm_arch_fini(); } return B_BAD_VALUE; }
status_t uninit_domains() { #if ENABLE_DEBUGGER_COMMANDS remove_debugger_command("net_domains", &dump_domains); #endif mutex_destroy(&sDomainLock); return B_OK; }
void uninit_driver(void) { #if DEBUG > 0 remove_debugger_command("et6000dump", et6000dump); #endif /* free the driver data */ DELETE_BEN(pd->kernel); free(pd); pd = NULL; /* put the pci module away */ put_module(B_PCI_MODULE_NAME); }
void uninit_driver() { remove_debugger_command(DRIVER_NAME, SiS19X_DebuggerCommand); for (size_t i = 0; i < MAX_DEVICES; i++) { if (gDevices[i]) { gDevices[i]->TeardownDevice(); delete gDevices[i]; gDevices[i] = NULL; } free(gDeviceNames[i]); gDeviceNames[i] = NULL; } put_module(B_PCI_MODULE_NAME); release_settings(); }
static status_t device_free(void *data) { struct intel_info *info = (intel_info *)data; mutex_lock(&gLock); if (info->open_count-- == 1) { // release info structure info->init_status = B_NO_INIT; intel_extreme_uninit(*info); #ifdef DEBUG_COMMANDS remove_debugger_command("ie_reg", getset_register); #endif } mutex_unlock(&gLock); return B_OK; }
static int32 bus_std_ops(int32 op, ...) { switch (op) { case B_MODULE_INIT: { TRACE_MODULE("init\n"); if (gUSBStack) return B_OK; #ifdef HAIKU_TARGET_PLATFORM_BEOS // This code is to handle plain R5 (non-BONE) where the same module // gets loaded multiple times (once for each exported module // interface, the USB v2 and v3 API in our case). We don't want to // ever create multiple stacks however, so we "share" the same stack // for both modules by storing it's address in a shared area. void *address = NULL; area_id shared = find_area("shared usb stack"); if (shared >= B_OK && clone_area("usb stack clone", &address, B_ANY_KERNEL_ADDRESS, B_KERNEL_READ_AREA, shared) >= B_OK) { gUSBStack = *((Stack **)address); TRACE_MODULE("found shared stack at %p\n", gUSBStack); return B_OK; } #endif #ifdef TRACE_USB set_dprintf_enabled(true); #ifndef HAIKU_TARGET_PLATFORM_HAIKU load_driver_symbols("usb"); #endif #endif Stack *stack = new(std::nothrow) Stack(); TRACE_MODULE("usb_module: stack created %p\n", stack); if (!stack) return B_NO_MEMORY; if (stack->InitCheck() != B_OK) { delete stack; return ENODEV; } gUSBStack = stack; #ifdef HAIKU_TARGET_PLATFORM_HAIKU add_debugger_command("get_usb_pipe_for_id", &debug_get_pipe_for_id, "Gets the config for a USB pipe"); #elif HAIKU_TARGET_PLATFORM_BEOS // Plain R5 workaround, see comment above. shared = create_area("shared usb stack", &address, B_ANY_KERNEL_ADDRESS, B_PAGE_SIZE, B_NO_LOCK, B_KERNEL_WRITE_AREA); if (shared >= B_OK) *((Stack **)address) = gUSBStack; #endif break; } case B_MODULE_UNINIT: TRACE_MODULE("uninit\n"); delete gUSBStack; gUSBStack = NULL; #ifdef HAIKU_TARGET_PLATFORM_HAIKU remove_debugger_command("get_usb_pipe_for_id", &debug_get_pipe_for_id); #endif break; default: return EINVAL; } return B_OK; }