main.c File Reference

Loads and runs programs from VFS. More...

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <bool.h>
#include <fcntl.h>
#include <sys/types.h>
#include <ipc/services.h>
#include <ipc/loader.h>
#include <ipc/ns.h>
#include <macros.h>
#include <loader/pcb.h>
#include <entry_point.h>
#include <errno.h>
#include <async.h>
#include <str.h>
#include <as.h>
#include <elf.h>
#include <elf_load.h>

Go to the source code of this file.

Defines

#define DPRINTF()

Functions

static void ldr_connection (ipc_callid_t iid, ipc_call_t *icall)
 Handle loader connection.
static void ldr_get_taskid (ipc_callid_t rid, ipc_call_t *request)
static int ldr_load (ipc_callid_t rid, ipc_call_t *request)
 Load the previously selected program.
static void ldr_run (ipc_callid_t rid, ipc_call_t *request)
 Run the previously loaded program.
static void ldr_set_args (ipc_callid_t rid, ipc_call_t *request)
 Receive a call setting arguments of the program to execute.
static void ldr_set_cwd (ipc_callid_t rid, ipc_call_t *request)
 Receive a call setting the current working directory.
static void ldr_set_files (ipc_callid_t rid, ipc_call_t *request)
 Receive a call setting preset files of the program to execute.
static void ldr_set_pathname (ipc_callid_t rid, ipc_call_t *request)
 Receive a call setting pathname of the program to execute.
int main (int argc, char *argv[])
 Main entry point.

Variables

static char * arg_buf = NULL
 Buffer holding all arguments.
static int argc = 0
 Number of arguments.
static char ** argv = NULL
 Argument vector.
static bool connected = false
 Used to limit number of connections to one.
static char * cwd = NULL
 Current working directory.
static fdi_node_tfil_buf = NULL
 Buffer holding all preset files.
static int filc = 0
 Number of preset files.
static fdi_node_t ** filv = NULL
 Preset files vector.
static char * pathname = NULL
 Pathname of the file that will be loaded.
static pcb_t pcb
 The Program control block.
static elf_info_t prog_info


Detailed Description

Loads and runs programs from VFS.

The program loader is a special init binary. Its image is used to create a new task upon a task_spawn syscall. The syscall returns the id of a phone connected to the newly created task.

The caller uses this phone to send the pathname and various other information to the loader. This is normally done by the C library and completely hidden from applications.

Definition in file main.c.


Generated on Thu Jun 2 07:45:51 2011 for HelenOS/USB by  doxygen 1.4.7