Kernel:提供的对外接口interface介绍,应用于kernel module/驱动开发

285 篇文章 34 订阅 ¥69.90 ¥99.00
本文介绍了Linux内核中用于获取随机数的get_random_bytes函数,适用于生成键值和TCP顺序号,同时讲解了网络部分的devlink分配资源的devlink_alloc函数。还探讨了list_head在net_namespace.c中的使用。
摘要由CSDN通过智能技术生成

公共

  • 获取随机数函数
    void get_random_bytes(void *buf, int nbytes);这个函数向外开发了内核的接口,将好的随机数放到buf中,这些随机数可以很好的用于生成键值以及TCP的顺序号。这个函数不依赖于硬件随机数生成源。如果想直接用硬件提供的随机源,请用use get_random_bytes_arch()
/*
 * This function is the exported kernel interface.  It returns some
 * number of good random numbers, suitable for key generation, seeding
 * TCP sequence numbers, etc.  It does not rely on the hardware random
 * number generator.  For random bytes direct from the hardware RNG
 * (when available), use get_random_bytes_arch().
 */
 例子:
 include/linux/random.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

mzhan017

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值