From owner-freebsd-current@FreeBSD.ORG Mon Oct 4 05:05:13 2010 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 301D6106564A for ; Mon, 4 Oct 2010 05:05:13 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-iw0-f182.google.com (mail-iw0-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id D968D8FC13 for ; Mon, 4 Oct 2010 05:05:12 +0000 (UTC) Received: by iwn10 with SMTP id 10so1883183iwn.13 for ; Sun, 03 Oct 2010 22:05:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=qK+IPUx355CreqOQa3BHUD675ChlcyfksF757/I/VDQ=; b=KFVqGV8qZj64Y3h1LD58Oo1HdM3SwH1m+6nMugtfdeDBBFYl+K8/JKuf0L0Q3jOVcp 2yDkUlIBpi+d21dGNhcsOluk8uvzbgJSBWLvAxPQk3s4ORs4myOnnftYQxBdfakAoBKx qJk4JTEltt3aszdCAIK5fsbfT5MMAYnrwAu3c= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=WSUw3EKPC2FoGJRBJG7FBSu/bPwSomrJ7/vHCVOr7ozPuI4laGhm1lFsetkrAyIhFN 9M4f72q8mOrpHS3/9Lymey3QP+5+iK4jYIaKd0jdeyf8DTU4e9Nx+0raNyO4USpzWteN 7iXO07KNUk1zETOxAOFb/dZrWk2Ytqy31SV8M= MIME-Version: 1.0 Received: by 10.231.182.201 with SMTP id cd9mr9591344ibb.21.1286168712174; Sun, 03 Oct 2010 22:05:12 -0700 (PDT) Sender: yanegomi@gmail.com Received: by 10.231.190.68 with HTTP; Sun, 3 Oct 2010 22:05:12 -0700 (PDT) In-Reply-To: <20101004123725.65d09b9e.daichi@ongs.co.jp> References: <20101004123725.65d09b9e.daichi@ongs.co.jp> Date: Sun, 3 Oct 2010 22:05:12 -0700 X-Google-Sender-Auth: QQ0cDYuvaGg3Nc64JvVHKc8Ae0M Message-ID: From: Garrett Cooper To: Daichi GOTO Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: freebsd-fs@freebsd.org, freebsd-current@freebsd.org Subject: Re: fcntl always fails to delete lock file, and PID is always -6464 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Oct 2010 05:05:13 -0000 On Sun, Oct 3, 2010 at 8:37 PM, Daichi GOTO wrote: > It looks very strange. fcntl() always fails to delete lock file > and command.l_pid is always -6464. This issue is disclosed in > porting Google's Japanese input system called "mozc". > > =A0details follow: > =A0 =A0http://code.google.com/p/mozc/issues/detail?id=3D40 > > % uname -a > FreeBSD parancell.ongs.co.jp 9.0-CURRENT FreeBSD 9.0-CURRENT #6 r213257: = Thu Sep 30 10:30:06 JST 2010 =A0 =A0 root@parancell.ongs.co.jp:/usr/obj/usr= /src/sys/PARANCELL =A0amd64 > % > > My home directory on NFS server. =A0Does anyone have any ideas? I see some bad assumptions in the code: const int result =3D ::fcntl(*fd, F_SETLK, &command); if (-1 =3D=3D result) { // failed ::close(*fd); LOG(WARNING) << "already locked"; return false; // another server is already running } If the developer actually coded to POSIX expectations, he/she would be checking for EACCES/EAGAIN; there are a myriad of other issues that might be occurring with the software, as per my copy of SUSv4 (see the ERRORS section of fcntl). I would print out the strerror for that case. Providing a backtrace of the application's execution and the architecture and what version of FreeBSD you're using would be helpful. Thanks, -Garrett PS Quickly looking over this code, it has portability issues assuming that all Unix based OSes (that aren't under some Mac OSX guard) are Linux, based on the number of /proc filesystem opens and reads I see in the code.