{
(void) rou_alert(0,"JMPDBG starting task");
-(void) sleep(5);
+(void) prc_settitle("JMPDBG bingo!");
+(void) sleep(10);
(void) rou_alert(0,"JMPDBG task completed");
}
/*
proceed=false;//Dive mode
break;
case 2 : //initialising process
+ (void) prc_preptitle(argc,argv,environ);
(void) rou_modesubrou(true);
(void) par_modeunipar(true);
(void) prc_modeuniprc(true);
case 3 : //doing main tash
(void) task();
break;
- default : //end of task
+ case 4 : //doing main tash
+ (void) prc_cleantitle();
(void) prc_modeuniprc(false);
(void) par_modeunipar(false);
(void) rou_modesubrou(false);
+ break;
+ default : //end of task
proceed=false;
break;
}
#include "subrou.h"
#include "uniprc.h"
-
//directory to set lock
#define DIRLOCK "/var/run/"APPNAME
-static _Bool modopen; //boolean module open/close
+/*Process command override structure (proc) */
+typedef struct {
+ int max; //title max size
+ char *title; //title storage area
+ }TITLTYP;
+
+static TITLTYP *title=(TITLTYP *)0; //storage area for /proc
+ //title display
+static _Bool modopen; //boolean module open/close
+
/*
\f
*/
#undef OPEP
}
/*
+\f
+*/
+/********************************************************/
+/* */
+/* Procedure to free used by "title" struct memory.*/
+/* */
+/********************************************************/
+void prc_cleantitle()
+
+{
+if (title!=(TITLTYP *)0) {
+ if (environ!=(char **)0) {
+ int i;
+
+ for (i=0;environ[i]!=(char *)0;i++) {
+ (void) free(environ[i]);
+ environ[i]=(char *)0;
+ }
+ (void) free(environ);
+ environ=(char **)0;
+ }
+ (void) free(title);
+ title=(TITLTYP *)0;
+ }
+}
+/*
+\f
+*/
+/********************************************************/
+/* */
+/* */
+/* Procedure to find and limit space to */
+/* be used as status information available */
+/* from proc (ps ax) */
+/* */
+/********************************************************/
+void prc_preptitle(int argc,char *argv[],char *env[])
+
+{
+char *lastend;
+
+lastend=(char *)0;
+(void) prc_cleantitle();
+title=(TITLTYP *)calloc(1,sizeof(TITLTYP));
+if (argv!=(char **)0) {
+ int i;
+
+ title->title=argv[0];
+ for (i=1;i<argc;i++) {
+ lastend=argv[i]+strlen(argv[i]);
+ argv[i]=(char *)0;
+ }
+ }
+if (env!=(char **)0) {
+ int i;
+
+ environ=(char **)0;
+ for (i=0;env[i]!=(char *)0;i++) {
+ char *valeur;
+
+ lastend=env[i]+strlen(env[i]);
+ valeur=strdup(env[i]);
+ (void) putenv(valeur);
+ }
+ }
+title->max=lastend-title->title;
+}
+/*
+^L
+*/
+/********************************************************/
+/* */
+/* Procedure to update title information. */
+/* Title information is avalable via the */
+/* CLI (commande line interface) "ps" */
+/* */
+/********************************************************/
+void prc_settitle(const char *fmt,...)
+
+{
+va_list args;
+
+va_start(args,fmt);
+if ((title!=(TITLTYP *)0)&&(title->title!=(char *)0)) {
+ (void) memset(title->title,'\000',title->max);
+ (void) vsnprintf(title->title,title->max,fmt,args);
+ }
+va_end(args);
+}
+/*
^L
*/
/********************************************************/
#include "subrou.h"
+extern char **environ; //context enviromenent variable
+
#define LCK_UNLOCK 0 /*unlocking request */
#define LCK_LOCK 1 /*locking requets */
+//To clean the command line title area
+extern void prc_cleantitle();
+
+//To duplicate enviromenet library and used as command line data
+extern void prc_preptitle(int argc,char *argv[],char *env[]);
+
+//To insert a string in the command area
+extern void prc_settitle(const char *fmt,...);
+
//To allow application to core dump is memory is
//big trouble need to be investigated
extern void prc_allow_core_dump();