[Python-Dev] Add sendfile() to core? (original) (raw)
Hye-Shik Chang perky@fallin.lv
Thu, 21 Mar 2002 18:09:16 +0900
- Previous message: [Python-Dev] Add sendfile() to core?
- Next message: [Python-Dev] Add sendfile() to core?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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.PRIOPROCESS, 33762) 0 xposix.setpriority(xposix.PRIOPROCESS, 33762, 5) xposix.getpriority(xposix.PRIOPROCESS, 33762) 5 import os xposix.setproctitle("searching for the honeypot.. ") 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.. (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.PRIOPROCESS, 27456) 0 xposix.setpriority(xposix.PRIOPROCESS, 27456, 17) xposix.getpriority(xposix.PRIOPROCESS, 27456) 17
Thank you!
-- Hye-Shik Chang <perky@fallin.lv> Yonsei University, Seoul
- Previous message: [Python-Dev] Add sendfile() to core?
- Next message: [Python-Dev] Add sendfile() to core?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]