Skip to content

Commit a328487

Browse files
committed
revise RT_USING_POSIX_STDIO to RT_USING_POSIX_DEVIO
1 parent 3bc5ffb commit a328487

File tree

10 files changed

+31
-35
lines changed

10 files changed

+31
-35
lines changed

components/dfs/src/dfs.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
#include <lwp.h>
1919
#endif
2020

21-
#ifdef RT_USING_POSIX_STDIO
21+
#ifdef RT_USING_POSIX_DEVIO
2222
#include <libc.h>
23-
#endif /* RT_USING_POSIX_STDIO */
23+
#endif /* RT_USING_POSIX_DEVIO */
2424

2525
/* Global variables */
2626
const struct dfs_filesystem_ops *filesystem_operation_table[DFS_FILESYSTEM_TYPES_MAX];
@@ -216,10 +216,10 @@ struct dfs_fd *fd_get(int fd)
216216
struct dfs_fd *d;
217217
struct dfs_fdtable *fdt;
218218

219-
#ifdef RT_USING_POSIX_STDIO
219+
#ifdef RT_USING_POSIX_DEVIO
220220
if ((0 <= fd) && (fd <= 2))
221221
fd = libc_stdio_get_console();
222-
#endif /* RT_USING_POSIX_STDIO */
222+
#endif /* RT_USING_POSIX_DEVIO */
223223

224224
fdt = dfs_fdtable_get();
225225
fd = fd - DFS_FD_OFFSET;

components/finsh/shell.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ int finsh_getchar(void)
146146
{
147147
#ifdef RT_USING_DEVICE
148148
char ch = 0;
149-
#ifdef RT_USING_POSIX_STDIO
149+
#ifdef RT_USING_POSIX_DEVIO
150150
if(read(STDIN_FILENO, &ch, 1) > 0)
151151
{
152152
return ch;
@@ -170,14 +170,14 @@ int finsh_getchar(void)
170170
rt_sem_take(&shell->rx_sem, RT_WAITING_FOREVER);
171171

172172
return ch;
173-
#endif /* RT_USING_POSIX_STDIO */
173+
#endif /* RT_USING_POSIX_DEVIO */
174174
#else
175175
extern char rt_hw_console_getchar(void);
176176
return rt_hw_console_getchar();
177177
#endif /* RT_USING_DEVICE */
178178
}
179179

180-
#if !defined(RT_USING_POSIX_STDIO) && defined(RT_USING_DEVICE)
180+
#if !defined(RT_USING_POSIX_DEVIO) && defined(RT_USING_DEVICE)
181181
static rt_err_t finsh_rx_ind(rt_device_t dev, rt_size_t size)
182182
{
183183
RT_ASSERT(shell != RT_NULL);
@@ -241,7 +241,7 @@ const char *finsh_get_device()
241241
RT_ASSERT(shell != RT_NULL);
242242
return shell->device->parent.name;
243243
}
244-
#endif /* !defined(RT_USING_POSIX_STDIO) && defined(RT_USING_DEVICE) */
244+
#endif /* !defined(RT_USING_POSIX_DEVIO) && defined(RT_USING_DEVICE) */
245245

246246
/**
247247
* @ingroup finsh
@@ -443,7 +443,7 @@ void finsh_thread_entry(void *parameter)
443443
shell->echo_mode = 0;
444444
#endif
445445

446-
#if !defined(RT_USING_POSIX_STDIO) && defined(RT_USING_DEVICE)
446+
#if !defined(RT_USING_POSIX_DEVIO) && defined(RT_USING_DEVICE)
447447
/* set console device as shell device */
448448
if (shell->device == RT_NULL)
449449
{
@@ -453,7 +453,7 @@ void finsh_thread_entry(void *parameter)
453453
finsh_set_device(console->parent.name);
454454
}
455455
}
456-
#endif /* !defined(RT_USING_POSIX_STDIO) && defined(RT_USING_DEVICE) */
456+
#endif /* !defined(RT_USING_POSIX_DEVIO) && defined(RT_USING_DEVICE) */
457457

