Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!hellgate.utah.edu!helios.ee.lbl.gov!pasteur!ucbvax!cascade.carleton.CDN!holtz From: holtz@cascade.carleton.CDN (Neal Holtz) Newsgroups: comp.sys.apollo Subject: Re: more ignorant questions ... Message-ID: <1364*holtz@cascade.carleton.cdn> Date: 15 Dec 89 01:36:00 GMT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The Internet Lines: 27 To set the name of a process (in SR9.7), we use the following C procedure, which uses an undocumented system call. The procedure tries 25 (or is it 26) times to set the name, appending a numeric count to the name when a process of the desired name already exists. ##################################################################### /* * set the name of this process */ int Name_process( pn ) char *pn; /* the desired process name */ { std_$call pm_$set_my_name(); /* undocumented, but handy */ typedef long stat_$t; /* status codes returned */ stat_$t st; stat_$t exists = 0x800E0003; /* if process already exists */ int cnt = 0; /* to append to name */ char buf[100]; strcpy( buf, pn ); pm_$set_my_name( buf, (short)strlen(buf), st ); while( st == exists && cnt < 25 ) { sprintf( buf, "%s.%d", pn, cnt++ ); pm_$set_my_name( buf, (short)strlen(buf), st ); } return( st == 0 ); }