Subject: Re: Getting the PID in CLISP
From: rpw3@rpw3.org (Rob Warnock)
Date: Thu, 24 Oct 2002 14:54:00 -0500
Newsgroups: comp.lang.lisp
Message-ID: <hGSdnUTnKqFF0iWgXTWcqg@giganews.com>
Paolo Amoroso  <amoroso@mclink.it> wrote:
+---------------
| Erik Naggum <erik@naggum.no> wrote:
| >   The crucial element appears to be whether you compile with exported
| >   syscalls or not.  ...
| 
| The relevant CLISP configure options should be:
| 
|   --with-export-syscalls --with-module=bindings/linuxlibc6
| 
| Since I don't have the configure help handy, I don't remember whether both
| of them are required, or just the former. The function for getting a
| process pid is then accessible as `LINUX:getpid'.
+---------------

Guys, this is all very well and good if one wants *all* the syscalls
in that package to be accessible with their Unix names, but in the case
of the original poster's question the following might be a lot simpler:

	#+clisp (setf (symbol-function 'getpid)    ; in the using package
		      (symbol-function 'system::program-id))

[I apologize if this isn't the "proper" way to do that, but after a
half-hour of wandering around in the PACKAGE & SYMBOL dictionaries
in the CLHS looking for "RENAMING-IMPORT" or equiv., I gave up and
went with the brute-force approach.]

Or perhaps even:

	#+clisp (defun getpid () (system::program-id))

Since one never needs to call it more than *once* per process,
the overhead of the extra subroutine won't matter.

What am I missing here?


-Rob

-----
Rob Warnock, PP-ASEL-IA		<rpw3@rpw3.org>
627 26th Avenue			<URL:http://www.rpw3.org/>
San Mateo, CA 94403		(650)572-2607