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 7880395
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T04:08:08+00:00 2026-06-03T04:08:08+00:00

I created two new syscalls, but when I try to test them I get

  • 0

I created two new syscalls, but when I try to test them I get the following error:

matt@ubuntu:~/test$ gcc test.c 
test.c: In function ‘newcall’:
test.c:6:17: error: ‘sys_get_slob_amnt_free’ undeclared (first use in this function)
test.c:6:17: note: each undeclared identifier is reported only once for each function it appears in
matt@ubuntu:~/test$ 

I also tried this with syscall(sys_get_slob_amnt_free) with the same result.

Here is the test code:

#include <unistd.h>
#include <stdio.h>

unsigned long newcall()
{
        return syscall(__NR_get_slob_amnt_free);
}
int main()
{
        printf("%d\n", newcall());
        return 0;
}

In order to add these I put them in the syscall table
(/usr/src/linux-3.0/include/asm-generic/unistd.h)

#define __NR_sendmmsg 269
__SC_COMP(__NR_sendmmsg, sys_ sendmmsg, compat_sys_sendmmsg)
/** my changes here **/
#define __NR_get_slob_amnt_free 270
__SYSCALL(__NR__get_slob_amnt_free, sys_get_slob_amnt_free)
#define __NR_get_slob_amnt_claimed 271)
__SYSCALL(__NR_get_slob_amnt_claimed, sys_get_slob_amnt_claimed)
/**  /my changes **/

#undef __NR_syscalls
#define __NR_syscalls 272

And here is the code for the calls themselves (../linux-3.0/mm/slob.c)

asmlinkage unsigned int sys_get_slob_amnt_claimed()
{
    return memClaimed;
}

asmlinkage unsigned int sys_get_slob_amnt_free()
{
    return memClaimed - memUsed;
}

I’m trying to figure out whether I’m botching the test code (maybe I need to include something more? or link something?) Or if I’ve overlooked something in adding the syscall in the first place. With the amount of time it takes to recompile the kernel, it would really help me out to know where to start looking.

Admittedly, this is related to a homework assignment. The assignment is about modifying slob.c, which I have a pretty good handle on. I’m just doing this to get a peek at whether the modifications I’ve made so far are going anywhere. I appreciate any guidance you can give. Thanks!

Edit: Solved (or at least solved enough for me).

Many thanks to bdonlan! Although syscall(270) didn’t do it directly, it jogged my memory–there is another set of relevant numbers that I was neglecting entirely. The file /linux-3.0/arch/x86/kernel/syscall_table_32.c needed to be modified as well in order to properly add the syscall.

Once I added .long sys_get_slob_amnt_free and .long sys_get_slob_amnt_claimed to that file and rebuilt the kernel, I could hit my syscalls by using syscall(###) where ### is the numbering in syscall_table_32.c (not the numbering in unistd.h). I feel like they should match–but since this is just glorified debug information I think I’ll leave that mystery for another time and just call it good.

  • 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-06-03T04:08:10+00:00Added an answer on June 3, 2026 at 4:08 am

    There is another set of relevant numbers that I was needed to add. The file /linux-3.0/arch/x86/kernel/syscall_table_32.c needed to be modified as well in order to properly add the syscall.

    Once I added .long sys_get_slob_amnt_free and .long sys_get_slob_amnt_claimed to that file and rebuilt the kernel, I could hit my syscalls by using syscall(###) where ### is the numbering in syscall_table_32.c (not the numbering in unistd.h)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So following this SO question Here , i created two new sets of files:
I created two new user forms for a worksheet. After I made them I
I have a local branch work, where I created two new files a.py, b.py
I've created two entities (simplified) in C#: class Log { entries = new List<Entry>();
i am new to iPad developer, i have created two or three iPad application
Say I have two classes created work and workItem. CWorker *work = new CWorker();
In Visual Studio, two files are created when you create a new Windows Form
I have the following three arrays and need to create a new two-dimensional array
Look at the following two ways to create a new object of class Y:
i am new to iPad developer, i have created two or three iPad application

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.