mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-03 16:35:06 -05:00
sched: rework file handling API
Replace SCH_*InputFileHandler() functions with more general SCH_*FileHandler(), where events are specified as a new parameter and which will later support other file events, e.g. file ready for ouput and exception. The file handlers have two new parameters: file descriptor and event.
This commit is contained in:
@@ -57,14 +57,13 @@ struct sock_sample {
|
||||
int magic;
|
||||
};
|
||||
|
||||
static void read_sample(void *anything)
|
||||
static void read_sample(int sockfd, int event, void *anything)
|
||||
{
|
||||
struct sock_sample sample;
|
||||
RCL_Instance instance;
|
||||
int sockfd, s;
|
||||
int s;
|
||||
|
||||
instance = (RCL_Instance)anything;
|
||||
sockfd = (long)RCL_GetDriverData(instance);
|
||||
|
||||
s = recv(sockfd, &sample, sizeof (sample), 0);
|
||||
|
||||
@@ -122,7 +121,7 @@ static int sock_initialise(RCL_Instance instance)
|
||||
}
|
||||
|
||||
RCL_SetDriverData(instance, (void *)(long)sockfd);
|
||||
SCH_AddInputFileHandler(sockfd, read_sample, instance);
|
||||
SCH_AddFileHandler(sockfd, SCH_FILE_INPUT, read_sample, instance);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -131,7 +130,7 @@ static void sock_finalise(RCL_Instance instance)
|
||||
int sockfd;
|
||||
|
||||
sockfd = (long)RCL_GetDriverData(instance);
|
||||
SCH_RemoveInputFileHandler(sockfd);
|
||||
SCH_RemoveFileHandler(sockfd);
|
||||
close(sockfd);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user