Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp2462529ybi; Mon, 17 Jun 2019 05:21:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqyxpyighio1cIOBhZizDZJR15DEthbMcAyxw98xOu4q3XNvaI7nJHQ2gmjL2kczI2TDf+aP X-Received: by 2002:a17:902:2b8a:: with SMTP id l10mr68998141plb.283.1560774098887; Mon, 17 Jun 2019 05:21:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560774098; cv=none; d=google.com; s=arc-20160816; b=YUVdvJprY6947ibEPxVZX3oAhlYtVsEACF9RhdQS41KsvKVawqRb/e6kTAAO52pqzP FWsGxRzQFp0+jUK5dLC8t2OpWnXfMci+J9RHP9pT39uMDKgfE4aKUKqLHBV27Oocjz5E Eb3fs4tm1dPFMqaLCQWRtQLOv7UPRfNtNMXpNXuRwfb00k3hDgftLdNyIT9fQfCKwTwe krTSqz/HOy9CoX+MUo8SLgS1bgiWiuts3nWzGYNexJfXCtWMqwwyypf0cluho8UR0WEU UNjaZlCqMxTGEKsGF9IVA3rZH07zFHeLdIYjP3+QiDAv/UjBKgC3PKhzlH0oHEMB1iA0 A9dw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=h6E2Ip34X/NLucxUj+SAkivtur6dQeITpi+3ydY7xI0=; b=Y6npVyuICL4Oa7Oda/BG/kHLlt56LBa2cUVmON7nAe/k45G+oy0JigXjJ29KDNvhih HnMjhyAncqjIkEbzh/La5GX2x6rf3O/+Zj3Sb84MS+H7Xh4GDeWBB/ZbpELfe4Rzydfe h14Hv50nOjL5rmAcLsVuw9sMjt6zqgKEIkgOAv3JrdOGYqtOGe3AwDEdpJ5VkSkiMVu/ k7SiNvu8kYKw1ogKAwDoPLSUGS/3T0nmay7YhUyOI6X98RdmvMGMkp/hlyD9IW7WMTIf g+ZoHyTjZQSW08MNFmB7uCG9GCI1W0OBVHzMLyj/QE2NoH+GIU4wRYAgoDHIFufIqGGW elcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=VaUgNytS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 91si10235133plb.39.2019.06.17.05.21.23; Mon, 17 Jun 2019 05:21:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=VaUgNytS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727809AbfFQMUq (ORCPT + 99 others); Mon, 17 Jun 2019 08:20:46 -0400 Received: from mail-vs1-f66.google.com ([209.85.217.66]:34929 "EHLO mail-vs1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726957AbfFQMUp (ORCPT ); Mon, 17 Jun 2019 08:20:45 -0400 Received: by mail-vs1-f66.google.com with SMTP id u124so5965261vsu.2 for ; Mon, 17 Jun 2019 05:20:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=h6E2Ip34X/NLucxUj+SAkivtur6dQeITpi+3ydY7xI0=; b=VaUgNytSxrZHTdPy4AHf679viycuTT6TSbjD97ksFXQstGJ82OF4pQ79sVLFQZQhN+ TAuv5O2zEPG++5ULYyed+wDJ5gD2Dqj0QNEzc6xYj4nzpZTwncw9qHWxhO6uVJGU+EYS 2EbluPNmffJYa8MDJ+KpRZqomOybDNanPvTv+/o3haL3l7jK1LYduPX7LAks6bEOSRAB Ten84501wJz8bGfC9E0wLG4zBNZLaFYPikgrBwnDcGtcQe9IxcbgCH3GWG/SspfXvqP9 zgqRTcV4gdtH0YJ7d3VGLRfctNOdxQZCumldkSAga6QkZJaEAFxC0NobHLu/1cHYL9Qj jdxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=h6E2Ip34X/NLucxUj+SAkivtur6dQeITpi+3ydY7xI0=; b=MYykcE7iVsYCDJT/vnNjb+D+yBxIck7UA93FNLBUWPNmny8fIVh+0WrBuUA4LbzwoP b5cuz4tfoLGBsit8i91Le7tiI644NRWWcKavZ4oJmLBUqKYlGLxWx4jmkRo/y53DmbpL PUB0AZo6WBGNHP/nr4JFQKQ74dfHeA3paPTQF8+sXmmjCiZN8x494h4jAuLbvjW/cwOq FZ58RvLhx855w1/tVp+uXoLfbJSvRbcpHVEAD6HmhsbKFI4VdJeQNmxju0ajL8v/L6JQ znBQ+JVjf6QQ7OHS+DiLjFBeNf5uZNTyY35Y3j4o9emz846/0eg665rKBC9fUOhmIE03 pbLg== X-Gm-Message-State: APjAAAU9PnZNedsmr2Zky55nZ6DvGwDYcNRW41y2xAsZB2N4hjtvMT8x +UKU+tRqtS9623lFmQr0jaI8n9dGC26IV8k2Z81f7QLh X-Received: by 2002:a67:6d44:: with SMTP id i65mr59348095vsc.106.1560774044360; Mon, 17 Jun 2019 05:20:44 -0700 (PDT) MIME-Version: 1.0 References: <13999.1560455005@turing-police> In-Reply-To: <13999.1560455005@turing-police> From: Pintu Agarwal Date: Mon, 17 Jun 2019 17:50:32 +0530 Message-ID: Subject: Re: Pause a process execution from external program To: =?UTF-8?Q?Valdis_Kl=C4=93tnieks?= Cc: Shyam Saini , open list , pedro@palves.net, Kernelnewbies Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 14, 2019 at 1:13 AM Valdis Kl=C4=93tnieks wrote: > > On Thu, 13 Jun 2019 13:22:12 +0530, Shyam Saini said: > > > from command line we use ctrl-z to stop execution of a foreground > > process but you can program > > SIGTSTP signal handler in your application code to do the same. > > Note that if you simply fail to include a signal handler for SIGSTOP and > SIGCONT, it will Do The Right Thing. The only programs that need worry a= bout > SIGTSTP are ones like 'vi' that may want to do something (like restore th= e > terminal state from raw to cooked mode, etc) before they stop. That's wh= y you > can control-z /bin/cat without it having to include a signal handler for = it. > > % kill -STOP `pidof process-to-stop` # stop it > % kill -CONT `pidof process-to-stop` # and make it run again. > > No source code modifications needed. No source needed. > > Now, if you want to make it stop at a *specific point*, then you're into > ptrace territory, and source will be helpful. > Yes, I think ptrace can serve our purpose. Thank you so much.