Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6743669
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:59:21+00:00 2026-05-26T11:59:21+00:00

I want to add a system call using KLD in FreeBSD 8.2 that has

  • 0

I want to add a system call using KLD in FreeBSD 8.2 that has some arguments (1 argument here)
I’ve done the following (I’ve actually changed the the syscall.c in /usr/share/examples/kld/syscalls/module/syscall.c)

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

struct hellomet_args{
    int a;
};

static int
hellomet(struct thread *td, struct hellomet_args *arg)
{
    int a = arg->a;

    printf("hello secondish kernel %d  \n",a);
    return (0);
}

static struct sysent hellomet_sysent = {
    1,          
    hellomet            
};




static int offset = NO_SYSCALL;


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(hellomet, &offset, &hellomet_sysent, load, NULL);

When I make this file using provided Makefile in module directory I get :

cc1: warnings being treated as errors syscall.c:56: warning: initialization from incompatible pointer type
*** Error code 1

Stop in /usr/share/examples/kld/syscall/module.
*** Error code 1

What’s the problem with this code?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T11:59:22+00:00Added an answer on May 26, 2026 at 11:59 am

    You are initialising the sy_call member of hellomet_sysent with a function pointer that doesn’t match the typedef. sy_call is of type sy_call_t, which is defined as being a function that takes (struct thread* , void*) and returns int. Your call takes (struct thread*, struct hellomet_args *) instead.

    Try something like this:

    static struct sysent hellomet_sysent = {
        1,          
        (sy_call_t*) hellomet            
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to setup symlinks and add some lines to system configuration files, I
I have an htm-file, lets call it somehtml.htm, with some HTML that I want
I want to add a javascript based chat system to my web app. I
I have a System.Windows.Forms.Button control, and I want to add a hover-text explanation of
I have a website built with ASP.NET (3.5) and want add some level of
I have a list of string values that I want add to a hashtable
I want to add some jQuery functionality to our sites where one piece of
Consider the following code: namespace DisposeTest { using System; class Program { static void
I need a flexible way to log keyvalue pairs of arguments using System.Diagnostics.Trace. Basically,
I am using the HtmlTextWriter to create some HTML for me. I want to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.