1#include <stdint.h> 2#include <time.h> 3 4#include "threads_impl.h" 5 6/* This assumes that a check for the 7 template size has already been made */ 8char* __randname(char* template) { 9 int i; 10 struct timespec ts; 11 unsigned long r; 12 13 __clock_gettime(CLOCK_REALTIME, &ts); 14 r = ts.tv_nsec * 65537 ^ ((uintptr_t)&ts / 16 + (uintptr_t) template); 15 for (i = 0; i < 6; i++, r >>= 5) 16 template[i] = 'A' + (r & 15) + (r & 16) * 2; 17 18 return template; 19} 20