Files
ece373-hw/hw1/section_a.md
Edith Boles cd07449a48 Add hw1
2026-04-09 00:14:59 -07:00

60 lines
1.9 KiB
Markdown

---
title: ECE 371 HW 1
author: Edith Boles
---
1. `open()` system call
A. List the BUGS when using the system call.
> BUGS
>
> Currently, it is not possible to enable signal-driven I/O by specifying O_ASYNC when calling open(); use fcntl(2) to enable this flag.
>
> One must check for two different error codes, EISDIR and ENOENT, when trying to determine whether the kernel supports O_TMPFILE functionality.
>
> When both O_CREAT and O_DIRECTORY are specified in flags and the file specified by pathname does not exist, open() will create a regular file (i.e., O_DIRECTORY is ignored).
B. What files need to be included to use this function?
`open` is inside `fcntl.h`.
C. List the first three related system calls to open().
```
SEE ALSO
chmod(2), chown(2), close(2), ...
```
D. Choose one of the system calls from above and list its bugs (also list
what system call you chose) and files needing to be included to use
the system call
For `link(2)`, you need to include `fcntrl.h` and `unistd.h`. The `BUGS` section details an issue on NFS filesystems that requires verifying the operation before assuming it succeeded.
2. https://elixir.bootlin.com/, searching on kernel `v6.19.11`
A. `usb_device` is defined in `include/linux/usb.h`, with first five members being:
```
int devnum;
char devpath[16];
u32 route;
enum usb_device_state state;
enum usb_device_speed speed;
```
B. `include/uapi/linux/usb/ch9.h`
C. ```
enum usb_device_speed {
USB_SPEED_UNKNOWN = 0, /* enumerating */
USB_SPEED_LOW, USB_SPEED_FULL, /* usb 1.1 */
USB_SPEED_HIGH, /* usb 2.0 */
USB_SPEED_WIRELESS, /* wireless (usb 2.5) */
USB_SPEED_SUPER, /* usb 3.0 */
USB_SPEED_SUPER_PLUS, /* usb 3.1 */
};
```