小编use*_*690的帖子

Linux内核中.mod.c文件中版本信息的含义

在所有可加载的内核模块,当make被赋予它会产生一个名为modulename.mod.c除了modulename.ko.

以下代码摘录来自一个.mod.c文件,其中包含一{number, function}对.这个号码有什么意义?这个数字是如何由编译器生成的?

static const struct modversion_info ____versions[]
__used
__attribute__((section("__versions"))) = {

        { 0xa6d8dcb5, "module_layout" },
        { 0x16c2b958, "register_netdevice" },
        { 0x609f1c7e, "synchronize_net" },
        { 0x90a60c63, "kmem_cache_destroy" },
        { 0x402b8281, "__request_module" },
        { 0x844a8af7, "netdev_info" },
        { 0xdfdb0ee8, "kmalloc_caches" },
        { 0x12da5bb2, "__kmalloc" },
        { 0x92d42843, "cfg80211_cqm_rssi_notify" },
        { 0xc86289e8, "perf_tp_event" },
...
...
}
Run Code Online (Sandbox Code Playgroud)

c linux kernel driver

5
推荐指数
1
解决办法
4104
查看次数

指向数组的指针,指示不兼容的指针类型警告

我在warning: assignment from incompatible pointer type [enabled by default]编译以下代码时得到:

int main() {
     int (*aptr) [5] = NULL;
     int arr[5] = {1,2,3,4,5};

     aptr = &arr[0];

     printf("aptr = %p\n arr = %p\n", aptr, &arr[0]);
     return 0;
}
Run Code Online (Sandbox Code Playgroud)

我得到了正确的输出:

aptr = 0xbfcc2c64
arr = 0xbfcc2c64
Run Code Online (Sandbox Code Playgroud)

但是为什么我会收到不兼容指针类型的警告?

c pointers

3
推荐指数
1
解决办法
3307
查看次数

标签 统计

c ×2

driver ×1

kernel ×1

linux ×1

pointers ×1