group
group__libshare__sysproc
Provides the capability to create, manage, and communicate with multiple processes running as spawned programs.

Process Pool Management

typedef
typedef int(* shproc_op_t)(int, shbuf_t *buff)
typedef
typedef struct shproc_req_t shproc_req_t
typedef
typedef struct shproc_t shproc_t
typedef
typedef struct shproc_pool_t shproc_pool_t
function
shproc_pool_t* shproc_init
(shproc_op_t req_f, shproc_op_t resp_f)
Create a new pool to manage process workers.
function
int shproc_conf
(shproc_pool_t *pool, int type, int val)
Configure a process pool's attributes.
  • SHPROC_MAX The maximum number of processes that can be spawned in the pool.
  • SHPROC_PRIO A value in the range -20 to 19. A lower priority indicates a more favorable scheduling.
    Param
    type
    The configuration option value to set or get.
    val
    Zero to indicate a 'Get Value' request; otherwise the parameter specifies the value to the option to.
function
shproc_pool_t* shproc_pool
(void)
Obtain currrent pool, if any, that has been initialized.
function
shproc_t* shproc_start
(shproc_pool_t *pool)
Start a new process to handle worker requests.
function
int shproc_stop
(shproc_t *proc)
Terminate a running worker process.
function
shproc_t* shproc_get
(shproc_pool_t *pool, int state)
Obtain a process slot from the pool based on process state.
function
int shproc_schedule
(shproc_t *proc, unsigned char *data, size_t data_len)
function
shproc_t* shproc_pull
(shproc_pool_t *pool)
Obtain a process from the pool that is ready for work.
function
int shproc_push
(shproc_pool_t *pool, int fd, unsigned char *data, size_t data_len)
Perform a request against a process ready for work.
function
void shproc_free
(shproc_pool_t **pool_p)
deallocate resources for a process pool
function
void shproc_signal
(void *sig_f)
Set a custom signal handler for worker process.
function
void shproc_poll
(shproc_pool_t *pool)
Process pending communications with worker process(es).
function
void shproc_rlim_set
(void)
function
uint64_t shproc_rlim
(int mode)
define
SHPROC_NONE
0
define
SHPROC_IDLE
1
define
SHPROC_PEND
2
define
SHPROC_RUN
3
define
MAX_SHPROC_STATES
4
define
SHPROC_MAX
100
A control option which manages the maximum number of processes spawned.
define
SHPROC_PRIO
101
define
SHPROC_POOL_DEFAULT_SIZE
16
The default maximum number of processes spawned.