|
| static sem_info_t * | __sem_info_alloc (key_t key, int nsems, int semflg) |
| | Allocates the memory for semaphore management structure. More...
|
| |
| static void | __sem_info_dealloc (sem_info_t *sem_info) |
| | Frees the memory of a semaphore management structure. More...
|
| |
| static sem_info_t * | __list_find_sem_info_by_id (int semid) |
| | Searches for the semaphore with the given id. More...
|
| |
| static sem_info_t * | __list_find_sem_info_by_key (key_t key) |
| | Searches for the semaphore with the given key. More...
|
| |
| static void | __list_add_sem_info (sem_info_t *sem_info) |
| | Adds the structure to the global list. More...
|
| |
| static void | __list_remove_sem_info (sem_info_t *sem_info) |
| | Removes the structure from the global list. More...
|
| |
| int | sem_init (void) |
| | Iinitializes the semaphore system. More...
|
| |
|
long | sys_semget (key_t key, int nsems, int semflg) |
| |
|
long | sys_semop (int semid, struct sembuf *sops, unsigned nsops) |
| |
|
long | sys_semctl (int semid, int semnum, int cmd, union semun *arg) |
| |
| ssize_t | procipc_sem_read (vfs_file_t *file, char *buf, off_t offset, size_t nbyte) |
| | Read function for the proc system. More...
|
| |
- Copyright
- (c) 2014-2024 This file is distributed under the MIT License. See LICENSE.md for details.
03/04/2023
At the moment we have various functions with their description (see comments). The first time that the function semget is called, we are going to generate the list and the first semaphore set with the assumption that we are not given a IPC_PRIVATE key (temporary ofc). We are able to create new semaphores set and generate unique keys (IPC_PRIVATE) with a counter that searches for the first possible key to assign. Temporary idea:
- IPC_CREAT flag, it should be working properly, it creates a semaphore set with the given key.
- IPC_EXCL flag, it should be working properly, it returns -1 and sets the errno if the key is already used.
11/04/2023
Right now we have a first version of working semaphores in MentOS. We have completed the semctl function and we have implemented the first version of the semop function both user and kernel side. The way it works is pretty straightforward, the user tries to perform an operation and based on the value of the semaphore the kernel returns certain values. If the operation cannot be performed then the user will stay in a while loop. The cycle ends with a positive return value (the operation has been taken care of) or in case of errors. For testing purposes -> you can try the t_semget and the t_sem1 tests. They both use semaphores and blocking / non blocking operations. t_sem1 is also an exercise that was assingned by Professor Drago in the OS course.