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=-1.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS 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 9C7A7C43381 for ; Sun, 3 Mar 2019 05:56:19 +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 7A63120857 for ; Sun, 3 Mar 2019 05:56:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7A63120857 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=vt.edu 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 1h0K6U-0006IB-Na; Sun, 03 Mar 2019 00:56:02 -0500 Received: from omr2.cc.ipv6.vt.edu ([2607:b400:92:8400:0:33:fb76:806e] helo=omr2.cc.vt.edu) by shelob.surriel.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91) (envelope-from ) id 1h0K6S-0006I4-79 for kernelnewbies@kernelnewbies.org; Sun, 03 Mar 2019 00:56:00 -0500 Received: from mr5.cc.vt.edu (junk.cc.ipv6.vt.edu [IPv6:2607:b400:92:9:0:9d:8fcb:4116]) by omr2.cc.vt.edu (8.14.4/8.14.4) with ESMTP id x235tw6J010973 for ; Sun, 3 Mar 2019 00:55:58 -0500 Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by mr5.cc.vt.edu (8.14.7/8.14.7) with ESMTP id x235tr3J020567 for ; Sun, 3 Mar 2019 00:55:58 -0500 Received: by mail-qk1-f197.google.com with SMTP id 203so1871031qke.7 for ; Sat, 02 Mar 2019 21:55:58 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:in-reply-to:references :mime-version:date:message-id; bh=DkWqsIb2NhU+DOIPX6xfVqqPgktEI75Q7PH8vRf8zY0=; b=ISaO+gIJAKoeCtHfEXU2lddh5GdVBK8Yc/clOzQv/0vHgFy+pWvxSJe7YAq+76fDO0 1Gq65vBhed+LyeaXnG4Ol8G7M+/L4xzXR5cUeWrhOCAPuKCzr820urWwDgJVWclQAKrj 3uPQ7dlMxxQtg0XRyxpjYMHTF/8yj6mnmOETaPAWUGdH7Pjv0vF9I5lQyQvxY6CrUKAH sjHvODojH7Z9wFvbDPKq61OdCeM1SR01BH3YAe5ShmT4Ym0BvHVA2cXvvgnjrBJPqa3S 1YwknM4j94uQMQtPQpYpmkRDr2t+O6RRUjLnRN8tor9BcqmN1wfJRpmfLmhD11usBpuL QvsQ== X-Gm-Message-State: APjAAAWNvl4T5i8fDFqvOdSgmVA4BHWHp7E9mm9upVgEBGGpW9FTrQVn TC7GDCQHd+515eAjQ1H0eG09SjHQ/g46JM5was+qwolWIV4pmyvQZpWKpYm7PwsjIz99QEtVgJi 8sGXEyn7i6zs7QCuMNBQqkPCGOjd/ln3e+b1FBC8= X-Received: by 2002:aed:3e97:: with SMTP id n23mr10308241qtf.201.1551592553266; Sat, 02 Mar 2019 21:55:53 -0800 (PST) X-Google-Smtp-Source: APXvYqzzuUqjYPVmXSEOEPa6Mb7bs7T8FCsANzSMTI8gxyvVlsFW9BgovNk0DzJGdlXmk5dgoxLpxg== X-Received: by 2002:aed:3e97:: with SMTP id n23mr10308229qtf.201.1551592553001; Sat, 02 Mar 2019 21:55:53 -0800 (PST) Received: from turing-police ([2601:5c0:c001:4341::936]) by smtp.gmail.com with ESMTPSA id t26sm1942996qkl.73.2019.03.02.21.55.51 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 02 Mar 2019 21:55:51 -0800 (PST) From: valdis.kletnieks@vt.edu X-Google-Original-From: Valdis.Kletnieks@vt.edu X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.7+dev To: noloader@gmail.com Subject: Re: How to make /dev/ttyACM0 (and friends) exclusive? In-reply-to: References: <3824.1551552333@turing-police> Mime-Version: 1.0 Date: Sun, 03 Mar 2019 00:55:50 -0500 Message-ID: <8247.1551592550@turing-police> 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 Sat, 02 Mar 2019 14:36:12 -0500, Jeffrey Walton said: > I feel like I am missing something... Does Linux consider the modem a > shared resource instead of an exclusive resource? What use cases > support two different programs sending commands to the modem at the > same time? The Linux kernel has exactly zero clue what a "modem" is. It's talking to a serial port, and doesn't care where the other end of the serial cable is. If you have a onboard modem, that cable may be all of 2 mm long and consist of a bunch of traces between two chips on a PCB, or even internal connections between two sides of a chip, but it's still there. So the correct question is "what use cases have two programs talking to the same serial port"? And the answer is: A lot. For a long time, there were these things called "terminals", that the younger folk may not have encountered. And a very common use case was to login via a terminal. At that point, you usually had a login shell like bash or similar running and often doing I/O to the terminal - and if you ran any sub-processes, they also would do I/O to the terminal. So consider the following bash one-liner: % for i in `seq 1 10`; do echo "Loop number $i"; date; sleep 1; done How and why does this work? (Hint 1: 'echo' is a bash builtin, Hint 2: think about how a shell handles stdin/out for child processes) _______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies