diff options
author | Rob Pike <r@golang.org> | 2008-07-15 08:27:50 -0700 |
---|---|---|
committer | Rob Pike <r@golang.org> | 2008-07-15 08:27:50 -0700 |
commit | d5b4e2ebae60dd1af1ac5fdf692445bf7b7afc9e (patch) | |
tree | 357747af72681205c2b524c6a9165fd521e5696c | |
parent | 92f52c5c6c4695d483706641cecc87f9618e87e4 (diff) | |
download | golang-d5b4e2ebae60dd1af1ac5fdf692445bf7b7afc9e.tar.gz |
add linkage for writefile on darwin
SVN=127208
-rw-r--r-- | src/runtime/amd64_darwin.h | 2 | ||||
-rw-r--r-- | src/runtime/amd64_linux.h | 2 | ||||
-rw-r--r-- | src/runtime/sys_amd64_linux.s | 25 | ||||
-rw-r--r-- | src/runtime/sys_file.c | 2 |
4 files changed, 22 insertions, 9 deletions
diff --git a/src/runtime/amd64_darwin.h b/src/runtime/amd64_darwin.h index 4bb906bd2..18d1b605f 100644 --- a/src/runtime/amd64_darwin.h +++ b/src/runtime/amd64_darwin.h @@ -41,3 +41,5 @@ struct stat { // really a stat64 uint32 st_gen; int64 st_qspare[2]; }; + +#define O_CREAT 0x0200 diff --git a/src/runtime/amd64_linux.h b/src/runtime/amd64_linux.h index 743289d9c..9412954b4 100644 --- a/src/runtime/amd64_linux.h +++ b/src/runtime/amd64_linux.h @@ -38,3 +38,5 @@ struct stat { struct timespec st_mtime; /* time of last modification */ struct timespec st_ctime; /* time of last status change */ }; + +#define O_CREAT 0100 diff --git a/src/runtime/sys_amd64_linux.s b/src/runtime/sys_amd64_linux.s index 37247a739..e98ca5245 100644 --- a/src/runtime/sys_amd64_linux.s +++ b/src/runtime/sys_amd64_linux.s @@ -12,17 +12,10 @@ TEXT sys·exit(SB),1,$0-8 SYSCALL RET -TEXT sys·write(SB),1,$0-24 - MOVL 8(SP), DI - MOVQ 16(SP), SI - MOVL 24(SP), DX - MOVL $1, AX // syscall entry - SYSCALL - RET - TEXT open(SB),1,$0-16 MOVQ 8(SP), DI MOVL 16(SP), SI + MOVL 20(SP), DX MOVL $2, AX // syscall entry SYSCALL RET @@ -48,6 +41,22 @@ TEXT read(SB),1,$0-24 SYSCALL RET +TEXT write(SB),1,$0-24 + MOVL 8(SP), DI + MOVQ 16(SP), SI + MOVL 24(SP), DX + MOVL $1, AX // syscall entry + SYSCALL + RET + +TEXT sys·write(SB),1,$0-24 + MOVL 8(SP), DI + MOVQ 16(SP), SI + MOVL 24(SP), DX + MOVL $1, AX // syscall entry + SYSCALL + RET + TEXT sys·rt_sigaction(SB),1,$0-32 MOVL 8(SP), DI MOVQ 16(SP), SI diff --git a/src/runtime/sys_file.c b/src/runtime/sys_file.c index 70c7fb652..1fc1e55e6 100644 --- a/src/runtime/sys_file.c +++ b/src/runtime/sys_file.c @@ -59,7 +59,7 @@ sys·writefile(string filein, string textin, bool okout) mcpy(namebuf, filein->str, filein->len); namebuf[filein->len] = '\0'; - fd = open(namebuf, 1|0x0200, 0644); // open for write, create if non-existant (sic) + fd = open(namebuf, 1|O_CREAT, 0644); // open for write, create if non-existant (sic) if(fd < 0) goto out; |