Re: [PATCH V3 05/26] csky: System Call
From: Guo Ren
Date: Thu Sep 06 2018 - 21:49:27 EST
On Thu, Sep 06, 2018 at 04:10:49PM +0200, Arnd Bergmann wrote:
> On Wed, Sep 5, 2018 at 2:08 PM Guo Ren <ren_guo@xxxxxxxxx> wrote:
>
> > +SYSCALL_DEFINE6(mmap2,
> > + unsigned long, addr,
> > + unsigned long, len,
> > + unsigned long, prot,
> > + unsigned long, flags,
> > + unsigned long, fd,
> > + off_t, offset)
> > +{
> > + if (unlikely(offset & (~PAGE_MASK >> 12)))
> > + return -EINVAL;
> > + return sys_mmap_pgoff(addr, len, prot, flags, fd,
> > + offset >> (PAGE_SHIFT - 12));
> > +}
>
> Please call ksys_mmap_pgoff() instead of sys_mmap_pgoff() here.
Ok.
> The prototype in include/asm-generic/syscalls.h uses 'unsigned long'
> for the last argument as well, not off_t.
Ok, unsigned long for last argument.
> > +struct mmap_arg_struct {
> > + unsigned long addr;
> > + unsigned long len;
> > + unsigned long prot;
> > + unsigned long flags;
> > + unsigned long fd;
> > + unsigned long offset;
> > +};
> > +
> > +SYSCALL_DEFINE1(mmap,
> > + struct mmap_arg_struct *, arg)
>
> Something is still wrong here, there should be no way to
> call sys_mmap(), since it's not in the syscall table.
You are right, remove it.
> > + return sys_fadvise64_64(fd, offset, len, advice);
> > +}
>
> And call ksys_fadvise64_64() here.
Ok.
Guo Ren