Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
bedee318
Commit
bedee318
authored
Jul 05, 2011
by
Fazlul Shahriar
Committed by
Alex Brainman
Jul 05, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
os: fix build for Plan 9
R=golang-dev, alex.brainman CC=golang-dev
https://golang.org/cl/4657074
parent
cc9fed7c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
4 deletions
+28
-4
src/pkg/os/file_plan9.go
src/pkg/os/file_plan9.go
+26
-0
src/pkg/os/file_unix.go
src/pkg/os/file_unix.go
+2
-4
No files found.
src/pkg/os/file_plan9.go
View file @
bedee318
...
...
@@ -9,6 +9,32 @@ import (
"syscall"
)
// File represents an open file descriptor.
type
File
struct
{
fd
int
name
string
dirinfo
*
dirInfo
// nil unless directory being read
nepipe
int
// number of consecutive EPIPE in Write
}
// Fd returns the integer Unix file descriptor referencing the open file.
func
(
file
*
File
)
Fd
()
int
{
if
file
==
nil
{
return
-
1
}
return
file
.
fd
}
// NewFile returns a new File with the given file descriptor and name.
func
NewFile
(
fd
int
,
name
string
)
*
File
{
if
fd
<
0
{
return
nil
}
f
:=
&
File
{
fd
:
fd
,
name
:
name
}
runtime
.
SetFinalizer
(
f
,
(
*
File
)
.
Close
)
return
f
}
// Auxiliary information if the File describes a directory
type
dirInfo
struct
{
buf
[
syscall
.
STATMAX
]
byte
// buffer for directory I/O
...
...
src/pkg/os/file_unix.go
View file @
bedee318
...
...
@@ -6,7 +6,6 @@ package os
import
(
"runtime"
"sync"
"syscall"
)
...
...
@@ -14,9 +13,8 @@ import (
type
File
struct
{
fd
int
name
string
dirinfo
*
dirInfo
// nil unless directory being read
nepipe
int
// number of consecutive EPIPE in Write
l
sync
.
Mutex
// used to implement windows pread/pwrite
dirinfo
*
dirInfo
// nil unless directory being read
nepipe
int
// number of consecutive EPIPE in Write
}
// Fd returns the integer Unix file descriptor referencing the open file.
...
...
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