Skip to content

Tag: io

How much locked memory does io_uring_setup need?

When using io_uring_queue_init it calls io_uring_setup. There’s an ENOMEM returned when there is insufficient amount of locked memory available for the process. A strace will look something like: What is the formula for how much locked memory is required per entry (first argument)? and if possible, base…

Read a file that’s constantly updated (C++)

Let me start with saying that I’m around 3 days old in C++. Ok to the main question, I have a file that spans multiple lines, and I’m trying to print one specific line repeatedly, which is subject to change arbitrarily by some other process. Example file : I’m trying to print the middle line…

getcwd() vs get_current_dir_name()?

Is it better to use getcwd(NULL, 0) or get_current_dir_name() ? What is common practice ? My uninformed guess is that a call to getcwd(NULL, 0) may be a better idea since it is possible that the PWD variable is not set… Answer Is it better to use getcwd(NULL, 0) or get_current_dir_name() ? What is commo…

Piping to File Utility

I am being sent the bytes of thousands files over an interface, and my app must maintain statistics regarding the counts of various files types which it observes (text, HTML, binary, compressed, etc.). I have been using the subprocess module to run the file utility. However, as the scale has increased, I am h…

file descriptor unable to read 1 byte

I’m a beginner in Unix/Linux, just a question on file descriptor, my textbooks asks a question: In most Unix systems, typing ctrl-d indicates EOF on standard input. What happens if you type ctrl-d to the program in Figure 12.6(just a program that use select()) to while it is blocked in the call to selec…

C Linux Pipe Reading Out-of-Order. Missing, and Duplicated Output

I am working on an application that needs to launch arbitrary child processes and read their output while they are running. It might be useful to think of it as a terminal emulator because it has to be able to run child processes many times throughout it’s lifetime and read back their output, and I want…

How can I write a I/O bound C program?

I must write programs that are I/O Bound and that will make my I/O scheduler work like never done before for a Operating Systems homework, but I have no idea how to do it. I’ve tried writing a simple C program that counts the lines of big text files, but it executes too fast and I can’t measure th…

linux read sys call doesnt get EOF

First of all sorry if my English won’t be fluent and clear. I’m working on understanding pipes and communication between processes. I have tried to implement two c programs, the one writes into a certain pipe from what he reads from the standard input and the other one waits until the pipe opens a…