[Mono-dev] [HaikuPorts-devs] [RFC 5/8] io-layer: Define makedev for Haiku

François Revol revol at free.fr
Fri Apr 2 13:35:08 EDT 2010


Le Fri, 2 Apr 2010 19:18:09 +0200, Andreas Färber a écrit :
> Hey guys,
> 
> First, Haiku has the POSIX dev_t type declared in sys/types.h:
> http://www.opengroup.org/onlinepubs/9699919799/basedefs/sys_types.h.html
> > 
> Linux, BSDs, Solaris, OSX all seem to have a makedev macro or 
> function  
> to construct the final dev_t value from major and minor values (and  
> major and minor macros/functions to obtain the individual values  
> again). The stub implementation below is from FreeBSD iirc, OSX uses 
> a  
> different shift.
> 
> Should some implementation be added to Haiku?
> 

I don't know what you want this for, but Haiku does not use the major/
minor values at all, and devfs publishes them as 0,0 for all devices 
anyway.

The dev_t is used for block devices (which are actually char devices 
currently as in BeOS because the drivers do not differentiate) which 
are mounted, but they are just an internal incremented ID.

> Second, the use of makedev here comes from trying to parse a dev_t  
> value from a string in a /proc/*/map[s] file [1], in load_modules 
> [2].  
> Apparently Haiku does not have /proc at all.

It does not. So if you don't need makedev for anything else just drop 
it.

> On Mac OS X, Mono uses _dyld_get_image_* functions instead [3].
> 
> What could I use on Haiku to enumerate process modules, from C code?

You'll want to check get_next_image_info() from <OS.h>.
Set a cookie to 0, and iterate over it.

François.


More information about the Mono-devel-list mailing list