1 Jun 2011 01:07
sizeof(function pointer)
<mdf <at> FreeBSD.org>
2011-05-31 23:07:29 GMT
2011-05-31 23:07:29 GMT
I am looking into potentially MFC'ing r212367 and related, that adds drains to sbufs. The reason for MFC is that several pieces of new code in CURRENT are using the drain functionality and it would make MFCing those changes much easier. The problem is that r212367 added a pointer to a drain function in the sbuf (it replaced a pointer to void). The C standard doesn't guarantee that a void * and a function pointer have the same size, though its true on amd64, i386 and I believe PPC. What I'm wondering is, though not guaranteed by the standard, is it *practically* true that sizeof(void *) == sizeof(int(*)(void)), such that an MFC won't break binary compatibility for any supported architecture? (The standard does guarantee, though not in words, that all function pointers have the same size, since it guarantees that pointers to functions can be cast to other pointers to functions and back without changing the value). Another possibility is to malloc a blob that is sizeof(int(*)(void)) and store that in a renamed s_unused; this is a bit messier but guaranteed to work. I'd just rather the code be an MCF instead of a partial re-write. Thanks, matthew _______________________________________________ freebsd-hackers <at> freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "freebsd-hackers-unsubscribe <at> freebsd.org"(Continue reading)
>>
>> Not sure if I really did that.
>> My position is this:
>> - if we think that TSC is SMP-safe then it should have the best
>> priority
>> - we should do our best to auto-guess if TSC is SMP-safe
>> unless a user explicitly overrides that property (either via
>> explicit testing or by making guesses based on CPU model or etc)
>
> I am sorry if I misunderstood your intention. However, I added
> explicit boot-time TSC sanity check (to do our best to auto-guess)
> and I think TSC is fairly SMP-safe. Hence, I thought that it is
> about time for the change.
In this case - yes. But I remember that you were thinking about either
improving or simplifying that check or both.
>>> Comments?
>>
RSS Feed