MCPcopy Index your code
hub / github.com/RT-Thread/rt-thread / lwp_copy_files

Function lwp_copy_files

components/lwp/lwp_syscall.c:3524–3555  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3522}
3523
3524static int lwp_copy_files(struct rt_lwp *dst, struct rt_lwp *src)
3525{
3526 struct dfs_fdtable *dst_fdt;
3527 struct dfs_fdtable *src_fdt;
3528
3529 src_fdt = &src->fdt;
3530 dst_fdt = &dst->fdt;
3531 /* init fds */
3532 dst_fdt->fds = rt_calloc(src_fdt->maxfd, sizeof(void *));
3533 if (dst_fdt->fds)
3534 {
3535 struct dfs_file *d_s;
3536 int i;
3537
3538 dst_fdt->maxfd = src_fdt->maxfd;
3539
3540 dfs_file_lock();
3541 /* dup files */
3542 for (i = 0; i < src_fdt->maxfd; i++)
3543 {
3544 d_s = fdt_get_file(src_fdt, i);
3545 if (d_s)
3546 {
3547 dst_fdt->fds[i] = d_s;
3548 d_s->ref_count++;
3549 }
3550 }
3551 dfs_file_unlock();
3552 return 0;
3553 }
3554 return -RT_ERROR;
3555}
3556
3557sysret_t _sys_fork(void)
3558{

Callers 1

_sys_forkFunction · 0.85

Calls 4

rt_callocFunction · 0.85
fdt_get_fileFunction · 0.85
dfs_file_lockFunction · 0.50
dfs_file_unlockFunction · 0.50

Tested by

no test coverage detected