diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/lib9/mkfile | 1 | ||||
-rw-r--r-- | src/lib9/write.c | 23 |
2 files changed, 24 insertions, 0 deletions
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; +} |