* @brief Opens a communication channel. * * This system call is used to open a communication channel with a specified name and set of flags. * The channel allows for inter-process or inter-thread communication, depending on the underlying system. * The `name` parameter specifies the name of the channel, while the `flags` parameter allows * configuration of the channel's behavior (e.g., read/w
| 4063 | * as improper configuration might lead to access issues, data loss, or undefined behavior. |
| 4064 | */ |
| 4065 | sysret_t sys_channel_open(const char *name, int flags) |
| 4066 | { |
| 4067 | rt_size_t ret = 0; |
| 4068 | char *kname = RT_NULL; |
| 4069 | int len = 0; |
| 4070 | |
| 4071 | len = lwp_user_strlen(name); |
| 4072 | if (len <= 0) |
| 4073 | { |
| 4074 | return -EFAULT; |
| 4075 | } |
| 4076 | |
| 4077 | kname = (char *)kmem_get(len + 1); |
| 4078 | if (!kname) |
| 4079 | { |
| 4080 | return -ENOMEM; |
| 4081 | } |
| 4082 | |
| 4083 | if (lwp_get_from_user(kname, (void *)name, len + 1) != (len + 1)) |
| 4084 | { |
| 4085 | kmem_put(kname); |
| 4086 | return -EFAULT; |
| 4087 | } |
| 4088 | |
| 4089 | ret = lwp_channel_open(FDT_TYPE_LWP, kname, flags); |
| 4090 | |
| 4091 | kmem_put(kname); |
| 4092 | |
| 4093 | return ret; |
| 4094 | } |
| 4095 | |
| 4096 | /** |
| 4097 | * @brief Closes an open communication channel. |
nothing calls this directly
no test coverage detected