Barrelfish
|
Startup code for distributed services. More...
Functions | |
int | dist_main (struct dist_args *d_args, void *m_args, char *name) |
Main function that starts work for master and worker dispatchers. More... | |
errval_t | worker_args (void *m_args, char **res[], int *res_len) |
Externally defined function to convert service-specific arguments. More... | |
errval_t | run_master (coreid_t core, coreid_t *cores, int cores_len, void *m_args, char *name) |
Externally defined function providing service specific master functionality. More... | |
errval_t | run_worker (coreid_t core, coreid_t *cores, int cores_len, void *m_args, char *name) |
Externally defined function providing service-specific worker functionality. More... | |
Startup code for distributed services.
int dist_main | ( | struct dist_args * | d_args, |
void * | m_args, | ||
char * | name | ||
) |
Main function that starts work for master and worker dispatchers.
Depending on the arguments passed in d_args->master this function starts a dispatcher running as a master or a worker. As a master it spwans worker dispatchers on the given cores (d_args->cores) and then calls the externally defined run_master() function. As a worker it calls the externally defined run_worker() function.
d_args | the generic distributed service arguments passed to this dispatcher. |
m_args | the service-specific arguments passed to this dispatcher. |
name | the name of this service. |
errval_t run_master | ( | coreid_t | core, |
coreid_t * | cores, | ||
int | cores_len, | ||
void * | m_args, | ||
char * | name | ||
) |
Externally defined function providing service specific master functionality.
This function is run after all the workers have been succesfully spawned. In most cases this function won't do much, since the master's main task is to spawn workers and then coordinate their startup.
core | core ID of this dispatcher. |
cores | a list of the cores that the workers run on. |
cores_len | the length of the list. |
m_args | the service-specific arguments passed to this dispatcher. |
name | the name of this service. |
errval_t run_worker | ( | coreid_t | core, |
coreid_t * | cores, | ||
int | cores_len, | ||
void * | m_args, | ||
char * | name | ||
) |
Externally defined function providing service-specific worker functionality.
This function is run by every worker dispatcher when it is started. This is the main service-specific entry point. In most cases this function never returns but starts an infinite dispatch loop.
core | core ID of this dispatcher. |
cores | a list of the cores that the workers run on. |
cores_len | the length of the list. |
m_args | the service-specific arguments passed to this dispatcher. |
name | the name of this service. |
errval_t worker_args | ( | void * | m_args, |
char ** | res[], | ||
int * | res_len | ||
) |
Externally defined function to convert service-specific arguments.
This function must return an array of command line arguments, representing those in m_args, that can be passed to a worker dispatcher when it is spawned by a master.
m_args | the service-specific arguments passed to this dispatcher. |
res | returns a list of command line arguments (like argv). This is malloced by this function, the caller must free it. |
res_len | returns the number of elements in the res list |