lib/ioctl.h
branchstable-1.5
changeset 2433 3bdd7a747fae
child 2703 045624f7f4c3
equal deleted inserted replaced
2432:f4313f5aba88 2433:3bdd7a747fae
       
     1 /******************************************************************************
       
     2  *
       
     3  *  $Id$
       
     4  *
       
     5  *  Copyright (C) 2006-2012  Florian Pose, Ingenieurgemeinschaft IgH
       
     6  *
       
     7  *  This file is part of the IgH EtherCAT master userspace library.
       
     8  *
       
     9  *  The IgH EtherCAT master userspace library is free software; you can
       
    10  *  redistribute it and/or modify it under the terms of the GNU Lesser General
       
    11  *  Public License as published by the Free Software Foundation; version 2.1
       
    12  *  of the License.
       
    13  *
       
    14  *  The IgH EtherCAT master userspace library is distributed in the hope that
       
    15  *  it will be useful, but WITHOUT ANY WARRANTY; without even the implied
       
    16  *  warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
       
    17  *  GNU Lesser General Public License for more details.
       
    18  *
       
    19  *  You should have received a copy of the GNU Lesser General Public License
       
    20  *  along with the IgH EtherCAT master userspace library. If not, see
       
    21  *  <http://www.gnu.org/licenses/>.
       
    22  *
       
    23  *  ---
       
    24  *
       
    25  *  The license mentioned above concerns the source code only. Using the
       
    26  *  EtherCAT technology and brand is only permitted in compliance with the
       
    27  *  industrial property and similar rights of Beckhoff Automation GmbH.
       
    28  *
       
    29  *****************************************************************************/
       
    30 
       
    31 #ifndef __EC_LIB_IOCTL_H__
       
    32 #define __EC_LIB_IOCTL_H__
       
    33 
       
    34 /*****************************************************************************/
       
    35 
       
    36 #ifdef USE_RTDM
       
    37 #include <rtdm/rtdm.h>
       
    38 #else
       
    39 #include <sys/ioctl.h>
       
    40 #endif
       
    41 
       
    42 /*****************************************************************************/
       
    43 
       
    44 #include "master/ioctl.h"
       
    45 
       
    46 /*****************************************************************************/
       
    47 
       
    48 #ifdef USE_RTDM
       
    49 
       
    50 #define ioctl rt_dev_ioctl
       
    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 
       
    60 /* libc's ioctl() always returns -1 on error and sets errno */
       
    61 #define EC_IOCTL_IS_ERROR(X) ((X) == -1)
       
    62 #define EC_IOCTL_ERRNO(X) (errno)
       
    63 
       
    64 #include <errno.h>
       
    65 
       
    66 #endif
       
    67 
       
    68 /*****************************************************************************/
       
    69 
       
    70 #endif /* __EC_LIB_IOCTL_H__ */
       
    71 
       
    72 /*****************************************************************************/
       
    73