/* ** Name: int dpeth_task(void) ** Function: Main entry for dp task */ int main(int argc, char **argv) { message m; int ipc_status; int rc; /* SEF local startup. */ env_setargs(argc, argv); sef_local_startup(); while (TRUE) { if ((rc = netdriver_receive(ANY, &m, &ipc_status)) != OK){ panic(RecvErrMsg, rc); } DEBUG(printf("eth: got message %d, ", m.m_type)); if (is_ipc_notify(ipc_status)) { switch(_ENDPOINT_P(m.m_source)) { case CLOCK: /* to be defined */ do_watchdog(&m); break; case HARDWARE: /* Interrupt from device */ handle_hw_intr(); break; case TTY_PROC_NR: /* Function key pressed */ do_dump(&m); break; default: /* Invalid message type */ panic(TypeErrMsg, m.m_type); break; } /* message processed, get another one */ continue; } switch (m.m_type) { case DL_WRITEV_S: /* Write message to device */ do_vwrite_s(&m); break; case DL_READV_S: /* Read message from device */ do_vread_s(&m); break; case DL_CONF: /* Initialize device */ do_init(&m); break; case DL_GETSTAT_S: /* Get device statistics */ do_getstat_s(&m); break; default: /* Invalid message type */ panic(TypeErrMsg, m.m_type); break; } } return OK; /* Never reached, but keeps compiler happy */ }
/*===========================================================================* * main * *===========================================================================*/ int main(void) { /* SEF local startup. */ sef_local_startup(); return 0; }
/*===========================================================================* * main * *===========================================================================*/ int main(int argc, char *argv[]) { message m_out; int r, ipc_status; size_t size; /* SEF local startup. */ env_setargs(argc, argv); sef_local_startup(); for (;;) { /* Wait for request. */ if(driver_receive(ANY, &m_in, &ipc_status) != OK) { panic("driver_receive failed"); } #if DEBUG2 printf("Filter: got request %d from %d\n", m_in.m_type, m_in.m_source); #endif if(m_in.m_source == DS_PROC_NR && is_ipc_notify(ipc_status)) { ds_event(); continue; } who_e = m_in.m_source; req_id = m_in.BDEV_ID; grant_id = m_in.BDEV_GRANT; size = 0; /* Forword the request message to the drivers. */ switch(m_in.m_type) { case BDEV_OPEN: /* open/close is a noop for filter. */ case BDEV_CLOSE: r = OK; break; case BDEV_READ: r = do_rdwt(FLT_READ); break; case BDEV_WRITE: r = do_rdwt(FLT_WRITE); break; case BDEV_GATHER: r = do_vrdwt(FLT_READ); break; case BDEV_SCATTER: r = do_vrdwt(FLT_WRITE); break; case BDEV_IOCTL: r = do_ioctl(&m_in); break; default: printf("Filter: ignoring unknown request %d from %d\n", m_in.m_type, m_in.m_source); continue; } #if DEBUG2 printf("Filter: replying with code %d\n", r); #endif /* Send back reply message. */ m_out.m_type = BDEV_REPLY; m_out.BDEV_ID = req_id; m_out.BDEV_STATUS = r; send(who_e, &m_out); } return 0; }
int main(void) { int err; message m; int ipc_status; sef_local_startup(); for(;;) { err = driver_receive(ANY, &m, &ipc_status); if (err != OK) { printf("ACPI: driver_receive failed: %d\n", err); continue; } switch (((struct acpi_request_hdr *)&m)->request) { case ACPI_REQ_GET_IRQ: do_get_irq(&m); break; case ACPI_REQ_MAP_BRIDGE: do_map_bridge(&m); break; default: printf("ACPI: ignoring unsupported request %d " "from %d\n", ((struct acpi_request_hdr *)&m)->request, ((struct acpi_request_hdr *)&m)->m_source); } err = send(m.m_source, &m); if (err != OK) { printf("ACPI: send failed: %d\n", err); } } }
int main(void) { sef_local_startup(); chardriver_task(&fb_tab, CHARDRIVER_SYNC); return OK; }
/*===========================================================================* * start_vtreefs * *===========================================================================*/ PUBLIC void start_vtreefs(struct fs_hooks *hooks, unsigned int nr_inodes, struct inode_stat *stat, index_t nr_indexed_entries) { /* This is the main routine of this service. The main loop consists of * three major activities: getting new work, processing the work, and * sending the reply. The loop exits when the process is signaled to * exit; due to limitations of SEF, it can not return to the caller. */ int call_nr, err, transid; /* Use global variables to work around the inability to pass parameters * through SEF to the initialization function.. */ vtreefs_hooks = hooks; inodes = nr_inodes; root_stat = stat; root_entries = nr_indexed_entries; sef_local_startup(); for (;;) { get_work(); transid = TRNS_GET_ID(fs_m_in.m_type); fs_m_in.m_type = TRNS_DEL_ID(fs_m_in.m_type); if (fs_m_in.m_type == 0) { assert(!IS_VFS_FS_TRANSID(transid)); fs_m_in.m_type = transid; /* Backwards compat. */ transid = 0; } else assert(IS_VFS_FS_TRANSID(transid)); call_nr = fs_m_in.m_type; if (fs_m_in.m_source != VFS_PROC_NR) { if (vtreefs_hooks->message_hook != NULL) { /* If the request is not among the recognized * requests, call the message hook. */ vtreefs_hooks->message_hook(&fs_m_in); } continue; } if (fs_mounted || call_nr == REQ_READSUPER) { call_nr -= VFS_BASE; if (call_nr >= 0 && call_nr < NREQS) { err = (*fs_call_vec[call_nr])(); } else { err = ENOSYS; } } else err = EINVAL; send_reply(err, transid); } }
int main(int argc, char **argv) { env_setargs(argc, argv); sef_local_startup(); return 0; }
int main(int argc, char *argv[]) { env_setargs(argc, argv); sef_local_startup(); virtio_net_main_loop(); }
/*===========================================================================* * printer_task * *===========================================================================*/ int main(void) { /* Main routine of the printer task. */ /* SEF local startup. */ sef_local_startup(); chardriver_task(&printer_tab); }
/*===========================================================================* * main * *===========================================================================*/ int main(void) { /* SEF local startup. */ sef_local_startup(); /* Call the generic receive loop. */ chardriver_task(&log_dtab); return(OK); }
int main(int argc, char **argv) { /* Set and apply the environment */ env_setargs(argc, argv); sef_local_startup(); blockdriver_task(&mmc_driver); return EXIT_SUCCESS; }
int main(void) { int r; message m; int ipc_status; /* SEF local startup. */ sef_local_startup(); for(;;) { r= driver_receive(ANY, &m, &ipc_status); if (r < 0) { printf("PCI: driver_receive failed: %d\n", r); break; } if (is_ipc_notify(ipc_status)) { printf("PCI: got notify from %d\n", m.m_source); /* done, get a new message */ continue; } switch(m.m_type) { case BUSC_PCI_INIT: do_init(&m); break; case BUSC_PCI_FIRST_DEV: do_first_dev(&m); break; case BUSC_PCI_NEXT_DEV: do_next_dev(&m); break; case BUSC_PCI_FIND_DEV: do_find_dev(&m); break; case BUSC_PCI_IDS: do_ids(&m); break; case BUSC_PCI_RESERVE: do_reserve(&m); break; case BUSC_PCI_ATTR_R8: do_attr_r8(&m); break; case BUSC_PCI_ATTR_R16: do_attr_r16(&m); break; case BUSC_PCI_ATTR_R32: do_attr_r32(&m); break; case BUSC_PCI_ATTR_W8: do_attr_w8(&m); break; case BUSC_PCI_ATTR_W16: do_attr_w16(&m); break; case BUSC_PCI_ATTR_W32: do_attr_w32(&m); break; case BUSC_PCI_RESCAN: do_rescan_bus(&m); break; case BUSC_PCI_DEV_NAME_S: do_dev_name_s(&m); break; case BUSC_PCI_SLOT_NAME_S: do_slot_name_s(&m); break; case BUSC_PCI_SET_ACL: do_set_acl(&m); break; case BUSC_PCI_DEL_ACL: do_del_acl(&m); break; case BUSC_PCI_GET_BAR: do_get_bar(&m); break; default: printf("PCI: got message from %d, type %d\n", m.m_source, m.m_type); break; } } return 0; }
/*===========================================================================* * main * *===========================================================================*/ int main(int argc, char *argv[]) { int r; int ipc_status; /* SEF local startup. */ env_setargs(argc, argv); sef_local_startup(); while (TRUE) { if ((r = netdriver_receive(ANY, &m, &ipc_status)) != OK) panic("netdriver_receive failed: %d", r); if (is_ipc_notify(ipc_status)) { switch (_ENDPOINT_P(m.m_source)) { case CLOCK: /* * Under MINIX, synchronous alarms are used * instead of watchdog functions. * The approach is very different: MINIX VMD * timeouts are handled within the kernel * (the watchdog is executed by CLOCK), and * notify() the driver in some cases. MINIX * timeouts result in a SYN_ALARM message to * the driver and thus are handled where they * should be handled. Locally, watchdog * functions are used again. */ rl_watchdog_f(NULL); break; case HARDWARE: do_hard_int(); if (int_event_check) { check_int_events(); } break ; default: panic("illegal notify from: %d", m.m_type); } /* done, get nwe message */ continue; } switch (m.m_type) { case DL_WRITEV_S: rl_writev_s(&m, FALSE); break; case DL_READV_S: rl_readv_s(&m, FALSE); break; case DL_CONF: rl_init(&m); break; case DL_GETSTAT_S: rl_getstat_s(&m); break; default: panic("illegal message: %d", m.m_type); } } }
/*===========================================================================* * main * *===========================================================================*/ int main(int argc, char **argv) { /* SEF local startup. */ env_setargs(argc, argv); sef_local_startup(); /* Call the generic receive loop. */ blockdriver_task(&fbd_dtab); return OK; }
/*===========================================================================* * main * *===========================================================================*/ int main(int argc, char *argv[]) { dpeth_t *dep; message m; int ipc_status; int r; /* SEF local startup. */ env_setargs(argc, argv); sef_local_startup(); while (TRUE) { if ((r= netdriver_receive(ANY, &m, &ipc_status)) != OK) panic("netdriver_receive failed: %d", r); if(is_ipc_notify(ipc_status)) { switch(_ENDPOINT_P(m.m_source)) { case CLOCK: do_watchdog(&m); break; case HARDWARE: dep = &de_state; if (dep->de_mode == DEM_ENABLED) { do_interrupt(dep); if (dep->de_flags & (DEF_ACK_SEND | DEF_ACK_RECV)) do_reply(dep); sys_irqenable(&dep->de_hook); } break; default: printf("ignoring notify from %d\n", m.m_source); break; } continue; } switch (m.m_type) { case DL_WRITEV_S: do_vwrite_s(&m, FALSE); break; case DL_READV_S: do_vread_s(&m, FALSE); break; case DL_CONF: do_conf(&m); break; case DL_GETSTAT_S: do_get_stat_s(&m); break; default: printf("message 0x%x; %d from %d\n", m.m_type, m.m_type-DL_RQ_BASE, m.m_source); panic("illegal message: %d", m.m_type); } } }
int main(void) { /* * Perform initialization. */ sef_local_startup(); /* * Run the main loop. */ chardriver_task(&hello_tab, CHARDRIVER_SYNC); return OK; }
/*===========================================================================* * main * *===========================================================================*/ int main(int argc, char *argv[]) { /* This is the main routine of this service. */ /* SEF local startup. */ env_setargs(argc, argv); sef_local_startup(); /* The fsdriver library does the actual work here. */ fsdriver_task(&mfs_table); return(0); }
int main(int argc, char **argv) { env_setargs(argc, argv); sef_local_startup(); blockdriver_mt_task(&virtio_blk_dtab); dprintf(("Terminating")); virtio_blk_cleanup(); return OK; }
/*===========================================================================* * main * *===========================================================================*/ int main(void) { /* SEF local startup. */ sef_local_startup(); /* Run all the tests. */ test_u32(); test_str(); test_mem(); test_map(); test_label(); return 0; }
/*===========================================================================* * main * *===========================================================================*/ int main(int argc, char **argv) { /* Driver task. */ message m; int ipc_status; int r; /* Initialize SEF. */ env_setargs(argc, argv); sef_local_startup(); while (TRUE) { if ((r = netdriver_receive(ANY, &m, &ipc_status)) != OK) panic("netdriver_receive failed: %d", r); if (is_ipc_notify(ipc_status)) { switch (m.m_source) { case HARDWARE: /* interrupt */ atl2_intr(&m); break; case TTY_PROC_NR: /* function key */ atl2_dump(); break; default: printf("ATL2: illegal notify from %d\n", m.m_source); } continue; } /* Process requests from Inet. */ switch (m.m_type) { case DL_CONF: atl2_conf(&m); break; case DL_GETSTAT_S: atl2_getstat(&m); break; case DL_WRITEV_S: atl2_writev(&m, FALSE); break; case DL_READV_S: atl2_readv(&m, FALSE); break; default: printf("ATL2: illegal message %d from %d\n", m.m_type, m.m_source); } } }
/*===========================================================================* * dpeth_task * *===========================================================================*/ int main(int argc, char *argv[]) { message m; int ipc_status; int r; /* SEF local startup. */ env_setargs(argc, argv); sef_local_startup(); while (TRUE) { if ((r= netdriver_receive(ANY, &m, &ipc_status)) != OK) panic("dp8390: netdriver_receive failed: %d", r); if (is_ipc_notify(ipc_status)) { switch (_ENDPOINT_P(m.m_source)) { case HARDWARE: handle_hw_intr(); break; case CLOCK: printf("dp8390: notify from CLOCK\n"); break; default: panic("dp8390: illegal notify from: %d", m.m_source); } /* done, get a new message */ continue; } switch (m.m_type) { case DL_WRITEV_S: do_vwrite_s(&m, FALSE); break; case DL_READV_S: do_vread_s(&m); break; case DL_CONF: do_init(&m); break; case DL_GETSTAT_S: do_getstat_s(&m); break; default: panic("dp8390: illegal message: %d", m.m_type); } } }
int main(__unused int argc, __unused char ** argv) { sef_local_startup(); for(;;) { int err, ipc_status; message m; netif_poll_lo(); mq_process(); if ((err = sef_receive_status(ANY, &m, &ipc_status)) != OK) { printf("LWIP : sef_receive_status errr %d\n", err); continue; } if (m.m_source == VFS_PROC_NR) socket_request(&m, ipc_status); else if (is_ipc_notify(ipc_status)) { switch (m.m_source) { case CLOCK: expire_timers(m.m_notify.timestamp); break; case DS_PROC_NR: ds_event(); break; case PM_PROC_NR: panic("LWIP : unhandled event from PM"); break; default: printf("LWIP : unexpected notify from %d\n", m.m_source); continue; } } else /* all other request can be from drivers only */ driver_request(&m); } return 0; }
/*===========================================================================* * main * *===========================================================================*/ int main(int argc, char *argv[]) { int r; message m; int ipc_status; /* SEF local startup. */ env_setargs(argc, argv); sef_local_startup(); for (;;) { r= driver_receive(ANY, &m, &ipc_status); if (r != OK) panic("driver_receive failed: %d", r); printf("ti1225: got message %u from %d\n", m.m_type, m.m_source); } return 0; }
int main(int argc, char **argv) { message m; int r; env_setargs(argc, argv); sef_local_startup(); for (;;) { if ((r = sef_receive(ANY, &m)) != OK) panic("sef_receive failed (%d)\n", r); m.m_type = do_request(&m); send(m.m_source, &m); } return 0; }
/*===========================================================================* * main * *===========================================================================*/ int main(int argc, char **argv) { /* This is the main routine of this service. The main loop consists of * three major activities: getting new work, processing the work, and * sending the reply. The loop never terminates, unless a panic occurs. */ int result; /* SEF local startup. */ env_setargs(argc, argv); sef_local_startup(); /* Main loop - get work and do it, forever. */ while (TRUE) { /* Wait for incoming message, sets 'callnr' and 'who'. */ get_work(); if (is_notify(callnr)) { switch (_ENDPOINT_P(who_e)) { case TTY_PROC_NR: result = do_fkey_pressed(&m_in); break; default: /* FIXME: error message. */ result = EDONTREPLY; break; } } else { printf("IS: warning, got illegal request %d from %d\n", callnr, m_in.m_source); result = EDONTREPLY; } /* Finally send reply message, unless disabled. */ if (result != EDONTREPLY) { reply(who_e, result); } } return(OK); /* shouldn't come here */ }
int main(void) { int i = 0; owner = -1; open_file_descriptors = 0; secret_opened_for_reading = false; for (i = 0; i < SECRET_SIZE; i++) { the_secret[i] = '\0'; } /* * Perform initialization. */ sef_local_startup(); /* * Run the main loop. */ chardriver_task(&hello_tab, CHARDRIVER_SYNC); return OK; }
/*===========================================================================* * main * *===========================================================================*/ int main(void) { message msg; int r, ipc_status; /* SEF local startup. */ sef_local_startup(); /* The receive loop. */ for (;;) { if ((r = driver_receive(ANY, &msg, &ipc_status)) != OK) panic("memory: driver_receive failed (%d)", r); if (IS_BDEV_RQ(msg.m_type)) blockdriver_process(&m_bdtab, &msg, ipc_status); else chardriver_process(&m_cdtab, CHARDRIVER_SYNC, &msg, ipc_status); } return(OK); }
/*===========================================================================* * main * *===========================================================================*/ int main(int argc, char **argv) { /* The main message loop. */ message m; int r, ipc_status; env_setargs(argc, argv); sef_local_startup(); while (TRUE) { if ((r = driver_receive(ANY, &m, &ipc_status)) != OK) panic("driver_receive failed: %d", r); if (is_ipc_notify(ipc_status)) { switch (m.m_source) { case HARDWARE: vbox_intr(); break; case CLOCK: vbox_update_time(); break; default: printf("VBOX: received notify from %d\n", m.m_source); } continue; } hgcm_message(&m, ipc_status); } return 0; }
int main(int argc, char *argv[]) { int r; env_setargs(argc, argv); r = tda19988_env_parse(); if (r < 0) { log_warn(&log, "Expecting -args 'cec_bus=X cec_address=0xAA hdmi_bus=Y hdmi_address=0xBB'\n"); log_warn(&log, "Example -args 'cec_bus=1 cec_address=0x34 hdmi_bus=1 hdmi_address=0x70'\n"); return EXIT_FAILURE; } sef_local_startup(); log_debug(&log, "Startup Complete\n"); blockdriver_task(&tda19988_tab); log_debug(&log, "Shutting down\n"); return OK; }
/*===========================================================================* * tty_task * *===========================================================================*/ int main(void) { /* Main routine of the terminal task. */ message tty_mess; /* buffer for all incoming messages */ int ipc_status; int line; int r; register tty_t *tp; /* SEF local startup. */ sef_local_startup(); while (TRUE) { /* Check for and handle any events on any of the ttys. */ for (tp = FIRST_TTY; tp < END_TTY; tp++) { if (tp->tty_events) handle_events(tp); } /* Get a request message. */ r= driver_receive(ANY, &tty_mess, &ipc_status); if (r != 0) panic("driver_receive failed with: %d", r); /* First handle all kernel notification types that the TTY supports. * - An alarm went off, expire all timers and handle the events. * - A hardware interrupt also is an invitation to check for events. * - A new kernel message is available for printing. * - Reset the console on system shutdown. * Then see if this message is different from a normal device driver * request and should be handled separately. These extra functions * do not operate on a device, in constrast to the driver requests. */ if (is_ipc_notify(ipc_status)) { switch (_ENDPOINT_P(tty_mess.m_source)) { case CLOCK: /* run watchdogs of expired timers */ expire_timers(tty_mess.m_notify.timestamp); break; case HARDWARE: /* hardware interrupt notification */ #if NR_RS_LINES > 0 /* serial I/O */ if (tty_mess.m_notify.interrupts & rs_irq_set) rs_interrupt(&tty_mess); #endif /* run watchdogs of expired timers */ expire_timers(tty_mess.m_notify.timestamp); break; default: /* do nothing */ break; } /* done, get new message */ continue; } switch (tty_mess.m_type) { case TTY_FKEY_CONTROL: /* (un)register a fkey observer */ do_fkey_ctl(&tty_mess); continue; case TTY_INPUT_UP: case TTY_INPUT_EVENT: do_input(&tty_mess); continue; default: /* should be a driver request */ ; /* do nothing; end switch */ } if (!IS_CDEV_RQ(tty_mess.m_type)) { chardriver_process(&tty_tab, &tty_mess, ipc_status); continue; } /* Only device requests should get to this point. * All requests have a minor device number. */ if (OK != chardriver_get_minor(&tty_mess, &line)) continue; if (line == VIDEO_MINOR) { do_video(&tty_mess, ipc_status); continue; } /* Execute the requested device driver function. */ chardriver_process(&tty_tab, &tty_mess, ipc_status); } return 0; }