Robert Lor wrote:
Hi,
>> What I suggest might be a reasonable compromise is to copy needed
>> typedefs directly into the probes.d file:
> Implemented this suggestion. There are some weirdness with the OS X
> compiler causing some of the probe declarations not to compile (see
> comments in probe.d). The compiler spits out some warnings because the
> types don't show up in the function prototype in probes.h, but the
> probes work okay. I think we can safely ignore the warnings.
These make sense, because they are already typedef's in our code:
> +typedef unsigned int LocalTransactionId;
> +typedef int LWLockId;
> +typedef int LWLockMode;
> +typedef int LOCKMODE;
> +typedef unsigned int BlockNumber;
> +typedef unsigned int Oid;
But I don't see a reason to define the rest:
> +typedef unsigned int locktag_field2;
> +typedef const char * query_string;
> +typedef int sortType;
> +typedef int trueFalse;
> +typedef int nkeys;
> +typedef int workMem;
> +typedef int randomAccess;
> +typedef unsigned long LogicalTapeSetPtr;
> +typedef long spaceUsed;
> +typedef int isLocalBuf;
> +typedef int found;
> +typedef int flags;
> +typedef int num_to_write;
> +typedef int num_written;
> +typedef int NBuffers;
> +typedef int buf_id;
I think you should add a #define Size, perhaps #define bool, and use
those where applicable, and the plain types (int, long, etc) in the rest.
> + /* The following probe declarations cause compilation errors
> + * on Mac OS X but not on Solaris. Need further investigation.
> + * probe lock__wait__start(locktag_field2, LOCKMODE);
> + * probe lock__wait__done(locktag_field2, LOCKMODE);
> + */
> + probe lock__wait__start(unsigned int, int);
> + probe lock__wait__done(unsigned int, int);
For example I think this should look like
probe lock__wait__start(unsigned int, LOCKMODE);
That Mac OS X problem merits some extra investigation, I think.
Other than this, I think this patch can be committed.
--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support