Xenomai API  2.6.5
Collaboration diagram for User API:

Files

file  rtdm.h
 Real-Time Driver Model for Xenomai, user API header.
 

Functions

int rt_dev_open (const char *path, int oflag,...)
 Open a device. More...
 
int rt_dev_socket (int protocol_family, int socket_type, int protocol)
 Create a socket. More...
 
int rt_dev_close (int fd)
 Close a device or socket. More...
 
int rt_dev_ioctl (int fd, int request,...)
 Issue an IOCTL. More...
 
ssize_t rt_dev_read (int fd, void *buf, size_t nbyte)
 Read from device. More...
 
ssize_t rt_dev_write (int fd, const void *buf, size_t nbyte)
 Write to device. More...
 
ssize_t rt_dev_recvmsg (int fd, struct user_msghdr *msg, int flags)
 Receive message from socket. More...
 
ssize_t rt_dev_recvfrom (int fd, void *buf, size_t len, int flags, struct sockaddr *from, socklen_t *fromlen)
 Receive message from socket. More...
 
ssize_t rt_dev_recv (int fd, void *buf, size_t len, int flags)
 Receive message from socket. More...
 
ssize_t rt_dev_sendmsg (int fd, const struct user_msghdr *msg, int flags)
 Transmit message to socket. More...
 
ssize_t rt_dev_sendto (int fd, const void *buf, size_t len, int flags, const struct sockaddr *to, socklen_t tolen)
 Transmit message to socket. More...
 
ssize_t rt_dev_send (int fd, const void *buf, size_t len, int flags)
 Transmit message to socket. More...
 
int rt_dev_bind (int fd, const struct sockaddr *my_addr, socklen_t addrlen)
 Bind to local address. More...
 
int rt_dev_connect (int fd, const struct sockaddr *serv_addr, socklen_t addrlen)
 Connect to remote address. More...
 
int rt_dev_listen (int fd, int backlog)
 Listen for incomming connection requests. More...
 
int rt_dev_accept (int fd, struct sockaddr *addr, socklen_t *addrlen)
 Accept a connection requests. More...
 
int rt_dev_shutdown (int fd, int how)
 Shut down parts of a connection. More...
 
int rt_dev_getsockopt (int fd, int level, int optname, void *optval, socklen_t *optlen)
 Get socket option. More...
 
int rt_dev_setsockopt (int fd, int level, int optname, const void *optval, socklen_t optlen)
 Set socket option. More...
 
int rt_dev_getsockname (int fd, struct sockaddr *name, socklen_t *namelen)
 Get local socket address. More...
 
int rt_dev_getpeername (int fd, struct sockaddr *name, socklen_t *namelen)
 Get socket destination address. More...
 

Detailed Description

This is the upper interface of RTDM provided to application programs both in kernel and user space. Note that certain functions may not be implemented by every device. Refer to the Device Profiles for precise information.

Function Documentation

int rt_dev_accept ( int  fd,
struct sockaddr *  addr,
socklen_t *  addrlen 
)

Accept a connection requests.

Parameters
[in]fdFile descriptor as returned by rt_dev_socket()
[out]addrBuffer for remote address
[in,out]addrlenAddress buffer size
Returns
0 on success, otherwise negative error code

Environments:

Depends on driver implementation, see Device Profiles.

Rescheduling: possible.

See also
accept() in IEEE Std 1003.1, http://www.opengroup.org/onlinepubs/009695399
int rt_dev_bind ( int  fd,
const struct sockaddr *  my_addr,
socklen_t  addrlen 
)

Bind to local address.

Parameters
[in]fdFile descriptor as returned by rt_dev_socket()
[in]my_addrAddress buffer
[in]addrlenAddress buffer size
Returns
0 on success, otherwise negative error code

Environments:

Depends on driver implementation, see Device Profiles.

Rescheduling: possible.

See also
bind() in IEEE Std 1003.1, http://www.opengroup.org/onlinepubs/009695399
Examples:
rtcanrecv.c, and rtcansend.c.
int rt_dev_close ( int  fd)

Close a device or socket.

Parameters
[in]fdFile descriptor as returned by rt_dev_open() or rt_dev_socket()
Returns
0 on success, otherwise a negative error code.
Note
If the matching rt_dev_open() or rt_dev_socket() call took place in non-real-time context, rt_dev_close() must be issued within non-real-time as well. Otherwise, the call will fail.

Environments:

Depends on driver implementation, see Device Profiles.

Rescheduling: possible.

See also
close() in IEEE Std 1003.1, http://www.opengroup.org/onlinepubs/009695399
int rt_dev_connect ( int  fd,
const struct sockaddr *  serv_addr,
socklen_t  addrlen 
)

Connect to remote address.

Parameters
[in]fdFile descriptor as returned by rt_dev_socket()
[in]serv_addrAddress buffer
[in]addrlenAddress buffer size
Returns
0 on success, otherwise negative error code

