---
# System prepended metadata

title: System Programming CH 3

---

##### tags `sp`
# System Programming CH 3
![](https://i.imgur.com/04a7jAT.png)

## File Descriptor:
---
> - To the <font color = red>**kernel**</font>, all open files are referred to as a file descriptor.
> - Is a non-negative number
> - range from 0 through <font color=red>OPEN_MAX − 1</font>
> - In Unix:
> 
>> 0 | 1 | 2 | others
>> --|-- |-- | ------
>> stdin | stdout | stderror | open files|
---
## Open() and Openat():
---
```
#include <fcntl.h>
int open(const char *path, int oflag, ... /* mode_t mode */ );
int openat(int fd, const char *path, int oflag, ... /* mode_t mode */ );
```



