#define SCM_TIMESTAMPING_OPT_STATS 54
+#define SO_MEMINFO 55
+
#endif /* _UAPI_ASM_SOCKET_H */
#define SCM_TIMESTAMPING_OPT_STATS 54
+#define SO_MEMINFO 55
+
#endif /* _UAPI__ASM_AVR32_SOCKET_H */
#define SCM_TIMESTAMPING_OPT_STATS 54
+#define SO_MEMINFO 55
+
#endif /* _ASM_SOCKET_H */
#define SCM_TIMESTAMPING_OPT_STATS 54
+#define SO_MEMINFO 55
+
#endif /* _ASM_IA64_SOCKET_H */
#define SCM_TIMESTAMPING_OPT_STATS 54
+#define SO_MEMINFO 55
+
#endif /* _ASM_M32R_SOCKET_H */
#define SCM_TIMESTAMPING_OPT_STATS 54
+#define SO_MEMINFO 55
+
+
#endif /* _UAPI_ASM_SOCKET_H */
#define SCM_TIMESTAMPING_OPT_STATS 54
+#define SO_MEMINFO 55
+
#endif /* _ASM_SOCKET_H */
#define SCM_TIMESTAMPING_OPT_STATS 0x402F
+#define SO_MEMINFO 0x4030
+
#endif /* _UAPI_ASM_SOCKET_H */
#define SCM_TIMESTAMPING_OPT_STATS 54
+#define SO_MEMINFO 55
+
#endif /* _ASM_POWERPC_SOCKET_H */
#define SCM_TIMESTAMPING_OPT_STATS 54
+#define SO_MEMINFO 55
+
#endif /* _ASM_SOCKET_H */
#define SCM_TIMESTAMPING_OPT_STATS 0x0038
+#define SO_MEMINFO 0x0039
+
/* Security levels - as per NRL IPv6 - don't actually do anything */
#define SO_SECURITY_AUTHENTICATION 0x5001
#define SO_SECURITY_ENCRYPTION_TRANSPORT 0x5002
#define SCM_TIMESTAMPING_OPT_STATS 54
+#define SO_MEMINFO 55
+
#endif /* _XTENSA_SOCKET_H */
bool sk_capable(const struct sock *sk, int cap);
bool sk_net_capable(const struct sock *sk, int cap);
+void sk_get_meminfo(const struct sock *sk, u32 *meminfo);
+
extern __u32 sysctl_wmem_max;
extern __u32 sysctl_rmem_max;
#define SCM_TIMESTAMPING_OPT_STATS 54
+#define SO_MEMINFO 55
+
#endif /* __ASM_GENERIC_SOCKET_H */
v.val = sk->sk_incoming_cpu;
break;
+ case SO_MEMINFO:
+ {
+ u32 meminfo[SK_MEMINFO_VARS];
+
+ if (get_user(len, optlen))
+ return -EFAULT;
+
+ sk_get_meminfo(sk, meminfo);
+
+ len = min_t(unsigned int, len, sizeof(meminfo));
+ if (copy_to_user(optval, &meminfo, len))
+ return -EFAULT;
+
+ goto lenout;
+ }
default:
/* We implement the SO_SNDLOWAT etc to not be settable
* (1003.1g 7).
}
EXPORT_SYMBOL(sk_common_release);
+void sk_get_meminfo(const struct sock *sk, u32 *mem)
+{
+ memset(mem, 0, sizeof(*mem) * SK_MEMINFO_VARS);
+
+ mem[SK_MEMINFO_RMEM_ALLOC] = sk_rmem_alloc_get(sk);
+ mem[SK_MEMINFO_RCVBUF] = sk->sk_rcvbuf;
+ mem[SK_MEMINFO_WMEM_ALLOC] = sk_wmem_alloc_get(sk);
+ mem[SK_MEMINFO_SNDBUF] = sk->sk_sndbuf;
+ mem[SK_MEMINFO_FWD_ALLOC] = sk->sk_forward_alloc;
+ mem[SK_MEMINFO_WMEM_QUEUED] = sk->sk_wmem_queued;
+ mem[SK_MEMINFO_OPTMEM] = atomic_read(&sk->sk_omem_alloc);
+ mem[SK_MEMINFO_BACKLOG] = sk->sk_backlog.len;
+ mem[SK_MEMINFO_DROPS] = atomic_read(&sk->sk_drops);
+}
+
#ifdef CONFIG_PROC_FS
#define PROTO_INUSE_NR 64 /* should be enough for the first time */
struct prot_inuse {
{
u32 mem[SK_MEMINFO_VARS];
- mem[SK_MEMINFO_RMEM_ALLOC] = sk_rmem_alloc_get(sk);
- mem[SK_MEMINFO_RCVBUF] = sk->sk_rcvbuf;
- mem[SK_MEMINFO_WMEM_ALLOC] = sk_wmem_alloc_get(sk);
- mem[SK_MEMINFO_SNDBUF] = sk->sk_sndbuf;
- mem[SK_MEMINFO_FWD_ALLOC] = sk->sk_forward_alloc;
- mem[SK_MEMINFO_WMEM_QUEUED] = sk->sk_wmem_queued;
- mem[SK_MEMINFO_OPTMEM] = atomic_read(&sk->sk_omem_alloc);
- mem[SK_MEMINFO_BACKLOG] = sk->sk_backlog.len;
- mem[SK_MEMINFO_DROPS] = atomic_read(&sk->sk_drops);
+ sk_get_meminfo(sk, mem);
return nla_put(skb, attrtype, sizeof(mem), &mem);
}