*/
else {
switch(call_nr) {
- case RS_UP: result = do_up(&m, FALSE /*!do_copy*/); break;
- case RS_UP_COPY: result = do_up(&m, TRUE /*do_copy*/); break;
+ case RS_UP: result = do_up(&m, FALSE, 0); break;
+ case RS_UP_COPY: result = do_up(&m, TRUE, 0); break;
+ case RS_RUN: result = do_up(&m, FALSE, RS_EXITING); break;
case RS_DOWN: result = do_down(&m); break;
case RS_REFRESH: result = do_refresh(&m); break;
case RS_RESCUE: result = do_rescue(&m); break;
extern int errno; /* error status */
/* Prototypes for internal functions that do the hard work. */
-FORWARD _PROTOTYPE( int start_service, (struct rproc *rp) );
+FORWARD _PROTOTYPE( int start_service, (struct rproc *rp, int flags) );
FORWARD _PROTOTYPE( int stop_service, (struct rproc *rp,int how) );
FORWARD _PROTOTYPE( int fork_nb, (void) );
FORWARD _PROTOTYPE( int read_exec, (struct rproc *rp) );
/*===========================================================================*
* do_up *
*===========================================================================*/
-PUBLIC int do_up(m_ptr, do_copy)
+PUBLIC int do_up(m_ptr, do_copy, flags)
message *m_ptr; /* request message pointer */
int do_copy; /* keep copy in memory */
+int flags; /* extra flags, if any */
{
/* A request was made to start a new system service. Dismember the request
* message and gather all information needed to start the service. Starting
rp->r_restarts = -1; /* will be incremented */
/* All information was gathered. Now try to start the system service. */
- return(start_service(rp));
+ return(start_service(rp, flags));
}
}
else if(rp->r_flags & RS_REFRESHING) {
rp->r_restarts = -1; /* reset counter */
- start_service(rp); /* direct restart */
+ start_service(rp, 0); /* direct restart */
}
else if (WIFEXITED(exit_status) &&
WEXITSTATUS(exit_status) == EXEC_FAILED) {
rp->r_backoff= 1;
}
else {
- start_service(rp); /* direct restart */
+ start_service(rp, 0); /* direct restart */
}
}
break;
if (rp->r_backoff > 0) {
rp->r_backoff -= 1;
if (rp->r_backoff == 0) {
- start_service(rp);
+ start_service(rp, 0);
}
}
/*===========================================================================*
* start_service *
*===========================================================================*/
-PRIVATE int start_service(rp)
+PRIVATE int start_service(rp, flags)
struct rproc *rp;
+int flags;
{
/* Try to execute the given system service. Fork a new process. The child
* process will be inhibited from running by the NO_PRIV flag. Only let the
* that's the case, the child will exit.
*/
child_proc_nr_n = _ENDPOINT_P(child_proc_nr_e);
- rp->r_flags = RS_IN_USE; /* mark slot in use */
+ rp->r_flags = RS_IN_USE | flags; /* mark slot in use */
rp->r_restarts += 1; /* raise nr of restarts */
rp->r_proc_nr_e = child_proc_nr_e; /* set child details */
rp->r_pid = child_pid;
_PROTOTYPE( int main, (void));
/* manager.c */
-_PROTOTYPE( int do_up, (message *m, int do_copy));
+_PROTOTYPE( int do_up, (message *m, int do_copy, int flags));
_PROTOTYPE( int do_down, (message *m));
_PROTOTYPE( int do_refresh, (message *m));
_PROTOTYPE( int do_rescue, (message *m));
"refresh",
"rescue",
"shutdown",
+ "upcopy", /* fill for RS_UP_COPY */
+ "run",
"catch for illegal requests"
};
#define ILLEGAL_REQUEST sizeof(known_requests)/sizeof(char *)
{
printf("Warning, %s\n", problem);
printf("Usage:\n");
- printf(" %s [-c] up <binary> [%s <args>] [%s <special>] [%s <ticks>]\n",
+ printf(" %s [-c] (up|run) <binary> [%s <args>] [%s <special>] [%s <ticks>]\n",
app_name, ARG_ARGS, ARG_DEV, ARG_PERIOD);
printf(" %s down <pid>\n", app_name);
printf(" %s refresh <pid>\n", app_name);
}
req_nr = RS_RQ_BASE + req_type;
- if (req_nr == RS_UP) {
+ if (req_nr == RS_UP || req_nr == RS_RUN) {
- if (c_flag)
+ if (req_nr == RS_UP && c_flag)
req_nr= RS_UP_COPY;
/* Verify argument count. */
switch(request) {
case RS_UP:
case RS_UP_COPY:
+ case RS_RUN:
/* Build space-separated command string to be passed to RS server. */
strcpy(command, req_path);
command[strlen(req_path)] = ' ';