Index: cpukit/telnetd/telnetd.c
===================================================================
--- cpukit/telnetd/telnetd.c	(revision 2548d14b82b4baab29b7b680ec799042983dff8f)
+++ cpukit/telnetd/telnetd.c	(revision 6d3ec58a52feb89bf98f8f883c075580727bc3d7)
@@ -83,28 +83,6 @@
 static int sockpeername(int sock, char *buf, int bufsz);
 
-rtems_id telnetd_dflt_spawn(
-  const char *name,
-  unsigned priority,
-  unsigned stackSize,
-  void (*fn)(void*),
-  void *fnarg
-);
-
 /***********************************************************/
 static telnetd_context telnetd_instance;
-
-/*
- * chrisj: this variable was global and with no declared interface in a header
- *         file and with no means to set it so I have stopped it being global;
- *         if this breaks any user they will have be to provide a formal
- *         interface to get this change reverted.
- */
-static const rtems_id (*telnetd_spawn_task)(
-  const char *,
-  unsigned,
-  unsigned,
-  void (*)(void*),
-  void *
-) = telnetd_dflt_spawn;
 
 static struct shell_args *grab_a_Connection(
@@ -194,10 +172,37 @@
 }
 
+static rtems_id telnetd_spawn_task(
+  rtems_name name,
+  rtems_task_priority priority,
+  size_t stack_size,
+  rtems_task_entry entry,
+  void *arg
+)
+{
+  rtems_status_code sc;
+  rtems_id task_id;
+
+  sc = rtems_task_create(
+    name,
+    priority,
+    stack_size,
+    RTEMS_DEFAULT_MODES,
+    RTEMS_FLOATING_POINT,
+    &task_id
+  );
+  if (sc != RTEMS_SUCCESSFUL) {
+    return RTEMS_ID_NONE;
+  }
+
+  (void)rtems_task_start(task_id, entry, (rtems_task_argument) arg);
+  return task_id;
+}
+
 static void
-spawned_shell(void *arg);
+spawned_shell(rtems_task_argument arg);
 
 /***********************************************************/
 static void
-rtems_task_telnetd(void *task_argument)
+telnetd_server_task(rtems_task_argument targ)
 {
   int                des_socket;
@@ -208,5 +213,5 @@
   struct shell_args *arg = NULL;
   rtems_id           task_id;
-  telnetd_context   *ctx = task_argument;
+  telnetd_context   *ctx = (telnetd_context *) targ;
 
   if ((des_socket=socket(PF_INET,SOCK_STREAM,0))<0) {
@@ -247,5 +252,5 @@
 
     task_id = telnetd_spawn_task(
-      arg->pty.name,
+      rtems_build_name('T', 'N', 'T', 'a'),
       ctx->config.priority,
       ctx->config.stack_size,
@@ -256,8 +261,4 @@
       FILE *dummy;
 
-      if ( telnetd_spawn_task != telnetd_dflt_spawn ) {
-        fprintf(stderr,"Telnetd: Unable to spawn child task\n");
-      }
-
       /* hmm - the pty driver slot can only be
        * released by opening and subsequently
@@ -320,10 +321,9 @@
   }
 
-  /* Spawn task */
   task_id = telnetd_spawn_task(
-    "TNTD",
+    rtems_build_name('T', 'N', 'T', 'D'),
     ctx->config.priority,
-    ctx->config.stack_size,
-    rtems_task_telnetd,
+    RTEMS_MINIMUM_STACK_SIZE,
+    telnetd_server_task,
     ctx
   );
@@ -340,5 +340,5 @@
 /* utility wrapper */
 static void
-spawned_shell(void *targ)
+spawned_shell(rtems_task_argument targ)
 {
   rtems_status_code    sc;
@@ -346,5 +346,5 @@
   FILE                *ostd[3]={ stdin, stdout, stderr };
   int                  i=0;
-  struct shell_args  *arg = targ;
+  struct shell_args  *arg = (struct shell_args *) targ;
   telnetd_context    *ctx = arg->ctx;
   bool login_failed = false;
@@ -408,58 +408,2 @@
   free(arg);
 }
-
-struct wrap_delete_args {
-  void (*t)(void *);
-  void           *a;
-};
-
-static rtems_task
-wrap_delete(rtems_task_argument arg)
-{
-  struct wrap_delete_args     *pwa = (struct wrap_delete_args *)arg;
-  register void              (*t)(void *) = pwa->t;
-  register void               *a   = pwa->a;
-
-  /* free argument before calling function (which may never return if
-   * they choose to delete themselves)
-   */
-  free(pwa);
-  t(a);
-  rtems_task_exit();
-}
-
-rtems_id
-telnetd_dflt_spawn(const char *name, unsigned int priority, unsigned int stackSize, void (*fn)(void *), void* fnarg)
-{
-  rtems_status_code        sc;
-  rtems_id                 task_id = RTEMS_ID_NONE;
-  char                     nm[4] = {'X','X','X','X' };
-  struct wrap_delete_args *pwa = malloc(sizeof(*pwa));
-
-  strncpy(nm, name, 4);
-
-  if ( !pwa ) {
-    perror("Telnetd: no memory\n");
-    return RTEMS_ID_NONE;
-  }
-
-  pwa->t = fn;
-  pwa->a = fnarg;
-
-  if ((sc=rtems_task_create(
-    rtems_build_name(nm[0], nm[1], nm[2], nm[3]),
-      (rtems_task_priority)priority,
-      stackSize,
-      RTEMS_DEFAULT_MODES,
-      RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT,
-      &task_id)) ||
-    (sc=rtems_task_start(
-      task_id,
-      wrap_delete,
-      (rtems_task_argument)pwa))) {
-        free(pwa);
-        rtems_error(sc,"Telnetd: spawning task failed");
-        return RTEMS_ID_NONE;
-  }
-  return task_id;
-}