Environments:

Depends on driver implementation, see Device Profiles.

Rescheduling: possible.

See also
connect() in IEEE Std 1003.1, http://www.opengroup.org/onlinepubs/009695399
int rt_dev_getpeername ( int  fd,
struct sockaddr *  name,
socklen_t *  namelen 
)

Get socket destination address.

Parameters
[in]fdFile descriptor as returned by rt_dev_socket()
[out]nameAddress buffer
[in,out]namelenAddress buffer size
Returns
0 on success, otherwise negative error code

Environments:

Depends on driver implementation, see Device Profiles.

Rescheduling: possible.

See also
getpeername() in IEEE Std 1003.1, http://www.opengroup.org/onlinepubs/009695399
int rt_dev_getsockname ( int  fd,
struct sockaddr *  name,
socklen_t *  namelen 
)

Get local socket address.

Parameters
[in]fdFile descriptor as returned by rt_dev_socket()
[out]nameAddress buffer
[in,out]namelenAddress buffer size
Returns
0 on success, otherwise negative error code

Environments:

Depends on driver implementation, see Device Profiles.

Rescheduling: possible.

See also
getsockname() in IEEE Std 1003.1, http://www.opengroup.org/onlinepubs/009695399
int rt_dev_getsockopt ( int  fd,
int  level,
int  optname,
void *  optval,
socklen_t *  optlen 
)

Get socket option.

Parameters
[in]fdFile descriptor as returned by rt_dev_socket()
[in]levelAddressed stack level
[in]optnameOption name ID
[out]optvalValue buffer
[in,out]optlenValue buffer size
Returns
0 on success, otherwise negative error code

Environments:

Depends on driver implementation, see Device Profiles.

Rescheduling: possible.

See also
getsockopt() in IEEE Std 1003.1, http://www.opengroup.org/onlinepubs/009695399
int rt_dev_ioctl ( int  fd,
int  request,
  ... 
)

Issue an IOCTL.

Parameters
[in]fdFile descriptor as returned by rt_dev_open() or rt_dev_socket()
[in]requestIOCTL code
...Optional third argument, depending on IOCTL function (void * or unsigned long)
Returns
Positiv value on success, otherwise negative error code

Environments:

Depends on driver implementation, see Device Profiles.

Rescheduling: possible.

See also
ioctl() in IEEE Std 1003.1, http://www.opengroup.org/onlinepubs/009695399
int rt_dev_listen ( int  fd,
int  backlog 
)

Listen for incomming connection requests.

Parameters
[in]fdFile descriptor as returned by rt_dev_socket()
[in]backlogMaximum queue length
Returns
0 on success, otherwise negative error code

Environments:

Depends on driver implementation, see Device Profiles.

Rescheduling: possible.

See also
lsiten() in IEEE Std 1003.1, http://www.opengroup.org/onlinepubs/009695399
int rt_dev_open ( const char *  path,
int  oflag,
  ... 
)

Open a device.

Parameters
[in]pathDevice name
[in]oflagOpen flags
...Further parameters will be ignored.
Returns
Positive file descriptor value on success, otherwise a negative error code.

Environments:

Depends on driver implementation, see Device Profiles.

Rescheduling: possible.

See also
open() in IEEE Std 1003.1, http://www.opengroup.org/onlinepubs/009695399
ssize_t rt_dev_read ( int  fd,
void *  buf,
size_t  nbyte 
)

Read from device.

Parameters
[in]fdFile descriptor as returned by rt_dev_open()
[out]bufInput buffer
[in]nbyteNumber of bytes to read
Returns
Number of bytes read, otherwise negative error code

Environments:

Depends on driver implementation, see Device Profiles.

Rescheduling: possible.

See also
read() in IEEE Std 1003.1, http://www.opengroup.org/onlinepubs/009695399
ssize_t rt_dev_recv ( int  fd,
void *  buf,
size_t  len,
int  flags 
)

Receive message from socket.

Parameters
[in]fdFile descriptor as returned by rt_dev_socket()
[out]bufMessage buffer
[in]lenMessage buffer size
[in]flagsMessage flags
Returns
Number of bytes received, otherwise negative error code

Environments:

Depends on driver implementation, see Device Profiles.

Rescheduling: possible.

See also
recv() in IEEE Std 1003.1, http://www.opengroup.org/onlinepubs/009695399
ssize_t rt_dev_recvfrom ( int  fd,
void *  buf,
size_t  len,
int  flags,
struct sockaddr *  from,
socklen_t *  fromlen 
)

Receive message from socket.

Parameters
[in]fdFile descriptor as returned by rt_dev_socket()
[out]bufMessage buffer
[in]lenMessage buffer size
[in]flagsMessage flags
[out]fromBuffer for message sender address
[in,out]fromlenAddress buffer size
Returns
Number of bytes received, otherwise negative error code

