mirror of
https://sourceware.org/git/glibc.git
synced 2025-08-01 10:06:57 +03:00
2.5-18.1
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
# Copyright (C) 1991,95,96,97,98,99,2000,2001 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1991,1995-2001,2005 Free Software Foundation, Inc.
|
||||
# This file is part of the GNU C Library.
|
||||
|
||||
# The GNU C Library is free software; you can redistribute it and/or
|
||||
@ -22,7 +22,7 @@
|
||||
subdir := socket
|
||||
|
||||
headers := sys/socket.h sys/un.h bits/sockaddr.h bits/socket.h \
|
||||
sys/socketvar.h net/if.h
|
||||
bits/socket2.h sys/socketvar.h net/if.h
|
||||
|
||||
routines := accept bind connect getpeername getsockname getsockopt \
|
||||
listen recv recvfrom recvmsg send sendmsg sendto \
|
||||
|
40
socket/accept.c
Normal file
40
socket/accept.c
Normal file
@ -0,0 +1,40 @@
|
||||
/* Copyright (C) 1991, 1995, 1996, 1997, 2002 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
#include <errno.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
/* Await a connection on socket FD.
|
||||
When a connection arrives, open a new socket to communicate with it,
|
||||
set *ADDR (which is *ADDR_LEN bytes long) to the address of the connecting
|
||||
peer and *ADDR_LEN to the address's actual length, and return the
|
||||
new socket's descriptor, or -1 for errors. */
|
||||
int
|
||||
accept (fd, addr, addr_len)
|
||||
int fd;
|
||||
__SOCKADDR_ARG addr;
|
||||
socklen_t *addr_len;
|
||||
{
|
||||
__set_errno (ENOSYS);
|
||||
return -1;
|
||||
}
|
||||
libc_hidden_def (accept)
|
||||
|
||||
|
||||
stub_warning (accept)
|
||||
#include <stub-tag.h>
|
36
socket/bind.c
Normal file
36
socket/bind.c
Normal file
@ -0,0 +1,36 @@
|
||||
/* Copyright (C) 1991, 1995, 1996, 1997, 2002 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
#include <errno.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
/* Give the socket FD the local address ADDR (which is LEN bytes long). */
|
||||
int
|
||||
__bind (fd, addr, len)
|
||||
int fd;
|
||||
__CONST_SOCKADDR_ARG addr;
|
||||
socklen_t len;
|
||||
{
|
||||
__set_errno (ENOSYS);
|
||||
return -1;
|
||||
}
|
||||
|
||||
weak_alias (__bind, bind)
|
||||
|
||||
stub_warning (bind)
|
||||
#include <stub-tag.h>
|
56
socket/bits/socket2.h
Normal file
56
socket/bits/socket2.h
Normal file
@ -0,0 +1,56 @@
|
||||
/* Checking macros for socket functions.
|
||||
Copyright (C) 2005 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
#ifndef _SYS_SOCKET_H
|
||||
# error "Never include <bits/socket2.h> directly; use <sys/socket.h> instead."
|
||||
#endif
|
||||
|
||||
extern ssize_t __recv_chk (int __fd, void *__buf, size_t __n, size_t __buflen,
|
||||
int __flags);
|
||||
extern ssize_t __REDIRECT (__recv_alias, (int __fd, void *__buf, size_t __n,
|
||||
int __flags), recv);
|
||||
|
||||
extern __always_inline ssize_t
|
||||
recv (int __fd, void *__buf, size_t __n, int __flags)
|
||||
{
|
||||
if (__bos0 (__buf) != (size_t) -1
|
||||
&& (!__builtin_constant_p (__n) || __n > __bos0 (__buf)))
|
||||
return __recv_chk (__fd, __buf, __n, __bos0 (__buf), __flags);
|
||||
return __recv_alias (__fd, __buf, __n, __flags);
|
||||
}
|
||||
|
||||
extern ssize_t __recvfrom_chk (int __fd, void *__restrict __buf, size_t __n,
|
||||
size_t __buflen, int __flags,
|
||||
__SOCKADDR_ARG __addr,
|
||||
socklen_t *__restrict __addr_len);
|
||||
extern ssize_t __REDIRECT (__recvfrom_alias,
|
||||
(int __fd, void *__restrict __buf, size_t __n,
|
||||
int __flags, __SOCKADDR_ARG __addr,
|
||||
socklen_t *__restrict __addr_len), recvfrom);
|
||||
|
||||
extern __always_inline ssize_t
|
||||
recvfrom (int __fd, void *__restrict __buf, size_t __n, int __flags,
|
||||
__SOCKADDR_ARG __addr, socklen_t *__restrict __addr_len)
|
||||
{
|
||||
if (__bos0 (__buf) != (size_t) -1
|
||||
&& (!__builtin_constant_p (__n) || __n > __bos0 (__buf)))
|
||||
return __recvfrom_chk (__fd, __buf, __n, __bos0 (__buf), __flags,
|
||||
__addr, __addr_len);
|
||||
return __recvfrom_alias (__fd, __buf, __n, __flags, __addr, __addr_len);
|
||||
}
|
38
socket/connect.c
Normal file
38
socket/connect.c
Normal file
@ -0,0 +1,38 @@
|
||||
/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
#include <errno.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
/* Open a connection on socket FD to peer at ADDR (which LEN bytes long).
|
||||
For connectionless socket types, just set the default address to send to
|
||||
and the only address from which to accept transmissions.
|
||||
Return 0 on success, -1 for errors. */
|
||||
int
|
||||
__connect (fd, addr, len)
|
||||
int fd;
|
||||
__CONST_SOCKADDR_ARG addr;
|
||||
socklen_t len;
|
||||
{
|
||||
__set_errno (ENOSYS);
|
||||
return -1;
|
||||
}
|
||||
weak_alias (__connect, connect)
|
||||
|
||||
stub_warning (connect)
|
||||
#include <stub-tag.h>
|
36
socket/getpeername.c
Normal file
36
socket/getpeername.c
Normal file
@ -0,0 +1,36 @@
|
||||
/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
#include <errno.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
/* Put the address of the peer connected to socket FD into *ADDR
|
||||
(which is *LEN bytes long), and its actual length into *LEN. */
|
||||
int
|
||||
getpeername (fd, addr, len)
|
||||
int fd;
|
||||
__SOCKADDR_ARG addr;
|
||||
socklen_t *len;
|
||||
{
|
||||
__set_errno (ENOSYS);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
stub_warning (getpeername)
|
||||
#include <stub-tag.h>
|
36
socket/getsockname.c
Normal file
36
socket/getsockname.c
Normal file
@ -0,0 +1,36 @@
|
||||
/* Copyright (C) 1991, 1995, 1996, 1997, 2002 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
#include <errno.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
/* Put the local address of FD into *ADDR and its length in *LEN. */
|
||||
int
|
||||
__getsockname (fd, addr, len)
|
||||
int fd;
|
||||
__SOCKADDR_ARG addr;
|
||||
socklen_t *len;
|
||||
{
|
||||
__set_errno (ENOSYS);
|
||||
return -1;
|
||||
}
|
||||
|
||||
weak_alias (__getsockname, getsockname)
|
||||
|
||||
stub_warning (getsockname)
|
||||
#include <stub-tag.h>
|
38
socket/getsockopt.c
Normal file
38
socket/getsockopt.c
Normal file
@ -0,0 +1,38 @@
|
||||
/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
#include <errno.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
/* Put the current value for socket FD's option OPTNAME at protocol level LEVEL
|
||||
into OPTVAL (which is *OPTLEN bytes long), and set *OPTLEN to the value's
|
||||
actual length. Returns 0 on success, -1 for errors. */
|
||||
int
|
||||
getsockopt (fd, level, optname, optval, optlen)
|
||||
int fd;
|
||||
int level;
|
||||
int optname;
|
||||
void *optval;
|
||||
socklen_t *optlen;
|
||||
{
|
||||
__set_errno (ENOSYS);
|
||||
return -1;
|
||||
}
|
||||
|
||||
stub_warning (getsockopt)
|
||||
#include <stub-tag.h>
|
31
socket/isfdtype.c
Normal file
31
socket/isfdtype.c
Normal file
@ -0,0 +1,31 @@
|
||||
/* isfdtype - Determine whether descriptor has given property. Stub version.
|
||||
Copyright (C) 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
#include <errno.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
|
||||
int
|
||||
isfdtype (int fildes, int fdtype)
|
||||
{
|
||||
__set_errno (ENOSYS);
|
||||
return -1;
|
||||
}
|
||||
stub_warning (isfdtype)
|
||||
#include <stub-tag.h>
|
37
socket/listen.c
Normal file
37
socket/listen.c
Normal file
@ -0,0 +1,37 @@
|
||||
/* Copyright (C) 1991,1995,1996,1997,2001,2002 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
#include <errno.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
/* Prepare to accept connections on socket FD.
|
||||
N connection requests will be queued before further requests are refused.
|
||||
Returns 0 on success, -1 for errors. */
|
||||
int
|
||||
__listen (fd, n)
|
||||
int fd;
|
||||
int n;
|
||||
{
|
||||
__set_errno (ENOSYS);
|
||||
return -1;
|
||||
}
|
||||
|
||||
weak_alias (__listen, listen)
|
||||
|
||||
stub_warning (listen)
|
||||
#include <stub-tag.h>
|
71
socket/opensock.c
Normal file
71
socket/opensock.c
Normal file
@ -0,0 +1,71 @@
|
||||
/* Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/socket.h>
|
||||
#include <bits/libc-lock.h>
|
||||
|
||||
/* Return a socket of any type. The socket can be used in subsequent
|
||||
ioctl calls to talk to the kernel. */
|
||||
int internal_function
|
||||
__opensock (void)
|
||||
{
|
||||
/* Cache the last AF that worked, to avoid many redundant calls to
|
||||
socket(). */
|
||||
static int sock_af = -1;
|
||||
int fd = -1;
|
||||
__libc_lock_define_initialized (static, lock);
|
||||
|
||||
if (sock_af != -1)
|
||||
{
|
||||
fd = __socket (sock_af, SOCK_DGRAM, 0);
|
||||
if (fd != -1)
|
||||
return fd;
|
||||
}
|
||||
|
||||
__libc_lock_lock (lock);
|
||||
|
||||
if (sock_af != -1)
|
||||
fd = __socket (sock_af, SOCK_DGRAM, 0);
|
||||
|
||||
if (fd == -1)
|
||||
{
|
||||
#ifdef AF_INET
|
||||
fd = __socket (sock_af = AF_INET, SOCK_DGRAM, 0);
|
||||
#endif
|
||||
#ifdef AF_INET6
|
||||
if (fd < 0)
|
||||
fd = __socket (sock_af = AF_INET6, SOCK_DGRAM, 0);
|
||||
#endif
|
||||
#ifdef AF_IPX
|
||||
if (fd < 0)
|
||||
fd = __socket (sock_af = AF_IPX, SOCK_DGRAM, 0);
|
||||
#endif
|
||||
#ifdef AF_AX25
|
||||
if (fd < 0)
|
||||
fd = __socket (sock_af = AF_AX25, SOCK_DGRAM, 0);
|
||||
#endif
|
||||
#ifdef AF_APPLETALK
|
||||
if (fd < 0)
|
||||
fd = __socket (sock_af = AF_APPLETALK, SOCK_DGRAM, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
__libc_lock_unlock (lock);
|
||||
return fd;
|
||||
}
|
37
socket/recv.c
Normal file
37
socket/recv.c
Normal file
@ -0,0 +1,37 @@
|
||||
/* Copyright (C) 1991,1995,1996,1997,2001,2005 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
#include <errno.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
/* Read N bytes into BUF from socket FD.
|
||||
Returns the number read or -1 for errors. */
|
||||
ssize_t
|
||||
__recv (fd, buf, n, flags)
|
||||
int fd;
|
||||
void *buf;
|
||||
size_t n;
|
||||
int flags;
|
||||
{
|
||||
__set_errno (ENOSYS);
|
||||
return -1;
|
||||
}
|
||||
weak_alias (__recv, recv)
|
||||
|
||||
stub_warning (recv)
|
||||
#include <stub-tag.h>
|
41
socket/recvfrom.c
Normal file
41
socket/recvfrom.c
Normal file
@ -0,0 +1,41 @@
|
||||
/* Copyright (C) 1991,1995,1996,1997,2001,2002 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
#include <errno.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
/* Read N bytes into BUF through socket FD from peer
|
||||
at address ADDR (which is ADDR_LEN bytes long).
|
||||
Returns the number read or -1 for errors. */
|
||||
ssize_t
|
||||
__recvfrom (fd, buf, n, flags, addr, addr_len)
|
||||
int fd;
|
||||
void *buf;
|
||||
size_t n;
|
||||
int flags;
|
||||
__SOCKADDR_ARG addr;
|
||||
socklen_t *addr_len;
|
||||
{
|
||||
__set_errno (ENOSYS);
|
||||
return -1;
|
||||
}
|
||||
|
||||
weak_alias (__recvfrom, recvfrom)
|
||||
|
||||
stub_warning (recvfrom)
|
||||
#include <stub-tag.h>
|
37
socket/recvmsg.c
Normal file
37
socket/recvmsg.c
Normal file
@ -0,0 +1,37 @@
|
||||
/* Copyright (C) 1991,1995,1996,1997,2001,2002 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
#include <errno.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
/* Receive a message as described by MESSAGE from socket FD.
|
||||
Returns the number of bytes read or -1 for errors. */
|
||||
ssize_t
|
||||
__recvmsg (fd, message, flags)
|
||||
int fd;
|
||||
struct msghdr *message;
|
||||
int flags;
|
||||
{
|
||||
__set_errno (ENOSYS);
|
||||
return -1;
|
||||
}
|
||||
|
||||
weak_alias (__recvmsg, recvmsg)
|
||||
|
||||
stub_warning (recvmsg)
|
||||
#include <stub-tag.h>
|
37
socket/send.c
Normal file
37
socket/send.c
Normal file
@ -0,0 +1,37 @@
|
||||
/* Copyright (C) 1991,1995,1996,1997,2001,2002 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
#include <errno.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
/* Send N bytes of BUF to socket FD. Returns the number sent or -1. */
|
||||
ssize_t
|
||||
__send (fd, buf, n, flags)
|
||||
int fd;
|
||||
__const __ptr_t buf;
|
||||
size_t n;
|
||||
int flags;
|
||||
{
|
||||
__set_errno (ENOSYS);
|
||||
return -1;
|
||||
}
|
||||
libc_hidden_def (__send)
|
||||
weak_alias (__send, send)
|
||||
|
||||
stub_warning (send)
|
||||
#include <stub-tag.h>
|
37
socket/sendmsg.c
Normal file
37
socket/sendmsg.c
Normal file
@ -0,0 +1,37 @@
|
||||
/* Copyright (C) 1991,1995,1996,1997,2001,2002 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
#include <errno.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
/* Send a message described MESSAGE on socket FD.
|
||||
Returns the number of bytes sent, or -1 for errors. */
|
||||
ssize_t
|
||||
__sendmsg (fd, message, flags)
|
||||
int fd;
|
||||
const struct msghdr *message;
|
||||
int flags;
|
||||
{
|
||||
__set_errno (ENOSYS);
|
||||
return -1;
|
||||
}
|
||||
|
||||
weak_alias (__sendmsg, sendmsg)
|
||||
|
||||
stub_warning (sendmsg)
|
||||
#include <stub-tag.h>
|
40
socket/sendto.c
Normal file
40
socket/sendto.c
Normal file
@ -0,0 +1,40 @@
|
||||
/* Copyright (C) 1991,1995,1996,1997,2001,2002 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
#include <errno.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
/* Send N bytes of BUF on socket FD to peer at address ADDR (which is
|
||||
ADDR_LEN bytes long). Returns the number sent, or -1 for errors. */
|
||||
ssize_t
|
||||
__sendto (fd, buf, n, flags, addr, addr_len)
|
||||
int fd;
|
||||
__const __ptr_t buf;
|
||||
size_t n;
|
||||
int flags;
|
||||
__CONST_SOCKADDR_ARG addr;
|
||||
socklen_t addr_len;
|
||||
{
|
||||
__set_errno (ENOSYS);
|
||||
return -1;
|
||||
}
|
||||
|
||||
weak_alias (__sendto, sendto)
|
||||
|
||||
stub_warning (sendto)
|
||||
#include <stub-tag.h>
|
40
socket/setsockopt.c
Normal file
40
socket/setsockopt.c
Normal file
@ -0,0 +1,40 @@
|
||||
/* Copyright (C) 1991,1995,1996,1997,1998,2002 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
#include <errno.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
/* Set socket FD's option OPTNAME at protocol level LEVEL
|
||||
to *OPTVAL (which is OPTLEN bytes long).
|
||||
Returns 0 on success, -1 for errors. */
|
||||
int
|
||||
__setsockopt (fd, level, optname, optval, optlen)
|
||||
int fd;
|
||||
int level;
|
||||
int optname;
|
||||
const __ptr_t optval;
|
||||
socklen_t optlen;
|
||||
{
|
||||
__set_errno (ENOSYS);
|
||||
return -1;
|
||||
}
|
||||
|
||||
weak_alias (__setsockopt, setsockopt)
|
||||
|
||||
stub_warning (setsockopt)
|
||||
#include <stub-tag.h>
|
39
socket/shutdown.c
Normal file
39
socket/shutdown.c
Normal file
@ -0,0 +1,39 @@
|
||||
/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
#include <errno.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
/* Shut down all or part of the connection open on socket FD.
|
||||
HOW determines what to shut down:
|
||||
0 = No more receptions;
|
||||
1 = No more transmissions;
|
||||
2 = No more receptions or transmissions.
|
||||
Returns 0 on success, -1 for errors. */
|
||||
int
|
||||
shutdown (fd, how)
|
||||
int fd;
|
||||
int how;
|
||||
{
|
||||
__set_errno (ENOSYS);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
stub_warning (shutdown)
|
||||
#include <stub-tag.h>
|
33
socket/sockatmark.c
Normal file
33
socket/sockatmark.c
Normal file
@ -0,0 +1,33 @@
|
||||
/* Copyright (C) 2001 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
#include <errno.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
/* Determine wheter socket is at a out-of-band mark. */
|
||||
int
|
||||
sockatmark (fd)
|
||||
int fd;
|
||||
{
|
||||
__set_errno (ENOSYS);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
stub_warning (sockatmark)
|
||||
#include <stub-tag.h>
|
38
socket/socket.c
Normal file
38
socket/socket.c
Normal file
@ -0,0 +1,38 @@
|
||||
/* Copyright (C) 1991, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
#include <errno.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
/* Create a new socket of type TYPE in domain DOMAIN, using
|
||||
protocol PROTOCOL. If PROTOCOL is zero, one is chosen automatically.
|
||||
Returns a file descriptor for the new socket, or -1 for errors. */
|
||||
int
|
||||
__socket (domain, type, protocol)
|
||||
int domain;
|
||||
int type;
|
||||
int protocol;
|
||||
{
|
||||
__set_errno (ENOSYS);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
weak_alias (__socket, socket)
|
||||
stub_warning (socket)
|
||||
#include <stub-tag.h>
|
39
socket/socketpair.c
Normal file
39
socket/socketpair.c
Normal file
@ -0,0 +1,39 @@
|
||||
/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
#include <errno.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
/* Create two new sockets, of type TYPE in domain DOMAIN and using
|
||||
protocol PROTOCOL, which are connected to each other, and put file
|
||||
descriptors for them in FDS[0] and FDS[1]. If PROTOCOL is zero,
|
||||
one will be chosen automatically. Returns 0 on success, -1 for errors. */
|
||||
int
|
||||
socketpair (domain, type, protocol, fds)
|
||||
int domain;
|
||||
int type;
|
||||
int protocol;
|
||||
int fds[2];
|
||||
{
|
||||
__set_errno (ENOSYS);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
stub_warning (socketpair)
|
||||
#include <stub-tag.h>
|
@ -1,5 +1,5 @@
|
||||
/* Declarations of socket constants, types, and functions.
|
||||
Copyright (C) 1991,92,1994-2001,2003 Free Software Foundation, Inc.
|
||||
Copyright (C) 1991,92,1994-2001,2003,2005 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@ -231,6 +231,12 @@ extern int sockatmark (int __fd) __THROW;
|
||||
extern int isfdtype (int __fd, int __fdtype) __THROW;
|
||||
#endif
|
||||
|
||||
|
||||
/* Define some macros helping to catch buffer overflows. */
|
||||
#if __USE_FORTIFY_LEVEL > 0 && !defined __cplusplus
|
||||
# include <bits/socket2.h>
|
||||
#endif
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* sys/socket.h */
|
||||
|
Reference in New Issue
Block a user