Prev: Is Scheme/LISP faster than C/C++
Next: Standard Library SSL Module (was: Python OpenSSL library)
From: Tomasz Pajor on 14 Jun 2010 14:41 Hello, Why there is no setprocname function in standard library, or am I missing something?
From: Grant Edwards on 14 Jun 2010 15:22 On 2010-06-14, Tomasz Pajor <nikon(a)puffy.pl> wrote: > Why there is no setprocname function in standard library, or am I > missing something? Dunno. Before we start guessing, would you care to explain what you think "setprocname" ought to do? -- Grant Edwards grant.b.edwards Yow! If I pull this SWITCH at I'll be RITA HAYWORTH!! gmail.com Or a SCIENTOLOGIST!
From: Thomas Jollans on 14 Jun 2010 15:31 On 06/14/2010 08:41 PM, Tomasz Pajor wrote: > Hello, > > Why there is no setprocname function in standard library, or am I > missing something? why should there be one? what should it do? This sounds like you expect there to be a wrapper of a C system call or other libc function called "setprocname". There is no "setprocname" manual page installed on my system, which suggests to me that there is no such function, at least not in the GNU libc. I may be wrong. What makes you expect the existence of this function, and on which platform? -- Thomas
From: MRAB on 14 Jun 2010 15:43 Grant Edwards wrote: > On 2010-06-14, Tomasz Pajor <nikon(a)puffy.pl> wrote: > >> Why there is no setprocname function in standard library, or am I >> missing something? > > Dunno. Before we start guessing, would you care to explain what you > think "setprocname" ought to do? > I think it's to set the name of the OS process. On Windows, for example, all Python processes are called "python.exe" or "pythonw.exe", so if you have several running it's not clear which is which. Have a look at: http://bugs.python.org/issue5672
From: John Nagle on 14 Jun 2010 16:00 On 6/14/2010 12:31 PM, Thomas Jollans wrote: > On 06/14/2010 08:41 PM, Tomasz Pajor wrote: >> Hello, >> >> Why there is no setprocname function in standard library, or am I >> missing something? > > why should there be one? what should it do? > > This sounds like you expect there to be a wrapper of a C system call or > other libc function called "setprocname". There is no "setprocname" > manual page installed on my system, which suggests to me that there is > no such function, at least not in the GNU libc. I may be wrong. > > What makes you expect the existence of this function, and on which platform? This is useful if you're running some web app that has many processes running, and you'd like some indication of who's doing what for debugging and administration purposes. Some daemons change their title as they run to indicate what they're doing. Do a "ps ax" on Linux, and you'll see some examples. (If the original poster simply wants to change the name in the window of a GUI app, that's a function of the GUI.) BSD systems support "setproctitle", which changes the name of the program visible in "ps", "top", etc. Linux doesn't have "setproctitle". Linux 2.6.9 and later, though, have a PR_SET_NAME function in "prtcl", to set the process name. There's a way to do this in Windows. Look in Task Manager, with a browser running, and the description for each Firefox instance will show the page being displayed. Perl supports program name changing. Storing into "$0" does the appropriate platform-specific thing behind the scenes. It's a reasonable capability to have in Python. I have an application which has a large number of copies of the same Python program running on a server, and it would be useful to be able to see, in "ps" and "top", which one was doing what. John Nagle
|
Next
|
Last
Pages: 1 2 Prev: Is Scheme/LISP faster than C/C++ Next: Standard Library SSL Module (was: Python OpenSSL library) |