On 09/10/14 13:28, Martin Lucina wrote:
> [Cc-ing to the rumpkernel-users list, better discussed there rather than
> hidden away under many clicks of Github]

Good idea.

>> Looks good, except rump_pub_etfs_register(), like all rump_pub calls, 
>> returns a NetBSD errno.  So you can't use warn() there meaningfully.
>
> Right, in fact rump_etfs(3) says nothing about the return values of those
> functions; I just assumed they returned 0 on success and -1 on error (and
> set errno).  Reading rumpvfs/rumpfs.c it turns out they actually return 0
> on success and the NetBSD errno directly otherwise.

Yea, the man page should say that.  The problem is that I wrote it so 
that I wouldn't have to look up the code all the time; I can never 
remember the exact names of the constants, but I do remember the return 
convention ;)

The reason why the rump_pub calls don't use "errno" is the following: 
errno is defined by the platform, not the rump kernel.  Assume you want 
to run rump kernels on a platform without errno (e.g. some bare metal or 
microkernel'y thing).  Returning an explicit error saves you from having 
to define the concept of errno for that platform for rump_pub call 
return values to be usable.  Sure, with syscalls you're always screwed 
since errno is part of the calling convention, but it's just as valid to 
not use rump kernel syscalls.  The above is sort of documented in the 
rumpuser_seterrno() description in rumpuser(3).

That, plus I generally think all functions should return "success / 
error", but that's another debate.

> Given there's no way to sensibly translate the NetBSD errno to a local one,
> for this particular case shall I just call
>
>    warnx("%s: rump_pub_etfs_register failed (errno=%d)", fsdevice, rv)

Yea, that's what I would do, except maybe s/errno/error/.  Everything 
else is opening up a can of worms.  Besides, for this particular case, 
it's highly unlikely that the call will fail since we already stat() the 
device earlier.

   - antti

------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
rumpkernel-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rumpkernel-users

Reply via email to