Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 27 Jul 2021 13:12:29 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 257450] MALLOC_DEFINE macro error in Freebsd13 OS
Message-ID:  <bug-257450-227@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D257450

            Bug ID: 257450
           Summary: MALLOC_DEFINE macro error in Freebsd13 OS
           Product: Base System
           Version: 13.0-STABLE
          Hardware: amd64
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: meetshamsher@gmail.com

# cat test.c=20
#include <sys/types.h>
#include <sys/module.h>
#include <sys/systm.h>=20=20
#include <sys/param.h>=20
#include <sys/kernel.h>
#include <sys/malloc.h>
#include <sys/kthread.h>
#include <sys/unistd.h>
#include <stdlib.h>=20

MALLOC_DEFINE(M_NODE, "NODE1", "test Node");
int main() {
    int *ptr;
    ptr =3D (int*)malloc(sizeof(int), M_NODE ,M_WAITOK)
    printf("ptr=3D%p\n",ptr);
    return 0;
}


# cc test.c=20
test.c:11:23: error: expected identifier
MALLOC_DEFINE(M_NODE, "NODE1", "test Node");
                      ^
test.c:11:1: warning: type specifier missing, defaults to 'int'
[-Wimplicit-int]
MALLOC_DEFINE(M_NODE, "NODE1", "test Node");
^
test.c:14:37: error: use of undeclared identifier 'M_NODE'
    ptr =3D (int*)malloc(sizeof(int), M_NODE ,M_WAITOK)
                                    ^
1 warning and 2 errors generated.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-257450-227>