2010-10-22 18:20:38 +08:00
|
|
|
#include <rtthread.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <fcntl.h>
|
2010-11-22 07:55:44 +08:00
|
|
|
#include <sys/time.h>
|
2010-11-22 17:51:40 +08:00
|
|
|
#include "libc.h"
|
2010-11-22 07:55:44 +08:00
|
|
|
|
2010-10-22 18:20:38 +08:00
|
|
|
void libc_system_init(const char* tty_name)
|
|
|
|
{
|
|
|
|
int fd;
|
2010-11-24 19:04:08 +08:00
|
|
|
extern int pthread_system_init(void);
|
2010-10-22 18:20:38 +08:00
|
|
|
|
2010-11-29 08:04:55 +08:00
|
|
|
#ifndef RT_USING_DFS_DEVFS
|
|
|
|
#error Please enable devfs by defining RT_USING_DFS_DEVFS in rtconfig.h
|
|
|
|
#endif
|
|
|
|
|
2010-10-22 18:20:38 +08:00
|
|
|
/* init console device */
|
|
|
|
rt_console_init(tty_name);
|
|
|
|
|
|
|
|
/* open console as stdin/stdout/stderr */
|
|
|
|
fd = open("/dev/console", O_RDONLY, 0); /* for stdin */
|
|
|
|
fd = open("/dev/console", O_WRONLY, 0); /* for stdout */
|
|
|
|
fd = open("/dev/console", O_WRONLY, 0); /* for stderr */
|
2010-10-29 13:57:19 +08:00
|
|
|
|
|
|
|
/* set PATH and HOME */
|
|
|
|
putenv("PATH=/");
|
|
|
|
putenv("HOME=/");
|
2010-11-22 07:55:44 +08:00
|
|
|
|
2010-11-24 19:04:08 +08:00
|
|
|
#ifdef RT_USING_PTHREADS
|
|
|
|
pthread_system_init();
|
|
|
|
#endif
|
2010-11-22 07:55:44 +08:00
|
|
|
}
|