On Wed, Mar 20, 2002 at 10:14:49PM +0100, Martin v. Loewis wrote: > > Certainly. posixmodule.c is traditionally the place for wrappers > around function supported one atleast some Unixish systems; it > contains already functions less useful than sendfile. > I did some quick hack to use 'setproctitle' of sendmail. I think it is very useful for daemons to show their status. I'm sorry but, can you review this for posixmodule candidate, too? http://fallin.lv/distfiles/xposix-0.0.1.tar.gz I tested only on FreeBSD and Linux. DEMO on FreeBSD Python 2.2 Stackless 020305 (#4, Mar 6 2002, 04:20:41) [GCC 2.95.3 20010315 (release) [FreeBSD]] on freebsd4 Type "help", "copyright", "credits" or "license" for more information. >>> import xposix >>> dir(xposix) ['PRIO_PGRP', 'PRIO_PROCESS', 'PRIO_USER', '__builtins__', '__doc__', '__file__', '__name__', '__path__', '_priority', '_setproctitle', 'getpriority', 'setpriority', 'setproctitle'] >>> xposix.getpriority(xposix.PRIO_PROCESS, 33762) 0 >>> xposix.setpriority(xposix.PRIO_PROCESS, 33762, 5) >>> xposix.getpriority(xposix.PRIO_PROCESS, 33762) 5 >>> import os >>> xposix.setproctitle("searching for the honeypot.. <wink>") >>> os.system("ps auxw|grep 'searching'") perky 29060 0.0 1.0 3676 2648 p8 S+ 5:41PM 0:00.11 python2.2: searching for the honeypot.. <wink> (python2.2) perky 30392 0.0 0.2 732 392 p8 S+ 5:45PM 0:00.00 sh -c ps auxw|grep 'searching' perky 30394 0.0 0.3 1176 720 p8 S+ 5:45PM 0:00.01 grep searching >>> DEMO on Linux >>> xposix.setproctitle("Python: meeting his girl. *^-^*") >>> os.system("ps auxw|grep Python") perky 6231 0.0 0.3 3544 1920 pts/18 S 18:21 0:00 Python: meeting his girl. *^-^* perky 6252 0.0 0.0 1048 500 pts/18 S 18:23 0:00 sh -c ps auxw|grep Python perky 6254 0.0 0.0 1424 464 pts/18 S 18:23 0:00 grep Python 0 >>> >>> xposix.getpriority(xposix.PRIO_PROCESS, 27456) 0 >>> xposix.setpriority(xposix.PRIO_PROCESS, 27456, 17) >>> xposix.getpriority(xposix.PRIO_PROCESS, 27456) 17 >>> Thank you! -- Hye-Shik Chang <perky@fallin.lv> Yonsei University, Seoul
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4