should compile on netbsd
This commit is contained in:
parent
f332ac1d37
commit
de538deb7a
3 changed files with 8 additions and 8 deletions
|
|
@ -1586,7 +1586,7 @@ proc getAppFilename*(): string {.rtl, extern: "nos$1", tags: [FReadIO].} =
|
||||||
# little heuristic that may work on other POSIX-like systems:
|
# little heuristic that may work on other POSIX-like systems:
|
||||||
result = string(getEnv("_"))
|
result = string(getEnv("_"))
|
||||||
if len(result) == 0:
|
if len(result) == 0:
|
||||||
result = string(ParamStr(0))
|
result = string(paramStr(0))
|
||||||
# POSIX guaranties that this contains the executable
|
# POSIX guaranties that this contains the executable
|
||||||
# as it has been executed by the calling process
|
# as it has been executed by the calling process
|
||||||
if len(result) > 0 and result[0] != DirSep: # not an absolute path?
|
if len(result) > 0 and result[0] != DirSep: # not an absolute path?
|
||||||
|
|
|
||||||
|
|
@ -660,8 +660,8 @@ elif not defined(useNimRtl):
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
||||||
Pid = fork()
|
pid = fork()
|
||||||
if Pid < 0: osError(osLastError())
|
if pid < 0: osError(osLastError())
|
||||||
if pid == 0:
|
if pid == 0:
|
||||||
## child process:
|
## child process:
|
||||||
|
|
||||||
|
|
@ -685,14 +685,14 @@ elif not defined(useNimRtl):
|
||||||
if env == nil:
|
if env == nil:
|
||||||
discard execv(command, a)
|
discard execv(command, a)
|
||||||
else:
|
else:
|
||||||
discard execve(command, a, ToCStringArray(env))
|
discard execve(command, a, toCStringArray(env))
|
||||||
else:
|
else:
|
||||||
var x = addCmdArgs(command, args)
|
var x = addCmdArgs(command, args)
|
||||||
var a = toCStringArray(["sh", "-c"], [x])
|
var a = toCStringArray(["sh", "-c"], [x])
|
||||||
if env == nil:
|
if env == nil:
|
||||||
discard execv("/bin/sh", a)
|
discard execv("/bin/sh", a)
|
||||||
else:
|
else:
|
||||||
discard execve("/bin/sh", a, ToCStringArray(env))
|
discard execve("/bin/sh", a, toCStringArray(env))
|
||||||
# too risky to raise an exception here:
|
# too risky to raise an exception here:
|
||||||
quit("execve call failed: " & $strerror(errno))
|
quit("execve call failed: " & $strerror(errno))
|
||||||
# Parent process. Copy process information.
|
# Parent process. Copy process information.
|
||||||
|
|
|
||||||
|
|
@ -192,7 +192,7 @@ when defined(Posix):
|
||||||
of AF_UNIX: result = posix.AF_UNIX
|
of AF_UNIX: result = posix.AF_UNIX
|
||||||
of AF_INET: result = posix.AF_INET
|
of AF_INET: result = posix.AF_INET
|
||||||
of AF_INET6: result = posix.AF_INET6
|
of AF_INET6: result = posix.AF_INET6
|
||||||
else: nil
|
else: discard
|
||||||
|
|
||||||
proc toInt(typ: TType): cint =
|
proc toInt(typ: TType): cint =
|
||||||
case typ
|
case typ
|
||||||
|
|
@ -200,7 +200,7 @@ when defined(Posix):
|
||||||
of SOCK_DGRAM: result = posix.SOCK_DGRAM
|
of SOCK_DGRAM: result = posix.SOCK_DGRAM
|
||||||
of SOCK_SEQPACKET: result = posix.SOCK_SEQPACKET
|
of SOCK_SEQPACKET: result = posix.SOCK_SEQPACKET
|
||||||
of SOCK_RAW: result = posix.SOCK_RAW
|
of SOCK_RAW: result = posix.SOCK_RAW
|
||||||
else: nil
|
else: discard
|
||||||
|
|
||||||
proc toInt(p: TProtocol): cint =
|
proc toInt(p: TProtocol): cint =
|
||||||
case p
|
case p
|
||||||
|
|
@ -210,7 +210,7 @@ when defined(Posix):
|
||||||
of IPPROTO_IPV6: result = posix.IPPROTO_IPV6
|
of IPPROTO_IPV6: result = posix.IPPROTO_IPV6
|
||||||
of IPPROTO_RAW: result = posix.IPPROTO_RAW
|
of IPPROTO_RAW: result = posix.IPPROTO_RAW
|
||||||
of IPPROTO_ICMP: result = posix.IPPROTO_ICMP
|
of IPPROTO_ICMP: result = posix.IPPROTO_ICMP
|
||||||
else: nil
|
else: discard
|
||||||
|
|
||||||
else:
|
else:
|
||||||
proc toInt(domain: TDomain): cint =
|
proc toInt(domain: TDomain): cint =
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue