From: David Ross Date: 2004-08-03T23:45:50+09:00 Subject: Re: help from *nix ruby users The output is from my DragonFlyBSD systems. It is the same in FreeBSD4.x > ruby -r rbconfig -e 'p Config::CONFIG["arch"]' "i386-dragonfly1.1" struct flock { off_t l_start; /* starting offset */ off_t l_len; /* len = 0 means until end of file */ pid_t l_pid; /* lock owner */ short l_type; /* lock type: read/write, etc. */ short l_whence; /* type of l_start */ }; --- "Ara.T.Howard" wrote: > > i have a bit of code that packs an flock struct > > struct flock { > ... > short l_type; /* Type of lock: F_RDLCK, > F_WRLCK, F_UNLCK */ > short l_whence; /* How to interpret l_start: > SEEK_SET, SEEK_CUR, > SEEK_END */ > off_t l_start; /* Starting offset for lock > */ > off_t l_len; /* Number of bytes to lock */ > pid_t l_pid; /* PID of process blocking > our lock > (F_GETLK only) */ > ... > }; > > using 'ssqqi' (thanks to matz for this tip). this > works for linux, but i'm > sure it won't for other *nixes with different flock > layouts. if i understand > ruby dl there is no way to portably set the fields > of a struct unless you > already know it's layout, so packing is just as good > in this case (please > correct me if i'm wrong). what i'm asking for > people on various *nixes to > post their struct flock definitions so i can add > appropriate pack templates > for those. > > this output of > > ruby -r rbconfig -e 'p Config::CONFIG["arch"]' > > would also be useful > > if there is an easier way to do this - some online > resource where i could find > this info - please let me know > > thanks alot. > > -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 > =============================================================================== > > __________________________________ Do you Yahoo!? Yahoo! Mail Address AutoComplete - You start. We finish. http://promotions.yahoo.com/new_mail