[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Trouble executing example translator from Hurd Hacking Guide

From: Samuel Thibault
Subject: Re: Trouble executing example translator from Hurd Hacking Guide
Date: Sat, 27 Jul 2019 11:09:56 +0200
User-agent: NeoMutt/20170113 (1.7.2)


Andrew Eggenberger, le ven. 26 juil. 2019 20:36:20 -0500, a ecrit:
> I've been trying to compile and run the trivfs example [1] in the Hurd
> Hacking Guide. It compiles with the slightly amended command:
>         gcc -g -o one -ltrivfs -lports

Indeed, it is using a libports function and nowadays tools don't let
that implicitly taken from libtrivfs.

> mmap fails to allocate memory. When I checked the errno string, it said
> there was an invalid argument. The mmap manual says MAP_SHARED or
> MAP_PRIVATE need to appear in the flags argument (the fourth one).

MAP_PRIVATE is actually #defined to 0, so it's not actually "mandatory".
The idea here is that MAP_ANON means MAP_PRIVATE anyway, so people were
not putting the latter.

> I tried adding each and the error persisted. Another possible reason
> for the error according to the man page is an amount that is too
> high. I checked the variable and it is a large number, but I don't
> know how to check to see how much is too much.

Print it in hex:

gdb> p/x amount

That is way too much (2^32-1) for the 32bit address space. That's where
the problem comes from.

The issue here is actually that the source code is missing

#define _FILE_OFFSET_BITS 64

at the very top of the file.  It seems that compatibility symbols have
not been introduced, and thus your translator was using 32bit off_t
while libtrivfs uses 64bit off_t. Recompile with that #define and it
should work.

I have updated the webpage, I guess that will show up after mirrors
catch up.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]