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
61ba1601
Commit
61ba1601
authored
Apr 07, 2009
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Chdir
R=r DELTA=17 (17 added, 0 deleted, 0 changed) OCL=27146 CL=27153
parent
16b38b55
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
0 deletions
+17
-0
src/lib/os/file.go
src/lib/os/file.go
+6
-0
src/lib/syscall/file_darwin.go
src/lib/syscall/file_darwin.go
+6
-0
src/lib/syscall/file_linux.go
src/lib/syscall/file_linux.go
+5
-0
No files found.
src/lib/os/file.go
View file @
61ba1601
...
...
@@ -261,3 +261,9 @@ func (file *File) Readdir(count int) (dirs []Dir, err *os.Error) {
return
}
// Chdir changes the current working directory to the named directory.
func
Chdir
(
dir
string
)
*
os
.
Error
{
r
,
e
:=
syscall
.
Chdir
(
dir
);
return
ErrnoToError
(
e
);
}
src/lib/syscall/file_darwin.go
View file @
61ba1601
...
...
@@ -98,3 +98,9 @@ func Getdirentries(fd int64, buf *byte, nbytes int64, basep *int64) (ret int64,
r1
,
r2
,
err
:=
Syscall6
(
SYS_GETDIRENTRIES64
,
fd
,
int64
(
uintptr
(
unsafe
.
Pointer
(
buf
))),
nbytes
,
int64
(
uintptr
(
unsafe
.
Pointer
(
basep
))),
0
,
0
);
return
r1
,
err
;
}
func
Chdir
(
dir
string
)
(
ret
int64
,
errno
int64
)
{
namebuf
:=
StringBytePtr
(
dir
);
r1
,
r2
,
err
:=
Syscall
(
SYS_CHDIR
,
int64
(
uintptr
(
unsafe
.
Pointer
(
namebuf
))),
0
,
0
);
return
r1
,
err
;
}
src/lib/syscall/file_linux.go
View file @
61ba1601
...
...
@@ -100,3 +100,8 @@ func Getdents(fd int64, buf *Dirent, nbytes int64) (ret int64, errno int64) {
return
r1
,
err
;
}
func
Chdir
(
dir
string
)
(
ret
int64
,
errno
int64
)
{
namebuf
:=
StringBytePtr
(
dir
);
r1
,
r2
,
err
:=
Syscall
(
SYS_CHDIR
,
int64
(
uintptr
(
unsafe
.
Pointer
(
namebuf
))),
0
,
0
);
return
r1
,
err
;
}
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