LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-13-2010, 10:51 AM   #1
flea89
LQ Newbie
 
Registered: Mar 2010
Posts: 15

Rep: Reputation: 0
Problem with kernel call


Hello everyone. I am trying to make a new kernel call in minix, which will get an integer as input and return the mux of this integer * 4260.

I have made the nessecary additions (according to other existing kernel calls) in:
Makefile (cd /usr/src/kernel/system)
com.h (cd /usr/src/include/minix)
system.h and system.c (cd /usr/src/kernel)

Now, I have also created two .c files
The following one, do_mux.c is in /usr/src/kernel/system:
Code:

Code:
#if USE_MUX

PUBLIC int do_mux(m_ptr)
message *m_ptr;
{
	int num;
	
	num = m_ptr->m1_i1; /* num takes the value of m1_i1 of passed message structure */
						/* in which m_ptr points to */
	return num * 4260; /* return the mux of given number x AM number */
}

#endif /* USE_MUX */
and this one, 3.c is in /usr/src/kernel
Code:

Code:
#include <lib.h>
#include <minix/com.h>
#include <stdio.h>
#include <stdlib.h>
#include <minix/syslib.h>

int my_mux(int num)
{
	message m; /* creates the message structure which will pass to kernel call do_mux */
	
	m.m1_i1 = num; /* stores the value of num into an integer member of message structure m */
					/* in order to pass its value into the kernel call */
	return (_taskcall(SYSTASK, SYS_MUX, &m)); /* invokes do_mux kernel call */
}

int main(int argc, char *argv[2])
{
	int number = atoi(argv[1]); /* converts the second argument passed into its integer representation */
	
	printf("\n%d*4260 = %d\n", number, my_mux(number)); /* prints the mux of the given number x 4260 calculated by the kernel call do_mux */
	
	return 0; /* terminates */
}
The thing was, after saying 'make hdboot' (for the changes to work), and rebooting minix, to run
3.c and get for example, if I run it with 1 as input,
1x4260=4260
Instead, with whatever input i run it, it prints =-104.
I know that -104 means CALL DENIED, but I really dont know how to fix this...
Any ideas? sorry for the extra large post
 
Old 04-14-2010, 08:05 PM   #2
smeezekitty
Senior Member
 
Registered: Sep 2009
Location: Washington U.S.
Distribution: M$ Windows / Debian / Ubuntu / DSL / many others
Posts: 2,339

Rep: Reputation: 231Reputation: 231Reputation: 231
minix? minix? MINIX?
Isn't that like an ancient predecessor to Linux? LOL.
I doubt people at this forum will know much about it.
Any chance of using something more modern?

Last edited by smeezekitty; 04-14-2010 at 08:06 PM.
 
Old 04-15-2010, 05:48 AM   #3
ravishekhar.82
Member
 
Registered: Feb 2010
Posts: 30

Rep: Reputation: 15
Look into MINIX3 google group.
http://groups.google.com/group/minix3

You might get some help out there.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with kernel call flea89 Linux - Newbie 2 04-13-2010 01:12 PM
[SOLVED] I added a system call in the Linux kernel, but a problem occured. corone Linux - Kernel 2 08-26-2009 05:22 AM
How do i call a kernel call that i have created in Minix jianelisj Programming 1 04-03-2008 03:11 PM
How to call function in kernel vishalbutte Programming 10 02-07-2006 02:50 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:26 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration