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
e06d1540
Commit
e06d1540
authored
Jul 29, 2008
by
Rob Pike
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixes for linux system call linkage
R=gri OCL=13547 CL=13547
parent
ebcd76d5
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
3 deletions
+14
-3
src/syscall/file_amd64_linux.go
src/syscall/file_amd64_linux.go
+9
-3
src/syscall/syscall_amd64_linux.s
src/syscall/syscall_amd64_linux.s
+5
-0
No files found.
src/syscall/file_amd64_linux.go
View file @
e06d1540
...
...
@@ -11,6 +11,7 @@ export stat, fstat, lstat
export
open
,
close
,
read
,
write
,
pipe
func
StatToInt
(
s
*
Stat
)
int64
;
func
Addr32ToInt
(
s
*
int32
)
int64
;
// Stat and relatives for Linux
...
...
@@ -45,6 +46,9 @@ type Stat struct {
st_atime
Timespec
;
/* time of last access */
st_mtime
Timespec
;
/* time of last modification */
st_ctime
Timespec
;
/* time of last status change */
st_unused4
int64
;
st_unused5
int64
;
st_unused6
int64
;
}
func
open
(
name
*
byte
,
mode
int64
)
(
ret
int64
,
errno
int64
)
{
...
...
@@ -60,6 +64,7 @@ func close(fd int64) (ret int64, errno int64) {
}
func
read
(
fd
int64
,
buf
*
byte
,
nbytes
int64
)
(
ret
int64
,
errno
int64
)
{
print
"READ: "
,
fd
,
" "
,
nbytes
,
"
\n
"
;
const
SYSREAD
=
0
;
r1
,
r2
,
err
:=
syscall
.
Syscall
(
SYSREAD
,
fd
,
AddrToInt
(
buf
),
nbytes
);
return
r1
,
err
;
...
...
@@ -73,12 +78,13 @@ func write(fd int64, buf *byte, nbytes int64) (ret int64, errno int64) {
func
pipe
(
fds
*
[
2
]
int64
)
(
ret
int64
,
errno
int64
)
{
const
SYSPIPE
=
22
;
r1
,
r2
,
err
:=
syscall
.
Syscall
(
SYSPIPE
,
0
,
0
,
0
);
var
t
[
2
]
int32
;
r1
,
r2
,
err
:=
syscall
.
Syscall
(
SYSPIPE
,
Addr32ToInt
(
&
t
[
0
]),
0
,
0
);
if
r1
<
0
{
return
r1
,
err
;
}
fds
[
0
]
=
r1
;
fds
[
1
]
=
r2
;
fds
[
0
]
=
int64
(
t
[
0
])
;
fds
[
1
]
=
int64
(
t
[
1
])
;
return
0
,
err
;
}
...
...
src/syscall/syscall_amd64_linux.s
View file @
e06d1540
...
...
@@ -32,6 +32,11 @@ TEXT syscall·AddrToInt(SB),1,$-8
MOVQ
AX
,
16
(
SP
)
RET
TEXT
syscall
·
Addr32ToInt
(
SB
),1,$-8
MOVQ
8
(
SP
),
AX
MOVQ
AX
,
16
(
SP
)
RET
TEXT
syscall
·
StatToInt
(
SB
),1,$-8
MOVQ
8
(
SP
),
AX
MOVQ
AX
,
16
(
SP
)
...
...
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