« | August 2025 | » | 日 | 一 | 二 | 三 | 四 | 五 | 六 | | | | | | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | | | | | | | |
| 公告 |
戒除浮躁,读好书,交益友 |
Blog信息 |
blog名称:邢红瑞的blog 日志总数:523 评论数量:1142 留言数量:0 访问次数:9690971 建立时间:2004年12月20日 |

| |
[linux kernel]_syscall1宏被删除了 原创空间, 文章收藏
邢红瑞 发表于 2011/5/19 20:16:33 |
不用syscall的程序#include <errno.h>#include <stdio.h>#include <stdlib.h>#include <syscall.h>#include <unistd.h>
int main(int argc, char **argv){
time_t current_time; long seconds;
seconds = time(¤t_time);
printf("The current time is : %ld.\n",seconds);
exit(0);
}2.6.18以后kernel headers删除了_syscall1宏,应该使用syscall()。#define _GNU_SOURCE#include <errno.h>#include <stdio.h>#include <stdlib.h>#include <syscall.h>#include <unistd.h>
#define __NR_time 13 /* normally defined in <asm/unistd.h> */
int main(int argc, char **argv){
time_t current_time; long seconds;
seconds = syscall(__NR_time,¤t_time);
printf("The current time is : %ld.\n",seconds);
exit(0);
} |
|
|