>>>>> "t" == ts  <decoux / moulon.inra.fr> writes:

t>  Now try with File#mmap and you'll see the result :-)

 Just to give you an example, I've just modified

-    if ((fd = open(path, smode)) == -1) {
-       rb_raise(rb_eTypeError, "open");
-    }
+    GetOpenFile(obj, fh);
+    fd = fileno(fh->f);

pigeon% cat b.rb
#!/usr/bin/ruby
require "mmapf"
a = open("b.rb", "a+").mmap("rw")
a[12] = "X"
a.scan(/.*\n/) do |line|
   puts line
end
pigeon%

pigeon% b.rb
#!/usr/bin/rXby
require "mmapf"
a = open("b.rb", "a+").mmap("rw")
a[12] = "X"
a.scan(/.*\n/) do |line|
   puts line
end
pigeon%
 
pigeon% cat b.rb
#!/usr/bin/rXby
require "mmapf"
a = open("b.rb", "a+").mmap("rw")
a[12] = "X"
a.scan(/.*\n/) do |line|
   puts line
end
#!/usr/bin/rXby
require "mmapf"
a = open("b.rb", "a+").mmap("rw")
a[12] = "X"
a.scan(/.*\n/) do |line|
   puts line
end
pigeon% 


Guy Decoux