Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Does this concept only apply to terminal drivers (which is what most sites cover) or to any driver in general?

share|improve this question
add comment

2 Answers 2

The terms raw and cooked only apply to terminal drivers. "Cooked" is called canonical and "raw" is called non-canonical mode.

The terminal driver is, by default a line-based system: characters are buffered internally until a carriage return (Enter or Return) before it is passed to the program - this is called "cooked". This allows certain characters to be processed (see stty(1)), such as Cntl-D, Cntl-S, Ctrl-U Backspace); essentially rudimentary line-editing. The terminal driver "cooks" the characters before serving them up.

The terminal can be placed into "raw" mode where the characters are not processed by the terminal driver, but are sent straight through (it can be set that INTR and QUIT characters are still processed). This allows programs like emacs and vi to use the entire screen more easily.

You can read more about this in the "Canonical mode" section of the termios(3) manpage.

share|improve this answer
add comment

The terms get used to describe terminal and disk I/O, but mean different things in each context.

Raw and cooked modes on a terminal device cover processing (character-at-a-time vs. line-at-a-time, there are also a few other differences).

A 'raw' disk device (/dev/rdsk/*) is a character device, and the /dev/dsk/ is a block device. IIRC the main difference is that the block device has kernel buffering, and fine grained control over I/O modes such as direct/mapped I/O can be specified on a raw defice.

A description of raw and cooked tty modes can be found here. A posting about raw vs cooked disk devices can be found here.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.