This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: F_ULOCK, F_LOCK, F_TLOCK, F_TEST missing in unistd.h


On Aug 26 15:02, Reini Urban wrote:
> Corinna Vinschen schrieb:
> >I have already lockf kernel code from FreeBSD in my local sandbox since
> >I began working on that earlier this year at one point.  The most missing
> >resources are spare time and a good idea how to share the lock data
> >between processes in a *sensible* way.  The simple appraoch would use
> >Cygserver to keep track of lock data, but I really don't want to involve
> >Cygserver in file I/O.
> 
> but lockf isn't used that often.
> why not KISS style for the start?

Like this?

  int
  lockf (int fildes, int function, off_t size)
  {
    return 0;
  }

Seriously, the basic idea is not to implement lockf, but to implement
advisory locking.  Windows doesn't support advisory locking, only mandatory
locking.  So, roughly the idea is to use some internal locking structure
and to implement lockf, flock and fcntl-locking on top of that.  All these
implementations are only advisory, so the whole job is to keep the
information ready for all Cygwin processes, and to give them the expected
locking behaviour as a process would get on, say, GNU/Linux, but without
actually locking the files on Win32 level.

Mandatory locking would rather go away entirely.  On Linux, one would have
to enable mandatory locking for the whole file system by using a special
mount flag, plus making sure that the group execute bit isn't set on the
file for which mandatory locking should be used.  AFAICS, that wouldn't
have to be implemented for Cygwin at all.

If somebody is interested to have a stab at implementing that, PTC,
as always.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          mailto:cygwin@cygwin.com
Red Hat, Inc.

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]