40 lines
1.0 KiB
C
40 lines
1.0 KiB
C
|
|
#ifndef TEMP_PERMISSIONS_TABLE_H
|
|
#define TEMP_PERMISSIONS_TABLE_H
|
|
|
|
#include "process_info.h"
|
|
|
|
/**
|
|
* Initializes the temporary permissions table.
|
|
*
|
|
* @return: 0 on success, -1 on failure (e.g. ENOMEM)
|
|
*/
|
|
int init_temp_permissions_table();
|
|
|
|
/**
|
|
* Destroys the temporary permissions table.
|
|
*
|
|
* @note: the table is guranteed to be destroyed if it is already initialized
|
|
*/
|
|
void destroy_temp_permissions_table();
|
|
|
|
/**
|
|
* Checks if the process has a temporary access to the file.
|
|
*
|
|
* @param filename: The file that the process is trying to access
|
|
* @param pi: The process information
|
|
* @return: 0 if access is denied, 1 if access is allowed
|
|
*/
|
|
int check_temp_access(const char *filename, struct process_info pi);
|
|
|
|
/**
|
|
* Gives temporary access to the process to the file.
|
|
*
|
|
* @param filename: The file that the process is trying to access
|
|
* @param pi: The process information
|
|
* @return: 0 on success, -1 on failure (e.g. ENOMEM)
|
|
*/
|
|
int give_temp_access(const char *filename, struct process_info pi);
|
|
|
|
#endif // !TEMP_PERMISSIONS_TABLE_H
|