• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Getting the parent process name
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting the parent process name


  • Subject: Re: Getting the parent process name
  • From: Pascal Pochet <email@hidden>
  • Date: Wed, 28 Jun 2006 22:30:53 +0200

#include <sys/types.h>
#include <unistd.h>

#include <sys/sysctl.h>

int getprocessname( pid_t inPID, char *outName, size_t inMaxLen)
{
	struct kinfo_proc info;
	size_t length = sizeof(struct kinfo_proc);
	int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, inPID };

	if (sysctl(mib, 4, &info, &length, NULL, 0) < 0)
		return -1 ;
	else
		strncpy(outName, info.kp_proc.p_comm, inMaxLen)	;

	return 0	;
}

pass getppid() as first argument…

Pascal Pochet
email@hidden



Le 27-juin-06 à 22:18, Mark Williams a écrit :

I should expand. I am trying to make sure here that the child was actually launched by the proper app and not from something else or the command line.


Mark.

On Jun 27, 2006, at 12:02 PM, Mark Williams wrote:

How would I go about getting the parent process name? Actually, the grand parent's name?

Thanks,
Mark.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40fornextsoft.com


This email sent to email@hidden



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40mac.com


This email sent to email@hidden



Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Getting the parent process name (From: Mark Williams <email@hidden>)
 >Re: Getting the parent process name (From: Mark Williams <email@hidden>)

  • Prev by Date: Re: Executing non objective-c code in a loaded bundle
  • Next by Date: Re: Bind to element in dictionary in array
  • Previous by thread: Re: Getting the parent process name
  • Next by thread: Re: Getting the parent process name
  • Index(es):
    • Date
    • Thread