lib/ioctl.h
branchstable-1.5
changeset 2703 045624f7f4c3
parent 2433 3bdd7a747fae
equal deleted inserted replaced
2702:c67a3647891d 2703:045624f7f4c3
    31 #ifndef __EC_LIB_IOCTL_H__
    31 #ifndef __EC_LIB_IOCTL_H__
    32 #define __EC_LIB_IOCTL_H__
    32 #define __EC_LIB_IOCTL_H__
    33 
    33 
    34 /*****************************************************************************/
    34 /*****************************************************************************/
    35 
    35 
    36 #ifdef USE_RTDM
       
    37 #include <rtdm/rtdm.h>
       
    38 #else
       
    39 #include <sys/ioctl.h>
    36 #include <sys/ioctl.h>
    40 #endif
       
    41 
    37 
    42 /*****************************************************************************/
    38 /*****************************************************************************/
    43 
    39 
    44 #include "master/ioctl.h"
    40 #include "master/ioctl.h"
    45 
    41 
    46 /*****************************************************************************/
    42 /*****************************************************************************/
    47 
    43 
    48 #ifdef USE_RTDM
    44 /* FIXME : historical code inherited from difference 
    49 
    45            between RTDM ioctl an normal ioctl 
    50 #define ioctl rt_dev_ioctl
    46            -> should ioctl.h be removed ? */
    51 
       
    52 /* rt_dev_ioctl() returns negative error code */
       
    53 #define EC_IOCTL_IS_ERROR(X) ((X) < 0)
       
    54 #define EC_IOCTL_ERRNO(X) (-(X))
       
    55 
       
    56 #else
       
    57 
       
    58 #define ioctl ioctl
       
    59 
    47 
    60 /* libc's ioctl() always returns -1 on error and sets errno */
    48 /* libc's ioctl() always returns -1 on error and sets errno */
    61 #define EC_IOCTL_IS_ERROR(X) ((X) == -1)
    49 #define EC_IOCTL_IS_ERROR(X) ((X) == -1)
    62 #define EC_IOCTL_ERRNO(X) (errno)
    50 #define EC_IOCTL_ERRNO(X) (errno)
    63 
    51 
    64 #include <errno.h>
    52 #include <errno.h>
    65 
    53 
    66 #endif
       
    67 
       
    68 /*****************************************************************************/
    54 /*****************************************************************************/
    69 
    55 
    70 #endif /* __EC_LIB_IOCTL_H__ */
    56 #endif /* __EC_LIB_IOCTL_H__ */
    71 
    57 
    72 /*****************************************************************************/
    58 /*****************************************************************************/