Back to index

php5  5.3.10
Classes | Defines | Typedefs | Functions | Variables
lsapilib.h File Reference
#include <stddef.h>
#include <lsapidef.h>
#include <sys/time.h>
#include <sys/types.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  LSAPI_key_value_pair
struct  lsapi_request

Defines

#define LSAPI_MAX_RESP_HEADERS   100

Typedefs

typedef struct lsapi_request LSAPI_Request
typedef int(* LSAPI_CB_EnvHandler )(const char *pKey, int keyLen, const char *pValue, int valLen, void *arg)
typedef int(* fn_select_t )(int, fd_set *, fd_set *, fd_set *, struct timeval *)

Functions

int LSAPI_Init (void)
void LSAPI_Stop (void)
int LSAPI_Is_Listen_r (LSAPI_Request *pReq)
int LSAPI_InitRequest (LSAPI_Request *pReq, int fd)
int LSAPI_Accept_r (LSAPI_Request *pReq)
void LSAPI_Reset_r (LSAPI_Request *pReq)
int LSAPI_Finish_r (LSAPI_Request *pReq)
int LSAPI_Release_r (LSAPI_Request *pReq)
char * LSAPI_GetHeader_r (LSAPI_Request *pReq, int headerIndex)
int LSAPI_ForeachHeader_r (LSAPI_Request *pReq, LSAPI_CB_EnvHandler fn, void *arg)
int LSAPI_ForeachOrgHeader_r (LSAPI_Request *pReq, LSAPI_CB_EnvHandler fn, void *arg)
int LSAPI_ForeachEnv_r (LSAPI_Request *pReq, LSAPI_CB_EnvHandler fn, void *arg)
int LSAPI_ForeachSpecialEnv_r (LSAPI_Request *pReq, LSAPI_CB_EnvHandler fn, void *arg)
char * LSAPI_GetEnv_r (LSAPI_Request *pReq, const char *name)
int LSAPI_ReadReqBody_r (LSAPI_Request *pReq, char *pBuf, int len)
int LSAPI_ReqBodyGetChar_r (LSAPI_Request *pReq)
int LSAPI_ReqBodyGetLine_r (LSAPI_Request *pReq, char *pBuf, int bufLen, int *getLF)
int LSAPI_FinalizeRespHeaders_r (LSAPI_Request *pReq)
int LSAPI_Write_r (LSAPI_Request *pReq, const char *pBuf, int len)
int LSAPI_Write_Stderr_r (LSAPI_Request *pReq, const char *pBuf, int len)
int LSAPI_Flush_r (LSAPI_Request *pReq)
int LSAPI_AppendRespHeader_r (LSAPI_Request *pHeader, char *pBuf, int len)
static int LSAPI_SetRespStatus_r (LSAPI_Request *pReq, int code)
static char * LSAPI_GetQueryString_r (LSAPI_Request *pReq)
static char * LSAPI_GetScriptFileName_r (LSAPI_Request *pReq)
static char * LSAPI_GetScriptName_r (LSAPI_Request *pReq)
static char * LSAPI_GetRequestMethod_r (LSAPI_Request *pReq)
static int LSAPI_GetReqBodyLen_r (LSAPI_Request *pReq)
static int LSAPI_GetReqBodyRemain_r (LSAPI_Request *pReq)
int LSAPI_Is_Listen (void)
static int LSAPI_Accept (void)
static int LSAPI_Finish (void)
static char * LSAPI_GetHeader (int headerIndex)
static int LSAPI_ForeachHeader (LSAPI_CB_EnvHandler fn, void *arg)
static int LSAPI_ForeachOrgHeader (LSAPI_CB_EnvHandler fn, void *arg)
static int LSAPI_ForeachEnv (LSAPI_CB_EnvHandler fn, void *arg)
static int LSAPI_ForeachSpecialEnv (LSAPI_CB_EnvHandler fn, void *arg)
static char * LSAPI_GetEnv (const char *name)
static char * LSAPI_GetQueryString ()
static char * LSAPI_GetScriptFileName ()
static char * LSAPI_GetScriptName ()
static char * LSAPI_GetRequestMethod ()
static int LSAPI_GetReqBodyLen ()
static int LSAPI_GetReqBodyRemain ()
static int LSAPI_ReadReqBody (char *pBuf, int len)
static int LSAPI_ReqBodyGetChar ()
static int LSAPI_ReqBodyGetLine (char *pBuf, int len, int *getLF)
static int LSAPI_FinalizeRespHeaders (void)
static int LSAPI_Write (const char *pBuf, int len)
static int LSAPI_Write_Stderr (const char *pBuf, int len)
static int LSAPI_Flush ()
static int LSAPI_AppendRespHeader (char *pBuf, int len)
static int LSAPI_SetRespStatus (int code)
int LSAPI_IsRunning (void)
int LSAPI_CreateListenSock (const char *pBind, int backlog)
int LSAPI_Init_Prefork_Server (int max_children, fn_select_t fp, int avoidFork)
void LSAPI_Set_Server_fd (int fd)
int LSAPI_Prefork_Accept_r (LSAPI_Request *pReq)
void LSAPI_Set_Max_Reqs (int reqs)
void LSAPI_Set_Max_Idle (int secs)
void LSAPI_Set_Max_Children (int maxChildren)
void LSAPI_Set_Max_Idle_Children (int maxIdleChld)
void LSAPI_Set_Server_Max_Idle_Secs (int serverMaxIdle)
void LSAPI_Set_Max_Process_Time (int secs)
void LSAPI_Init_Env_Parameters (fn_select_t fp)
void LSAPI_Set_Slow_Req_Msecs (int msecs)
int LSAPI_Get_Slow_Req_Msecs ()

Variables

LSAPI_Request g_req

Class Documentation

struct LSAPI_key_value_pair

Definition at line 67 of file lsapilib.h.

Class Members
int keyLen
char * pKey
char * pValue
int valLen
struct lsapi_request

Definition at line 78 of file lsapilib.h.

Collaboration diagram for lsapi_request:
Class Members
int m_bufProcessed
int m_bufRead
int m_envListSize
int m_fd
int m_fdListen
long m_lLastActive
long m_lReqBegin
struct LSAPI_key_value_pair * m_pEnvList
struct lsapi_req_header * m_pHeader
struct lsapi_http_header_index * m_pHeaderIndex
char * m_pHttpHeader
struct iovec * m_pIovec
struct iovec * m_pIovecCur
struct iovec * m_pIovecEnd
struct iovec * m_pIovecToWrite
char * m_pQueryString
char * m_pReqBuf
char * m_pRequestMethod
char * m_pRespBuf
char * m_pRespBufEnd
char * m_pRespBufPos
char * m_pRespHeaderBuf
char * m_pRespHeaderBufEnd
char * m_pRespHeaderBufPos
char * m_pScriptFile
char * m_pScriptName
struct LSAPI_key_value_pair * m_pSpecialEnvList
struct lsapi_header_offset * m_pUnknownHeader
int m_reqBodyRead
int m_reqBufSize
int m_reqState
short m_respHeaderLen
struct lsapi_packet_header * m_respPktHeaderEnd
int m_specialEnvListSize
int m_totalLen

Define Documentation

#define LSAPI_MAX_RESP_HEADERS   100

Definition at line 76 of file lsapilib.h.


Typedef Documentation

typedef int(* fn_select_t)(int, fd_set *, fd_set *, fd_set *, struct timeval *)

Definition at line 324 of file lsapilib.h.

typedef int(* LSAPI_CB_EnvHandler)(const char *pKey, int keyLen, const char *pValue, int valLen, void *arg)

Definition at line 136 of file lsapilib.h.

typedef struct lsapi_request LSAPI_Request

Function Documentation

static int LSAPI_Accept ( void  ) [inline, static]

Definition at line 248 of file lsapilib.h.

{   return LSAPI_Accept_r( &g_req );                        }

Here is the call graph for this function:

Definition at line 656 of file lsapilib.c.

