Porting from linux to FreeBSD (procfs question)

2008-01-03 Thread Fernando Apesteguía
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]


Porting from linux to FreeBSD (procfs question)

2008-01-03 Thread Robert Huff

=?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]


Re: Porting from linux to FreeBSD (procfs question)

2008-01-03 Thread Ivan Voras
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


Re: Porting from linux to FreeBSD (procfs question)

2008-01-03 Thread Fernando Apesteguía
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)

2008-01-03 Thread Ivan Voras
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)

2008-01-03 Thread Jerry McAllister
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)

2008-01-03 Thread Jeremy Chadwick
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)

2008-01-03 Thread Patrick Lamaiziere
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

2005-09-09 Thread RW
On Thursday 08 September 2005 11:25, Subhro wrote:
 Deepak Naidu sat at his 'puter and typed on 9/8/2005 15:16:
...
 for mailing server. I used raiserfs in linux.  Which
 ...  
 Just something off topic, did you have any reasons for 
 using ReiserFS in Linux and not use EXT2/3?

See:

 http://en.wikipedia.org/wiki/ReiserFS#Performance

___
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

2005-09-09 Thread RW
On Thursday 08 September 2005 10:46, Deepak Naidu wrote:

 2)How to i find memory, cpu information in freebsd,
 apart from TOP. In linux we have free and
 /pro/cpuinfo.  I dont see any files under /proc

On the subject of /proc see:

http://www.onlamp.com/pub/a/bsd/2005/01/13/FreeBSD_Basics.html

but bear this in mind when looking at free memory:

http://www.freebsd.org/doc/en/books/faq/misc.html#TOP-FREEMEM
___
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

2005-09-08 Thread Deepak Naidu
Hi,
   I am trying to migrate my mail servers from Fedora
core 3 to FreeBSD 5.4, due to performance issue.  Had
few questions.

1)Which is the suitable filesystem ie UFS2, Ext2
etc...
for mailing server. I used raiserfs in linux.  Which
File System's are supported in FreeBSD 5.4 and which
is stable for mailing system.  How do i enable them in
kernel.

2)How to i find memory, cpu information in freebsd,
apart from TOP. In linux we have free and
/pro/cpuinfo.  I dont see any files under /proc

3) Is SMP support enabled in FreeBSD 5.4, or should I
recompile the kernel for the support(what kernel
arguments should I use).

Regards,
Deepak Naidu.






___ 
Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with voicemail 
http://uk.messenger.yahoo.com
___
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

2005-09-08 Thread Subhro

Deepak Naidu sat at his 'puter and typed on 9/8/2005 15:16:


Hi,
 


Hello :-),


  I am trying to migrate my mail servers from Fedora
core 3 to FreeBSD 5.4, due to performance issue. 


Cool! Go for it :-)


1)Which is the suitable filesystem ie UFS2, Ext2
etc...
for mailing server. I used raiserfs in linux.  Which
File System's are supported in FreeBSD 5.4 and which
is stable for mailing system.  How do i enable them in
kernel.
 


The native filesystem for FreeBSD 5.x and above is UFS2 which performs
exceptionally well IMHO. Reiserfs also has support in FBSD although
readonly only. Just something off topic, did you have any reasons for
using ReiserFS in Linux and not use EXT2/3?


2)How to i find memory, cpu information in freebsd,
apart from TOP. In linux we have free and
/pro/cpuinfo.  I dont see any files under /proc
 


what information do you need that top does not provide? You can try
sysctl -a | more and analyse all the kernel runtime variables.


3) Is SMP support enabled in FreeBSD 5.4, or should I
recompile the kernel for the support(what kernel
arguments should I use).
 


No SMP by default is not there in the stock kernel. However you can boot
up your SMP box with the stock kernel and cimpile SMP support in it.
Refer to the handbook for the kernel parameters.
Also have a look at /usr/src/sys/arch/conf/GENERIC and
/usr/src/sys/arch/conf/NOTES for examples where arch is your
architecture (i386,amd64,etc)

Welcome to the world of FreeBSD.

Thanks
S.

--
-+-
 | Subhro Sankha Kar
 \   /  |   GSM: +919831064613  Egold: 2078232
  \./|MSN:[EMAIL PROTECTED]  --  Yahoo: subhro82
 (0Y0)   |ICQ: 203567534 --  AIM: bsdboy1982
--ooO--(_)--Ooo--+-


___
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

2005-09-08 Thread Subhro

Deepak Naidu sat at his 'puter and typed on 9/8/2005 16:55:


Hey Subhro thanx for the info.  I used Reiserfs in
linux, bcos its reads and writes smaller files faster
like file size of 1-5 Mb, basically for mailing
solution.  I dont know where iam wrong.  


