Sample Header Ad - 728x90

Which header defines the macro that specifies the machine architecture?

11 votes
2 answers
11638 views
_Shorter version of question:_ Which C header contains the macro that corresponds to the machine architecture of the system (e.g., __x86_64__, __ia64__, __mips__?) _Longer version of question:_ I'd like to run the [ganglia](http://ganglia.info/) monitoring tools on a [Tilera](http://tilera.com/)-based system that runs Linux. Ganglia doesn't currently have support for Tilera. To get this to work, I ned to modify a C function called [machine_type_func](http://sourceforge.net/apps/trac/ganglia/browser/trunk/monitor-core/libmetrics/linux/metrics.c#L523) that returns the machine architecture. The body of this function is determined at compile-time, it looks like this: g_val_t machine_type_func ( void ) { g_val_t val; #ifdef __i386__ snprintf(val.str, MAX_G_STRING_SIZE, "x86"); #endif #ifdef __x86_64__ snprintf(val.str, MAX_G_STRING_SIZE, "x86_64"); #endif ... return val; } I need to add the appropriate line for Tilera, but I don't know the name of the macro that specifies a Tilera-based system. I'm guessing this macro is defined in one of the standard Linux headers, but I don't know which one to look in.
Asked by Lorin Hochstein (8605 rep)
Aug 29, 2011, 01:04 AM
Last activity: Jan 27, 2021, 08:04 AM