#include "EXTERN.h" #include "perl.h" #include "XSUB.h" #include "dlfcn.h" static int (*setproctitle)(const char *buf, int len); static int (*getproctitle)(char *buf, int len); static int (*setproctitle_max)(void); MODULE = Sys::Proctitle PACKAGE = Sys::Proctitle SV * getproctitle() PROTOTYPE: CODE: { int len=setproctitle_max(); char *buf=malloc( len ); if( getproctitle( buf, len ) ) { XSRETURN_UNDEF; } else { RETVAL=newSVpv( buf, len ); } free( buf ); } OUTPUT: RETVAL void setproctitle(...) PROTOTYPE: @ PPCODE: if( items > 0 ) { char *title, *buf, *cur; STRLEN len; int i, max; if( items==1 ) { title=(char *)SvPV(ST(0), len); setproctitle(title, len); } else { buf=malloc( max=setproctitle_max() ); if( !buf ) XSRETURN_NO; for( i=0, cur=buf; i