Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static ssize_t dev_read(struct file *filep, char __user *buffer, size_t len, loff_t *offset){
- unsigned long sent;
- // ...
- pr_err("MYLOGGER: copying from buffer: head=%d, tail=%d, cnt=%d, sent=%lu, access=%lun",
- head, tail, cnt, sent,
- access_ok(VERIFY_WRITE, buffer, sent));
- if(sent >= 1) {
- sent -= copy_to_user(buffer, mybuf + tail, sent);
- pr_err("MYLOGGER: sent %lu bytesn", sent);
- // ...
- }
- // ...
- }
- [ 56.476834] MYLOGGER: device opened
- [ 56.476861] MYLOGGER: reading from buffer
- [ 56.476872] MYLOGGER: copying from buffer: head=5666644, tail=0, cnt=5666644, sent=4096, access=1
- [ 56.476882] MYLOGGER: sent 0 bytes
Add Comment
Please, Sign In to add comment