LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (https://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   Why the 'N_TTY_BUF_SIZE' is restricted as 4096? (https://www.linuxquestions.org/questions/linux-hardware-18/why-the-n_tty_buf_size-is-restricted-as-4096-a-605107/)

d2e2004 12-06-2007 11:38 PM

Why the 'N_TTY_BUF_SIZE' is restricted as 4096?
 
Hi All,

I have one doubt in linux kernel. I.e. Why the 'N_TTY_BUF_SIZE' is defined as 4096 in 'tty.h' file. I have checked linux kernels from 2.6.10 to 2.6.23 in all these sources the tty buffer size value is defined as 4096. Due to this i couldnt able to read more than 4096 bytes from a serial device which is connected in 'ttyUSB0' using a single read operation.

If any one knows the reason pls share the same.

Thanks.

osor 12-07-2007 05:16 PM

Quote:

Originally Posted by d2e2004 (Post 2982844)
I have one doubt in linux kernel. I.e. Why the 'N_TTY_BUF_SIZE' is defined as 4096 in 'tty.h' file.

Why not? It’s a nice big, round number (4K). There’s nothing inherently “special” about it.
Quote:

Originally Posted by d2e2004 (Post 2982844)
I have checked linux kernels from 2.6.10 to 2.6.23 in all these sources the tty buffer size value is defined as 4096.

It is in fact this way all the way back until kernel 1.1.13 (when the tty line discipline was introduced). Prior to 1.1.13, the equivalent macro was 1024.
Quote:

Originally Posted by d2e2004 (Post 2982844)
Due to this i couldnt able to read more than 4096 bytes from a serial device which is connected in 'ttyUSB0' using a single read operation.

Then use two read operations…

d2e2004 12-08-2007 03:38 AM

Thank you for your response...

why i asked about 4096 means when i changed the value of 'N_TTY_BUF_SIZE' to 8192 then also it works fine and reads 8192 bytes for a single read operation.
whether this change is legal and also whether it will produce any performance degradation?

And also with multiple read operations i couldn't able to read more than 5500 bytes from the device.

so pls specify the feasible option for reading large no of bytes from the device.

Thanks.


All times are GMT -5. The time now is 04:15 AM.