diff options
Diffstat (limited to 'cpukit/libmisc/uuid/gen_uuid.c')
-rw-r--r-- | cpukit/libmisc/uuid/gen_uuid.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/cpukit/libmisc/uuid/gen_uuid.c b/cpukit/libmisc/uuid/gen_uuid.c index 3ca75a08ce..5601c887c9 100644 --- a/cpukit/libmisc/uuid/gen_uuid.c +++ b/cpukit/libmisc/uuid/gen_uuid.c @@ -165,10 +165,18 @@ static int get_random_fd(void) if (fd >= 0) { i = fcntl(fd, F_GETFD); if (i >= 0) + #ifdef __rtems__ + (void) + #endif fcntl(fd, F_SETFD, i | FD_CLOEXEC); } #endif +#ifdef __rtems__ + srand((((time_t)getpid()) << ((sizeof(pid_t)*CHAR_BIT)>>1)) ^ getuid() + ^ tv.tv_sec ^ tv.tv_usec); +#else srand((getpid() << ((sizeof(pid_t)*CHAR_BIT)>>1)) ^ getuid() ^ tv.tv_sec ^ tv.tv_usec); +#endif #ifdef DO_JRAND_MIX jrand_seed[0] = getpid() ^ (tv.tv_sec & 0xFFFF); jrand_seed[1] = getppid() ^ (tv.tv_usec & 0xFFFF); @@ -340,11 +348,17 @@ static int get_clock(uint32_t *clock_high, uint32_t *clock_low, state_fd = open("/var/lib/libuuid/clock.txt", O_RDWR|O_CREAT, 0660); (void) umask(save_umask); +#ifdef __rtems__ + if (state_fd >= 0) { +#endif state_f = fdopen(state_fd, "r+"); if (!state_f) { close(state_fd); state_fd = -1; } +#ifdef __rtems__ + } +#endif } fl.l_type = F_WRLCK; fl.l_whence = SEEK_SET; @@ -426,6 +440,9 @@ try_again: } rewind(state_f); fl.l_type = F_UNLCK; + #ifdef __rtems__ + (void) + #endif fcntl(state_fd, F_SETLK, &fl); } |