Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Go
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Martin Stiemerling
Go
Commits
12befd06
Commit
12befd06
authored
14 years ago
by
Peter Mundy
Committed by
Russ Cox
14 years ago
Browse files
Options
Downloads
Patches
Plain Diff
os: Null device
R=rsc, cw CC=golang-dev
https://golang.org/cl/1854042
parent
311973ea
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/pkg/exec/exec.go
+1
-1
1 addition, 1 deletion
src/pkg/exec/exec.go
src/pkg/os/file_unix.go
+4
-0
4 additions, 0 deletions
src/pkg/os/file_unix.go
src/pkg/os/file_windows.go
+2
-0
2 additions, 0 deletions
src/pkg/os/file_windows.go
with
7 additions
and
1 deletion
src/pkg/exec/exec.go
+
1
−
1
View file @
12befd06
...
@@ -39,7 +39,7 @@ func modeToFiles(mode, fd int) (*os.File, *os.File, os.Error) {
...
@@ -39,7 +39,7 @@ func modeToFiles(mode, fd int) (*os.File, *os.File, os.Error) {
if
fd
==
0
{
if
fd
==
0
{
rw
=
os
.
O_RDONLY
rw
=
os
.
O_RDONLY
}
}
f
,
err
:=
os
.
Open
(
"/dev/n
ull
"
,
rw
,
0
)
f
,
err
:=
os
.
Open
(
os
.
DevN
ull
,
rw
,
0
)
return
f
,
nil
,
err
return
f
,
nil
,
err
case
PassThrough
:
case
PassThrough
:
switch
fd
{
switch
fd
{
...
...
This diff is collapsed.
Click to expand it.
src/pkg/os/file_unix.go
+
4
−
0
View file @
12befd06
...
@@ -18,6 +18,10 @@ type dirInfo struct {
...
@@ -18,6 +18,10 @@ type dirInfo struct {
bufp
int
// location of next record in buf.
bufp
int
// location of next record in buf.
}
}
// DevNull is the name of the operating system's ``null device.''
// On Unix-like systems, it is "/dev/null"; on Windows, "NUL".
const
DevNull
=
"/dev/null"
// Open opens the named file with specified flag (O_RDONLY etc.) and perm, (0666 etc.)
// Open opens the named file with specified flag (O_RDONLY etc.) and perm, (0666 etc.)
// if applicable. If successful, methods on the returned File can be used for I/O.
// if applicable. If successful, methods on the returned File can be used for I/O.
// It returns the File and an Error, if any.
// It returns the File and an Error, if any.
...
...
This diff is collapsed.
Click to expand it.
src/pkg/os/file_windows.go
+
2
−
0
View file @
12befd06
...
@@ -17,6 +17,8 @@ type dirInfo struct {
...
@@ -17,6 +17,8 @@ type dirInfo struct {
usefirststat
bool
usefirststat
bool
}
}
const
DevNull
=
"NUL"
func
(
file
*
File
)
isdir
()
bool
{
return
file
!=
nil
&&
file
.
dirinfo
!=
nil
}
func
(
file
*
File
)
isdir
()
bool
{
return
file
!=
nil
&&
file
.
dirinfo
!=
nil
}
func
openFile
(
name
string
,
flag
int
,
perm
int
)
(
file
*
File
,
err
Error
)
{
func
openFile
(
name
string
,
flag
int
,
perm
int
)
(
file
*
File
,
err
Error
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment