【发布时间】:2010-09-19 04:42:13
【问题描述】:
我正在尝试在 Debian Linux lenny 下使用 timerfd_create 和 timerfd_settime。手册页说包括<sys/timerfd.h>。此文件无法在我的系统上找到。根据 Debian 包搜索,唯一带有 timerfd.h 的包是 linux-headers-* 包。
我已经安装了包 linux-headers-2.6.26-1-amd64 和 linux-headers-2.6.26-1-common。我尝试包含 /lib/modules/2.6.26-1-amd64/build/include/linux/timerfd.h 文件(不包括<sys/timerfd.h>)。但后来我收到以下链接器错误:
slave.c:(.text+0x166): 未定义对timerfd_ceate的引用
slave.c:(.text+0x1e5): 未定义对timerfd_settime的引用
我的构建命令是 gcc -o slave slave.c -L../libs -lcan -lutils -lrt
can 和 utils 库是我自己的。他们都不使用或定义 timerfd_* 函数之一。我尝试了 -lrt 因为 timer_create 和 timer_settimer 需要它,即使它不在手册页中。带有 timer_create 和 timer_settimer 的测试程序可以正常工作,并且符合预期。
我需要安装哪些数据包,需要链接到哪些库,以及使用 timerfd_create 和 timerfd_settimer 需要哪些包含文件。
谢谢 磨边机
【问题讨论】: