On Sunday 05 October 2008, stephane eranian wrote: > If I summarize our discussion. It seems we can define the API as follows: > > int pfm_create_session(int fd, uint64_t flags, pfarg_sinfo_t *sif, > [ char *smpl_name, void *smpl_arg, size_t arg_size]); > int pfm_read_pmrs(int fd, uint64_t flags, void *tab, size_t sz); > int pfm_write_pmrs(int fd, uint64_t flags, void *tab, size_t sz); > int pfm_attach_session(int fd, uint64_t flags, int target); /* > attach, detach with target=-1 */ > int pfm_control_session(int fd, uint64_t flags); /* for start/stop */ > int pfm_control_sets(int fd, uint64_t flags, void *sets, size_t sz);
There are two problems with uint64_t arguments to system calls: 1. You have to mandate the use of stdint.h before including the perfmon header file. This is a minor problem as long as all callers go through libpfm, but you can avoid it entirely by using the kernel __u32 instead of uint32_t style types everywhere in your interface. 2. The calling conventions for passing 64 bit values on 32 bit architecture are complex, every architecture enforces different rules here. On the syscall interface, bettwe always use native types like 'unsigned long' instead of '__u64'. This is different from the case where you pass a pointer to data, in which case a '__u64 *' is much preferred over a 'unsigned long *'. I did not understand the reason for going to a 64 bit flags parameter, but I think that you would do everyone a favour if you can instead use two 32-bit flags or a unsigned long flags parameter. Arnd <>< ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ perfmon2-devel mailing list perfmon2-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/perfmon2-devel