Re: Porting from linux to FreeBSD (procfs question)
Le Thu, 3 Jan 2008 14:14:57 +0100, "Fernando Apesteguía" <[EMAIL PROTECTED]> a écrit : > As I know, FreeBSD has some kind of procfs but more limited in terms > of information. My questions is how should I proceed now? I see two > options. > > 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. I don't know exactly what you need, but look at libkvm. Good samples are ps and top in the source code. ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: Porting from linux to FreeBSD (procfs question)
On Thu, Jan 03, 2008 at 05:16:42PM +0100, Ivan Voras wrote: > On 03/01/2008, Fernando Apesteguía <[EMAIL PROTECTED]> wrote: > > > 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? > > Probably. I don't know if there's anything that can give you the > details present in cpuinfo (except using CPUID data directly). Best bet is parsing or using the hw.model sysctl, or if you need lower-level information, there is a port that apparently gets cache size and other data. There are very few things I liked about Linux /proc when I used it, but getting h/w information happened to be one of them... -- | Jeremy Chadwickjdc at parodius.com | | Parodius Networking http://www.parodius.com/ | | UNIX Systems Administrator Mountain View, CA, USA | | Making life hard for others since 1977. PGP: 4BD6C0CB | ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: Porting from linux to FreeBSD (procfs question)
On 03/01/2008, Fernando Apesteguía <[EMAIL PROTECTED]> wrote: > 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? Probably. I don't know if there's anything that can give you the details present in cpuinfo (except using CPUID data directly). > Thanks in advance. > > BTW if this is isn't the proper list to continue with this thread, let me > know. Maybe hackers@ would help you more. ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: Porting from linux to FreeBSD (procfs question)
On Thu, Jan 03, 2008 at 02:14:57PM +0100, Fernando Apesteguía wrote: > Hi all, > > First of all, Happy New Year. > > I have a question about porting an application from Linux to FreeBSD. > > The application I want to port, makes an extensive use of the procfs > in Linux. It gathers a lot of information from those files (cpuinfo, > meminfo, devices, filesystems, modules, etc...) > > As I know, FreeBSD has some kind of procfs but more limited in terms > of information. My questions is how should I proceed now? I see two > options. > > 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?) Use the sysctl calls. That is what will be supported correctly. jerry > > I would like to know from you which one is the best approach. > > Thanks in advance > ___ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to "[EMAIL PROTECTED]" ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: Porting from linux to FreeBSD (procfs question)
On Jan 3, 2008 2:47 PM, Ivan Voras <[EMAIL PROTECTED]> 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. > > ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: Porting from linux to FreeBSD (procfs question)
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). 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. signature.asc Description: OpenPGP digital signature
Porting from linux to FreeBSD (procfs question)
=?ISO-8859-1?Q?Fernando_Apestegu=EDa?= writes: > First of all, Happy New Year. And to you, > The application I want to port, makes an extensive use of the > procfs in Linux. It gathers a lot of information from those files > (cpuinfo, meminfo, devices, filesystems, modules, etc...) > > As I know, FreeBSD has some kind of procfs but more limited in > terms of information. My questions is how should I proceed now? I > see two options. > > 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?) As I understand it, use (2). Use of FreeBSD procfs is possible, but heavily discouraged due to known security issues. Robert Huff ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Porting from linux to FreeBSD (procfs question)
Hi all, First of all, Happy New Year. I have a question about porting an application from Linux to FreeBSD. The application I want to port, makes an extensive use of the procfs in Linux. It gathers a lot of information from those files (cpuinfo, meminfo, devices, filesystems, modules, etc...) As I know, FreeBSD has some kind of procfs but more limited in terms of information. My questions is how should I proceed now? I see two options. 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. Thanks in advance ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"