]> rtime.felk.cvut.cz Git - lincan.git/blob - lincan/src/fasync.c
Added support for fasync system call and replacement of spinXXX by can_spinXXX
[lincan.git] / lincan / src / fasync.c
1 /* open.c
2  * Linux CAN-bus device driver.
3  * Written by Arnaud Westenberg email:arnaud@wanadoo.nl
4  * Rewritten for new CAN queues by Pavel Pisa - OCERA team member
5  * email:pisa@cmp.felk.cvut.cz
6  * This software is released under the GPL-License.
7  * Version lincan-0.2  9 Jul 2003
8  */
9
10 #include "../include/can.h"
11 #include "../include/can_sysdep.h"
12 #include "../include/main.h"
13 #include "../include/fasync.h"
14
15 #ifdef CAN_ENABLE_KERN_FASYNC
16
17 int can_fasync(int fd, struct file *file, int on)
18 {
19         struct canuser_t *canuser = (struct canuser_t*)(file->private_data);
20         struct canque_ends_t *qends;
21         
22         if(!canuser || (canuser->magic != CAN_USER_MAGIC)){
23                 CANMSG("can_close: bad canuser magic\n");
24                 return -ENODEV;
25         }
26         
27         qends = canuser->qends;
28
29         int retval = fasync_helper(fd, file, on, &qends->endinfo.fileinfo.fasync);
30
31         if (retval < 0)
32                 return retval;
33         return 0;
34 }
35
36
37
38
39
40 #endif /*CAN_ENABLE_KERN_FASYNC*/