RTC driver: A PID of zero should mean to notify the calling task

This commit is contained in:
Gregory Nutt 2016-04-08 17:44:24 -06:00
parent b909099f09
commit 8eb7898a91
2 changed files with 24 additions and 4 deletions

View File

@ -384,13 +384,23 @@ static int rtc_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
if (ops->setalarm)
{
pid_t pid;
/* A PID of zero means to signal the calling task */
pid = alarminfo->pid;
if (pid == 0)
{
pid = getpid();
}
/* Save the signal info to be used to notify the caller when the
* alarm expires.
*/
upperinfo->active = true;
upperinfo->signo = alarminfo->signo;
upperinfo->pid = alarminfo->pid;
upperinfo->pid = pid;
upperinfo->sigvalue = alarminfo->sigvalue;
/* Format the alarm info needed by the lower half driver */
@ -447,13 +457,23 @@ static int rtc_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
if (ops->setrelative)
{
pid_t pid;
/* A PID of zero means to signal the calling task */
pid = alarminfo->pid;
if (pid == 0)
{
pid = getpid();
}
/* Save the signal info to be used to notify the caller when the
* alarm expires.
*/
upperinfo->active = true;
upperinfo->signo = alarminfo->signo;
upperinfo->pid = alarminfo->pid;
upperinfo->pid = pid;
upperinfo->sigvalue = alarminfo->sigvalue;
/* Format the alarm info needed by the lower half driver */

View File

@ -223,7 +223,7 @@ struct rtc_setalarm_s
{
uint8_t id; /* Indicates the alarm to be set */
uint8_t signo; /* Signal number for alarm notification */
pid_t pid; /* Identifies task to be notified */
pid_t pid; /* Identifies task to be notified (0=caller) */
union sigval sigvalue; /* Data passed with notification */
struct rtc_time time; /* Alarm time */
};
@ -234,7 +234,7 @@ struct rtc_setrelative_s
{
uint8_t id; /* Indicates the alarm to be set */
uint8_t signo; /* Signal number for alarm notification */
pid_t pid; /* Identifies task to be notified */
pid_t pid; /* Identifies task to be notified (0=caller) */
union sigval sigvalue; /* Data passed with notification */
time_t reltime; /* Relative time in seconds */
};