{
    char        achPeer[128];
    socklen_t   len;
    int         nodelay = 1;
    
    if ( !pReq ) {
        return -1;
    }
    if ( LSAPI_Finish_r( pReq ) == -1 ) {
        return -1;
    }
    while( g_running ) {
        if ( pReq->m_fd == -1 ) {
            if ( pReq->m_fdListen != -1) {
                len = sizeof( achPeer );
                pReq->m_fd = accept( pReq->m_fdListen,
                            (struct sockaddr *)&achPeer, &len );
                if ( pReq->m_fd == -1 ) {
                    if (( errno == EINTR )||( errno == EAGAIN)) {
                        continue;
                    } else {
                        return -1;
                    }
                } else {
                    lsapi_set_nblock( pReq->m_fd , 0 );
                    if (((struct sockaddr *)&achPeer)->sa_family == AF_INET ) {    
                        setsockopt(pReq->m_fd, IPPROTO_TCP, TCP_NODELAY,
                                (char *)&nodelay, sizeof(nodelay));
                    }

                    if ( s_accept_notify )
                        return notify_req_received( pReq->m_fd );

                }
            } else {
                return -1;
            }
        }
        if ( !readReq( pReq ) ) {
            break;
        }
        lsapi_close( pReq->m_fd );
        pReq->m_fd = -1;
        LSAPI_Reset_r( pReq );
    }
    return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int LSAPI_AppendRespHeader ( char *  pBuf,
int  len 
) [inline, static]

Definition at line 314 of file lsapilib.h.

{   return LSAPI_AppendRespHeader_r( &g_req, pBuf, len );   }

Here is the call graph for this function:

Here is the caller graph for this function:

int LSAPI_AppendRespHeader_r ( LSAPI_Request pHeader,
char *  pBuf,
int  len 
)

Definition at line 1368 of file lsapilib.c.

{
    if ( !pReq || !pBuf || len <= 0 || len > LSAPI_RESP_HTTP_HEADER_MAX ) {
        return -1;
    }
    if ( pReq->m_reqState & LSAPI_ST_RESP_BODY ) {
        return -1;
    }
    if ( pReq->m_respHeader.m_respInfo.m_cntHeaders >= LSAPI_MAX_RESP_HEADERS ) {
        return -1;
    }
    if ( pReq->m_pRespHeaderBufPos + len + 1 > pReq->m_pRespHeaderBufEnd ) {
        int newlen = pReq->m_pRespHeaderBufPos + len + 4096 - pReq->m_pRespHeaderBuf;
        newlen -= newlen % 4096;
        if ( allocateRespHeaderBuf( pReq, newlen ) == -1 ) {
            return -1;
        }
    }
    memmove( pReq->m_pRespHeaderBufPos, pBuf, len );
    pReq->m_pRespHeaderBufPos += len;
    *pReq->m_pRespHeaderBufPos++ = 0;
    ++len;  /* add one byte padding for \0 */
    pReq->m_respHeaderLen[pReq->m_respHeader.m_respInfo.m_cntHeaders] = len;
    ++pReq->m_respHeader.m_respInfo.m_cntHeaders;
    return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int LSAPI_CreateListenSock ( const char *  pBind,
int  backlog 
)

Definition at line 1540 of file lsapilib.c.

{
    char serverAddr[128];
    int ret;
    int fd = -1;
    ret = LSAPI_ParseSockAddr( pBind, (struct sockaddr *)serverAddr );
    if ( !ret ) {
        fd = LSAPI_CreateListenSock2( (struct sockaddr *)serverAddr, backlog );
    }
    return fd;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int LSAPI_FinalizeRespHeaders ( void  ) [inline, static]

Definition at line 302 of file lsapilib.h.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1338 of file lsapilib.c.

{
    if ( !pReq || !pReq->m_pIovec ) {
        return -1;
    }
    if ( !( pReq->m_reqState & LSAPI_ST_RESP_HEADER ) ) {
        return 0;
    }
    pReq->m_reqState &= ~LSAPI_ST_RESP_HEADER;
    if ( pReq->m_pRespHeaderBufPos > pReq->m_pRespHeaderBuf ) {
        pReq->m_pIovecCur->iov_base = (void *)pReq->m_pRespHeaderBuf;
        pReq->m_pIovecCur->iov_len  = pReq->m_pRespHeaderBufPos - pReq->m_pRespHeaderBuf;
        pReq->m_totalLen += pReq->m_pIovecCur->iov_len;
        ++pReq->m_pIovecCur;
    }
    
    pReq->m_pIovec->iov_len  = sizeof( struct lsapi_resp_header)
            + pReq->m_respHeader.m_respInfo.m_cntHeaders * sizeof( short );
    pReq->m_totalLen += pReq->m_pIovec->iov_len;

    lsapi_buildPacketHeader( &pReq->m_respHeader.m_pktHeader,
                    LSAPI_RESP_HEADER, pReq->m_totalLen  );
    pReq->m_pIovec->iov_base = (void *)&pReq->m_respHeader;
    pReq->m_pIovecToWrite = pReq->m_pIovec;
    return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int LSAPI_Finish ( void  ) [inline, static]

Definition at line 251 of file lsapilib.h.

{   return LSAPI_Finish_r( &g_req );                        }

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 708 of file lsapilib.c.

{
    /* finish req body */
    if ( !pReq ) {
        return -1;
    }
    if (pReq->m_reqState) {
        if ( pReq->m_fd != -1 ) {
            if ( pReq->m_reqState & LSAPI_ST_RESP_HEADER ) {
                LSAPI_FinalizeRespHeaders_r( pReq );
            }
            if ( pReq->m_pRespBufPos != pReq->m_pRespBuf ) {
                Flush_RespBuf_r( pReq );
            }
            
            pReq->m_pIovecCur->iov_base = (void *)&finish;
            pReq->m_pIovecCur->iov_len  = LSAPI_PACKET_HEADER_LEN;
            pReq->m_totalLen += LSAPI_PACKET_HEADER_LEN;
            ++pReq->m_pIovecCur;
            LSAPI_Flush_r( pReq );
        }
        LSAPI_Reset_r( pReq );
    }
    return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int LSAPI_Flush ( ) [inline, static]

Definition at line 311 of file lsapilib.h.

{   return LSAPI_Flush_r( &g_req );                         }

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1015 of file lsapilib.c.

{
    int ret = 0;
    int n;
    if ( !pReq ) {
        return -1;
    }
    n = pReq->m_pIovecCur - pReq->m_pIovecToWrite;
    if (( 0 == n )&&( pReq->m_pRespBufPos == pReq->m_pRespBuf )) {
        return 0;
    }
    if ( pReq->m_fd == -1 ) {
        pReq->m_pRespBufPos = pReq->m_pRespBuf;
        pReq->m_totalLen = 0;
        pReq->m_pIovecCur = pReq->m_pIovecToWrite = pReq->m_pIovec;
        return -1;
    }
    if ( pReq->m_reqState & LSAPI_ST_RESP_HEADER ) {
        LSAPI_FinalizeRespHeaders_r( pReq );
    }
    if ( pReq->m_pRespBufPos != pReq->m_pRespBuf ) {
        Flush_RespBuf_r( pReq );
    }
    
    n = pReq->m_pIovecCur - pReq->m_pIovecToWrite;
    if ( n > 0 ) {
        
        ret = lsapi_writev( pReq->m_fd, &pReq->m_pIovecToWrite,
                  n, pReq->m_totalLen );
        if ( ret < pReq->m_totalLen ) {
            lsapi_close( pReq->m_fd );
            pReq->m_fd = -1;
            ret = -1;
        }
        pReq->m_totalLen = 0;
        pReq->m_pIovecCur = pReq->m_pIovecToWrite = pReq->m_pIovec;
    }
    return ret;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int LSAPI_ForeachEnv ( LSAPI_CB_EnvHandler  fn,
void *  arg 
) [inline, static]

Definition at line 264 of file lsapilib.h.

{   return LSAPI_ForeachEnv_r( &g_req, fn, arg );           }

Here is the call graph for this function:

Here is the caller graph for this function:

int LSAPI_ForeachEnv_r ( LSAPI_Request pReq,
LSAPI_CB_EnvHandler  fn,
void *  arg 
)

Definition at line 1306 of file lsapilib.c.

{
    if ( !pReq || !fn ) {
        return -1;
    }
    if ( pReq->m_pHeader->m_cntEnv > 0 ) {
        return EnvForeach( pReq->m_pEnvList, pReq->m_pHeader->m_cntEnv,
                    fn, arg );
    }
    return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int LSAPI_ForeachHeader ( LSAPI_CB_EnvHandler  fn,
void *  arg 
) [inline, static]

Definition at line 257 of file lsapilib.h.

{   return LSAPI_ForeachHeader_r( &g_req, fn, arg );        }

Here is the call graph for this function:

Here is the caller graph for this function:

int LSAPI_ForeachHeader_r ( LSAPI_Request pReq,
LSAPI_CB_EnvHandler  fn,
void *  arg 
)

Definition at line 1216 of file lsapilib.c.

{
    int i;
    int len = 0;
    char * pValue;
    int ret;
    int count = 0;
    if ( !pReq || !fn ) {
        return -1;
    }
    for( i = 0; i < H_TRANSFER_ENCODING; ++i ) {
        if ( pReq->m_pHeaderIndex->m_headerOff[i] ) {
            len = pReq->m_pHeaderIndex->m_headerLen[i];
            pValue = pReq->m_pHttpHeader + pReq->m_pHeaderIndex->m_headerOff[i];
            *(pValue + len ) = 0;
            ret = (*fn)( CGI_HEADERS[i], CGI_HEADER_LEN[i],
                        pValue, len, arg );
            ++count;
            if ( ret <= 0 ) {
                return ret;
            }
        }
    }
    if ( pReq->m_pHeader->m_cntUnknownHeaders > 0 ) {
        char achHeaderName[256];
        char *p;
        char *pKey;
        char *pKeyEnd ;
        int  keyLen;
        struct lsapi_header_offset * pCur, *pEnd;
        pCur = pReq->m_pUnknownHeader;
        pEnd = pCur + pReq->m_pHeader->m_cntUnknownHeaders;
        while( pCur < pEnd ) {
            pKey = pReq->m_pHttpHeader + pCur->nameOff;
            keyLen = pCur->nameLen;
            if ( keyLen > 250 ) {
                keyLen = 250;
            }

            pKeyEnd = pKey + keyLen;
            memcpy( achHeaderName, "HTTP_", 5 );
            p = &achHeaderName[5];

            while( pKey < pKeyEnd ) {
                char ch = *pKey++;
                if ( ch == '-' ) {
                    *p++ = '_';
                } else {
                    *p++ = toupper( ch );
                }
            }
            *p = 0;
            keyLen += 5;

            pValue = pReq->m_pHttpHeader + pCur->valueOff;
            *(pValue + pCur->valueLen ) = 0;
            ret = (*fn)( achHeaderName, keyLen, 
                        pValue, pCur->valueLen, arg );
            if ( ret <= 0 ) {
                return ret;
            }
            ++pCur;
        }
    }
    return count + pReq->m_pHeader->m_cntUnknownHeaders;
    
}

Here is the caller graph for this function:

static int LSAPI_ForeachOrgHeader ( LSAPI_CB_EnvHandler  fn,
void *  arg 
) [inline, static]

Definition at line 260 of file lsapilib.h.

{   return LSAPI_ForeachOrgHeader_r( &g_req, fn, arg );     }

Here is the call graph for this function:

Here is the caller graph for this function:

int LSAPI_ForeachOrgHeader_r ( LSAPI_Request pReq,
LSAPI_CB_EnvHandler  fn,
void *  arg 
)

Definition at line 1167 of file lsapilib.c.

{
    int i;
    int len = 0;
    char * pValue;
    int ret;
    int count = 0;
    if ( !pReq || !fn ) {
        return -1;
    }
    for( i = 0; i < H_TRANSFER_ENCODING; ++i ) {
        if ( pReq->m_pHeaderIndex->m_headerOff[i] ) {
            len = pReq->m_pHeaderIndex->m_headerLen[i];
            pValue = pReq->m_pHttpHeader + pReq->m_pHeaderIndex->m_headerOff[i];
            *(pValue + len ) = 0;
            ret = (*fn)( HTTP_HEADERS[i], HTTP_HEADER_LEN[i],
                        pValue, len, arg );
            ++count;
            if ( ret <= 0 ) {
                return ret;
            }
        }
    }
    if ( pReq->m_pHeader->m_cntUnknownHeaders > 0 ) {
        char *pKey;
        int  keyLen;
        struct lsapi_header_offset * pCur, *pEnd;
        pCur = pReq->m_pUnknownHeader;
        pEnd = pCur + pReq->m_pHeader->m_cntUnknownHeaders;
        while( pCur < pEnd ) {
            pKey = pReq->m_pHttpHeader + pCur->nameOff;
            keyLen = pCur->nameLen;

            pValue = pReq->m_pHttpHeader + pCur->valueOff;
            *(pValue + pCur->valueLen ) = 0;
            ret = (*fn)( pKey, keyLen, 
                        pValue, pCur->valueLen, arg );
            if ( ret <= 0 ) {
                return ret;
            }
            ++pCur;
        }
    }
    return count + pReq->m_pHeader->m_cntUnknownHeaders;
    
}

Here is the caller graph for this function:

static int LSAPI_ForeachSpecialEnv ( LSAPI_CB_EnvHandler  fn,
void *  arg 
) [inline, static]

Definition at line 267 of file lsapilib.h.

{   return LSAPI_ForeachSpecialEnv_r( &g_req, fn, arg );    }

Here is the call graph for this function:

Here is the caller graph for this function:

int LSAPI_ForeachSpecialEnv_r ( LSAPI_Request pReq,
LSAPI_CB_EnvHandler  fn,
void *  arg 
)

Definition at line 1321 of file lsapilib.c.

{
    if ( !pReq || !fn ) {
        return -1;
    }
    if ( pReq->m_pHeader->m_cntSpecialEnv > 0 ) {
        return EnvForeach( pReq->m_pSpecialEnvList,
                pReq->m_pHeader->m_cntSpecialEnv,
                    fn, arg );
    }
    return 0;

}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 2095 of file lsapilib.c.

{
       return s_slow_req_msecs;
}

Here is the caller graph for this function:

static char* LSAPI_GetEnv ( const char *  name) [inline, static]

Definition at line 270 of file lsapilib.h.

{   return LSAPI_GetEnv_r( &g_req, name );                  }

Here is the call graph for this function:

Here is the caller graph for this function:

char* LSAPI_GetEnv_r ( LSAPI_Request pReq,
const char *  name 
)

Definition at line 1148 of file lsapilib.c.

{
    struct LSAPI_key_value_pair * pBegin = pReq->m_pEnvList;
    struct LSAPI_key_value_pair * pEnd = pBegin + pReq->m_pHeader->m_cntEnv;
    if ( !pReq || !name ) {
        return NULL;
    }
    if ( strncmp( name, "HTTP_", 5 ) == 0 ) {
        return GetHeaderVar( pReq, name );
    }
    while( pBegin < pEnd ) {
        if ( strcmp( name, pBegin->pKey ) == 0 ) {
            return pBegin->pValue;
        }
        ++pBegin;
    }
    return NULL;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static char* LSAPI_GetHeader ( int  headerIndex) [inline, static]

Definition at line 254 of file lsapilib.h.

{   return LSAPI_GetHeader_r( &g_req, headerIndex );        }

Here is the call graph for this function:

Here is the caller graph for this function:

char* LSAPI_GetHeader_r ( LSAPI_Request pReq,
int  headerIndex 
)

Definition at line 764 of file lsapilib.c.

{
    int off;
    if ( !pReq || ((unsigned int)headerIndex > H_TRANSFER_ENCODING) ) {
        return NULL;
    }
    off = pReq->m_pHeaderIndex->m_headerOff[ headerIndex ];
    if ( !off ) {
        return NULL;
    }
    if ( *(pReq->m_pHttpHeader + off + 
           pReq->m_pHeaderIndex->m_headerLen[ headerIndex ]) ) {
        *( pReq->m_pHttpHeader + off + 
            pReq->m_pHeaderIndex->m_headerLen[ headerIndex ]) = 0;
    }
    return pReq->m_pHttpHeader + off;
}

Here is the caller graph for this function:

static char* LSAPI_GetQueryString ( ) [inline, static]

Definition at line 273 of file lsapilib.h.

{   return LSAPI_GetQueryString_r( &g_req );                }

Here is the call graph for this function:

Here is the caller graph for this function:

static char* LSAPI_GetQueryString_r ( LSAPI_Request pReq) [inline, static]

Definition at line 198 of file lsapilib.h.

{
    if ( pReq )
        return pReq->m_pQueryString;
    return NULL;
}

Here is the caller graph for this function:

static int LSAPI_GetReqBodyLen ( ) [inline, static]

Definition at line 285 of file lsapilib.h.

{   return LSAPI_GetReqBodyLen_r( &g_req );                 }

Here is the call graph for this function:

Here is the caller graph for this function:

static int LSAPI_GetReqBodyLen_r ( LSAPI_Request pReq) [inline, static]

Definition at line 231 of file lsapilib.h.

{
    if ( pReq )
        return pReq->m_pHeader->m_reqBodyLen;
    return -1;
}

Here is the caller graph for this function:

static int LSAPI_GetReqBodyRemain ( ) [inline, static]

Definition at line 288 of file lsapilib.h.

Here is the call graph for this function:

static int LSAPI_GetReqBodyRemain_r ( LSAPI_Request pReq) [inline, static]

Definition at line 238 of file lsapilib.h.

{
    if ( pReq )
        return pReq->m_pHeader->m_reqBodyLen - pReq->m_reqBodyRead;
    return -1;
}

Here is the caller graph for this function:

static char* LSAPI_GetRequestMethod ( ) [inline, static]

Definition at line 282 of file lsapilib.h.

Here is the call graph for this function:

Here is the caller graph for this function:

static char* LSAPI_GetRequestMethod_r ( LSAPI_Request pReq) [inline, static]

Definition at line 222 of file lsapilib.h.

{
    if ( pReq )
        return pReq->m_pRequestMethod;
    return NULL;
}

Here is the caller graph for this function:

static char* LSAPI_GetScriptFileName ( ) [inline, static]

Definition at line 276 of file lsapilib.h.

Here is the call graph for this function:

Here is the caller graph for this function:

static char* LSAPI_GetScriptFileName_r ( LSAPI_Request pReq) [inline, static]

Definition at line 206 of file lsapilib.h.

{
    if ( pReq )
        return pReq->m_pScriptFile;
    return NULL;
}

Here is the caller graph for this function:

static char* LSAPI_GetScriptName ( ) [inline, static]

Definition at line 279 of file lsapilib.h.

{    return LSAPI_GetScriptName_r( &g_req );                }

Here is the call graph for this function:

Here is the caller graph for this function:

static char* LSAPI_GetScriptName_r ( LSAPI_Request pReq) [inline, static]

Definition at line 214 of file lsapilib.h.

{
    if ( pReq )
        return pReq->m_pScriptName;
    return NULL;
}

Here is the caller graph for this function:

int LSAPI_Init ( void  )

Definition at line 581 of file lsapilib.c.

{
    if ( !g_inited ) {
        lsapi_signal(SIGPIPE, lsapi_sigpipe);
        lsapi_signal(SIGUSR1, lsapi_siguser1);

#if defined(SIGXFSZ) && defined(SIG_IGN)
        signal(SIGXFSZ, SIG_IGN);
#endif
        /* let STDOUT function as STDERR, 
           just in case writing to STDOUT directly */
        dup2( 2, 1 );

        if ( LSAPI_InitRequest( &g_req, LSAPI_SOCK_FILENO ) == -1 ) {
            return -1;
        }
        g_inited = 1;
        s_ppid = getppid();
    }
    return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 2131 of file lsapilib.c.

{
    const char *p;
    int n;
    int avoidFork = 0;
    p = getenv( "PHP_LSAPI_MAX_REQUESTS" );
    if ( !p ) {
        p = getenv( "LSAPI_MAX_REQS" );
    }
    if ( p ) {
        n = atoi( p );
        if ( n > 0 ) {
            LSAPI_Set_Max_Reqs( n );
        }
    }

    p = getenv( "LSAPI_AVOID_FORK" );
    if ( p ) {
        avoidFork = atoi( p );
    }    

    p = getenv( "LSAPI_ACCEPT_NOTIFY" );
    if ( p ) {
        s_accept_notify = atoi( p );
    }    

    p = getenv( "LSAPI_SLOW_REQ_MSECS" );
    if ( p ) {
        n = atoi( p );
        LSAPI_Set_Slow_Req_Msecs( n );
    }    


#if defined( RLIMIT_CORE )
    p = getenv( "LSAPI_ALLOW_CORE_DUMP" );
    if ( !p ) {
        struct rlimit limit = { 0, 0 };
        setrlimit( RLIMIT_CORE, &limit );
    }
#endif    

    p = getenv( "LSAPI_MAX_IDLE" );
    if ( p ) {
        n = atoi( p );
        LSAPI_Set_Max_Idle( n );
    }

    if ( LSAPI_Is_Listen() ) {
        n = 0;
        p = getenv( "PHP_LSAPI_CHILDREN" );
        if ( !p ) {
            p = getenv( "LSAPI_CHILDREN" );
        }
        if ( p ) {
            n = atoi( p );
        }
        if ( n > 1 ) {
            LSAPI_Init_Prefork_Server( n, fp, avoidFork );
            LSAPI_Set_Server_fd( g_req.m_fdListen );
        }

        p = getenv( "LSAPI_EXTRA_CHILDREN" );
        if ( p ) {
            LSAPI_Set_Extra_Children( atoi( p ) );
        }
        
        p = getenv( "LSAPI_MAX_IDLE_CHILDREN" );
        if ( p ) {
            LSAPI_Set_Max_Idle_Children( atoi( p ) );
        }
        p = getenv( "LSAPI_PGRP_MAX_IDLE" );
        if ( p ) {
            LSAPI_Set_Server_Max_Idle_Secs( atoi( p ) );
        }
        
        p = getenv( "LSAPI_MAX_PROCESS_TIME" );
        if ( p ) {     
            LSAPI_Set_Max_Process_Time( atoi( p ) );
        }
        if ( getenv( "LSAPI_PPID_NO_CHECK" ) ) {
            LSAPI_No_Check_ppid();
        }
    }
    unset_lsapi_envs();
}

Here is the call graph for this function:

Here is the caller graph for this function:

int LSAPI_Init_Prefork_Server ( int  max_children,
fn_select_t  fp,
int  avoidFork 
)

Definition at line 1587 of file lsapilib.c.

{
    if ( g_prefork_server ) {
        return 0;
    }
    if ( max_children <= 1 ) {
        return -1;
    }
    if ( max_children >= 10000) {
        max_children = 10000;
    }

    
    g_prefork_server = (lsapi_prefork_server *)malloc( sizeof( lsapi_prefork_server ) );
    if ( !g_prefork_server ) {
        return -1;
    }
    memset( g_prefork_server, 0, sizeof( lsapi_prefork_server ) );

    if ( fp != NULL ) {
        g_fnSelect = fp;
    }

    s_ppid = getppid();
    g_prefork_server->m_iAvoidFork = avoidFork;
    g_prefork_server->m_iMaxChildren = max_children;
    
    g_prefork_server->m_iExtraChildren = ( avoidFork ) ? 0 : (max_children / 3) ;
    g_prefork_server->m_iMaxIdleChildren = ( avoidFork ) ? (max_children + 1) : (max_children / 3);
    g_prefork_server->m_iChildrenMaxIdleTime = 300;
    g_prefork_server->m_iMaxReqProcessTime = 300;
    return 0;    
}

Here is the caller graph for this function:

int LSAPI_InitRequest ( LSAPI_Request pReq,
int  fd 
)

Definition at line 613 of file lsapilib.c.

{
    if ( !pReq ) {
        return -1;
    }
    memset( pReq, 0, sizeof( LSAPI_Request ) );
    if ( allocateIovec( pReq, 16 ) == -1 ) {
        return -1;
    }
    pReq->m_pRespBuf = pReq->m_pRespBufPos = (char *)malloc( LSAPI_RESP_BUF_SIZE );
    if ( !pReq->m_pRespBuf ) {
        return -1;
    }
    pReq->m_pRespBufEnd = pReq->m_pRespBuf + LSAPI_RESP_BUF_SIZE;
    pReq->m_pIovecCur = pReq->m_pIovecToWrite = pReq->m_pIovec + 1;
    pReq->m_respPktHeaderEnd = &pReq->m_respPktHeader[5];
    if ( allocateRespHeaderBuf( pReq, LSAPI_INIT_RESP_HEADER_LEN ) == -1 ) {
        return -1;
    }
 
    if ( isPipe( fd ) ) {
        pReq->m_fdListen = -1;
        pReq->m_fd = fd;
    } else {
        pReq->m_fdListen = fd;
        pReq->m_fd = -1;
        lsapi_set_nblock( fd, 1 );
    }
    return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int LSAPI_Is_Listen ( void  )

Definition at line 644 of file lsapilib.c.

{
    return LSAPI_Is_Listen_r( &g_req );
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 649 of file lsapilib.c.

{
    return pReq->m_fdListen != -1;
}

Here is the caller graph for this function:

int LSAPI_IsRunning ( void  )

Definition at line 608 of file lsapilib.c.

{
    return g_running;
}

Definition at line 1938 of file lsapilib.c.

{
    int             fd;
    int             ret;
    int             wait_secs;
    fd_set          readfds;
    struct timeval  timeout;

    LSAPI_Finish_r( pReq );


    if ( g_prefork_server ) {
        if ( g_prefork_server->m_fd != -1 ) {
            if ( lsapi_prefork_server_accept( g_prefork_server, pReq ) == -1 ) {
                return -1;
            }
        }
    }
    if ( s_req_processed >= s_max_reqs ) {
        return -1;
    }

    if ( s_pChildStatus ) {
        s_pChildStatus->m_tmWaitBegin = time( NULL );
    }
    
    while( g_running ) {
        if ( pReq->m_fd != -1 ) {
            fd = pReq->m_fd;
        } else {
            if ( pReq->m_fdListen != -1 ) {
                fd = pReq->m_fdListen;
            } else {
                return -1;
            }
        }
        wait_secs = 0;
        while( 1 ) {
            if ( !g_running ) {
                return -1;
            }
            if (( s_pChildStatus )&&( s_pChildStatus->m_iKillSent )) {
                return -1; 
            }
            FD_ZERO( &readfds );
            FD_SET( fd, &readfds );
            timeout.tv_sec = 1;
            timeout.tv_usec = 0;
            ret = (*g_fnSelect)(fd+1, &readfds, NULL, NULL, &timeout);
            if ( ret == 0 ) {
                if ( s_pChildStatus ) {
                    s_pChildStatus->m_inProcess = 0;
                }
                ++wait_secs;
                if (( s_max_idle_secs > 0 )&&(wait_secs >= s_max_idle_secs )) {
                    return -1;
                }
                if ( s_ppid &&( getppid() != s_ppid)) {
                    return -1;
                }
            } else {
                if ( ret == -1 ) {
                    if ( errno == EINTR ) {
                        continue;
                    } else {
                        return -1;
                    }
                } else {
                    if ( ret >= 1 ) {
                        if (( s_pChildStatus )&&( s_pChildStatus->m_iKillSent )) {
                            return -1; 
                        }
                        if ( fd == pReq->m_fdListen ) {
                            pReq->m_fd = lsapi_accept( pReq->m_fdListen );
                            if ( pReq->m_fd != -1 ) {
                                fd = pReq->m_fd;
                                lsapi_set_nblock( fd, 0 );
                            } else {
                                if (( errno == EINTR )||( errno == EAGAIN)) {
                                    continue;
                                                        }
                                return -1;
                            }
                        } else {
                            break;
                        }
                    }
                }
            }
        }
        if ( !readReq( pReq ) ) {
            if ( s_pChildStatus ) {
                s_pChildStatus->m_inProcess = 1;
                s_pChildStatus->m_tmReqBegin = s_pChildStatus->m_tmLastCheckPoint = time(NULL);
            }
            ++s_req_processed;
            return 0;
        }
        lsapi_close( pReq->m_fd );
        pReq->m_fd = -1;
        LSAPI_Reset_r( pReq );
    }
    return -1;
    
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int LSAPI_ReadReqBody ( char *  pBuf,
int  len 
) [inline, static]

Definition at line 291 of file lsapilib.h.

{   return LSAPI_ReadReqBody_r( &g_req, pBuf, len );        }

Here is the call graph for this function:

Here is the caller graph for this function:

int LSAPI_ReadReqBody_r ( LSAPI_Request pReq,
char *  pBuf,
int  len 
)

Definition at line 869 of file lsapilib.c.

{
    int len;
    int total;
    /* char *pOldBuf = pBuf; */
    if (!pReq || (pReq->m_fd ==-1) || ( !pBuf )||(bufLen < 0 )) {
        return -1;
    }
    total = pReq->m_pHeader->m_reqBodyLen - pReq->m_reqBodyRead;
    
    if ( total <= 0 ) {
        return 0;
    }
    if ( total < bufLen ) {
        bufLen = total;
    }

    total = 0;
    len = pReq->m_bufRead - pReq->m_bufProcessed;
    if ( len > 0 ) {
        if ( len > bufLen ) {
            len = bufLen;
        }
        memmove( pBuf, pReq->m_pReqBuf + pReq->m_bufProcessed, len );
        pReq->m_bufProcessed += len;
        total += len;
        pBuf += len;
        bufLen -= len;
    }
    while( bufLen > 0 ) {
        len = lsapi_read( pReq->m_fd, pBuf, bufLen );
        if ( len > 0 ) {
            total += len;
            pBuf += len;
            bufLen -= len;
        } else {
            if ( len <= 0 ) {
                if ( !total) {
                    return -1;
                }
                break;
            }
        }
    }
    pReq->m_reqBodyRead += total;
    return total;
        
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 746 of file lsapilib.c.

{
    if ( pReq->m_pReqBuf ) {
        free( pReq->m_pReqBuf );
    }
    if ( pReq->m_pSpecialEnvList ) {
        free( pReq->m_pSpecialEnvList );
    }
    if ( pReq->m_pEnvList ) {
        free( pReq->m_pEnvList );
    }
    if ( pReq->m_pRespHeaderBuf ) {
        free( pReq->m_pRespHeaderBuf );  
    }
    return 0;
}
static int LSAPI_ReqBodyGetChar ( ) [inline, static]

Definition at line 294 of file lsapilib.h.

{   return LSAPI_ReqBodyGetChar_r( &g_req );        }

Here is the call graph for this function:

Definition at line 807 of file lsapilib.c.

{
    if (!pReq || (pReq->m_fd ==-1) ) {
        return EOF;
    }
    if ( pReq->m_bufProcessed >= pReq->m_bufRead ) {
        if ( readBodyToReqBuf( pReq ) <= 0 ) {
            return EOF;
        }
    }
    ++pReq->m_reqBodyRead;
    return (unsigned char)*(pReq->m_pReqBuf + pReq->m_bufProcessed++);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int LSAPI_ReqBodyGetLine ( char *  pBuf,
int  len,
int getLF 
) [inline, static]

Definition at line 297 of file lsapilib.h.

{   return LSAPI_ReqBodyGetLine_r( &g_req, pBuf, len, getLF );        }

Here is the call graph for this function:

int LSAPI_ReqBodyGetLine_r ( LSAPI_Request pReq,
char *  pBuf,
int  bufLen,
int getLF 
)

Definition at line 823 of file lsapilib.c.

{
    int len;
    int left;
    char * pBufEnd = pBuf + bufLen - 1;
    char * pBufCur = pBuf;
    char * pCur;
    char * p;
    if (!pReq || (pReq->m_fd ==-1) ||( !pBuf )||(bufLen < 0 )|| !getLF ) {
        return -1;
    }
    *getLF = 0;
    while( (left = pBufEnd - pBufCur ) > 0 ) {
        
        len = pReq->m_bufRead - pReq->m_bufProcessed;
        if ( len <= 0 ) {
            if ( (len = readBodyToReqBuf( pReq )) <= 0 ) {
                *getLF = 1;
                break;
            }
        }
        if ( len > left ) {
            len = left;
        }
        pCur = pReq->m_pReqBuf + pReq->m_bufProcessed;
        p = memchr( pCur, '\n', len );
        if ( p ) {
            len = p - pCur + 1;
        }
        memmove( pBufCur, pCur, len );
        pBufCur += len;
        pReq->m_bufProcessed += len;

        pReq->m_reqBodyRead += len;
        
        if ( p ) {
            *getLF = 1;
            break;
        }
    }
    *pBufCur = 0;
  
    return pBufCur - pBuf;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void LSAPI_Reset_r ( LSAPI_Request pReq)

Definition at line 735 of file lsapilib.c.

{
    pReq->m_pRespBufPos         = pReq->m_pRespBuf;
    pReq->m_pIovecCur           = pReq->m_pIovecToWrite = pReq->m_pIovec + 1;
    pReq->m_pRespHeaderBufPos   = pReq->m_pRespHeaderBuf;
    
    memset( &pReq->m_pHeaderIndex, 0,
            (char *)(pReq->m_respHeaderLen) - (char *)&pReq->m_pHeaderIndex );
}

Here is the caller graph for this function:

void LSAPI_Set_Max_Children ( int  maxChildren)

Definition at line 2054 of file lsapilib.c.

{
    if ( g_prefork_server ) {
        g_prefork_server->m_iMaxChildren = maxChildren;
    }
}
void LSAPI_Set_Max_Idle ( int  secs)

Definition at line 2049 of file lsapilib.c.

{   
    s_max_idle_secs = secs;     
}

Here is the caller graph for this function:

void LSAPI_Set_Max_Idle_Children ( int  maxIdleChld)

Definition at line 2076 of file lsapilib.c.

{
    if (( g_prefork_server )&&( maxIdleChld > 0 )) {
        g_prefork_server->m_iMaxIdleChildren = maxIdleChld;
    }
}

Here is the caller graph for this function:

Definition at line 2068 of file lsapilib.c.

{
    if (( g_prefork_server )&&( secs > 0 )) {
        g_prefork_server->m_iMaxReqProcessTime = secs;
    }
}

Here is the caller graph for this function:

void LSAPI_Set_Max_Reqs ( int  reqs)

Definition at line 2044 of file lsapilib.c.

{   
    s_max_reqs = reqs;          
}

Here is the caller graph for this function:

void LSAPI_Set_Server_fd ( int  fd)

Definition at line 1621 of file lsapilib.c.

{
    if( g_prefork_server ) {
        g_prefork_server->m_fd = fd;
    }
}

Here is the caller graph for this function:

void LSAPI_Set_Server_Max_Idle_Secs ( int  serverMaxIdle)

Definition at line 2083 of file lsapilib.c.

{
    if ( g_prefork_server ) {
        g_prefork_server->m_iServerMaxIdle = serverMaxIdle;
    }
}

Here is the caller graph for this function:

void LSAPI_Set_Slow_Req_Msecs ( int  msecs)

Definition at line 2090 of file lsapilib.c.

{
       s_slow_req_msecs = msecs;
}

Here is the caller graph for this function:

static int LSAPI_SetRespStatus ( int  code) [inline, static]

Definition at line 317 of file lsapilib.h.

{   return LSAPI_SetRespStatus_r( &g_req, code );           }

Here is the call graph for this function:

Here is the caller graph for this function:

static int LSAPI_SetRespStatus_r ( LSAPI_Request pReq,
int  code 
) [inline, static]

Definition at line 190 of file lsapilib.h.

{
    if ( !pReq )
        return -1;
    pReq->m_respHeader.m_respInfo.m_status = code;
    return 0;
}

Here is the caller graph for this function:

void LSAPI_Stop ( void  )

Definition at line 603 of file lsapilib.c.

{
    g_running = 0;
}
static int LSAPI_Write ( const char *  pBuf,
int  len 
) [inline, static]

Definition at line 305 of file lsapilib.h.

{   return LSAPI_Write_r( &g_req, pBuf, len );              }

Here is the call graph for this function:

Here is the caller graph for this function:

int LSAPI_Write_r ( LSAPI_Request pReq,
const char *  pBuf,
int  len 
)

Definition at line 919 of file lsapilib.c.

{
    struct lsapi_packet_header * pHeader;
    const char * pEnd;
    const char * p;
    int bufLen;
    int toWrite;
    int packetLen;
    
    if ( !pReq || !pBuf || (pReq->m_fd == -1) ) {
        return -1;
    }
    if ( len < pReq->m_pRespBufEnd - pReq->m_pRespBufPos ) {
        memmove( pReq->m_pRespBufPos, pBuf, len );
        pReq->m_pRespBufPos += len;
        return len;
    }
    
    if ( pReq->m_reqState & LSAPI_ST_RESP_HEADER ) {
        LSAPI_FinalizeRespHeaders_r( pReq );
    }
    pReq->m_reqState |= LSAPI_ST_RESP_BODY;
    
    pHeader = pReq->m_respPktHeader;
    p       = pBuf;
    pEnd    = pBuf + len;
    bufLen  = pReq->m_pRespBufPos - pReq->m_pRespBuf;
    
    while( ( toWrite = pEnd - p ) > 0 ) {
        packetLen = toWrite + bufLen;
        if ( LSAPI_MAX_DATA_PACKET_LEN < packetLen) {
            packetLen = LSAPI_MAX_DATA_PACKET_LEN;
            toWrite = packetLen - bufLen;
        }
        
        lsapi_buildPacketHeader( pHeader, LSAPI_RESP_STREAM,
                            packetLen + LSAPI_PACKET_HEADER_LEN );
        pReq->m_totalLen += packetLen + LSAPI_PACKET_HEADER_LEN;

        pReq->m_pIovecCur->iov_base = (void *)pHeader;
        pReq->m_pIovecCur->iov_len  = LSAPI_PACKET_HEADER_LEN;
        ++pReq->m_pIovecCur;
        ++pHeader;
        if ( bufLen > 0 ) {
            pReq->m_pIovecCur->iov_base = (void *)pReq->m_pRespBuf;
            pReq->m_pIovecCur->iov_len  = bufLen;
            pReq->m_pRespBufPos = pReq->m_pRespBuf;
            ++pReq->m_pIovecCur;       
            bufLen = 0;
        }

        pReq->m_pIovecCur->iov_base = (void *)p;
        pReq->m_pIovecCur->iov_len  = toWrite;
        ++pReq->m_pIovecCur;
        p += toWrite;

        if ( pHeader >= pReq->m_respPktHeaderEnd - 1) {
            if ( LSAPI_Flush_r( pReq ) == -1 ) {
                return -1;
            }
            pHeader = pReq->m_respPktHeader;
        }
    }
    if ( pHeader != pReq->m_respPktHeader ) {
        if ( LSAPI_Flush_r( pReq ) == -1 ) {
            return -1;
        }
    }
    return p - pBuf;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int LSAPI_Write_Stderr ( const char *  pBuf,
int  len 
) [inline, static]

Definition at line 308 of file lsapilib.h.

{   return LSAPI_Write_Stderr_r( &g_req, pBuf, len );       }

Here is the call graph for this function:

Here is the caller graph for this function:

int LSAPI_Write_Stderr_r ( LSAPI_Request pReq,
const char *  pBuf,
int  len 
)

Definition at line 1056 of file lsapilib.c.

{
    struct lsapi_packet_header header;
    const char * pEnd;
    const char * p;
    int packetLen;
    int totalLen;
    int ret;
    struct iovec iov[2];
    struct iovec *pIov;
    
    if ( !pReq ) {
        return -1;
    }
    if (( pReq->m_fd == -1 )||(pReq->m_fd == pReq->m_fdListen )) {
        return write( 2, pBuf, len );
    }
    if ( pReq->m_pRespBufPos != pReq->m_pRespBuf ) {
        LSAPI_Flush_r( pReq );
    }
    
    p       = pBuf;
    pEnd    = pBuf + len;

    while( ( packetLen = pEnd - p ) > 0 ) {
        if ( LSAPI_MAX_DATA_PACKET_LEN < packetLen) {
            packetLen = LSAPI_MAX_DATA_PACKET_LEN;
        }

        lsapi_buildPacketHeader( &header, LSAPI_STDERR_STREAM,
                            packetLen + LSAPI_PACKET_HEADER_LEN );
        totalLen = packetLen + LSAPI_PACKET_HEADER_LEN;

        iov[0].iov_base = (void *)&header;
        iov[0].iov_len  = LSAPI_PACKET_HEADER_LEN;

        iov[1].iov_base = (void *)p;
        iov[1].iov_len  = packetLen;
        p += packetLen;
        pIov = iov;
        ret = lsapi_writev( pReq->m_fd, &pIov,
                  2, totalLen );
        if ( ret < totalLen ) {
            lsapi_close( pReq->m_fd );
            pReq->m_fd = -1;
            ret = -1;
        }
    }
    return p - pBuf;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

Definition at line 90 of file lsapilib.c.