Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Getting the PID in CLISP
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  Messages 1 - 25 of 48 - Collapse all  -  Translate all to Translated (View all originals)   Newer >
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Marc Mertens  
View profile  
 More options Oct 22 2002, 2:27 pm
Newsgroups: comp.lang.lisp
From: Marc Mertens <mmert...@vt4.net>
Date: Tue, 22 Oct 2002 20:27:16 +0000
Local: Tues, Oct 22 2002 4:27 pm
Subject: Getting the PID in CLISP
Hi,

  I run CLISP in unix,linux or solaris and wants to get the process id of
the running lisp process. Can someone tell me how I can do this.

Thanks a lot in advance.

Marc Mertens


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Chris Beggy  
View profile  
 More options Oct 22 2002, 4:29 pm
Newsgroups: comp.lang.lisp
From: Chris Beggy <chr...@kippona.com>
Date: Tue, 22 Oct 2002 16:29:19 -0400
Local: Tues, Oct 22 2002 4:29 pm
Subject: Re: Getting the PID in CLISP

Marc Mertens <mmert...@vt4.net> writes:
>   I run CLISP in unix,linux or solaris and wants to get the process id of
> the running lisp process. Can someone tell me how I can do this.

In clisp under linux, try:

  (run-program "/sbin/pidof" :arguments '( "lisp.run") :output "lisp.pid")

The argument of pidof will depend on how clisp is invoked on your system.

For cmucl, it is:

  (run-program "/sbin/pidof" '( "lisp") :output "lisp.pid")

HTH,

Chris


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Barry Margolin  
View profile  
 More options Oct 22 2002, 4:35 pm
Newsgroups: comp.lang.lisp
From: Barry Margolin <bar...@genuity.net>
Date: Tue, 22 Oct 2002 20:35:22 GMT
Local: Tues, Oct 22 2002 4:35 pm
Subject: Re: Getting the PID in CLISP
In article <874rbetdy8....@lackawana.kippona.com>,
Chris Beggy  <chr...@kippona.com> wrote:

>Marc Mertens <mmert...@vt4.net> writes:

>>   I run CLISP in unix,linux or solaris and wants to get the process id of
>> the running lisp process. Can someone tell me how I can do this.

>In clisp under linux, try:

>  (run-program "/sbin/pidof" :arguments '( "lisp.run") :output "lisp.pid")

This assumes there's only one Lisp running on the system at a time.

--
Barry Margolin, bar...@genuity.net
Genuity, Woburn, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tim Bradshaw  
View profile  
 More options Oct 22 2002, 4:48 pm
Newsgroups: comp.lang.lisp
From: Tim Bradshaw <t...@cley.com>
Date: 22 Oct 2002 21:48:06 +0100
Local: Tues, Oct 22 2002 4:48 pm
Subject: Re: Getting the PID in CLISP

* Chris Beggy wrote:
>   (run-program "/sbin/pidof" :arguments '( "lisp.run") :output
>   "lisp.pid")

This can't work - in particular it can't work if there is more than
one image running.  You need, somehow, to ask the process itself what
its PID is.  A horrible hack would be to spawn a bash and ask it for
the value of $PPID, which will be its parent, and therefore, you.
Better would be to compile some foreign call to getpid...

--tim


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Chris Beggy  
View profile  
 More options Oct 22 2002, 5:13 pm
Newsgroups: comp.lang.lisp
From: Chris Beggy <chr...@kippona.com>
Date: Tue, 22 Oct 2002 17:13:21 -0400
Local: Tues, Oct 22 2002 5:13 pm
Subject: Re: Getting the PID in CLISP

Barry Margolin <bar...@genuity.net> writes:
> In article <874rbetdy8....@lackawana.kippona.com>,
> Chris Beggy  <chr...@kippona.com> wrote:
>>Marc Mertens <mmert...@vt4.net> writes:

>>>   I run CLISP in unix,linux or solaris and wants to get the process id of
>>> the running lisp process. Can someone tell me how I can do this.

>>In clisp under linux, try:

>>  (run-program "/sbin/pidof" :arguments '( "lisp.run") :output "lisp.pid")

> This assumes there's only one Lisp running on the system at a time.

I know it's not perfect, but is this any better:

  (run-program "/sbin/pidof" :arguments '( "<programname>") :output "lisp.pid")

Chris


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Erik Naggum  
View profile  
 More options Oct 22 2002, 5:45 pm
Newsgroups: comp.lang.lisp
From: Erik Naggum <e...@naggum.no>
Date: 22 Oct 2002 21:45:09 +0000
Local: Tues, Oct 22 2002 5:45 pm
Subject: Re: Getting the PID in CLISP
* Marc Mertens
| I run CLISP in unix,linux or solaris and wants to get the process id of
| the running lisp process. Can someone tell me how I can do this.

  Have you tried (apropos "pid")?

  (Curiously, the only Common Lisp implementation I have here that does
  /not/ accept the above is Allegro CL in their "ansi mode", in which they
  force you to write (apropos "pid" nil nil t) if you want case-insensitive
  matches -- there is no way to make the last argument default to true!
  No wonder case-sensitivity hurts more than it should.)

--
Erik Naggum, Oslo, Norway

Act from reason, and failure makes you rethink and study harder.
Act from faith, and failure makes you blame someone and push harder.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Erik Naggum  
View profile  
 More options Oct 22 2002, 5:48 pm
Newsgroups: comp.lang.lisp
From: Erik Naggum <e...@naggum.no>
Date: 22 Oct 2002 21:48:42 +0000
Local: Tues, Oct 22 2002 5:48 pm
Subject: Re: Getting the PID in CLISP
* Tim Bradshaw
| Better would be to compile some foreign call to getpid...

  I have never seen a Common Lisp under Unix that did /not/ have a getpid
  function already available under that name ± some adornments.

--
Erik Naggum, Oslo, Norway

Act from reason, and failure makes you rethink and study harder.
Act from faith, and failure makes you blame someone and push harder.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Chris Beggy  
View profile  
 More options Oct 22 2002, 7:50 pm
Newsgroups: comp.lang.lisp
From: Chris Beggy <chr...@kippona.com>
Date: Tue, 22 Oct 2002 19:50:07 -0400
Local: Tues, Oct 22 2002 7:50 pm
Subject: Re: Getting the PID in CLISP

Erik Naggum <e...@naggum.no> writes:
> * Marc Mertens
> | I run CLISP in unix,linux or solaris and wants to get the process id of
> | the running lisp process. Can someone tell me how I can do this.

>   Have you tried (apropos "pid")?

in ilisp, C-c i on pid gives:

PID is the symbol PID, lies in #<PACKAGE COMMON-LISP-USER>, is accessible in the package COMMON-LISP-USER.

 #<PACKAGE COMMON-LISP-USER> is the package named COMMON-LISP-USER. It has the nicknames CL-USER, USER.
 It imports the external symbols of the packages COMMON-LISP, EXT
 and exports no symbols, but no package uses these exports.

Chris


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Erik Naggum  
View profile  
 More options Oct 22 2002, 7:57 pm
Newsgroups: comp.lang.lisp
From: Erik Naggum <e...@naggum.no>
Date: 22 Oct 2002 23:57:38 +0000
Local: Tues, Oct 22 2002 7:57 pm
Subject: Re: Getting the PID in CLISP
* Erik Naggum
| Have you tried (apropos "pid")?

* Chris Beggy
| in ilisp, C-c i on pid gives:

  HAVE YOU TRIED (APROPOS "PID")?

--
Erik Naggum, Oslo, Norway

Act from reason, and failure makes you rethink and study harder.
Act from faith, and failure makes you blame someone and push harder.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Donald Fisk  
View profile  
 More options Oct 22 2002, 8:04 pm
Newsgroups: comp.lang.lisp
From: Donald Fisk <hibou00000nos...@enterprise.net>
Date: Wed, 23 Oct 2002 01:19:58 +0100
Local: Tues, Oct 22 2002 8:19 pm
Subject: Re: Getting the PID in CLISP

Erik Naggum wrote:

> * Marc Mertens
> | I run CLISP in unix,linux or solaris and wants to get the process id of
> | the running lisp process. Can someone tell me how I can do this.

>   Have you tried (apropos "pid")?

Command: clisp
  i i i i i i i       ooooo    o        ooooooo   ooooo   ooooo
  I I I I I I I      8     8   8           8     8     o  8    8
  I  \ `+' /  I      8         8           8     8        8    8
   \  `-+-'  /       8         8           8      ooooo   8oooo
    `-__|__-'        8         8           8           8  8
        |            8     o   8           8     o     8  8
  ------+------       ooooo    8oooooo  ooo8ooo   ooooo   8

Copyright (c) Bruno Haible, Michael Stoll 1992, 1993
Copyright (c) Bruno Haible, Marcus Daniels 1994-1997
Copyright (c) Bruno Haible, Pierpaolo Bernardi, Sam Steingold 1998
Copyright (c) Bruno Haible, Sam Steingold 1999

[1]> (apropos "pid")

[nothing output]

Yes, and it did not find anything on my version of CLisp.
Does it work on the most recent version?

Tim's "horrible hack" works fine:

[10]> (let ((p (make-pipe-input-stream "echo $PPID"))) (prog1 (read p)
(close p)))
31345
[11]>

can be wrapped up into a function, and is preferable to
grepping ps and keeping your fingers crossed it doesn't
pick up someone else's CLisp process.

> Erik Naggum, Oslo, Norway

Le Hibou
--
Dalinian: Lisp. Java. Which one sounds sexier?
RevAaron: Definitely Lisp. Lisp conjures up images of hippy coders,
drugs,
sex, and rock & roll. Late nights at Berkeley, coding in Lisp fueled by
LSD.
Java evokes a vision of a stereotypical nerd, with no life or social
skills.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Marcus Breiing  
View profile  
 More options Oct 22 2002, 8:13 pm
Newsgroups: comp.lang.lisp
From: Marcus Breiing <news-gwif...@breiing.com>
Date: 23 Oct 2002 02:13:21 +0200
Local: Tues, Oct 22 2002 8:13 pm
Subject: Re: Getting the PID in CLISP
Erik Naggum <e...@naggum.no> wrote:

* Chris Beggy

> | in ilisp, C-c i on pid gives:
>   HAVE YOU TRIED (APROPOS "PID")?

(SYSTEM::PROGRAM-ID) seems to do the trick.  Does CLISP have a
non-Unix heritage to account for that name?

--
Marcus Breiing
mailto:news-gwif...@breiing.com (will expire)


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Erik Naggum  
View profile  
 More options Oct 22 2002, 8:34 pm
Newsgroups: comp.lang.lisp
From: Erik Naggum <e...@naggum.no>
Date: 23 Oct 2002 00:34:29 +0000
Local: Tues, Oct 22 2002 8:34 pm
Subject: Re: Getting the PID in CLISP
* Donald Fisk
| Yes, and it did not find anything on my version of CLisp.
| Does it work on the most recent version?

  Well, I am just shocked.  (APROPOS "PID") has produced useful functions
  on all the Common Lisp environments I have used under all the Unices I
  have used Common Lisp on, including all versions of CLISP.  (I am in the
  process of becoming Certified Microsoft-Free, so if I admit to knowing
  anything about what happens in The Other Realm, my certification may be
  in jeopardy.)

--
Erik Naggum, Oslo, Norway

Act from reason, and failure makes you rethink and study harder.
Act from faith, and failure makes you blame someone and push harder.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Chris Beggy  
View profile  
 More options Oct 22 2002, 11:11 pm
Newsgroups: comp.lang.lisp
From: Chris Beggy <chr...@kippona.com>
Date: Tue, 22 Oct 2002 23:11:04 -0400
Local: Tues, Oct 22 2002 11:11 pm
Subject: Re: Getting the PID in CLISP

Erik Naggum <e...@naggum.no> writes:
> * Erik Naggum
> | Have you tried (apropos "pid")?

> * Chris Beggy
> | in ilisp, C-c i on pid gives:

>   HAVE YOU TRIED (APROPOS "PID")?

I should have passed on the results rather than obscurly jumping
ahead to other results.

In my case:

clisp prompt> (apropos "pid")

returns nothing

My clisp version is:

bash prompt%% clisp --version

GNU CLISP 2.28 (released 2002-03-03) (built 3228004349) (memory 3228005268)
Features:
(CLOS LOOP COMPILER CLISP ANSI-CL COMMON-LISP LISP=CL INTERPRETER SOCKETS GENERIC-STREAMS LOGICAL-PATHNAMES SCREEN FFI GETTEXT
 UNICODE BASE-CHAR=CHARACTER PC386 UNIX)

And the platform is gnu/linux on x86 with clisp linked to the
following libraries:

bash prompt%% ldd /usr/bin/clisp

        libc.so.6 => /lib/libc.so.6 (0x40019000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)

Chris


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Vassil Nikolov  
View profile  
 More options Oct 23 2002, 12:02 am
Newsgroups: comp.lang.lisp
From: Vassil Nikolov <vniko...@poboxes.com>
Date: 22 Oct 2002 23:59:53 -0400
Local: Tues, Oct 22 2002 11:59 pm
Subject: Re: Getting the PID in CLISP
    On 22 Oct 2002 21:45:09 +0000, Erik Naggum <e...@naggum.no> said:

    [...]
    EN>   write (apropos "pid" nil nil t) if you want case-insensitive
    EN>   matches -- there is no way to make the last argument default to true!

Or maybe the last argument should have been CASE-SENSITIVE-P,
still defaulting to NIL...

(I'm saying this because I prefer default values of NIL, unless
there is a good reason to pick up a non-NIL default value.)

---Vassil.

--
Non-googlable is googlable.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Carl Shapiro  
View profile  
 More options Oct 23 2002, 12:23 am
Newsgroups: comp.lang.lisp
From: Carl Shapiro <cshapiro+s...@panix.com>
Date: 23 Oct 2002 00:23:19 -0400
Local: Wed, Oct 23 2002 12:23 am
Subject: Re: Getting the PID in CLISP

Erik Naggum <e...@naggum.no> writes:
>   (Curiously, the only Common Lisp implementation I have here that does
>   /not/ accept the above is Allegro CL in their "ansi mode", in which they
>   force you to write (apropos "pid" nil nil t) if you want case-insensitive
>   matches -- there is no way to make the last argument default to true!
>   No wonder case-sensitivity hurts more than it should.)

Well, Lucid also chose the wrong default for APROPOS and APROPOS-LIST.
It is trivial for a user of LCL to patch these functions to call the
underlying LCL:APROPOS-DRIVER subroutine (where the real action
happens) selecting the correct behavior, but these functions really
ought to have had the more intuitive behavior out-of-the-box.

Lucid also dropped the ball by not having LCL startup in an ANSI
compatible mode by default.  To this day, one has to load an optional
submodule in Xanalys Liquid Common Lisp to create the COMMON-LISP and
COMMON-LISP-USER packages with ANSI symbols.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Donald Fisk  
View profile  
 More options Oct 23 2002, 9:11 am
Newsgroups: comp.lang.lisp
From: Donald Fisk <hibou00000nos...@enterprise.net>
Date: Wed, 23 Oct 2002 14:26:53 +0100
Local: Wed, Oct 23 2002 9:26 am
Subject: Re: Getting the PID in CLISP

Erik Naggum wrote:

> * Donald Fisk
> | Yes, and it did not find anything on my version of CLisp.
> | Does it work on the most recent version?

>   Well, I am just shocked.  (APROPOS "PID") has produced useful functions
>   on all the Common Lisp environments I have used under all the Unices I
>   have used Common Lisp on, including all versions of CLISP.  (I am in the
>   process of becoming Certified Microsoft-Free, so if I admit to knowing
>   anything about what happens in The Other Realm, my certification may be
>   in jeopardy.)

I use:

Command: clisp --version
CLISP 1999-07-22 (July 1999)

Running on SuSE Linux.

> Erik Naggum, Oslo, Norway

Le Hibou
--
Dalinian: Lisp. Java. Which one sounds sexier?
RevAaron: Definitely Lisp. Lisp conjures up images of hippy coders,
drugs,
sex, and rock & roll. Late nights at Berkeley, coding in Lisp fueled by
LSD.
Java evokes a vision of a stereotypical nerd, with no life or social
skills.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Erik Naggum  
View profile  
 More options Oct 23 2002, 11:12 am
Newsgroups: comp.lang.lisp
From: Erik Naggum <e...@naggum.no>
Date: 23 Oct 2002 15:12:36 +0000
Local: Wed, Oct 23 2002 11:12 am
Subject: Re: Getting the PID in CLISP
* Donald Fisk <hibou00000nos...@enterprise.net>
| I use:
|
| Command: clisp --version
| CLISP 1999-07-22 (July 1999)

  The crucial element appears to be whether you compile with exported
  syscalls or not.  I have just tried to build 2.27, 2.28, 2.29, and 2.30
  from the distributed tarballs, but all of them bomb during building, so I
  gave up on recovering the configuration options necessary to get `getpid´
  in, e.g., the LINUX package.  My heartfelt thanks go out to the people
  who take time out of their lives to build CLISP into Debian packages.

--
Erik Naggum, Oslo, Norway

Act from reason, and failure makes you rethink and study harder.
Act from faith, and failure makes you blame someone and push harder.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Erik Naggum  
View profile  
 More options Oct 23 2002, 11:13 am
Newsgroups: comp.lang.lisp
From: Erik Naggum <e...@naggum.no>
Date: 23 Oct 2002 15:12:52 +0000
Local: Wed, Oct 23 2002 11:12 am
Subject: Re: Getting the PID in CLISP
* Chris Beggy
| I should have passed on the results rather than obscurly jumping
| ahead to other results.

  That would have helped.

| In my case:
|
| clisp prompt> (apropos "pid")
|
| returns nothing

  Absolutely fascinating.

| My clisp version is:
|
| bash prompt%% clisp --version
|
| GNU CLISP 2.28 (released 2002-03-03) (built 3228004349) (memory 3228005268)
| Features:
(CLOS LOOP COMPILER CLISP ANSI-CL COMMON-LISP LISP=CL INTERPRETER SOCKETS
 GENERIC-STREAMS LOGICAL-PATHNAMES SCREEN FFI GETTEXT UNICODE
 BASE-CHAR=CHARACTER PC386 UNIX)

  Mine does

GNU CLISP 2.30 (released 2002-09-15) (built 3241717887) (memory 3244300085)
Features:
(ASDF MK-DEFSYSTEM COMMON-LISP-CONTROLLER CLX-MIT-R5 CLX-MIT-R4 XLIB CLX
 CLX-LITTLE-ENDIAN HAVE-WITH-STANDARD-IO-SYNTAX HAVE-CLCS HAVE-DECLAIM
 HAVE-PRINT-UNREADABLE-OBJECT CLOS LOOP COMPILER CLISP ANSI-CL COMMON-LISP
 LISP=CL INTERPRETER SOCKETS GENERIC-STREAMS LOGICAL-PATHNAMES SCREEN FFI
 UNICODE BASE-CHAR=CHARACTER SYSCALLS PC386 UNIX)

  Using `set-difference´ on these values, yours-mine yields (gettext) while
  mine-yours yields (asdf mk-defsystem common-lisp-controller clx-mit-r5
  clx-mit-r4 xlib clx clx-little-endian have-with-standard-io-syntax
  have-clcs have-declaim have-print-unreadable-object syscalls)

  The crucial difference is `syscalls´.  It appears to be a build option.

--
Erik Naggum, Oslo, Norway

Act from reason, and failure makes you rethink and study harder.
Act from faith, and failure makes you blame someone and push harder.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Marc Mertens  
View profile  
 More options Oct 23 2002, 12:06 pm
Newsgroups: comp.lang.lisp
From: Marc Mertens <mmert...@vt4.net>
Date: Wed, 23 Oct 2002 18:06:33 +0000
Local: Wed, Oct 23 2002 2:06 pm
Subject: Re: Getting the PID in CLISP

On Tue, 22 Oct 2002 20:48:06 +0000, Tim Bradshaw wrote:
> * Chris Beggy wrote:
>>   (run-program "/sbin/pidof" :arguments '( "lisp.run") :output
>>   "lisp.pid")

> This can't work - in particular it can't work if there is more than
> one image running.  You need, somehow, to ask the process itself what
> its PID is.  A horrible hack would be to spawn a bash and ask it for
> the value of $PPID, which will be its parent, and therefore, you.
> Better would be to compile some foreign call to getpid...

> --tim

I was actually using the following :

(defun get-process-id ()
   (read (ext:run-shell-command "echo $PPID" :output :stream)))

and this works in Linux but fails in Solaris the result of

(ext:run-shell-command "echo $PPID") is

[4]>   (ext:run-shell-command "echo $PPID")

0

on Solaris.

I have tried (apropos 'pid) and its variants but my CLISP does not seems
to support it (searching the CLISP documentation on pid or process did
not revail anything usefull either).

Marc


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Erik Naggum  
View profile  
 More options Oct 23 2002, 12:16 pm
Newsgroups: comp.lang.lisp
From: Erik Naggum <e...@naggum.no>
Date: 23 Oct 2002 16:16:14 +0000
Local: Wed, Oct 23 2002 12:16 pm
Subject: Re: Getting the PID in CLISP
* Marc Mertens <mmert...@vt4.net>
| I have tried (apropos 'pid) and its variants but my CLISP does not seems
| to support it (searching the CLISP documentation on pid or process did
| not revail anything usefull either).

  If you can get CLISP to compile, build it with --with-exported-syscalls.
  (Note that building from the last four available tarballs all bomb on a
  stock Debian 3.0 system, so it may not be your fault if you cannot build.)

--
Erik Naggum, Oslo, Norway

Act from reason, and failure makes you rethink and study harder.
Act from faith, and failure makes you blame someone and push harder.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Discussion subject changed to "Giving away the secret" by Alan S. Crowe
Alan S. Crowe  
View profile  
 More options Oct 23 2002, 1:02 pm
Newsgroups: comp.lang.lisp
From: a...@cawtech.freeserve.co.uk (Alan S. Crowe)
Date: 23 Oct 2002 18:05:42 +0100
Local: Wed, Oct 23 2002 1:05 pm
Subject: Giving away the secret

Erik Naggum <e...@naggum.no> writes:
> * Tim Bradshaw
> | Better would be to compile some foreign call to getpid...

>   I have never seen a Common Lisp under Unix that did /not/ have a getpid
>   function already available under that name ± some adornments.

It is important for beginners to realise that Erik has given
away the store here. It goes like this:

shell-prompt$ lisp
CMU Common Lisp 18d,...
* (apropos "getpid")

UNIX:UNIX-GETPID (defined)
* (unix:unix-getpid)

29312

And in another window:

shell-prompt$ ps | grep lisp
29312  p5  S+     0:00.50 lisp
29367  p6  R+     0:00.00 grep lisp (bash)

Meanwhile, back in CMUCL

* (describe 'unix:unix-getpid)

UNIX-GETPID is an external symbol in the UNIX package.
Function: #<Function UNIX:UNIX-GETPID {1029C9E9}>
Function arguments:
  There are no arguments.
Function documentation:
  Unix-getpid returns the process-id of the current process.
Its defined argument types are:
  NIL
Its result type is:
  (SIGNED-BYTE 32)
On Wednesday, 4/10/02 01:25:46 pm [+1] it was compiled from:
target:code/unix.lisp
  Created: Saturday, 3/23/02 06:50:14 pm GMT
  Comment: $Header: /home/CVS-cmucl/src/code/unix.lisp,v 1.48.2.8 2002/03/23 18:50:14 pw Exp $

With apropos and describe, one can go hunting for cool
functions in one's lisp image all on one's own :)

Alan Crowe


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Discussion subject changed to "Getting the PID in CLISP" by Barry Margolin
Barry Margolin  
View profile  
 More options Oct 23 2002, 2:18 pm
Newsgroups: comp.lang.lisp
From: Barry Margolin <bar...@genuity.net>
Date: Wed, 23 Oct 2002 17:51:22 GMT
Local: Wed, Oct 23 2002 1:51 pm
Subject: Re: Getting the PID in CLISP
In article <pan.2002.10.23.18.06.33.341367....@vt4.net>,
Marc Mertens  <mmert...@vt4.net> wrote:

>I was actually using the following :

>(defun get-process-id ()
>   (read (ext:run-shell-command "echo $PPID" :output :stream)))

>and this works in Linux but fails in Solaris the result of

>(ext:run-shell-command "echo $PPID") is

>[4]>   (ext:run-shell-command "echo $PPID")

>0

>on Solaris.

On Linux, /bin/sh is really bash, which has the built-in $PPID variable.
On Solaris, /bin/sh is Bourne shell, which doesn't.

--
Barry Margolin, bar...@genuity.net
Genuity, Woburn, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tim Bradshaw  
View profile  
 More options Oct 23 2002, 2:39 pm
Newsgroups: comp.lang.lisp
From: Tim Bradshaw <t...@cley.com>
Date: 23 Oct 2002 19:35:25 +0100
Local: Wed, Oct 23 2002 2:35 pm
Subject: Re: Getting the PID in CLISP

* Marc Mertens wrote:
> and this works in Linux but fails in Solaris the result of
> (ext:run-shell-command "echo $PPID") is
> [4]>   (ext:run-shell-command "echo $PPID")
> 0
> on Solaris.

Yes, this is because Solaris's default shell is actually a Bourne
Shell, not bash dressed up (or something), and PPID is something that
bash invented (or maybe some other sh derivative that got inherited by
bash...).

In any case this is a *really* bad way of getting the pid of a
process...

--tim


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Johannes Grødem  
View profile  
 More options Oct 23 2002, 3:55 pm
Newsgroups: comp.lang.lisp
From: "Johannes Grødem" <joh...@ifi.uio.no>
Date: Wed, 23 Oct 2002 21:55:13 +0200
Local: Wed, Oct 23 2002 3:55 pm
Subject: Re: Getting the PID in CLISP
* Erik Naggum <e...@naggum.no>:

> (Note that building from the last four available tarballs all bomb on a
> stock Debian 3.0 system, so it may not be your fault if you cannot build.)

That's odd.  Both 2.30 and the CVS-version builds just fine for me on
Debian 3.0.  Maybe "apt-get build-dep clisp" will fix it for you.

--
Johannes Grødem <OpenPGP: 5055654C>


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Raymond Toy  
View profile  
 More options Oct 23 2002, 4:18 pm
Newsgroups: comp.lang.lisp
From: Raymond Toy <t...@rtp.ericsson.se>
Date: 23 Oct 2002 16:13:47 -0400
Local: Wed, Oct 23 2002 4:13 pm
Subject: Re: Getting the PID in CLISP

>>>>> "Marc" == Marc Mertens <mmert...@vt4.net> writes:

    Marc> and this works in Linux but fails in Solaris the result of

    Marc> (ext:run-shell-command "echo $PPID") is

    Marc> [4]>   (ext:run-shell-command "echo $PPID")

    Marc> 0

    Marc> on Solaris.

Perhaps a bashism?  PPID is defined for me when my shell is bash.
When I use /bin/sh, PPID doesn't exist.

Ray


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Messages 1 - 25 of 48   Newer >
« Back to Discussions « Newer topic     Older topic »