Properly handle ipc and sem permissions. Fix return error codes. Fix private key generation.

This commit is contained in:
Enrico Fraccaroli (Galfurian)
2023-05-17 15:23:42 -04:00
parent 97eedf450d
commit 9f63a93d63
11 changed files with 363 additions and 242 deletions
+12 -12
View File
@@ -22,18 +22,18 @@
#define S_ISUID 0x0800 ///< Set user id on execution
#define S_ISGID 0x0400 ///< Set group id on execution
#define S_ISVTX 0x0200 ///< Save swapped text even after use (Sticky Bit)
#define S_IRWXU 0x01C0 ///< rwx------- : User can read/write/execute
#define S_IRUSR 0x0100 ///< -r-------- : User can read
#define S_IWUSR 0x0080 ///< --w------- : User can write
#define S_IXUSR 0x0040 ///< ---x------ : User can execute
#define S_IRWXG 0x0038 ///< ----rwx--- : Group can read/write/execute
#define S_IRGRP 0x0020 ///< ----r----- : Group can read
#define S_IWGRP 0x0010 ///< -----w---- : Group can write
#define S_IXGRP 0x0008 ///< ------x--- : Group can execute
#define S_IRWXO 0x0007 ///< -------rwx : Others can read/write/execute
#define S_IROTH 0x0004 ///< -------r-- : Others can read
#define S_IWOTH 0x0002 ///< --------w- : Others can write
#define S_IXOTH 0x0001 ///< ---------x : Others can execute
#define S_IRWXU 0x01C0 ///< rwx------ : User can read/write/execute
#define S_IRUSR 0x0100 ///< r-------- : User can read
#define S_IWUSR 0x0080 ///< -w------- : User can write
#define S_IXUSR 0x0040 ///< --x------ : User can execute
#define S_IRWXG 0x0038 ///< ---rwx--- : Group can read/write/execute
#define S_IRGRP 0x0020 ///< ---r----- : Group can read
#define S_IWGRP 0x0010 ///< ----w---- : Group can write
#define S_IXGRP 0x0008 ///< -----x--- : Group can execute
#define S_IRWXO 0x0007 ///< ------rwx : Others can read/write/execute
#define S_IROTH 0x0004 ///< ------r-- : Others can read
#define S_IWOTH 0x0002 ///< -------w- : Others can write
#define S_IXOTH 0x0001 ///< --------x : Others can execute
#define S_ISDIR(m) (((m)&0170000) == 0040000) ///< directory.
#define S_ISCHR(m) (((m)&0170000) == 0020000) ///< char special
+2 -2
View File
@@ -20,8 +20,8 @@
/// @brief Permission details of an IPC object.
struct ipc_perm {
/// Key supplied to msgget(2).
key_t __key;
/// Key associated to the IPC.
key_t key;
/// Effective UID of owner.
uid_t uid;
/// Effective GID of owner.
+3 -3
View File
@@ -29,6 +29,8 @@
/// }@
#define SEM_SET_MAX 256
/// @brief Optional argument for semctl() function
union semun {
/// @brief Value for SETVAL.
@@ -56,9 +58,7 @@ struct sem {
/// @brief Semaphore set
struct semid_ds {
/// @brief Ownership and permissions.
pid_t owner;
/// @brief IPC_KEY associated to the semaphore set.
key_t key;
struct ipc_perm sem_perm;
/// @brief Semaphore ID associated to the semaphore set.
int semid;
/// @brief Last semop time.