syscalls.c

来自「优龙2410linux2.6.8内核源代码」· C语言 代码 · 共 69 行

C
69
字号
/*  * Copyright (C) 2000 Jeff Dike (jdike@karaya.com) * Licensed under the GPL */#include "asm/mman.h"#include "asm/uaccess.h"#include "asm/unistd.h"/* * Perform the select(nd, in, out, ex, tv) and mmap() system * calls. Linux/i386 didn't use to be able to handle more than * 4 system call parameters, so these system calls used a memory * block for parameter passing.. */struct mmap_arg_struct {	unsigned long addr;	unsigned long len;	unsigned long prot;	unsigned long flags;	unsigned long fd;	unsigned long offset;};extern int old_mmap(unsigned long addr, unsigned long len,		    unsigned long prot, unsigned long flags,		    unsigned long fd, unsigned long offset);int old_mmap_i386(struct mmap_arg_struct *arg){	struct mmap_arg_struct a;	int err = -EFAULT;	if (copy_from_user(&a, arg, sizeof(a)))		goto out;	err = old_mmap(a.addr, a.len, a.prot, a.flags, a.fd, a.offset); out:	return err;}struct sel_arg_struct {	unsigned long n;	fd_set *inp, *outp, *exp;	struct timeval *tvp;};int old_select(struct sel_arg_struct *arg){	struct sel_arg_struct a;	if (copy_from_user(&a, arg, sizeof(a)))		return -EFAULT;	/* sys_select() does the appropriate kernel locking */	return sys_select(a.n, a.inp, a.outp, a.exp, a.tvp);}/* * Overrides for Emacs so that we follow Linus's tabbing style. * Emacs will notice this stuff at the end of the file and automatically * adjust the settings for this buffer only.  This must remain at the end * of the file. * --------------------------------------------------------------------------- * Local variables: * c-file-style: "linux" * End: */

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?