Thread: Minix and system calls!!!help!

  1. #1
    Registered User
    Join Date
    Apr 2008
    Posts
    11

    Minix and system calls!!!help!

    Need some help with minix!!! To put it simple,what i want is,when i execute a system call, me or the OS,to also print a random message followed be the system call's name i just used.
    Any help would be appreciated.

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    You will have to add code in the system call function itself to produce this information. This is implemented in most Unix varieties for the strace command.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    Registered User
    Join Date
    Apr 2008
    Posts
    11
    i need to print the msg with the name of system call ,whatever system call i use.when i typing ls for example with what order this call execute?
    if i want to print just something when a call is executing i can put a printf in exec right?but what about the name of the call?

  4. #4
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Quote Originally Posted by squeezah View Post
    Need some help with minix!!! To put it simple,what i want is,when i execute a system call, me or the OS,to also print a random message followed be the system call's name i just used.
    Any help would be appreciated.
    Capturing a process's system calls is usually done with ptrace(). I have no idea if Minix has it, but I assume it does.

  5. #5
    Registered User
    Join Date
    Apr 2008
    Posts
    11
    strace doesnt work in minix...

  6. #6
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Quote Originally Posted by squeezah View Post
    strace doesnt work in minix...
    strace works by using ptrace(). Do you at least have ptrace() on Minix? If not, you'll have to hack the standard library to hook the syscall entry points, which will be a pain.

  7. #7
    Registered User
    Join Date
    Apr 2008
    Posts
    11
    no other way to 'capture' the system call's name??

  8. #8
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Quote Originally Posted by squeezah View Post
    no other way to 'capture' the system call's name??
    No. I keep suggesting ptrace() and you keep ignoring it for some reason.

  9. #9
    Registered User
    Join Date
    Apr 2008
    Posts
    11
    am not ignoring it how can i use it?

  10. #10
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Quote Originally Posted by squeezah View Post
    am not ignoring it how can i use it?
    Surely Minix has a manual? It would be far more informative than my random guesses. Googling for "minix ptrace" might be useful.

  11. #11
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    It is, I just did. Not quite as helpful as you'd think, though.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  12. #12
    Registered User
    Join Date
    Apr 2008
    Posts
    11
    i use man ptrace and says
    Note: This manual page has no relation to Minix. Someone who
    knows
    ptrace() has to check, or rewrite, this page. :P

  13. #13
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Quote Originally Posted by CornedBee View Post
    It is, I just did. Not quite as helpful as you'd think, though.
    Well, Minix is getting old in the tooth. If there's no good manual out there anymore, then the OP will have to resort to random hacking.

    Most UNIX-like operating systems provide equivalent functionality through ptrace(), but the details are all slightly different.

  14. #14
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    You could also look at the source of ptrace. I think it's the kernel function do_trace, here:
    https://gforge.cs.vu.nl/plugins/scms...ix&view=markup
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  15. #15
    Registered User
    Join Date
    Apr 2008
    Posts
    11
    can i ask something ?maybe is wrong or stupid:P a call is executing through exec right?which is the function that reads from shell and l8r other fuction/call call exec??

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. minix system call pls help for project
    By porvas in forum Linux Programming
    Replies: 2
    Last Post: 06-14-2009, 02:40 AM
  2. Access file's info in MINIX
    By Zuko in forum Linux Programming
    Replies: 3
    Last Post: 01-07-2008, 10:14 AM
  3. starting linux's source code and kernel
    By sawer in forum Linux Programming
    Replies: 9
    Last Post: 08-01-2006, 07:46 AM