I have read regarding XFS, in freebsd any info ?.
So ok FreeBSD supports UFS1/2, dos, fat, fat32, ext2
reiserfs read only, ok cool...

So how do i enable Reiserfs in kernel, and do the
partion at install time...

http://people.freebsd.org/~rodrigc/xfs/index.html
 

XFS is supported in FBSD. For infomration regarding enabling various 
stuff in the kernel have a look at /usr/src/sys/conf/NOTES. BTW, your 
mail client incorrectly marks the replies. Why dont u use thunderbird? 
Its a really cool client IMHO. Also send a cc to 
[EMAIL PROTECTED]


Thanks
S.



--- Subhro [EMAIL PROTECTED] wrote:

 


Deepak Naidu sat at his 'puter and typed on 9/8/2005
15:16:

   


Hi,


 


Hello :-),

   


 I am trying to migrate my mail servers from
 


Fedora
   

core 3 to FreeBSD 5.4, due to performance issue. 

 


Cool! Go for it :-)

   


1)Which is the suitable filesystem ie UFS2, Ext2
etc...
for mailing server. I used raiserfs in linux. 
 


Which
   


File System's are supported in FreeBSD 5.4 and
 


which
   


is stable for mailing system.  How do i enable them
 


in
   


kernel.


 


The native filesystem for FreeBSD 5.x and above is
UFS2 which performs
exceptionally well IMHO. Reiserfs also has support
in FBSD although
readonly only. Just something off topic, did you
have any reasons for
using ReiserFS in Linux and not use EXT2/3?

   


2)How to i find memory, cpu information in freebsd,
apart from TOP. In linux we have free and
/pro/cpuinfo.  I dont see any files under /proc


 


what information do you need that top does not
provide? You can try
sysctl -a | more and analyse all the kernel runtime
variables.

   


3) Is SMP support enabled in FreeBSD 5.4, or should
 


I
   


recompile the kernel for the support(what kernel
arguments should I use).


 


No SMP by default is not there in the stock kernel.
However you can boot
up your SMP box with the stock kernel and cimpile
SMP support in it.
Refer to the handbook for the kernel parameters.
Also have a look at /usr/src/sys/arch/conf/GENERIC
and
/usr/src/sys/arch/conf/NOTES for examples where
arch is your
architecture (i386,amd64,etc)

Welcome to the world of FreeBSD.

Thanks
S.

--

   


-+-
 


 | Subhro Sankha Kar
 \   /  |   GSM: +919831064613  Egold:
2078232
  \./|MSN:[EMAIL PROTECTED]  --  Yahoo:
subhro82
 (0Y0)   |ICQ: 203567534 --  AIM:
bsdboy1982

   


--ooO--(_)--Ooo--+-
 



   






___ 
Does your mail provider give you FREE antivirus protection? 
Get Yahoo! Mail http://uk.mail.yahoo.com


 




--
-+-
 | Subhro Sankha Kar
 \   /  |   GSM: +919831064613  Egold: 2078232
  \./|MSN:[EMAIL PROTECTED]  --  Yahoo: subhro82
 (0Y0)   |ICQ: 203567534 --  AIM: bsdboy1982
--ooO--(_)--Ooo--+-

___
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

2005-09-08 Thread Svein Halvor Halvorsen

* Deepak Naidu [2005-09-08 10:46 +0100]
  2)How to i find memory, cpu information in freebsd,
  apart from TOP. In linux we have free and
  /pro/cpuinfo.  I dont see any files under /proc

You need to mount procfs on /proc to have files appear in /proc. However, 
you won't find cpuinfo in there, just one folder for each running process.
You could however mount the linprocfs filesystm in /compat/linux/proc and 
look at /compat/linux/proc/cpuinfo et.al. You'd need to load the linux and 
linprocfs kernel modules to do that.

To gather system information, these utils should provide a starting point:

dmesg(8)
sysctl(8) 
kenv(1)
devinfo(8)
pciconf(8)
vmstat(8)
pstat(8)
___
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

2005-09-08 Thread Deepak Naidu

i am using my yahoo a/c ... ya regarding xfs its only
read only support in 6.0 and no support for 5.4

Thanx 
Deepak Naidu.

--- Subhro [EMAIL PROTECTED] wrote:

 Deepak Naidu sat at his 'puter and typed on 9/8/2005
 16:55:
 
 Hey Subhro thanx for the info.  I used Reiserfs in
 linux, bcos its reads and writes smaller files
 faster
 like file size of 1-5 Mb, basically for mailing
 solution.  I dont know where iam wrong.  
 
 I have read regarding XFS, in freebsd any info ?.
 So ok FreeBSD supports UFS1/2, dos, fat, fat32,
 ext2
 reiserfs read only, ok cool...
 
 So how do i enable Reiserfs in kernel, and do the
 partion at install time...
 
 http://people.freebsd.org/~rodrigc/xfs/index.html
   
 
 XFS is supported in FBSD. For infomration regarding
 enabling various 
 stuff in the kernel have a look at
 /usr/src/sys/conf/NOTES. BTW, your 
 mail client incorrectly marks the replies. Why dont
 u use thunderbird? 
 Its a really cool client IMHO. Also send a cc to 
 [EMAIL PROTECTED]
 
 Thanks
 S.
 
 
 --- Subhro [EMAIL PROTECTED] wrote:
 
   
 
 Deepak Naidu sat at his 'puter and typed on
 9/8/2005
 15:16:
 
 
 
 Hi,
  
 
   
 
 Hello :-),
 
 
 
   I am trying to migrate my mail servers from
   
 
 Fedora
 
 
 core 3 to FreeBSD 5.4, due to performance issue. 
 
   
 
 Cool! Go for it :-)
 
 
 
 1)Which is the suitable filesystem ie UFS2, Ext2
 etc...
 for mailing server. I used raiserfs in linux. 
   
 
 Which
 
 
 File System's are supported in FreeBSD 5.4 and
   
 
 which
 
 
 is stable for mailing system.  How do i enable
 them
   
 
 in
 
 
 kernel.
  
 
   
 
 The native filesystem for FreeBSD 5.x and above is
 UFS2 which performs
 exceptionally well IMHO. Reiserfs also has support
 in FBSD although
 readonly only. Just something off topic, did you
 have any reasons for
 using ReiserFS in Linux and not use EXT2/3?
 
 
 
 2)How to i find memory, cpu information in
 freebsd,
 apart from TOP. In linux we have free and
 /pro/cpuinfo.  I dont see any files under /proc
  
 
   
 
 what information do you need that top does not
 provide? You can try
 sysctl -a | more and analyse all the kernel
 runtime
 variables.
 
 
 
 3) Is SMP support enabled in FreeBSD 5.4, or
 should
   
 
 I
 
 
 recompile the kernel for the support(what kernel
 arguments should I use).
  
 
   
 
 No SMP by default is not there in the stock
 kernel.
 However you can boot
 up your SMP box with the stock kernel and cimpile
 SMP support in it.
 Refer to the handbook for the kernel parameters.
 Also have a look at
 /usr/src/sys/arch/conf/GENERIC
 and
 /usr/src/sys/arch/conf/NOTES for examples where
 arch is your
 architecture (i386,amd64,etc)
 
 Welcome to the world of FreeBSD.
 
 Thanks
 S.
 
 -- 
 
 
 

-+-
   
 
  | Subhro Sankha
 Kar
   \   /  |   GSM: +919831064613 
 Egold:
 2078232
\./   |MSN:[EMAIL PROTECTED]  --  Yahoo:
 subhro82
   (0Y0)  |ICQ: 203567534 --  AIM:
 bsdboy1982
 
 
 

--ooO--(_)--Ooo--+-
   
 
 
 
 
 
 
 
  

___
 
 Does your mail provider give you FREE antivirus
 protection? 
 Get Yahoo! Mail http://uk.mail.yahoo.com
 
   
 
 
 
 -- 

-+-
| Subhro Sankha Kar
   \   /  |   GSM: +919831064613  Egold:
 2078232
\./ |MSN:[EMAIL PROTECTED]  --  Yahoo:
 subhro82
   (0Y0)|ICQ: 203567534 --  AIM:
 bsdboy1982

--ooO--(_)--Ooo--+-
 
 



Linux your Life, Don't Window it [[]] 

   { All for the best }






___ 
To help you stay safe and secure online, we've developed the all new Yahoo! 
Security Centre. http://uk.security.yahoo.com
___
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

2005-09-08 Thread Martin Hepworth
On 9/8/05, Deepak Naidu [EMAIL PROTECTED] wrote:
 
 Hi,
 I am trying to migrate my mail servers from Fedora
 core 3 to FreeBSD 5.4, due to performance issue. Had
 few questions.
 
 1)Which is the suitable filesystem ie UFS2, Ext2
 etc...
 for mailing server. I used raiserfs in linux. Which
 File System's are supported in FreeBSD 5.4 and which
 is stable for mailing system. How do i enable them in
 kernel.


I'd suggest use the ufs2 default with softupdates (a liitle like journaling 
but better) enabled. 

Other questions already answered by other people
--
martin
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]