source: trunk/minix/man/man2/write.2@ 20

Last change on this file since 20 was 9, checked in by Mattia Monga, 14 years ago

Minix 3.1.2a

File size: 2.4 KB
Line 
1.\" Copyright (c) 1980 Regents of the University of California.
2.\" All rights reserved. The Berkeley software License Agreement
3.\" specifies the terms and conditions for redistribution.
4.\"
5.\" @(#)write.2 6.5 (Berkeley) 5/14/86
6.\"
7.TH WRITE 2 "May 14, 1986"
8.UC 4
9.SH NAME
10write \- write output
11.SH SYNOPSIS
12.nf
13.ft B
14#include <sys/types.h>
15#include <unistd.h>
16
17ssize_t write(int \fId\fP, const void *\fIbuf\fP, size_t \fInbytes\fP)
18.fi
19.SH DESCRIPTION
20.B Write
21attempts to write
22.I nbytes
23of data to the object referenced by the descriptor
24.I d
25from the buffer pointed to by
26.IR buf .
27.PP
28On objects capable of seeking, the \fBwrite\fP starts at a position
29given by the pointer associated with
30.IR d ,
31see
32.BR lseek (2).
33Upon return from
34.BR write ,
35the pointer is incremented by the number of bytes actually written.
36.PP
37Objects that are not capable of seeking always write from the current
38position. The value of the pointer associated with such an object
39is undefined.
40.PP
41When using non-blocking I/O on objects such as TCP/IP channels that are
42subject to flow control,
43.B write
44may write fewer bytes than requested;
45the return value must be noted,
46and the remainder of the operation should be retried when possible.
47.SH "RETURN VALUE
48Upon successful completion the number of bytes actually written
49is returned. Otherwise a \-1 is returned and the global variable
50.B errno
51is set to indicate the error.
52.SH ERRORS
53.B Write
54will fail and the file pointer will remain unchanged if one or more
55of the following are true:
56.TP 15
57[EBADF]
58\fID\fP is not a valid descriptor open for writing.
59.TP 15
60[EPIPE]
61An attempt is made to write to a pipe that is not open
62for reading by any process.
63.TP 15
64[EPIPE]
65An attempt is made to write to a TCP channel
66that is not connected to a peer socket.
67.TP 15
68[EFBIG]
69An attempt was made to write a file that exceeds the process's
70file size limit or the maximum file size.
71.TP 15
72[EFAULT]
73Part of the data to be written to the file
74points outside the process's allocated address space.
75.TP 15
76[ENOSPC]
77There is no free space remaining on the file system
78containing the file.
79.ig
80.TP 15
81[EDQUOT]
82The user's quota of disk blocks on the file system
83containing the file has been exhausted.
84..
85.TP 15
86[EIO]
87An I/O error occurred while reading from or writing to the file system.
88.TP 15
89[EAGAIN]
90The file was marked for non-blocking I/O,
91and no data could be written immediately.
92.SH "SEE ALSO"
93.BR fcntl (2),
94.BR lseek (2),
95.BR open (2),
96.BR pipe (2),
97.BR read (2).
Note: See TracBrowser for help on using the repository browser.