458458
#ifdef FINSH_USING_AUTH
459459
/* set the default password when the password isn't setting */

components/finsh/shell.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ struct finsh_shell
7878
rt_uint16_t line_position;
7979
rt_uint16_t line_curpos;
8080

81-
#if !defined(RT_USING_POSIX_STDIO) && defined(RT_USING_DEVICE)
81+
#if !defined(RT_USING_POSIX_DEVIO) && defined(RT_USING_DEVICE)
8282
rt_device_t device;
8383
#endif
8484

components/legacy/dfs/dfs_select.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313

1414
#include <sys/select.h>
1515

16-
#endif
16+
#endif /* DFS_SELECT_H__ */

components/libc/Kconfig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ if RT_USING_LIBC
1212
config RT_LIBC_USING_FILEIO
1313
bool "Enable libc with file operation, eg.fopen/fwrite/fread/getchar"
1414
select RT_USING_POSIX
15-
select RT_USING_POSIX_STDIO
15+
select RT_USING_POSIX_DEVIO
1616
default n
1717

1818
config RT_USING_MODULE
@@ -44,8 +44,8 @@ config RT_USING_POSIX
4444
default n
4545

4646
if RT_USING_POSIX
47-
config RT_USING_POSIX_STDIO
48-
bool "Enable standard I/O, STDOUT_FILENO/STDIN_FILENO/STDERR_FILENO"
47+
config RT_USING_POSIX_DEVIO
48+
bool "Enable devices as file descriptors"
4949
select RT_USING_DFS
5050
select RT_USING_DFS_DEVFS
5151
default n

components/libc/compilers/armlibc/syscalls.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121
#include <fcntl.h>
2222
#include <unistd.h>
2323
#include <sys/stat.h>
24-
#ifdef RT_USING_POSIX_STDIO
24+
#ifdef RT_USING_POSIX_DEVIO
2525
#include "libc.h"
26-
#endif
26+
#endif /* RT_USING_POSIX_DEVIO */
2727

2828
#define DBG_TAG "armlibc.syscalls"
2929
#define DBG_LVL DBG_INFO
@@ -149,7 +149,7 @@ int _sys_read(FILEHANDLE fh, unsigned char *buf, unsigned len, int mode)
149149

