From 42c69cfcfc06cd4d20a5b40c266e79d8e3d2e126 Mon Sep 17 00:00:00 2001 From: Stefan Lankes Date: Sun, 25 Sep 2011 20:41:03 +0200 Subject: [PATCH] add rlogind via 'telnet hostname 4211' is it possible to establish a connection to a mshell --- kernel/init.c | 4 +++- kernel/tasks.c | 18 ++++++++++-------- newlib/examples/Makefile | 10 ++++++++-- 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/kernel/init.c b/kernel/init.c index 447455b7..4d54b4d4 100644 --- a/kernel/init.c +++ b/kernel/init.c @@ -209,6 +209,7 @@ int initd(void* arg) { #ifdef CONFIG_LWIP sys_sem_t sem; + char* argv[] = {"/bin/rlogind ", NULL}; // Initialize lwIP modules if(sys_sem_new(&sem, 0) != ERR_OK) @@ -228,9 +229,10 @@ int initd(void* arg) } #endif - // start echo and/or netio server + // start echo, netio and rlogind echo_init(); netio_init(); + create_user_task(NULL, "/bin/rlogind", argv); #endif list_root(); diff --git a/kernel/tasks.c b/kernel/tasks.c index db30571f..e44d3fd3 100644 --- a/kernel/tasks.c +++ b/kernel/tasks.c @@ -520,15 +520,17 @@ static int load_task(load_args_t* largs) /* init fildes_table */ spinlock_irqsave_lock(&table_lock); - task_table[curr_task->id].fildes_table = kmalloc(sizeof(fildes_t)*NR_OPEN); - if (BUILTIN_EXPECT(!task_table[curr_task->id].fildes_table, 0)) { - spinlock_irqsave_unlock(&table_lock); - return -ENOMEM; + if (!task_table[curr_task->id].fildes_table) { + task_table[curr_task->id].fildes_table = kmalloc(sizeof(fildes_t)*NR_OPEN); + if (BUILTIN_EXPECT(!task_table[curr_task->id].fildes_table, 0)) { + spinlock_irqsave_unlock(&table_lock); + return -ENOMEM; + } + memset(task_table[curr_task->id].fildes_table, 0x00, sizeof(fildes_t)*NR_OPEN); + task_table[curr_task->id].fildes_table[0].node = findnode_fs("/dev/stdin"); + task_table[curr_task->id].fildes_table[1].node = findnode_fs("/dev/stdout"); + task_table[curr_task->id].fildes_table[2].node = findnode_fs("/dev/stderr"); } - memset(task_table[curr_task->id].fildes_table, 0x00, sizeof(fildes_t)*NR_OPEN); - task_table[curr_task->id].fildes_table[0].node = findnode_fs("/dev/stdin"); - task_table[curr_task->id].fildes_table[1].node = findnode_fs("/dev/stdout"); - task_table[curr_task->id].fildes_table[2].node = findnode_fs("/dev/stderr"); spinlock_irqsave_unlock(&table_lock); err = read_fs(file, (uint8_t*)&header, sizeof(elf_header_t)); diff --git a/newlib/examples/Makefile b/newlib/examples/Makefile index 67e44b6a..25019007 100644 --- a/newlib/examples/Makefile +++ b/newlib/examples/Makefile @@ -11,7 +11,7 @@ LDFLAGS = default: all -all: hello tests jacobi mshell server client +all: hello tests jacobi mshell server client rlogind jacobi: jacobi.o $(CC_FOR_TARGET) -T link.ld -o $@ $(LDFLAGS) $< -lm @@ -37,6 +37,12 @@ mshell: mshell.o $(OBJCOPY_FOR_TARGET) $(STRIP_DEBUG) $@ chmod a-x $@.sym +rlogind: rlogind.o + $(CC_FOR_TARGET) -T link.ld -o $@ $(LDFLAGS) $< -lsocket + $(OBJCOPY_FOR_TARGET) $(KEEP_DEBUG) $@ $@.sym + $(OBJCOPY_FOR_TARGET) $(STRIP_DEBUG) $@ + chmod a-x $@.sym + server: server.o $(CC_FOR_TARGET) -T link.ld -o $@ $(LDFLAGS) $< -lsocket $(OBJCOPY_FOR_TARGET) $(KEEP_DEBUG) $@ $@.sym @@ -50,7 +56,7 @@ client: client.o chmod a-x $@.sym clean: - $(RM) hello tests server client *.sym *.o *~ + $(RM) hello tests server client rlogind mshell jacobi hello *.sym *.o *~ depend: $(CC_FOR_TARGET) -MM $(CFLAGS) *.c > Makefile.dep