1
0
mirror of https://github.com/golang/go synced 2024-11-12 08:20:22 -07:00

Adding Mkdir.

R=rsc
APPROVED=rsc
DELTA=21  (21 added, 0 deleted, 0 changed)
OCL=16794
CL=16803
This commit is contained in:
Cary Hull 2008-10-09 00:15:37 -07:00
parent aed247fdb9
commit f960840a0e
3 changed files with 21 additions and 0 deletions

View File

@ -91,3 +91,8 @@ export func Pipe() (fd1 *FD, fd2 *FD, err *Error) {
}
return NewFD(p[0]), NewFD(p[1]), nil
}
export func Mkdir(name string, perm int) *Error {
r, e := syscall.mkdir(name, int64(perm));
return ErrnoToError(e)
}

View File

@ -86,3 +86,11 @@ export func fcntl(fd, cmd, arg int64) (ret int64, errno int64) {
return r1, err
}
export func mkdir(name string, perm int64) (ret int64, errno int64) {
var namebuf [NameBufsize]byte;
if !StringToBytes(&namebuf, name) {
return -1, ENAMETOOLONG
}
r1, r2, err := Syscall(SYS_MKDIR, BytePtr(&namebuf[0]), perm, 0);
return r1, err;
}

View File

@ -87,3 +87,11 @@ export func fcntl(fd, cmd, arg int64) (ret int64, errno int64) {
return r1, err
}
export func mkdir(name string, perm int64) (ret int64, errno int64) {
var namebuf [NameBufsize]byte;
if !StringToBytes(&namebuf, name) {
return -1, ENAMETOOLONG
}
r1, r2, err := Syscall(SYS_MKDIR, BytePtr(&namebuf[0]), perm, 0);
return r1, err;
}