• 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
Unix Process ID (and Processes List)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Unix Process ID (and Processes List)


  • Subject: Unix Process ID (and Processes List)
  • From: "Daniele M." <email@hidden>
  • Date: Tue, 4 Mar 2003 23:21:06 +0100
  • Organization: westcode software, inc.

Hi

I would to know the Unix ID number of a process. I have found the code
to get the processes list. Is there a method to get, from here, the
unix pid of the process?

- (NSArray *)Process {
NSMutableArray *resultsArray=[NSMutableArray array];
OSErr resultCode=noErr;
ProcessSerialNumber serialNumber;
ProcessInfoRec procInfo;
FSSpec appFSSpec;

Str255 procName;
serialNumber.highLongOfPSN = kNoProcess;
serialNumber.lowLongOfPSN = kNoProcess;

procInfo.processInfoLength =sizeof(ProcessInfoRec);
procInfo.processName=procName;
procInfo.processAppSpec = &appFSSpec;
procInfo.processAppSpec = &appFSSpec;

while (procNotFound != (resultCode =
GetNextProcess(&serialNumber))) {
if (noErr ==(resultCode =
GetProcessInformation(&serialNumber,&procInfo))) {
if (procName[1] == nil) procName[1] = '0';
[resultsArray
addObject:(NSString*)CFStringCreateWithPascalString(NULL,procInfo.processName,kCFStringEncodingMacRoman)];
}
}
return resultsArray;
}


Thank you to all
Good work
dan
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Unix Process ID (and Processes List)
      • From: Aram Greenman <email@hidden>
    • Re: Unix Process ID (and Processes List)
      • From: Bill Cheeseman <email@hidden>
    • Re: Unix Process ID (and Processes List)
      • From: David Remahl <email@hidden>
  • Prev by Date: Weird crashes in loading nibs
  • Next by Date: Re: Unix Process ID (and Processes List)
  • Previous by thread: Re: Weird crashes in loading nibs
  • Next by thread: Re: Unix Process ID (and Processes List)
  • Index(es):
    • Date
    • Thread