add linkage for writefile on darwin

SVN=127208
This commit is contained in:
Rob Pike 2008-07-15 08:27:50 -07:00
parent c870ac239e
commit cbdaa10f8c
4 changed files with 22 additions and 9 deletions

View File

@ -41,3 +41,5 @@ struct stat { // really a stat64
uint32 st_gen;
int64 st_qspare[2];
};
#define O_CREAT 0x0200

View File

@ -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

View File

@ -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

View File

@ -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;