Hot answers tagged

16

Because the nc command inside <(...) will also read from stdin. Simpler example: $ nc -l 9999 >/tmp/foo & [1] 5659 $ echo text | cat <(nc -N localhost 9999) - [1]+ Done nc -l 9999 > /tmp/foo Where did the text go? Through the netcat. $ cat /tmp/foo text Your program and nc compete for the same stdin, and nc gets some ...


5

You should set your signal handler using sigaction(2) instead of signal(2), and set SA_RESTART in sa_flags if you don't want it to interrupt a blocking system call. struct sigaction sa; sa.sa_handler = your_handler; sa.sa_flags = SA_RESTART; sigemptyset(&sa.sa_mask); sigaction(SIGUSR1, &sa, 0); Or, even better than that, just handle the interrupt ...


4

No, they aren't exact copies. If you care to investigate, you'll find that the files at the top level /usr/include will normally have a lot of #ifdefs or other conditionals, and they'll only define the architecture-independent parts and will #include other stuff from architecture-specific directories deeper within the hierarchy. As some architecture-...


3

epoll() or poll() returning with E/POLLIN will only tell you that a single read() may not block. Not that you will be able to do a lot of one byte read()s up to a newline, as you do. I say may because a read() after epoll() returned with E/POLLIN may still block. Your code will also try to read past EOF, and completely ignores any read() errors.


2

NOTE: First information regarding this is, there is seemingly an open issue related to cmake. Therefore this can be considered as an indirect solution to achieve the same. Now follow the illustration using cmake. test.cpp #include <stdio.h> void sayHello (char *tag) { printf("%s: Hello!\n", tag); } ...


2

Alright I found out what was the problem: When I found out, I had to use g++-multilib I went ahead and searched for that in my package manager (synaptic in my case). That one listed a bunch of versions so I checked what version of g++ I had installed and then I installed the appropriate g++-multilib-package which in my case was the g++-7-multilib. However ...


1

So this code should print the devices I have for sound io. No, it doesn't. It prints the Portaudio devices, which is an abstraction which may or may not resolve to ALSA devices (though today it probably will in the majority of cases). And in particular the Portaudio developers seem to have decided to include only some of the ALSA devices (in particular the ...


1

It seems what you're looking for is the uevent pseudo-file in the /sys sysfs filesystem. By writing commands to that file (such as "remove"), the kernel will forward those to the userspace handler of the device events, which is udevd. So doing the equivalent of the following snippet (using shell for the example) should do what you want, requesting udev ...


1

have you tried to pass your ID from /proc/pid/sessionid to loginctl show-session ID But in my case it shows the sam numbers. someuser@somemachine-test ~ $ cat /proc/self/sessionid 9293 someuser@somemachine-test ~ $ loginctl list-sessions SESSION UID USER SEAT 9293 10002 someuser 1 sessions listed. someuser@somemachine-test ...


1

libstc++.so.6.0.13 and libstdc++.so.0.19 are compatible. See the libstdc++ manual. You should have no problem running your program on the CentOS machine. In general, shared libraries on Linux should follow the following versioning convention: libfoo.so.X.Y.Z, where X is the major number, and Y and Z are minor numbers. When X is incremented, the new version ...


1

My structure was failing to take in account that AMD64 is little-endian ordered, not big-endian.


1

I was having problems last week; it looks like as of 2019-01-23 gcc-5 has been removed from the repositories completely. (See https://tracker.debian.org/pkg/gcc-5) If you really need it I suppose you could compile it from source. I am going to find a way to drop the dependency from my system.


1

Here is piece of my ~/.vim/vimrc configuration file: set cindent " enable specific indenting for C code set cino+=j1,(0,ws,Ws " enable partial c++11 (lambda) support


Only top voted, non community-wiki answers of a minimum length are eligible