linuxterminalposixpipe

POSIX limits the number of character acceptable as user input to 4096, how to increase it?


query

I have created a java program that accepts user input (String). The problem is that the terminal is not allowing me to provide an input of size greater that 4096 characters. The problems causing this might be:

  1. POSIX smallest allowable upper limit on argument length(all systems): 4096 Check using the command: xargs --show-limits
  2. Pipe buffer size: 4096 Check using the command: ulimit -a or ulimit -p

Can anyone suggest how can I increase these values? Or how can I increase the number of characters allowed as user input.

I want to accept around 1 mb of data as argument.


Solution

  • As Mali said: stty -icanon in terminal before launching the program... solves the problem..

    POSIX systems support two basic modes of input: canonical and noncanonical (or raw mode).

    In canonical input processing mode, terminal input is processed in lines terminated by newline ('\n'), EOF, or EOL characters. The operating system provides input editing facilities: the ERASE and KILL characters are interpreted specially to perform editing operations within the current line of text.

    In noncanonical input processing mode (raw mode), characters are not grouped into lines, and ERASE and KILL processing is not performed. The granularity with which bytes are read in raw mode is controlled by the MIN and TIME settings (see man termios the VMIN and VTIME value. VMIN specifies the minimum number of bytes before a read returns. VTIME specifies the number of tenths of a second to wait for data to arrive.

    More bascally, in canonical mode, input are accumulated in a buffer (4096) until a \n occured. In raw mode, input is flushed when VMIN or VTIME occured Thanks Mali..