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: What library to link for replacing lockf by _locking?


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Please don't commandeer threads.  If you are starting a new subject, start
a new thread rather than replying to an existing one.

According to James Wong (Infrasys) on 4/20/2006 9:29 PM:
> I followed an idea from the previous mailing list
> (http://www.cygwin.com/ml/cygwin-talk/2004-q4/msg00136.html) on
> emulating lockf by _locking provided by Windows standard runtime
> library.  However, the binary executable crashes everytime it runs.  I
> did the following and don't know if it has conflicts with cygwin. 
> Anyone has successfully ported lockf before ? Any sample code for
> reference ?

Until someone contributes a patch to cygwin to directly supports lockf (as
required by SUSv3), it remains unsupported.  Mixing Windows calls with
cygwin calls can be dangerous, as doing things behind one another's back
can lead to inconsistent state if not done correctly.

> 
> When compile .... gcc xxx.c -o xxx -lcrtdll -L/usr/lib/mingw ... but xxx
> crashes

mingw is not cygwin; it is a cross-compiler provided for convenience only.
 When compiling a cygwin app, you should NEVER need to -L/usr/lib/mingw,
unless you are asking for a crash.

> 
> If I emulates lockf by dummy function simply just return 1, the binary
> executable will not crash but it simply cannot lock file. Is it the
> right direction to emulate lockf or any other alternative solution ? 

A better emulation would be setting errno to ENOSYS and returning -1,
since 1 is not a valid return value according to POSIX:
http://www.opengroup.org/onlinepubs/009695399/functions/lockf.html

- --
Life is short - so eat dessert first!

Eric Blake             ebb9@byu.net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.1 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFESiEa84KuGfSFAYARAqhgAJwPDhKiBW1YoX61jj9DaA9b54yaEACfeqDa
7eqxzuPDw3caJ43VVuOTsJ8=
=fv4U
-----END PGP SIGNATURE-----

--
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]