mirror of
https://github.com/apache/nuttx.git
synced 2026-05-23 06:39:01 +08:00
RTC driver: A PID of zero should mean to notify the calling task
This commit is contained in:
+22
-2
@@ -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 */
|
||||
|
||||
@@ -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 */
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user