summaryrefslogtreecommitdiffstats
path: root/cpukit/librpc/src/rpc/rtems_rpc.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2000-06-12 15:00:15 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2000-06-12 15:00:15 +0000
commitdf49c60c9671e4a28e636964d744c1f59fb6cb68 (patch)
treeeabd85e189514ad412a35414ba5d483dcda3ef1f /cpukit/librpc/src/rpc/rtems_rpc.c
parentPurged as many egcs references as possible. (diff)
downloadrtems-df49c60c9671e4a28e636964d744c1f59fb6cb68.tar.bz2
Merged from 4.5.0-beta3a
Diffstat (limited to '')
-rw-r--r--cpukit/librpc/src/rpc/rtems_rpc.c56
1 files changed, 56 insertions, 0 deletions
diff --git a/cpukit/librpc/src/rpc/rtems_rpc.c b/cpukit/librpc/src/rpc/rtems_rpc.c
index e69de29bb2..d2666e2f91 100644
--- a/cpukit/librpc/src/rpc/rtems_rpc.c
+++ b/cpukit/librpc/src/rpc/rtems_rpc.c
@@ -0,0 +1,56 @@
+/*
+ * RTEMS multi-tasking support
+ */
+
+#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
+ */
+void *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, &rtems_rpc_task_variables, NULL);
+ if (sc != RTEMS_SUCCESSFUL) {
+ free (tvp);
+ return sc;
+ }
+ *tvp = rpc_init;
+ rtems_rpc_task_variables = tvp;
+ }
+ return RTEMS_SUCCESSFUL;
+}