File Coverage

/usr/include/x86_64-linux-gnu/bits/socket2.h
Criterion Covered Total %
statement 2 6 33.3
branch 1 6 16.7
condition n/a
subroutine n/a
total 3 12 25.0


line stmt bran cond sub time code
1           /* Checking macros for socket functions.
2           Copyright (C) 2005, 2007 Free Software Foundation, Inc.
3           This file is part of the GNU C Library.
4            
5           The GNU C Library is free software; you can redistribute it and/or
6           modify it under the terms of the GNU Lesser General Public
7           License as published by the Free Software Foundation; either
8           version 2.1 of the License, or (at your option) any later version.
9            
10           The GNU C Library is distributed in the hope that it will be useful,
11           but WITHOUT ANY WARRANTY; without even the implied warranty of
12           MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13           Lesser General Public License for more details.
14            
15           You should have received a copy of the GNU Lesser General Public
16           License along with the GNU C Library; if not, write to the Free
17           Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18           02111-1307 USA. */
19            
20           #ifndef _SYS_SOCKET_H
21           # error "Never include directly; use instead."
22           #endif
23            
24           extern ssize_t __recv_chk (int __fd, void *__buf, size_t __n, size_t __buflen,
25           int __flags);
26           extern ssize_t __REDIRECT (__recv_alias, (int __fd, void *__buf, size_t __n,
27           int __flags), recv);
28           extern ssize_t __REDIRECT (__recv_chk_warn,
29           (int __fd, void *__buf, size_t __n, size_t __buflen,
30           int __flags), __recv_chk)
31           __warnattr ("recv called with bigger length than size of destination "
32           "buffer");
33            
34           __extern_always_inline ssize_t
35           recv (int __fd, void *__buf, size_t __n, int __flags)
36           {
37           if (__bos0 (__buf) != (size_t) -1)
38           {
39           if (!__builtin_constant_p (__n))
40           return __recv_chk (__fd, __buf, __n, __bos0 (__buf), __flags);
41            
42           if (__n > __bos0 (__buf))
43           return __recv_chk_warn (__fd, __buf, __n, __bos0 (__buf), __flags);
44           }
45           return __recv_alias (__fd, __buf, __n, __flags);
46           }
47            
48           extern ssize_t __recvfrom_chk (int __fd, void *__restrict __buf, size_t __n,
49           size_t __buflen, int __flags,
50           __SOCKADDR_ARG __addr,
51           socklen_t *__restrict __addr_len);
52           extern ssize_t __REDIRECT (__recvfrom_alias,
53           (int __fd, void *__restrict __buf, size_t __n,
54           int __flags, __SOCKADDR_ARG __addr,
55           socklen_t *__restrict __addr_len), recvfrom);
56           extern ssize_t __REDIRECT (__recvfrom_chk_warn,
57           (int __fd, void *__restrict __buf, size_t __n,
58           size_t __buflen, int __flags,
59           __SOCKADDR_ARG __addr,
60           socklen_t *__restrict __addr_len), __recvfrom_chk)
61           __warnattr ("recvfrom called with bigger length than size of "
62           "destination buffer");
63            
64           __extern_always_inline ssize_t
65           recvfrom (int __fd, void *__restrict __buf, size_t __n, int __flags,
66           __SOCKADDR_ARG __addr, socklen_t *__restrict __addr_len)
67           {
68 16 50       if (__bos0 (__buf) != (size_t) -1)
69           {
70 0 0       if (!__builtin_constant_p (__n))
71 0         return __recvfrom_chk (__fd, __buf, __n, __bos0 (__buf), __flags,
72           __addr, __addr_len);
73 0 0       if (__n > __bos0 (__buf))
74 0         return __recvfrom_chk_warn (__fd, __buf, __n, __bos0 (__buf), __flags,
75           __addr, __addr_len);
76           }
77 16         return __recvfrom_alias (__fd, __buf, __n, __flags, __addr, __addr_len);
78           }