process.c File Reference

Processes. More...

#include <gpxe/list.h>
#include <gpxe/init.h>
#include <gpxe/process.h>

Go to the source code of this file.

Functions

 FILE_LICENCE (GPL2_OR_LATER)
static LIST_HEAD (run_queue)
 Process run queue.
void process_add (struct process *process)
 Add process to process list.
void process_del (struct process *process)
 Remove process from process list.
void step (void)
 Single-step a single process.
static void init_processes (void)
 Initialise processes.
struct init_fn process_init_fn __init_fn (INIT_NORMAL)
 Process initialiser.


Detailed Description

Processes.

We implement a trivial form of cooperative multitasking, in which all processes share a single stack and address space.

Definition in file process.c.


Function Documentation

FILE_LICENCE ( GPL2_OR_LATER   ) 

static LIST_HEAD ( run_queue   )  [static]

Process run queue.

void process_add ( struct process process  ) 

Add process to process list.

Parameters:
process Process
It is safe to call process_add() multiple times; further calls will have no effect.

Definition at line 44 of file process.c.

References DBGC, process::list, list_add_tail, list_empty(), ref_get(), and process::refcnt.

Referenced by ib_cmrc_close(), init_processes(), net80211_autoassociate(), and process_init().

00044                                              {
00045         if ( list_empty ( &process->list ) ) {
00046                 DBGC ( process, "PROCESS %p starting\n", process );
00047                 ref_get ( process->refcnt );
00048                 list_add_tail ( &process->list, &run_queue );
00049         } else {
00050                 DBGC ( process, "PROCESS %p already started\n", process );
00051         }
00052 }

void process_del ( struct process process  ) 

Remove process from process list.

Parameters:
process Process
It is safe to call process_del() multiple times; further calls will have no effect.

Definition at line 62 of file process.c.

References DBGC, INIT_LIST_HEAD, process::list, list_del, list_empty(), ref_put(), and process::refcnt.

Referenced by http_done(), http_step(), hw_finished(), ib_cmrc_shutdown(), iscsi_detach(), net80211_netdev_close(), net80211_step_associate(), numeric_step(), and tls_close().

00062                                              {
00063         if ( ! list_empty ( &process->list ) ) {
00064                 DBGC ( process, "PROCESS %p stopping\n", process );
00065                 list_del ( &process->list );
00066                 INIT_LIST_HEAD ( &process->list );
00067                 ref_put ( process->refcnt );
00068         } else {
00069                 DBGC ( process, "PROCESS %p already stopped\n", process );
00070         }
00071 }

void step ( void   ) 

Single-step a single process.

This executes a single step of the first process in the run queue, and moves the process to the end of the run queue.

Definition at line 79 of file process.c.

References DBGC2, process::list, list_add_tail, list_del, list_for_each_entry, and process::step.

Referenced by aoe_discover(), ata_command(), ath5k_hw_rf_check_gainf_readback(), ath5k_hw_rf_gainf_corr(), comboot_resolv(), getchar(), getchar_timeout(), iflinkwait(), int22(), iwlist(), md5_transform(), monojob_wait(), open(), process_init(), process_init_stopped(), pxe_menu_select(), pxenv_tftp_get_fsize(), pxenv_tftp_open(), pxenv_tftp_read(), pxenv_tftp_read_file(), pxenv_udp_read(), read_user(), scsi_command(), select(), and spi_bit_transfer().

00079                    {
00080         struct process *process;
00081 
00082         list_for_each_entry ( process, &run_queue, list ) {
00083                 list_del ( &process->list );
00084                 list_add_tail ( &process->list, &run_queue );
00085                 DBGC2 ( process, "PROCESS %p executing\n", process );
00086                 process->step ( process );
00087                 DBGC2 ( process, "PROCESS %p finished executing\n", process );
00088                 break;
00089         }
00090 }

static void init_processes ( void   )  [static]

Initialise processes.

Definition at line 96 of file process.c.

References for_each_table_entry, PERMANENT_PROCESSES, and process_add().

00096                                     {
00097         struct process *process;
00098 
00099         for_each_table_entry ( process, PERMANENT_PROCESSES )
00100                 process_add ( process );
00101 }

struct init_fn process_init_fn __init_fn ( INIT_NORMAL   )  [read]

Process initialiser.


Generated on Tue Apr 6 20:01:14 2010 for gPXE by  doxygen 1.5.7.1