diff options
-rw-r--r-- | include/libc.h | 2 | ||||
-rw-r--r-- | src/lib9/mkfile | 1 | ||||
-rw-r--r-- | src/lib9/write.c | 23 |
3 files changed, 26 insertions, 0 deletions
diff --git a/include/libc.h b/include/libc.h index 7611dde1..aa23d306 100644 --- a/include/libc.h +++ b/include/libc.h @@ -793,6 +793,7 @@ extern int p9waitpid(void); extern long write(int, void*, long); extern long writev(int, IOchunk*, int); */ +extern long p9write(int, void*, long); /* extern int wstat(char*, uchar*, int); give up */ extern ulong rendezvous(ulong, ulong); @@ -813,6 +814,7 @@ extern ulong rendezvous(ulong, ulong); #define open p9open #define pipe p9pipe #define waitfor p9waitfor +#define write p9write #endif extern Dir* dirstat(char*); diff --git a/src/lib9/mkfile b/src/lib9/mkfile index ca615435..782dd274 100644 --- a/src/lib9/mkfile +++ b/src/lib9/mkfile @@ -157,6 +157,7 @@ LIB9OFILES=\ unsharp.$O\ wait.$O\ waitpid.$O\ + write.$O\ OFILES=\ $LIB9OFILES\ diff --git a/src/lib9/write.c b/src/lib9/write.c new file mode 100644 index 00000000..aa32db7f --- /dev/null +++ b/src/lib9/write.c @@ -0,0 +1,23 @@ +#include <u.h> +#define NOPLAN9DEFINES +#include <libc.h> + +long +p9write(int f, void *av, long n) +{ + char *a; + long m, t; + + a = av; + t = 0; + while(t < n){ + m = write(f, a+t, n-t); + if(m <= 0){ + if(t == 0) + return m; + break; + } + t += m; + } + return t; +} |