MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / lwp_pgrp_create

Function lwp_pgrp_create

components/lwp/lwp_pgrp.c:88–116  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

86}
87
88rt_processgroup_t lwp_pgrp_create(rt_lwp_t leader)
89{
90 rt_processgroup_t group = RT_NULL;
91
92 /* parameter check */
93 if (leader == RT_NULL)
94 {
95 return RT_NULL;
96 }
97
98 group = rt_malloc(sizeof(struct rt_processgroup));
99 if (group != RT_NULL)
100 {
101 rt_object_init(&(group->object), RT_Object_Class_ProcessGroup, "pgrp");
102 rt_list_init(&(group->process));
103 rt_list_init(&(group->pgrp_list_node));
104 rt_mutex_init(&(group->mutex), "pgrp", RT_IPC_FLAG_PRIO);
105 group->leader = leader;
106 group->sid = 0;
107 group->session = RT_NULL;
108 group->is_orphaned = 0;
109 group->pgid = lwp_to_pid(leader);
110 rt_atomic_store(&group->ref, 1);
111 }
112
113 LOG_I("create(ptr:%p, pgid:%d)() by pid:%d", group, group->pgid, lwp_getpid());
114
115 return group;
116}
117
118#include <terminal/terminal.h>
119

Callers 3

lwp_execveFunction · 0.85
sys_setsidFunction · 0.85
sys_setpgidFunction · 0.85

Calls 6

rt_mallocFunction · 0.85
rt_object_initFunction · 0.85
rt_list_initFunction · 0.85
rt_mutex_initFunction · 0.85
lwp_to_pidFunction · 0.85
lwp_getpidFunction · 0.85

Tested by

no test coverage detected