diff --git a/common/os_calls.c b/common/os_calls.c index b9e0af37..e3e157a6 100644 --- a/common/os_calls.c +++ b/common/os_calls.c @@ -2510,6 +2510,50 @@ g_file_get_size(const char *filename) #endif } +/*****************************************************************************/ +/* returns device number, -1 on error */ +int +g_file_get_device_number(const char *filename) +{ +#if defined(_WIN32) + return -1; +#else + struct stat st; + + if (stat(filename, &st) == 0) + { + return (int)(st.st_dev); + } + else + { + return -1; + } + +#endif +} + +/*****************************************************************************/ +/* returns inode number, -1 on error */ +int +g_file_get_inode_num(const char *filename) +{ +#if defined(_WIN32) + return -1; +#else + struct stat st; + + if (stat(filename, &st) == 0) + { + return (int)(st.st_ino); + } + else + { + return -1; + } + +#endif +} + /*****************************************************************************/ long g_load_library(char *in) diff --git a/common/os_calls.h b/common/os_calls.h index 811c16f8..82689fa1 100644 --- a/common/os_calls.h +++ b/common/os_calls.h @@ -128,6 +128,8 @@ int g_create_path(const char *path); int g_remove_dir(const char *dirname); int g_file_delete(const char *filename); int g_file_get_size(const char *filename); +int g_file_get_device_number(const char *filename); +int g_file_get_inode_num(const char *filename); long g_load_library(char *in); int g_free_library(long lib); void *g_get_proc_address(long lib, const char *name);