From owner-freebsd-questions Fri Oct 4 8: 1: 3 2002 Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9CCBC37B401 for ; Fri, 4 Oct 2002 08:01:02 -0700 (PDT) Received: from post-20.mail.nl.demon.net (post-20.mail.nl.demon.net [194.159.73.1]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0245343E3B for ; Fri, 4 Oct 2002 08:01:02 -0700 (PDT) (envelope-from cls@raggedclown.net) Received: from [212.238.197.102] (helo=mailhost.raggedclown.net) by post-20.mail.nl.demon.net with esmtp (Exim 3.36 #1) id 17xTwq-00092g-00; Fri, 04 Oct 2002 15:01:01 +0000 Received: from willow.raggedclown.net (willow.raggedclown.intra [192.168.1.10]) by mailhost.raggedclown.net (Ragged Clown Mail Gateway [oz]) with ESMTP id E26624881D; Fri, 4 Oct 2002 17:00:59 +0200 (CEST) Received: by willow.raggedclown.net (Ragged Clown Host [willow], from userid 1009) id 91298225A5; Fri, 4 Oct 2002 17:01:00 +0200 (CEST) Date: Fri, 4 Oct 2002 17:01:00 +0200 From: Cliff Sarginson To: Oliver Fromme Cc: freebsd-questions@FreeBSD.ORG Subject: Re: killing an application through code Message-ID: <20021004150100.GB1537@raggedclown.net> References: <200210011702.g91H2gZN051898@axp.csl.sri.com> <200210041431.g94EVn1R057459@lurza.secnetix.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200210041431.g94EVn1R057459@lurza.secnetix.de> User-Agent: Mutt/1.3.27i Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Fri, Oct 04, 2002 at 04:31:49PM +0200, Oliver Fromme wrote: > Mike Hogsett wrote: > > > > > Can anyone tell me how i can kill an application > > > process through a piece of C code? > > > > man killall > > He was asking for C code. Well, in C, the easiest way > is probably to go through the procfs(5) filesystem to > find the PID and then use the kill(2) system call. This > isn't portable, though, but I don't think that there is > a portable way to do it. > > Regards > Oliver > Well if he has control over the application he could make it record it's pid somewhere as many system programs do, and use that. He should bear in mind of course he will only be able to kill them stone dead if he owns them or is root. This is definitely portable ! -- Regards Cliff Sarginson The Netherlands Email: cls@raggedclown.net Tel : +31 (0)10 4764595 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message