Ignore:
Timestamp:
Jul 13, 2020, 8:07:55 PM (4 years ago)
Author:
coas-nagasima
Message:

ntshellアプリはnewlibを使うよう変更し、syscallの実装部分と区別がつくよう更新。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • EcnlProtoTool/trunk/ntshell/src/stdio_stub.c

    r441 r442  
    3636 */
    3737#include "shellif.h"
    38 #include <stdint.h>
    3938#include <kernel.h>
    4039#include <t_syslog.h>
     
    4645#include "fdtable.h"
    4746#include "kernel_cfg.h"
    48 #include <string.h>
    49 #include <errno.h>
    5047#include "util/ntstdio.h"
    5148#include "hal/serial_api.h"
     
    5855#endif
    5956
    60 int shell_errno;
     57#undef errno
     58extern int errno;
    6159
    6260extern bool_t sio_isr_snd(ID siopid);
     
    105103
    106104stdio_sio_t stdio_sio;
    107 ntstdio_t *ntstdio = &stdio_sio.ntstdio;
    108105
    109106void sys_init(intptr_t exinf)
     
    573570        struct SHELL_FILE *fp = fd_to_fp(fd);
    574571        if ((fp == NULL) || (fp->type != &IO_TYPE_SIO)) {
    575                 shell_errno = EBADF;
     572                errno = EBADF;
    576573                return -1;
    577574        }
    578575
    579         shell_errno = sio_close(fp);
    580         if (shell_errno != 0)
     576        errno = sio_close(fp);
     577        if (errno != 0)
    581578                return 1;
    582579        return 0;
     
    587584        struct SHELL_FILE *fp = fd_to_fp(fd);
    588585        if ((fp == NULL) || ((fp->type != &IO_TYPE_STDIN) && (fp->type != &IO_TYPE_SIO))) {
    589                 shell_errno = EBADF;
     586                errno = EBADF;
    590587                return -1;
    591588        }
     
    604601        if ((fp == NULL) || ((fp->type != &IO_TYPE_STDOUT) && (fp->type != &IO_TYPE_STDERR)
    605602                && (fp->type != &IO_TYPE_SIO))) {
    606                 shell_errno = EBADF;
     603                errno = EBADF;
    607604                return -1;
    608605        }
     
    621618        if ((fp == NULL) || ((fp->type != &IO_TYPE_STDIN) && (fp->type != &IO_TYPE_STDOUT)
    622619                && (fp->type != &IO_TYPE_STDERR) && (fp->type != &IO_TYPE_SIO))) {
    623                 shell_errno = EBADF;
     620                errno = EBADF;
    624621                return -1;
    625622        }
    626623
    627         shell_errno = sio_tcsetattr(fp, act, tio);
    628         if (shell_errno != 0)
     624        errno = sio_tcsetattr(fp, act, tio);
     625        if (errno != 0)
    629626                return 1;
    630627        return 0;
     
    636633        if ((fp == NULL) || ((fp->type != &IO_TYPE_STDIN) && (fp->type != &IO_TYPE_STDOUT)
    637634                && (fp->type != &IO_TYPE_STDERR) && (fp->type != &IO_TYPE_SIO))) {
    638                 shell_errno = EBADF;
     635                errno = EBADF;
    639636                return -1;
    640637        }
    641638
    642         shell_errno = sio_tcgetattr(fp, tio);
    643         if (shell_errno != 0)
     639        errno = sio_tcgetattr(fp, tio);
     640        if (errno != 0)
    644641                return 1;
    645642        return 0;
     
    651648        if ((fp == NULL) || ((fp->type != &IO_TYPE_STDIN) && (fp->type != &IO_TYPE_STDOUT)
    652649                && (fp->type != &IO_TYPE_STDERR) && (fp->type != &IO_TYPE_SIO))) {
    653                 shell_errno = EBADF;
     650                errno = EBADF;
    654651                return -1;
    655652        }
     
    660657        va_end(ap);
    661658
    662         shell_errno = sio_ioctl(fp, cmd, arg);
    663         if (shell_errno != 0)
     659        errno = sio_ioctl(fp, cmd, arg);
     660        if (errno != 0)
    664661                return 1;
    665662        return 0;
Note: See TracChangeset for help on using the changeset viewer.