Quote:
Originally Posted by bahhti
but this limit is also per minute. i mean if the limiting system call is passed 1024 then max file system usage will be 1024kn/minute. so i want to call this system call(which sets the variable) every minute and set it to 1024. and i will use this variable in sys_read() to control reading operations.
|
It seams a little confusing.
Do you want to limit the bytes that are read by a process, at all, device or a file opened?
If you want to limit the data transfer then this is right pretty done in the terminal device or any other serial device. Have a look on tty and terminal emulation (VT 100 ...).
maybe you want to read a little about streaming and buffers ?
If you want to limit the bytes read by sys_read() per minute then I think a kernel parameter is the right choice in /proc/sys/kernel. In sys_open() the parameter could be set and manipulated by user app. and sys_read() uses it also a minute process is created (sys_sleep()). If that parameter is not 0 then that process is active and sleeps for a minute and if awake it clears the sys_read() variable bytes_read. Like this sys_read() can compare the limit with the value bytes_read and stop further readings.
If you only want to limit the calls of the sys_read() function then also set a minute process and sys_read() counts and compares its calls and the minute process clears that variable. Think about an error code to implement that apps. wanted to read something give you back the right error (f.e. reading not possible, error was: "To many readings per minute")
bastl