Xenomai  3.1
fd.h File Reference
Include dependency graph for fd.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  rtdm_fd_ops
 RTDM file operation descriptor. More...
 

Functions

int rtdm_open_handler (struct rtdm_fd *fd, int oflags)
 Open handler for named devices. More...
 
int rtdm_socket_handler (struct rtdm_fd *fd, int protocol)
 Socket creation handler for protocol devices. More...
 
void rtdm_close_handler (struct rtdm_fd *fd)
 Close handler. More...
 
int rtdm_ioctl_handler (struct rtdm_fd *fd, unsigned int request, void __user *arg)
 IOCTL handler. More...
 
ssize_t rtdm_read_handler (struct rtdm_fd *fd, void __user *buf, size_t size)
 Read handler. More...
 
ssize_t rtdm_write_handler (struct rtdm_fd *fd, const void __user *buf, size_t size)
 Write handler. More...
 
ssize_t rtdm_recvmsg_handler (struct rtdm_fd *fd, struct user_msghdr *msg, int flags)
 Receive message handler. More...
 
ssize_t rtdm_sendmsg_handler (struct rtdm_fd *fd, const struct user_msghdr *msg, int flags)
 Transmit message handler. More...
 
int rtdm_select_handler (struct rtdm_fd *fd, struct xnselector *selector, unsigned int type, unsigned int index)
 Select handler. More...
 
int rtdm_mmap_handler (struct rtdm_fd *fd, struct vm_area_struct *vma)
 Memory mapping handler. More...
 
unsigned long rtdm_get_unmapped_area_handler (struct rtdm_fd *fd, unsigned long len, unsigned long pgoff, unsigned long flags)
 Allocate mapping region in address space. More...
 
struct rtdm_fd * rtdm_fd_get (int ufd, unsigned int magic)
 
Retrieve and lock a RTDM file descriptor More...
 
int rtdm_fd_lock (struct rtdm_fd *fd)
 
Hold a reference on a RTDM file descriptor More...
 
void rtdm_fd_put (struct rtdm_fd *fd)
 
Release a RTDM file descriptor obtained via rtdm_fd_get() More...
 
void rtdm_fd_unlock (struct rtdm_fd *fd)
 
Drop a reference on a RTDM file descriptor More...
 
int rtdm_fd_select (int ufd, struct xnselector *selector, unsigned int type)
 
Bind a selector to specified event types of a given file descriptor More...
 

Detailed Description

operation handlers

Function Documentation

◆ rtdm_fd_get()

struct rtdm_fd* rtdm_fd_get ( int  ufd,
unsigned int  magic 
)


Retrieve and lock a RTDM file descriptor

Parameters
[in]ufdUser-side file descriptor
[in]magicMagic word for lookup validation
Returns
Pointer to the RTDM file descriptor matching ufd. Otherwise:
  • ERR_PTR(-EADV) if the use-space handle is either invalid, or not managed by RTDM.
  • ERR_PTR(-EBADF) if the underlying device is being torned down at the time of the call.
Note
The file descriptor returned must be later released by a call to rtdm_fd_put().
Tags
unrestricted

◆ rtdm_fd_lock()

int rtdm_fd_lock ( struct rtdm_fd *  fd)


Hold a reference on a RTDM file descriptor

Parameters
[in]fdTarget file descriptor
Note
rtdm_fd_lock() increments the reference counter of fd. You only need to call this function in special scenarios, e.g. when keeping additional references to the file descriptor that have different lifetimes. Only use rtdm_fd_lock() on descriptors that are currently locked via an earlier rtdm_fd_get()/rtdm_fd_lock() or while running a device operation handler.
Tags
unrestricted

◆ rtdm_fd_put()

void rtdm_fd_put ( struct rtdm_fd *  fd)


Release a RTDM file descriptor obtained via rtdm_fd_get()

Parameters
[in]fdRTDM file descriptor to release
Note
Every call to rtdm_fd_get() must be matched by a call to rtdm_fd_put().
Tags
unrestricted

◆ rtdm_fd_select()

int rtdm_fd_select ( int  ufd,
struct xnselector *  selector,
unsigned int  type 
)


Bind a selector to specified event types of a given file descriptor

This function is invoked by higher RTOS layers implementing select-like services. It shall not be called directly by RTDM drivers.

Parameters
[in]ufdUser-side file descriptor to bind to
[in,out]selectorSelector object that shall be bound to the given event
[in]typeEvent type the caller is interested in
Returns
0 on success, otherwise:
  • -EBADF is returned if the file descriptor ufd cannot be resolved.
  • -EINVAL is returned if type is invalid.
Tags
task-unrestricted

◆ rtdm_fd_unlock()

void rtdm_fd_unlock ( struct rtdm_fd *  fd)


Drop a reference on a RTDM file descriptor

Parameters
[in]fdTarget file descriptor
Note
Every call to rtdm_fd_lock() must be matched by a call to rtdm_fd_unlock().
Tags
unrestricted