Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
riscv-gcc-1
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
riscv-gcc-1
Commits
2b120fe9
Commit
2b120fe9
authored
Feb 14, 2012
by
Ian Lance Taylor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
syscall: Change Dup2 to only return an error.
From-SVN: r184222
parent
4b386d4d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
18 deletions
+15
-18
libgo/go/syscall/exec_bsd.go
+5
-8
libgo/go/syscall/exec_linux.go
+6
-9
libgo/go/syscall/exec_unix.go
+3
-0
libgo/go/syscall/libcall_posix.go
+1
-1
No files found.
libgo/go/syscall/exec_bsd.go
View file @
2b120fe9
...
...
@@ -136,9 +136,8 @@ func forkAndExecInChild(argv0 *byte, argv, envv []*byte, chroot, dir *byte, attr
// so that pass 2 won't stomp on an fd it needs later.
nextfd
=
int
(
len
(
fd
))
if
pipe
<
nextfd
{
_
,
err2
:=
Dup2
(
pipe
,
nextfd
)
if
err2
!=
nil
{
err1
=
err2
.
(
Errno
)
err1
=
raw_dup2
(
pipe
,
nextfd
)
if
err1
!=
0
{
goto
childerror
}
raw_fcntl
(
nextfd
,
F_SETFD
,
FD_CLOEXEC
)
...
...
@@ -147,9 +146,8 @@ func forkAndExecInChild(argv0 *byte, argv, envv []*byte, chroot, dir *byte, attr
}
for
i
=
0
;
i
<
len
(
fd
);
i
++
{
if
fd
[
i
]
>=
0
&&
fd
[
i
]
<
int
(
i
)
{
_
,
err2
:=
Dup2
(
fd
[
i
],
nextfd
)
if
err2
!=
nil
{
err1
=
err2
.
(
Errno
)
err1
=
raw_dup2
(
fd
[
i
],
nextfd
)
if
err1
!=
0
{
goto
childerror
}
raw_fcntl
(
nextfd
,
F_SETFD
,
FD_CLOEXEC
)
...
...
@@ -178,9 +176,8 @@ func forkAndExecInChild(argv0 *byte, argv, envv []*byte, chroot, dir *byte, attr
}
// The new fd is created NOT close-on-exec,
// which is exactly what we want.
_
,
err2
:=
D
up2
(
fd
[
i
],
i
)
err1
=
raw_d
up2
(
fd
[
i
],
i
)
if
err1
!=
0
{
err1
=
err2
.
(
Errno
)
goto
childerror
}
}
...
...
libgo/go/syscall/exec_linux.go
View file @
2b120fe9
...
...
@@ -161,9 +161,8 @@ func forkAndExecInChild(argv0 *byte, argv, envv []*byte, chroot, dir *byte, attr
// so that pass 2 won't stomp on an fd it needs later.
nextfd
=
int
(
len
(
fd
))
if
pipe
<
nextfd
{
_
,
err2
:=
Dup2
(
pipe
,
nextfd
)
if
err2
!=
nil
{
err1
=
err2
.
(
Errno
)
err1
=
raw_dup2
(
pipe
,
nextfd
)
if
err1
!=
0
{
goto
childerror
}
raw_fcntl
(
nextfd
,
F_SETFD
,
FD_CLOEXEC
)
...
...
@@ -172,9 +171,8 @@ func forkAndExecInChild(argv0 *byte, argv, envv []*byte, chroot, dir *byte, attr
}
for
i
=
0
;
i
<
len
(
fd
);
i
++
{
if
fd
[
i
]
>=
0
&&
fd
[
i
]
<
int
(
i
)
{
_
,
err2
:=
Dup2
(
fd
[
i
],
nextfd
)
if
err2
!=
nil
{
err1
=
err2
.
(
Errno
)
err1
=
raw_dup2
(
fd
[
i
],
nextfd
)
if
err1
!=
0
{
goto
childerror
}
raw_fcntl
(
nextfd
,
F_SETFD
,
FD_CLOEXEC
)
...
...
@@ -203,9 +201,8 @@ func forkAndExecInChild(argv0 *byte, argv, envv []*byte, chroot, dir *byte, attr
}
// The new fd is created NOT close-on-exec,
// which is exactly what we want.
_
,
err2
:=
Dup2
(
fd
[
i
],
i
);
if
err2
!=
nil
{
err1
=
err2
.
(
Errno
)
err1
=
raw_dup2
(
fd
[
i
],
i
)
if
err1
!=
0
{
goto
childerror
}
}
...
...
libgo/go/syscall/exec_unix.go
View file @
2b120fe9
...
...
@@ -47,6 +47,9 @@ import (
//sysnb raw_exit(status int)
//_exit(status int)
//sysnb raw_dup2(oldfd int, newfd int) (err Errno)
//dup2(oldfd int, newfd int) int
// Note: not raw, returns error rather than Errno.
//sys read(fd int, p *byte, np int) (n int, err error)
//read(fd int, buf *byte, count Size_t) Ssize_t
...
...
libgo/go/syscall/libcall_posix.go
View file @
2b120fe9
...
...
@@ -178,7 +178,7 @@ func FDZero(set *FdSet) {
//sysnb Dup(oldfd int) (fd int, err error)
//dup(oldfd int) int
//sysnb Dup2(oldfd int, newfd int) (
fd int,
err error)
//sysnb Dup2(oldfd int, newfd int) (err error)
//dup2(oldfd int, newfd int) int
//sys Exit(code int)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment