Fix pipe2() and mkfifo2() syscall logic

This commit is contained in:
Gregory Nutt 2016-07-20 15:26:54 -06:00
parent a7de34b88d
commit bfc664af49
3 changed files with 40 additions and 20 deletions

View File

@ -292,24 +292,37 @@
# define SYS_dup2 (__SYS_filedesc+2) # define SYS_dup2 (__SYS_filedesc+2)
# define SYS_fcntl (__SYS_filedesc+3) # define SYS_fcntl (__SYS_filedesc+3)
# define SYS_lseek (__SYS_filedesc+4) # define SYS_lseek (__SYS_filedesc+4)
# define SYS_mkfifo2 (__SYS_filedesc+5) # define SYS_mmap (__SYS_filedesc+5)
# define SYS_mmap (__SYS_filedesc+6) # define SYS_open (__SYS_filedesc+6)
# define SYS_open (__SYS_filedesc+7) # define SYS_opendir (__SYS_filedesc+7)
# define SYS_opendir (__SYS_filedesc+8) # define SYS_readdir (__SYS_filedesc+8)
# define SYS_pipe2 (__SYS_filedesc+9) # define SYS_rewinddir (__SYS_filedesc+9)
# define SYS_readdir (__SYS_filedesc+10) # define SYS_seekdir (__SYS_filedesc+10)
# define SYS_rewinddir (__SYS_filedesc+11) # define SYS_stat (__SYS_filedesc+11)
# define SYS_seekdir (__SYS_filedesc+12) # define SYS_statfs (__SYS_filedesc+12)
# define SYS_stat (__SYS_filedesc+13) # define SYS_telldir (__SYS_filedesc+13)
# define SYS_statfs (__SYS_filedesc+14)
# define SYS_telldir (__SYS_filedesc+15) # if defined(CONFIG_PIPES) && ONFIG_DEV_PIPE_SIZE > 0
# define SYS_pipe2 (__SYS_filedesc+14)
# define __SYS_mkfifo2 (__SYS_filedesc+15)
# else
# define __SYS_mkfifo2 (__SYS_filedesc+14)
# endif
# if defined(CONFIG_PIPES) && ONFIG_DEV_FIFO_SIZE > 0
# define SYS_mkfifo2 (__SYS_mkfifo2+0)
# define __SYS_fs_fdopen (__SYS_mkfifo2+1)
# else
# define __SYS_fs_fdopen (__SYS_mkfifo2+0)
# endif
# endif
# if CONFIG_NFILE_STREAMS > 0 # if CONFIG_NFILE_STREAMS > 0
# define SYS_fs_fdopen (__SYS_filedesc+16) # define SYS_fs_fdopen (__SYS_fs_fdopen+0)
# define SYS_sched_getstreams (__SYS_filedesc+17) # define SYS_sched_getstreams (__SYS_fs_fdopen+1)
# define __SYS_sendfile (__SYS_filedesc+18) # define __SYS_sendfile (__SYS_fs_fdopen+2)
# else # else
# define __SYS_sendfile (__SYS_filedesc+16) # define __SYS_sendfile (__SYS_fs_fdopen+0)
# endif # endif
# if defined(CONFIG_NET_SENDFILE) # if defined(CONFIG_NET_SENDFILE)

View File

@ -208,11 +208,9 @@ SYSCALL_LOOKUP(up_assert, 2, STUB_up_assert)
SYSCALL_LOOKUP(dup2, 2, STUB_dup2) SYSCALL_LOOKUP(dup2, 2, STUB_dup2)
SYSCALL_LOOKUP(fcntl, 6, STUB_fcntl) SYSCALL_LOOKUP(fcntl, 6, STUB_fcntl)
SYSCALL_LOOKUP(lseek, 3, STUB_lseek) SYSCALL_LOOKUP(lseek, 3, STUB_lseek)
SYSCALL_LOOKUP(mkfifo2, 3, STUB_mkfifo2)
SYSCALL_LOOKUP(mmap, 6, STUB_mmap) SYSCALL_LOOKUP(mmap, 6, STUB_mmap)
SYSCALL_LOOKUP(open, 6, STUB_open) SYSCALL_LOOKUP(open, 6, STUB_open)
SYSCALL_LOOKUP(opendir, 1, STUB_opendir) SYSCALL_LOOKUP(opendir, 1, STUB_opendir)
SYSCALL_LOOKUP(pipe2, 2, STUB_pipe2)
SYSCALL_LOOKUP(readdir, 1, STUB_readdir) SYSCALL_LOOKUP(readdir, 1, STUB_readdir)
SYSCALL_LOOKUP(rewinddir, 1, STUB_rewinddir) SYSCALL_LOOKUP(rewinddir, 1, STUB_rewinddir)
SYSCALL_LOOKUP(seekdir, 2, STUB_seekdir) SYSCALL_LOOKUP(seekdir, 2, STUB_seekdir)
@ -220,6 +218,14 @@ SYSCALL_LOOKUP(up_assert, 2, STUB_up_assert)
SYSCALL_LOOKUP(statfs, 2, STUB_statfs) SYSCALL_LOOKUP(statfs, 2, STUB_statfs)
SYSCALL_LOOKUP(telldir, 1, STUB_telldir) SYSCALL_LOOKUP(telldir, 1, STUB_telldir)
# if defined(CONFIG_PIPES) && ONFIG_DEV_PIPE_SIZE > 0
SYSCALL_LOOKUP(mkfifo2, 3, STUB_mkfifo2)
# endif
# if defined(CONFIG_PIPES) && ONFIG_DEV_FIFO_SIZE > 0
SYSCALL_LOOKUP(pipe2, 2, STUB_pipe2)
# endif
# if CONFIG_NFILE_STREAMS > 0 # if CONFIG_NFILE_STREAMS > 0
SYSCALL_LOOKUP(fdopen, 3, STUB_fs_fdopen) SYSCALL_LOOKUP(fdopen, 3, STUB_fs_fdopen)
SYSCALL_LOOKUP(sched_getstreams, 0, STUB_sched_getstreams) SYSCALL_LOOKUP(sched_getstreams, 0, STUB_sched_getstreams)

View File

@ -214,8 +214,6 @@ uintptr_t STUB_fcntl(int nbr, uintptr_t parm1, uintptr_t parm2,
uintptr_t parm6); uintptr_t parm6);
uintptr_t STUB_lseek(int nbr, uintptr_t parm1, uintptr_t parm2, uintptr_t STUB_lseek(int nbr, uintptr_t parm1, uintptr_t parm2,
uintptr_t parm3); uintptr_t parm3);
uintptr_t STUB_mkfifo2(int nbr, uintptr_t parm1, uintptr_t parm2,
uintptr_t parm3);
uintptr_t STUB_mmap(int nbr, uintptr_t parm1, uintptr_t parm2, uintptr_t STUB_mmap(int nbr, uintptr_t parm1, uintptr_t parm2,
uintptr_t parm3, uintptr_t parm4, uintptr_t parm5, uintptr_t parm3, uintptr_t parm4, uintptr_t parm5,
uintptr_t parm6); uintptr_t parm6);
@ -223,7 +221,6 @@ uintptr_t STUB_open(int nbr, uintptr_t parm1, uintptr_t parm2,
uintptr_t parm3, uintptr_t parm4, uintptr_t parm5, uintptr_t parm3, uintptr_t parm4, uintptr_t parm5,
uintptr_t parm6); uintptr_t parm6);
uintptr_t STUB_opendir(int nbr, uintptr_t parm1); uintptr_t STUB_opendir(int nbr, uintptr_t parm1);
uintptr_t STUB_pipe2(int nbr, uintptr_t parm1, uintptr_t parm2);
uintptr_t STUB_readdir(int nbr, uintptr_t parm1); uintptr_t STUB_readdir(int nbr, uintptr_t parm1);
uintptr_t STUB_rewinddir(int nbr, uintptr_t parm1); uintptr_t STUB_rewinddir(int nbr, uintptr_t parm1);
uintptr_t STUB_seekdir(int nbr, uintptr_t parm1, uintptr_t parm2); uintptr_t STUB_seekdir(int nbr, uintptr_t parm1, uintptr_t parm2);
@ -231,6 +228,10 @@ uintptr_t STUB_stat(int nbr, uintptr_t parm1, uintptr_t parm2);
uintptr_t STUB_statfs(int nbr, uintptr_t parm1, uintptr_t parm2); uintptr_t STUB_statfs(int nbr, uintptr_t parm1, uintptr_t parm2);
uintptr_t STUB_telldir(int nbr, uintptr_t parm1); uintptr_t STUB_telldir(int nbr, uintptr_t parm1);
uintptr_t STUB_mkfifo2(int nbr, uintptr_t parm1, uintptr_t parm2,
uintptr_t parm3);
uintptr_t STUB_pipe2(int nbr, uintptr_t parm1, uintptr_t parm2);
uintptr_t STUB_fs_fdopen(int nbr, uintptr_t parm1, uintptr_t parm2, uintptr_t STUB_fs_fdopen(int nbr, uintptr_t parm1, uintptr_t parm2,
uintptr_t parm3); uintptr_t parm3);
uintptr_t STUB_sched_getstreams(int nbr); uintptr_t STUB_sched_getstreams(int nbr);