Sync with cat.c from netbsd-8
[minix3.git] / minix / servers / vfs / write.c
blobeeb04b60d57cdf15e34bb0c572fd562a86aa8b60
1 /* This file is the counterpart of "read.c". It contains the code for writing
2 * insofar as this is not contained in read_write().
4 * The entry points into this file are
5 * do_write: call read_write to perform the WRITE system call
6 */
8 #include "fs.h"
9 #include "file.h"
10 #include <minix/callnr.h>
12 /*===========================================================================*
13 * do_write *
14 *===========================================================================*/
15 int do_write(void)
17 /* Perform the write(fd, buffer, nbytes) system call. */
19 /* See the comment in do_read(). */
20 if (job_m_in.m_lc_vfs_readwrite.cum_io != 0)
21 return(EINVAL);
23 return(do_read_write_peek(WRITING, job_m_in.m_lc_vfs_readwrite.fd,
24 job_m_in.m_lc_vfs_readwrite.buf, job_m_in.m_lc_vfs_readwrite.len));