arch/x86/include/asm/unistd.h与include/asm-generic/unistd.h [英] arch/x86/include/asm/unistd.h vs. include/asm-generic/unistd.h

查看:536
本文介绍了arch/x86/include/asm/unistd.h与include/asm-generic/unistd.h的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这两个文件有什么区别?我真的不明白.我应该提到第一个文件应该是arch/x86/include/asm/unistd_32.h(或_64.h).以下是它们包含的内容的快速预览:

What's the difference between these two files? I can't really get it. I should mention that the first file should be arch/x86/include/asm/unistd_32.h (or and _64.h). Here is a quick preview of what they contain:

arch/x86/include/asm/unistd.h:

#ifndef _ASM_X86_UNISTD_32_H
#define _ASM_X86_UNISTD_32_H

/*
 * This file contains the system call numbers.
 */

#define __NR_restart_syscall      0
#define __NR_exit         1
#define __NR_fork         2
#define __NR_read         3
#define __NR_write        4
#define __NR_open         5
#define __NR_close        6
#define __NR_waitpid          7
#define __NR_creat        8
#define __NR_link         9
#define __NR_unlink      10
#define __NR_execve      11
#define __NR_chdir       12
#define __NR_time        13
#define __NR_mknod       14
#define __NR_chmod       15
#define __NR_lchown      16
#define __NR_break       17
#define __NR_oldstat         18
#define __NR_lseek       19
#define __NR_getpid      20
#define __NR_mount       21
#define __NR_umount      22


include/asm-generic/unistd.h

#if !defined(_ASM_GENERIC_UNISTD_H) || defined(__SYSCALL)
#define _ASM_GENERIC_UNISTD_H

#include <asm/bitsperlong.h>

/*
 * This file contains the system call numbers, based on the
 * layout of the x86-64 architecture, which embeds the
 * pointer to the syscall in the table.
 *
 * As a basic principle, no duplication of functionality
 * should be added, e.g. we don't use lseek when llseek
 * is present. New architectures should use this file
 * and implement the less feature-full calls in user space.
 */

#ifndef __SYSCALL
#define __SYSCALL(x, y)
#endif

#if __BITS_PER_LONG == 32
#define __SC_3264(_nr, _32, _64) __SYSCALL(_nr, _32)
#else
#define __SC_3264(_nr, _32, _64) __SYSCALL(_nr, _64)
#endif

#define __NR_io_setup 0
__SYSCALL(__NR_io_setup, sys_io_setup)

#define __NR_io_destroy 1
__SYSCALL(__NR_io_destroy, sys_io_destroy)

#define __NR_io_submit 2
__SYSCALL(__NR_io_submit, sys_io_submit)

#define __NR_io_cancel 3
__SYSCALL(__NR_io_cancel, sys_io_cancel)

#define __NR_io_getevents 4
__SYSCALL(__NR_io_getevents, sys_io_getevents)

/* fs/xattr.c */

#define __NR_setxattr 5
__SYSCALL(__NR_setxattr, sys_setxattr)

#define __NR_lsetxattr 6
__SYSCALL(__NR_lsetxattr, sys_lsetxattr)

#define __NR_fsetxattr 7
__SYSCALL(__NR_fsetxattr, sys_fsetxattr)

#define __NR_getxattr 8
__SYSCALL(__NR_getxattr, sys_getxattr)

#define __NR_lgetxattr 9
__SYSCALL(__NR_lgetxattr, sys_lgetxattr)

#define __NR_fgetxattr 10
__SYSCALL(__NR_fgetxattr, sys_fgetxattr)

#define __NR_listxattr 11
__SYSCALL(__NR_listxattr, sys_listxattr)

#define __NR_llistxattr 12

推荐答案

我没有确切的答案,但是当开发人员尝试从旧机制转换到较新机制时,冗余文件并不罕见.您的情况在这里看起来很相似.

I don't have a definite answer, but it's not uncommon for redundant files to exist when devs try to shift from old mechanisms to newer ones. Your case here looks quite similar.

如果签出3.4内核,则会发现arch/x86/include/asm/unistd_32.h和arch/x86/include/asm/unistd_64.h均已消失.相反,它们是使用arch/x86/syscalls生成的.

If you checkout the 3.4 kernel, you will find that both arch/x86/include/asm/unistd_32.h and arch/x86/include/asm/unistd_64.h are gone. Instead, they are generated using arch/x86/syscalls.

签出最新的内核(对我来说3.4.2稳定版有效),并执行"git log --stat arch/x86/include/asm",搜索unistd_64.h或unistd_32.h或unistd.h.

Checkout the latest kernel (3.4.2 stable works for me), and do a "git log --stat arch/x86/include/asm", search for unistd_64.h or unistd_32.h or unistd.h.

我发现以下提交对您来说可能很有趣. 提交303395ac3bf3e2cb488435537d416bc840438fcb

I found the following commit might be interesting to you. commit 303395ac3bf3e2cb488435537d416bc840438fcb

我以前从未接触过系统调用,所以我不想说太多. git log通常是我整理混乱文件的方式.如果您擅长于此,也可以进入makefile. (我不是,所以我依赖git log.)

I've never touched syscalls before, so I'd rather not say too much. git log is usually how I sort out confusing files. You can also get into makefiles if you are good at it. (I am not, so I rely on git log. )

这篇关于arch/x86/include/asm/unistd.h与include/asm-generic/unistd.h的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