Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Ruby
file locking
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Bedo Sandor, post: 4411614"] Hi All, There are 3 different file locking mechanisms in C: flock lockf fcntl I want to write a Ruby script, which shares files with a C program using all of these lockings. As I can see objects with the type File have an flock method. This is the only one I can use. There is an fcntl method, but I don't know how to use it. What kind of parameters can I pass to fcntl? I want to implement this code in Ruby for fcntl: def lock_fcntl(fd) # struct flock f_lock; # memset(&f_lock, '\0', sizeof(f_lock)); # f_lock.l_type = F_WRLCK; # f_lock.l_whence = SEEK_SET; # f_lock.l_start = 0; # f_lock.l_len = 0; # fcntl(fd, F_SETLKW, &f_lock); end and I need a lockf-type method too: def lock_lockf(fd) # ??? end Could you show me how to use fcntl, and how to access lockf from Ruby? [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Ruby
file locking
Top