delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/04/20/23:30:18

X-Spam-Check-By: sourceware.org
Message-ID: <015f01c664f3$de26e7c0$6507a8c0@infrasys.com.hk>
From: "James Wong \(Infrasys\)" <james_wong AT infrasys DOT com DOT hk>
To: <cygwin AT cygwin DOT com>
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>
Subject: What library to link for replacing lockf by _locking?
Date: Fri, 21 Apr 2006 11:29:55 +0800
MIME-Version: 1.0
X-Mailer: Microsoft Outlook Express 6.00.2900.2869
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
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

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 ?

In the source code ......

#define LK_UNLCK _LK_UNLCK
#define LK_LOCK  _LK_LOCK
#define LK_NBLCK _LK_NBLCK
#define LK_RLCK  _LK_RLCK
#define LK_NBRLCK _LK_NBRLCK

#define lockf _locking              // _locking emulating lockf

#define F_ULOCK _LK_UNLCK /* Unlock locked sections. */
#define F_LOCK  _LK_LOCK  /* Lock a section for exclusive use. */
#define F_TLOCK _LK_NBLCK /* Test and lock a section for exclusive use */
#define F_TEST  _LK_RLCK  /* Test section for locks by other processes. */

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

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 ?  Thks ~

James


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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019