On 14 December 2016 at 20:33, Maxim Uvarov <maxim.uva...@linaro.org> wrote:

> Size might be not passed to that function if is is read
> from file. But it has to be set to provide valid number
> in odp_shm_info().
>
> Signed-off-by: Maxim Uvarov <maxim.uva...@linaro.org>
> ---
>  platform/linux-generic/_ishm.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/platform/linux-generic/_ishm.c b/platform/linux-generic/_
> ishm.c
> index 449e357..b34c70e 100644
> --- a/platform/linux-generic/_ishm.c
> +++ b/platform/linux-generic/_ishm.c
> @@ -803,7 +803,9 @@ int _odp_ishm_reserve(const char *name, uint64_t size,
> int fd,
>         /* If a file descriptor is provided, get the real size and map: */
>         if (fd >= 0) {
>                 fstat(fd, &statbuf);
> -               len = statbuf.st_size;
> +               len  = statbuf.st_size;
> +               size = statbuf.st_size;
> +
>

That will return the real allocated size (aligned to page), not the user
requested length (which may be shorter). is that ok?

Alternatively, I think the block user size is known in the "find_exported"
function, the info could be set there. Let me know if I am unclear, I feel
some kind of responsability for this one :-)... so I am keen to help !

Christophe.

                /* note that the huge page flag is meningless here as huge
>                  * page is determined by the provided file descriptor: */
>                 addr = do_map(new_index, len, align, flags, EXTERNAL, &fd);
> --
> 2.7.1.250.gff4ea60
>
>

Reply via email to