LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Closed Thread
  Search this Thread
Old 04-13-2010, 11:10 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:
#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:
#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-13-2010, 12:22 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,331
Blog Entries: 55

Rep: Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529
Please post your thread once and in only one forum. Posting a single thread in the most relevant forum will make it easier for members to help you and will keep the discussion in one place. This thread should be closed because it is a duplicate of http://www.linuxquestions.org/questi...l-call-801763/.
 
Old 04-13-2010, 02:12 PM   #3
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Closing the original in favour of the more sensibly placed dupe.
 
  


Closed Thread


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
[SOLVED] I added a system call in the Linux kernel, but a problem occured. corone Linux - Kernel 2 08-26-2009 06:22 AM
How do i call a kernel call that i have created in Minix jianelisj Programming 1 04-03-2008 04:11 PM
How to call function in kernel vishalbutte Programming 10 02-07-2006 03:50 AM
new kernel system call Ephracis Programming 1 05-06-2005 11:23 AM


All times are GMT -5. The time now is 12:22 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration