diff options
author | YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> | 2007-02-09 09:24:36 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-02-11 02:19:25 -0500 |
commit | 4ec93edb14fe5fdee9fae6335f2cbba204627eac (patch) | |
tree | b768f96942b5d19f5bc36b47262c42a8a7acdd7f /net/core/sock.c | |
parent | 9d6f229fc45b6ac268020c0c8eff29e94bb34381 (diff) |
[NET] CORE: Fix whitespace errors.
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/sock.c')
-rw-r--r-- | net/core/sock.c | 148 |
1 files changed, 74 insertions, 74 deletions
diff --git a/net/core/sock.c b/net/core/sock.c index 0ed5b4f0bc4..1e35d9973f5 100644 --- a/net/core/sock.c +++ b/net/core/sock.c | |||
@@ -34,7 +34,7 @@ | |||
34 | * Alan Cox : TCP ack handling is buggy, the DESTROY timer | 34 | * Alan Cox : TCP ack handling is buggy, the DESTROY timer |
35 | * was buggy. Put a remove_sock() in the handler | 35 | * was buggy. Put a remove_sock() in the handler |
36 | * for memory when we hit 0. Also altered the timer | 36 | * for memory when we hit 0. Also altered the timer |
37 | * code. The ACK stuff can wait and needs major | 37 | * code. The ACK stuff can wait and needs major |
38 | * TCP layer surgery. | 38 | * TCP layer surgery. |
39 | * Alan Cox : Fixed TCP ack bug, removed remove sock | 39 | * Alan Cox : Fixed TCP ack bug, removed remove sock |
40 | * and fixed timer/inet_bh race. | 40 | * and fixed timer/inet_bh race. |
@@ -217,8 +217,8 @@ static void sock_warn_obsolete_bsdism(const char *name) | |||
217 | { | 217 | { |
218 | static int warned; | 218 | static int warned; |
219 | static char warncomm[TASK_COMM_LEN]; | 219 | static char warncomm[TASK_COMM_LEN]; |
220 | if (strcmp(warncomm, current->comm) && warned < 5) { | 220 | if (strcmp(warncomm, current->comm) && warned < 5) { |
221 | strcpy(warncomm, current->comm); | 221 | strcpy(warncomm, current->comm); |
222 | printk(KERN_WARNING "process `%s' is using obsolete " | 222 | printk(KERN_WARNING "process `%s' is using obsolete " |
223 | "%s SO_BSDCOMPAT\n", warncomm, name); | 223 | "%s SO_BSDCOMPAT\n", warncomm, name); |
224 | warned++; | 224 | warned++; |
@@ -226,8 +226,8 @@ static void sock_warn_obsolete_bsdism(const char *name) | |||
226 | } | 226 | } |
227 | 227 | ||
228 | static void sock_disable_timestamp(struct sock *sk) | 228 | static void sock_disable_timestamp(struct sock *sk) |
229 | { | 229 | { |
230 | if (sock_flag(sk, SOCK_TIMESTAMP)) { | 230 | if (sock_flag(sk, SOCK_TIMESTAMP)) { |
231 | sock_reset_flag(sk, SOCK_TIMESTAMP); | 231 | sock_reset_flag(sk, SOCK_TIMESTAMP); |
232 | net_disable_timestamp(); | 232 | net_disable_timestamp(); |
233 | } | 233 | } |
@@ -347,7 +347,7 @@ int sock_setsockopt(struct socket *sock, int level, int optname, | |||
347 | int valbool; | 347 | int valbool; |
348 | struct linger ling; | 348 | struct linger ling; |
349 | int ret = 0; | 349 | int ret = 0; |
350 | 350 | ||
351 | /* | 351 | /* |
352 | * Options without arguments | 352 | * Options without arguments |
353 | */ | 353 | */ |
@@ -360,20 +360,20 @@ int sock_setsockopt(struct socket *sock, int level, int optname, | |||
360 | return 0; | 360 | return 0; |
361 | } | 361 | } |
362 | #endif | 362 | #endif |
363 | 363 | ||
364 | if(optlen<sizeof(int)) | 364 | if(optlen<sizeof(int)) |
365 | return(-EINVAL); | 365 | return(-EINVAL); |
366 | 366 | ||
367 | if (get_user(val, (int __user *)optval)) | 367 | if (get_user(val, (int __user *)optval)) |
368 | return -EFAULT; | 368 | return -EFAULT; |
369 | 369 | ||
370 | valbool = val?1:0; | 370 | valbool = val?1:0; |
371 | 371 | ||
372 | lock_sock(sk); | 372 | lock_sock(sk); |
373 | 373 | ||
374 | switch(optname) | 374 | switch(optname) |
375 | { | 375 | { |
376 | case SO_DEBUG: | 376 | case SO_DEBUG: |
377 | if(val && !capable(CAP_NET_ADMIN)) | 377 | if(val && !capable(CAP_NET_ADMIN)) |
378 | { | 378 | { |
379 | ret = -EACCES; | 379 | ret = -EACCES; |
@@ -389,7 +389,7 @@ int sock_setsockopt(struct socket *sock, int level, int optname, | |||
389 | case SO_TYPE: | 389 | case SO_TYPE: |
390 | case SO_ERROR: | 390 | case SO_ERROR: |
391 | ret = -ENOPROTOOPT; | 391 | ret = -ENOPROTOOPT; |
392 | break; | 392 | break; |
393 | case SO_DONTROUTE: | 393 | case SO_DONTROUTE: |
394 | if (valbool) | 394 | if (valbool) |
395 | sock_set_flag(sk, SOCK_LOCALROUTE); | 395 | sock_set_flag(sk, SOCK_LOCALROUTE); |
@@ -404,7 +404,7 @@ int sock_setsockopt(struct socket *sock, int level, int optname, | |||
404 | about it this is right. Otherwise apps have to | 404 | about it this is right. Otherwise apps have to |
405 | play 'guess the biggest size' games. RCVBUF/SNDBUF | 405 | play 'guess the biggest size' games. RCVBUF/SNDBUF |
406 | are treated in BSD as hints */ | 406 | are treated in BSD as hints */ |
407 | 407 | ||
408 | if (val > sysctl_wmem_max) | 408 | if (val > sysctl_wmem_max) |
409 | val = sysctl_wmem_max; | 409 | val = sysctl_wmem_max; |
410 | set_sndbuf: | 410 | set_sndbuf: |
@@ -433,7 +433,7 @@ set_sndbuf: | |||
433 | about it this is right. Otherwise apps have to | 433 | about it this is right. Otherwise apps have to |
434 | play 'guess the biggest size' games. RCVBUF/SNDBUF | 434 | play 'guess the biggest size' games. RCVBUF/SNDBUF |
435 | are treated in BSD as hints */ | 435 | are treated in BSD as hints */ |
436 | 436 | ||
437 | if (val > sysctl_rmem_max) | 437 | if (val > sysctl_rmem_max) |
438 | val = sysctl_rmem_max; | 438 | val = sysctl_rmem_max; |
439 | set_rcvbuf: | 439 | set_rcvbuf: |
@@ -474,16 +474,16 @@ set_rcvbuf: | |||
474 | sock_valbool_flag(sk, SOCK_KEEPOPEN, valbool); | 474 | sock_valbool_flag(sk, SOCK_KEEPOPEN, valbool); |
475 | break; | 475 | break; |
476 | 476 | ||
477 | case SO_OOBINLINE: | 477 | case SO_OOBINLINE: |
478 | sock_valbool_flag(sk, SOCK_URGINLINE, valbool); | 478 | sock_valbool_flag(sk, SOCK_URGINLINE, valbool); |
479 | break; | 479 | break; |
480 | 480 | ||
481 | case SO_NO_CHECK: | 481 | case SO_NO_CHECK: |
482 | sk->sk_no_check = valbool; | 482 | sk->sk_no_check = valbool; |
483 | break; | 483 | break; |
484 | 484 | ||
485 | case SO_PRIORITY: | 485 | case SO_PRIORITY: |
486 | if ((val >= 0 && val <= 6) || capable(CAP_NET_ADMIN)) | 486 | if ((val >= 0 && val <= 6) || capable(CAP_NET_ADMIN)) |
487 | sk->sk_priority = val; | 487 | sk->sk_priority = val; |
488 | else | 488 | else |
489 | ret = -EPERM; | 489 | ret = -EPERM; |
@@ -547,9 +547,9 @@ set_rcvbuf: | |||
547 | #ifdef CONFIG_NETDEVICES | 547 | #ifdef CONFIG_NETDEVICES |
548 | case SO_BINDTODEVICE: | 548 | case SO_BINDTODEVICE: |
549 | { | 549 | { |
550 | char devname[IFNAMSIZ]; | 550 | char devname[IFNAMSIZ]; |
551 | 551 | ||
552 | /* Sorry... */ | 552 | /* Sorry... */ |
553 | if (!capable(CAP_NET_RAW)) { | 553 | if (!capable(CAP_NET_RAW)) { |
554 | ret = -EPERM; | 554 | ret = -EPERM; |
555 | break; | 555 | break; |
@@ -557,9 +557,9 @@ set_rcvbuf: | |||
557 | 557 | ||
558 | /* Bind this socket to a particular device like "eth0", | 558 | /* Bind this socket to a particular device like "eth0", |
559 | * as specified in the passed interface name. If the | 559 | * as specified in the passed interface name. If the |
560 | * name is "" or the option length is zero the socket | 560 | * name is "" or the option length is zero the socket |
561 | * is not bound. | 561 | * is not bound. |
562 | */ | 562 | */ |
563 | 563 | ||
564 | if (!valbool) { | 564 | if (!valbool) { |
565 | sk->sk_bound_dev_if = 0; | 565 | sk->sk_bound_dev_if = 0; |
@@ -608,7 +608,7 @@ set_rcvbuf: | |||
608 | case SO_DETACH_FILTER: | 608 | case SO_DETACH_FILTER: |
609 | rcu_read_lock_bh(); | 609 | rcu_read_lock_bh(); |
610 | filter = rcu_dereference(sk->sk_filter); | 610 | filter = rcu_dereference(sk->sk_filter); |
611 | if (filter) { | 611 | if (filter) { |
612 | rcu_assign_pointer(sk->sk_filter, NULL); | 612 | rcu_assign_pointer(sk->sk_filter, NULL); |
613 | sk_filter_release(sk, filter); | 613 | sk_filter_release(sk, filter); |
614 | rcu_read_unlock_bh(); | 614 | rcu_read_unlock_bh(); |
@@ -628,9 +628,9 @@ set_rcvbuf: | |||
628 | /* We implement the SO_SNDLOWAT etc to | 628 | /* We implement the SO_SNDLOWAT etc to |
629 | not be settable (1003.1g 5.3) */ | 629 | not be settable (1003.1g 5.3) */ |
630 | default: | 630 | default: |
631 | ret = -ENOPROTOOPT; | 631 | ret = -ENOPROTOOPT; |
632 | break; | 632 | break; |
633 | } | 633 | } |
634 | release_sock(sk); | 634 | release_sock(sk); |
635 | return ret; | 635 | return ret; |
636 | } | 636 | } |
@@ -640,32 +640,32 @@ int sock_getsockopt(struct socket *sock, int level, int optname, | |||
640 | char __user *optval, int __user *optlen) | 640 | char __user *optval, int __user *optlen) |
641 | { | 641 | { |
642 | struct sock *sk = sock->sk; | 642 | struct sock *sk = sock->sk; |
643 | 643 | ||
644 | union | 644 | union |
645 | { | 645 | { |
646 | int val; | 646 | int val; |
647 | struct linger ling; | 647 | struct linger ling; |
648 | struct timeval tm; | 648 | struct timeval tm; |
649 | } v; | 649 | } v; |
650 | 650 | ||
651 | unsigned int lv = sizeof(int); | 651 | unsigned int lv = sizeof(int); |
652 | int len; | 652 | int len; |
653 | 653 | ||
654 | if(get_user(len,optlen)) | 654 | if(get_user(len,optlen)) |
655 | return -EFAULT; | 655 | return -EFAULT; |
656 | if(len < 0) | 656 | if(len < 0) |
657 | return -EINVAL; | 657 | return -EINVAL; |
658 | 658 | ||
659 | switch(optname) | 659 | switch(optname) |
660 | { | 660 | { |
661 | case SO_DEBUG: | 661 | case SO_DEBUG: |
662 | v.val = sock_flag(sk, SOCK_DBG); | 662 | v.val = sock_flag(sk, SOCK_DBG); |
663 | break; | 663 | break; |
664 | 664 | ||
665 | case SO_DONTROUTE: | 665 | case SO_DONTROUTE: |
666 | v.val = sock_flag(sk, SOCK_LOCALROUTE); | 666 | v.val = sock_flag(sk, SOCK_LOCALROUTE); |
667 | break; | 667 | break; |
668 | 668 | ||
669 | case SO_BROADCAST: | 669 | case SO_BROADCAST: |
670 | v.val = !!sock_flag(sk, SOCK_BROADCAST); | 670 | v.val = !!sock_flag(sk, SOCK_BROADCAST); |
671 | break; | 671 | break; |
@@ -673,7 +673,7 @@ int sock_getsockopt(struct socket *sock, int level, int optname, | |||
673 | case SO_SNDBUF: | 673 | case SO_SNDBUF: |
674 | v.val = sk->sk_sndbuf; | 674 | v.val = sk->sk_sndbuf; |
675 | break; | 675 | break; |
676 | 676 | ||
677 | case SO_RCVBUF: | 677 | case SO_RCVBUF: |
678 | v.val = sk->sk_rcvbuf; | 678 | v.val = sk->sk_rcvbuf; |
679 | break; | 679 | break; |
@@ -687,7 +687,7 @@ int sock_getsockopt(struct socket *sock, int level, int optname, | |||
687 | break; | 687 | break; |
688 | 688 | ||
689 | case SO_TYPE: | 689 | case SO_TYPE: |
690 | v.val = sk->sk_type; | 690 | v.val = sk->sk_type; |
691 | break; | 691 | break; |
692 | 692 | ||
693 | case SO_ERROR: | 693 | case SO_ERROR: |
@@ -699,7 +699,7 @@ int sock_getsockopt(struct socket *sock, int level, int optname, | |||
699 | case SO_OOBINLINE: | 699 | case SO_OOBINLINE: |
700 | v.val = !!sock_flag(sk, SOCK_URGINLINE); | 700 | v.val = !!sock_flag(sk, SOCK_URGINLINE); |
701 | break; | 701 | break; |
702 | 702 | ||
703 | case SO_NO_CHECK: | 703 | case SO_NO_CHECK: |
704 | v.val = sk->sk_no_check; | 704 | v.val = sk->sk_no_check; |
705 | break; | 705 | break; |
@@ -707,13 +707,13 @@ int sock_getsockopt(struct socket *sock, int level, int optname, | |||
707 | case SO_PRIORITY: | 707 | case SO_PRIORITY: |
708 | v.val = sk->sk_priority; | 708 | v.val = sk->sk_priority; |
709 | break; | 709 | break; |
710 | 710 | ||
711 | case SO_LINGER: | 711 | case SO_LINGER: |
712 | lv = sizeof(v.ling); | 712 | lv = sizeof(v.ling); |
713 | v.ling.l_onoff = !!sock_flag(sk, SOCK_LINGER); | 713 | v.ling.l_onoff = !!sock_flag(sk, SOCK_LINGER); |
714 | v.ling.l_linger = sk->sk_lingertime / HZ; | 714 | v.ling.l_linger = sk->sk_lingertime / HZ; |
715 | break; | 715 | break; |
716 | 716 | ||
717 | case SO_BSDCOMPAT: | 717 | case SO_BSDCOMPAT: |
718 | sock_warn_obsolete_bsdism("getsockopt"); | 718 | sock_warn_obsolete_bsdism("getsockopt"); |
719 | break; | 719 | break; |
@@ -750,7 +750,7 @@ int sock_getsockopt(struct socket *sock, int level, int optname, | |||
750 | 750 | ||
751 | case SO_SNDLOWAT: | 751 | case SO_SNDLOWAT: |
752 | v.val=1; | 752 | v.val=1; |
753 | break; | 753 | break; |
754 | 754 | ||
755 | case SO_PASSCRED: | 755 | case SO_PASSCRED: |
756 | v.val = test_bit(SOCK_PASSCRED, &sock->flags) ? 1 : 0; | 756 | v.val = test_bit(SOCK_PASSCRED, &sock->flags) ? 1 : 0; |
@@ -798,9 +798,9 @@ int sock_getsockopt(struct socket *sock, int level, int optname, | |||
798 | if (copy_to_user(optval, &v, len)) | 798 | if (copy_to_user(optval, &v, len)) |
799 | return -EFAULT; | 799 | return -EFAULT; |
800 | lenout: | 800 | lenout: |
801 | if (put_user(len, optlen)) | 801 | if (put_user(len, optlen)) |
802 | return -EFAULT; | 802 | return -EFAULT; |
803 | return 0; | 803 | return 0; |
804 | } | 804 | } |
805 | 805 | ||
806 | /* | 806 | /* |
@@ -846,7 +846,7 @@ struct sock *sk_alloc(int family, gfp_t priority, | |||
846 | sk->sk_prot = sk->sk_prot_creator = prot; | 846 | sk->sk_prot = sk->sk_prot_creator = prot; |
847 | sock_lock_init(sk); | 847 | sock_lock_init(sk); |
848 | } | 848 | } |
849 | 849 | ||
850 | if (security_sk_alloc(sk, family, priority)) | 850 | if (security_sk_alloc(sk, family, priority)) |
851 | goto out_free; | 851 | goto out_free; |
852 | 852 | ||
@@ -988,8 +988,8 @@ void __init sk_init(void) | |||
988 | */ | 988 | */ |
989 | 989 | ||
990 | 990 | ||
991 | /* | 991 | /* |
992 | * Write buffer destructor automatically called from kfree_skb. | 992 | * Write buffer destructor automatically called from kfree_skb. |
993 | */ | 993 | */ |
994 | void sock_wfree(struct sk_buff *skb) | 994 | void sock_wfree(struct sk_buff *skb) |
995 | { | 995 | { |
@@ -1002,8 +1002,8 @@ void sock_wfree(struct sk_buff *skb) | |||
1002 | sock_put(sk); | 1002 | sock_put(sk); |
1003 | } | 1003 | } |
1004 | 1004 | ||
1005 | /* | 1005 | /* |
1006 | * Read buffer destructor automatically called from kfree_skb. | 1006 | * Read buffer destructor automatically called from kfree_skb. |
1007 | */ | 1007 | */ |
1008 | void sock_rfree(struct sk_buff *skb) | 1008 | void sock_rfree(struct sk_buff *skb) |
1009 | { | 1009 | { |
@@ -1051,7 +1051,7 @@ struct sk_buff *sock_wmalloc(struct sock *sk, unsigned long size, int force, | |||
1051 | 1051 | ||
1052 | /* | 1052 | /* |
1053 | * Allocate a skb from the socket's receive buffer. | 1053 | * Allocate a skb from the socket's receive buffer. |
1054 | */ | 1054 | */ |
1055 | struct sk_buff *sock_rmalloc(struct sock *sk, unsigned long size, int force, | 1055 | struct sk_buff *sock_rmalloc(struct sock *sk, unsigned long size, int force, |
1056 | gfp_t priority) | 1056 | gfp_t priority) |
1057 | { | 1057 | { |
@@ -1065,16 +1065,16 @@ struct sk_buff *sock_rmalloc(struct sock *sk, unsigned long size, int force, | |||
1065 | return NULL; | 1065 | return NULL; |
1066 | } | 1066 | } |
1067 | 1067 | ||
1068 | /* | 1068 | /* |
1069 | * Allocate a memory block from the socket's option memory buffer. | 1069 | * Allocate a memory block from the socket's option memory buffer. |
1070 | */ | 1070 | */ |
1071 | void *sock_kmalloc(struct sock *sk, int size, gfp_t priority) | 1071 | void *sock_kmalloc(struct sock *sk, int size, gfp_t priority) |
1072 | { | 1072 | { |
1073 | if ((unsigned)size <= sysctl_optmem_max && | 1073 | if ((unsigned)size <= sysctl_optmem_max && |
1074 | atomic_read(&sk->sk_omem_alloc) + size < sysctl_optmem_max) { | 1074 | atomic_read(&sk->sk_omem_alloc) + size < sysctl_optmem_max) { |
1075 | void *mem; | 1075 | void *mem; |
1076 | /* First do the add, to avoid the race if kmalloc | 1076 | /* First do the add, to avoid the race if kmalloc |
1077 | * might sleep. | 1077 | * might sleep. |
1078 | */ | 1078 | */ |
1079 | atomic_add(size, &sk->sk_omem_alloc); | 1079 | atomic_add(size, &sk->sk_omem_alloc); |
1080 | mem = kmalloc(size, priority); | 1080 | mem = kmalloc(size, priority); |
@@ -1210,7 +1210,7 @@ failure: | |||
1210 | return NULL; | 1210 | return NULL; |
1211 | } | 1211 | } |
1212 | 1212 | ||
1213 | struct sk_buff *sock_alloc_send_skb(struct sock *sk, unsigned long size, | 1213 | struct sk_buff *sock_alloc_send_skb(struct sock *sk, unsigned long size, |
1214 | int noblock, int *errcode) | 1214 | int noblock, int *errcode) |
1215 | { | 1215 | { |
1216 | return sock_alloc_send_pskb(sk, size, 0, noblock, errcode); | 1216 | return sock_alloc_send_pskb(sk, size, 0, noblock, errcode); |
@@ -1298,7 +1298,7 @@ int sock_no_bind(struct socket *sock, struct sockaddr *saddr, int len) | |||
1298 | return -EOPNOTSUPP; | 1298 | return -EOPNOTSUPP; |
1299 | } | 1299 | } |
1300 | 1300 | ||
1301 | int sock_no_connect(struct socket *sock, struct sockaddr *saddr, | 1301 | int sock_no_connect(struct socket *sock, struct sockaddr *saddr, |
1302 | int len, int flags) | 1302 | int len, int flags) |
1303 | { | 1303 | { |
1304 | return -EOPNOTSUPP; | 1304 | return -EOPNOTSUPP; |
@@ -1314,7 +1314,7 @@ int sock_no_accept(struct socket *sock, struct socket *newsock, int flags) | |||
1314 | return -EOPNOTSUPP; | 1314 | return -EOPNOTSUPP; |
1315 | } | 1315 | } |
1316 | 1316 | ||
1317 | int sock_no_getname(struct socket *sock, struct sockaddr *saddr, | 1317 | int sock_no_getname(struct socket *sock, struct sockaddr *saddr, |
1318 | int *len, int peer) | 1318 | int *len, int peer) |
1319 | { | 1319 | { |
1320 | return -EOPNOTSUPP; | 1320 | return -EOPNOTSUPP; |
@@ -1400,7 +1400,7 @@ static void sock_def_error_report(struct sock *sk) | |||
1400 | read_lock(&sk->sk_callback_lock); | 1400 | read_lock(&sk->sk_callback_lock); |
1401 | if (sk->sk_sleep && waitqueue_active(sk->sk_sleep)) | 1401 | if (sk->sk_sleep && waitqueue_active(sk->sk_sleep)) |
1402 | wake_up_interruptible(sk->sk_sleep); | 1402 | wake_up_interruptible(sk->sk_sleep); |
1403 | sk_wake_async(sk,0,POLL_ERR); | 1403 | sk_wake_async(sk,0,POLL_ERR); |
1404 | read_unlock(&sk->sk_callback_lock); | 1404 | read_unlock(&sk->sk_callback_lock); |
1405 | } | 1405 | } |
1406 | 1406 | ||
@@ -1473,7 +1473,7 @@ void sock_init_data(struct socket *sock, struct sock *sk) | |||
1473 | sk->sk_send_head = NULL; | 1473 | sk->sk_send_head = NULL; |
1474 | 1474 | ||
1475 | init_timer(&sk->sk_timer); | 1475 | init_timer(&sk->sk_timer); |
1476 | 1476 | ||
1477 | sk->sk_allocation = GFP_KERNEL; | 1477 | sk->sk_allocation = GFP_KERNEL; |
1478 | sk->sk_rcvbuf = sysctl_rmem_default; | 1478 | sk->sk_rcvbuf = sysctl_rmem_default; |
1479 | sk->sk_sndbuf = sysctl_wmem_default; | 1479 | sk->sk_sndbuf = sysctl_wmem_default; |
@@ -1553,26 +1553,26 @@ void fastcall release_sock(struct sock *sk) | |||
1553 | EXPORT_SYMBOL(release_sock); | 1553 | EXPORT_SYMBOL(release_sock); |
1554 | 1554 | ||
1555 | int sock_get_timestamp(struct sock *sk, struct timeval __user *userstamp) | 1555 | int sock_get_timestamp(struct sock *sk, struct timeval __user *userstamp) |
1556 | { | 1556 | { |
1557 | if (!sock_flag(sk, SOCK_TIMESTAMP)) | 1557 | if (!sock_flag(sk, SOCK_TIMESTAMP)) |
1558 | sock_enable_timestamp(sk); | 1558 | sock_enable_timestamp(sk); |
1559 | if (sk->sk_stamp.tv_sec == -1) | 1559 | if (sk->sk_stamp.tv_sec == -1) |
1560 | return -ENOENT; | 1560 | return -ENOENT; |
1561 | if (sk->sk_stamp.tv_sec == 0) | 1561 | if (sk->sk_stamp.tv_sec == 0) |
1562 | do_gettimeofday(&sk->sk_stamp); | 1562 | do_gettimeofday(&sk->sk_stamp); |
1563 | return copy_to_user(userstamp, &sk->sk_stamp, sizeof(struct timeval)) ? | 1563 | return copy_to_user(userstamp, &sk->sk_stamp, sizeof(struct timeval)) ? |
1564 | -EFAULT : 0; | 1564 | -EFAULT : 0; |
1565 | } | 1565 | } |
1566 | EXPORT_SYMBOL(sock_get_timestamp); | 1566 | EXPORT_SYMBOL(sock_get_timestamp); |
1567 | 1567 | ||
1568 | void sock_enable_timestamp(struct sock *sk) | 1568 | void sock_enable_timestamp(struct sock *sk) |
1569 | { | 1569 | { |
1570 | if (!sock_flag(sk, SOCK_TIMESTAMP)) { | 1570 | if (!sock_flag(sk, SOCK_TIMESTAMP)) { |
1571 | sock_set_flag(sk, SOCK_TIMESTAMP); | 1571 | sock_set_flag(sk, SOCK_TIMESTAMP); |
1572 | net_enable_timestamp(); | 1572 | net_enable_timestamp(); |
1573 | } | 1573 | } |
1574 | } | 1574 | } |
1575 | EXPORT_SYMBOL(sock_enable_timestamp); | 1575 | EXPORT_SYMBOL(sock_enable_timestamp); |
1576 | 1576 | ||
1577 | /* | 1577 | /* |
1578 | * Get a socket option on an socket. | 1578 | * Get a socket option on an socket. |