Module: ngircd.git Branch: master Commit: bf8b64630443b2bd3fe2a298f860ea0d492df649 URL: http://ngircd.barton.de/cgi-bin/gitweb.cgi?p=ngircd.git&a=commit;h=bf8b6...
Author: Alexander Barton alex@barton.de Date: Sun Jul 11 15:15:23 2010 +0200
New function Conn_GetProcStat()
Get PROC_STAT sub-process structure of a given connection.
---
src/ngircd/conn.c | 17 ++++++++++++++++- src/ngircd/conn.h | 3 ++- src/ngircd/resolve.c | 1 - 3 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/src/ngircd/conn.c b/src/ngircd/conn.c index 9da618f..f4efff1 100644 --- a/src/ngircd/conn.c +++ b/src/ngircd/conn.c @@ -68,7 +68,6 @@ #include "log.h" #include "ng_ipaddr.h" #include "parse.h" -#include "proc.h" #include "resolve.h" #include "tool.h"
@@ -2099,6 +2098,22 @@ Conn_GetClient( CONN_ID Idx ) return c ? c->client : NULL; }
+/** + * Get PROC_STAT sub-process structure of a connection. + * @param Idx Connection index number + * @return PROC_STAT structure + */ +GLOBAL PROC_STAT * +Conn_GetProcStat(CONN_ID Idx) +{ + CONNECTION *c; + + assert(Idx >= 0); + c = array_get(&My_ConnArray, sizeof (CONNECTION), (size_t)Idx); + assert(c != NULL); + return &c->proc_stat; +} /* Conn_GetProcStat */ +
/** * Get CONN_ID from file descriptor associated to a subprocess structure. diff --git a/src/ngircd/conn.h b/src/ngircd/conn.h index e9b470b..a63fcbb 100644 --- a/src/ngircd/conn.h +++ b/src/ngircd/conn.h @@ -44,11 +44,11 @@ typedef long CONN_ID;
#include "client.h" +#include "proc.h"
#ifdef CONN_MODULE
#include "defines.h" -#include "proc.h" #include "array.h" #include "tool.h" #include "ng_ipaddr.h" @@ -115,6 +115,7 @@ GLOBAL void Conn_SyncServerStruct PARAMS(( void ));
GLOBAL CONN_ID Conn_GetFromProc PARAMS((int fd)); GLOBAL CLIENT* Conn_GetClient PARAMS((CONN_ID i)); +GLOBAL PROC_STAT* Conn_GetProcStat PARAMS((CONN_ID i)); #ifdef SSL_SUPPORT GLOBAL bool Conn_GetCipherInfo PARAMS((CONN_ID Idx, char *buf, size_t len)); GLOBAL bool Conn_UsesSSL PARAMS((CONN_ID Idx)); diff --git a/src/ngircd/resolve.c b/src/ngircd/resolve.c index f8c39cf..26ad103 100644 --- a/src/ngircd/resolve.c +++ b/src/ngircd/resolve.c @@ -35,7 +35,6 @@ #include "defines.h" #include "log.h" #include "ng_ipaddr.h" -#include "proc.h"
#include "exp.h" #include "resolve.h"