X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BC31A385841A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1691860530; bh=S6KfkBfpSx2ZsxWUCatUVekJMLMs9sDV2yDAr2l+mQ0=; h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=GwBkJIoxoNYCIaEHUDVCw9Zaes+/Vu7SGadwJIKlIM/C3KpCHZOFIiZTXdr5/oY3C F45NwU+R4B0awgVfkAMDD/DYTwq2GeuHYn0WkawmhShE1rpYrCm4/5bZJr5xAT+4UX CsxmPnVRPRsnpvPcXqAlrTrRKnMw2YYLfaUBKzEc= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BF55E3858D20 X-Authority-Analysis: v=2.4 cv=e5oV9Il/ c=1 sm=1 tr=0 ts=64d7be0d a=DxHlV3/gbUaP7LOF0QAmaA==:117 a=DxHlV3/gbUaP7LOF0QAmaA==:17 a=IkcTkHD0fZMA:10 a=_Dj-zB-qAAAA:8 a=w_pzkKWiAAAA:8 a=ScbYiTYG-RjKel5snz4A:9 a=QEXdDO2ut3YA:10 a=sRI3_1zDfAgwuvI8zelB:22 Message-ID: Date: Sat, 12 Aug 2023 11:14:52 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.14.0 Subject: Re: lsof for Windows processes? Content-Language: en-CA To: cygwin AT cygwin DOT com References: <1b03c681-a144-5953-1d15-388029f19ba3 AT Shaw DOT ca> Organization: Inglis In-Reply-To: X-CMAE-Envelope: MS4xfJdDPt53riakaQ9kQyYVdqE1rnWvjXNvnPAXchR+i9t5CLRRXPTaGYQwjrsjL3e8Rq7m+vQmZbEXRE2sH4xqSdfw6UnwOP4RKSd0j/ASf5+m0TRZrC7t M+TK6wHIWFOrwqDKTHXJ44pH8yIpZSP//C1b1ELcKSk9AugxWGscM06o+fFWp45379XRiDOEJuxtlzt1HCzyXslQgMAcntCD59Vv7+EcN3889m/Hd2NsUCCb X-Spam-Status: No, score=-3.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: cygwin AT cygwin DOT com X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Brian Inglis via Cygwin Reply-To: cygwin AT cygwin DOT com Cc: Brian Inglis , Cedric Blancher Content-Type: text/plain; charset="utf-8"; Format="flowed" Errors-To: cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com Sender: "Cygwin" Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 37CHFVwH006397 On 2023-08-12 05:34, Cedric Blancher via Cygwin wrote: > Good afternoon! > > On Fri, 11 Aug 2023 at 18:21, Brian Inglis wrote: >> >> On 2023-08-11 09:45, Cedric Blancher via Cygwin wrote: >>> Does Cygwin have a tool like lsof which can list which files or >>> directories are in use by a Windows process? >> >> You can check these things yourself using the Cygwin Search Packages page: >> >> https://cygwin.com/packages/ >> >> type "usr/bin/lsof" and hit Enter: >> >> https://cygwin.com/cgi-bin2/package-grep.cgi?grep=usr%2Fbin%2Ffuser >> >> Search Results >> >> Found 0 matches for usr/bin/lsof >> >> and the same on the command line: >> >> $ cygcheck -p usr/bin/lsof >> Found 0 matches for usr/bin/lsof >> >> but Cygwin does have fuser: >> >> $ cygcheck -p usr/bin/fuser >> Found 6 matches for usr/bin/fuser >> cygfuse-3.2.0-2 - cygfuse: Cygwin interface to Windows FUSE providers >> cygfuse-3.2.0-3 - cygfuse: Cygwin interface to Windows FUSE providers >> psmisc-debuginfo-22.20-1 - psmisc-debuginfo: Debug info for psmisc >> psmisc-debuginfo-23.4-4 - psmisc-debuginfo: Debug info for psmisc >> psmisc-22.20-1 - psmisc: Utilities for managing processes on your system >> psmisc-23.4-4 - psmisc: Utilities for managing processes on your system >> >> and Windows has openfiles: >> >> $ cmd /c help openfiles >> >> OPENFILES /parameter [arguments] >> >> Description: >> Enables an administrator to list or disconnect files and folders >> that have been opened on a system. >> >> Parameter List: >> /Disconnect Disconnects one or more open files. >> >> /Query Displays files opened locally or from shared >> folders. >> >> /Local Enables / Disables the display of local open files. >> >> /? Displays this help message. >> >> Examples: >> OPENFILES /Disconnect /? >> OPENFILES /Query /? >> OPENFILES /Local /? > > Thank you. > > But neither openfiles or fuser seem to work in this case, even if I > have a file open in my bash shell, and call fuser in the same bash > script: > > bash -c 'command exec {n} fuser -a /mynfsmount ; true' > > gives > > fd=10 > /mynfsmount: > > (no processes listed, which might be correct, as maybe a non cygwin > process has that file open) I use it to tell me when build processes close their logs. Currently on X (lightly sanitized): $ fuser -av ~/.xsession-errors Cannot stat file /proc/14838/fd/0: No such device or address Cannot stat file /proc/14838/fd/1: No such device or address Cannot stat file /proc/14838/fd/2: No such device or address Cannot stat file /proc/14931/fd/0: No such device or address Cannot stat file /proc/14931/fd/1: No such device or address Cannot stat file /proc/14931/fd/2: No such device or address USER PID ACCESS COMMAND $HOME/.xsession-errors: $USER 14962 F.... fbxkb $USER 14935 F.... xwin-xdg-menu $USER 14964 F.... mintty -- Take care. Thanks, Brian Inglis Calgary, Alberta, Canada La perfection est atteinte Perfection is achieved non pas lorsqu'il n'y a plus rien à ajouter not when there is no more to add mais lorsqu'il n'y a plus rien à retirer but when there is no more to cut -- Antoine de Saint-Exupéry -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple