C Board  

Go Back   C Board > Platform Specific Boards > Linux Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 04-01-2008, 09:07 AM   #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.
squeezah is offline   Reply With Quote
Old 04-01-2008, 09:08 AM   #2
Kernel hacker
 
Join Date: Jul 2007
Location: Farncombe, Surrey, England
Posts: 15,686
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.
matsp is offline   Reply With Quote
Old 04-01-2008, 09:20 AM   #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?
squeezah is offline   Reply With Quote
Old 04-01-2008, 09:35 AM   #4
Senior software engineer
 
brewbuck's Avatar
 
Join Date: Mar 2007
Location: Portland, OR
Posts: 5,768
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.
brewbuck is offline   Reply With Quote
Old 04-01-2008, 10:44 AM   #5
Registered User
 
Join Date: Apr 2008
Posts: 11
strace doesnt work in minix...
squeezah is offline   Reply With Quote
Old 04-01-2008, 12:06 PM   #6
Senior software engineer
 
brewbuck's Avatar
 
Join Date: Mar 2007
Location: Portland, OR
Posts: 5,768
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.
brewbuck is offline   Reply With Quote
Old 04-01-2008, 12:50 PM   #7
Registered User
 
Join Date: Apr 2008
Posts: 11
no other way to 'capture' the system call's name??
squeezah is offline   Reply With Quote
Old 04-01-2008, 01:06 PM   #8
Senior software engineer
 
brewbuck's Avatar
 
Join Date: Mar 2007
Location: Portland, OR
Posts: 5,768
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.
brewbuck is offline   Reply With Quote
Old 04-01-2008, 02:15 PM   #9
Registered User
 
Join Date: Apr 2008
Posts: 11
am not ignoring it how can i use it?
squeezah is offline   Reply With Quote
Old 04-01-2008, 02:38 PM   #10
Senior software engineer
 
brewbuck's Avatar
 
Join Date: Mar 2007
Location: Portland, OR
Posts: 5,768
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.
brewbuck is offline   Reply With Quote
Old 04-01-2008, 02:45 PM   #11
Cat without Hat
 
CornedBee's Avatar
 
Join Date: Apr 2003
Posts: 8,492
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
CornedBee is offline   Reply With Quote
Old 04-01-2008, 02:58 PM   #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
squeezah is offline   Reply With Quote
Old 04-01-2008, 02:58 PM   #13
Senior software engineer
 
brewbuck's Avatar
 
Join Date: Mar 2007
Location: Portland, OR
Posts: 5,768
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.
brewbuck is offline   Reply With Quote
Old 04-01-2008, 03:01 PM   #14
Cat without Hat
 
CornedBee's Avatar
 
Join Date: Apr 2003
Posts: 8,492
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
CornedBee is offline   Reply With Quote
Old 04-01-2008, 03:05 PM   #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??
squeezah is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

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


All times are GMT -6. The time now is 10:16 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22