MCPcopy Create free account
hub / github.com/Tencent/libco / getenv

Function getenv

co_hook_sys_call.cpp:836–861  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

834 return g_sys_unsetenv_func( n );
835}
836char *getenv( const char *n )
837{
838 HOOK_SYS_FUNC( getenv )
839 if( co_is_enable_sys_hook() && g_co_sysenv.data )
840 {
841 stCoRoutine_t *self = co_self();
842
843 stCoSysEnv_t name = { (char*)n,0 };
844
845 if( !self->pvEnv )
846 {
847 self->pvEnv = dup_co_sysenv_arr( &g_co_sysenv );
848 }
849 stCoSysEnvArr_t *arr = (stCoSysEnvArr_t*)(self->pvEnv);
850
851 stCoSysEnv_t *e = (stCoSysEnv_t*)bsearch( &name,arr->data,arr->cnt,sizeof(name),co_sysenv_comp );
852
853 if( e )
854 {
855 return e->value;
856 }
857
858 }
859 return g_sys_getenv_func( n );
860
861}
862struct hostent* co_gethostbyname(const char *name);
863
864struct hostent *gethostbyname(const char *name)

Callers 1

SetAndGetEnvFunction · 0.85

Calls 3

co_is_enable_sys_hookFunction · 0.85
co_selfFunction · 0.85
dup_co_sysenv_arrFunction · 0.85

Tested by

no test coverage detected