X-Spam-Check-By: sourceware.org Message-ID: <444A211A.1090607@byu.net> Date: Sat, 22 Apr 2006 06:27:06 -0600 From: Eric Blake User-Agent: Thunderbird 1.5.0.2 (Windows/20060308) MIME-Version: 1.0 To: cygwin AT cygwin DOT com, james_wong AT infrasys DOT com DOT hk Subject: Re: What library to link for replacing lockf by _locking? References: <335b7d740604140207j4d99c9cald901cda24d2942e2 AT mail DOT gmail DOT com> <44406047 DOT 40401 AT cygwin DOT com> <335b7d740604182321r631a24c5q3f42431fd475dfd2 AT mail DOT gmail DOT com> <4446F251 DOT 8090208 AT gmail DOT com> <335b7d740604201845q418c281ak34ecc6a6e873bf0f AT mail DOT gmail DOT com> <015f01c664f3$de26e7c0$6507a8c0 AT infrasys DOT com DOT hk> In-Reply-To: <015f01c664f3$de26e7c0$6507a8c0@infrasys.com.hk> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Note-from-DJ: This may be spam -----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 AT byu DOT 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/