|
Thread Synch AOSV 2020
1.2
LKM for exchanging messages between threads
|
Handles all procedures releated to the main synch device file. More...
#include <linux/module.h>#include <linux/kernel.h>#include <linux/fs.h>#include <linux/cdev.h>#include <linux/device.h>#include <linux/slab.h>#include <linux/uaccess.h>#include <linux/semaphore.h>#include <linux/ioctl.h>#include <linux/idr.h>#include "group_manager.h"#include "sysfs.h"

Go to the source code of this file.
Data Structures | |
| struct | t_main_sync |
| Main device structure. More... | |
Macros | |
| #define | INVALID_IOCTL_COMMAND -1 |
| #define | ALLOC_ERR -2 |
| #define | USER_COPY_ERR -3 |
| #define | IDR_ERR -4 |
| #define | MEM_ACCESS_ERR -5 |
| #define | CLASS_EXISTS -10 |
| #define | CLASS_ERR -11 |
| #define | DEV_CREATION_ERR -12 |
| #define | CDEV_ALLOC_ERR -13 |
| #define | GROUP_EXISTS -14 |
| #define | IOCTL_INSTALL_GROUP _IOW('X', 99, group_t*) |
| #define | IOCTL_GET_GROUP_ID _IOW('X', 100, group_t*) |
| #define | D_DEV_NAME "main_thread_synch" |
| #define | D_DEV_MAJOR (0) |
| #define | D_DEV_MINOR (0) |
| #define | D_DEV_NUM (1) |
| #define | CLASS_NAME "thread_synch" |
| #define | GRP_MIN_ID 0 |
| #define | GRP_MAX_ID 255 |
Functions | |
| int | mainInit (void) |
| Kernel Module Init. More... | |
| void | mainExit (void) |
| Kernel Module Exit. More... | |
| void | initializeMainDevice (void) |
| Init Main Device members. More... | |
| int | installGroup (const group_t new_group) |
| Install a group for the provided 'group_t' descriptor. More... | |
Variables | |
| struct class * | group_device_class |
Handles all procedures releated to the main synch device file.
| #define ALLOC_ERR -2 |
Returned when a 'kmalloc' fails
| #define CLASS_EXISTS -10 |
Returned when the class name already exists
| #define CLASS_NAME "thread_synch" |
Main device class name
| #define D_DEV_MAJOR (0) |
Main device major#
| #define D_DEV_MINOR (0) |
Main device minor#
| #define D_DEV_NAME "main_thread_synch" |
Main device name
| #define D_DEV_NUM (1) |
Number of main device
| #define GRP_MAX_ID 255 |
Group's max ID
| #define GRP_MIN_ID 0 |
Group's min ID
| #define IDR_ERR -4 |
Returned when the IDR fails
| #define MEM_ACCESS_ERR -5 |
Returned when 'access_ok' fails
| #define USER_COPY_ERR -3 |
Returned when copy_to_user/copy_from_user fails
| void initializeMainDevice | ( | void | ) |
Init Main Device members.
| nothing |
| nothing |
| int installGroup | ( | const group_t | new_group_descriptor | ) |
Install a group for the provided 'group_t' descriptor.
| [in] | new_group_descriptor | The group descriptor |
| The | installed group's ID |
| ALLOC_ERR | if some memory allocation fails |
| IDR_ERR | If the IDR fails to allocate the ID |
| void mainExit | ( | void | ) |
Kernel Module Exit.
| nothing |
| nothing |
| int mainInit | ( | void | ) |
Kernel Module Init.
| nothing |
| 0 | success |
| CLASS_EXISTS | if the class already exists |
| others | failure |
1.8.17