Use Genode::size_t in rumpuser_getrandom_backend()

This streamlines the Genode-specific interface for both 32-bit and
64-bit architectures and fixes dynamic-linking issue with the rump
VFS due to differing size_t types.
This commit is contained in:
Christian Helmuth 2017-01-18 15:43:38 +01:00 committed by Norman Feske
parent eb869ab2dc
commit f1c877f205
6 changed files with 20 additions and 18 deletions

View File

@ -16,6 +16,6 @@
#include <base/stdint.h>
int rumpuser_getrandom_backend(void *buf, Genode::size_t buflen, int flags, __SIZE_TYPE__ *retp);
int rumpuser_getrandom_backend(void *buf, Genode::size_t buflen, int flags, Genode::size_t *retp);
#endif /* _INCLUDE__UTIL__RANDOM_H_ */

View File

@ -60,12 +60,11 @@ append config {
<start name="test-libc_vfs">
<resource name="RAM" quantum="10M"/>
<config>
<libc stdout="/dev/log">
<vfs>
<dir name="dev"> <log/> </dir>
<rump fs="ext2fs" writeable="yes"/>
</vfs>
</libc>
<vfs>
<dir name="dev"> <log/> </dir>
<rump fs="ext2fs" writeable="yes"/>
</vfs>
<libc stdout="/dev/log"/>
</config>
</start>
</config>}

View File

@ -69,12 +69,11 @@ append config {
<start name="test-libc_vfs">
<resource name="RAM" quantum="10M"/>
<config>
<libc stdout="/dev/log">
<vfs>
<dir name="dev"> <log/> </dir>
<fs/>
</vfs>
</libc>
<vfs>
<dir name="dev"> <log/> </dir>
<fs/>
</vfs>
<libc stdout="/dev/log"/>
</config>
</start>
</config>}

View File

@ -318,9 +318,14 @@ int rumpuser_clock_sleep(int enum_rumpclock, int64_t sec, long nsec)
** Random pool **
*****************/
int rumpuser_getrandom(void *buf, size_t buflen, int flags, __SIZE_TYPE__ *retp)
int rumpuser_getrandom(void *buf, size_t buflen, int flags, size_t *retp)
{
return rumpuser_getrandom_backend(buf, buflen, flags, retp);
/*
* Cast retp to Genode::size_t to prevent compiler error because
* the type of rump's size_t is int on 32 bit and long 64 bit archs.
*/
return rumpuser_getrandom_backend(buf, buflen, flags,
(Genode::size_t *)retp);
}

View File

@ -56,9 +56,8 @@ struct Entropy
};
int rumpuser_getrandom_backend(void *buf, size_t buflen, int flags, __SIZE_TYPE__ *retp)
int rumpuser_getrandom_backend(void *buf, size_t buflen, int flags, Genode::size_t *retp)
{
*retp = Entropy::e()->read((char *)buf, buflen);
*retp = buflen;
return 0;
}

View File

@ -14,7 +14,7 @@
#include <util/random.h>
int rumpuser_getrandom_backend(void *buf, Genode::size_t buflen, int flags, __SIZE_TYPE__ *retp)
int rumpuser_getrandom_backend(void *buf, Genode::size_t buflen, int flags, Genode::size_t *retp)
{
*retp = buflen;
return 0;