How to find users with common interests?
how to add syscall with arguments through KLD
Hello Guest
  
  • Login
• Register…
• Start blog
  • Who, Where, When
• What can I do?
• What to Read?
  • Polls
• Avatars
• Interests
  • Cities and Countries
• Random blog
• Users search
  • Search
• Games
• Tests
• RYXI
  • Сообщества
• Talxy Chat
• Horoscope
• Online
 
Зарегистрируйся!

RYXI > FreeBSD > how to add syscall with arguments through KLD 21 April 2006 08:16:58

  Recent blog posts: 
  Forums:   
  Discuss: 
  Recent forum topics: 
  Recent forum comments:
  Moderators:

how to add syscall with arguments through KLD

Guhoward@Gmail.Com 21 April 2006 08:16:58
 Hi all

I wanna add syscall through KLD in FreeBSD 6.0, and have studied the
example code at /usr/share/example/­kld/.

But how could I add arguments to syscall? I tried below way, but failed
with compiler error.

syscall.c:60: warning: initialization from incompatible pointer type
*** Error code 1

Need help.

---syscall.c

#include <sys/types.h>
#include <sys/param.h>
#include <sys/proc.h>
#include <sys/module.h>
#include <sys/sysent.h>
#include <sys/kernel.h>
#include <sys/systm.h>

struct hello_args{
char *str;
}

/*
* The function for implementing the syscall.
*/

static int
hello (struct thread *td, struct hello_args *uap)
{
printf ("hello kernel\n");
printf ("%s\n",uap->str);
return 0;
}

/*
* The `sysent' for the new syscall
*/

static struct sysent hello_sysent = {
1, /* sy_narg */
hello /* sy_call */
};

/*
* The offset in sysent where the syscall is allocated.
*/

static int offset = NO_SYSCALL;

/*
* The function called at load/unload.
*/

static int
load (struct module *module, int cmd, void *arg)
{
int error = 0;

switch (cmd) {
case MOD_LOAD :
printf ("syscall loaded at %d\n", offset);
break;
case MOD_UNLOAD :
printf ("syscall unloaded from %d\n", offset);
break;
default :
error = EOPNOTSUPP;
break;
}
return error;
}

SYSCALL_MODULE(sysc­all, &offset, &hello_sysent, load, NULL);

Add comment
 

Add new comment

As:
Login:  Password:  
 
 
  
 
Пожалуйста, относитесь к собеседникам уважительно, не используйте нецензурные слова, не злоупотребляйте заглавными буквами, не публикуйте рекламу и объявления о купле/продаже, а также материалы нарушающие сетевой этикет или УК РФ.


RYXI > FreeBSD > how to add syscall with arguments through KLD 21 April 2006 08:16:58

see also:
Re: Sound Libraries for Sale SCAMMER…
Re: downloading Chase
Starting Quicken from scratch question
пройди тесты:
see also:
auuuuu
nikogo sdes net ///
Ja izmenil diz,nu kak?

  Copyright © 2001—2008 RYXI
Idea: Miсhael Monashev
Помощь и задать вопросы можно в сообществе support.ryxi.com.
Сообщения об ошибках оставляем в сообществе bugs.ryxi.com.
Предложения и комментарии пишем в сообществе suggest.ryxi.com.
Информация для родителей.
Write us at:
If you would like to report an abuse of our service, such as a spam message, please .