ext portability question

A

Ara.T.Howard

i've got a little statfs ext which works fine. the man page, however, claim
subtly different struct statfs layouts for different *nixes. what is the
preferred method for dealing with this? the struct is exposed to ruby via a
wrapped struct so the layout actual cannot be abstracted. right now i am
considering:

arch = Config::CONFIG['arch']

case arch
when /linux/
spit_out_linux_src
when /sun/
spit_out_sun_src
else
spit_out_posix_src
end

create_makefile 'statfs'

in extconf.rb.

another question: these methods __really__ fit into the File class:

File.statfs path

file.statfs

how strongly are people opposed to this sort of standard class munging?

cheers.

-a
--
===============================================================================
| EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov
| PHONE :: 303.497.6469
| A flower falls, even though we love it; and a weed grows, even though we do
| not love it. --Dogen
===============================================================================
 
N

nobu.nokada

Hi,

At Tue, 22 Jun 2004 13:13:13 +0900,
Ara.T.Howard wrote in [ruby-talk:104311]:
i've got a little statfs ext which works fine. the man page, however, claim
subtly different struct statfs layouts for different *nixes. what is the
preferred method for dealing with this? the struct is exposed to ruby via a
wrapped struct so the layout actual cannot be abstracted. right now i am
considering:

$ ruby18 -v -rmkmf -e 'have_struct_member("struct statfs", "f_blocks", "sys/statfs.h")'
ruby 1.8.2 (2004-06-19) [i686-linux]
checking for struct statfs.f_blocks... yes
 
A

Ara.T.Howard

Hi,

At Tue, 22 Jun 2004 13:13:13 +0900,
Ara.T.Howard wrote in [ruby-talk:104311]:
i've got a little statfs ext which works fine. the man page, however, claim
subtly different struct statfs layouts for different *nixes. what is the
preferred method for dealing with this? the struct is exposed to ruby via a
wrapped struct so the layout actual cannot be abstracted. right now i am
considering:

$ ruby18 -v -rmkmf -e 'have_struct_member("struct statfs", "f_blocks", "sys/statfs.h")'
ruby 1.8.2 (2004-06-19) [i686-linux]
checking for struct statfs.f_blocks... yes

never knew about that one - guess i need to read mkmf! thanks.

-a
--
===============================================================================
| EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov
| PHONE :: 303.497.6469
| A flower falls, even though we love it; and a weed grows, even though we do
| not love it. --Dogen
===============================================================================
 
A

Ara.T.Howard

See "filesystem" by Mike Hall. The RAA entry is outdated (Mike!) so
get the latest at http://users.rcn.com/m3ha11/ruby/ruby.html.

Regards,

Dan

thanks daniel - i checked this out but gave up on the dead link too soon.

cheers.

-a
--
===============================================================================
| EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov
| PHONE :: 303.497.6469
| A flower falls, even though we love it; and a weed grows, even though we do
| not love it. --Dogen
===============================================================================
 
A

Aredridel

another question: these methods __really__ fit into the File class:

File.statfs path

file.statfs

how strongly are people opposed to this sort of standard class munging?

Strongly in favor.

Ari
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

opening a file in ext 11
help from *nix ruby users 11
determining ruby interpreter 4
openssl examples and docs 12
tk tabbed pane 1
latest instiki err 2
stable-snapshot.tgz 1
irb 5

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top