Exemplo n.º 1
0
/*
 * 2.	Allocate the buffer. For details, see sched.c:rpc_malloc.
 *	(Note: buffer memory is freed in rpc_task_release).
 */
static void
call_allocate(struct rpc_task *task)
{
	struct rpc_clnt	*clnt = task->tk_client;
	unsigned int	bufsiz;

	dprintk("RPC: %4d call_allocate (status %d)\n", 
				task->tk_pid, task->tk_status);
	task->tk_action = call_encode;
	if (task->tk_buffer)
		return;

	/* FIXME: compute buffer requirements more exactly using
	 * auth->au_wslack */
	bufsiz = rpcproc_bufsiz(clnt, task->tk_proc) + RPC_SLACK_SPACE;

	if ((task->tk_buffer = rpc_malloc(task, bufsiz)) != NULL)
		return;
	printk("RPC: buffer allocation failed for task %p\n", task); 

	if (!signalled()) {
		xprt_release(task);
		task->tk_action = call_reserve;
		rpc_delay(task, HZ);
		return;
	}

	rpc_exit(task, -ERESTARTSYS);
}
Exemplo n.º 2
0
/*
 * 2.	Allocate the buffer. For details, see sched.c:rpc_malloc.
 *	(Note: buffer memory is freed in rpc_task_release).
 */
static void
call_allocate(struct rpc_task *task)
{
	struct rpc_clnt	*clnt = task->tk_client;
	unsigned int	bufsiz;

	dprintk("RPC: %4d call_allocate (status %d)\n", 
				task->tk_pid, task->tk_status);
	task->tk_action = call_encode;
	if (task->tk_buffer)
		return;

	/* FIXME: compute buffer requirements more exactly using
	 * auth->au_wslack */
	bufsiz = rpcproc_bufsiz(clnt, task->tk_msg.rpc_proc) + RPC_SLACK_SPACE;

	if ((task->tk_buffer = rpc_malloc(task, bufsiz << 1)) != NULL)
		return;
	printk(KERN_INFO "RPC: buffer allocation failed for task %p\n", task); 

	if (RPC_IS_ASYNC(task) || !(task->tk_client->cl_intr && signalled())) {
		xprt_release(task);
		task->tk_action = call_reserve;
		rpc_delay(task, HZ>>4);
		return;
	}
Exemplo n.º 3
0
Arquivo: rpc.c Projeto: seL4/refos
char*
rpc_sv_pop_str(void *cl)
{
    uint32_t slen = rpc_sv_pop_uint(cl);
    char *str = rpc_malloc((slen + 1) * sizeof(char));
    assert(str);
    _rpc_mr = rpc_unmarshall(_rpc_mr, str, slen);
    str[slen] = '\0';
    return str;
}
Exemplo n.º 4
0
Arquivo: rpc.c Projeto: seL4/refos
rpc_buffer_t
rpc_sv_pop_buf_array(void *cl, size_t sz)
{
    uint32_t count = rpc_sv_pop_uint(cl);
    char *v = rpc_malloc(count * sz);
    for (uint32_t i = 0; i < count; i++) {
        _rpc_mr = rpc_unmarshall(_rpc_mr, v + i * sz, sz);
    }
    rpc_buffer_t buffer;
    buffer.data = v;
    buffer.count = count;
    return buffer;
}
Exemplo n.º 5
0
/*
 * Create NULL creds for current process
 */
static struct rpc_cred *
nul_create_cred(struct rpc_task *task)
{
	struct rpc_cred	*cred;

	if (!(cred = (struct rpc_cred *) rpc_malloc(task, sizeof(*cred)))) {
		task->tk_status = -ENOMEM;
		return NULL;
	}

	cred->cr_count = 0;
	cred->cr_flags = RPCAUTH_CRED_UPTODATE;

	return cred;
}