Find the answer to your Linux question:
Results 1 to 3 of 3
Hallo, was bedeutet SYSCALL_DEFINE in Kernel? Ich habe die folgende Pseudocode aus fs/super.c kopiert. Kann jemand bitte mir diesen Abschnitt erklären. SYSCALL_DEFINE2(ustat, unsigned, dev, struct ustat __user *, ubuf) { ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Mar 2010
    Posts
    6

    Was ist SYSCALL_DEFINE?


    Hallo,

    was bedeutet SYSCALL_DEFINE in Kernel? Ich habe die folgende Pseudocode aus fs/super.c kopiert. Kann jemand bitte mir diesen Abschnitt erklären.

    SYSCALL_DEFINE2(ustat, unsigned, dev, struct ustat __user *, ubuf)
    {
    struct super_block *s;
    struct ustat tmp;
    struct kstatfs sbuf;
    int err = -EINVAL;

    s = user_get_super(new_decode_dev(dev));
    if (s == NULL)
    goto out;
    err = vfs_statfs(s->s_root, &sbuf);
    drop_super(s);
    if (err)
    goto out;

    memset(&tmp,0,sizeof(struct ustat));
    tmp.f_tfree = sbuf.f_bfree;
    tmp.f_tinode = sbuf.f_ffree;

    err = copy_to_user(ubuf,&tmp,sizeof(struct ustat)) ? -EFAULT : 0;
    out:
    return err;
    }


    Danke im Voraus

  2. #2
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    3,345
    Bin kein Developer, aber damit die hier anwesenden Developer dich verstehen und evtl was dazu sagen können:

    Please re-write your question in english
    You must always face the curtain with a bow.

  3. #3
    Just Joined!
    Join Date
    Mar 2010
    Posts
    6
    Hello,

    What does SYSCALL_DEFINE in kernel? I copied the following source code from fs/super.c. Can someone please explain to me this section.

    SYSCALL_DEFINE2(ustat, unsigned, dev, struct ustat __user *, ubuf)
    {
    struct super_block *s;
    struct ustat tmp;
    struct kstatfs sbuf;
    int err = -EINVAL;

    s = user_get_super(new_decode_dev(dev));
    if (s == NULL)
    goto out;
    err = vfs_statfs(s->s_root, &sbuf);
    drop_super(s);
    if (err)
    goto out;

    memset(&tmp,0,sizeof(struct ustat));
    tmp.f_tfree = sbuf.f_bfree;
    tmp.f_tinode = sbuf.f_ffree;

    err = copy_to_user(ubuf,&tmp,sizeof(struct ustat)) ? -EFAULT : 0;
    out:
    return err;
    }

    Thank

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •