97 lines
2 KiB
C
97 lines
2 KiB
C
/*
|
|
* linux/ibcs/fcntl.c
|
|
*
|
|
* Copyright (C) 1993 Joe Portman (baron@hebron.connected.com)
|
|
* First stab at troubleshooting fcntl calls
|
|
*
|
|
* $Id: fcntl.c,v 1.1.1.2 1994/02/23 17:22:40 mike Exp $
|
|
* $Source: /nfs4/sophia/home/mjagdis/src/ibcs.cvs/ibcs/Attic/fcntl.c,v $
|
|
*/
|
|
#include <linux/errno.h>
|
|
#include <linux/sched.h>
|
|
#include <linux/kernel.h>
|
|
#include <linux/mm.h>
|
|
#include <linux/stddef.h>
|
|
#include <linux/unistd.h>
|
|
#include <linux/segment.h>
|
|
#include <linux/ptrace.h>
|
|
#include <linux/config.h>
|
|
|
|
#include <asm/segment.h>
|
|
#include <asm/system.h>
|
|
#include <linux/fs.h>
|
|
#include <linux/sys.h>
|
|
#include <linux/ipc.h>
|
|
#include <linux/sem.h>
|
|
#include <linux/string.h>
|
|
#include <linux/fcntl.h>
|
|
|
|
#include <ibcs/ibcs.h>
|
|
#include <ibcs/trace.h>
|
|
|
|
struct ibcs_flock
|
|
{
|
|
short l_type; /* numbers don't match */
|
|
short l_whence;
|
|
off_t l_start;
|
|
off_t l_len; /* 0 means to end of file */
|
|
short l_sysid;
|
|
short l_pid;
|
|
};
|
|
|
|
/*
|
|
** time to get a little more sophisticated on
|
|
** fcntl
|
|
*/
|
|
int
|
|
ibcs_fcntl (struct pt_regs *regs)
|
|
{
|
|
int arg1, arg2, arg3;
|
|
int retval;
|
|
struct ibcs_flock fl;
|
|
arg1 = get_fs_long (((unsigned long *) regs->esp) + (1));
|
|
arg2 = get_fs_long (((unsigned long *) regs->esp) + (2));
|
|
arg3 = get_fs_long (((unsigned long *) regs->esp) + (3));
|
|
|
|
switch(arg2)
|
|
{
|
|
case F_GETLK:
|
|
case F_SETLK:
|
|
case F_SETLKW:
|
|
memcpy_fromfs(&fl,(void *)arg3,sizeof(fl));
|
|
fl.l_type--;
|
|
memcpy_tofs((void *)arg3,&fl,sizeof(fl));
|
|
|
|
#ifdef IBCS_TRACE
|
|
if (ibcs_func_p->trace)
|
|
{
|
|
printk (KERN_DEBUG "iBCS: lock l_type: %d l_whence: %d l_start: %lu l_len: %lu l_sysid: %d l_pid: %d\n",
|
|
fl.l_type,
|
|
fl.l_whence,
|
|
fl.l_start,
|
|
fl.l_len,
|
|
fl.l_sysid,
|
|
fl.l_pid);
|
|
|
|
}
|
|
|
|
#endif
|
|
/*
|
|
** okay do some magic here
|
|
*/
|
|
retval = sys_fcntl(arg1, arg2, arg3);
|
|
memcpy_fromfs(&fl, (void *)arg3, sizeof(fl));
|
|
fl.l_type++;
|
|
memcpy_tofs((void *)arg3, &fl, sizeof(fl));
|
|
return retval;
|
|
break;
|
|
|
|
default:
|
|
retval = sys_fcntl(arg1, arg2, arg3);
|
|
return retval;
|
|
break;
|
|
}
|
|
|
|
|
|
}
|