Environments:

Depends on driver implementation, see Device Profiles.

Rescheduling: possible.

See also
recvfrom() in IEEE Std 1003.1, http://www.opengroup.org/onlinepubs/009695399
ssize_t rt_dev_recvmsg ( int  fd,
struct user_msghdr *  msg,
int  flags 
)

Receive message from socket.

Parameters
[in]fdFile descriptor as returned by rt_dev_socket()
[in,out]msgMessage descriptor
[in]flagsMessage flags
Returns
Number of bytes received, otherwise negative error code

Environments:

Depends on driver implementation, see Device Profiles.

Rescheduling: possible.

See also
recvmsg() in IEEE Std 1003.1, http://www.opengroup.org/onlinepubs/009695399
Examples:
rtcanrecv.c.
ssize_t rt_dev_send ( int  fd,
const void *  buf,
size_t  len,
int  flags 
)

Transmit message to socket.

Parameters
[in]fdFile descriptor as returned by rt_dev_socket()
[in]bufMessage buffer
[in]lenMessage buffer size
[in]flagsMessage flags
Returns
Number of bytes sent, otherwise negative error code

Environments:

Depends on driver implementation, see Device Profiles.

Rescheduling: possible.

See also
send() in IEEE Std 1003.1, http://www.opengroup.org/onlinepubs/009695399
Examples:
rtcansend.c.
ssize_t rt_dev_sendmsg ( int  fd,
const struct user_msghdr *  msg,
int  flags 
)

Transmit message to socket.

Parameters
[in]fdFile descriptor as returned by rt_dev_socket()
[in]msgMessage descriptor
[in]flagsMessage flags
Returns
Number of bytes sent, otherwise negative error code

Environments:

Depends on driver implementation, see Device Profiles.

Rescheduling: possible.

See also
sendmsg() in IEEE Std 1003.1, http://www.opengroup.org/onlinepubs/009695399
ssize_t rt_dev_sendto ( int  fd,
const void *  buf,
size_t  len,
int  flags,
const struct sockaddr *  to,
socklen_t  tolen 
)

Transmit message to socket.

Parameters
[in]fdFile descriptor as returned by rt_dev_socket()
[in]bufMessage buffer
[in]lenMessage buffer size
[in]flagsMessage flags
[in]toBuffer for message destination address
[in]tolenAddress buffer size
Returns
Number of bytes sent, otherwise negative error code

Environments:

Depends on driver implementation, see Device Profiles.

Rescheduling: possible.

See also
sendto() in IEEE Std 1003.1, http://www.opengroup.org/onlinepubs/009695399
Examples:
rtcansend.c.
int rt_dev_setsockopt ( int  fd,
int  level,
int  optname,
const void *  optval,
socklen_t  optlen 
)

Set socket option.

Parameters
[in]fdFile descriptor as returned by rt_dev_socket()
[in]levelAddressed stack level
[in]optnameOption name ID
[in]optvalValue buffer
[in]optlenValue buffer size
Returns
0 on success, otherwise negative error code

Environments:

Depends on driver implementation, see Device Profiles.

Rescheduling: possible.

See also
setsockopt() in IEEE Std 1003.1, http://www.opengroup.org/onlinepubs/009695399
Examples:
rtcanrecv.c, and rtcansend.c.
int rt_dev_shutdown ( int  fd,
int  how 
)

Shut down parts of a connection.

Parameters
[in]fdFile descriptor as returned by rt_dev_socket()
[in]howSpecifies the part to be shut down (SHUT_xxx)
Returns
0 on success, otherwise negative error code

Environments:

Depends on driver implementation, see Device Profiles.

Rescheduling: possible.

See also
shutdown() in IEEE Std 1003.1, http://www.opengroup.org/onlinepubs/009695399
int rt_dev_socket ( int  protocol_family,
int  socket_type,
int  protocol 
)

Create a socket.

Parameters
[in]protocol_familyProtocol family (PF_xxx)
[in]socket_typeSocket type (SOCK_xxx)
[in]protocolProtocol ID, 0 for default
Returns
Positive file descriptor value on success, otherwise a negative error code.

Environments:

Depends on driver implementation, see Device Profiles.

Rescheduling: possible.

See also
socket() in IEEE Std 1003.1, http://www.opengroup.org/onlinepubs/009695399
ssize_t rt_dev_write ( int  fd,
const void *  buf,
size_t  nbyte 
)

Write to device.

Parameters
[in]fdFile descriptor as returned by rt_dev_open()
[in]bufOutput buffer
[in]nbyteNumber of bytes to write
Returns
Number of bytes written, otherwise negative error code

Environments:

Depends on driver implementation, see Device Profiles.

Rescheduling: possible.

See also
write() in IEEE Std 1003.1, http://www.opengroup.org/onlinepubs/009695399