| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/rand_util.h" | 5 #include "base/rand_util.h" |
| 6 #include "base/rand_util_c.h" | |
| 7 | 6 |
| 8 #include <errno.h> | 7 #include <errno.h> |
| 9 #include <fcntl.h> | 8 #include <fcntl.h> |
| 10 #include <unistd.h> | 9 #include <unistd.h> |
| 11 | 10 |
| 12 #include "base/file_util.h" | 11 #include "base/file_util.h" |
| 13 #include "base/lazy_instance.h" | 12 #include "base/lazy_instance.h" |
| 14 #include "base/logging.h" | 13 #include "base/logging.h" |
| 15 | 14 |
| 16 namespace { | 15 namespace { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 47 | 46 |
| 48 int urandom_fd = g_urandom_fd.Pointer()->fd(); | 47 int urandom_fd = g_urandom_fd.Pointer()->fd(); |
| 49 bool success = file_util::ReadFromFD(urandom_fd, | 48 bool success = file_util::ReadFromFD(urandom_fd, |
| 50 reinterpret_cast<char*>(&number), | 49 reinterpret_cast<char*>(&number), |
| 51 sizeof(number)); | 50 sizeof(number)); |
| 52 CHECK(success); | 51 CHECK(success); |
| 53 | 52 |
| 54 return number; | 53 return number; |
| 55 } | 54 } |
| 56 | 55 |
| 57 } // namespace base | |
| 58 | |
| 59 int GetUrandomFD(void) { | 56 int GetUrandomFD(void) { |
| 60 return g_urandom_fd.Pointer()->fd(); | 57 return g_urandom_fd.Pointer()->fd(); |
| 61 } | 58 } |
| 59 |
| 60 } // namespace base |
| OLD | NEW |