source: rtems/cpukit/librpc/src/rpc/rtems_rpc.c @ d16b2d3

4.104.114.84.95
Last change on this file since d16b2d3 was d16b2d3, checked in by Ralf Corsepius <ralf.corsepius@…>, on Nov 27, 2003 at 9:35:40 AM

2003-11-27 Ralf Corsepius <corsepiu@…>

  • include/rpc/rpc.hinclude/rpc/rpc.h: Rename struct rtems_rpc_task_variables into struct _rtems_rpc_task_variables (Avoid symbol conflict between struct and variable). struct _rtems_rpc_task_variables *rtems_rpc_task_variables; Reflect changes above.
  • src/rpc/clnt_perror.c, src/rpc/clnt_raw.c, src/rpc/clnt_simple.c, src/rpc/rpcdname.c, src/rpc/rtems_rpc.c, src/rpc/svc.c, src/rpc/svc_auth.c, src/rpc/svc_raw.c, src/rpc/svc_simple.c: Reflect changes above.
  • Property mode set to 100644
File size: 1.2 KB
Line 
1/*
2 * RTEMS multi-tasking support
3 */
4
5#include <rpc/rpc.h>
6#include <rtems.h>
7#include <stdlib.h>
8
9/*
10 * RPC variables for single-thread
11 */
12static struct _rtems_rpc_task_variables rpc_default = {
13        -1,             /* svc_maxfd */
14};
15
16/*
17 * RPC values for initializing a new per-task set of variables
18 */
19static const struct _rtems_rpc_task_variables rpc_init = {
20        -1,             /* svc_maxfd */
21};
22
23/*
24 * Per-task pointer to RPC data
25 */
26struct _rtems_rpc_task_variables *rtems_rpc_task_variables = &rpc_default;
27
28/*
29 * Set up per-task RPC variables
30 */
31int rtems_rpc_task_init (void)
32{
33        rtems_status_code sc;
34        struct _rtems_rpc_task_variables *tvp;
35
36        if (rtems_rpc_task_variables == &rpc_default) {
37                tvp = malloc (sizeof *tvp);
38                if (tvp == NULL)
39                        return RTEMS_NO_MEMORY;
40                /*
41                 * FIXME: Should have destructor which cleans up
42                 * all RPC stuff:
43                 *      - Close all files
44                 *      - Go through and free linked list elements
45                 *      - Free other allocated memory (e.g. clnt_perror_buf)
46                 */
47                sc = rtems_task_variable_add (RTEMS_SELF, &rtems_rpc_task_variables, NULL);
48                if (sc != RTEMS_SUCCESSFUL) {
49                        free (tvp);
50                        return sc;
51                }
52                *tvp = rpc_init;
53                rtems_rpc_task_variables = tvp;
54        }
55        return RTEMS_SUCCESSFUL;
56}
Note: See TracBrowser for help on using the repository browser.