Merge pull request #1221 from BernardXiong/master

merge O_CREAT issue
This commit is contained in:
Bernard Xiong 2018-02-11 14:39:22 +08:00 committed by GitHub
commit 2e71b8a741
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 13 additions and 12 deletions

View File

@ -6,7 +6,7 @@ Thread::Thread(rt_uint32_t stack_size,
rt_uint8_t priority, rt_uint8_t priority,
rt_uint32_t tick, rt_uint32_t tick,
const char *name) const char *name)
: _entry(RT_NULL), started(false) : _entry(RT_NULL), _param(RT_NULL), started(false)
{ {
rt_event_init(&_event, name, 0); rt_event_init(&_event, name, 0);
@ -24,7 +24,7 @@ Thread::Thread(void (*entry)(void *p),
rt_uint8_t priority, rt_uint8_t priority,
rt_uint32_t tick, rt_uint32_t tick,
const char *name) const char *name)
: _entry(RT_NULL), started(false), _param(p) : _entry(RT_NULL), _param(p), started(false)
{ {
rt_event_init(&_event, name, 0); rt_event_init(&_event, name, 0);

View File

@ -19,6 +19,7 @@
* *
* Change Logs: * Change Logs:
* Date Author Notes * Date Author Notes
* 2018-02-11 Bernard Ignore O_CREAT flag in open.
*/ */
#include <rtthread.h> #include <rtthread.h>
@ -137,9 +138,6 @@ int dfs_device_fs_open(struct dfs_fd *file)
rt_err_t result; rt_err_t result;
rt_device_t device; rt_device_t device;
if (file->flags & O_CREAT)
return -EINVAL;
/* open root directory */ /* open root directory */
if ((file->path[0] == '/') && (file->path[1] == '\0') && if ((file->path[0] == '/') && (file->path[1] == '\0') &&
(file->flags & O_DIRECTORY)) (file->flags & O_DIRECTORY))

View File

@ -36,7 +36,7 @@
int libc_system_init(void) int libc_system_init(void)
{ {
#if defined(RT_USING_DFS) & defined(RT_USING_DFS_DEVFS) #if defined(RT_USING_DFS) && defined(RT_USING_DFS_DEVFS)
rt_device_t dev_console; rt_device_t dev_console;
dev_console = rt_console_get_device(); dev_console = rt_console_get_device();
@ -50,10 +50,11 @@ int libc_system_init(void)
} }
#endif #endif
#if defined RT_USING_PTHREADS && !defined RT_USING_COMPONENTS_INIT #if defined (RT_USING_PTHREADS) && !defined (RT_USING_COMPONENTS_INIT)
pthread_system_init(); pthread_system_init();
#endif #endif
return 0; return 0;
} }
INIT_COMPONENT_EXPORT(libc_system_init); INIT_COMPONENT_EXPORT(libc_system_init);

View File

@ -81,7 +81,9 @@ int libc_stdio_set_console(const char* device_name, int mode)
_GLOBAL_REENT->__sdidinit = 1; _GLOBAL_REENT->__sdidinit = 1;
} }
return fileno(std_console); if (std_console) return fileno(std_console);
return -1;
} }
int libc_stdio_get_console(void) { int libc_stdio_get_console(void) {

View File

@ -32,15 +32,15 @@
* header file. * header file.
* *
* #define DBG_SECTION_NAME "[ MOD]" * #define DBG_SECTION_NAME "[ MOD]"
* #define DEBUG_ENABLE // enable debug macro * #define DBG_ENABLE // enable debug macro
* #define DEBUG_LEVEL DBG_INFO * #define DBG_LEVEL DBG_INFO
* #include <rtdbg.h> // must after of DEBUG_ENABLE or some other options * #include <rtdbg.h> // must after of DEBUG_ENABLE or some other options
* *
* Then in your C/C++ file, you can use dbg_log macro to print out logs: * Then in your C/C++ file, you can use dbg_log macro to print out logs:
* dbg_log(DBG_INFO, "this is a log!\n"); * dbg_log(DBG_INFO, "this is a log!\n");
* *
* Or if you want to use different color for different kinds log, you can * Or if you want to use different color for different kinds log, you can
* #define DEBUG_COLOR * #define DBG_COLOR
*/ */
#ifndef RT_DBG_H__ #ifndef RT_DBG_H__