UbixOS V2  2.0
descrip.c File Reference
#include <sys/descrip.h>
#include <sys/sysproto_posix.h>
#include <sys/thread.h>
#include <lib/kprintf.h>
#include <ubixos/endtask.h>
#include <lib/kmalloc.h>
#include <assert.h>
#include <sys/select.h>
#include <sys/ioctl.h>
Include dependency graph for descrip.c:

Go to the source code of this file.

Functions

int close (struct thread *td, struct close_args *uap)
 
int dup2 (struct thread *td, u_int32_t from, u_int32_t to)
 
int falloc (struct thread *td, struct file **resultfp, int *resultfd)
 
int fcntl (struct thread *td, struct sys_fcntl_args *uap)
 
int fdestroy (struct thread *td, struct file *fp, int fd)
 The function bar. More...
 
int fstat (struct thread *td, struct sys_fstat_args *uap)
 
int getdtablesize (struct thread *td, struct getdtablesize_args *uap)
 return data table size More...
 
int getfd (struct thread *td, struct file **fp, int fd)
 get pointer to file fd in specified thread More...
 
int ioctl (struct thread *td, struct ioctl_args *uap)
 ioctl functionality not implimented yet More...
 
int sys_dup2 (struct thread *td, struct sys_dup2_args *args)
 
int sys_fcntl (struct thread *td, struct sys_fcntl_args *uap)
 
int sys_ioctl (struct thread *td, struct sys_ioctl_args *args)
 
int sys_select (struct thread *td, struct sys_select_args *args)
 

Function Documentation

◆ close()

int close ( struct thread td,
struct close_args uap 
)

Definition at line 162 of file descrip.c.

References close_args::fd, kfree(), kprintf(), thread::o_files, and thread::td_retval.

Here is the call graph for this function:

◆ dup2()

int dup2 ( struct thread td,
u_int32_t  from,
u_int32_t  to 
)

Definition at line 348 of file descrip.c.

References fileDescriptor::dup, fclose(), file::fd, fdestroy(), kmalloc(), kprintf(), MAX_FILES, memcpy(), and thread::o_files.

Referenced by sys_dup2().

Here is the call graph for this function:

◆ falloc()

int falloc ( struct thread td,
struct file **  resultfp,
int *  resultfd 
)

Definition at line 96 of file descrip.c.

References kfree(), kmalloc(), MAX_FILES, and thread::o_files.

Referenced by kern_openat(), pipe(), sys_openat(), sys_pipe2(), and sys_socket().

Here is the call graph for this function:

◆ fcntl()

int fcntl ( struct thread td,
struct sys_fcntl_args uap 
)

Definition at line 40 of file descrip.c.

References sys_fcntl_args::arg, sys_fcntl_args::cmd, file::f_flag, fclose(), FCNTLFLAGS, sys_fcntl_args::fd, fdestroy(), FFLAGS, kmalloc(), kprintf(), MAX_FILES, memcpy(), O_ACCMODE, thread::o_files, and thread::td_retval.

Referenced by sys_fcntl().

Here is the call graph for this function:

◆ fdestroy()

int fdestroy ( struct thread td,
struct file fp,
int  fd 
)

The function bar.

This function does something which is doing nothing. So this text is totally senseless and you really do not need to read this, because this text is basically saying nothing.

Note
This text shall only show you, how such a "note" section is looking. There is nothing which really needs your notice, so you do not really need to read this section.
Parameters
[in]aDescription of parameter a.
[out]bDescription of the parameter b.
[in,out]cDescription of the parameter c.
Returns
The error return code of the function.
Return values
ERR_SUCCESSThe function is successfully executed
ERR_FAILUREAn error occurred

Definition at line 147 of file descrip.c.

References file::fd, kfree(), kprintf(), and thread::o_files.

Referenced by dup2(), fcntl(), kern_openat(), sys_close(), sys_openat(), and sys_socket().

Here is the call graph for this function:

◆ fstat()

int fstat ( struct thread td,
struct sys_fstat_args uap 
)

Definition at line 185 of file descrip.c.

References _current, sys_fstat_args::fd, kprintf(), thread::o_files, sys_fstat_args::sb, stat::st_blksize, stat::st_mode, and taskStruct::td.

Here is the call graph for this function:

◆ getdtablesize()

int getdtablesize ( struct thread td,
struct getdtablesize_args uap 
)

return data table size

Definition at line 176 of file descrip.c.

References kprintf(), O_FILES, and thread::td_retval.

Here is the call graph for this function:

◆ getfd()

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

get pointer to file fd in specified thread

Returns
returns fp

Definition at line 214 of file descrip.c.

References file::fd, kprintf(), and thread::o_files.

Referenced by read(), sys_close(), sys_fchdir(), sys_fstat(), sys_fstatat(), sys_fstatfs(), sys_getdirentries(), sys_lseek(), sys_mmap(), sys_pread(), sys_read(), sys_sendto(), sys_setsockopt(), and sys_write().

Here is the call graph for this function:

◆ ioctl()

int ioctl ( struct thread td,
struct ioctl_args uap 
)

ioctl functionality not implimented yet

Returns
NULL for now

Definition at line 204 of file descrip.c.

References thread::td_retval.

◆ sys_dup2()

int sys_dup2 ( struct thread td,
struct sys_dup2_args args 
)

Definition at line 377 of file descrip.c.

References dup2(), sys_dup2_args::from, thread::td_retval, and sys_dup2_args::to.

Here is the call graph for this function:

◆ sys_fcntl()

int sys_fcntl ( struct thread td,
struct sys_fcntl_args uap 
)

Definition at line 92 of file descrip.c.

References fcntl().

Here is the call graph for this function:

◆ sys_ioctl()

◆ sys_select()

int sys_select ( struct thread td,
struct sys_select_args args 
)