#define DRD64_SRC_LIBGOBLIN_BINFO
#include"drd64_libgoblin.h"
+#define LOCATION(n) DRD64_ERR_LOCATION( \
+ DRD64_ERROR_MODULE_LIBGOBLIN, DRD64_ERROR_ARCH_NODEPEND, \
+ DRD64_SRCID_LIBGOBLIN_BINARYINFO, (n))
+
/*----------------------------------------------------------------------
----------------------------------------------------------------------*/
+#define FUNCID_LibGoblin_BinaryInfo_GetBinInfo 0x14
LIBGOBLIN_BINFO_EXTERN
LibGoblin_BinaryInfo *
BinaryInfo_GetBinInfo(
int i_bid )
{
- if(( gi_max_binary_info <= i_bid ) || ( 0 > i_bid ))
- { return NULL; }
-
- return BINFO(i_bid);
-}
-
-
-/*----------------------------------------------------------------------
-----------------------------------------------------------------------*/
-LIBGOBLIN_BINFO_EXTERN
-const char *
- BinaryInfo_GetRPath(
- LibGoblin_BinaryInfo *p_binfo,
- char *pstr_rpath )
-{
- const char *pcstr_result;
- LibGoblin_BinaryFile *p_binfile;
-
- assert( NULL != p_binfo );
- p_binfile = BinaryFile_GetBinaryFile( p_binfo->i_binfile );
- assert( NULL != p_binfile );
-
- if( NULL != pstr_rpath ) {
- strncpy( pstr_rpath, p_binfile->str_rpath, DRD64_MAX_PATH );
- pcstr_result = (const char *)pstr_rpath;
- }
- else {
- pcstr_result = (const char *)p_binfile->str_rpath;
- }
-
- return pcstr_result;
-}
-
-
-/***********************************************************************
-***********************************************************************/
-LIBGOBLIN_API_BINFO
-const char *
- LibGoblin_GetRPath_fromBinInfo(
- int i_bid,
- char *pstr_rpath )
-{
- const char *pcstr_result;
- LibGoblin_BinaryInfo *p_binfo;
-
- p_binfo = BinaryInfo_GetBinInfo( i_bid );
- if( NULL == p_binfo ) {
+ if(( gi_max_binary_info <= i_bid ) || ( 0 > i_bid )) {
+ LibBrownie_Error_SetErrorInfo(
+ DRD64_WARNING( DRD64_ERROR_PTN_FAILED_ARG, 0x01, 0x01 ),
+ LOCATION( FUNCID_LibGoblin_BinaryInfo_GetBinInfo ),
+ errno, (QWord)i_bid, (QWord)0x00, __LINE__ );
return NULL;
}
-
- pcstr_result = BinaryInfo_GetRPath( p_binfo, pstr_rpath );
-
- return pcstr_result;
+
+ return BINFO(i_bid);
}
/*----------------------------------------------------------------------
----------------------------------------------------------------------*/
+#define FUNCID_LibGoblin_BinaryInfo_ClearBinInfo 0x13
void
BinaryInfo_ClearBinInfo(
LibGoblin_BinaryInfo *p_binfo )
/*----------------------------------------------------------------------
----------------------------------------------------------------------*/
+#define FUNCID_LibGoblin_BinaryInfo_SearchFilename_inProgInfo 0x42
LIBGOBLIN_BINFO_EXTERN
int
BinInfo_SearchFilename_inProgInfo(
/*----------------------------------------------------------------------
----------------------------------------------------------------------*/
+#define FUNCID_LibGoblin_BinaryInfo_SearchFilename 0x41
LIBGOBLIN_BINFO_EXTERN
int
BinInfo_SearchFilename(
/*----------------------------------------------------------------------
----------------------------------------------------------------------*/
+#define FUNCID_LibGoblin_BinaryInfo_SearchNextSlave 0x43
LIBGOBLIN_BINFO_EXTERN
int
BinInfo_SearchNextSlave(
LibGoblin_BinaryInfo *p_binfo_now;
LibGoblin_BinaryInfo *p_binfo_ret = NULL;
- if(( 0 > i_bid_self ) || ( 0 > i_bid_now )) { return -0x01; }
+ if(( 0 > i_bid_self ) || ( 0 > i_bid_now )) {
+ LibBrownie_Error_SetErrorInfo(
+ DRD64_ERROR( DRD64_ERROR_PTN_FAILED_ARG, 0x01, 0x01 ),
+ LOCATION( FUNCID_LibGoblin_BinaryInfo_SearchNextSlave ),
+ errno, (QWord)i_bid_self, (QWord)i_bid_now, __LINE__ );
+ return -0x01;
+ }
p_binfo_self = BINFO( i_bid_self );
p_binfo_now = BINFO( i_bid_now );
/*----------------------------------------------------------------------
----------------------------------------------------------------------*/
+#define FUNCID_LibGoblin_BinaryInfo_AppendChain 0x31
int
BinInfo_AppendChain(
LibGoblin_BinaryInfo *p_binfo_now )
/*----------------------------------------------------------------------
----------------------------------------------------------------------*/
+#define FUNCID_LibGoblin_BinaryInfo_DeleteChain 0x32
int
BinInfo_DeleteChain(
LibGoblin_BinaryInfo *p_binfo_del )
/*----------------------------------------------------------------------
----------------------------------------------------------------------*/
+#define FUNCID_LibGoblin_BinaryInfo_SetRPath 0x23
LIBGOBLIN_BINFO_EXTERN
int
BinaryInfo_SetRPath(
LibGoblin_BinaryFile *p_binfile;
if( LIBGOBLIN_BINFO_PHASE_SETPROG > p_binfo->b_phase ) {
+ LibBrownie_Error_SetErrorInfo(
+ DRD64_ERROR( DRD64_ERROR_PTN_FAILCALL, 0x01, 0x01 ),
+ LOCATION( FUNCID_LibGoblin_BinaryInfo_SetRPath ),
+ errno, (QWord)p_binfo->b_phase, (QWord)p_binfo->i_id, __LINE__ );
return -0x01;
}
pstr_result = realpath( str_src, str_dest );
if( NULL == pstr_result ) {
+ LibBrownie_Error_SetErrorInfo(
+ DRD64_ERROR( DRD64_ERROR_PTN_LIBCALL, 0x01, 0x02 ),
+ LOCATION( FUNCID_LibGoblin_BinaryInfo_SetRPath ),
+ errno, (QWord)0x00, (QWord)0x00, __LINE__ );
return -0x02;
}
i_len = strnlen( str_dest, MAXPATHLEN );
if( DRD64_MAX_PATH <= i_len ) {
+ LibBrownie_Error_SetErrorInfo(
+ DRD64_ERROR( DRD64_ERROR_PTN_FAILCALL, 0x01, 0x03 ),
+ LOCATION( FUNCID_LibGoblin_BinaryInfo_SetRPath ),
+ errno, (QWord)i_len, (QWord)0x00, __LINE__ );
return -0x03;
}
strncpy( p_binfile->str_rpath, str_dest, DRD64_MAX_PATH );
/*----------------------------------------------------------------------
----------------------------------------------------------------------*/
+#define FUNCID_LibGoblin_BinaryInfo_SetRunPath 0x22
LIBGOBLIN_BINFO_EXTERN
int
BinaryInfo_SetRunPath(
LibGoblin_BinaryFile *p_binfile;
if( LIBGOBLIN_BINFO_PHASE_SETPROG > p_binfo->b_phase ) {
+ LibBrownie_Error_SetErrorInfo(
+ DRD64_ERROR( DRD64_ERROR_PTN_FAILCALL, 0x01, 0x01 ),
+ LOCATION( FUNCID_LibGoblin_BinaryInfo_SetRunPath ),
+ errno, (QWord)p_binfo->b_phase, (QWord)p_binfo->i_id, __LINE__ );
return -0x01;
}
pstr_result = realpath( str_src, str_dest );
if( NULL == pstr_result ) {
+ LibBrownie_Error_SetErrorInfo(
+ DRD64_ERROR( DRD64_ERROR_PTN_LIBCALL, 0x01, 0x02 ),
+ LOCATION( FUNCID_LibGoblin_BinaryInfo_SetRunPath ),
+ errno, (QWord)0x00, (QWord)0x00, __LINE__ );
return -0x02;
}
i_len = strnlen( str_dest, MAXPATHLEN );
if( DRD64_MAX_PATH <= i_len ) {
+ LibBrownie_Error_SetErrorInfo(
+ DRD64_ERROR( DRD64_ERROR_PTN_FAILCALL, 0x01, 0x03 ),
+ LOCATION( FUNCID_LibGoblin_BinaryInfo_SetRunPath ),
+ errno, (QWord)i_len, (QWord)0x00, __LINE__ );
return -0x03;
}
strncpy( p_binfile->str_runpath, str_dest, DRD64_MAX_PATH );
Absolute Path ONLY in remote-machine program.
* pstr_progpath != pstr_realpath is remote-machine program.
----------------------------------------------------------------------*/
+#define FUNCID_LibGoblin_BinaryInfo_SetProgramPath 0x21
LIBGOBLIN_BINFO_EXTERN
int
BinaryInfo_SetProgramPath(
// Check BinaryInfo & BinaryFile struct status ---
if( LIBGOBLIN_BINFO_PHASE_SETPROG <= p_binfo->b_phase ) {
+ LibBrownie_Error_SetErrorInfo(
+ DRD64_ERROR( DRD64_ERROR_PTN_FAILCALL, 0x01, 0x01 ),
+ LOCATION( FUNCID_LibGoblin_BinaryInfo_SetProgramPath ),
+ errno, (QWord)p_binfo->b_phase, (QWord)p_binfo->i_id, __LINE__ );
return -0x01;
}
// localpath convert to RelativePath to AbsolutePath ---
pstr_result = realpath( pstr_localpath, str_local );
if( NULL == pstr_result ) {
- return -0x04;
+ LibBrownie_Error_SetErrorInfo(
+ DRD64_ERROR( DRD64_ERROR_PTN_LIBCALL, 0x01, 0x02 ),
+ LOCATION( FUNCID_LibGoblin_BinaryInfo_SetProgramPath ),
+ errno, (QWord)0x00, (QWord)0x00, __LINE__ );
+ return -0x02;
}
i_len = strnlen( str_local, DRD64_MAX_PATH );
if( '/' == str_local[ i_len ] ) { str_local[ i_len ] = '\0'; }
if( '\0' != *pstr_remotepath ) {
pstr_result = realpath( pstr_remotepath, str_remote );
if( NULL == pstr_result ) {
- return -0x05;
+ LibBrownie_Error_SetErrorInfo(
+ DRD64_ERROR( DRD64_ERROR_PTN_LIBCALL, 0x01, 0x03 ),
+ LOCATION( FUNCID_LibGoblin_BinaryInfo_SetProgramPath ),
+ errno, (QWord)0x00, (QWord)0x00, __LINE__ );
+ return -0x03;
}
i_len = strnlen( str_remote, DRD64_MAX_PATH );
if( '/' == str_remote[ i_len ] ) { str_remote[ i_len ] = '\0'; }
// Alloc BinaryFile struct & Set File Path ---
p_bfile = BinaryFile_DispenseBinaryFile( p_binfo, str_local, pstr_remote);
if( NULL == p_bfile ) {
- return -0x06;
+ LibBrownie_Error_SetErrorInfo(
+ DRD64_ERROR( DRD64_ERROR_PTN_CALLFUNC, 0x01, 0x04 ),
+ LOCATION( FUNCID_LibGoblin_BinaryInfo_SetProgramPath ),
+ errno, (QWord)0x00, (QWord)0x00, __LINE__ );
+ return -0x04;
}
p_binfo->i_binfile = p_bfile->i_id;
/*----------------------------------------------------------------------
----------------------------------------------------------------------*/
+#define FUNCID_LibGoblin_BinaryInfo_AllocBinInfo 0x11
LIBGOBLIN_BINFO_EXTERN
LibGoblin_BinaryInfo *
BinaryInfo_AllocBinInfo(
sizeof( LibGoblin_BinaryInfo ) *
(gi_alloc_binary_info + LIBGOBLIN_BINFO_UNITS) );
if( NULL == p_binfo_base ) {
+ LibBrownie_Error_SetErrorInfo(
+ DRD64_ERROR( DRD64_ERROR_PTN_NOMEMORY, 0x01, 0x01 ),
+ LOCATION( FUNCID_LibGoblin_BinaryInfo_AllocBinInfo ),
+ errno, (QWord)gi_alloc_binary_info, (QWord)gi_now_binary_info, __LINE__ );
return NULL;
}
/*----------------------------------------------------------------------
----------------------------------------------------------------------*/
+#define FUNCID_LibGoblin_BinaryInfo_FreeBinInfo 0x12
LIBGOBLIN_BINFO_EXTERN
int
BinaryInfo_FreeBinInfo(
int i_binfoid;
LibGoblin_BinaryFile *p_binfile;
- if( NULL == p_binfo ) { return 0x01; }
+ if( NULL == p_binfo ) {
+ LibBrownie_Error_SetErrorInfo(
+ DRD64_ERROR( DRD64_ERROR_PTN_FAILED_ARG, 0x01, 0x01 ),
+ LOCATION( FUNCID_LibGoblin_BinaryInfo_FreeBinInfo ),
+ errno, (QWord)0x00, (QWord)0x00, __LINE__ );
+ return 0x01;
+ }
if( -0x01 != p_binfo->i_binfile ) {
p_binfile = BinaryFile_GetBinaryFile( p_binfo->i_binfile );
/*----------------------------------------------------------------------
----------------------------------------------------------------------*/
+#define FUNCID_LibGoblin_BinaryInfo_Init 0x01
LIBGOBLIN_BINFO_EXTERN
int
BinaryInfo_Init(
LibGoblin_BinaryInfo *p_binfo;
if( 0 != gi_max_binary_info ) {
+ LibBrownie_Error_SetErrorInfo(
+ DRD64_ERROR( DRD64_ERROR_PTN_FAILCALL, 0x01, 0x01 ),
+ LOCATION( FUNCID_LibGoblin_BinaryInfo_Init ),
+ errno, (QWord)gi_max_binary_info, (QWord)0x00, __LINE__ );
return -0x01;
}
gp_binary_info = malloc( sizeof( LibGoblin_BinaryInfo )
* LIBGOBLIN_BINFO_UNITS );
if( NULL == gp_binary_info ) {
+ LibBrownie_Error_SetErrorInfo(
+ DRD64_ERROR( DRD64_ERROR_PTN_NOMEMORY, 0x01, 0x02 ),
+ LOCATION( FUNCID_LibGoblin_BinaryInfo_Init ),
+ errno, (QWord)0x00, (QWord)0x00, __LINE__ );
return -0x02;
}
/*----------------------------------------------------------------------
----------------------------------------------------------------------*/
+#define FUNCID_LibGoblin_BinaryInfo_Term 0x02
LIBGOBLIN_BINFO_EXTERN
int
BinaryInfo_Term(
#define DRD64_SRC_LIBGOBLIN_PROGINFO
#include"drd64_libgoblin.h"
+#define LOCATION(n) DRD64_ERR_LOCATION( \
+ DRD64_ERROR_MODULE_LIBGOBLIN, DRD64_ERROR_ARCH_NODEPEND, \
+ DRD64_SRCID_LIBGOBLIN_PROGINFO, (n))
+
+
/*----------------------------------------------------------------------
----------------------------------------------------------------------*/
+#define FUNCID_LibGoblin_ProgInfo_GetProgInfo 0x14
LIBGOBLIN_PROGINFO_EXTERN
LibGoblin_ProgramInfo *
ProgInfo_GetProgInfo(
int i_pgid )
{
- if(( gi_max_program_info <= i_pgid ) || ( 0 > i_pgid ))
- { return NULL; }
+ if(( gi_max_program_info <= i_pgid ) || ( 0 > i_pgid )) {
+ LibBrownie_Error_SetErrorInfo(
+ DRD64_ERROR( DRD64_ERROR_PTN_FAILED_ARG, 0x01, 0x01 ),
+ LOCATION( FUNCID_LibGoblin_ProgInfo_GetProgInfo ),
+ errno, (QWord)i_pgid, (QWord)0x00, __LINE__ );
+ return NULL;
+ }
- if( -0x01 == PGINFO( i_pgid )->i_id )
- { return NULL; }
+ if( -0x01 == PGINFO( i_pgid )->i_id ) {
+ LibBrownie_Error_SetErrorInfo(
+ DRD64_ERROR( DRD64_ERROR_PTN_FAILCALL, 0x01, 0x02 ),
+ LOCATION( FUNCID_LibGoblin_ProgInfo_GetProgInfo ),
+ errno, (QWord)i_pgid, (QWord)0x00, __LINE__ );
+ return NULL;
+ }
return PGINFO( i_pgid );
}
/*----------------------------------------------------------------------
----------------------------------------------------------------------*/
+#define FUNCID_LibGoblin_ProgInfo_AddBinaryInfo 0x21
LIBGOBLIN_PROGINFO_EXTERN
LibGoblin_BinaryInfo *
ProgInfo_AddBinaryInfo(
// Alloc BinaryInfo ---
p_binfo = BinaryInfo_AllocBinInfo( p_pginfo, pstr_binfilename, i_req_bid );
if( NULL == p_binfo ) {
+ LibBrownie_Error_SetErrorInfo(
+ DRD64_ERROR( DRD64_ERROR_PTN_CALLFUNC, 0x01, 0x01 ),
+ LOCATION( FUNCID_LibGoblin_ProgInfo_AddBinaryInfo ),
+ errno, (QWord)i_bid, (QWord)i_req_bid, __LINE__ );
return NULL;
}
}
else {
p_binfo = BinaryInfo_GetBinInfo( i_bid );
+ if( NULL == p_binfo ) {
+ LibBrownie_Error_SetErrorInfo(
+ DRD64_ERROR( DRD64_ERROR_PTN_FAILCALL, 0x01, 0x02 ),
+ LOCATION( FUNCID_LibGoblin_ProgInfo_AddBinaryInfo ),
+ errno, (QWord)i_bid, (QWord)0x00, __LINE__ );
+ }
}
return p_binfo;
/*----------------------------------------------------------------------
----------------------------------------------------------------------*/
+#define FUNCID_LibGoblin_ProgInfo_ClearProgInfo 0x13
void
ProgInfo_ClearProgInfo(
LibGoblin_ProgramInfo *p_pginfo )
/*----------------------------------------------------------------------
----------------------------------------------------------------------*/
+#define FUNCID_LibGoblin_ProgInfo_AllocProgInfo 0x11
LIBGOBLIN_PROGINFO_EXTERN
LibGoblin_ProgramInfo *
ProgInfo_AllocProgInfo(
}
}
+ LibBrownie_Error_SetErrorInfo(
+ DRD64_ERROR( DRD64_ERROR_PTN_BUG, 0x01, 0x01 ),
+ LOCATION( FUNCID_LibGoblin_ProgInfo_AllocProgInfo ),
+ errno, (QWord)gi_now_program_info, (QWord)gi_max_program_info, __LINE__ );
goto goto_ProgInfo_AllocProgInfo_post;
}
sizeof( LibGoblin_ProgramInfo ) *
( gi_alloc_program_info + LIBGOBLIN_PROGINFO_UNITS ) );
if( NULL == p_pgbase ) {
+ LibBrownie_Error_SetErrorInfo(
+ DRD64_ERROR( DRD64_ERROR_PTN_NOMEMORY, 0x01, 0x02 ),
+ LOCATION( FUNCID_LibGoblin_ProgInfo_AllocProgInfo ),
+ errno, (QWord)gi_alloc_program_info, (QWord)0x00, __LINE__ );
goto goto_ProgInfo_AllocProgInfo_post;
}
/*----------------------------------------------------------------------
----------------------------------------------------------------------*/
+#define FUNCID_LibGoblin_ProgInfo_FreeProgInfo 0x12
LIBGOBLIN_PROGINFO_EXTERN
int
ProgInfo_FreeProgInfo(
assert( NULL != p_pginfo );
- if( -0x01 == p_pginfo->i_id ) { return 0x00; }
+ if( -0x01 == p_pginfo->i_id ) {
+ LibBrownie_Error_SetErrorInfo(
+ DRD64_WARNING( DRD64_ERROR_PTN_FAILCALL, 0x01, 0x01 ),
+ LOCATION( FUNCID_LibGoblin_ProgInfo_FreeProgInfo ),
+ errno, (QWord)p_pginfo, (QWord)0x00, __LINE__ );
+ return 0x00;
+ }
i_id = p_pginfo->i_id;
ProgInfo_ClearProgInfo( p_pginfo );
/*----------------------------------------------------------------------
----------------------------------------------------------------------*/
+#define FUNCID_LibGoblin_ProgInfo_Init 0x01
LIBGOBLIN_PROGINFO_EXTERN
int
ProgInfo_Init(
LibGoblin_ProgramInfo *p_pginfo;
if( 0 != gi_max_program_info ) {
+ LibBrownie_Error_SetErrorInfo(
+ DRD64_ERROR( DRD64_ERROR_PTN_FAILCALL, 0x01, 0x01 ),
+ LOCATION( FUNCID_LibGoblin_ProgInfo_Init ),
+ errno, (QWord)gi_max_program_info, (QWord)0x00, __LINE__ );
return -0x01;
}
gp_program_info = (LibGoblin_ProgramInfo *)malloc(
sizeof( LibGoblin_ProgramInfo ) * LIBGOBLIN_PROGINFO_UNITS );
if( NULL == gp_program_info ) {
+ LibBrownie_Error_SetErrorInfo(
+ DRD64_ERROR( DRD64_ERROR_PTN_NOMEMORY, 0x01, 0x02 ),
+ LOCATION( FUNCID_LibGoblin_ProgInfo_Init ),
+ errno, (QWord)0x00, (QWord)0x00, __LINE__ );
return -0x02;
}
/*----------------------------------------------------------------------
----------------------------------------------------------------------*/
+#define FUNCID_LibGoblin_ProgInfo_Term 0x02
LIBGOBLIN_PROGINFO_EXTERN
int
ProgInfo_Term(