| 277 | }; |
| 278 | |
| 279 | rt_err_t lwp_ptmx_init(rt_device_t ptmx_device, const char *root_path) |
| 280 | { |
| 281 | char *device_name; |
| 282 | int root_len; |
| 283 | const char *dev_rel_path; |
| 284 | rt_err_t rc; |
| 285 | |
| 286 | root_len = strlen(root_path); |
| 287 | dev_rel_path = "/ptmx"; |
| 288 | device_name = rt_malloc(root_len + sizeof("/ptmx")); |
| 289 | |
| 290 | if (device_name) |
| 291 | { |
| 292 | /* Register device */ |
| 293 | sprintf(device_name, "%s%s", root_path, dev_rel_path); |
| 294 | rt_device_register(ptmx_device, device_name, 0); |
| 295 | |
| 296 | /* Setup fops */ |
| 297 | ptmx_device->fops = &ptm_fops; |
| 298 | |
| 299 | rt_free(device_name); |
| 300 | |
| 301 | rc = RT_EOK; |
| 302 | } |
| 303 | else |
| 304 | { |
| 305 | rc = -RT_ENOMEM; |
| 306 | } |
| 307 | |
| 308 | return rc; |
| 309 | } |
| 310 | |
| 311 | /* system level ptmx */ |
| 312 | static struct rt_device sysptmx; |
no test coverage detected