blob: 301ba2138bc40394f994aa7e8f419cabb89b573e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
/*
* RTEMS multi-tasking support
*
* $Id$
*/
#include <rpc/rpc.h>
#include <rtems.h>
#include <stdlib.h>
/*
* RPC variables for single-thread
*/
static struct _rtems_rpc_task_variables rpc_default = {
-1, /* svc_maxfd */
};
/*
* RPC values for initializing a new per-task set of variables
*/
static const struct _rtems_rpc_task_variables rpc_init = {
-1, /* svc_maxfd */
};
/*
* Per-task pointer to RPC data
*/
struct _rtems_rpc_task_variables *rtems_rpc_task_variables = &rpc_default;
/*
* Set up per-task RPC variables
*/
int rtems_rpc_task_init (void)
{
rtems_status_code sc;
struct _rtems_rpc_task_variables *tvp;
if (rtems_rpc_task_variables == &rpc_default) {
tvp = malloc (sizeof *tvp);
if (tvp == NULL)
return RTEMS_NO_MEMORY;
/*
* FIXME: Should have destructor which cleans up
* all RPC stuff:
* - Close all files
* - Go through and free linked list elements
* - Free other allocated memory (e.g. clnt_perror_buf)
*/
sc = rtems_task_variable_add (
RTEMS_SELF, (void *)&rtems_rpc_task_variables, NULL);
if (sc != RTEMS_SUCCESSFUL) {
free (tvp);
return sc;
}
*tvp = rpc_init;
rtems_rpc_task_variables = tvp;
}
return RTEMS_SUCCESSFUL;
}
|