From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.3 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 522EDC4360F for ; Mon, 4 Mar 2019 13:20:30 +0000 (UTC) Received: from shelob.surriel.com (shelob.surriel.com [96.67.55.147]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 01AA420645 for ; Mon, 4 Mar 2019 13:20:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=kroah.com header.i=@kroah.com header.b="puBxdevl"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="SHd7Odpl" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 01AA420645 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kroah.com Authentication-Results: mail.kernel.org; spf=fail smtp.mailfrom=kernelnewbies-bounces@kernelnewbies.org Received: from localhost ([::1] helo=shelob.surriel.com) by shelob.surriel.com with esmtp (Exim 4.91) (envelope-from ) id 1h0nW2-00050W-TK; Mon, 04 Mar 2019 08:20:22 -0500 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]) by shelob.surriel.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91) (envelope-from ) id 1h0nW0-00050P-NV for kernelnewbies@kernelnewbies.org; Mon, 04 Mar 2019 08:20:21 -0500 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id 2E30831B9; Mon, 4 Mar 2019 08:20:14 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Mon, 04 Mar 2019 08:20:14 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kroah.com; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm3; bh=FCl+UmIsKNzki/tAG3oC4nSwa5+ Sci5MFgvhpEfUJew=; b=puBxdevlTNtaT3gEkcCgqWadGvp+aj3Z2X5SjNPtlL/ r2izWFZ4YnFt+fc7Z6pYO9jO7kxB3vmfVOBNZAKgkl6QjczTFNBWJgqzcU/iMxX2 nNIuBqMqbUtPcIT0IS9t0Z/RL/6w4aobDduWhiowWrmTKKCu1L9TaO0x2ty7hq1E BWAnt4CiB68dhPqm62Tb4Ixr7Bro3KIZZUfeNc5vNKCmpoBxmR8TP/G7AQCB1VIQ g5q3onW6JYQCBkZ3obJpa8MsxPZQA+QHlEZuxPNJhtIkxsk0HtVHAj55OR1HJ07Z RSBfbc4/8py1C1uoztoujHTpyTVe9sse6N8QWRJ2OWg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=FCl+Um IsKNzki/tAG3oC4nSwa5+Sci5MFgvhpEfUJew=; b=SHd7OdplQ/7sOYBsJtk4Iu 1aOLrAmT9aXOhiylwGZPrdrqXlmgTgYw9ualBW8+e2V/nC6Ot7HHhVf8W4eOqkC+ JfbEsPmGW7B7y97JUGQvzPfk1BF6pe6+dYM9BPTQFuRpV9Ob6zhLPvCC0/XEm5O1 tKH0bkVR6kYf6cDh0g6D5cb4zxTF/eE/KP1OCZvNpa6GaRTynS3YuHfvmkTw8Udj yiI0YUxP6DrcE++jvQ11k/RZncguOBBH7rAifEBFEEvTAYYw3n/I7COnFezS7m1m dxDvJG7YB7SPpPbfwCTJXVakhESURbYVqn2n5MJjaNirPVpTcYMjn86ulEAOujeQ == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedutddrfedugdehtdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhepfffhvffukfhfgggtuggjfgesthdtre dttdervdenucfhrhhomhepifhrvghgucfmjfcuoehgrhgvgheskhhrohgrhhdrtghomheq necukfhppeekfedrkeeirdekledruddtjeenucfrrghrrghmpehmrghilhhfrhhomhepgh hrvghgsehkrhhorghhrdgtohhmnecuvehluhhsthgvrhfuihiivgeptd X-ME-Proxy: Received: from localhost (5356596b.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) by mail.messagingengine.com (Postfix) with ESMTPA id 11ADB10318; Mon, 4 Mar 2019 08:20:12 -0500 (EST) Date: Mon, 4 Mar 2019 14:20:11 +0100 From: Greg KH To: Jeffrey Walton Subject: Re: How to make /dev/ttyACM0 (and friends) exclusive? Message-ID: <20190304132011.GA8963@kroah.com> References: <3824.1551552333@turing-police> <8247.1551592550@turing-police> <20190303110011.GA10485@kroah.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.11.3 (2019-02-01) Cc: kernelnewbies X-BeenThere: kernelnewbies@kernelnewbies.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Learn about the Linux kernel List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kernelnewbies-bounces@kernelnewbies.org On Mon, Mar 04, 2019 at 08:04:23AM -0500, Jeffrey Walton wrote: > On Sun, Mar 3, 2019 at 6:00 AM Greg KH wrote: > > > > On Sun, Mar 03, 2019 at 03:55:44AM -0500, Jeffrey Walton wrote: > > > ... > > > > Again, go delete modem manager off of your system, it is the thing that > > keeps opening the port up to see if you have made a valid connection on > > the device or not. If you write your own program to talk to the device, > > modem manager is not needed at all, and is known to cause this problem. > > Thanks Greg. I deleted modem manager, then ran two instances of my > program. Both opened the device with O_EXCL, and both opens succeeded. > They proceeded to much with one another's state. Yes, don't do that :) > I don't think modem manager is the problem here. The problem is your userspace is trying to open a device node twice without being _very_ careful about it :) > The first problem is the way this device is setup. An exclusive > resource is being treated as a shared resource. The second problem is > open silently ignores flags. Epic fail. character device nodes do not support O_EXCL, only block device nodes do in kernels newer than 2.6. Again, the kernel is working just fine the only "failure" is a lack of reading the man page for open(2) fully :) greg k-h _______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies