mirror of
https://github.com/apache/nuttx.git
synced 2026-06-05 07:12:54 +08:00
Ensure the kernel component don't call userspace API
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
committed by
Masayuki Ishikawa
parent
cf73496d9e
commit
9473434587
@@ -40,9 +40,10 @@
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/mount.h>
|
||||
#include <syslog.h>
|
||||
|
||||
#include <nuttx/fs/fs.h>
|
||||
|
||||
#include "makerlisp.h"
|
||||
|
||||
/****************************************************************************
|
||||
@@ -70,7 +71,7 @@ int ez80_bringup(void)
|
||||
#ifdef CONFIG_FS_PROCFS
|
||||
/* Mount the procfs file system */
|
||||
|
||||
ret = mount(NULL, "/proc", "procfs", 0, NULL);
|
||||
ret = nx_mount(NULL, "/proc", "procfs", 0, NULL);
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret);
|
||||
|
||||
@@ -25,9 +25,10 @@
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/mount.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/fs/fs.h>
|
||||
|
||||
#include "z20x.h"
|
||||
|
||||
/****************************************************************************
|
||||
@@ -55,7 +56,7 @@ int ez80_bringup(void)
|
||||
#ifdef CONFIG_FS_PROCFS
|
||||
/* Mount the procfs file system */
|
||||
|
||||
ret = mount(NULL, "/proc", "procfs", 0, NULL);
|
||||
ret = nx_mount(NULL, "/proc", "procfs", 0, NULL);
|
||||
if (ret < 0)
|
||||
{
|
||||
ferr("ERROR: Failed to mount procfs at /proc: %d\n", ret);
|
||||
|
||||
@@ -24,8 +24,6 @@
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/mount.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
|
||||
@@ -104,7 +104,7 @@ static int w25_read_hex(FAR uint24_t *len)
|
||||
fd = open(W25_CHARDEV, O_WRONLY);
|
||||
if (fd < 0)
|
||||
{
|
||||
ret = -get_errno();
|
||||
ret = -errno;
|
||||
fprintf(stderr, "ERROR: Failed to open %s: %d\n", W25_CHARDEV, ret);
|
||||
return ret;
|
||||
}
|
||||
@@ -170,7 +170,7 @@ static int w25_write(int fd, FAR const void *src, size_t len)
|
||||
nwritten = write(fd, src, remaining);
|
||||
if (nwritten <= 0)
|
||||
{
|
||||
int errcode = get_errno();
|
||||
int errcode = errno;
|
||||
if (errno != EINTR)
|
||||
{
|
||||
fprintf(stderr, "ERROR: Write failed: %d\n", errcode);
|
||||
@@ -207,7 +207,7 @@ static int w25_write_binary(FAR const struct prog_header_s *hdr)
|
||||
fd = open(W25_CHARDEV, O_WRONLY);
|
||||
if (fd < 0)
|
||||
{
|
||||
ret = -get_errno();
|
||||
ret = -errno;
|
||||
fprintf(stderr, "ERROR: Failed to open %s: %d\n", W25_CHARDEV, ret);
|
||||
return ret;
|
||||
}
|
||||
@@ -255,7 +255,7 @@ static int w25_read(int fd, FAR void *dest, size_t len)
|
||||
nread = read(fd, dest, remaining);
|
||||
if (nread <= 0)
|
||||
{
|
||||
int errcode = get_errno();
|
||||
int errcode = errno;
|
||||
if (errno != EINTR)
|
||||
{
|
||||
fprintf(stderr, "ERROR: Read failed: %d\n", errcode);
|
||||
@@ -291,7 +291,7 @@ static int w25_read_binary(FAR struct prog_header_s *hdr)
|
||||
fd = open(W25_CHARDEV, O_RDONLY);
|
||||
if (fd < 0)
|
||||
{
|
||||
ret = -get_errno();
|
||||
ret = -errno;
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -553,7 +553,7 @@ static int w25_boot_program(void)
|
||||
ret = tcdrain(1);
|
||||
if (ret < 0)
|
||||
{
|
||||
ret = -get_errno();
|
||||
ret = -errno;
|
||||
fprintf(stderr, "ERROR: tcdrain() failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
@@ -590,7 +590,7 @@ static int w25_wait_keypress(FAR char *keyset, int nseconds)
|
||||
fd = dup(0);
|
||||
if (fd < 0)
|
||||
{
|
||||
ret = -get_errno();
|
||||
ret = -errno;
|
||||
fprintf(stderr, "ERROR: Failed to dup stdin: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
@@ -605,7 +605,7 @@ static int w25_wait_keypress(FAR char *keyset, int nseconds)
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
ret = -get_errno();
|
||||
ret = -errno;
|
||||
fprintf(stderr, "ERROR: fcnt() failed: %d\n", ret);
|
||||
close(fd) ;
|
||||
return ret;
|
||||
@@ -635,7 +635,7 @@ static int w25_wait_keypress(FAR char *keyset, int nseconds)
|
||||
|
||||
if (nread < 0)
|
||||
{
|
||||
int errcode = get_errno();
|
||||
int errcode = errno;
|
||||
|
||||
/* If is not an error if a signal occurred or if there is
|
||||
* no key pressed.
|
||||
|
||||
Reference in New Issue
Block a user