Fix permission management for IPC and also for EXT2.

This commit is contained in:
Enrico Fraccaroli (Galfurian)
2023-05-23 13:40:02 -04:00
parent e7c0334ac0
commit 3ae9258347
12 changed files with 394 additions and 400 deletions
+8 -18
View File
@@ -1,4 +1,10 @@
//test
/// @file t_semget.c
/// @brief This program creates a son and then performs a blocking operation on
/// a semaphore. The son sleeps for five seconds and then it wakes up his
/// father and then it deletes the semaphore.
/// @copyright (c) 2014-2023 This file is distributed under the MIT License.
/// See LICENSE.md for details.
#include "sys/unistd.h"
#include "sys/errno.h"
#include "sys/sem.h"
@@ -7,23 +13,7 @@
#include "fcntl.h"
#include "stdio.h"
/*
Testing Semaphores.
This program creates a son and then performs a blocking operation on a semaphore. The son sleeps for
five seconds and then it wakes up his father and then it deletes the semaphore.
*/
void semid_print(struct semid_ds *temp)
{
printf("pid, IPC_KEY, Semid, semop, change: %d, %d, %d, %d, %d\n", temp->sem_perm.uid, temp->sem_perm.key, temp->semid, temp->sem_otime, temp->sem_ctime);
for (int i = 0; i < (temp->sem_nsems); i++) {
printf("%d semaphore:\n", i + 1);
printf("value: %d, pid %d, process waiting %d\n", temp->sems[i].sem_val, temp->sems[i].sem_pid, temp->sems[i].sem_zcnt);
}
}
int main()
int main(int argc, char *argv[])
{
struct sembuf op_child;
struct sembuf op_father[3];