From mboxrd@z Thu Jan 1 00:00:00 1970 References: From: Philippe Gerum Message-ID: <681ccdf8-5b7f-e9e2-2047-d789b6e0d10c@xenomai.org> Date: Mon, 6 Feb 2017 14:50:13 +0100 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=gbk Content-Transfer-Encoding: 7bit Subject: Re: [Xenomai] Fw:some API about RT_TASK occur Segmentation fault List-Id: Discussions about the Xenomai project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "dreamtale90@163.com" , "xenomai@xenomai.org" On 02/06/2017 02:30 AM, dreamtale90@163.com wrote: > System configuration: > debian-8.6, 3.18.46-rt50 > Xenomai/mercury v3.0.3 > Build args: --with-core=mercury --enable-smp --enable-pshared > > Now I am need help. Thanks. > > > -------- Forwarding messages -------- > From: "dreamtale90@163.com" > Date: 2017-02-04 12:04:15 > To: xenomai@xenomai.org > Subject: some API about RT_TASK occur Segmentation fault > Hi > During using API about RT_TASK I found some doubt. > 1) rt_task_inquire(RT_TASK * task, RT_TASK_INFO * info ), if info is > NULL will occur Segmentation fault, but in API reference this is valid. > http://www.xenomai.org/documentation/xenomai-3/html/xeno3prm/group__alchemy__task.html#ga53bad6acf5496f8008e594954507dce8 > > 2) After main task called rt_task_shadow(), program will create other > tasks depend on request, but when create second task will occur > Segmentation fault. > Now main task don't call rt_task_shadow(), program will OK. I don't > know why. > > 3) I write a demo which create the same task three times as follows: > #include > #include > #include > RT_TASK task1; > void func(void *arg) > { > printf("enter func ...\n"); > } > int main() > { > rt_task_spawn(&task1, "task1", 0, 80, 0, func, NULL); > sleep(1); > rt_task_spawn(&task1, "task1", 0, 80, 0, func, NULL); > sleep(1); > rt_task_spawn(&task1, "task1", 0, 80, 0, func, NULL); > //rt_task_delete(&task1); > return 0; > } > > When the third time create , program will occur Segmentation fault. > This bug was fixed in the stable branch some time ago: git://git.xenomai.org/xenomai-3.git, branch stable-3.0.x -- Philippe.