Discussion:
Using madvise(3C)
Kishore Kumar Pusukuri
2010-08-27 08:00:11 UTC
Permalink
Hi,
I am trying to play with madvise on my AMD machine running OpenSolaris.2009.06. However, getting the following error when I used to compile the below program with /usr/sfw/bin/g++. Please help me to resolve this.

457: error: `madvise' undeclared (first use this function)
457: error: (Each undeclared identifier is reported only once for each function it appears in.)

Program
=========
....
#include <sys/types.h>
#include <sys/mman.h>
...
...

int
main (void)
{
....

int size = numOptions*sizeof(OptionData);
data = (OptionData*)malloc(size);

if (data == NULL) {
perror("Fatal Error: malloc failed");
exit(-1);
}

int ret = madvise(data, size, MADV_ACCESS_MANY);
if (ret == -1) {
perror("Fatal Error: madvise failed");
exit(-2);
}
...
...

return 0;
}
--
This message posted from opensolaris.org
Kishore Kumar Pusukuri
2010-08-27 08:03:01 UTC
Permalink
Hi,
I am trying to play with madvise on my AMD machine running OpenSolaris.2009.06. However, getting the following error when I used to compile the below program with /usr/sfw/bin/g++. Please help me to resolve this. I am not sure whether the usage of madvise is correct or not? Please let me know.

error: `madvise' undeclared (first use this function)
error: (Each undeclared identifier is reported only once for each function it appears in.)

Program
=========
....
#include <sys/types.h>
#include <sys/mman.h>
...
...

int
main (void)
{
....

int size = numOptions*sizeof(OptionData);
data = (OptionData*)malloc(size);

if (data == NULL) {
perror("Fatal Error: malloc failed");
exit(-1);
}

int ret = madvise(data, size, MADV_ACCESS_MANY);
if (ret == -1) {
perror("Fatal Error: madvise failed");
exit(-2);
}
...
...

return 0;
}
--
This message posted from opensolaris.org
Bob Friesenhahn
2010-08-27 17:54:53 UTC
Permalink
Hi, I am trying to play with madvise on my AMD machine running
OpenSolaris.2009.06. However, getting the following error when I
used to compile the below program with /usr/sfw/bin/g++. Please help
me to resolve this.
457: error: `madvise' undeclared (first use this function)
I see your multiple postings to this list. Only one posting was
necessary.

You did not describe how you are executing g++ but perhaps you have
passed a compiler argument which causes it to request only strict ANSI
C++, which lacks most Unix functions.

Bob
--
Bob Friesenhahn
bfriesen-***@public.gmane.org, http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer, http://www.GraphicsMagick.org/
Loading...