[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freebsd-questions
Subject:    Re: Regarding MALLOC_DEFINE related issues in kernel code usage
From:       Shamsher singh <meetshamsher () gmail ! com>
Date:       2021-07-28 10:45:10
Message-ID: 9E45B3A6-451E-4F92-ACC6-8B63750F9BE4 () gmail ! com
[Download RAW message or body]

Hi,
Please ignore this mail. It's done and working fine.

Thanks & regards
Shamsher

> On 28-Jul-2021, at 12:32 PM, Shamsher singh <meetshamsher@gmail.com> wrote:
> 
> Hi,
> I am using below test.c file (shown as example) in freebsd13 and getting below issues:
> 
> For #include <sys/systm.h> and #include <sys/malloc.h>
> 
> # cat test.c 
> #define _KERNEL
> #include <sys/types.h>
> #include <sys/module.h>
> #include <sys/systm.h>  
> #include <sys/param.h> 
> #include <sys/kernel.h>
> #include <sys/malloc.h>
> #include <sys/kthread.h>
> #include <sys/unistd.h>
> #include <stdlib.h> 
> #include <sys/param.h>
> #include <sys/kernel.h>
> #include <sys/types.h>
> 
> MALLOC_DEFINE(M_NODE, "NODE1", "test Node");
> int main() {
>     int *ptr;
>     ptr = (int*)malloc(sizeof(int), M_NODE ,M_WAITOK)
>     printf("ptr=%p\n",ptr);
>     return 0;
> }
> [root@FreeBSD_build_machine1 ~/iproot/freebsd/mods/drivers/dell_bios]# cc test.c 
> In file included from test.c:4:
> In file included from /usr/include/sys/systm.h:179:
> /usr/include/sys/kpilite.h:33:10: fatal error: 'offset.inc' file not found
> #include "offset.inc"
>          ^~~~~~~~~~~~
> 1 error generated.
> 
> If commenting above header then getting issues like:
> In file included from /usr/include/sys/malloc.h:43:
> In file included from /usr/include/sys/systm.h:179:
> /usr/include/sys/kpilite.h:33:10: fatal error: 'offset.inc' file not found
> #include "offset.inc"
> 
> 
> 
> The MALLOC_DEFINE is defined in malloc.h with macros _KERNEL.
> So can't avoid these above header files.
> 
> Can you please suggest me what am I missing here ?
> 
> Note: This similar issues I am facing for smbios.
> 
> Thanks & regards
> Shamsher Singh

_______________________________________________
freebsd-questions@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org"

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic