Commit cbdaa10f authored by Rob Pike's avatar Rob Pike

add linkage for writefile on darwin

SVN=127208
parent c870ac23
...@@ -41,3 +41,5 @@ struct stat { // really a stat64 ...@@ -41,3 +41,5 @@ struct stat { // really a stat64
uint32 st_gen; uint32 st_gen;
int64 st_qspare[2]; int64 st_qspare[2];
}; };
#define O_CREAT 0x0200
...@@ -38,3 +38,5 @@ struct stat { ...@@ -38,3 +38,5 @@ struct stat {
struct timespec st_mtime; /* time of last modification */ struct timespec st_mtime; /* time of last modification */
struct timespec st_ctime; /* time of last status change */ struct timespec st_ctime; /* time of last status change */
}; };
#define O_CREAT 0100
...@@ -12,17 +12,10 @@ TEXT sys·exit(SB),1,$0-8 ...@@ -12,17 +12,10 @@ TEXT sys·exit(SB),1,$0-8
SYSCALL SYSCALL
RET 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 TEXT open(SB),1,$0-16
MOVQ 8(SP), DI MOVQ 8(SP), DI
MOVL 16(SP), SI MOVL 16(SP), SI
MOVL 20(SP), DX
MOVL $2, AX // syscall entry MOVL $2, AX // syscall entry
SYSCALL SYSCALL
RET RET
...@@ -48,6 +41,22 @@ TEXT read(SB),1,$0-24 ...@@ -48,6 +41,22 @@ TEXT read(SB),1,$0-24
SYSCALL SYSCALL
RET 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 TEXT sys·rt_sigaction(SB),1,$0-32
MOVL 8(SP), DI MOVL 8(SP), DI
MOVQ 16(SP), SI MOVQ 16(SP), SI
......
...@@ -59,7 +59,7 @@ sys·writefile(string filein, string textin, bool okout) ...@@ -59,7 +59,7 @@ sys·writefile(string filein, string textin, bool okout)
mcpy(namebuf, filein->str, filein->len); mcpy(namebuf, filein->str, filein->len);
namebuf[filein->len] = '\0'; 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) if(fd < 0)
goto out; goto out;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment