# kern_descrip.h File Reference

`#include <sys/thread.h>`
`#include <sys/sysproto.h>`
`#include <vfs/file.h>`

Include dependency graph for kern_descrip.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Data Structures

struct | __timespec
struct | file
struct | stat

## Defines

#define | F_DUPFD 0
#define | F_GETFD 1
#define | F_GETFL 3
#define | F_GETLK 7
#define | F_GETOWN 5
#define | F_SETFD 2
#define | F_SETFL 4
#define | F_SETLK 8
#define | F_SETLKW 9
#define | F_SETOWN 6
#define | FAPPEND O_APPEND
#define | FASYNC O_ASYNC
#define | FCNTLFLAGS (FAPPEND|FASYNC|FFSYNC|FNONBLOCK|FPOSIXSHM|O_DIRECT)
#define | FFLAGS(oflags) ((oflags) + 1)
#define | FFSYNC O_FSYNC
#define | FHASLOCK 0x4000
#define | FNDELAY O_NONBLOCK
#define | FNONBLOCK O_NONBLOCK
#define | FPOSIXSHM O_NOFOLLOW
#define | FREAD 0x0001
#define | FWRITE 0x0002
#define | O_ACCMODE 0x0003
#define | O_APPEND 0x0008
#define | O_ASYNC 0x0040
#define | O_CREAT 0x0200
#define | O_DIRECT 0x00010000
#define | O_EXCL 0x0800
#define | O_EXLOCK 0x0020
#define | O_FSYNC 0x0080
#define | O_NDELAY O_NONBLOCK
#define | O_NOFOLLOW 0x0100
#define | O_NONBLOCK 0x0004
#define | O_RDONLY 0x0000
#define | O_RDWR 0x0002
#define | O_SHLOCK 0x0010
#define | O_SYNC 0x0080
#define | O_TRUNC 0x0400
#define | O_WRONLY 0x0001
#define | OFLAGS(fflags) ((fflags) - 1)

## Typedefs

typedef __mode_t | mode_t
typedef __nlink_t | nlink_t

## Functions

int | close (struct thread *, struct close_args *)
int | falloc (struct thread *, struct file **, int *)
int | fcntl (struct thread *, struct fcntl_args *)
int | fstat (struct thread *, struct fstat_args *)
int | getdtablesize (struct thread *, struct getdtablesize_args *)
| return data table size
int | getfd (struct thread *td, struct file **fp, int fd)
| get pointer to file fd in specified thread
int | ioctl (struct thread *, struct ioctl_args *)
| ioctl functionality not implimented yet

## Define Documentation

#define F_DUPFD 0

Definition at line 42 of file kern_descrip.h.

#define F_GETFD 1

Definition at line 43 of file kern_descrip.h.

#define F_GETFL 3

Definition at line 45 of file kern_descrip.h.

#define F_GETLK 7

Definition at line 49 of file kern_descrip.h.

#define F_GETOWN 5

Definition at line 47 of file kern_descrip.h.

#define F_SETFD 2

Definition at line 44 of file kern_descrip.h.

#define F_SETFL 4

Definition at line 46 of file kern_descrip.h.

#define F_SETLK 8

Definition at line 50 of file kern_descrip.h.

#define F_SETLKW 9

Definition at line 51 of file kern_descrip.h.

#define F_SETOWN 6

Definition at line 48 of file kern_descrip.h.

#define FAPPEND O_APPEND

Definition at line 78 of file kern_descrip.h.

#define FASYNC O_ASYNC

Definition at line 79 of file kern_descrip.h.

#define FCNTLFLAGS (FAPPEND|FASYNC|FFSYNC|FNONBLOCK|FPOSIXSHM|O_DIRECT)

Definition at line 88 of file kern_descrip.h.

Referenced by fcntl().

#define FFLAGS | ( | oflags |  | ) | ((oflags) + 1)

Definition at line 90 of file kern_descrip.h.

Referenced by fcntl().

#define FFSYNC O_FSYNC

Definition at line 80 of file kern_descrip.h.

#define FHASLOCK 0x4000

Definition at line 74 of file kern_descrip.h.

#define FNDELAY O_NONBLOCK

Definition at line 82 of file kern_descrip.h.

#define FNONBLOCK O_NONBLOCK

Definition at line 81 of file kern_descrip.h.

#define FPOSIXSHM O_NOFOLLOW

Definition at line 84 of file kern_descrip.h.

#define FREAD 0x0001

Definition at line 54 of file kern_descrip.h.

Referenced by pipe().

#define FWRITE 0x0002

Definition at line 55 of file kern_descrip.h.

Referenced by pipe().

#define O_ACCMODE 0x0003

Definition at line 71 of file kern_descrip.h.

Referenced by fcntl().

#define O_APPEND 0x0008

Definition at line 57 of file kern_descrip.h.

#define O_ASYNC 0x0040

Definition at line 60 of file kern_descrip.h.

#define O_CREAT 0x0200

Definition at line 64 of file kern_descrip.h.

#define O_DIRECT 0x00010000

Definition at line 67 of file kern_descrip.h.

#define O_EXCL 0x0800

Definition at line 66 of file kern_descrip.h.

#define O_EXLOCK 0x0020

Definition at line 59 of file kern_descrip.h.

#define O_FSYNC 0x0080

Definition at line 61 of file kern_descrip.h.

#define O_NDELAY O_NONBLOCK

Definition at line 83 of file kern_descrip.h.

#define O_NOFOLLOW 0x0100

Definition at line 63 of file kern_descrip.h.

#define O_NONBLOCK 0x0004

Definition at line 56 of file kern_descrip.h.

#define O_RDONLY 0x0000

Definition at line 68 of file kern_descrip.h.

#define O_RDWR 0x0002

Definition at line 70 of file kern_descrip.h.

#define O_SHLOCK 0x0010

Definition at line 58 of file kern_descrip.h.

#define O_SYNC 0x0080

Definition at line 62 of file kern_descrip.h.

#define O_TRUNC 0x0400

Definition at line 65 of file kern_descrip.h.

#define O_WRONLY 0x0001

Definition at line 69 of file kern_descrip.h.

#define OFLAGS | ( | fflags |  | ) | ((fflags) - 1)

Definition at line 91 of file kern_descrip.h.

## Typedef Documentation

typedef __mode_t mode_t

Definition at line 38 of file kern_descrip.h.

typedef __nlink_t nlink_t

Definition at line 39 of file kern_descrip.h.

## Function Documentation

int close | ( | struct thread * | ,
|  | struct close_args * |  |
| ) |  |  |

Definition at line 90 of file kern_descrip.c.

int falloc | ( | struct thread * | ,
|  | struct file ** | ,
|  | int * |  |
| ) |  |  |

Definition at line 67 of file kern_descrip.c.

References kmalloc(), kprintf(), and thread::o_files.

Referenced by pipe(), and sys_open().

Here is the call graph for this function:

int fcntl | ( | struct thread * | ,
|  | struct fcntl_args * |  |
| ) |  |  |

Definition at line 39 of file kern_descrip.c.

int fstat | ( | struct thread * | ,
|  | struct fstat_args * |  |
| ) |  |  |

Definition at line 112 of file kern_descrip.c.

int getdtablesize | ( | struct thread * | ,
|  | struct getdtablesize_args * |  |
| ) |  |  |

return data table size

Definition at line 103 of file kern_descrip.c.

int getfd | ( | struct thread * | td,
|  | struct file ** | fp,
|  | int | fd |
| ) |  |  |

get pointer to file fd in specified thread

Returns:
  returns fp

Definition at line 141 of file kern_descrip.c.

References kprintf(), and thread::o_files.

Referenced by read().

Here is the call graph for this function:

int ioctl | ( | struct thread * | td,
|  | struct ioctl_args * | uap |
| ) |  |  |

ioctl functionality not implimented yet

Returns:
  NULL for now

Definition at line 131 of file kern_descrip.c.