diff --git a/include/signal.h b/include/signal.h index 30f97ef687d..18ab6b85c12 100644 --- a/include/signal.h +++ b/include/signal.h @@ -216,6 +216,7 @@ struct siginfo { uint8_t si_signo; /* Identifies signal */ uint8_t si_code; /* Source: SI_USER, SI_QUEUE, SI_TIMER, SI_ASYNCIO, or SI_MESGQ */ + uint8_t si_errno; /* Zero or errno value associated with signal */ union sigval si_value; /* Data passed with signal */ #ifdef CONFIG_SCHED_HAVE_PARENT pid_t si_pid; /* Sending task ID */ diff --git a/sched/pthread/pthread_condtimedwait.c b/sched/pthread/pthread_condtimedwait.c index b9d266a763d..3a3e6f21f7a 100644 --- a/sched/pthread/pthread_condtimedwait.c +++ b/sched/pthread/pthread_condtimedwait.c @@ -1,7 +1,7 @@ /**************************************************************************** * sched/pthread/pthread_condtimedwait.c * - * Copyright (C) 2007-2009, 2013-2014 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2009, 2013-2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -119,6 +119,7 @@ static void pthread_condtimedout(int argc, uint32_t pid, uint32_t signo) info.si_signo = signo; info.si_code = SI_QUEUE; + info.si_errno = ETIMEDOUT; info.si_value.sival_ptr = NULL; #ifdef CONFIG_SCHED_HAVE_PARENT info.si_pid = (pid_t)pid; diff --git a/sched/pthread/pthread_kill.c b/sched/pthread/pthread_kill.c index 7c9609a4d6c..78da939d085 100644 --- a/sched/pthread/pthread_kill.c +++ b/sched/pthread/pthread_kill.c @@ -116,6 +116,7 @@ int pthread_kill(pthread_t thread, int signo) info.si_signo = signo; info.si_code = SI_USER; + info.si_errno = EINTR; info.si_value.sival_ptr = NULL; #ifdef CONFIG_SCHED_HAVE_PARENT info.si_pid = rtcb->pid; diff --git a/sched/sched/sched_waitid.c b/sched/sched/sched_waitid.c index 31a393861d6..ca9054ba880 100644 --- a/sched/sched/sched_waitid.c +++ b/sched/sched/sched_waitid.c @@ -68,11 +68,12 @@ static void exited_child(FAR struct tcb_s *rtcb, FAR struct child_status_s *chil FAR siginfo_t *info) { /* The child has exited. Return the saved exit status (and some fudged - * information. + * information). */ info->si_signo = SIGCHLD; info->si_code = CLD_EXITED; + info->si_errno = OK; info->si_value.sival_ptr = NULL; info->si_pid = child->ch_pid; info->si_status = child->ch_status; diff --git a/sched/signal/sig_kill.c b/sched/signal/sig_kill.c index 956029a693f..21835986023 100644 --- a/sched/signal/sig_kill.c +++ b/sched/signal/sig_kill.c @@ -1,7 +1,7 @@ /************************************************************************ * sched/signal/sig_kill.c * - * Copyright (C) 2007, 2009, 2011, 2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2009, 2011, 2013, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -114,6 +114,7 @@ int kill(pid_t pid, int signo) info.si_signo = signo; info.si_code = SI_USER; + info.si_errno = EINTR; info.si_value.sival_ptr = NULL; #ifdef CONFIG_SCHED_HAVE_PARENT info.si_pid = rtcb->pid; diff --git a/sched/signal/sig_mqnotempty.c b/sched/signal/sig_mqnotempty.c index ee936f02fcf..4fa0196a178 100644 --- a/sched/signal/sig_mqnotempty.c +++ b/sched/signal/sig_mqnotempty.c @@ -1,7 +1,7 @@ /**************************************************************************** * sched/signal/sig_mqnotempty.c * - * Copyright (C) 2007-2009, 2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2009, 2013, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -112,6 +112,7 @@ int sig_mqnotempty(int pid, int signo, void *sival_ptr) info.si_signo = signo; info.si_code = SI_MESGQ; + info.si_errno = OK; #ifdef CONFIG_CAN_PASS_STRUCTS info.si_value = value; #else diff --git a/sched/signal/sig_queue.c b/sched/signal/sig_queue.c index 6e9b1b2ce9f..bc0aa01012c 100644 --- a/sched/signal/sig_queue.c +++ b/sched/signal/sig_queue.c @@ -135,6 +135,7 @@ int sigqueue(int pid, int signo, void *sival_ptr) info.si_signo = signo; info.si_code = SI_QUEUE; + info.si_errno = OK; #ifdef CONFIG_CAN_PASS_STRUCTS info.si_value = value; #else diff --git a/sched/signal/sig_timedwait.c b/sched/signal/sig_timedwait.c index a0abc47d933..18ab5075c4a 100644 --- a/sched/signal/sig_timedwait.c +++ b/sched/signal/sig_timedwait.c @@ -115,6 +115,7 @@ static void sig_timeout(int argc, wdparm_t itcb) { u.wtcb->sigunbinfo.si_signo = SIG_WAIT_TIMEOUT; u.wtcb->sigunbinfo.si_code = SI_TIMER; + u.wtcb->sigunbinfo.si_errno = ETIMEDOUT; u.wtcb->sigunbinfo.si_value.sival_int = 0; #ifdef CONFIG_SCHED_HAVE_PARENT u.wtcb->sigunbinfo.si_pid = 0; /* Not applicable */ diff --git a/sched/task/task_exithook.c b/sched/task/task_exithook.c index 585b897d496..e471e64578b 100644 --- a/sched/task/task_exithook.c +++ b/sched/task/task_exithook.c @@ -1,7 +1,7 @@ /**************************************************************************** * sched/task/task_exithook.c * - * Copyright (C) 2011-2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2011-2013, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -343,6 +343,7 @@ static inline void task_sigchild(gid_t pgid, FAR struct tcb_s *ctcb, int status) info.si_signo = SIGCHLD; info.si_code = CLD_EXITED; + info.si_errno = OK; info.si_value.sival_ptr = NULL; #ifndef CONFIG_DISABLE_PTHREAD info.si_pid = chgrp->tg_task; @@ -394,6 +395,7 @@ static inline void task_sigchild(FAR struct tcb_s *ptcb, info.si_signo = SIGCHLD; info.si_code = CLD_EXITED; + info.si_errno = OK; info.si_value.sival_ptr = NULL; #ifndef CONFIG_DISABLE_PTHREAD info.si_pid = ctcb->group->tg_task; diff --git a/sched/timer/timer_settime.c b/sched/timer/timer_settime.c index 432b6d20680..1145ff77835 100644 --- a/sched/timer/timer_settime.c +++ b/sched/timer/timer_settime.c @@ -100,6 +100,7 @@ static inline void timer_sigqueue(FAR struct posix_timer_s *timer) info.si_signo = timer->pt_signo; info.si_code = SI_TIMER; + info.si_errno = OK; #ifdef CONFIG_CAN_PASS_STRUCTS info.si_value = timer->pt_value; #else