# sysctlbyname



## uslanmaz (Nov 25, 2009)

Hi everyone, I have a problem with getting the memory size. when I use the folloeing:

```
int a=sysctlbyname("hw.physmem", &physmem, &len, NULL, 0);
```

I get an error saying 
	
	



```
implicit declaration of function sysctlbyname
```

(I include sysctl.h) is there any way to get rid of this or any other way to get the memory info in the kernel source code?

Thanks in advance.


----------



## Ole (Nov 25, 2009)

*sys/types.h* needed too.

Also you can look this


----------



## uslanmaz (Nov 25, 2009)

I include sys/types.h too, but still I have the error


----------



## lyuts (Dec 1, 2009)

Can you show this code?


----------



## expl (Dec 1, 2009)

Are you trying to include this code into kernel? It will not work, its part of libc(userland).


----------

