⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ipc.c

📁 Linux内核源代码 为压缩文件 是<<Linux内核>>一书中的源代码
💻 C
字号:
/* * linux/arch/mips/kernel/ipc.c * * This file contains various random system calls that * have a non-standard calling sequence on the Linux/MIPS * platform. */#include <linux/errno.h>#include <linux/sched.h>#include <linux/mm.h>#include <linux/smp.h>#include <linux/smp_lock.h>#include <linux/sem.h>#include <linux/msg.h>#include <linux/shm.h>#include <asm/ipc.h>#include <asm/uaccess.h>/* * sys_ipc() is the de-multiplexer for the SysV IPC calls.. * * This is really horribly ugly. */asmlinkage int sys_ipc (uint call, int first, int second,			int third, void *ptr, long fifth){	int version, ret;	version = call >> 16; /* hack for backward compatibility */	call &= 0xffff;	switch (call) {	case SEMOP:		return sys_semop (first, (struct sembuf *)ptr, second);	case SEMGET:		return sys_semget (first, second, third);	case SEMCTL: {		union semun fourth;		if (!ptr)			return -EINVAL;		if (get_user(fourth.__pad, (void **) ptr))			return -EFAULT;		return sys_semctl (first, second, third, fourth);	}	case MSGSND:		return sys_msgsnd (first, (struct msgbuf *) ptr, 				   second, third);	case MSGRCV:		switch (version) {		case 0: {			struct ipc_kludge tmp;			if (!ptr)				return -EINVAL;						if (copy_from_user(&tmp,					   (struct ipc_kludge *) ptr, 					   sizeof (tmp)))				return -EFAULT;			return sys_msgrcv (first, tmp.msgp, second,					   tmp.msgtyp, third);		}		default:			return sys_msgrcv (first,					   (struct msgbuf *) ptr,					   second, fifth, third);		}	case MSGGET:		return sys_msgget ((key_t) first, second);	case MSGCTL:		return sys_msgctl (first, second, (struct msqid_ds *) ptr);	case SHMAT:		switch (version) {		default: {			ulong raddr;			ret = sys_shmat (first, (char *) ptr, second, &raddr);			if (ret)				return ret;			return put_user (raddr, (ulong *) third);		}		case 1:	/* iBCS2 emulator entry point */			if (!segment_eq(get_fs(), get_ds()))				return -EINVAL;			return sys_shmat (first, (char *) ptr, second, (ulong *) third);		}	case SHMDT: 		return sys_shmdt ((char *)ptr);	case SHMGET:		return sys_shmget (first, second, third);	case SHMCTL:		return sys_shmctl (first, second,				   (struct shmid_ds *) ptr);	default:		return -EINVAL;	}}

⌨️ 快捷键说明

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