Skip to content
Advertisement

Tag: c++

How do you check if a serial port is open in Linux?

How does one check if a serial port is already open in Linux using Posix/C functions? I want to check the status of the serial port to check if the serial port is open or not. I would like to know what methods work for: Checking the file descriptor to see if the serial port is open and Checking the

Segmentation Fault on pthread_create

I am having an issue with the following C code. The code itself is supposed to create 5 threads that simulate the Dining Philosophers problem in which threads are accessing shared data. The code follows: I am on a Linux virtual machine, using gedit. The program compiles fine, but upon attempting to run it, I am getting a “Segmentation Fault”

IPv6 multicast interface selection

The setsockopt way to select an interface for the outgoing traffic with IPv4 is IP_MULTICAST_IF, which accepts two arguments. From the ip(4) manual page: Set the local device for a multicast socket. The argument for setsockopt(2) is an ip_mreqn or (since Linux 3.5) ip_mreq structure similar to IP_ADD_MEMBERSHIP, or an in_addr structure. When trying to do the analogous operation with

fopen() returns inavlid argument when writing on SD card?

I’m trying to write a file on SD card if it’s inserted into the kit. Otherwise, the file should be written to the current directory of the project. I can write the file in the project’s directory without any problems. However, when I try to write it on the inserted SD card, it returns Invalide argument! I tried changing the

Are BIGNUM BN_ functions deprecated in openssl 1.1?

I was compiling some ‘C’ code that uses openssl under Fedora 27 (version 1.1.0g-1). I made some needed changes (from the 1.0.2 version of my code) and things now compile o.k. again. I then tried to compile with the option “OPENSSL_API_COMPAT=0x10100000L” which I understand causes the compiler to not include APIs deprecated in openssl version 1.1. Now, my code won’t

How to log to /var/log/mail.log using rsyslogd?

I am currently playing around with logging under Linux. I have made the following very simple test application (in plain C): This “application” compiles, and when I execute it, it generates an entry in /var/log/syslog, but no entry in /var/log/mail.log and no entry in /var/log/mail.err. Could somebody please explain why? I am using rsyslogd on the test machine; this is

How to find which process owns the named posix semaphore lock? [closed]

Closed. This question needs debugging details. It is not currently accepting answers. Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question. Closed 4 years ago. Improve this question I used named semaphore to synchronize multiple processes in my system. One of

Advertisement