小编Dil*_*mar的帖子

在设备驱动程序中使用select()/ poll()

我有一个驱动程序,它可以处理多个TCP连接.

有没有办法在内核中给出一个类似于用户空间应用api的select/poll()/ epoll()struct sock的内容?

谢谢

linux linux-kernel

8
推荐指数
1
解决办法
602
查看次数

平均数的计算通向高位.我不明白为什么?

我试图得到一个数组的平均数,但输出是高的,因为它是正确的.我究竟做错了什么?

int count(int arr[]){

int sum;

    //Average
    for(int i=0;i<100; i++)
        sum = sum + arr[i];

    printf("Average:%f \n", sum/100);

}
int main()
{
    int array[100]; //RANDOM NUMBERS 0-900

count(array);

 return 0;
}
Run Code Online (Sandbox Code Playgroud)

c undefined-behavior

0
推荐指数
1
解决办法
70
查看次数

标签 统计

c ×1

linux ×1

linux-kernel ×1

undefined-behavior ×1