CXX on X86 : wrong device when calling random_device

Post Reply

Topic author
Valued Contributor
Posts: 94
Joined: Thu Aug 27, 2020 5:50 am
Reputation: 0
Status: Offline

CXX on X86 : wrong device when calling random_device

Post by joukj » Thu Sep 14, 2023 9:55 am


I get the following. when using random_device; it looks like the linux device is not ported

Code: Select all

rumba-jj) cxx/vers
clang version 10.0.1 ( 1944c289616
Build date: 09-01-2023
Target: x86_64-OpenVMS
Thread model: posix
rumba-jj) ty test.cxx
#include <iostream>
#include <map>
#include <random>
#include <string>
int main()
    std::random_device rd;
    std::map<int, int> hist;
    std::uniform_int_distribution<int> dist(0, 9);
    for (int n = 0; n != 20000; ++n)
        ++hist[dist(rd)]; // note: demo only: the performance of many
                          // implementations of random_device degrades sharply
                          // once the entropy pool is exhausted. For practical u
                          // random_device is generally only used to seed
                          // a PRNG such as mt19937

  14-SEP-2023 15:50:37
rumba-jj) cxx test
rumba-jj) link test
rumba-jj) run test
terminating with uncaught exception of type std::__1::system_error: random_devic
e failed to open /dev/urandom: no such file or directory
%SYSTEM-F-OPCCUS, opcode reserved to customer fault at PC=FFFF8301097347DF, PS=0
%TRACE-F-TRACEBACK, symbolic stack dump follows
image     module    routine               line      rel PC           abs PC     
DECC$SHR  SIGNAL.C;1                    #20739 00000000801C97DF FFFF8301097347DF
DECC$SHR  ABORT.C;1                      #2967 000000008009643B FFFF83010960143B
LIBCXXABI                                    0 0000000080028180 0000000080198180
LIBCXXABI                                    0 000000008000077F 000000008017077F
LIBCXXABI                                    0 00000000800251D9 00000000801951D9
LIBCXXABI                                    0 0000000080000C7A 0000000080170C7A
LIBCXXABI                                    0 0000000080027FBC 0000000080197FBC
                                             0 FFFF8301073EC687 FFFF8301073EC687
----- Above condition handler called with exception 05F78414
%NONAME-F-NOMSG, Message number 05F78414
----- End of Exception message
                                             0 FFFF8301073F6F74 FFFF8301073F6F74
TEST                                         0 0000000080000184 0000000080000184
TEST                                         0 00000000800001C3 00000000800001C3
PTHREAD$RTL                                  0 000000008004122C FFFF83010950722C
PTHREAD$RTL                                  0 0000000080002316 FFFF8301094C8316
                                             0 FFFF8301079FC0A6 FFFF8301079FC0A6
DCL                                          0 000000008006778B 000000007ADFF78B
%TRACE-I-LINENUMBER, Leading '#' specifies a source file record number.
%TRACE-I-END, end of TRACE stack dump

User avatar

Posts: 218
Joined: Fri Apr 17, 2020 7:31 pm
Reputation: 0
Location: Rhode Island, USA
Status: Offline

Re: CXX on X86 : wrong device when calling random_device

Post by arne_v » Fri Sep 15, 2023 2:27 pm

It would not be the VMS way to create a device for this.

std::random_device usage should really end up as a call to sys$get_entropy.
VMS user since 1986

VSI Expert
Valued Contributor
Posts: 89
Joined: Tue Dec 01, 2020 8:40 am
Reputation: 0
Status: Offline

Re: CXX on X86 : wrong device when calling random_device

Post by jreagan » Sun Sep 17, 2023 6:18 pm

I'll tell the team

Post Reply