1,482 questions
0
votes
0
answers
30
views
Re-opening a file from handle in a cross platform way
Consider a situation where you have a file handle and would like to open a new file handle from it. You might want to do this because you need different access rights, or perhaps you want the two ...
0
votes
0
answers
118
views
File descriptor creation in Linux takes considerable time to execute at 256/512 values
File-descriptor creation in Linux takes considerable time at 256 and 512 values (~5 to ~15ms on my laptop). Otherwise it finishes avg. in <2us.
Also I noticed this problem happens only if its ...
1
vote
1
answer
82
views
Python Request Session throws connection errors after exactly six hours
TLDR: Python request session transmits data to API successfully for six hours and then suddenly only receives ConnectionErrors. Rate limits and other basic errors shouldn't be the issue as the ...
0
votes
1
answer
68
views
Python Requests with stream=True not working as supposed when using pipe mechanic. Trying to get distant video duration
I am trying to know the duration of a distant video file (say mp4).
I know already how to get the duration of a local video file:
import xml.etree.ElementTree as eltt, subprocess as spr
def ...
3
votes
1
answer
74
views
How to have foreground tasks logged to stdout and a logger, background tasks only to the logger?
I'm trying to achieve the following:
A script shall echo some strings and execute some fast returning commands and I want to see all it's stderr and stdout output on stdout and in syslog (using ...
1
vote
1
answer
100
views
can starvation happen due to select serving few fd while other fd starve?
Here is the scenario,
one server handling multiple clients using select()
few of the fds are very active(there are very much data coming on few) while other are normal active.
Then will other fds ...
3
votes
1
answer
105
views
How to show which instance has the file descriptor of a specific file in Java
Background
I am writing a web application on Windows. This application consists of two or more WARs.
These WARs make temporary files in processing.
Problem
In program testing, I've found a ...
1
vote
0
answers
100
views
Application is leaking event handle after calling syscalls on Windows
I have a go application that calling the Windows Management Infrastructure (MI).
After some amount of time, I notice that the amount of handle is quite high. I inspect the process with the handles ...
2
votes
1
answer
254
views
How to prevent a SIGABRT from event_base_new() when "Too many files open"
We're using libevent 1.4.14.
In our production environment, we've found that our process crashes with a SIGABRT from libevent when the host runs out of a file descriptors.
Consider the following
#...
0
votes
1
answer
226
views
read() after write() does not read what I just wrote [closed]
I am learning to deal with files in C. Now i try to use read() and write() correctly. So I wrote the following code:
#include <stdio.h>
#include <fcntl.h>
int main(){
[...]
write(...
1
vote
1
answer
116
views
Problem extracting a line from a buffer readed from a file descriptor
Well, i am trying to create a program that reads from a file descriptor piece by piece (defined as BUFFER_SIZE), until it finds a '\n' or the EOF. The problem its i am getting stuck in a infinite loop,...
0
votes
0
answers
131
views
Python's ioctl function returns FileNotFoundError: [Errno 2] No such file or directory while the C function with the same args succeeds
I am creating a driver for an existing python library with a device that communicates via ioctl. The vendor of the device provided some sample C code that I have been using for reference but I am ...
1
vote
2
answers
622
views
Are additional changes necessary for worker_rlimit_nofile to take effect?
We have an Ubuntu server with Nginx.
ulimit -n returns 1024 and in /etc/nginx/nginx.conf there are the following settings:
user www-data;
worker_processes auto;
events {
worker_connections 1024;
}...
0
votes
0
answers
62
views
Restoring stdin after dup2 without using fflush is inconsistent
I am trying to understand how duping works in c. I tried to save the file descriptor to stdin so it can be recovered then used dup2 to use file in.txt as input and then use dup2 to return stdin to its ...
0
votes
1
answer
172
views
Poll for data written to a file descriptor
Suppose we have a file descriptor for a TCP socket. Is there a way to poll for data written to a socket (as opposed to data being available for reading, or the socket being available for writing)? i.e....
0
votes
2
answers
959
views
AWS Lambda: IOException: Too many open files
I deployed an AWS Lambda written in C#, and depending on the input I can see in the console the following error message (truncated):
{
"Cause": "{\n \"errorType\": \"...
1
vote
1
answer
89
views
initializing buttons on beaglebone black
I have code to initialize GPIO and read the button state value from a file descriptor. I only have 3 buttons.The code is very simple. first I initialize 3 gpio and configure them to output. then I ...
0
votes
0
answers
230
views
Does Open file descriptors on windows incur a performance cost
I am building a high performance application that streams data in from ~1000 different sources of on disk data (aka files) on demand on windows.
To minimize latency, I was looking into keeping all ...
2
votes
1
answer
229
views
Can we close file descriptors 3 and 4? I'm having trouble with it
I am facing challenges with managing file descriptors in my C program, specifically in the context of my Pipex project. Upon program exit, Valgrind reports that 5 file descriptors are open, with 3 ...
1
vote
0
answers
256
views
Monitor file for read availability using asyncio on Windows
Using asyncio's add_reader() method on Unix systems, I can easily monitor file descriptors, such as pipes, for read availability and invoke a callback once the file is available for reading.
For ...
0
votes
1
answer
1k
views
How to read an open file through a file descriptor from proc?
I'm trying to learn how to work with proc and file descriptors. I want to start a process that opens a file, read the same file in parallel through a file descriptor from proc.
I tried to do this:
#!/...
1
vote
1
answer
125
views
When does the kernel decide to have multiple vnode entries for a single file?
I found this code here and have several follow up questions.
#include <fcntl.h>
int main()
{
// have kernel open two connection to file alphabet.txt which contains letters from a to z
int ...
1
vote
1
answer
42
views
process multiple file descriptors from 1 command into multiple commands
I would like to do:
cat a.txt |\
awk '{
if ($1>0) {
print $0
} else {
print $0 | "cat 1>&3"
}
}' 1>(awk '{print $0"positive"}') 3>(awk '{[print $...
0
votes
2
answers
91
views
How can I get the name of the three reserved file descriptors?
I am doing a project for my school where I have to build a shell.
The thing is when I got to do the "open [file] [mode]" command for my shell, I have to keep a list of the opened files with ...
0
votes
1
answer
79
views
How to get FD on datagram socket?
Before java 17, we could get the FD on a datagram socket like below trick with reflection, in order to set a socket option for SO_PORTREUSE using a kernel API. But the implementation changed in ...