RTC driver: A PID of zero should mean to notify the calling task
This commit is contained in:
parent
b909099f09
commit
8eb7898a91
@ -384,13 +384,23 @@ static int rtc_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
|||||||
|
|
||||||
if (ops->setalarm)
|
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
|
/* Save the signal info to be used to notify the caller when the
|
||||||
* alarm expires.
|
* alarm expires.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
upperinfo->active = true;
|
upperinfo->active = true;
|
||||||
upperinfo->signo = alarminfo->signo;
|
upperinfo->signo = alarminfo->signo;
|
||||||
upperinfo->pid = alarminfo->pid;
|
upperinfo->pid = pid;
|
||||||
upperinfo->sigvalue = alarminfo->sigvalue;
|
upperinfo->sigvalue = alarminfo->sigvalue;
|
||||||
|
|
||||||
/* Format the alarm info needed by the lower half driver */
|
/* 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)
|
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
|
/* Save the signal info to be used to notify the caller when the
|
||||||
* alarm expires.
|
* alarm expires.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
upperinfo->active = true;
|
upperinfo->active = true;
|
||||||
upperinfo->signo = alarminfo->signo;
|
upperinfo->signo = alarminfo->signo;
|
||||||
upperinfo->pid = alarminfo->pid;
|
upperinfo->pid = pid;
|
||||||
upperinfo->sigvalue = alarminfo->sigvalue;
|
upperinfo->sigvalue = alarminfo->sigvalue;
|
||||||
|
|
||||||
/* Format the alarm info needed by the lower half driver */
|
/* Format the alarm info needed by the lower half driver */
|
||||||
|
@ -223,7 +223,7 @@ struct rtc_setalarm_s
|
|||||||
{
|
{
|
||||||
uint8_t id; /* Indicates the alarm to be set */
|
uint8_t id; /* Indicates the alarm to be set */
|
||||||
uint8_t signo; /* Signal number for alarm notification */
|
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 */
|
union sigval sigvalue; /* Data passed with notification */
|
||||||
struct rtc_time time; /* Alarm time */
|
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 id; /* Indicates the alarm to be set */
|
||||||
uint8_t signo; /* Signal number for alarm notification */
|
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 */
|
union sigval sigvalue; /* Data passed with notification */
|
||||||
time_t reltime; /* Relative time in seconds */
|
time_t reltime; /* Relative time in seconds */
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user