/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
#include"mozilla/RandomNum.h"
#include <fcntl.h> #ifdef XP_UNIX # include <unistd.h> #endif
#ifdefined(XP_WIN)
// Microsoft doesn't "officially" support using RtlGenRandom() directly // anymore, and the Windows headers assume that __stdcall is // the default calling convention (which is true when Microsoft uses this // function to build their own CRT libraries).
// We will explicitly declare it with the proper calling convention.
# ifdefined(SYS_getrandom) // We have SYS_getrandom. Use it to check GETRANDOM_NR. Only do this if we set // GETRANDOM_NR so tier 3 platforms with recent glibc are not forced to define // it for no good reason. # ifdefined(GETRANDOM_NR)
static_assert(GETRANDOM_NR == SYS_getrandom, "GETRANDOM_NR should match the actual SYS_getrandom value"); # endif # else # define SYS_getrandom GETRANDOM_NR # endif
# ifdefined(GRND_NONBLOCK)
static_assert(GRND_NONBLOCK == 1, "If GRND_NONBLOCK is not 1 the #define below is wrong"); # else # define GRND_NONBLOCK 1 # endif
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.