New private method

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@25371 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2007-08-02 09:36:38 +00:00
parent 3e17a107ae
commit ffab73cc5a
2 changed files with 39 additions and 0 deletions

View file

@ -1,3 +1,8 @@
2007-08-02 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSProcessInfo.m: Private method to check existence of
process.
2007-07-31 Richard Frith-Macdonald <rfm@gnu.org>
* Headers/Foundation/NSRange.h:

View file

@ -67,6 +67,18 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef HAVE_WINDOWS_H
# include <windows.h>
#endif
#ifdef HAVE_SYS_SIGNAL_H
#include <sys/signal.h>
#endif
#ifdef HAVE_SIGNAL_H
#include <signal.h>
#endif
#include <sys/file.h>
#ifdef HAVE_SYS_FCNTL_H
#include <sys/fcntl.h>
@ -919,6 +931,28 @@ int main(int argc, char *argv[], char *env[])
return _gnu_sharedProcessInfoObject;
}
+ (BOOL) _exists: (int)pid
{
if (pid > 0)
{
#if defined(__MINGW32__)
HANDLE h = OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION,0,pid);
if (h == NULL && GetLastError() != ERROR_ACCESS_DENIED)
{
return NO;
}
CloseHandle(h);
#else
if (kill(0, pid) < 0 && errno == ESRCH)
{
return NO;
}
#endif
return YES;
}
return NO;
}
- (NSArray *) arguments
{
return _gnu_arguments;