Date: Sat, 5 Jan 2008 12:16:28 +0100 From: Alexander Leidinger <Alexander@Leidinger.net> To: "Fernando =?UTF-8?B?QXBlc3RlZ3XDrWE=?=" <fernando.apesteguia@gmail.com> Cc: freebsd-emulation@freebsd.org Subject: Re: linprocfs question. Porting app from linux to freebsd Message-ID: <20080105121628.00135363@deskjail> In-Reply-To: <1bd550a00801040447p3d0d43f6n87c79c51bb3cb508@mail.gmail.com> References: <1bd550a00801040447p3d0d43f6n87c79c51bb3cb508@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Quoting "Fernando Apestegu=C3=ADa" <fernando.apesteguia@gmail.com> (Fri, 4 = Jan 2008 13:47:50 +0100): > Hi all, >=20 > I was suggested to contact the linux compatibility team (or Roman > Divacky) to get some help. >=20 > I want to port an application from Linux to FreeBSD. The linux app. > makes extensive use of the procfs. Now, I have several options to port > the software: >=20 > 1 - Use sysctl. The problem here is that some information (about cpu > or memory, for instance) is not available through this interface. I suggest to do as much as possible with sysctl. For the CPU you get maybe more info from /var/run/dmesg.boot. Apart from that I can only repeat what you got already: use the CPUID call directly, or depend upon a port which gives you this information (execute the program from ports and parse the output). Regarding the memory: there are ways to obtain this info, as already suggested, have a look at the ganglia port, or have a look how top gets all the memory info. As you was already told, not every memory type in Linux maps to a corresponding FreeBSD value. So maybe printing a 'N/A' or '-' instead of a value may be a sensible solution. > 2 - Write a kernel module to get an uniform access (Ivan Vorak > suggested me this) I don't think users want to install a kernel module just to get a GUI program which is able to display some values. At least I would not be interested in something like this. > 3 - Use linprocfs. >=20 > The easiest to me is the third point. All the access would be very > similar. However, there are some missing files in the linprocfs. I It would be a good start to tell us which files are missing and also provide a description what it is and what example output looks like. We want to improve linprocfs for sure. Patches which implement some missing stuff are even more welcome. > would like to know if there are some plans of keeping adding more > linux-like files as the devices, filesystems or modules files you can > get under /proc in a linux system or I should look for another > alternative (like the module Ivan suggests.) Requiring to mount a FS or to load a kernel module is not very userfriendly if there are ways to obtain the info in a different way. FreeBSD is not going to have procfs or linprocfs mounted by default, and we discourage the use of procfs if not really necessary. For this reason you should really try to do as much as possible with sysctl and similar methods as suggested above. Bye, Alexander. --=20 BOFH excuse #102: Power company testing new voltage spike (creation) equipment http://www.Leidinger.net Alexander @ Leidinger.net: PGP ID =3D B0063FE7 http://www.FreeBSD.org netchild @ FreeBSD.org : PGP ID =3D 72077137
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080105121628.00135363>