From 9ca8dbcc65cfc63d6f5ef3312a33184e1d726e00 Mon Sep 17 00:00:00 2001 From: Yunhong Jiang Date: Tue, 4 Aug 2015 12:17:53 -0700 Subject: Add the rt linux 4.1.3-rt3 as base Import the rt linux 4.1.3-rt3 as OPNFV kvm base. It's from git://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-rt-devel.git linux-4.1.y-rt and the base is: commit 0917f823c59692d751951bf5ea699a2d1e2f26a2 Author: Sebastian Andrzej Siewior Date: Sat Jul 25 12:13:34 2015 +0200 Prepare v4.1.3-rt3 Signed-off-by: Sebastian Andrzej Siewior We lose all the git history this way and it's not good. We should apply another opnfv project repo in future. Change-Id: I87543d81c9df70d99c5001fbdf646b202c19f423 Signed-off-by: Yunhong Jiang --- kernel/include/net/af_unix.h | 81 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 kernel/include/net/af_unix.h (limited to 'kernel/include/net/af_unix.h') diff --git a/kernel/include/net/af_unix.h b/kernel/include/net/af_unix.h new file mode 100644 index 000000000..a175ba4a7 --- /dev/null +++ b/kernel/include/net/af_unix.h @@ -0,0 +1,81 @@ +#ifndef __LINUX_NET_AFUNIX_H +#define __LINUX_NET_AFUNIX_H + +#include +#include +#include +#include + +void unix_inflight(struct file *fp); +void unix_notinflight(struct file *fp); +void unix_gc(void); +void wait_for_unix_gc(void); +struct sock *unix_get_socket(struct file *filp); +struct sock *unix_peer_get(struct sock *); + +#define UNIX_HASH_SIZE 256 +#define UNIX_HASH_BITS 8 + +extern unsigned int unix_tot_inflight; +extern spinlock_t unix_table_lock; +extern struct hlist_head unix_socket_table[2 * UNIX_HASH_SIZE]; + +struct unix_address { + atomic_t refcnt; + int len; + unsigned int hash; + struct sockaddr_un name[0]; +}; + +struct unix_skb_parms { + struct pid *pid; /* Skb credentials */ + kuid_t uid; + kgid_t gid; + struct scm_fp_list *fp; /* Passed files */ +#ifdef CONFIG_SECURITY_NETWORK + u32 secid; /* Security ID */ +#endif + u32 consumed; +}; + +#define UNIXCB(skb) (*(struct unix_skb_parms *)&((skb)->cb)) +#define UNIXSID(skb) (&UNIXCB((skb)).secid) + +#define unix_state_lock(s) spin_lock(&unix_sk(s)->lock) +#define unix_state_unlock(s) spin_unlock(&unix_sk(s)->lock) +#define unix_state_lock_nested(s) \ + spin_lock_nested(&unix_sk(s)->lock, \ + SINGLE_DEPTH_NESTING) + +/* The AF_UNIX socket */ +struct unix_sock { + /* WARNING: sk has to be the first member */ + struct sock sk; + struct unix_address *addr; + struct path path; + struct mutex readlock; + struct sock *peer; + struct list_head link; + atomic_long_t inflight; + spinlock_t lock; + unsigned char recursion_level; + unsigned long gc_flags; +#define UNIX_GC_CANDIDATE 0 +#define UNIX_GC_MAYBE_CYCLE 1 + struct socket_wq peer_wq; +}; +#define unix_sk(__sk) ((struct unix_sock *)__sk) + +#define peer_wait peer_wq.wait + +long unix_inq_len(struct sock *sk); +long unix_outq_len(struct sock *sk); + +#ifdef CONFIG_SYSCTL +int unix_sysctl_register(struct net *net); +void unix_sysctl_unregister(struct net *net); +#else +static inline int unix_sysctl_register(struct net *net) { return 0; } +static inline void unix_sysctl_unregister(struct net *net) {} +#endif +#endif -- cgit 1.2.3-korg