Porting from linux to FreeBSD (procfs question)

Fernando Apesteguía fernando.apesteguia at gmail.com
Thu Jan 3 07:46:48 PST 2008


On Jan 3, 2008 2:47 PM, Ivan Voras <ivoras at freebsd.org> wrote:
> Fernando Apesteguía wrote:
>
> > 1 - Try to rely the porting on the compatibility procfs from FreeBSD
> > 2 - Do the things in a completely different way (which one is this?
> > Invoking sysctl system call?)
> >
> > I would like to know from you which one is the best approach.
>
> The best way to do it is to abstract the OS-dependant stuff from the
> application into separate modules / classes / libraries / etc. and then
> proceed by the second approach (use procfs on linux, use sysctl on FreeBSD).

OK, the code is modular enough to separate the dependant code into
different places.

>
> The first approach would probably be tedious if the application is
> non-trivial but there's also linprocfs which behaves more like the linux
> procfs but it's also incomplete.

Yes, that's my problem. In Linux I can get from /proc/cpuinfo for
example: name, model, stepping, cache size, clock speed, supported
extensions, etc...
But using sysctl in FreeBSD (sysctl -a) I can only see name and vendor
for the cpu and a few more things. Am I limited to the variables
showed in sysctl -a?

Thanks in advance.

BTW if this is isn't the proper list to continue with this thread, let me know.

Cheers.

>
>


More information about the freebsd-questions mailing list