# unknown type name intrmask_t when include sys/systm.h



## jchan21 (Apr 12, 2020)

I am new to freebsd, just imported

#include <sys/systm.h> errors Not find  uintfptr_t Intrmask_t  definitions,

Do yall know what else I need to include or change?


```
n file included from main.c:4:
/usr/include/sys/systm.h:419:39: error: unknown type name 'uintfptr_t'; did you
      mean 'uintptr_t'?
void    profclock(int cnt, int usermode, uintfptr_t pc);
                                         ^
/usr/include/sys/_stdint.h:80:22: note: 'uintptr_t' declared here
typedef uintptr_t             uintptr_t;
                                ^
In file included from main.c:4:
/usr/include/sys/systm.h:480:17: error: unknown type name 'intrmask_t'; did you
      mean 'intmax_t'?
static inline intrmask_t      splbio(void)            { return 0; }
                ^
/usr/include/sys/_stdint.h:84:21: note: 'intmax_t' declared here
typedef intmax_t              intmax_t;
         In file included from main.c:4:
/usr/include/sys/systm.h:419:39: error: unknown type name 'uintfptr_t'; did you
      mean 'uintptr_t'?
void    profclock(int cnt, int usermode, uintfptr_t pc);
                                         ^
/usr/include/sys/_stdint.h:80:22: note: 'uintptr_t' declared here
typedef uintptr_t             uintptr_t;
```


----------



## ralphbsz (Apr 13, 2020)

A: If you want real help, you need to explain to us what you are really trying to accomplish: what are you compiling, where did you get it from, ...

B: Try including types.h first. It might help, there is a definition of uintfptr_t in there (line 277 on my machine). Why didn't you try "grep uintfptr_t /usr/include/sys/*" first?


----------



## mark_j (Apr 13, 2020)

jchan21 said:


> I am new to freebsd, just imported
> 
> #include <sys/systm.h> errors Not find  uintfptr_t Intrmask_t  definitions,
> 
> ...



I'm not sure what you're working on, but if you're delving into interrupt priority levels, then you would probably know what other include files are required to bring in interrupt pointer structures? No?

I am also not sure why FreeBSD still uses splbio(). In NetBSD, it moved to splvm() many, many years ago.

In fact, I just looked at the include file, and noted this:

```
/* Stubs for obsolete functions that used to be for interrupt management */
static __inline intrmask_t      splbio(void)            { return 0; }
```

So, what are you doing? Trying to achieve?


----------



## jchan21 (Apr 13, 2020)

i got the problem fixed thanks!


----------



## jchan21 (Apr 13, 2020)

mark_j said:


> I'm not sure what you're working on, but if you're delving into interrupt priority levels, then you would probably know what other include files are required to bring in interrupt pointer structures? No?
> 
> I am also not sure why FreeBSD still uses splbio(). In NetBSD, it moved to splvm() many, many years ago.
> 
> ...





ralphbsz said:


> A: If you want real help, you need to explain to us what you are really trying to accomplish: what are you compiling, where did you get it from, ...
> 
> B: Try including types.h first. It might help, there is a definition of uintfptr_t in there (line 277 on my machine). Why didn't you try "grep uintfptr_t /usr/include/sys/*" first?



I think the problem was I didn't install the source in the /usr/src  for the errors above. Thanks!

But building a kernel module is the goal. I made a simple kernel module to test out. The version I have is FreeBSD-13.0-CURRENT. The kernel module is basically right now make load , make unload to see if the uprintf works. Seems like my source is not correct version. Trying to debug this now. If you know which source is correct for FreeBSD 13.0 CURRENT ARM64, that will be great!


----------



## mark_j (Apr 13, 2020)

What source is not the correct version? Kernel?
From the start you probably shouldn't be using Current but pick a stable Release unless you know what you're doing, which, no offense, you don't; you're learning.
Go use 11.3 or 12.1. Both have good support for Arm64 (aarch64), just not good ports support.


----------



## jchan21 (Apr 13, 2020)

mark_j said:


> What source is not the correct version? Kernel?
> From the start you probably shouldn't be using Current but pick a stable Release unless you know what you're doing, which, no offense, you don't; you're learning.
> Go use 11.3 or 12.1. Both have good support for Arm64 (aarch64), just not good ports support.



_*Error code 1 Stop. KLD skeleton.ko: depends on kernel - not available or version mismatch kldload: can't load /usr/local/ma/src/skeleton.ko: module already loaded or in kernel*_

I thought my source may not be correct for the error above error code 1..  When i kldstat -v , the skeleton kernel module is not loaded.

The code is here for the simple kernel module:

```
#include <sys/types.h>
#include <sys/module.h>
#include <sys/systm.h>
#include <sys/errno.h>
#include <sys/param.h>
#include <sys/kernel.h>


static int
skel_loader(struct module *m, int what, void *arg)
{
        int err = 0;

        switch (what) {
        case MOD_LOAD:
                uprintf("The answer to life);
                break;
        case MOD_UNLOAD:
                uprintf("Skeleton KLD unloaded.\n");
                break;
        default:
                err = EOPNOTSUPP;
                break;
        }
        return err;
}

static moduledata_t skel_mod = {
        "skel",
        skel_loader,
        NULL
};

DECLARE_MODULE(skeleton, skel_mod, SI_SUB_KLD, SI_ORDER_ANY);
```


The makefile for it is here
SRCS=skeleton.c
KMOD=skeleton

.include <bsd.kmod.mk>


----------



## mark_j (Apr 14, 2020)

Well the error message pretty much states the case.
I suspect your version of the source code is *NOT *the same as that of the kernel you're running on.

As I said, blow away Current and install either 11.3R or 12.1R *PLUS *the source code and go from there.

See: https://svnweb.freebsd.org/base/release/12.1.0/
or





						[base] Index of /release/11.3.0
					






					svnweb.freebsd.org


----------



## SirDice (Apr 14, 2020)

Please don't use the /release branches. Use https://svnweb.freebsd.org/base/releng/ for the -RELEASE versions.


----------



## mark_j (Apr 14, 2020)

I'm not sure why. Personally I would use release unless he's going to build the kernel. Who knows what patches have changed what and he's attempting to build a loadable module; you want the kernel to source to match, exactly.


----------

