aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/sock.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/core/sock.c')
-rw-r--r--net/core/sock.c135
1 files changed, 72 insertions, 63 deletions
diff --git a/net/core/sock.c b/net/core/sock.c
index 7dbf3ffb35cc..06e26b77ad9e 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -155,6 +155,7 @@ static const char *af_family_key_strings[AF_MAX+1] = {
155 "sk_lock-27" , "sk_lock-28" , "sk_lock-AF_CAN" , 155 "sk_lock-27" , "sk_lock-28" , "sk_lock-AF_CAN" ,
156 "sk_lock-AF_TIPC" , "sk_lock-AF_BLUETOOTH", "sk_lock-IUCV" , 156 "sk_lock-AF_TIPC" , "sk_lock-AF_BLUETOOTH", "sk_lock-IUCV" ,
157 "sk_lock-AF_RXRPC" , "sk_lock-AF_ISDN" , "sk_lock-AF_PHONET" , 157 "sk_lock-AF_RXRPC" , "sk_lock-AF_ISDN" , "sk_lock-AF_PHONET" ,
158 "sk_lock-AF_IEEE802154",
158 "sk_lock-AF_MAX" 159 "sk_lock-AF_MAX"
159}; 160};
160static const char *af_family_slock_key_strings[AF_MAX+1] = { 161static const char *af_family_slock_key_strings[AF_MAX+1] = {
@@ -170,6 +171,7 @@ static const char *af_family_slock_key_strings[AF_MAX+1] = {
170 "slock-27" , "slock-28" , "slock-AF_CAN" , 171 "slock-27" , "slock-28" , "slock-AF_CAN" ,
171 "slock-AF_TIPC" , "slock-AF_BLUETOOTH", "slock-AF_IUCV" , 172 "slock-AF_TIPC" , "slock-AF_BLUETOOTH", "slock-AF_IUCV" ,
172 "slock-AF_RXRPC" , "slock-AF_ISDN" , "slock-AF_PHONET" , 173 "slock-AF_RXRPC" , "slock-AF_ISDN" , "slock-AF_PHONET" ,
174 "slock-AF_IEEE802154",
173 "slock-AF_MAX" 175 "slock-AF_MAX"
174}; 176};
175static const char *af_family_clock_key_strings[AF_MAX+1] = { 177static const char *af_family_clock_key_strings[AF_MAX+1] = {
@@ -185,6 +187,7 @@ static const char *af_family_clock_key_strings[AF_MAX+1] = {
185 "clock-27" , "clock-28" , "clock-AF_CAN" , 187 "clock-27" , "clock-28" , "clock-AF_CAN" ,
186 "clock-AF_TIPC" , "clock-AF_BLUETOOTH", "clock-AF_IUCV" , 188 "clock-AF_TIPC" , "clock-AF_BLUETOOTH", "clock-AF_IUCV" ,
187 "clock-AF_RXRPC" , "clock-AF_ISDN" , "clock-AF_PHONET" , 189 "clock-AF_RXRPC" , "clock-AF_ISDN" , "clock-AF_PHONET" ,
190 "clock-AF_IEEE802154",
188 "clock-AF_MAX" 191 "clock-AF_MAX"
189}; 192};
190 193
@@ -212,6 +215,7 @@ __u32 sysctl_rmem_default __read_mostly = SK_RMEM_MAX;
212 215
213/* Maximal space eaten by iovec or ancilliary data plus some space */ 216/* Maximal space eaten by iovec or ancilliary data plus some space */
214int sysctl_optmem_max __read_mostly = sizeof(unsigned long)*(2*UIO_MAXIOV+512); 217int sysctl_optmem_max __read_mostly = sizeof(unsigned long)*(2*UIO_MAXIOV+512);
218EXPORT_SYMBOL(sysctl_optmem_max);
215 219
216static int sock_set_timeout(long *timeo_p, char __user *optval, int optlen) 220static int sock_set_timeout(long *timeo_p, char __user *optval, int optlen)
217{ 221{
@@ -444,7 +448,7 @@ static inline void sock_valbool_flag(struct sock *sk, int bit, int valbool)
444int sock_setsockopt(struct socket *sock, int level, int optname, 448int sock_setsockopt(struct socket *sock, int level, int optname,
445 char __user *optval, int optlen) 449 char __user *optval, int optlen)
446{ 450{
447 struct sock *sk=sock->sk; 451 struct sock *sk = sock->sk;
448 int val; 452 int val;
449 int valbool; 453 int valbool;
450 struct linger ling; 454 struct linger ling;
@@ -463,15 +467,15 @@ int sock_setsockopt(struct socket *sock, int level, int optname,
463 if (get_user(val, (int __user *)optval)) 467 if (get_user(val, (int __user *)optval))
464 return -EFAULT; 468 return -EFAULT;
465 469
466 valbool = val?1:0; 470 valbool = val ? 1 : 0;
467 471
468 lock_sock(sk); 472 lock_sock(sk);
469 473
470 switch(optname) { 474 switch (optname) {
471 case SO_DEBUG: 475 case SO_DEBUG:
472 if (val && !capable(CAP_NET_ADMIN)) { 476 if (val && !capable(CAP_NET_ADMIN))
473 ret = -EACCES; 477 ret = -EACCES;
474 } else 478 else
475 sock_valbool_flag(sk, SOCK_DBG, valbool); 479 sock_valbool_flag(sk, SOCK_DBG, valbool);
476 break; 480 break;
477 case SO_REUSEADDR: 481 case SO_REUSEADDR:
@@ -582,7 +586,7 @@ set_rcvbuf:
582 ret = -EINVAL; /* 1003.1g */ 586 ret = -EINVAL; /* 1003.1g */
583 break; 587 break;
584 } 588 }
585 if (copy_from_user(&ling,optval,sizeof(ling))) { 589 if (copy_from_user(&ling, optval, sizeof(ling))) {
586 ret = -EFAULT; 590 ret = -EFAULT;
587 break; 591 break;
588 } 592 }
@@ -690,9 +694,8 @@ set_rcvbuf:
690 case SO_MARK: 694 case SO_MARK:
691 if (!capable(CAP_NET_ADMIN)) 695 if (!capable(CAP_NET_ADMIN))
692 ret = -EPERM; 696 ret = -EPERM;
693 else { 697 else
694 sk->sk_mark = val; 698 sk->sk_mark = val;
695 }
696 break; 699 break;
697 700
698 /* We implement the SO_SNDLOWAT etc to 701 /* We implement the SO_SNDLOWAT etc to
@@ -704,6 +707,7 @@ set_rcvbuf:
704 release_sock(sk); 707 release_sock(sk);
705 return ret; 708 return ret;
706} 709}
710EXPORT_SYMBOL(sock_setsockopt);
707 711
708 712
709int sock_getsockopt(struct socket *sock, int level, int optname, 713int sock_getsockopt(struct socket *sock, int level, int optname,
@@ -727,7 +731,7 @@ int sock_getsockopt(struct socket *sock, int level, int optname,
727 731
728 memset(&v, 0, sizeof(v)); 732 memset(&v, 0, sizeof(v));
729 733
730 switch(optname) { 734 switch (optname) {
731 case SO_DEBUG: 735 case SO_DEBUG:
732 v.val = sock_flag(sk, SOCK_DBG); 736 v.val = sock_flag(sk, SOCK_DBG);
733 break; 737 break;
@@ -762,7 +766,7 @@ int sock_getsockopt(struct socket *sock, int level, int optname,
762 766
763 case SO_ERROR: 767 case SO_ERROR:
764 v.val = -sock_error(sk); 768 v.val = -sock_error(sk);
765 if (v.val==0) 769 if (v.val == 0)
766 v.val = xchg(&sk->sk_err_soft, 0); 770 v.val = xchg(&sk->sk_err_soft, 0);
767 break; 771 break;
768 772
@@ -816,7 +820,7 @@ int sock_getsockopt(struct socket *sock, int level, int optname,
816 break; 820 break;
817 821
818 case SO_RCVTIMEO: 822 case SO_RCVTIMEO:
819 lv=sizeof(struct timeval); 823 lv = sizeof(struct timeval);
820 if (sk->sk_rcvtimeo == MAX_SCHEDULE_TIMEOUT) { 824 if (sk->sk_rcvtimeo == MAX_SCHEDULE_TIMEOUT) {
821 v.tm.tv_sec = 0; 825 v.tm.tv_sec = 0;
822 v.tm.tv_usec = 0; 826 v.tm.tv_usec = 0;
@@ -827,7 +831,7 @@ int sock_getsockopt(struct socket *sock, int level, int optname,
827 break; 831 break;
828 832
829 case SO_SNDTIMEO: 833 case SO_SNDTIMEO:
830 lv=sizeof(struct timeval); 834 lv = sizeof(struct timeval);
831 if (sk->sk_sndtimeo == MAX_SCHEDULE_TIMEOUT) { 835 if (sk->sk_sndtimeo == MAX_SCHEDULE_TIMEOUT) {
832 v.tm.tv_sec = 0; 836 v.tm.tv_sec = 0;
833 v.tm.tv_usec = 0; 837 v.tm.tv_usec = 0;
@@ -842,7 +846,7 @@ int sock_getsockopt(struct socket *sock, int level, int optname,
842 break; 846 break;
843 847
844 case SO_SNDLOWAT: 848 case SO_SNDLOWAT:
845 v.val=1; 849 v.val = 1;
846 break; 850 break;
847 851
848 case SO_PASSCRED: 852 case SO_PASSCRED:
@@ -1002,8 +1006,9 @@ struct sock *sk_alloc(struct net *net, int family, gfp_t priority,
1002 1006
1003 return sk; 1007 return sk;
1004} 1008}
1009EXPORT_SYMBOL(sk_alloc);
1005 1010
1006void sk_free(struct sock *sk) 1011static void __sk_free(struct sock *sk)
1007{ 1012{
1008 struct sk_filter *filter; 1013 struct sk_filter *filter;
1009 1014
@@ -1027,6 +1032,18 @@ void sk_free(struct sock *sk)
1027 sk_prot_free(sk->sk_prot_creator, sk); 1032 sk_prot_free(sk->sk_prot_creator, sk);
1028} 1033}
1029 1034
1035void sk_free(struct sock *sk)
1036{
1037 /*
1038 * We substract one from sk_wmem_alloc and can know if
1039 * some packets are still in some tx queue.
1040 * If not null, sock_wfree() will call __sk_free(sk) later
1041 */
1042 if (atomic_dec_and_test(&sk->sk_wmem_alloc))
1043 __sk_free(sk);
1044}
1045EXPORT_SYMBOL(sk_free);
1046
1030/* 1047/*
1031 * Last sock_put should drop referrence to sk->sk_net. It has already 1048 * Last sock_put should drop referrence to sk->sk_net. It has already
1032 * been dropped in sk_change_net. Taking referrence to stopping namespace 1049 * been dropped in sk_change_net. Taking referrence to stopping namespace
@@ -1065,7 +1082,10 @@ struct sock *sk_clone(const struct sock *sk, const gfp_t priority)
1065 newsk->sk_backlog.head = newsk->sk_backlog.tail = NULL; 1082 newsk->sk_backlog.head = newsk->sk_backlog.tail = NULL;
1066 1083
1067 atomic_set(&newsk->sk_rmem_alloc, 0); 1084 atomic_set(&newsk->sk_rmem_alloc, 0);
1068 atomic_set(&newsk->sk_wmem_alloc, 0); 1085 /*
1086 * sk_wmem_alloc set to one (see sk_free() and sock_wfree())
1087 */
1088 atomic_set(&newsk->sk_wmem_alloc, 1);
1069 atomic_set(&newsk->sk_omem_alloc, 0); 1089 atomic_set(&newsk->sk_omem_alloc, 0);
1070 skb_queue_head_init(&newsk->sk_receive_queue); 1090 skb_queue_head_init(&newsk->sk_receive_queue);
1071 skb_queue_head_init(&newsk->sk_write_queue); 1091 skb_queue_head_init(&newsk->sk_write_queue);
@@ -1126,7 +1146,6 @@ struct sock *sk_clone(const struct sock *sk, const gfp_t priority)
1126out: 1146out:
1127 return newsk; 1147 return newsk;
1128} 1148}
1129
1130EXPORT_SYMBOL_GPL(sk_clone); 1149EXPORT_SYMBOL_GPL(sk_clone);
1131 1150
1132void sk_setup_caps(struct sock *sk, struct dst_entry *dst) 1151void sk_setup_caps(struct sock *sk, struct dst_entry *dst)
@@ -1170,13 +1189,20 @@ void __init sk_init(void)
1170void sock_wfree(struct sk_buff *skb) 1189void sock_wfree(struct sk_buff *skb)
1171{ 1190{
1172 struct sock *sk = skb->sk; 1191 struct sock *sk = skb->sk;
1192 int res;
1173 1193
1174 /* In case it might be waiting for more memory. */ 1194 /* In case it might be waiting for more memory. */
1175 atomic_sub(skb->truesize, &sk->sk_wmem_alloc); 1195 res = atomic_sub_return(skb->truesize, &sk->sk_wmem_alloc);
1176 if (!sock_flag(sk, SOCK_USE_WRITE_QUEUE)) 1196 if (!sock_flag(sk, SOCK_USE_WRITE_QUEUE))
1177 sk->sk_write_space(sk); 1197 sk->sk_write_space(sk);
1178 sock_put(sk); 1198 /*
1199 * if sk_wmem_alloc reached 0, we are last user and should
1200 * free this sock, as sk_free() call could not do it.
1201 */
1202 if (res == 0)
1203 __sk_free(sk);
1179} 1204}
1205EXPORT_SYMBOL(sock_wfree);
1180 1206
1181/* 1207/*
1182 * Read buffer destructor automatically called from kfree_skb. 1208 * Read buffer destructor automatically called from kfree_skb.
@@ -1188,6 +1214,7 @@ void sock_rfree(struct sk_buff *skb)
1188 atomic_sub(skb->truesize, &sk->sk_rmem_alloc); 1214 atomic_sub(skb->truesize, &sk->sk_rmem_alloc);
1189 sk_mem_uncharge(skb->sk, skb->truesize); 1215 sk_mem_uncharge(skb->sk, skb->truesize);
1190} 1216}
1217EXPORT_SYMBOL(sock_rfree);
1191 1218
1192 1219
1193int sock_i_uid(struct sock *sk) 1220int sock_i_uid(struct sock *sk)
@@ -1199,6 +1226,7 @@ int sock_i_uid(struct sock *sk)
1199 read_unlock(&sk->sk_callback_lock); 1226 read_unlock(&sk->sk_callback_lock);
1200 return uid; 1227 return uid;
1201} 1228}
1229EXPORT_SYMBOL(sock_i_uid);
1202 1230
1203unsigned long sock_i_ino(struct sock *sk) 1231unsigned long sock_i_ino(struct sock *sk)
1204{ 1232{
@@ -1209,6 +1237,7 @@ unsigned long sock_i_ino(struct sock *sk)
1209 read_unlock(&sk->sk_callback_lock); 1237 read_unlock(&sk->sk_callback_lock);
1210 return ino; 1238 return ino;
1211} 1239}
1240EXPORT_SYMBOL(sock_i_ino);
1212 1241
1213/* 1242/*
1214 * Allocate a skb from the socket's send buffer. 1243 * Allocate a skb from the socket's send buffer.
@@ -1217,7 +1246,7 @@ struct sk_buff *sock_wmalloc(struct sock *sk, unsigned long size, int force,
1217 gfp_t priority) 1246 gfp_t priority)
1218{ 1247{
1219 if (force || atomic_read(&sk->sk_wmem_alloc) < sk->sk_sndbuf) { 1248 if (force || atomic_read(&sk->sk_wmem_alloc) < sk->sk_sndbuf) {
1220 struct sk_buff * skb = alloc_skb(size, priority); 1249 struct sk_buff *skb = alloc_skb(size, priority);
1221 if (skb) { 1250 if (skb) {
1222 skb_set_owner_w(skb, sk); 1251 skb_set_owner_w(skb, sk);
1223 return skb; 1252 return skb;
@@ -1225,6 +1254,7 @@ struct sk_buff *sock_wmalloc(struct sock *sk, unsigned long size, int force,
1225 } 1254 }
1226 return NULL; 1255 return NULL;
1227} 1256}
1257EXPORT_SYMBOL(sock_wmalloc);
1228 1258
1229/* 1259/*
1230 * Allocate a skb from the socket's receive buffer. 1260 * Allocate a skb from the socket's receive buffer.
@@ -1261,6 +1291,7 @@ void *sock_kmalloc(struct sock *sk, int size, gfp_t priority)
1261 } 1291 }
1262 return NULL; 1292 return NULL;
1263} 1293}
1294EXPORT_SYMBOL(sock_kmalloc);
1264 1295
1265/* 1296/*
1266 * Free an option memory block. 1297 * Free an option memory block.
@@ -1270,11 +1301,12 @@ void sock_kfree_s(struct sock *sk, void *mem, int size)
1270 kfree(mem); 1301 kfree(mem);
1271 atomic_sub(size, &sk->sk_omem_alloc); 1302 atomic_sub(size, &sk->sk_omem_alloc);
1272} 1303}
1304EXPORT_SYMBOL(sock_kfree_s);
1273 1305
1274/* It is almost wait_for_tcp_memory minus release_sock/lock_sock. 1306/* It is almost wait_for_tcp_memory minus release_sock/lock_sock.
1275 I think, these locks should be removed for datagram sockets. 1307 I think, these locks should be removed for datagram sockets.
1276 */ 1308 */
1277static long sock_wait_for_wmem(struct sock * sk, long timeo) 1309static long sock_wait_for_wmem(struct sock *sk, long timeo)
1278{ 1310{
1279 DEFINE_WAIT(wait); 1311 DEFINE_WAIT(wait);
1280 1312
@@ -1392,6 +1424,7 @@ struct sk_buff *sock_alloc_send_skb(struct sock *sk, unsigned long size,
1392{ 1424{
1393 return sock_alloc_send_pskb(sk, size, 0, noblock, errcode); 1425 return sock_alloc_send_pskb(sk, size, 0, noblock, errcode);
1394} 1426}
1427EXPORT_SYMBOL(sock_alloc_send_skb);
1395 1428
1396static void __lock_sock(struct sock *sk) 1429static void __lock_sock(struct sock *sk)
1397{ 1430{
@@ -1460,7 +1493,6 @@ int sk_wait_data(struct sock *sk, long *timeo)
1460 finish_wait(sk->sk_sleep, &wait); 1493 finish_wait(sk->sk_sleep, &wait);
1461 return rc; 1494 return rc;
1462} 1495}
1463
1464EXPORT_SYMBOL(sk_wait_data); 1496EXPORT_SYMBOL(sk_wait_data);
1465 1497
1466/** 1498/**
@@ -1541,7 +1573,6 @@ suppress_allocation:
1541 atomic_sub(amt, prot->memory_allocated); 1573 atomic_sub(amt, prot->memory_allocated);
1542 return 0; 1574 return 0;
1543} 1575}
1544
1545EXPORT_SYMBOL(__sk_mem_schedule); 1576EXPORT_SYMBOL(__sk_mem_schedule);
1546 1577
1547/** 1578/**
@@ -1560,7 +1591,6 @@ void __sk_mem_reclaim(struct sock *sk)
1560 (atomic_read(prot->memory_allocated) < prot->sysctl_mem[0])) 1591 (atomic_read(prot->memory_allocated) < prot->sysctl_mem[0]))
1561 *prot->memory_pressure = 0; 1592 *prot->memory_pressure = 0;
1562} 1593}
1563
1564EXPORT_SYMBOL(__sk_mem_reclaim); 1594EXPORT_SYMBOL(__sk_mem_reclaim);
1565 1595
1566 1596
@@ -1575,78 +1605,92 @@ int sock_no_bind(struct socket *sock, struct sockaddr *saddr, int len)
1575{ 1605{
1576 return -EOPNOTSUPP; 1606 return -EOPNOTSUPP;
1577} 1607}
1608EXPORT_SYMBOL(sock_no_bind);
1578 1609
1579int sock_no_connect(struct socket *sock, struct sockaddr *saddr, 1610int sock_no_connect(struct socket *sock, struct sockaddr *saddr,
1580 int len, int flags) 1611 int len, int flags)
1581{ 1612{
1582 return -EOPNOTSUPP; 1613 return -EOPNOTSUPP;
1583} 1614}
1615EXPORT_SYMBOL(sock_no_connect);
1584 1616
1585int sock_no_socketpair(struct socket *sock1, struct socket *sock2) 1617int sock_no_socketpair(struct socket *sock1, struct socket *sock2)
1586{ 1618{
1587 return -EOPNOTSUPP; 1619 return -EOPNOTSUPP;
1588} 1620}
1621EXPORT_SYMBOL(sock_no_socketpair);
1589 1622
1590int sock_no_accept(struct socket *sock, struct socket *newsock, int flags) 1623int sock_no_accept(struct socket *sock, struct socket *newsock, int flags)
1591{ 1624{
1592 return -EOPNOTSUPP; 1625 return -EOPNOTSUPP;
1593} 1626}
1627EXPORT_SYMBOL(sock_no_accept);
1594 1628
1595int sock_no_getname(struct socket *sock, struct sockaddr *saddr, 1629int sock_no_getname(struct socket *sock, struct sockaddr *saddr,
1596 int *len, int peer) 1630 int *len, int peer)
1597{ 1631{
1598 return -EOPNOTSUPP; 1632 return -EOPNOTSUPP;
1599} 1633}
1634EXPORT_SYMBOL(sock_no_getname);
1600 1635
1601unsigned int sock_no_poll(struct file * file, struct socket *sock, poll_table *pt) 1636unsigned int sock_no_poll(struct file *file, struct socket *sock, poll_table *pt)
1602{ 1637{
1603 return 0; 1638 return 0;
1604} 1639}
1640EXPORT_SYMBOL(sock_no_poll);
1605 1641
1606int sock_no_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) 1642int sock_no_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
1607{ 1643{
1608 return -EOPNOTSUPP; 1644 return -EOPNOTSUPP;
1609} 1645}
1646EXPORT_SYMBOL(sock_no_ioctl);
1610 1647
1611int sock_no_listen(struct socket *sock, int backlog) 1648int sock_no_listen(struct socket *sock, int backlog)
1612{ 1649{
1613 return -EOPNOTSUPP; 1650 return -EOPNOTSUPP;
1614} 1651}
1652EXPORT_SYMBOL(sock_no_listen);
1615 1653
1616int sock_no_shutdown(struct socket *sock, int how) 1654int sock_no_shutdown(struct socket *sock, int how)
1617{ 1655{
1618 return -EOPNOTSUPP; 1656 return -EOPNOTSUPP;
1619} 1657}
1658EXPORT_SYMBOL(sock_no_shutdown);
1620 1659
1621int sock_no_setsockopt(struct socket *sock, int level, int optname, 1660int sock_no_setsockopt(struct socket *sock, int level, int optname,
1622 char __user *optval, int optlen) 1661 char __user *optval, int optlen)
1623{ 1662{
1624 return -EOPNOTSUPP; 1663 return -EOPNOTSUPP;
1625} 1664}
1665EXPORT_SYMBOL(sock_no_setsockopt);
1626 1666
1627int sock_no_getsockopt(struct socket *sock, int level, int optname, 1667int sock_no_getsockopt(struct socket *sock, int level, int optname,
1628 char __user *optval, int __user *optlen) 1668 char __user *optval, int __user *optlen)
1629{ 1669{
1630 return -EOPNOTSUPP; 1670 return -EOPNOTSUPP;
1631} 1671}
1672EXPORT_SYMBOL(sock_no_getsockopt);
1632 1673
1633int sock_no_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *m, 1674int sock_no_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *m,
1634 size_t len) 1675 size_t len)
1635{ 1676{
1636 return -EOPNOTSUPP; 1677 return -EOPNOTSUPP;
1637} 1678}
1679EXPORT_SYMBOL(sock_no_sendmsg);
1638 1680
1639int sock_no_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *m, 1681int sock_no_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *m,
1640 size_t len, int flags) 1682 size_t len, int flags)
1641{ 1683{
1642 return -EOPNOTSUPP; 1684 return -EOPNOTSUPP;
1643} 1685}
1686EXPORT_SYMBOL(sock_no_recvmsg);
1644 1687
1645int sock_no_mmap(struct file *file, struct socket *sock, struct vm_area_struct *vma) 1688int sock_no_mmap(struct file *file, struct socket *sock, struct vm_area_struct *vma)
1646{ 1689{
1647 /* Mirror missing mmap method error code */ 1690 /* Mirror missing mmap method error code */
1648 return -ENODEV; 1691 return -ENODEV;
1649} 1692}
1693EXPORT_SYMBOL(sock_no_mmap);
1650 1694
1651ssize_t sock_no_sendpage(struct socket *sock, struct page *page, int offset, size_t size, int flags) 1695ssize_t sock_no_sendpage(struct socket *sock, struct page *page, int offset, size_t size, int flags)
1652{ 1696{
@@ -1660,6 +1704,7 @@ ssize_t sock_no_sendpage(struct socket *sock, struct page *page, int offset, siz
1660 kunmap(page); 1704 kunmap(page);
1661 return res; 1705 return res;
1662} 1706}
1707EXPORT_SYMBOL(sock_no_sendpage);
1663 1708
1664/* 1709/*
1665 * Default Socket Callbacks 1710 * Default Socket Callbacks
@@ -1723,6 +1768,7 @@ void sk_send_sigurg(struct sock *sk)
1723 if (send_sigurg(&sk->sk_socket->file->f_owner)) 1768 if (send_sigurg(&sk->sk_socket->file->f_owner))
1724 sk_wake_async(sk, SOCK_WAKE_URG, POLL_PRI); 1769 sk_wake_async(sk, SOCK_WAKE_URG, POLL_PRI);
1725} 1770}
1771EXPORT_SYMBOL(sk_send_sigurg);
1726 1772
1727void sk_reset_timer(struct sock *sk, struct timer_list* timer, 1773void sk_reset_timer(struct sock *sk, struct timer_list* timer,
1728 unsigned long expires) 1774 unsigned long expires)
@@ -1730,7 +1776,6 @@ void sk_reset_timer(struct sock *sk, struct timer_list* timer,
1730 if (!mod_timer(timer, expires)) 1776 if (!mod_timer(timer, expires))
1731 sock_hold(sk); 1777 sock_hold(sk);
1732} 1778}
1733
1734EXPORT_SYMBOL(sk_reset_timer); 1779EXPORT_SYMBOL(sk_reset_timer);
1735 1780
1736void sk_stop_timer(struct sock *sk, struct timer_list* timer) 1781void sk_stop_timer(struct sock *sk, struct timer_list* timer)
@@ -1738,7 +1783,6 @@ void sk_stop_timer(struct sock *sk, struct timer_list* timer)
1738 if (timer_pending(timer) && del_timer(timer)) 1783 if (timer_pending(timer) && del_timer(timer))
1739 __sock_put(sk); 1784 __sock_put(sk);
1740} 1785}
1741
1742EXPORT_SYMBOL(sk_stop_timer); 1786EXPORT_SYMBOL(sk_stop_timer);
1743 1787
1744void sock_init_data(struct socket *sock, struct sock *sk) 1788void sock_init_data(struct socket *sock, struct sock *sk)
@@ -1795,8 +1839,10 @@ void sock_init_data(struct socket *sock, struct sock *sk)
1795 sk->sk_stamp = ktime_set(-1L, 0); 1839 sk->sk_stamp = ktime_set(-1L, 0);
1796 1840
1797 atomic_set(&sk->sk_refcnt, 1); 1841 atomic_set(&sk->sk_refcnt, 1);
1842 atomic_set(&sk->sk_wmem_alloc, 1);
1798 atomic_set(&sk->sk_drops, 0); 1843 atomic_set(&sk->sk_drops, 0);
1799} 1844}
1845EXPORT_SYMBOL(sock_init_data);
1800 1846
1801void lock_sock_nested(struct sock *sk, int subclass) 1847void lock_sock_nested(struct sock *sk, int subclass)
1802{ 1848{
@@ -1812,7 +1858,6 @@ void lock_sock_nested(struct sock *sk, int subclass)
1812 mutex_acquire(&sk->sk_lock.dep_map, subclass, 0, _RET_IP_); 1858 mutex_acquire(&sk->sk_lock.dep_map, subclass, 0, _RET_IP_);
1813 local_bh_enable(); 1859 local_bh_enable();
1814} 1860}
1815
1816EXPORT_SYMBOL(lock_sock_nested); 1861EXPORT_SYMBOL(lock_sock_nested);
1817 1862
1818void release_sock(struct sock *sk) 1863void release_sock(struct sock *sk)
@@ -1895,7 +1940,6 @@ int sock_common_getsockopt(struct socket *sock, int level, int optname,
1895 1940
1896 return sk->sk_prot->getsockopt(sk, level, optname, optval, optlen); 1941 return sk->sk_prot->getsockopt(sk, level, optname, optval, optlen);
1897} 1942}
1898
1899EXPORT_SYMBOL(sock_common_getsockopt); 1943EXPORT_SYMBOL(sock_common_getsockopt);
1900 1944
1901#ifdef CONFIG_COMPAT 1945#ifdef CONFIG_COMPAT
@@ -1925,7 +1969,6 @@ int sock_common_recvmsg(struct kiocb *iocb, struct socket *sock,
1925 msg->msg_namelen = addr_len; 1969 msg->msg_namelen = addr_len;
1926 return err; 1970 return err;
1927} 1971}
1928
1929EXPORT_SYMBOL(sock_common_recvmsg); 1972EXPORT_SYMBOL(sock_common_recvmsg);
1930 1973
1931/* 1974/*
@@ -1938,7 +1981,6 @@ int sock_common_setsockopt(struct socket *sock, int level, int optname,
1938 1981
1939 return sk->sk_prot->setsockopt(sk, level, optname, optval, optlen); 1982 return sk->sk_prot->setsockopt(sk, level, optname, optval, optlen);
1940} 1983}
1941
1942EXPORT_SYMBOL(sock_common_setsockopt); 1984EXPORT_SYMBOL(sock_common_setsockopt);
1943 1985
1944#ifdef CONFIG_COMPAT 1986#ifdef CONFIG_COMPAT
@@ -1989,7 +2031,6 @@ void sk_common_release(struct sock *sk)
1989 sk_refcnt_debug_release(sk); 2031 sk_refcnt_debug_release(sk);
1990 sock_put(sk); 2032 sock_put(sk);
1991} 2033}
1992
1993EXPORT_SYMBOL(sk_common_release); 2034EXPORT_SYMBOL(sk_common_release);
1994 2035
1995static DEFINE_RWLOCK(proto_list_lock); 2036static DEFINE_RWLOCK(proto_list_lock);
@@ -2171,7 +2212,6 @@ out_free_sock_slab:
2171out: 2212out:
2172 return -ENOBUFS; 2213 return -ENOBUFS;
2173} 2214}
2174
2175EXPORT_SYMBOL(proto_register); 2215EXPORT_SYMBOL(proto_register);
2176 2216
2177void proto_unregister(struct proto *prot) 2217void proto_unregister(struct proto *prot)
@@ -2198,7 +2238,6 @@ void proto_unregister(struct proto *prot)
2198 prot->twsk_prot->twsk_slab = NULL; 2238 prot->twsk_prot->twsk_slab = NULL;
2199 } 2239 }
2200} 2240}
2201
2202EXPORT_SYMBOL(proto_unregister); 2241EXPORT_SYMBOL(proto_unregister);
2203 2242
2204#ifdef CONFIG_PROC_FS 2243#ifdef CONFIG_PROC_FS
@@ -2324,33 +2363,3 @@ static int __init proto_init(void)
2324subsys_initcall(proto_init); 2363subsys_initcall(proto_init);
2325 2364
2326#endif /* PROC_FS */ 2365#endif /* PROC_FS */
2327
2328EXPORT_SYMBOL(sk_alloc);
2329EXPORT_SYMBOL(sk_free);
2330EXPORT_SYMBOL(sk_send_sigurg);
2331EXPORT_SYMBOL(sock_alloc_send_skb);
2332EXPORT_SYMBOL(sock_init_data);
2333EXPORT_SYMBOL(sock_kfree_s);
2334EXPORT_SYMBOL(sock_kmalloc);
2335EXPORT_SYMBOL(sock_no_accept);
2336EXPORT_SYMBOL(sock_no_bind);
2337EXPORT_SYMBOL(sock_no_connect);
2338EXPORT_SYMBOL(sock_no_getname);
2339EXPORT_SYMBOL(sock_no_getsockopt);
2340EXPORT_SYMBOL(sock_no_ioctl);
2341EXPORT_SYMBOL(sock_no_listen);
2342EXPORT_SYMBOL(sock_no_mmap);
2343EXPORT_SYMBOL(sock_no_poll);
2344EXPORT_SYMBOL(sock_no_recvmsg);
2345EXPORT_SYMBOL(sock_no_sendmsg);
2346EXPORT_SYMBOL(sock_no_sendpage);
2347EXPORT_SYMBOL(sock_no_setsockopt);
2348EXPORT_SYMBOL(sock_no_shutdown);
2349EXPORT_SYMBOL(sock_no_socketpair);
2350EXPORT_SYMBOL(sock_rfree);
2351EXPORT_SYMBOL(sock_setsockopt);
2352EXPORT_SYMBOL(sock_wfree);
2353EXPORT_SYMBOL(sock_wmalloc);
2354EXPORT_SYMBOL(sock_i_uid);
2355EXPORT_SYMBOL(sock_i_ino);
2356EXPORT_SYMBOL(sysctl_optmem_max);