From b984f825d9f734259eb180dfb81d65a36159b698 Mon Sep 17 00:00:00 2001 From: suter Date: Thu, 6 Jun 2013 17:27:05 +0200 Subject: [PATCH] add a function to retrieve the size of an msg_file_t --- include/msg/msg.h | 1 + src/msg/msg_io.c | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/include/msg/msg.h b/include/msg/msg.h index 9a5aa26c8e..2ab76ca341 100644 --- a/include/msg/msg.h +++ b/include/msg/msg.h @@ -75,6 +75,7 @@ XBT_PUBLIC(size_t) MSG_file_read(void* ptr, size_t size, size_t nmemb, msg_file_ XBT_PUBLIC(size_t) MSG_file_write(const void* ptr, size_t size, size_t nmemb, msg_file_t stream); XBT_PUBLIC(msg_file_t) MSG_file_open(const char* mount, const char* path, const char* mode); XBT_PUBLIC(int) MSG_file_close(msg_file_t fp); +XBT_PUBLIC(size_t) MSG_file_get_size(msg_file_t fd); XBT_PUBLIC(int) MSG_file_unlink(msg_file_t fd); XBT_PUBLIC(xbt_dict_t) MSG_file_ls(const char *mount, const char *path); diff --git a/src/msg/msg_io.c b/src/msg/msg_io.c index 008c7bf986..c5a995c054 100644 --- a/src/msg/msg_io.c +++ b/src/msg/msg_io.c @@ -103,6 +103,17 @@ int MSG_file_unlink(msg_file_t fd) return res; } +/** \ingroup msg_file_management + * \brief Return the size of a file + * + * \param fd is the file descriptor (#msg_file_t) + * \return the size of the file (as a size_t) + */ + +size_t MSG_file_get_size(msg_file_t fd){ + return fd->simdata->smx_file->surf_file->size; +} + /** \ingroup msg_file_management * \brief Search for file * -- 2.20.1