提交 de20a8ff 编写于 作者: R Rich Felker

add namespace-protected name for sysinfo function

it will be needed to implement some things in sysconf, and the syscall
can't easily be used directly because the x32 syscall uses the wrong
structure layout. the l (uncreative, for "linux") prefix is used since
the symbol name __sysinfo is already taken for AT_SYSINFO from the aux
vector.

the way the x32 override of this function works is also changed to be
simpler and avoid the useless jump instruction.
上级 6cf7d17f
#include <sys/sysinfo.h> #include <sys/sysinfo.h>
#include "syscall.h" #include "syscall.h"
#include "libc.h"
#define klong long long #define klong long long
#define kulong unsigned long long #define kulong unsigned long long
...@@ -20,7 +21,7 @@ struct kernel_sysinfo { ...@@ -20,7 +21,7 @@ struct kernel_sysinfo {
unsigned mem_unit; unsigned mem_unit;
}; };
int __x32_sysinfo(struct sysinfo *info) int __lsysinfo(struct sysinfo *info)
{ {
struct kernel_sysinfo tmp; struct kernel_sysinfo tmp;
int ret = syscall(SYS_sysinfo, &tmp); int ret = syscall(SYS_sysinfo, &tmp);
...@@ -45,3 +46,5 @@ int __x32_sysinfo(struct sysinfo *info) ...@@ -45,3 +46,5 @@ int __x32_sysinfo(struct sysinfo *info)
info->mem_unit = (tmp.mem_unit ? tmp.mem_unit : 1) << shifts; info->mem_unit = (tmp.mem_unit ? tmp.mem_unit : 1) << shifts;
return ret; return ret;
} }
weak_alias(__lsysinfo, sysinfo);
#include <sys/sysinfo.h> #include <sys/sysinfo.h>
#include "syscall.h" #include "syscall.h"
#include "libc.h"
int sysinfo(struct sysinfo *info) int __lsysinfo(struct sysinfo *info)
{ {
return syscall(SYS_sysinfo, info); return syscall(SYS_sysinfo, info);
} }
weak_alias(__lsysinfo, sysinfo);
.text # see arch/x32/src/sysinfo.c
.global sysinfo
.type sysinfo,@function
sysinfo:
jmp __x32_sysinfo
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册