The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > OS Specific Forums > SUN Solaris
Google UNIX.COM


SUN Solaris The Solaris Operating System, usually known simply as Solaris, is a free Unix-based operating system introduced by Sun Microsystems .

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
script to monitor process running on server and posting a mail if any process is dead pradeepmacha Shell Programming and Scripting 12 10-17-2008 12:08 AM
Can a child process return a specific value to a parent process ? Ametis1970 High Level Programming 8 04-09-2008 08:22 PM
Killing of a process and send a mail if the process doesnot come up within 2 minutes Prince89 Shell Programming and Scripting 1 02-15-2008 04:10 PM
how to start a process and make it sleep for 5 mins and then kill that process shrao Shell Programming and Scripting 6 03-27-2007 09:54 AM
my process is going to sleep mode after 12 hours but i need my process in in firsy pr mukesh_rakesh1 UNIX for Advanced & Expert Users 0 09-04-2006 11:43 PM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 09-06-2007
Registered User
 

Join Date: Dec 2006
Posts: 19
.noname process???

I'm here in the need of an experts' help!!! :-)

When does a process acquire a name ".noname"

In one of my applications I create a process using the following code,
the process is created with the given name 'executable', but the same process is not reachable with the same name.
It is only reachable as .noname!

Do you have any tips to solve this problem?

pid_t
PRH_CreateProcess(char* executable,
char*const argv[],
int p[],
PRH_ProcessNotifier notifier,
SEA_UserContext userContext)
{
pid_t child;
int childPipe[2];
int i;


if (p) {
/* We should create pipes. */
if (PRH_createPipe (&p[0], &childPipe[1]) < 0) {
return 0;
}
if (PRH_createPipe (&childPipe[0], &p[1]) < 0) {
return 0;
}
}

if ((child = vfork ()) < 0) {
REP_LOG_ERROR(("Vfork failed!\n"));
REP_LOG_ERROR(("%s\n", strerror(errno)));
return 0;
}
else if (child)
{
/* Parent, close the child side and register the new process */
if (p) {
close (childPipe[0]);
close (childPipe[1]);
}
PRH_addProcess (child, executable, argv, p, notifier, userContext);
return child;
}
else
{
/* Child, close parent side, setup stdin & stdout and exec away */
if (p) {
close (p[0]);
close (p[1]);

if (dup2 (childPipe[0], 0) < 0) { /* stdin */
REP_LOG_FATAL(("Dup2 failed\n"));
}
close (childPipe[0]);

if (dup2 (childPipe[1], 1) < 0) { /* stdout */
REP_LOG_FATAL(("Dup2 failed\n"));
}
close (childPipe[1]);
}
else
{
/* If no pipe was requested, close stdin and stdout to avoid zoombies
when the parent dies. stderr should also be closed, but that can't
be done since some tools relies on that errors can be printed on
stderr and end up in the SEA log. Each caller should really setup
an "error pipe" for this. */
close(0);
close(1);
}

/* Close all other descriptors that are inherited. */
i = (int)sysconf(_SC_OPEN_MAX);
for (i = i - 1; i > 3; i--)
{
close(i);
}

/* Create own process group */
(void)setpgid(0,0);

execvp (executable, argv );

REP_LOG_ERROR(("Execvp failed (Executable: %s)\n", executable));
REP_LOG_ERROR(("%s\n", strerror(errno)));
_exit (1);
}
REP_LOG_ERROR(("Reached non reachable statement in PRH_CreateProcess\n"));
return 0;
}
Reply With Quote
Google The UNIX and Linux Forums
Forum Sponsor
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 01:26 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0