mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 16:30:41 +00:00
Various minor updatesw for MacOS-X compatibility.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@10481 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
8f4c4cdab9
commit
190d5bdee4
7 changed files with 103 additions and 18 deletions
|
@ -1,3 +1,12 @@
|
||||||
|
2001-07-15 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
|
* Source/NSProcessInfo.m: Added -processIdentifier for compatibility
|
||||||
|
with MacOS-X
|
||||||
|
* Source/NSTask.m: Added -processIdentifier, -suspend, and -resume
|
||||||
|
for compatibility with MacOS-X
|
||||||
|
* Source/NSPortNameServer.m: Modified removal methods to return a
|
||||||
|
boolean success/failure status for MacOS-X compatibility.
|
||||||
|
|
||||||
2001-07-14 Adam Fedor <fedor@gnu.org>
|
2001-07-14 Adam Fedor <fedor@gnu.org>
|
||||||
|
|
||||||
* Headers/gnustep/base/objc-gnu2next.h: More function defs.
|
* Headers/gnustep/base/objc-gnu2next.h: More function defs.
|
||||||
|
|
|
@ -39,14 +39,14 @@
|
||||||
onHost: (NSString*)host;
|
onHost: (NSString*)host;
|
||||||
- (BOOL) registerPort: (NSPort*)port
|
- (BOOL) registerPort: (NSPort*)port
|
||||||
forName: (NSString*)name;
|
forName: (NSString*)name;
|
||||||
- (void) removePortForName: (NSString*)name;
|
- (BOOL) removePortForName: (NSString*)name;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
#ifndef NO_GNUSTEP
|
#ifndef NO_GNUSTEP
|
||||||
@interface NSPortNameServer (GNUstep)
|
@interface NSPortNameServer (GNUstep)
|
||||||
- (NSArray*) namesForPort: (NSPort*)port; /* return all names for port */
|
- (NSArray*) namesForPort: (NSPort*)port; /* return all names for port */
|
||||||
- (void) removePort: (NSPort*)port; /* remove all names for port */
|
- (BOOL) removePort: (NSPort*)port; /* remove all names for port */
|
||||||
- (void) removePort: (NSPort*)port forName: (NSString*)name;
|
- (BOOL) removePort: (NSPort*)port forName: (NSString*)name;
|
||||||
@end
|
@end
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -37,17 +37,20 @@
|
||||||
@interface NSProcessInfo: NSObject
|
@interface NSProcessInfo: NSObject
|
||||||
|
|
||||||
/* Getting an NSProcessInfo Object */
|
/* Getting an NSProcessInfo Object */
|
||||||
+ (NSProcessInfo *)processInfo;
|
+ (NSProcessInfo*) processInfo;
|
||||||
|
|
||||||
/* Returning Process Information */
|
/* Returning Process Information */
|
||||||
- (NSArray *)arguments;
|
- (NSArray*) arguments;
|
||||||
- (NSDictionary *)environment;
|
- (NSDictionary*) environment;
|
||||||
- (NSString *)hostName;
|
- (NSString*) hostName;
|
||||||
- (NSString *)processName;
|
#ifndef STRICT_OPENSTEP
|
||||||
- (NSString *)globallyUniqueString;
|
- (int) processIdentifier;
|
||||||
|
#endif
|
||||||
|
- (NSString*) processName;
|
||||||
|
- (NSString*) globallyUniqueString;
|
||||||
|
|
||||||
/* Specifying a Process Name */
|
/* Specifying a Process Name */
|
||||||
- (void)setProcessName:(NSString *)newName;
|
- (void) setProcessName: (NSString*)newName;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
@ -59,9 +62,9 @@
|
||||||
- (NSMutableSet*) debugSet;
|
- (NSMutableSet*) debugSet;
|
||||||
|
|
||||||
/* When non using the other argument initialization hacks... */
|
/* When non using the other argument initialization hacks... */
|
||||||
+ (void)initializeWithArguments:(char**)argv
|
+ (void)initializeWithArguments: (char**)argv
|
||||||
count:(int)argc
|
count: (int)argc
|
||||||
environment:(char**)env;
|
environment: (char**)env;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -76,6 +76,9 @@
|
||||||
* Obtaining task state
|
* Obtaining task state
|
||||||
*/
|
*/
|
||||||
- (BOOL) isRunning;
|
- (BOOL) isRunning;
|
||||||
|
#ifndef STRICT_OPENSTEP
|
||||||
|
- (int) processIdentifier;
|
||||||
|
#endif
|
||||||
- (int) terminationStatus;
|
- (int) terminationStatus;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -83,6 +86,10 @@
|
||||||
*/
|
*/
|
||||||
- (void) interrupt;
|
- (void) interrupt;
|
||||||
- (void) launch;
|
- (void) launch;
|
||||||
|
#ifndef STRICT_OPENSTEP
|
||||||
|
- (BOOL) resume;
|
||||||
|
- (BOOL) suspend;
|
||||||
|
#endif
|
||||||
- (void) terminate;
|
- (void) terminate;
|
||||||
- (void) waitUntilExit;
|
- (void) waitUntilExit;
|
||||||
|
|
||||||
|
|
|
@ -934,12 +934,13 @@ typedef enum {
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) removePortForName: (NSString*)name
|
- (BOOL) removePortForName: (NSString*)name
|
||||||
{
|
{
|
||||||
NSRunLoop *loop = [NSRunLoop currentRunLoop];
|
NSRunLoop *loop = [NSRunLoop currentRunLoop];
|
||||||
GSPortCom *com = nil;
|
GSPortCom *com = nil;
|
||||||
unsigned len;
|
unsigned len;
|
||||||
NSDate *limit = [NSDate dateWithTimeIntervalSinceNow: timeout];
|
NSDate *limit = [NSDate dateWithTimeIntervalSinceNow: timeout];
|
||||||
|
BOOL val = NO;
|
||||||
|
|
||||||
if (name == nil)
|
if (name == nil)
|
||||||
{
|
{
|
||||||
|
@ -990,6 +991,7 @@ typedef enum {
|
||||||
if (result == 0)
|
if (result == 0)
|
||||||
{
|
{
|
||||||
NSLog(@"NSPortNameServer unable to unregister '%@'", name);
|
NSLog(@"NSPortNameServer unable to unregister '%@'", name);
|
||||||
|
val = NO;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1015,6 +1017,7 @@ typedef enum {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
val = YES;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tmp = com;
|
tmp = com;
|
||||||
|
@ -1032,6 +1035,7 @@ typedef enum {
|
||||||
}
|
}
|
||||||
NS_ENDHANDLER
|
NS_ENDHANDLER
|
||||||
[serverLock unlock];
|
[serverLock unlock];
|
||||||
|
return val;
|
||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
@ -1070,8 +1074,9 @@ typedef enum {
|
||||||
* Remove all names for a particular port - used when a port is
|
* Remove all names for a particular port - used when a port is
|
||||||
* invalidated.
|
* invalidated.
|
||||||
*/
|
*/
|
||||||
- (void) removePort: (NSPort*)port
|
- (BOOL) removePort: (NSPort*)port
|
||||||
{
|
{
|
||||||
|
BOOL ok = YES;
|
||||||
[serverLock lock];
|
[serverLock lock];
|
||||||
NS_DURING
|
NS_DURING
|
||||||
{
|
{
|
||||||
|
@ -1080,7 +1085,10 @@ typedef enum {
|
||||||
|
|
||||||
while ((name = [known anyObject]) != nil)
|
while ((name = [known anyObject]) != nil)
|
||||||
{
|
{
|
||||||
[self removePortForName: name];
|
if ([self removePortForName: name] == NO)
|
||||||
|
{
|
||||||
|
ok = NO;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
NS_HANDLER
|
NS_HANDLER
|
||||||
|
@ -1090,13 +1098,16 @@ typedef enum {
|
||||||
}
|
}
|
||||||
NS_ENDHANDLER
|
NS_ENDHANDLER
|
||||||
[serverLock unlock];
|
[serverLock unlock];
|
||||||
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Remove name for port iff it is registered.
|
* Remove name for port iff it is registered.
|
||||||
*/
|
*/
|
||||||
- (void) removePort: (NSPort*)port forName: (NSString*)name
|
- (BOOL) removePort: (NSPort*)port forName: (NSString*)name
|
||||||
{
|
{
|
||||||
|
BOOL ok = YES;
|
||||||
|
|
||||||
[serverLock lock];
|
[serverLock lock];
|
||||||
NS_DURING
|
NS_DURING
|
||||||
{
|
{
|
||||||
|
@ -1104,7 +1115,10 @@ typedef enum {
|
||||||
|
|
||||||
if ([known member: name] != nil)
|
if ([known member: name] != nil)
|
||||||
{
|
{
|
||||||
[self removePortForName: name];
|
if ([self removePortForName: name] == NO)
|
||||||
|
{
|
||||||
|
ok = NO;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
NS_HANDLER
|
NS_HANDLER
|
||||||
|
@ -1114,6 +1128,7 @@ typedef enum {
|
||||||
}
|
}
|
||||||
NS_ENDHANDLER
|
NS_ENDHANDLER
|
||||||
[serverLock unlock];
|
[serverLock unlock];
|
||||||
|
return ok;
|
||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
|
@ -578,6 +578,18 @@ int main(int argc, char *argv[], char *env[])
|
||||||
return _gnu_hostName;
|
return _gnu_hostName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (int) processIdentifier
|
||||||
|
{
|
||||||
|
int pid;
|
||||||
|
|
||||||
|
#if defined(__MINGW__)
|
||||||
|
pid = (int)GetCurrentProcessId();
|
||||||
|
#else
|
||||||
|
pid = (int)getpid();
|
||||||
|
#endif
|
||||||
|
return pid;
|
||||||
|
}
|
||||||
|
|
||||||
- (NSString *) processName
|
- (NSString *) processName
|
||||||
{
|
{
|
||||||
return _gnu_processName;
|
return _gnu_processName;
|
||||||
|
|
|
@ -439,6 +439,11 @@ pty_slave(const char* name)
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (int) processIdentifier
|
||||||
|
{
|
||||||
|
return _taskId;
|
||||||
|
}
|
||||||
|
|
||||||
- (int) terminationStatus
|
- (int) terminationStatus
|
||||||
{
|
{
|
||||||
if (_hasLaunched == NO)
|
if (_hasLaunched == NO)
|
||||||
|
@ -487,6 +492,40 @@ pty_slave(const char* name)
|
||||||
[self subclassResponsibility: _cmd];
|
[self subclassResponsibility: _cmd];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (BOOL) resume
|
||||||
|
{
|
||||||
|
if (_hasLaunched == NO)
|
||||||
|
{
|
||||||
|
[NSException raise: NSInvalidArgumentException
|
||||||
|
format: @"NSTask - task has not yet launched"];
|
||||||
|
}
|
||||||
|
#ifndef __MINGW__
|
||||||
|
#ifdef HAVE_KILLPG
|
||||||
|
killpg(_taskId, SIGCONT);
|
||||||
|
#else
|
||||||
|
kill(-_taskId, SIGCONT);
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL) suspend
|
||||||
|
{
|
||||||
|
if (_hasLaunched == NO)
|
||||||
|
{
|
||||||
|
[NSException raise: NSInvalidArgumentException
|
||||||
|
format: @"NSTask - task has not yet launched"];
|
||||||
|
}
|
||||||
|
#ifndef __MINGW__
|
||||||
|
#ifdef HAVE_KILLPG
|
||||||
|
killpg(_taskId, SIGTERM);
|
||||||
|
#else
|
||||||
|
kill(-_taskId, SIGTERM);
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
|
||||||
- (void) terminate
|
- (void) terminate
|
||||||
{
|
{
|
||||||
if (_hasLaunched == NO)
|
if (_hasLaunched == NO)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue