From: "Ara.T.Howard" Date: 2003-12-09T12:42:06+09:00 Subject: RCR - 'struct flock*' wrapper for rb_io_fcntl SYNOPSIS: ruby's fcntl call is incomplete in that one cannot pass a 'struct flock *' arg as fcntl's third arg. because of this, no posix compliant locking is available from within ruby. SOLUTIONS: a) add a class, rb_cFlock, underneath class rb_cIO and a test in rb_io_fcntl to see whether it's third argument is of type rb_cFlock and retrieves the 'struct flock *' pointer to pass through to other calls. rb_cFlock could simply be a wrapper on a 'struct flock *' with methods type=, whence=, etc. b) create a module, fcntl, like the present one, but which does more that simply export the #defines from the header file i can do either and submit a patch if some preference is expressed. i'm hoping the usage in ruby would be as in: require 'fcntl' # import constants, perhaps this replaces IO#fcntl... include Fcntl f.open 'foobar', 'w' flock = IO::Flock # defaults: F_WRLCK, SEEK_SET, 0L, 0L f.fcntl F_SETLKW, flock comments? -a -- ATTN: please update your address books with address below! =============================================================================== | EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov | PHONE :: 303.497.6469 | ADDRESS :: E/GC2 325 Broadway, Boulder, CO 80305-3328 | STP :: http://www.ngdc.noaa.gov/stp/ | NGDC :: http://www.ngdc.noaa.gov/ | NESDIS :: http://www.nesdis.noaa.gov/ | NOAA :: http://www.noaa.gov/ | US DOC :: http://www.commerce.gov/ | | The difference between art and science is that science is what we | understand well enough to explain to a computer. | Art is everything else. | -- Donald Knuth, "Discover" | | /bin/sh -c 'for l in ruby perl;do $l -e "print \"\x3a\x2d\x29\x0a\"";done' ===============================================================================