Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
c54ed66c
Commit
c54ed66c
authored
Apr 07, 2011
by
Mikio Hara
Committed by
Rob Pike
Apr 07, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
syscall: fix build
R=golang-dev, r CC=golang-dev
https://golang.org/cl/4368050
parent
2aceea63
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
60 additions
and
29 deletions
+60
-29
syscall_bsd.go
src/pkg/syscall/syscall_bsd.go
+0
-29
syscall_darwin.go
src/pkg/syscall/syscall_darwin.go
+30
-0
syscall_freebsd.go
src/pkg/syscall/syscall_freebsd.go
+30
-0
No files found.
src/pkg/syscall/syscall_bsd.go
View file @
c54ed66c
...
@@ -74,35 +74,6 @@ func ReadDirent(fd int, buf []byte) (n int, errno int) {
...
@@ -74,35 +74,6 @@ func ReadDirent(fd int, buf []byte) (n int, errno int) {
return
Getdirentries
(
fd
,
buf
,
new
(
uintptr
))
return
Getdirentries
(
fd
,
buf
,
new
(
uintptr
))
}
}
// ParseDirent parses up to max directory entries in buf,
// appending the names to names. It returns the number
// bytes consumed from buf, the number of entries added
// to names, and the new names slice.
func
ParseDirent
(
buf
[]
byte
,
max
int
,
names
[]
string
)
(
consumed
int
,
count
int
,
newnames
[]
string
)
{
origlen
:=
len
(
buf
)
for
max
!=
0
&&
len
(
buf
)
>
0
{
dirent
:=
(
*
Dirent
)(
unsafe
.
Pointer
(
&
buf
[
0
]))
if
dirent
.
Reclen
==
0
{
buf
=
nil
break
}
buf
=
buf
[
dirent
.
Reclen
:
]
if
dirent
.
Ino
==
0
{
// File absent in directory.
continue
}
bytes
:=
(
*
[
10000
]
byte
)(
unsafe
.
Pointer
(
&
dirent
.
Name
[
0
]))
var
name
=
string
(
bytes
[
0
:
dirent
.
Namlen
])
if
name
==
"."
||
name
==
".."
{
// Useless names
continue
}
max
--
count
++
names
=
append
(
names
,
name
)
}
return
origlen
-
len
(
buf
),
count
,
names
}
// Wait status is 7 bits at bottom, either 0 (exited),
// Wait status is 7 bits at bottom, either 0 (exited),
// 0x7F (stopped), or a signal number that caused an exit.
// 0x7F (stopped), or a signal number that caused an exit.
// The 0x80 bit is whether there was a core dump.
// The 0x80 bit is whether there was a core dump.
...
...
src/pkg/syscall/syscall_darwin.go
View file @
c54ed66c
...
@@ -12,6 +12,8 @@
...
@@ -12,6 +12,8 @@
package
syscall
package
syscall
import
"unsafe"
const
OS
=
"darwin"
const
OS
=
"darwin"
type
SockaddrDatalink
struct
{
type
SockaddrDatalink
struct
{
...
@@ -26,6 +28,34 @@ type SockaddrDatalink struct {
...
@@ -26,6 +28,34 @@ type SockaddrDatalink struct {
raw
RawSockaddrDatalink
raw
RawSockaddrDatalink
}
}
// ParseDirent parses up to max directory entries in buf,
// appending the names to names. It returns the number
// bytes consumed from buf, the number of entries added
// to names, and the new names slice.
func
ParseDirent
(
buf
[]
byte
,
max
int
,
names
[]
string
)
(
consumed
int
,
count
int
,
newnames
[]
string
)
{
origlen
:=
len
(
buf
)
for
max
!=
0
&&
len
(
buf
)
>
0
{
dirent
:=
(
*
Dirent
)(
unsafe
.
Pointer
(
&
buf
[
0
]))
if
dirent
.
Reclen
==
0
{
buf
=
nil
break
}
buf
=
buf
[
dirent
.
Reclen
:
]
if
dirent
.
Ino
==
0
{
// File absent in directory.
continue
}
bytes
:=
(
*
[
10000
]
byte
)(
unsafe
.
Pointer
(
&
dirent
.
Name
[
0
]))
var
name
=
string
(
bytes
[
0
:
dirent
.
Namlen
])
if
name
==
"."
||
name
==
".."
{
// Useless names
continue
}
max
--
count
++
names
=
append
(
names
,
name
)
}
return
origlen
-
len
(
buf
),
count
,
names
}
/*
/*
* Wrapped
* Wrapped
*/
*/
...
...
src/pkg/syscall/syscall_freebsd.go
View file @
c54ed66c
...
@@ -12,6 +12,8 @@
...
@@ -12,6 +12,8 @@
package
syscall
package
syscall
import
"unsafe"
const
OS
=
"freebsd"
const
OS
=
"freebsd"
type
SockaddrDatalink
struct
{
type
SockaddrDatalink
struct
{
...
@@ -26,6 +28,34 @@ type SockaddrDatalink struct {
...
@@ -26,6 +28,34 @@ type SockaddrDatalink struct {
raw
RawSockaddrDatalink
raw
RawSockaddrDatalink
}
}
// ParseDirent parses up to max directory entries in buf,
// appending the names to names. It returns the number
// bytes consumed from buf, the number of entries added
// to names, and the new names slice.
func
ParseDirent
(
buf
[]
byte
,
max
int
,
names
[]
string
)
(
consumed
int
,
count
int
,
newnames
[]
string
)
{
origlen
:=
len
(
buf
)
for
max
!=
0
&&
len
(
buf
)
>
0
{
dirent
:=
(
*
Dirent
)(
unsafe
.
Pointer
(
&
buf
[
0
]))
if
dirent
.
Reclen
==
0
{
buf
=
nil
break
}
buf
=
buf
[
dirent
.
Reclen
:
]
if
dirent
.
Fileno
==
0
{
// File absent in directory.
continue
}
bytes
:=
(
*
[
10000
]
byte
)(
unsafe
.
Pointer
(
&
dirent
.
Name
[
0
]))
var
name
=
string
(
bytes
[
0
:
dirent
.
Namlen
])
if
name
==
"."
||
name
==
".."
{
// Useless names
continue
}
max
--
count
++
names
=
append
(
names
,
name
)
}
return
origlen
-
len
(
buf
),
count
,
names
}
/*
/*
* Exposed directly
* Exposed directly
*/
*/
...
...
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