~ubuntu-branches/ubuntu/quantal/uclibc/quantal

« back to all changes in this revision

Viewing changes to include/sys/socket.h

  • Committer: Bazaar Package Importer
  • Author(s): Hector Oron
  • Date: 2011-06-11 03:06:20 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20110611030620-ywjfvyuqvrpsm282
Tags: 0.9.32-1
* New upstream release
* Add myself as maintainer
* Bump standards version 
* Add Vcs-Git, Vcs-Browser and Homepage fields
* Add watch file 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* Declarations of socket constants, types, and functions.
2
 
   Copyright (C) 1991,92,1994-2001,2003 Free Software Foundation, Inc.
 
2
   Copyright (C) 1991,92,1994-2001,2003,2005,2007,2008
 
3
   Free Software Foundation, Inc.
3
4
   This file is part of the GNU C Library.
4
5
 
5
6
   The GNU C Library is free software; you can redistribute it and/or
27
28
#include <sys/uio.h>
28
29
#define __need_size_t
29
30
#include <stddef.h>
 
31
#ifdef __USE_GNU
 
32
/* Get the __sigset_t definition.  */
 
33
# include <bits/sigset.h>
 
34
#endif
30
35
 
31
36
 
32
37
/* This operating system-specific header file defines the SOCK_*, PF_*,
98
103
   protocol PROTOCOL.  If PROTOCOL is zero, one is chosen automatically.
99
104
   Returns a file descriptor for the new socket, or -1 for errors.  */
100
105
extern int socket (int __domain, int __type, int __protocol) __THROW;
 
106
libc_hidden_proto(socket)
101
107
 
102
108
/* Create two new sockets, of type TYPE in domain DOMAIN and using
103
109
   protocol PROTOCOL, which are connected to each other, and put file
109
115
/* Give the socket FD the local address ADDR (which is LEN bytes long).  */
110
116
extern int bind (int __fd, __CONST_SOCKADDR_ARG __addr, socklen_t __len)
111
117
     __THROW;
 
118
libc_hidden_proto(bind)
112
119
 
113
120
/* Put the local address of FD into *ADDR and its length in *LEN.  */
114
121
extern int getsockname (int __fd, __SOCKADDR_ARG __addr,
115
122
                        socklen_t *__restrict __len) __THROW;
 
123
libc_hidden_proto(getsockname)
116
124
 
117
125
/* Open a connection on socket FD to peer at ADDR (which LEN bytes long).
118
126
   For connectionless socket types, just set the default address to send to
122
130
   This function is a cancellation point and therefore not marked with
123
131
   __THROW.  */
124
132
extern int connect (int __fd, __CONST_SOCKADDR_ARG __addr, socklen_t __len);
 
133
libc_hidden_proto(connect)
125
134
 
126
135
/* Put the address of the peer connected to socket FD into *ADDR
127
136
   (which is *LEN bytes long), and its actual length into *LEN.  */
134
143
   This function is a cancellation point and therefore not marked with
135
144
   __THROW.  */
136
145
extern ssize_t send (int __fd, __const void *__buf, size_t __n, int __flags);
 
146
libc_hidden_proto(send)
137
147
 
138
148
/* Read N bytes into BUF from socket FD.
139
149
   Returns the number read or -1 for errors.
141
151
   This function is a cancellation point and therefore not marked with
142
152
   __THROW.  */
143
153
extern ssize_t recv (int __fd, void *__buf, size_t __n, int __flags);
 
154
libc_hidden_proto(recv)
144
155
 
145
156
/* Send N bytes of BUF on socket FD to peer at address ADDR (which is
146
157
   ADDR_LEN bytes long).  Returns the number sent, or -1 for errors.
150
161
extern ssize_t sendto (int __fd, __const void *__buf, size_t __n,
151
162
                       int __flags, __CONST_SOCKADDR_ARG __addr,
152
163
                       socklen_t __addr_len);
 
164
libc_hidden_proto(sendto)
153
165
 
154
166
/* Read N bytes into BUF through socket FD.
155
167
   If ADDR is not NULL, fill in *ADDR_LEN bytes of it with tha address of
161
173
extern ssize_t recvfrom (int __fd, void *__restrict __buf, size_t __n,
162
174
                         int __flags, __SOCKADDR_ARG __addr,
163
175
                         socklen_t *__restrict __addr_len);
 
176
libc_hidden_proto(recvfrom)
164
177
 
165
178
 
166
179
/* Send a message described MESSAGE on socket FD.
170
183
   __THROW.  */
171
184
extern ssize_t sendmsg (int __fd, __const struct msghdr *__message,
172
185
                        int __flags);
 
186
libc_hidden_proto(sendmsg)
173
187
 
174
188
/* Receive a message as described by MESSAGE from socket FD.
175
189
   Returns the number of bytes read or -1 for errors.
177
191
   This function is a cancellation point and therefore not marked with
178
192
   __THROW.  */
179
193
extern ssize_t recvmsg (int __fd, struct msghdr *__message, int __flags);
 
194
libc_hidden_proto(recvmsg)
180
195
 
181
196
 
182
197
/* Put the current value for socket FD's option OPTNAME at protocol level LEVEL
191
206
   Returns 0 on success, -1 for errors.  */
192
207
extern int setsockopt (int __fd, int __level, int __optname,
193
208
                       __const void *__optval, socklen_t __optlen) __THROW;
 
209
libc_hidden_proto(setsockopt)
194
210
 
195
211
 
196
212
/* Prepare to accept connections on socket FD.
197
213
   N connection requests will be queued before further requests are refused.
198
214
   Returns 0 on success, -1 for errors.  */
199
215
extern int listen (int __fd, int __n) __THROW;
 
216
libc_hidden_proto(listen)
200
217
 
201
218
/* Await a connection on socket FD.
202
219
   When a connection arrives, open a new socket to communicate with it,
208
225
   __THROW.  */
209
226
extern int accept (int __fd, __SOCKADDR_ARG __addr,
210
227
                   socklen_t *__restrict __addr_len);
 
228
libc_hidden_proto(accept)
 
229
 
 
230
#if defined __UCLIBC_LINUX_SPECIFIC__ && defined __USE_GNU
 
231
/* Similar to 'accept' but takes an additional parameter to specify flags.
 
232
 
 
233
   This function is a cancellation point and therefore not marked with
 
234
   __THROW.  */
 
235
extern int accept4 (int __fd, __SOCKADDR_ARG __addr,
 
236
                    socklen_t *__restrict __addr_len, int __flags);
 
237
#endif
211
238
 
212
239
/* Shut down all or part of the connection open on socket FD.
213
240
   HOW determines what to shut down:
218
245
extern int shutdown (int __fd, int __how) __THROW;
219
246
 
220
247
 
221
 
#ifdef __USE_XOPEN2K
 
248
#if 0 /*def __USE_XOPEN2K*/
222
249
/* Determine wheter socket is at a out-of-band mark.  */
223
250
extern int sockatmark (int __fd) __THROW;
224
251
#endif