LCOV - code coverage report
Current view: directory - ipc/chromium/src/base - rand_util_posix.cc (source / functions) Found Hit Coverage
Test: app.info Lines: 7 0 0.0 %
Date: 2012-06-02 Functions: 1 0 0.0 %

       1                 : // Copyright (c) 2008 The Chromium Authors. All rights reserved.
       2                 : // Use of this source code is governed by a BSD-style license that can be
       3                 : // found in the LICENSE file.
       4                 : 
       5                 : #include "base/rand_util.h"
       6                 : 
       7                 : #include <fcntl.h>
       8                 : #include <unistd.h>
       9                 : 
      10                 : #include "base/file_util.h"
      11                 : #include "base/logging.h"
      12                 : 
      13                 : namespace base {
      14                 : 
      15               0 : uint64 RandUint64() {
      16                 :   uint64 number;
      17                 : 
      18               0 :   int urandom_fd = open("/dev/urandom", O_RDONLY);
      19               0 :   CHECK(urandom_fd >= 0);
      20                 :   bool success = file_util::ReadFromFD(urandom_fd,
      21                 :                                        reinterpret_cast<char*>(&number),
      22               0 :                                        sizeof(number));
      23               0 :   CHECK(success);
      24               0 :   close(urandom_fd);
      25                 : 
      26               0 :   return number;
      27                 : }
      28                 : 
      29                 : }  // namespace base

Generated by: LCOV version 1.7