2010-10-22 10:20:38 +00:00
|
|
|
#include <rtthread.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <fcntl.h>
|
2010-11-21 23:55:44 +00:00
|
|
|
#include <sys/time.h>
|
2010-11-22 09:51:40 +00:00
|
|
|
#include "libc.h"
|
2010-11-21 23:55:44 +00:00
|
|
|
|
2010-10-22 10:20:38 +00:00
|
|
|
void libc_system_init(const char* tty_name)
|
|
|
|
{
|
|
|
|
int fd;
|
2010-11-24 11:04:08 +00:00
|
|
|
extern int pthread_system_init(void);
|
2010-10-22 10:20:38 +00:00
|
|
|
|
2010-11-29 00:04:55 +00:00
|
|
|
#ifndef RT_USING_DFS_DEVFS
|
|
|
|
#error Please enable devfs by defining RT_USING_DFS_DEVFS in rtconfig.h
|
|
|
|
#endif
|
|
|
|
|
2010-10-22 10:20:38 +00: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 05:57:19 +00:00
|
|
|
|
|
|
|
/* set PATH and HOME */
|
|
|
|
putenv("PATH=/");
|
|
|
|
putenv("HOME=/");
|
2010-11-21 23:55:44 +00:00
|
|
|
|
2010-11-24 11:04:08 +00:00
|
|
|
#ifdef RT_USING_PTHREADS
|
|
|
|
pthread_system_init();
|
|
|
|
#endif
|
2010-11-21 23:55:44 +00:00
|
|
|
}
|