Beispiel #1
0
/*
 * Copy of sock_queue_rcv_skb (from sock.h) without
 * bh_lock_sock() (its already held when this is called) which
 * also allows data and other data to be queued to a socket.
 */
static __inline__ int dn_queue_skb(struct sock *sk, struct sk_buff *skb, int sig, struct sk_buff_head *queue)
{
	int err;

        /* Cast skb->rcvbuf to unsigned... It's pointless, but reduces
           number of warnings when compiling with -W --ANK
         */
        if (atomic_read(&sk->rmem_alloc) + skb->truesize >= (unsigned)sk->rcvbuf) {
        	err = -ENOMEM;
        	goto out;
        }

	err = sk_filter(sk, skb, 0);
	if (err)
		goto out;

        skb_set_owner_r(skb, sk);
        skb_queue_tail(queue, skb);

	/* This code only runs from BH or BH protected context.
	 * Therefore the plain read_lock is ok here. -DaveM
	 */
	read_lock(&sk->callback_lock);
        if (!sk->dead) {
		struct socket *sock = sk->socket;
		wake_up_interruptible(sk->sleep);
		if (sock && sock->fasync_list &&
		    !test_bit(SOCK_ASYNC_WAITDATA, &sock->flags))
			__kill_fasync(sock->fasync_list, sig, 
				    (sig == SIGURG) ? POLL_PRI : POLL_IN);
	}
	read_unlock(&sk->callback_lock);
out:
        return err;
}
Beispiel #2
0
static void
timod_socket_wakeup(struct file *fp)
{
	struct socket		*sock;

	sock = SOCKET_I(fp->f_dentry->d_inode);
	wake_up_interruptible(&sock->wait);

	read_lock(&sock->sk->sk_callback_lock);
	if (sock->fasync_list && !test_bit(SOCK_ASYNC_WAITDATA, &sock->flags))
		__kill_fasync(sock->fasync_list, SIGIO, POLL_IN);
	read_unlock(&sock->sk->sk_callback_lock);
}
Beispiel #3
0
static void timod_wake_socket(unsigned int fd)
{
	struct socket *sock;

	SOLD("wakeing socket");
	sock = &current->files->fd[fd]->f_dentry->d_inode->u.socket_i;
	wake_up_interruptible(&sock->wait);
	read_lock(&sock->sk->callback_lock);
	if (sock->fasync_list && !test_bit(SOCK_ASYNC_WAITDATA, &sock->flags))
		__kill_fasync(sock->fasync_list, SIGIO, POLL_IN);
	read_unlock(&sock->sk->callback_lock);
	SOLD("done");
}
Beispiel #4
0
static void timod_wake_socket(unsigned int fd)
{
	struct socket *sock;
	struct fdtable *fdt;

	SOLD("wakeing socket");
	fdt = files_fdtable(current->files);
	sock = SOCKET_I(fdt->fd[fd]->f_path.dentry->d_inode);
	wake_up_interruptible(&sock->wait);
	read_lock(&sock->sk->sk_callback_lock);
	if (sock->fasync_list && !test_bit(SOCK_ASYNC_WAITDATA, &sock->flags))
		__kill_fasync(sock->fasync_list, SIGIO, POLL_IN);
	read_unlock(&sock->sk->sk_callback_lock);
	SOLD("done");
}