1502 Remove conversion cruft from manpages
[unleashed.git] / usr / src / man / man3xnet / sendmsg.3xnet
blob0f4fc5be86cb3b4421c7d80ebbc8f7673efdf1e5
1 '\" te
2 .\" Copyright (c) 1992, X/Open Company Limited.  All Rights Reserved.  Portions Copyright (c) 2003, Sun Microsystems, Inc.  All Rights Reserved.
3 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at
4 .\" http://www.opengroup.org/bookstore/.
5 .\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between these versions and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html.
6 .\"  This notice shall appear on any product containing this material.
7 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
8 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
9 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
10 .TH SENDMSG 3XNET "Nov 1, 2003"
11 .SH NAME
12 sendmsg \- send a message on a socket using a message structure
13 .SH SYNOPSIS
14 .LP
15 .nf
16 \fBcc\fR [ \fIflag\fR ... ] \fIfile\fR ... \fB-lxnet\fR [ \fIlibrary\fR ... ]
17 #include <sys/socket.h>
19 \fBssize_t\fR \fBsendmsg\fR(\fBint\fR \fIsocket\fR, \fBconst struct msghdr *\fR\fImessage\fR, \fBint\fR \fIflags\fR);
20 .fi
22 .SH PARAMETERS
23 .sp
24 .LP
25 The function takes the following arguments:
26 .sp
27 .ne 2
28 .na
29 \fB\fIsocket\fR\fR
30 .ad
31 .RS 11n
32 Specifies the socket file descriptor.
33 .RE
35 .sp
36 .ne 2
37 .na
38 \fB\fImessage\fR\fR
39 .ad
40 .RS 11n
41 Points to a \fBmsghdr\fR structure, containing both the destination address and
42 the buffers for the outgoing message. The length and format of the address
43 depend on the address family of the socket.  The \fBmsg_flags\fR member is
44 ignored.
45 .RE
47 .sp
48 .ne 2
49 .na
50 \fB\fIflags\fR\fR
51 .ad
52 .RS 11n
53 Specifies the type of message transmission. The application may specify 0 or
54 the following flag:
55 .sp
56 .ne 2
57 .na
58 \fBMSG_EOR\fR
59 .ad
60 .RS 11n
61 Terminates a record (if supported by the protocol)
62 .RE
64 .sp
65 .ne 2
66 .na
67 \fBMSG_OOB\fR
68 .ad
69 .RS 11n
70 Sends out-of-band data on sockets that support out-of-bound data. The
71 significance and semantics of out-of-band data are protocol-specific.
72 .RE
74 .RE
76 .SH DESCRIPTION
77 .sp
78 .LP
79 The \fBsendmsg()\fR function sends a message through a connection-mode or
80 connectionless-mode socket.  If the socket is connectionless-mode, the message
81 will be sent to the address specified by \fImsghdr\fR.  If the socket is
82 connection-mode, the destination address in \fImsghdr\fR is ignored.
83 .sp
84 .LP
85 The  \fImsg_iov\fR and  \fImsg_iovlen\fR fields of message specify zero or more
86 buffers containing the data to be sent. \fImsg_iov\fR points to an array of
87 \fBiovec\fR structures;  \fImsg_iovlen\fR must be set to the dimension of this
88 array. In each  \fBiovec\fR structure, the  \fIiov_base\fR field specifies  a
89 storage area and the  \fIiov_len\fR field gives its size  in bytes. Some of
90 these sizes can be zero. The data from each storage area indicated by
91 \fImsg_iov\fR is sent in turn.
92 .sp
93 .LP
94 Successful completion of a call to \fBsendmsg()\fR does not guarantee delivery
95 of the message. A return value of \(mi1 indicates only locally-detected errors.
96 .sp
97 .LP
98 If space is not available at the sending socket to hold the message to be
99 transmitted and the socket file descriptor does not have \fBO_NONBLOCK\fR set,
100 \fBsendmsg()\fR function blocks until space is available.  If space is not
101 available at the sending socket to hold the message to be transmitted and the
102 socket file descriptor does have \fBO_NONBLOCK\fR set, \fBsendmsg()\fR function
103 will fail.
106 If the socket protocol supports broadcast and the specified address is a
107 broadcast address for the socket protocol, \fBsendmsg()\fR will fail if the
108 \fBSO_BROADCAST\fR option is not set for the socket.
111 The socket in use may require the process to have appropriate privileges to use
112 the \fBsendmsg()\fR function.
113 .SH USAGE
116 The \fBselect\fR(3C) and \fBpoll\fR(2) functions can be used to determine when
117 it is possible to send more data.
118 .SH RETURN VALUES
121 Upon successful completion, \fBsendmsg()\fR function returns the number of
122 bytes sent.  Otherwise, \(mi1 is returned and \fBerrno\fR is set to indicate
123 the error.
124 .SH ERRORS
127 The \fBsendmsg()\fR function will fail if:
129 .ne 2
131 \fB\fBEAGAIN\fR \fR
135 \fB\fBEWOULDBLOCK\fR\fR
137 .RS 16n
138 The socket's file descriptor is marked O_NONBLOCK and the requested operation
139 would block.
143 .ne 2
145 \fB\fBEAFNOSUPPORT\fR\fR
147 .RS 16n
148 Addresses in the specified address family cannot be used with this socket.
152 .ne 2
154 \fB\fBEBADF\fR\fR
156 .RS 16n
157 The \fIsocket\fR argument is not a valid file descriptor.
161 .ne 2
163 \fB\fBECONNRESET\fR\fR
165 .RS 16n
166 A connection was forcibly closed by a peer.
170 .ne 2
172 \fB\fBEFAULT\fR\fR
174 .RS 16n
175 The  \fImessage\fR parameter, or storage pointed to by the  \fImsg_name\fR,
176 \fImsg_control\fR or  \fImsg_iov\fR fields of the  \fImessage\fR parameter, or
177 storage pointed to by the \fBiovec\fR structures pointed to by the
178 \fImsg_iov\fR field can not be accessed.
182 .ne 2
184 \fB\fBEINTR\fR\fR
186 .RS 16n
187 A signal interrupted \fBsendmsg()\fR before any data was transmitted.
191 .ne 2
193 \fB\fBEINVAL\fR\fR
195 .RS 16n
196 The sum of the \fBiov_len\fR values overflows an \fBssize_t\fR.
200 .ne 2
202 \fB\fBEMSGSIZE\fR\fR
204 .RS 16n
205 The message is to large to be sent all at once (as the socket requires), or the
206 \fBmsg_iovlen\fR member of the \fBmsghdr\fR structure pointed to by
207 \fImessage\fR is less than or equal to 0 or is greater than \fBIOV_MAX\fR.
211 .ne 2
213 \fB\fBENOTCONN\fR\fR
215 .RS 16n
216 The socket is connection-mode but is not connected.
220 .ne 2
222 \fB\fBENOTSOCK\fR\fR
224 .RS 16n
225 The \fIsocket\fR argument does not refer a socket.
229 .ne 2
231 \fB\fBEOPNOTSUPP\fR\fR
233 .RS 16n
234 The \fIsocket\fR argument is associated with a socket that does not support one
235 or more of the values set in \fIflags\fR.
239 .ne 2
241 \fB\fBEPIPE\fR\fR
243 .RS 16n
244 The socket is shut down for writing, or the socket is connection-mode and is no
245 longer connected. In the latter case, and if the socket is of type SOCK_STREAM,
246 the \fBSIGPIPE\fR signal is generated to the calling thread.
251 If the address family of the socket is \fBAF_UNIX\fR, then \fBsendmsg()\fR will
252 fail if:
254 .ne 2
256 \fB\fBEIO\fR\fR
258 .RS 16n
259 An I/O error occurred while reading from or writing to the file system.
263 .ne 2
265 \fB\fBELOOP\fR\fR
267 .RS 16n
268 Too many symbolic links were encountered in translating the pathname in the
269 socket address.
273 .ne 2
275 \fB\fBENAMETOOLONG\fR\fR
277 .RS 16n
278 A component of a pathname exceeded \fINAME_MAX\fR characters, or an entire
279 pathname exceeded \fIPATH_MAX\fR characters.
283 .ne 2
285 \fB\fBENOENT\fR\fR
287 .RS 16n
288 A component of the pathname does not name an existing file or the pathname is
289 an empty string.
293 .ne 2
295 \fB\fBENOTDIR\fR\fR
297 .RS 16n
298 A component of the path prefix of the pathname in the socket address is not a
299 directory.
304 The \fBsendmsg()\fR function may fail if:
306 .ne 2
308 \fB\fBEACCES\fR\fR
310 .RS 16n
311 Search permission is denied for a component of the path prefix; or write access
312 to the named socket is denied.
316 .ne 2
318 \fB\fBEDESTADDRREQ\fR\fR
320 .RS 16n
321 The socket is not connection-mode and does not have its peer address set, and
322 no destination address was specified.
326 .ne 2
328 \fB\fBEHOSTUNREACH\fR\fR
330 .RS 16n
331 The destination host cannot be reached (probably because the host is down or a
332 remote router cannot reach it).
336 .ne 2
338 \fB\fBEIO\fR\fR
340 .RS 16n
341 An I/O error occurred while reading from or writing to the file system.
345 .ne 2
347 \fB\fBEISCONN\fR\fR
349 .RS 16n
350 A destination address was specified and the socket is already connected.
354 .ne 2
356 \fB\fBENETDOWN\fR\fR
358 .RS 16n
359 The local interface used to reach the destination is down.
363 .ne 2
365 \fB\fBENETUNREACH\fR\fR
367 .RS 16n
368 No route to the network is present.
372 .ne 2
374 \fB\fBENOBUFS\fR\fR
376 .RS 16n
377 Insufficient resources were available in the system to perform the operation.
381 .ne 2
383 \fB\fBENOMEM\fR\fR
385 .RS 16n
386 Insufficient memory was available to fulfill the request.
390 .ne 2
392 \fB\fBENOSR\fR\fR
394 .RS 16n
395 There were insufficient STREAMS resources available for the operation to
396 complete.
401 If the address family of the socket is \fBAF_UNIX\fR, then \fBsendmsg()\fR may
402 fail if:
404 .ne 2
406 \fB\fBENAMETOOLONG\fR\fR
408 .RS 16n
409 Pathname resolution of a symbolic link produced an intermediate result whose
410 length exceeds \fIPATH_MAX\fR.
413 .SH ATTRIBUTES
416 See \fBattributes\fR(5) for descriptions of the following attributes:
421 box;
422 c | c
423 l | l .
424 ATTRIBUTE TYPE  ATTRIBUTE VALUE
426 Interface Stability     Standard
428 MT-Level        MT-Safe
431 .SH SEE ALSO
434 \fBpoll\fR(2) \fBgetsockopt\fR(3XNET), \fBrecv\fR(3XNET),
435 \fBrecvfrom\fR(3XNET), \fBrecvmsg\fR(3XNET), \fBselect\fR(3C),
436 \fBsend\fR(3XNET), \fBsendto\fR(3XNET), \fBsetsockopt\fR(3XNET),
437 \fBshutdown\fR(3XNET), \fBsocket\fR(3XNET), \fBattributes\fR(5),
438 \fBstandards\fR(5)