--- a/Win32OperatingSystem.st Thu Aug 01 10:22:20 2013 +0100
+++ b/Win32OperatingSystem.st Thu Aug 08 11:09:31 2013 +0100
@@ -3360,48 +3360,48 @@
"Internal lowLevel entry for combined fork & exec for WIN32
If fork is false (chain a command):
- execute the OS command specified by the argument, aCommandPath, with
- arguments in argArray (no arguments, if nil).
- If successful, this method does not return and smalltalk is gone.
- If not successful, it does return.
- Normal use is with forkForCommand.
+ execute the OS command specified by the argument, aCommandPath, with
+ arguments in argArray (no arguments, if nil).
+ If successful, this method does not return and smalltalk is gone.
+ If not successful, it does return.
+ Normal use is with forkForCommand.
If fork is true (subprocess command execution):
- fork a child to do the above.
- The Win32ProcessHandle of the child process is returned; nil if the fork failed.
+ fork a child to do the above.
+ The Win32ProcessHandle of the child process is returned; nil if the fork failed.
fdArray contains the filedescriptors, to be used for the child (if fork is true).
- fdArray[1] = 15 -> use fd 15 as stdin.
- If an element of the array is set to nil, the corresponding filedescriptor
- will be closed for the child.
- fdArray[0] == StdIn for child
- fdArray[1] == StdOut for child
- fdArray[2] == StdErr for child
- on VMS, these must be channels as returned by createMailBox.
+ fdArray[1] = 15 -> use fd 15 as stdin.
+ If an element of the array is set to nil, the corresponding filedescriptor
+ will be closed for the child.
+ fdArray[0] == StdIn for child
+ fdArray[1] == StdOut for child
+ fdArray[2] == StdErr for child
NOTE that in WIN32 the fds are HANDLES.
If newPgrp is true, the subprocess will be established in a new process group.
- The processgroup will be equal to id.
- newPgrp is not used on WIN32 and VMS systems."
+ The processgroup will be equal to id.
+ newPgrp is not used on WIN32 and VMS systems."
|dirPath rslt|
aDirectory notNil ifTrue:[
- dirPath := aDirectory asFilename asAbsoluteFilename osNameForDirectory.
- (dirPath endsWith:':') ifTrue:[
- dirPath := dirPath , '\'.
- ].
+ dirPath := aDirectory asFilename asAbsoluteFilename osNameForDirectory.
+ (dirPath endsWith:':') ifTrue:[
+ dirPath := dirPath , '\'.
+ ].
].
rslt := self
- primExec:aCommandPath
- commandLine:argString
- fileDescriptors:fdArray
- fork:doFork
- newPgrp:newPgrp
- inPath:dirPath
- createFlags:nil.
+ primExec:aCommandPath
+ commandLine:argString
+ fileDescriptors:fdArray
+ fork:doFork
+ newPgrp:newPgrp
+ inPath:dirPath
+ createFlags:nil
+ inheritHandles:true.
"/ 'created ' print. cmdLine print. ' -> ' print. rslt printCR.
^ rslt
@@ -3410,91 +3410,6 @@
"Modified: / 15.5.1999 / 18:07:51 / cg"
!
-exec:commandString withArguments:argString
- inputFrom:anExternalInStream outputTo:anExternalOutStream
- errorTo:anExternalErrStream auxFrom:anAuxiliaryStream
- environment:anEvironmentDictionary inDirectory:dir
-
- "start executing the OS command as specified by the argument, aCommandString
- as a separate process; do not wait for the command to finish.
- The commandString is passed to a shell for execution - see the description of
- 'sh -c' in your UNIX manual ('cmd.com' in your MSDOS manual).
- The command gets stdIn, stdOut and stdErr assigned from the arguments;
- each may be nil.
-
- Return the Win32ProcessHandle if successful, nil otherwise.
-
- Use #monitorPid:action: for synchronization and exec status return,
- or #killProcess: to stop it."
-
- |nullStream in out err rslt auxFd|
-
- (in := anExternalInStream) isNil ifTrue:[
- nullStream := Filename nullDevice readWriteStream.
- in := nullStream.
- ].
- (out := anExternalOutStream) isNil ifTrue:[
- nullStream isNil ifTrue:[nullStream := Filename nullDevice writeStream].
- out := nullStream.
- ].
- (err := anExternalErrStream) isNil ifTrue:[
- err := out
- ].
- anAuxiliaryStream notNil ifTrue:[
- auxFd := anAuxiliaryStream fileDescriptor
- ].
-
- rslt := self
- exec:commandString
- withArguments:argString
- environment:anEvironmentDictionary
- fileDescriptors:(Array with:in fileDescriptor
- with:out fileDescriptor
- with:err fileDescriptor
- with:auxFd)
- fork:true
- newPgrp:true "/ false
- inDirectory:dir.
-
- nullStream notNil ifTrue:[
- nullStream close.
- ].
- ^ rslt
-
- "blocking at current prio (i.e. only higher prio threads execute):
-
- OperatingSystem executeCommand:'ls -l > out'.
- "
-
- "non-blocking (lower prio threads continue):
-
- |in out err pid sema|
-
- in := 'out' asFilename readStream.
- out := 'out2' asFilename writeStream.
- err := 'err' asFilename writeStream.
-
- sema := Semaphore new.
- pid := OperatingSystem startProcess:'sleep 10; grep drw' inputFrom:in outputTo:out errorTo:err.
-
- The following will no longer work. monitorPid has disappeared
-
- pid notNil ifTrue:[
- Processor monitorPid:pid action:[:OSstatus | sema signal ].
- ].
- in close.
- out close.
- err close.
- sema wait.
- Transcript showCR:'finished'
- "
-
- "Modified: / 21-03-1997 / 10:04:35 / dq"
- "Modified: / 15-07-1997 / 16:03:51 / stefan"
- "Created: / 12-11-1998 / 14:39:20 / cg"
- "Modified: / 11-02-2007 / 20:13:28 / cg"
-!
-
getStatusOfProcess:aProcessId
"wait for a process to terminate and fetch its exit status.
This is required to avoid zombie processes."
@@ -3606,16 +3521,6 @@
"Modified: / 20-01-2012 / 13:32:55 / cg"
!
-primExec:commandPath commandLine:commandLine fileDescriptors:fdArray fork:doFork newPgrp:newPgrp inPath:dirName createFlags:flagsOrNil
- ^ self
- primExec:commandPath commandLine:commandLine
- fileDescriptors:fdArray
- fork:doFork newPgrp:newPgrp
- inPath:dirName
- createFlags:flagsOrNil
- inheritHandles:true "false" "/ must be true
-!
-
primExec:commandPath commandLine:commandLine fileDescriptors:fdArray fork:doFork newPgrp:newPgrp inPath:dirName createFlags:flagsOrNil inheritHandles:inheritHandles
"Internal lowLevel entry for combined fork & exec for WIN32"
@@ -4021,17 +3926,39 @@
Use #monitorPid:action: for synchronization and exec status return,
or #killProcess: to stop it."
- |shellAndArgs|
+ |shellAndArgs nullStream in out err rslt|
aCommandString isNil ifTrue:[^ nil].
-
shellAndArgs := self commandAndArgsForOSCommand:aCommandString.
- ^ self
- exec:(shellAndArgs at:1) withArguments:(shellAndArgs at:2)
- inputFrom:anExternalInStream outputTo:anExternalOutStream
- errorTo:anExternalErrStream auxFrom:anAuxiliaryStream
- environment:anEvironmentDictionary inDirectory:dir
+ (in := anExternalInStream) isNil ifTrue:[
+ nullStream := Filename nullDevice readWriteStream.
+ in := nullStream.
+ ].
+ (out := anExternalOutStream) isNil ifTrue:[
+ nullStream isNil ifTrue:[nullStream := Filename nullDevice writeStream].
+ out := nullStream.
+ ].
+ (err := anExternalErrStream) isNil ifTrue:[
+ err := out
+ ].
+
+ rslt := self
+ exec:(shellAndArgs at:1)
+ withArguments:(shellAndArgs at:2)
+ environment:anEvironmentDictionary
+ fileDescriptors:(Array with:in fileHandle
+ with:out fileHandle
+ with:err fileHandle
+ with:(anAuxiliaryStream notNil ifTrue:[anAuxiliaryStream fileHandle] ifFalse:[nil]))
+ fork:true
+ newPgrp:true
+ inDirectory:dir.
+
+ nullStream notNil ifTrue:[
+ nullStream close.
+ ].
+ ^ rslt
"blocking at current prio (i.e. only higher prio threads execute):
@@ -4052,7 +3979,7 @@
The following will no longer work. monitorPid has disappeared
pid notNil ifTrue:[
- Processor monitorPid:pid action:[:OSstatus | sema signal ].
+ Processor monitorPid:pid action:[:OSstatus | sema signal ].
].
in close.
out close.
@@ -16773,10 +16700,10 @@
type := OperatingSystem socketTypeCodeOf:typeArg.
proto := self protocolCodeOf:protoArg.
serviceNameArg notNil ifTrue:[
- serviceName := serviceNameArg printString. "convert integer port numbers"
- serviceNameArg isInteger ifTrue:[
- port := serviceNameArg.
- ].
+ serviceName := serviceNameArg printString. "convert integer port numbers"
+ serviceNameArg isInteger ifTrue:[
+ port := serviceNameArg.
+ ].
]. "ifFalse:[serviceName := nil]"
%{ /* STACK:32000 */
@@ -16787,26 +16714,26 @@
int cnt = 0;
if (hostName == nil) {
- __hostName = 0;
+ __hostName = 0;
} else if (__isStringLike(hostName)) {
- strncpy(__hostNameCopy, __stringVal(hostName), sizeof(__hostNameCopy)-1);
- __hostName = __hostNameCopy;
+ strncpy(__hostNameCopy, __stringVal(hostName), sizeof(__hostNameCopy)-1);
+ __hostName = __hostNameCopy;
} else {
- error = @symbol(badArgument1);
- goto exitPrim;
+ error = @symbol(badArgument1);
+ goto exitPrim;
}
if (serviceName == nil) {
- __serviceName = 0;
+ __serviceName = 0;
} else if (__isStringLike(serviceName)) {
- strncpy(__serviceNameCopy, __stringVal(serviceName), sizeof(__serviceNameCopy)-1);
- __serviceName = __serviceNameCopy;
+ strncpy(__serviceNameCopy, __stringVal(serviceName), sizeof(__serviceNameCopy)-1);
+ __serviceName = __serviceNameCopy;
} else {
- error = @symbol(badArgument2);
- goto exitPrim;
+ error = @symbol(badArgument2);
+ goto exitPrim;
}
if (__hostName == 0 && __serviceName == 0) {
- error = @symbol(badArgument);
- goto exitPrim;
+ error = @symbol(badArgument);
+ goto exitPrim;
}
{
@@ -16820,101 +16747,101 @@
memset(&hints, 0, sizeof(hints));
if (__isSmallInteger(domain))
- hints.ai_family = __intVal(domain);
+ hints.ai_family = __intVal(domain);
if (__isSmallInteger(type))
- hints.ai_socktype = __intVal(type);
+ hints.ai_socktype = __intVal(type);
if (__isSmallInteger(proto))
- hints.ai_protocol = __intVal(proto);
+ hints.ai_protocol = __intVal(proto);
do {
# ifdef DO_WRAP_CALLS
- do {
- __threadErrno = 0;
- // do not cast to INT - will loose sign bit then!
- ret = STX_WSA_NOINT_CALL4( "getaddrinfo", getaddrinfo, __hostName, __serviceName, &hints, &info);
- } while ((ret < 0) && (__threadErrno == EINTR));
+ do {
+ __threadErrno = 0;
+ // do not cast to INT - will loose sign bit then!
+ ret = STX_WSA_NOINT_CALL4( "getaddrinfo", getaddrinfo, __hostName, __serviceName, &hints, &info);
+ } while ((ret < 0) && (__threadErrno == EINTR));
# else
- __BEGIN_INTERRUPTABLE__
- ret = getaddrinfo(__hostName, __serviceName, &hints, &info);
- __END_INTERRUPTABLE__
+ __BEGIN_INTERRUPTABLE__
+ ret = getaddrinfo(__hostName, __serviceName, &hints, &info);
+ __END_INTERRUPTABLE__
# endif
} while (ret != 0 && __threadErrno == EINTR);
if (ret != 0) {
- switch (ret) {
- case EAI_FAMILY:
- error = @symbol(badProtocol);
- break;
- case EAI_SOCKTYPE:
- error = @symbol(badSocketType);
- break;
- case EAI_BADFLAGS:
- error = @symbol(badFlags);
- break;
- case EAI_NONAME:
- error = @symbol(unknownHost);
- break;
- case EAI_SERVICE:
- error = @symbol(unknownService);
- break;
- case EAI_MEMORY:
- error = @symbol(allocationFailure);
- break;
- case EAI_FAIL:
- error = @symbol(permanentFailure);
- break;
- case EAI_AGAIN:
- error = @symbol(tryAgain);
- break;
- default:
- error = @symbol(unknownError);
- }
- errorString = __MKSTRING(gai_strerror(ret));
- goto err;
+ switch (ret) {
+ case EAI_FAMILY:
+ error = @symbol(badProtocol);
+ break;
+ case EAI_SOCKTYPE:
+ error = @symbol(badSocketType);
+ break;
+ case EAI_BADFLAGS:
+ error = @symbol(badFlags);
+ break;
+ case EAI_NONAME:
+ error = @symbol(unknownHost);
+ break;
+ case EAI_SERVICE:
+ error = @symbol(unknownService);
+ break;
+ case EAI_MEMORY:
+ error = @symbol(allocationFailure);
+ break;
+ case EAI_FAIL:
+ error = @symbol(permanentFailure);
+ break;
+ case EAI_AGAIN:
+ error = @symbol(tryAgain);
+ break;
+ default:
+ error = @symbol(unknownError);
+ }
+ errorString = __MKSTRING(gai_strerror(ret));
+ goto err;
}
for (cnt=0, infop=info; infop; infop=infop->ai_next)
- cnt++;
+ cnt++;
result = __ARRAY_NEW_INT(cnt);
if (result == nil) {
- error = @symbol(allocationFailure);
- goto err;
+ error = @symbol(allocationFailure);
+ goto err;
}
for (infop=info, cnt=0; infop; infop=infop->ai_next, cnt++) {
- OBJ o, resp;
-
- resp = __ARRAY_NEW_INT(6);
- if (resp == nil) {
- error = @symbol(allocationFailure);
- goto err;
- }
-
- __ArrayInstPtr(result)->a_element[cnt] = resp; __STORE(result, resp);
-
- __ArrayInstPtr(resp)->a_element[0] = __mkSmallInteger(infop->ai_flags);
- __ArrayInstPtr(resp)->a_element[1] = __mkSmallInteger(infop->ai_family);
- __ArrayInstPtr(resp)->a_element[2] = __mkSmallInteger(infop->ai_socktype);
- __ArrayInstPtr(resp)->a_element[3] = __mkSmallInteger(infop->ai_protocol);
-
- __PROTECT__(resp);
- o = __BYTEARRAY_NEW_INT(infop->ai_addrlen);
- __UNPROTECT__(resp);
- if (o == nil) {
- error = @symbol(allocationFailure);
- goto err;
- }
- memcpy(__byteArrayVal(o), infop->ai_addr, infop->ai_addrlen);
+ OBJ o, resp;
+
+ resp = __ARRAY_NEW_INT(6);
+ if (resp == nil) {
+ error = @symbol(allocationFailure);
+ goto err;
+ }
+
+ __ArrayInstPtr(result)->a_element[cnt] = resp; __STORE(result, resp);
+
+ __ArrayInstPtr(resp)->a_element[0] = __mkSmallInteger(infop->ai_flags);
+ __ArrayInstPtr(resp)->a_element[1] = __mkSmallInteger(infop->ai_family);
+ __ArrayInstPtr(resp)->a_element[2] = __mkSmallInteger(infop->ai_socktype);
+ __ArrayInstPtr(resp)->a_element[3] = __mkSmallInteger(infop->ai_protocol);
+
+ __PROTECT__(resp);
+ o = __BYTEARRAY_NEW_INT(infop->ai_addrlen);
+ __UNPROTECT__(resp);
+ if (o == nil) {
+ error = @symbol(allocationFailure);
+ goto err;
+ }
+ memcpy(__byteArrayVal(o), infop->ai_addr, infop->ai_addrlen);
__ArrayInstPtr(resp)->a_element[4] = o; __STORE(resp, o);
- if (infop->ai_canonname) {
- __PROTECT__(resp);
- o = __MKSTRING(infop->ai_canonname);
- __UNPROTECT__(resp);
- if (o == nil) {
- error = @symbol(allocationFailure);
- goto err;
- }
- __ArrayInstPtr(resp)->a_element[5] = o; __STORE(resp, o);
- }
+ if (infop->ai_canonname) {
+ __PROTECT__(resp);
+ o = __MKSTRING(infop->ai_canonname);
+ __UNPROTECT__(resp);
+ if (o == nil) {
+ error = @symbol(allocationFailure);
+ goto err;
+ }
+ __ArrayInstPtr(resp)->a_element[5] = o; __STORE(resp, o);
+ }
}
err:
@@ -16931,142 +16858,133 @@
int i;
if (__isSmallInteger(port)) {
- __port = htons(__smallIntegerVal(port));
+ __port = htons(__smallIntegerVal(port));
} else if (__serviceName) {
- struct servent *sp;
- char *__proto = 0;
-
- if (__isStringLike(protoArg))
- __proto = __stringVal(protoArg);
-
- sp = getservbyname(__serviceName, __proto);
- if (sp == NULL) {
- __port = atoi(__serviceName);
- if (__port <= 0) {
- errorString = @symbol(unknownService);
- error = __mkSmallInteger(-3);
- goto err;
- }
- __port = htons(__port);
- } else
- __port = sp->s_port;
+ struct servent *sp;
+ char *__proto = 0;
+
+ if (__isStringLike(protoArg))
+ __proto = __stringVal(protoArg);
+
+ sp = getservbyname(__serviceName, __proto);
+ if (sp == NULL) {
+ __port = atoi(__serviceName);
+ if (__port <= 0) {
+ errorString = @symbol(unknownService);
+ error = __mkSmallInteger(-3);
+ goto err;
+ }
+ __port = htons(__port);
+ } else
+ __port = sp->s_port;
}
if (__hostName) {
-# ifdef USE_H_ERRNO
- do {
+ do {
# ifdef DO_WRAP_CALLS
- hp = STX_WSA_NOINT_CALL1("gethostbyname", gethostbyname, __hostName);
- if ((INT)hp < 0) hp = NULL;
+ hp = STX_WSA_NOINT_CALL1("gethostbyname", gethostbyname, __hostName);
+ if ((INT)hp < 0) hp = NULL;
# else
- /* __BEGIN_INTERRUPTABLE__ is dangerous, because gethostbyname
- * uses a static data area
- */
- __BEGIN_INTERRUPTABLE__
- hp = gethostbyname(__hostName);
- __END_INTERRUPTABLE__
-#endif
- } while ((hp == NULL)
- && (
- (h_errno == TRY_AGAIN)
- || errno == EINTR
+ /* __BEGIN_INTERRUPTABLE__ is dangerous, because gethostbyname
+ * uses a static data area
+ */
+ __BEGIN_INTERRUPTABLE__
+ hp = gethostbyname(__hostName);
+ __END_INTERRUPTABLE__
+#endif
+ } while ((hp == NULL)
+ && (
+ (h_errno == TRY_AGAIN)
+ || errno == EINTR
# ifdef IRIX5_3
- || (errno == ECONNREFUSED)
+ || (errno == ECONNREFUSED)
# endif
- )
- );
- if (hp == 0) {
- switch (h_errno) {
- case HOST_NOT_FOUND:
- errorString = @symbol(unknownHost);
- break;
- case NO_ADDRESS:
- errorString = @symbol(noAddress);
- break;
- case NO_RECOVERY:
- errorString = @symbol(permanentFailure);
- break;
- case TRY_AGAIN:
- errorString = @symbol(tryAgain);
- break;
- default:
- errorString = @symbol(unknownError);
- break;
- }
- error = __mkSmallInteger(h_errno);
- goto err;
- }
-# else /* !USE_H_ERRNO */
- hp = gethostbyname(__hostName);
- if (hp == 0) {
- errorString = @symbol(unknownHost);
- error = __mkSmallInteger(-1);
- goto err;
- }
-# endif /* !USE_H_ERRNO*/
-
- if (__isSmallInteger(domain) && hp->h_addrtype != __smallIntegerVal(domain)) {
- errorString = @symbol(unknownHost);
- error = __mkSmallInteger(-2);
- goto err;
- }
-
- for (cnt = 0, addrpp = hp->h_addr_list; *addrpp; addrpp++)
- cnt++;
- addrpp = hp->h_addr_list;
+ )
+ );
+ if (hp == 0) {
+ switch (h_errno) {
+ case HOST_NOT_FOUND:
+ errorString = @symbol(unknownHost);
+ break;
+ case NO_ADDRESS:
+ errorString = @symbol(noAddress);
+ break;
+ case NO_RECOVERY:
+ errorString = @symbol(permanentFailure);
+ break;
+ case TRY_AGAIN:
+ errorString = @symbol(tryAgain);
+ break;
+ default:
+ errorString = @symbol(unknownError);
+ break;
+ }
+ error = __mkSmallInteger(h_errno);
+ goto err;
+ }
+
+ if (__isSmallInteger(domain) && hp->h_addrtype != __smallIntegerVal(domain)) {
+ errorString = @symbol(unknownHost);
+ error = __mkSmallInteger(-2);
+ goto err;
+ }
+
+ for (cnt = 0, addrpp = hp->h_addr_list; *addrpp; addrpp++)
+ cnt++;
+ addrpp = hp->h_addr_list;
} else {
- cnt = 1;
+ cnt = 1;
}
result = __ARRAY_NEW_INT(cnt);
if (result == nil) {
- error = @symbol(allocationFailure);
- goto err;
+ error = @symbol(allocationFailure);
+ goto err;
}
for (i = 0; i < cnt; i++) {
- OBJ o, resp;
- struct sockaddr_in *sa;
-
- resp = __ARRAY_NEW_INT(6);
- if (resp == nil) {
- error = @symbol(allocationFailure);
- goto err;
- }
-
- __ArrayInstPtr(result)->a_element[i] = resp; __STORE(result, resp);
- __ArrayInstPtr(resp)->a_element[0] = __mkSmallInteger(0);
- __ArrayInstPtr(resp)->a_element[2] = type; __STORE(result, type);
- __ArrayInstPtr(resp)->a_element[3] = proto; __STORE(result, proto);
- __PROTECT__(resp);
- o = __BYTEARRAY_NEW_INT(sizeof(*sa));
- __UNPROTECT__(resp);
- if (o == nil) {
- error = @symbol(allocationFailure);
- goto err;
- }
- __ArrayInstPtr(resp)->a_element[4] = o; __STORE(resp, o);
- sa = (struct sockaddr_in *)__byteArrayVal(o);
- sa->sin_port = __port;
-
- if (__hostName) {
- sa->sin_family = hp->h_addrtype;
- memcpy(&sa->sin_addr, *addrpp, hp->h_length);
- __ArrayInstPtr(resp)->a_element[1] = __mkSmallInteger(hp->h_addrtype);
- if (hp->h_name) {
- __PROTECT__(resp);
- o = __MKSTRING(hp->h_name);
- __UNPROTECT__(resp);
- if (o == nil) {
- error = @symbol(allocationFailure);
- goto err;
- }
- __ArrayInstPtr(resp)->a_element[5] = o; __STORE(resp, o);
- }
- addrpp++;
- } else{
- __ArrayInstPtr(resp)->a_element[1] = domain; __STORE(resp, domain);
- }
+ OBJ o, resp;
+ struct sockaddr_in *sa;
+
+ resp = __ARRAY_NEW_INT(6);
+ if (resp == nil) {
+ error = @symbol(allocationFailure);
+ goto err;
+ }
+
+ __ArrayInstPtr(result)->a_element[i] = resp; __STORE(result, resp);
+ __ArrayInstPtr(resp)->a_element[0] = __mkSmallInteger(0);
+ __ArrayInstPtr(resp)->a_element[2] = type; __STORE(resp, type);
+ __ArrayInstPtr(resp)->a_element[3] = proto; __STORE(resp, proto);
+ __PROTECT__(resp);
+ o = __BYTEARRAY_NEW_INT(sizeof(*sa));
+ __UNPROTECT__(resp);
+ if (o == nil) {
+ error = @symbol(allocationFailure);
+ goto err;
+ }
+ __ArrayInstPtr(resp)->a_element[4] = o; __STORE(resp, o);
+ sa = (struct sockaddr_in *)__byteArrayVal(o);
+ sa->sin_port = __port;
+
+ if (__hostName) {
+ sa->sin_family = hp->h_addrtype;
+ memcpy(&sa->sin_addr, *addrpp, hp->h_length);
+ __ArrayInstPtr(resp)->a_element[1] = __mkSmallInteger(hp->h_addrtype);
+ if (hp->h_name) {
+ __PROTECT__(resp);
+ o = __MKSTRING(hp->h_name);
+ __UNPROTECT__(resp);
+ if (o == nil) {
+ error = @symbol(allocationFailure);
+ goto err;
+ }
+ __ArrayInstPtr(resp)->a_element[5] = o; __STORE(resp, o);
+ }
+ addrpp++;
+ } else{
+ __ArrayInstPtr(resp)->a_element[1] = domain; __STORE(resp, domain);
+ }
}
err:;
@@ -17078,58 +16996,58 @@
exitPrim:;
%}.
error notNil ifTrue:[
- |request|
- request := SocketAddressInfo new
- domain:domainArg;
- type:typeArg;
- protocol:protoArg;
- canonicalName:hostName;
- serviceName:serviceName.
- ^ (HostNameLookupError new
- parameter:error;
- messageText:' - ', (errorString ? error printString);
- request:request) raiseRequest.
+ |request|
+ request := SocketAddressInfo new
+ domain:domainArg;
+ type:typeArg;
+ protocol:protoArg;
+ canonicalName:hostName;
+ serviceName:serviceName.
+ ^ (HostNameLookupError new
+ parameter:error;
+ messageText:' - ', (errorString ? error printString);
+ request:request) raiseRequest.
].
1 to:result size do:[:i |
- |entry dom info|
-
- info := SocketAddressInfo new.
- entry := result at:i.
- info flags:(entry at:1).
- info domain:(dom := OperatingSystem domainSymbolOf:(entry at:2)).
- info type:(OperatingSystem socketTypeSymbolOf:(entry at:3)).
- info protocol:(self protocolSymbolOf:(entry at:4)).
- info socketAddress:((SocketAddress newDomain:dom) fromBytes:(entry at:5)).
- info canonicalName:(entry at:6).
- result at:i put:info
+ |entry dom info|
+
+ info := SocketAddressInfo new.
+ entry := result at:i.
+ info flags:(entry at:1).
+ info domain:(dom := OperatingSystem domainSymbolOf:(entry at:2)).
+ info type:(OperatingSystem socketTypeSymbolOf:(entry at:3)).
+ info protocol:(self protocolSymbolOf:(entry at:4)).
+ info socketAddress:((SocketAddress newDomain:dom) fromBytes:(entry at:5)).
+ info canonicalName:(entry at:6).
+ result at:i put:info
].
^ result
"
self getAddressInfo:'localhost' serviceName:nil
- domain:nil type:nil protocol:nil flags:nil
+ domain:nil type:nil protocol:nil flags:nil
self getAddressInfo:'localhost' serviceName:nil
- domain:#inet type:#stream protocol:nil flags:nil
+ domain:#inet type:#stream protocol:nil flags:nil
self getAddressInfo:'localhost' serviceName:nil
- domain:#inet type:#stream protocol:#tcp flags:nil
+ domain:#inet type:#stream protocol:#tcp flags:nil
self getAddressInfo:'localhost' serviceName:10
- domain:#inet type:#stream protocol:#tcp flags:nil
+ domain:#inet type:#stream protocol:#tcp flags:nil
self getAddressInfo:'localhost' serviceName:'10'
- domain:#inet type:#stream protocol:#tcp flags:nil
+ domain:#inet type:#stream protocol:#tcp flags:nil
self getAddressInfo:'blurb.exept.de' serviceName:nil
- domain:#inet type:nil protocol:nil flags:nil
+ domain:#inet type:nil protocol:nil flags:nil
self getAddressInfo:'1.2.3.4' serviceName:'bla'
- domain:#inet type:nil protocol:nil flags:nil
+ domain:#inet type:nil protocol:nil flags:nil
self getAddressInfo:'localhost' serviceName:'echo'
- domain:#inet type:nil protocol:nil flags:nil
+ domain:#inet type:nil protocol:nil flags:nil
self getAddressInfo:nil serviceName:'echo'
- domain:#inet type:nil protocol:nil flags:nil
+ domain:#inet type:nil protocol:nil flags:nil
self getAddressInfo:nil serviceName:nil
- domain:#inet type:nil protocol:nil flags:nil
+ domain:#inet type:nil protocol:nil flags:nil
self getAddressInfo:'www.google.de' serviceName:nil
- domain:nil type:nil protocol:nil flags:nil
+ domain:nil type:nil protocol:nil flags:nil
self getAddressInfo:'smc1' serviceName:nil
- domain:nil type:nil protocol:nil flags:nil
+ domain:nil type:nil protocol:nil flags:nil
"
!
@@ -17420,15 +17338,15 @@
!Win32OperatingSystem class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.476 2013-07-30 16:34:20 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.477 2013-08-02 15:31:19 stefan Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.476 2013-07-30 16:34:20 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.477 2013-08-02 15:31:19 stefan Exp $'
!
version_SVN
- ^ '$Id: Win32OperatingSystem.st,v 1.476 2013-07-30 16:34:20 stefan Exp $'
+ ^ '$Id: Win32OperatingSystem.st,v 1.477 2013-08-02 15:31:19 stefan Exp $'
! !