Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/neutrinolabs/xrdp.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authormatt335672 <30179339+matt335672@users.noreply.github.com>2021-10-25 17:18:39 +0300
committermatt335672 <30179339+matt335672@users.noreply.github.com>2021-10-25 17:24:27 +0300
commit50e37bf6731b0d3b1b6aee94cd066e78068e2684 (patch)
treea605b022bb58617a492357c924fd481157fc4d56 /common
parente867c925d5f002d80c2d1ca4422ef70b68848b4c (diff)
Add more file info functions
- g_file_get_device_number() - g_file_get_inode_num()
Diffstat (limited to 'common')
-rw-r--r--common/os_calls.c44
-rw-r--r--common/os_calls.h2
2 files changed, 46 insertions, 0 deletions
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
@@ -2511,6 +2511,50 @@ g_file_get_size(const char *filename)
}
/*****************************************************************************/
+/* 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);