150150
if (fh == STDIN)
151151
{
152-
#ifdef RT_USING_POSIX_STDIO
152+
#ifdef RT_USING_POSIX_DEVIO
153153
if (libc_stdio_get_console() < 0)
154154
{
155155
LOG_W("Do not invoke standard output before initializing libc");
@@ -159,7 +159,7 @@ int _sys_read(FILEHANDLE fh, unsigned char *buf, unsigned len, int mode)
159159
return 0; /* success */
160160
#else
161161
return 0; /* error */
162-
#endif
162+
#endif /* RT_USING_POSIX_DEVIO */
163163
}
164164
else if (fh == STDOUT || fh == STDERR)
165165
{
@@ -332,7 +332,7 @@ int fputc(int c, FILE *f)
332332

333333
int fgetc(FILE *f)
334334
{
335-
#ifdef RT_USING_POSIX_STDIO
335+
#ifdef RT_USING_POSIX_DEVIO
336336
char ch;
337337

338338
if (libc_stdio_get_console() < 0)
@@ -343,7 +343,7 @@ int fgetc(FILE *f)
343343

344344
if(read(STDIN_FILENO, &ch, 1) == 1)
345345
return ch;
346-
#endif /* RT_USING_POSIX_STDIO */
346+
#endif /* RT_USING_POSIX_DEVIO */
347347
return 0; /* error */
348348
}
349349

components/libc/compilers/dlib/syscall_read.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
#include <rtthread.h>
1212
#include <LowLevelIOInterface.h>
1313
#include <unistd.h>
14-
#ifdef RT_USING_POSIX_STDIO
14+
#ifdef RT_USING_POSIX_DEVIO
1515
#include "libc.h"
16-
#endif
16+
#endif /* RT_USING_POSIX_DEVIO */
1717

1818
#define DBG_TAG "dlib.syscall_read"
1919
#define DBG_LVL DBG_INFO
@@ -39,7 +39,7 @@ size_t __read(int handle, unsigned char *buf, size_t len)
3939

4040
if (handle == _LLIO_STDIN)
4141
{
42-
#ifdef RT_USING_POSIX_STDIO
42+
#ifdef RT_USING_POSIX_DEVIO
4343
if (libc_stdio_get_console() < 0)
4444
{
4545
LOG_W("Do not invoke standard input before initializing libc");
@@ -48,7 +48,7 @@ size_t __read(int handle, unsigned char *buf, size_t len)
4848
return read(STDIN_FILENO, buf, len); /* return the length of the data read */
4949
#else
5050
return _LLIO_ERROR;
51-
#endif /* RT_USING_POSIX_STDIO */
51+
#endif /* RT_USING_POSIX_DEVIO */
5252
}
5353
else if ((handle == _LLIO_STDOUT) || (handle == _LLIO_STDERR))
5454
{

components/libc/compilers/dlib/syscall_write.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@
1111
#include <rtthread.h>
1212
#include <LowLevelIOInterface.h>
1313
#include <unistd.h>
14-
#ifdef RT_USING_POSIX_STDIO
15-
#include "libc.h"
16-
#endif
17-
1814
#define DBG_TAG "dlib.syscall_write"
1915
#define DBG_LVL DBG_INFO
2016
#include <rtdbg.h>

components/libc/compilers/gcc/newlib/syscalls.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@
2020
#include <unistd.h>
2121
#include <sys/errno.h>
2222
#include <sys/stat.h>
23-
#ifdef RT_USING_POSIX_STDIO
23+
#ifdef RT_USING_POSIX_DEVIO
2424
#include "libc.h"
25-
#endif
25+
#endif /* RT_USING_POSIX_DEVIO */
2626
#ifdef RT_USING_MODULE
2727
#include <dlmodule.h>
28-
#endif
28+
#endif /* RT_USING_MODULE */
2929

3030
#define DBG_TAG "newlib.syscalls"
3131
#define DBG_LVL DBG_INFO
@@ -225,7 +225,7 @@ _ssize_t _read_r(struct _reent *ptr, int fd, void *buf, size_t nbytes)
225225
_ssize_t rc;
226226
if (fd == STDIN_FILENO)
227227
{
228-
#ifdef RT_USING_POSIX_STDIO
228+
#ifdef RT_USING_POSIX_DEVIO
229229
if (libc_stdio_get_console() < 0)
230230
{
231231
LOG_W("Do not invoke standard input before initializing libc");
@@ -234,7 +234,7 @@ _ssize_t _read_r(struct _reent *ptr, int fd, void *buf, size_t nbytes)
234234
#else
235235
ptr->_errno = ENOTSUP;
236236
return -1;
237-
#endif /* RT_USING_POSIX_STDIO */
237+
#endif /* RT_USING_POSIX_DEVIO */
238238
}
239239
else if (fd == STDOUT_FILENO || fd == STDERR_FILENO)
240240
{

components/libc/posix/src/SConscript

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ src = ['unistd.c']
66
cwd = GetCurrentDir()
77
CPPPATH = [cwd]
88

9-
if GetDepend('RT_USING_POSIX_STDIO'):
9+
if GetDepend('RT_USING_POSIX_DEVIO'):
1010
src += ['libc.c']
1111

1212
if GetDepend('RT_USING_POSIX_DELAY'):

0 commit comments

Comments
 (0)