* [9fans] plan9port: flock on sunos5.8? @ 2004-06-23 20:47 Axel Belinfante 2004-06-23 21:17 ` boyd, rounin 2004-06-24 9:03 ` Bengt Kleberg 0 siblings, 2 replies; 8+ messages in thread From: Axel Belinfante @ 2004-06-23 20:47 UTC (permalink / raw) To: Fans of the OS Plan 9 from Bell Labs yet another instance of 'spending some time on plan9port on sunos 5.8'. lib9/create.c needs/uses bsd-style flock which is not available by default, but accessable using /usr/usb/cc (this is what I figure from the source and sun's flock man page) LOCK_SH and LOCK_EX can be found using /usr/ucbinclude/sys/file.h and there is a ucb compatibility library. Any good idea for a way around? I tried a straightforward addition of -I/sys/ucbinclude in 9c and -L/sys/ucblib -lucb to 9lbiut that is obviously not good enough. it works for some files breaks breaks on some others :-( Yet another thing I don't know much about... Axel. ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [9fans] plan9port: flock on sunos5.8? 2004-06-23 20:47 [9fans] plan9port: flock on sunos5.8? Axel Belinfante @ 2004-06-23 21:17 ` boyd, rounin 2004-06-24 9:03 ` Bengt Kleberg 1 sibling, 0 replies; 8+ messages in thread From: boyd, rounin @ 2004-06-23 21:17 UTC (permalink / raw) To: Fans of the OS Plan 9 from Bell Labs look at all the lock calls, write down what they're doing, avoid /usr/ucb/cc and code a better algorithm. all that lunix locking stuff is hideous. i've only ever seen it done right once. ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [9fans] plan9port: flock on sunos5.8? 2004-06-23 20:47 [9fans] plan9port: flock on sunos5.8? Axel Belinfante 2004-06-23 21:17 ` boyd, rounin @ 2004-06-24 9:03 ` Bengt Kleberg 2004-06-24 13:20 ` William Josephson 2004-06-24 13:43 ` [9fans] plan9port (: flock) " Axel Belinfante 1 sibling, 2 replies; 8+ messages in thread From: Bengt Kleberg @ 2004-06-24 9:03 UTC (permalink / raw) To: 9fans Axel Belinfante wrote: > yet another instance of 'spending some time on plan9port on sunos 5.8'. > > lib9/create.c needs/uses bsd-style flock which is not available by default, > but accessable using /usr/usb/cc the sun man page mentioned things like: Use of these interfaces should be restricted to only appli- cations written on BSD platforms. Use of these interfaces with any of the system libraries or in multi-thread applica- tions is unsupported. i think that it is very difficult to use the sun flock(), without breaking many things. what is the intended effect? perhaps another lock function (lockf(), fcntl(), etc) can be used? my plan9port is plan9-20040517.tar.gz and does not have flock() in plan9/src/lib9/create.c perhaps the benefits of adding flock() are not worth the problems it creates? then flock() could be removed. bengt ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [9fans] plan9port: flock on sunos5.8? 2004-06-24 9:03 ` Bengt Kleberg @ 2004-06-24 13:20 ` William Josephson 2004-06-24 13:22 ` William Josephson 2004-06-24 13:43 ` [9fans] plan9port (: flock) " Axel Belinfante 1 sibling, 1 reply; 8+ messages in thread From: William Josephson @ 2004-06-24 13:20 UTC (permalink / raw) To: Fans of the OS Plan 9 from Bell Labs On Thu, Jun 24, 2004 at 09:03:08AM +0000, Bengt Kleberg wrote: > my plan9port is plan9-20040517.tar.gz and does not have flock() in > plan9/src/lib9/create.c > perhaps the benefits of adding flock() are not worth the problems it > creates? then flock() could be removed. It is needed for OLOCK emulation (we have something that uses the Plan 9 ports stuff and requires a lockfile for correct operation). ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [9fans] plan9port: flock on sunos5.8? 2004-06-24 13:20 ` William Josephson @ 2004-06-24 13:22 ` William Josephson 0 siblings, 0 replies; 8+ messages in thread From: William Josephson @ 2004-06-24 13:22 UTC (permalink / raw) To: Fans of the OS Plan 9 from Bell Labs On Thu, Jun 24, 2004 at 09:20:02AM -0400, William Josephson wrote: > On Thu, Jun 24, 2004 at 09:03:08AM +0000, Bengt Kleberg wrote: > > my plan9port is plan9-20040517.tar.gz and does not have flock() in > > plan9/src/lib9/create.c > > perhaps the benefits of adding flock() are not worth the problems it > > creates? then flock() could be removed. > > It is needed for OLOCK emulation (we have something that Er. DMEXCL. Sorry. In any case, I don't think the answer is to make exclusive use impossible. ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [9fans] plan9port (: flock) on sunos5.8? 2004-06-24 9:03 ` Bengt Kleberg 2004-06-24 13:20 ` William Josephson @ 2004-06-24 13:43 ` Axel Belinfante 2004-06-24 14:21 ` boyd, rounin 2004-06-24 15:25 ` William Josephson 1 sibling, 2 replies; 8+ messages in thread From: Axel Belinfante @ 2004-06-24 13:43 UTC (permalink / raw) To: Fans of the OS Plan 9 from Bell Labs > > lib9/create.c needs/uses bsd-style flock which is not available by default, > > but accessable using /usr/usb/cc > i think that it is very difficult to use the sun flock(), without > breaking many things. > > what is the intended effect? perhaps another lock function (lockf(), > fcntl(), etc) can be used? > my plan9port is plan9-20040517.tar.gz ... I'm using the cvs access, and updated yesterday or so. Actually, the problem is rather limited: there are only two calls. (I posted here mainly because, as I wrote, I knew nothing about it). they are used to implement the OLOCK mode bit for create and open, in lib9/^(create open)^.c according to the sun man page, the compatibility flock builds on fcntl so I decided to just use fcntl directly. I added a #include <fcntl.h> to the list of includes and a struct flock lockdata variable to the routine (create or open), and then I replaced if(flock(fd, (rdwr==OREAD) ? LOCK_SH : LOCK_EX) < 0){ by lockdata.l_type = (rdwr==OREAD) ? F_RDLCK : F_WRLCK; lockdata.l_whence = SEEK_SET; lockdata.l_start = 0; lockdata.l_len = 0; if(fcntl(fd, F_SETLK, &lockdata) < 0){ which at least compiles ok, and as far as I could figure from the man pages should have the right effect. One other thing needs attention in this plan9port version: libip/eipfmt.c has the following definition that sun cc does not grok uchar prefixvals[256] = { [0x00] 0 | Isprefix, [0x80] 1 | Isprefix, [0xC0] 2 | Isprefix, [0xE0] 3 | Isprefix, [0xF0] 4 | Isprefix, [0xF8] 5 | Isprefix, [0xFC] 6 | Isprefix, [0xFE] 7 | Isprefix, [0xFF] 8 | Isprefix, }; I moved the initialization inside the eipfmt routine. for the rest of this plan9port version... compilation when fine, apart from some warnings: in libdraw/x11-init.c in XParseGeometry signed/unsigned int warning for &width and &height in cmd/9660/dump9660.c in convertnames a couple of (void*) casts where sun cc prefers (char* (*)(char*,char*)) in cmd/9660/unix.c a superflous `;' at the end of dirtoxdir furthermore: gview.c:173: warning: initializer does not fit or is out of range: -5592321 gview.c:174: warning: initializer does not fit or is out of range: -872414977 gview.c:175: warning: initializer does not fit or is out of range: -5635841 gview.c:177: warning: initializer does not fit or is out of range: -1431699201 gview.c:182: warning: initializer does not fit or is out of range: -1431633921 gview.c:184: warning: initializer does not fit or is out of range: -1728013825 gview.c:185: warning: initializer does not fit or is out of range: -1145324545 I do have some own hacks that I did not remove when updating from cvs, and I did not test (use) much yet, after compiling, but what I have tried works fine. Axel. ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [9fans] plan9port (: flock) on sunos5.8? 2004-06-24 13:43 ` [9fans] plan9port (: flock) " Axel Belinfante @ 2004-06-24 14:21 ` boyd, rounin 2004-06-24 15:25 ` William Josephson 1 sibling, 0 replies; 8+ messages in thread From: boyd, rounin @ 2004-06-24 14:21 UTC (permalink / raw) To: Fans of the OS Plan 9 from Bell Labs i found some lunix exclusive use lock code here: http://www.insultant.net/tmp/mace/mail.c sysVile and BSD. ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [9fans] plan9port (: flock) on sunos5.8? 2004-06-24 13:43 ` [9fans] plan9port (: flock) " Axel Belinfante 2004-06-24 14:21 ` boyd, rounin @ 2004-06-24 15:25 ` William Josephson 1 sibling, 0 replies; 8+ messages in thread From: William Josephson @ 2004-06-24 15:25 UTC (permalink / raw) To: Fans of the OS Plan 9 from Bell Labs On Thu, Jun 24, 2004 at 03:43:16PM +0200, Axel Belinfante wrote: > I added a #include <fcntl.h> to the list of includes and a > struct flock lockdata variable to the routine (create or open), > and then I replaced Send me a patch and maybe once I get the SunRay on my desk working again I can try rolling the changes into the tree.. ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2004-06-24 15:25 UTC | newest] Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2004-06-23 20:47 [9fans] plan9port: flock on sunos5.8? Axel Belinfante 2004-06-23 21:17 ` boyd, rounin 2004-06-24 9:03 ` Bengt Kleberg 2004-06-24 13:20 ` William Josephson 2004-06-24 13:22 ` William Josephson 2004-06-24 13:43 ` [9fans] plan9port (: flock) " Axel Belinfante 2004-06-24 14:21 ` boyd, rounin 2004-06-24 15:25 ` William Josephson
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).