file-descriptor

Assign a pcap_t* File Descriptor to a Chunk of Memory?

强颜欢笑 提交于 2021-01-29 07:06:12
问题 I’ve written a C program which write a valid PCAP file into a malloc’ed chunk of memory: u_char* myPCAP = writePCAP( ... ); The program works wonderfully, and if I write myPCAP to a file, I can read that file in Wireshark and everything. So I know that everything is working. But now, I want to assign myPCAP a pcap_t* file descriptor and pass that FD to another program. (nDPI, for those who are curious.) How could I do this? I was hoping this would work: pcap_t* pcap = fdopen( ((int*)myPCAP),

fcntl(), F_GETFD meaning in UNIX

感情迁移 提交于 2021-01-28 19:10:14
问题 What is the meaning of F_GETFD in fcntl() function in unix ?, From what I understand it should return -1 if there is no file descriptor in the position specified.. If that's true, when would it happen ? when doing close to a file descriptor in that posstion, F_GETFD doesn't return -1 either.. This is a part of a program using F_GETFD and it will not return -1 if I close the x fd (thid fd entered 0 in the fd table since we closed 0 beforehand and did dup(x)): #include <stdio.h> #include

JVM Freeze under high load in longevity tests

跟風遠走 提交于 2021-01-27 04:44:22
问题 Running with JVM: java version "1.7.0_79" Java(TM) SE Runtime Environment (build 1.7.0_79-b15) Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode) OS: CentOS release 6.4 (Final) Jvm Options: -Xmx4g -Xms4g -XX:MaxPermSize=4g -XX:+HeapDumpOnOutOfMemoryError -XX:+PrintClassHistogram -XX:+CMSClassUnloadingEnabled -verbose:gc -XX:+UseG1GC -XX:MaxGCPauseMillis=200 -XX:+DisableExplicitGC Running in an OSGI environment, Aerospike DB, NETTY (NIO) for networking. Ran a weekend longevity

JVM Freeze under high load in longevity tests

做~自己de王妃 提交于 2021-01-27 04:44:16
问题 Running with JVM: java version "1.7.0_79" Java(TM) SE Runtime Environment (build 1.7.0_79-b15) Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode) OS: CentOS release 6.4 (Final) Jvm Options: -Xmx4g -Xms4g -XX:MaxPermSize=4g -XX:+HeapDumpOnOutOfMemoryError -XX:+PrintClassHistogram -XX:+CMSClassUnloadingEnabled -verbose:gc -XX:+UseG1GC -XX:MaxGCPauseMillis=200 -XX:+DisableExplicitGC Running in an OSGI environment, Aerospike DB, NETTY (NIO) for networking. Ran a weekend longevity

JVM Freeze under high load in longevity tests

你离开我真会死。 提交于 2021-01-27 04:42:05
问题 Running with JVM: java version "1.7.0_79" Java(TM) SE Runtime Environment (build 1.7.0_79-b15) Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode) OS: CentOS release 6.4 (Final) Jvm Options: -Xmx4g -Xms4g -XX:MaxPermSize=4g -XX:+HeapDumpOnOutOfMemoryError -XX:+PrintClassHistogram -XX:+CMSClassUnloadingEnabled -verbose:gc -XX:+UseG1GC -XX:MaxGCPauseMillis=200 -XX:+DisableExplicitGC Running in an OSGI environment, Aerospike DB, NETTY (NIO) for networking. Ran a weekend longevity

How to get current offset of stream or file descriptor?

淺唱寂寞╮ 提交于 2021-01-05 13:00:12
问题 In Node.js, is there any way of getting the current offset of a file descriptor or stream? Presently, it is possible to set the offset of a file descriptor, but there seems to be no way to get it. In C, getting the offset of a file stream is done via ftell, and a file descriptor via lseek(fd, 0, SEEK_CUR). Example If a Node.js program needs to check whether there is prior data in a file after opening it in append mode, a call to ftell would help in this case. This can be done in C as follows:

python 2.7 Popen: what does `close_fds` do?

☆樱花仙子☆ 提交于 2020-12-12 00:40:26
问题 I have a web server in Python (2.7) that uses Popen to delegate some work to a child process: url_arg = "http://localhost/index.html?someparam=somevalue" call = ('phantomjs', 'some/phantom/script.js', url_arg) imageB64data = tempfile.TemporaryFile() errordata = tempfile.TemporaryFile() p = Popen(call, stdout=imageB64data, stderr=errordata, stdin=PIPE) p.communicate(input="") I am seeing intermittent issues where after some number of these Popen s have occurred (roughly 64), the process runs