[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gsnd compile trouble on solaris

From: Wim Bakker
Subject: Re: gsnd compile trouble on solaris
Date: Sat, 7 Sep 2002 13:08:47 +0200

On Sat, 07 Sep 2002 05:38:43 -0500
Robert Slover <address@hidden> wrote:

> I've encountered this a number of times when porting to Solaris.  Solaris
> (at least 2.7 and below, I don't know about newer versions) does not
> have 'flock()'.  You can implement your own flock in terms of lockf().
> The caveats are that lockf doesn't handle all of the options of flock()
> (shared locking is missing, IIRC).  What I did was find a linux flock()
> man page and implement an 'flock.c' that uses lockf() underneath and
> returns the same result codes.  If my Sparc weren't down right now, I'd
> grab you some code.  Googling might turn up something, as I am sure
> others have encountered this.  You might also look at fcntl()...I don't
> remember if it does shared locks on Solaris or not.  Something has to.
> I haven't had to do this in a couple of years or so, or I would remember.
Thanks, I know what's the cause now at least, I run solaris 9 and
it has a man page for flock:
     flock - apply or remove an advisory lock on an open file

     /usr/ucb/cc[ flag ... ] file ...
     #include <sys/file.h>

     int flock( fd,  operation);
     int fd, operation;

     flock() applies or removes an  advisory  lock  on  the  file
     associated  with  the  file descriptor fd. The compatibility
     version of flock() has been implemented on top  of  fcntl(2)
      It does not provide complete binary compatibility.
     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.

It seems it has been implemented to some extent in solaris 9 still
ld returns symbol referencing error on flock. Maybe the solaris
implementation is not meant to be actually used in this case.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]