[lttng-dev] [Babeltrace RFC PATCH 19/28] Add MinGW implementation of posix_fallocate
Jérémie Galarneau
jeremie.galarneau at efficios.com
Mon May 13 16:20:32 EDT 2013
On Thu, May 2, 2013 at 8:00 AM, Ikaheimonen, JP
<jp_ikaheimonen at mentor.com> wrote:
> Add dummy MinGW implementation of posix_fallocate.
> The implementation does not do anything, and always returns zero.
> ---
> formats/ctf/ctf.c | 2 +-
> include/babeltrace/compat/fcntl.h | 13 +++++++++++++
> 2 files changed, 14 insertions(+), 1 deletion(-)
> create mode 100644 include/babeltrace/compat/fcntl.h
>
> diff --git a/formats/ctf/ctf.c b/formats/ctf/ctf.c
> index c29fcd7..431b2d4 100644
> --- a/formats/ctf/ctf.c
> +++ b/formats/ctf/ctf.c
> @@ -41,7 +41,7 @@
> #include <errno.h>
> #include <sys/types.h>
> #include <sys/stat.h>
> -#include <fcntl.h>
> +#include <babeltrace/compat/fcntl.h>
> #include <dirent.h>
> #include <glib.h>
> #include <babeltrace/compat/unistd.h>
> diff --git a/include/babeltrace/compat/fcntl.h b/include/babeltrace/compat/fcntl.h
> new file mode 100644
> index 0000000..0707c28
> --- /dev/null
> +++ b/include/babeltrace/compat/fcntl.h
> @@ -0,0 +1,13 @@
> +#ifndef _BABELTRACE_INCLUDE_COMPAT_FCNTL_H
> +#define _BABELTRACE_INCLUDE_COMPAT_FCNTL_H
> +
> +#include <fcntl.h>
> +#ifdef __MINGW32__
> +static inline
> +int posix_fallocate(int fd, off_t offset, off_t len)
> +{
This functionality can be achieved using SetFilePointerEx/SetEndOfFile
on Windows.
> + return 0;
> +}
> +#endif
> +
> +#endif
> \ No newline at end of file
> --
> 1.8.1.msysgit.1
>
>
> _______________________________________________
> lttng-dev mailing list
> lttng-dev at lists.lttng.org
> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
--
Jérémie Galarneau
EfficiOS Inc.
http://www.efficios.com
More information about the lttng-dev
mailing list