xref: /minix3/minix/servers/vfs/write.c (revision 232819dd499bd777897c6a4ee3a77009ce269db9)
1433d6423SLionel Sambuc /* This file is the counterpart of "read.c".  It contains the code for writing
2433d6423SLionel Sambuc  * insofar as this is not contained in read_write().
3433d6423SLionel Sambuc  *
4433d6423SLionel Sambuc  * The entry points into this file are
5433d6423SLionel Sambuc  *   do_write:     call read_write to perform the WRITE system call
6433d6423SLionel Sambuc  */
7433d6423SLionel Sambuc 
8433d6423SLionel Sambuc #include "fs.h"
9433d6423SLionel Sambuc #include "file.h"
10433d6423SLionel Sambuc #include <minix/callnr.h>
11433d6423SLionel Sambuc 
12433d6423SLionel Sambuc /*===========================================================================*
13433d6423SLionel Sambuc  *				do_write				     *
14433d6423SLionel Sambuc  *===========================================================================*/
do_write(void)15433d6423SLionel Sambuc int do_write(void)
16433d6423SLionel Sambuc {
17433d6423SLionel Sambuc /* Perform the write(fd, buffer, nbytes) system call. */
18*232819ddSDavid van Moolenbroek 
19*232819ddSDavid van Moolenbroek   /* See the comment in do_read(). */
20*232819ddSDavid van Moolenbroek   if (job_m_in.m_lc_vfs_readwrite.cum_io != 0)
21*232819ddSDavid van Moolenbroek 	return(EINVAL);
22*232819ddSDavid van Moolenbroek 
23433d6423SLionel Sambuc   return(do_read_write_peek(WRITING, job_m_in.m_lc_vfs_readwrite.fd,
24433d6423SLionel Sambuc 	job_m_in.m_lc_vfs_readwrite.buf, job_m_in.m_lc_vfs_readwrite.len));
25433d6423SLionel Sambuc }
26