From owner-freebsd-questions@FreeBSD.ORG Tue Jul 8 09:00:36 2003 Return-Path: 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 7070837B405 for ; Tue, 8 Jul 2003 09:00:31 -0700 (PDT) Received: from catflap.home.slightlystrange.org (pc4-cmbg1-4-cust87.cmbg.cable.ntl.com [80.6.127.87]) by mx1.FreeBSD.org (Postfix) with ESMTP id 60E2E43F93 for ; Tue, 8 Jul 2003 09:00:30 -0700 (PDT) (envelope-from danielby@slightlystrange.org) Received: from danielby by catflap.home.slightlystrange.org with local (Exim 4.20) id 19ZutJ-000Nun-DV for freebsd-questions@freebsd.org; Tue, 08 Jul 2003 17:00:29 +0100 Date: Tue, 8 Jul 2003 17:00:29 +0100 From: Daniel Bye To: FreeBSD Questions Message-ID: <20030708160029.GB91154@catflap.home.slightlystrange.org> Mail-Followup-To: FreeBSD Questions References: <20030708152937.GA91154@catflap.home.slightlystrange.org> <008501c34567$a3f2eb20$6e2a6ba5@lc.ca.gov> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="cmJC7u66zC7hs+87" Content-Disposition: inline In-Reply-To: <008501c34567$a3f2eb20$6e2a6ba5@lc.ca.gov> User-Agent: Mutt/1.4.1i Sender: Daniel Bye Subject: Re: Can I Set Process Name? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: dan@slightlystrange.org List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Jul 2003 16:00:37 -0000 --cmJC7u66zC7hs+87 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jul 08, 2003 at 08:43:12AM -0700, Drew Tomlinson wrote: > ----- Original Message -----=20 > From: "Daniel Bye" > To: "FreeBSD Questions" > Sent: Tuesday, July 08, 2003 8:29 AM >=20 > On Tue, Jul 08, 2003 at 08:26:45AM -0700, Drew Tomlinson wrote: > > > > > > $0=3D'webmin'; > ^ > > > > > > However when starting the program it dies with the following > message: > > > > > > Is there something really easy I'm missing? If it's complicated I'm > > > going to forget it as it's not that important. >=20 > > Yes - a `;' at the end of the line ;-) >=20 > Thanks. That removed the error but failed to change the process name. > I looked at the code a little more. I'm not experienced in this but it > seems to me that the 'package miniserv;' line calls a precompiled > program? Here's the beginning of the script: No - in Perl, a "package" is a namespace - an abstract storage space. It helps keep a module's (i.e. package's) variables etc logically separate from those of other packages. It prevents collisions in variable names, data structures, etc. The variable $0 contains, by default, the name of the file containing the currently running script. =20 >=20 > #!/usr/bin/perl > # A very simple perl web server used by Webmin >=20 > $0=3D'webmin'; >=20 > # Require basic libraries > package miniserv; <-- This is just declaring that the following code is in the "miniserv" package. > use Socket; > use POSIX; >=20 > Then a little farther in the script, I see this code: >=20 > # Get miniserv's perl path and location > $miniserv_path =3D $0; =20 > open(SOURCE, $miniserv_path); > =3D~ /^#!(\S+)/; $perl_path =3D $1; > close(SOURCE); > @miniserv_argv =3D @ARGV; >=20 > So I suspect the process name gets set in this somewhere? As you have poked $0 before it gets this far, no - $0 contains the value you set above. Which might, in itself, cause problems later in the script. Without reviewing it, I couldn't tell you. Dan --=20 Daniel Bye PGP Key: ftp://ftp.slightlystrange.org/pgpkey/dan.asc PGP Key fingerprint: 3B9D 8BBB EB03 BA83 5DB4 3B88 86FC F03A 90A1 BE8F _ ASCII ribbon campaign ( ) - against HTML, vCards and X - proprietary attachments in e-mail / \ --cmJC7u66zC7hs+87 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (FreeBSD) iD8DBQE/CuqdhvzwOpChvo8RAtzrAJ99wKddO3E/VDA5KZuVw2NwyDEBnwCdHdUF bQgoZuBUB+WuUI6Q6GwCFaU= =nJtV -----END PGP SIGNATURE----- --cmJC7u66zC7hs+87--