APLawrence.com -  Resources for Unix and Linux Systems, Bloggers and the self-employed

2004/01/06 not a typewriter


Some material is very old and may be incorrect today

© January 2004 Tony Lawrence

This is the error message (ENOTTY, error 25 on Unix systems) you get if you try to do something that needs a character device to something that isn't. It wouldn't have helped much if it said "Not a character device" instead.

So what's the difference between a block device and a character device? Well, in /dev/, ls -l lists them with a leading "c" or "b" in the perm column:



crw-------  1 root  wheel      23,   0  5 Jan 14:27 bpf0
crw-------  1 root  wheel      23,   1  2 Jan 09:12 bpf1
crw-------  1 root  wheel      23,   2  2 Jan 09:12 bpf2
crw-------  1 root  wheel      23,   3  2 Jan 09:12 bpf3
crw-------  1 apl   staff       0,   0  5 Jan 12:11 console
crw-rw-rw-  1 root  wheel       8,   1  2 Jan 09:12 cu.modem
brw-r-----  1 root  operator   14,   0  2 Jan 09:12 disk0
br--r-----  1 root  operator   14,   1  2 Jan 09:12 disk0s1
brw-r-----  1 root  operator   14,   2  2 Jan 09:12 disk0s2
brw-r-----  1 root  operator   14,   3  2 Jan 09:12 disk0s3
br--r-----  1 root  operator   14,   4  2 Jan 09:12 disk0s4
brw-r-----  1 root  operator   14,   5  2 Jan 09:12 disk0s5
 

but why are there character and block devices? It gets a little confusing because it's quite possible for a device driver to treat physical hardware almost anyway it likes, but the real important differences is what routines get called- a block open gets a buffer allocated by the kernel and that's where its data is, while a (character device) raw read or write is reading or writing user space.

See http://aplawrence.com/Bofcusm/321.html for even more confusion.


If you found something useful today, please consider a small donation.



Got something to add? Send me email.





(OLDER)    <- More Stuff -> (NEWER)    (NEWEST)   

Printer Friendly Version

->
-> not a typewriter


Inexpensive and informative Apple related e-books:

Take Control of Automating Your Mac

iOS 8: A Take Control Crash Course

Take Control of High Sierra

Photos for Mac: A Take Control Crash Course

Digital Sharing Crash Course





More Articles by © Tony Lawrence





Printer Friendly Version

Have you tried Searching this site?

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more.

Contact us


Printer Friendly Version





Being the richest man in the cemetery doesn't matter to me … Going to bed at night saying we've done something wonderful... that's what matters to me. (Steve Jobs)




Linux posts

Troubleshooting posts


This post tagged:

Kernel

UnixWords



Unix/Linux Consultants

Skills Tests

Unix/Linux Book Reviews

My Unix/Linux Troubleshooting Book

This site runs on Linode