sys_getprivtab doesnt work in user program - Minix

This is a discussion on sys_getprivtab doesnt work in user program - Minix ; hi when i press the function keys under minix, the is server (does that stand for information server?) makes sys_getinfo calls to display system information now, i tried to make use of these calls in my own programs but it ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: sys_getprivtab doesnt work in user program

  1. sys_getprivtab doesnt work in user program

    hi
    when i press the function keys under minix, the is server (does that
    stand for information server?) makes sys_getinfo calls to display
    system information
    now, i tried to make use of these calls in my own programs but it wont
    work:

    #include
    #include
    #include
    ....
    void main(void) {
    printf("%u\n", sys_getprivtab(privtab));
    }

    When I run this, I get output:

    4294967192

    Where I would expect 0 (= OK)

    Whats my problem here?

    Thanx,

    Martin


  2. Re: sys_getprivtab doesnt work in user program



    On Dec 29, 6:09 am, "sancho1980" wrote:
    > hi
    > when i press the function keys under minix, the is server (does that
    > stand for information server?)


    I think it does mean information server.

    > makes sys_getinfo calls to display
    > system information
    > now, i tried to make use of these calls in my own programs but it wont
    > work:
    >
    > #include
    > #include
    > #include
    > ...
    > void main(void) {
    > printf("%u\n", sys_getprivtab(privtab));
    >
    > }When I run this, I get output:
    >
    > 4294967192


    It's actually error code -104. Error codes are signed, not unsigned.
    Error -104 means "no permission for system call" according to
    "/usr/include/errno.h", and the reason you get it is because the
    children of the "init" process are not allowed to make system calls.
    However, if you would like to change this so that you can do some
    testing in user-space, go into "kernel/table.c" and change the
    "image[]" record for INIT_PROC_NR's "call" field to "DRV_C". Then go
    into "tools/" and type "make hdboot" and hard link "/boot/image_big" to
    the proper "/boot/image/3.1.2arX" file and reboot.

    Remember to change all this back when you are finished testing, because
    init's children are supposed to do everything via PM, FS, and RS.
    Leave system calls unlocked probably has lots of security issues, but I
    completely understand why you'd want to test your code that way (I
    recently had to do something like that).

    Hope this helps!


  3. Re: sys_getprivtab doesnt work in user program

    Hi
    thanx for the tip
    Actually the problem has deeper roots: I wanted to modify the kernel so
    that it collects information about messages sent by who to whom; then I
    wanted to implement a system call that would return this messages
    array; but I want to make the system call accessible to user
    processes...what do you mean when you say "the children of the "init"
    process are not allowed to make system calls"...there sure DO exist
    standard posix system calls in minix which are accessible to user
    processes...so i guess you're talking about kernel calls...also, there
    seems to be another service that seems to be allowed to make kernel
    calls which is not mentioned in the minix 3 book and that is
    "is"...what does it stand for, "information server"? all i've found out
    is that it mysteriously provides internal kernel information whenever a
    function key in pressed...i've also found out which table in
    /usr/src/servers/is/ i have to modify to implement another dump...but i
    don't understand the mechanism of catching the pressed function
    key...in any case, this server does not seem to go via pm, fm or rs
    when making kernel calls...


    hope you can help me again!

    thanx,

    martin

    William M. Grim schrieb:

    > On Dec 29, 6:09 am, "sancho1980" wrote:
    > > hi
    > > when i press the function keys under minix, the is server (does that
    > > stand for information server?)

    >
    > I think it does mean information server.
    >
    > > makes sys_getinfo calls to display
    > > system information
    > > now, i tried to make use of these calls in my own programs but it wont
    > > work:
    > >
    > > #include
    > > #include
    > > #include
    > > ...
    > > void main(void) {
    > > printf("%u\n", sys_getprivtab(privtab));
    > >
    > > }When I run this, I get output:
    > >
    > > 4294967192

    >
    > It's actually error code -104. Error codes are signed, not unsigned.
    > Error -104 means "no permission for system call" according to
    > "/usr/include/errno.h", and the reason you get it is because the
    > children of the "init" process are not allowed to make system calls.
    > However, if you would like to change this so that you can do some
    > testing in user-space, go into "kernel/table.c" and change the
    > "image[]" record for INIT_PROC_NR's "call" field to "DRV_C". Then go
    > into "tools/" and type "make hdboot" and hard link "/boot/image_big" to
    > the proper "/boot/image/3.1.2arX" file and reboot.
    >
    > Remember to change all this back when you are finished testing, because
    > init's children are supposed to do everything via PM, FS, and RS.
    > Leave system calls unlocked probably has lots of security issues, but I
    > completely understand why you'd want to test your code that way (I
    > recently had to do something like that).
    >
    > Hope this helps!



+ Reply to Thread