getrandom syscall in C not found

前端 未结 5 1553
温柔的废话
温柔的废话 2020-12-17 16:27

The problem was resolved by upgrading the C library.


I would like to use the syscall getrandom (http://man7.org/linux/man-pages/man2/getrandom.2.html)

5条回答
  •  死守一世寂寞
    2020-12-17 17:10

    I think with your program you will get a segmentation fault. The following code should work:

    #include 
    #include 
    #include 
    #include 
    
    int main() {
      unsigned long int s;
      syscall(SYS_getrandom, &s, sizeof(unsigned long int), 0);
      std::cout << "The seed is: " << s << "." << std::endl;
    }
    

提交回复
热议问题