/* set the number of pending calls permitted on a listening socket  */
static int rxrpc_listen(struct socket *sock, int backlog)
/* set the number of pending calls permitted on a listening socket  */
static int rxrpc_listen(struct socket *sock, int backlog)
{
	struct sock *sk = sock->sk;
	struct rxrpc_sock *rx = rxrpc_sk(sk);
	int ret;
	_enter("%p,%d", rx, backlog);
	lock_sock(&rx->sk);
	switch (rx->sk.sk_state) {
	case RXRPC_UNCONNECTED:
		ret = -EADDRNOTAVAIL;
		break;
	case RXRPC_CLIENT_BOUND:
	case RXRPC_CLIENT_CONNECTED:
	default:
		ret = -EBUSY;
		break;
	case RXRPC_SERVER_BOUND:
		ASSERT(rx->local != NULL);
		sk->sk_max_ack_backlog = backlog;
		rx->sk.sk_state = RXRPC_SERVER_LISTENING;
		ret = 0;
		break;
	}
	release_sock(&rx->sk);
	_leave(" = %d", ret);
	return ret;
}