Subversion Repositories shark

Rev

Rev 2 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 pj 1
 
2
#include <fs/types.h>
3
#include <fs/errno.h>
4
#include <fs/task.h>
5
#include <fs/maccess.h>
6
 
7
#include "file.h"
8
#include "inode.h"
9
#include "fileop.h"
10
#include "fs.h"
11
 
12
__off_t k_lseek(int fd, __off_t off, int whence)
13
{
14
  __pid_t pid;
15
 
16
  call_to_fs();
17
 
18
  /* don't try to use a bad file descriptor */
19
  pid=__get_pid();
20
  if (check_fd(pid,fd)) {
21
    printk(KERN_INFO "k_lseek: using bad file descriptor");
22
    return_from_fs(-EBADF);
23
  }
24
 
25
  /* seek on a directory not permitted! */
26
  if (file_ptr(pid,fd)->f_flag_isdir) return_from_fs(-EBADF);
27
 
28
  return_from_fs(file_ptr(pid,fd)->f_op->lseek(file_ptr(pid,fd),off,whence));
29
}