--- a/Win32OperatingSystem.st Sat Oct 12 21:16:20 2013 +0200
+++ b/Win32OperatingSystem.st Mon Oct 14 18:58:44 2013 +0200
@@ -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
+ 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
- inheritHandles:true.
+ primExec:aCommandPath
+ commandLine:argString
+ fileDescriptors:fdArray
+ fork:doFork
+ newPgrp:newPgrp
+ inPath:dirPath
+ createFlags:nil
+ inheritHandles:true.
"/ 'created ' print. cmdLine print. ' -> ' print. rslt printCR.
^ rslt
@@ -3932,31 +3932,31 @@
shellAndArgs := self commandAndArgsForOSCommand:aCommandString.
(in := anExternalInStream) isNil ifTrue:[
- nullStream := Filename nullDevice readWriteStream.
- in := nullStream.
+ nullStream := Filename nullDevice readWriteStream.
+ in := nullStream.
].
(out := anExternalOutStream) isNil ifTrue:[
- nullStream isNil ifTrue:[nullStream := Filename nullDevice writeStream].
- out := nullStream.
+ nullStream isNil ifTrue:[nullStream := Filename nullDevice writeStream].
+ out := nullStream.
].
(err := anExternalErrStream) isNil ifTrue:[
- err := out
+ 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.
+ 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.
+ nullStream close.
].
^ rslt
@@ -3979,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.
@@ -16700,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 */
@@ -16714,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;
}
{
@@ -16741,107 +16741,109 @@
/*
* Use getaddrinfo()
*/
+# ifndef __VISUALC__
extern getaddrinfo();
+# endif
struct addrinfo hints;
struct addrinfo *info = NULL, *infop;
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:
@@ -16858,130 +16860,130 @@
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) {
- int err;
-
- do {
+ int err;
+
+ do {
# if 0 && defined(DO_WRAP_CALLS)
- /* This does not work - the structure is allocated in thread local storage */
- hp = STX_WSA_NOINT_CALL1("gethostbyname", gethostbyname, __hostName);
- if ((INT)hp < 0) hp = NULL;
+ /* This does not work - the structure is allocated in thread local storage */
+ 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, but allocates it in thread local storage
- */
- // __BEGIN_INTERRUPTABLE__
- hp = gethostbyname(__hostName);
- // __END_INTERRUPTABLE__
-#endif
- } while ((hp == NULL
- && (err = WSAGetLastError()) == EINTR
- || err == TRY_AGAIN));
- if (hp == 0) {
- switch (err) {
- 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(err);
- 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;
+ /* __BEGIN_INTERRUPTABLE__ is dangerous, because gethostbyname
+ * uses a static data area, but allocates it in thread local storage
+ */
+ // __BEGIN_INTERRUPTABLE__
+ hp = gethostbyname(__hostName);
+ // __END_INTERRUPTABLE__
+#endif
+ } while ((hp == NULL
+ && (err = WSAGetLastError()) == EINTR
+ || err == TRY_AGAIN));
+ if (hp == 0) {
+ switch (err) {
+ 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(err);
+ 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(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);
- }
+ 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:;
@@ -16993,61 +16995,61 @@
exitPrim:;
%}.
error notNil ifTrue:[
- |request|
- error isSymbol ifTrue:[
- self primitiveFailed:error.
- ].
- 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|
+ error isSymbol ifTrue:[
+ self primitiveFailed:error.
+ ].
+ 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:#AF_INET type:#stream protocol:nil flags:nil
+ domain:#AF_INET type:#stream protocol:nil flags:nil
self getAddressInfo:'localhost' serviceName:nil
- domain:#AF_INET type:#stream protocol:#tcp flags:nil
+ domain:#AF_INET type:#stream protocol:#tcp flags:nil
self getAddressInfo:'localhost' serviceName:10
- domain:#AF_INET type:#stream protocol:#tcp flags:nil
+ domain:#AF_INET type:#stream protocol:#tcp flags:nil
self getAddressInfo:'localhost' serviceName:'10'
- domain:#AF_INET type:#stream protocol:#tcp flags:nil
+ domain:#AF_INET type:#stream protocol:#tcp flags:nil
self getAddressInfo:'blurb.exept.de' serviceName:nil
- domain:#AF_INET type:nil protocol:nil flags:nil
+ domain:#AF_INET type:nil protocol:nil flags:nil
self getAddressInfo:'1.2.3.4' serviceName:'bla'
- domain:#AF_INET type:nil protocol:nil flags:nil
+ domain:#AF_INET type:nil protocol:nil flags:nil
self getAddressInfo:'localhost' serviceName:'echo'
- domain:#AF_INET type:nil protocol:nil flags:nil
+ domain:#AF_INET type:nil protocol:nil flags:nil
self getAddressInfo:nil serviceName:'echo'
- domain:#AF_INET type:nil protocol:nil flags:nil
+ domain:#AF_INET type:nil protocol:nil flags:nil
self getAddressInfo:nil serviceName:nil
- domain:#AF_INET type:nil protocol:nil flags:nil
+ domain:#AF_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
"
!
@@ -17078,20 +17080,20 @@
int nInstBytes, sockAddrSize;
if (wantHostName == true) {
- hp = host;
- hsz = sizeof(host);
+ hp = host;
+ hsz = sizeof(host);
}
if (wantServiceName == true) {
- sp = service;
- ssz = sizeof(service);
+ sp = service;
+ ssz = sizeof(service);
}
if (hp == 0 && sp == 0) {
- error = @symbol(badArgument);
- goto err;
+ error = @symbol(badArgument);
+ goto err;
}
if (!__isBytes(socketAddress)) {
- error = @symbol(badArgument1);
- goto err;
+ error = @symbol(badArgument1);
+ goto err;
}
nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(__qClass(socketAddress))->c_ninstvars));
@@ -17099,170 +17101,172 @@
sockAddrSize -= nInstBytes;
if (!__isSmallInteger(flags)) {
- error = @symbol(badArgument5);
- goto err;
+ error = @symbol(badArgument5);
+ goto err;
}
__flags = __intVal(flags);
#if defined(NI_NUMERICHOST)
if (useDatagram == true) {
- __flags |= NI_DGRAM;
+ __flags |= NI_DGRAM;
}
{
- extern getnameinfo();
- bp = (char *)(__byteArrayVal(socketAddress));
- bp += nInstBytes;
+# ifndef __VISUALC__
+ extern getnameinfo();
+#endif
+ bp = (char *)(__byteArrayVal(socketAddress));
+ bp += nInstBytes;
# ifdef DO_WRAP_CALLS
- do {
- __threadErrno = 0;
- // do not cast to INT - will loose sign bit then!
- ret = STX_WSA_NOINT_CALL7( "getnameinfo", getnameinfo, (struct sockaddr *)bp, sockAddrSize, hp, hsz, sp, ssz, __flags);
- } while ((ret < 0) && (__threadErrno == EINTR));
+ do {
+ __threadErrno = 0;
+ // do not cast to INT - will loose sign bit then!
+ ret = STX_WSA_NOINT_CALL7( "getnameinfo", getnameinfo, (struct sockaddr *)bp, sockAddrSize, hp, hsz, sp, ssz, __flags);
+ } while ((ret < 0) && (__threadErrno == EINTR));
# else
- __BEGIN_INTERRUPTABLE__
- ret = getnameinfo((struct sockaddr *)bp, sockAddrSize,
- hp, hsz, sp, ssz, __flags);
- __END_INTERRUPTABLE__
+ __BEGIN_INTERRUPTABLE__
+ ret = getnameinfo((struct sockaddr *)bp, sockAddrSize,
+ hp, hsz, sp, ssz, __flags);
+ __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;
}
# else /* ! NI_NUMERICHOST */
{
- /*
- * Do it using gethostbyaddr()
- */
- struct sockaddr_in *sa;
-
- if (sockAddrSize < sizeof(*sa)) {
- error = @symbol(badArgument1);
- goto err;
- }
- bp = (char *)(__byteArrayVal(socketAddress));
- bp += nInstBytes;
- sa = (struct sockaddr_in *)bp;
-
- if (sp) {
- struct servent *servp;
- char *__proto = 0;
-
- __proto = (useDatagram == true ? "udp" : "tcp");
-
- servp = getservbyport(sa->sin_port, __proto);
- if (servp) {
- sp = servp->s_name;
- }
- }
- if (hp) {
- struct hostent *hostp;
- int err;
-
- do {
- /* must refetch in loop */
- bp = (char *)(__byteArrayVal(socketAddress));
- bp += nInstBytes;
- sa = (struct sockaddr_in *)bp;
- /* __BEGIN_INTERRUPTABLE__ is dangerous, because gethostbyname uses a static data area
- */
- hostp = gethostbyaddr((char *)&sa->sin_addr, sockAddrSize, sa->sin_family);
- /* __END_INTERRUPTABLE__ */
- } while ((hostp == NULL)
- && ((err = WSAGetLastError()) == TRY_AGAIN
- || err == EINTR
- )
- );
- if (hostp == 0) {
- switch (err) {
- 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(err);
- goto err;
- }
- hp = hostp->h_name;
- }
+ /*
+ * Do it using gethostbyaddr()
+ */
+ struct sockaddr_in *sa;
+
+ if (sockAddrSize < sizeof(*sa)) {
+ error = @symbol(badArgument1);
+ goto err;
+ }
+ bp = (char *)(__byteArrayVal(socketAddress));
+ bp += nInstBytes;
+ sa = (struct sockaddr_in *)bp;
+
+ if (sp) {
+ struct servent *servp;
+ char *__proto = 0;
+
+ __proto = (useDatagram == true ? "udp" : "tcp");
+
+ servp = getservbyport(sa->sin_port, __proto);
+ if (servp) {
+ sp = servp->s_name;
+ }
+ }
+ if (hp) {
+ struct hostent *hostp;
+ int err;
+
+ do {
+ /* must refetch in loop */
+ bp = (char *)(__byteArrayVal(socketAddress));
+ bp += nInstBytes;
+ sa = (struct sockaddr_in *)bp;
+ /* __BEGIN_INTERRUPTABLE__ is dangerous, because gethostbyname uses a static data area
+ */
+ hostp = gethostbyaddr((char *)&sa->sin_addr, sockAddrSize, sa->sin_family);
+ /* __END_INTERRUPTABLE__ */
+ } while ((hostp == NULL)
+ && ((err = WSAGetLastError()) == TRY_AGAIN
+ || err == EINTR
+ )
+ );
+ if (hostp == 0) {
+ switch (err) {
+ 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(err);
+ goto err;
+ }
+ hp = hostp->h_name;
+ }
}
# endif /* ! NI_NUMERICHOST */
if (hp)
- hostName = __MKSTRING(hp);
+ hostName = __MKSTRING(hp);
if (sp)
- serviceName = __MKSTRING(sp);
+ serviceName = __MKSTRING(sp);
err:;
#else
error = @symbol(notImplemented);
#endif
%}.
error notNil ifTrue:[
- error isSymbol ifTrue:[
- self primitiveFailed:error.
- ].
- ^ (HostAddressLookupError new
- parameter:error;
- messageText:' - ', (errorString ? error printString);
- request:thisContext message) raiseRequest.
+ error isSymbol ifTrue:[
+ self primitiveFailed:error.
+ ].
+ ^ (HostAddressLookupError new
+ parameter:error;
+ messageText:' - ', (errorString ? error printString);
+ request:thisContext message) raiseRequest.
].
^ Array with:hostName with:serviceName
"
self getNameInfo:
- (self getAddressInfo:'localhost' serviceName:'echo'
- domain:#AF_INET type:#stream protocol:nil flags:nil) first socketAddress
- wantHostName:true wantServiceName:true datagram:false flags:0
+ (self getAddressInfo:'localhost' serviceName:'echo'
+ domain:#AF_INET type:#stream protocol:nil flags:nil) first socketAddress
+ wantHostName:true wantServiceName:true datagram:false flags:0
self getNameInfo:
- (self getAddressInfo:'exept.exept.de' serviceName:'echo'
- domain:#AF_INET type:#stream protocol:nil flags:nil) first socketAddress
- wantHostName:true wantServiceName:true datagram:false flags:0
+ (self getAddressInfo:'exept.exept.de' serviceName:'echo'
+ domain:#AF_INET type:#stream protocol:nil flags:nil) first socketAddress
+ wantHostName:true wantServiceName:true datagram:false flags:0
self getNameInfo:(IPSocketAddress hostAddress:#[1 2 3 4])
- wantHostName:true wantServiceName:true datagram:false flags:0
+ wantHostName:true wantServiceName:true datagram:false flags:0
"
! !
@@ -17331,15 +17335,15 @@
!Win32OperatingSystem class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.478 2013-08-09 14:30:12 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.479 2013-10-14 16:58:44 cg Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.478 2013-08-09 14:30:12 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.479 2013-10-14 16:58:44 cg Exp $'
!
version_SVN
- ^ '$Id: Win32OperatingSystem.st,v 1.478 2013-08-09 14:30:12 cg Exp $'
+ ^ '$Id: Win32OperatingSystem.st,v 1.479 2013-10-14 16:58:44 cg Exp $'
! !