View of xos/include/fd.h


XOS | Parent Directory | View | Download

/* Copyright (C) 2008  Emmanuel Varoquaux
 
   This file is part of XOS.
 
   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation, either version 3 of the License, or
   (at your option) any later version.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.
 
   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>. */
 
#ifndef _FD_H
#define _FD_H
 
struct file_descr_struct;
struct stat_struct;
struct vm_struct;
 
void fd_init();
void fd_print_info();
 
int fd_open(const char *fs_filename, int flags, struct file_descr_struct **file_descr);
void fd_close(struct file_descr_struct *file_descr);
int fd_get_close_on_exec(struct file_descr_struct *file_descr);
void fd_set_close_on_exec(struct file_descr_struct *file_descr, int close_on_exec);
void fd_dup(struct file_descr_struct *file_descr);
int fd_read(struct file_descr_struct *file_descr, char *fs_buf, unsigned int count);
int fd_write(struct file_descr_struct *file_descr, const char *fs_buf, unsigned int count);
long fd_seek(struct file_descr_struct *file_descr, long offset, int whence);
int fd_pipe(struct file_descr_struct *file_descr[2]);
int fd_stat(const struct file_descr_struct *file_descr, struct stat_struct *fs_buf);
int fd_ioctl(struct file_descr_struct *file_descr, int request, void *fs_arg);
int fd_map(struct vm_struct *vm, unsigned long start, unsigned long length, int prot, struct file_descr_struct *file_descr, unsigned long offset);
 
#endif