can4linux - the Linux CAN driver
 All Data Structures Files Functions Variables Pages
Macros | Functions
write.c File Reference

Macros

#define pr_fmt(fmt)   KBUILD_MODNAME ": " fmt
 

Functions

ssize_t can_write (struct file *file, const char __user *buffer, size_t count, loff_t *loff)
 size_t write(int fd, const char *buf, size_t count); write CAN messages to the network More...
 

Detailed Description

Author
Heinz-Jürgen Oertel

Function Documentation

ssize_t can_write ( struct file *  file,
const char __user *  buffer,
size_t  count,
loff_t *  loff 
)

size_t write(int fd, const char *buf, size_t count); write CAN messages to the network

Parameters
fdThe descriptor to write to.
bufThe data buffer to write (array of CAN canmsg_t).
countThe number of bytes to write.

write writes up to count CAN messages to the CAN controller referenced by the file descriptor fd from the buffer starting at buf.

Errors

the following errors can occur

  • EBADF fd is not a valid file descriptor or is not open for writing.
  • EINVAL fd is attached to an object which is unsuitable for writing.
  • EFAULT buf is outside your accessible address space.
  • EINTR The call was interrupted by a signal before any data was written.
Returns
On success, the number of CAN messages written are returned (zero indicates nothing was written). On error, -1 is returned, and errno is set appropriately.

References canmsg_t::length.