Questions tagged [posix]
POSIX (Portable Operating System Interface) is a set of standards defining programming APIs, a command interpreter, and common utilities for Unix-like operating systems.
5,988
questions
0
votes
0
answers
9
views
Prevent Spam by Modify Events Java.NIO.WatchService
I am currently working on an application which deals with the Java.NIO-API, in particular the WatchService. My problem now is that the application is being deployed on debian 9 systems which still ...
0
votes
0
answers
8
views
How do i solve the following state machine using signals and posix
The system has four processess, P!,P2,P3, and P4. P2 and p# will execute the following taks upon completion of one after the other. P4 will verify and acknowlefe the completion of p2 and p3 and assign ...
0
votes
0
answers
21
views
How does kernel sharing work in a dual-OS infotainment system?
I am interested in learning more about the architecture and design of an infotainment system that runs two different operating systems, such as Posix and Android, on the same hardware. How do they ...
0
votes
1
answer
28
views
Why does a joinable thread terminate before pthread_join?
The documentation for the pthread_join function says:
Failure to join with a thread that is joinable (i.e., one that is
not detached), produces a "zombie thread".
As far as I understand ...
0
votes
1
answer
13
views
Why can't we get the thread termination code from the detached thread?
My question is strange, but that's what it is. My question: Is there any explanation why the posix threads developers did not make it possible to get the exit code from a detached thread?
I understand ...
-2
votes
0
answers
27
views
POSIX messages queues "mq_open: Invalid argument"
I am new to C and trying to understand message queue but I can't understand why when I try to open this message queue is gives me the error "Invalid argument". I know the arguments of ...
0
votes
1
answer
16
views
Cannot coerce column to be the same date time type in R
> class(report_df$LASTACTIVITYDATE)
[1] "POSIXct" "POSIXt"
Because there are the mixed data types of POSIXct and POSIXt I cannot process my data correctly.
Issue is happening ...
0
votes
0
answers
29
views
"read" command does not wok in /bin/sh script
I need to read output of one command into variables. Here is simplified examle:
#!/bin/sh
echo AAA BBB | read X Y
echo $X
this echos empty string.
Whereas when i use /bin/zsh as shell, it works as ...
0
votes
0
answers
52
views
How can script command line arguments be parsed portably?
I have a script that I use to take screenshots. It runs maim in the background and provides a more convenient interface than just running the command by itself (much less to type, simpler, mnemonic ...
0
votes
2
answers
43
views
Create start and end date of a calendar year
I would like to create the start and end date of a calendar year from a calendar year variable (here 1991 to 2001), and found a solution:
library(lubridate)
library(dplyr)
df <- tibble(...
0
votes
1
answer
22
views
Process run via posix_spawn() results in defunct process immediately
Thank you in advance.
When I try to launch a cli-based music player via bash, all is well and the player (mplayer) works with a simple path passed on the command line (/home/pi/Music/*).
However, when ...
4
votes
1
answer
87
views
Can I trust shell's `read` to not buffer input?
seq 99999 | (head -n2; cat) | head -n5
1
2
1861
1862
In the above example, head -n2 reads much more than two lines, so cat misses out on them.
Using read does not have this problem:
seq 99999 | (...
2
votes
1
answer
23
views
how to determine currency symbol of current locale in POSIX shell script?
ahoy all.
while finding a few answers related to determining the locale's decimal separator (AKA radix point, thousands separator) in a shell script, the only answers that i have found related to ...
0
votes
1
answer
30
views
POSIX Regex to capture up to x number of occurrences
I am using POSIX regex and trying to capture all occurrences of a given pattern in the string.
The string is
N2800 W08700-N2730 W08430-N2645 W08415-N2500 W08630-N2430>>W08900-N2630 W08845-N2800 ...
0
votes
0
answers
12
views
Redirect zephyr LOGS statements to host stderr
When executing a zephyr app like a native_posix application is it possible
to have LOG statement redirected to stderr, while printk statements goes to stdout ?
0
votes
1
answer
61
views
POSIX semaphore across 32 and 64 bits processes
I'm trying to synchronize 2 processes with a semaphore. One process is 32bits, the second is 64bits.
Under windows, I use CreateSemaphoreA, WaitForSingleObject and ReleaseSemaphore API. It works well....
0
votes
0
answers
19
views
Preserving backslashes when reading from a variable in a posix script
I was hoping someone might be able to please lead me on the right path using POSIX script... I've got a variable that contains a network path UNC. When I refer to this variable, it chops the ...
2
votes
1
answer
54
views
Why can waitpid(2) specify a non-child process?
I checked the man page for waitpid, but the ERROR section indicates:
ECHILD (for waitpid() or waitid()) The process specified by pid (waitpid()) or idtype and id (waitid()) does not exist or is not ...
0
votes
0
answers
30
views
Shared memory condition variable block after process crash
I'm running some process with POSIX cond var on shared memory, orig question: boost-ipc-condition-variable-blocks.
I run 2, 3 or 4 processes and if one of them stops, the other two get block on the ...
1
vote
2
answers
56
views
Read blocks indefinitely on external SSD
I'm trying to read data from a faulty external SSD to create an image for data recovery. The drive is an Apacer Panther SSD connected to a USB port via an ICY BOX SATA to USB connector on Ubuntu.
...
0
votes
2
answers
71
views
What Happens to POSIX File Lock When the Underlying File is Overwritten
Title says it all. Suppose I have a file which multiple processes want to modify using my library. A traditional means of preventing corruption is to use flock or similar to place an advisory lock ...
0
votes
0
answers
42
views
ThreadPool implementation in C is at same performance or slower when compared to non parallelized code
I've been working on implementing a ThreadPool in C to optimize the processing of my program, which involves various tasks related to neural network linear algebra. However, I'm encountering ...
0
votes
1
answer
50
views
Win32 API equivalent to POSIX fpathconf()?
Does the Win32 API have an equivalent to POSIX fpathconf(), for example to figure out what the maximum length of a file name can be for a specific mounted filesystem? Or whether the filesystem for a ...
1
vote
0
answers
107
views
POSIX - rebuild multiline strings with awk and feed them to xargs
I have a file where each record starts with ./ and has a superfluous linefeed at the end:
./a
b/
./c
d"
./
e
f
/
./
g
h'
What I want to do is:
1. rebuild the records that don't end with /
2. ...
0
votes
0
answers
45
views
Shared memory error - cannot map an existing or recently created shared memory
I'm implementing a shared memory to do IPC between 2 processes in Linux Ubuntu.
The idea is to try to get to an existing shared memory. If not found, create it.
After that, adjust the shared memory to ...
0
votes
1
answer
98
views
Which socket accept() errors are fatal?
I am writing a TCP server program in C++ using Boost.Asio, which uses POSIX sockets under the hood in Linux. I have everything working with a loop that continually accepts new connections and spawns ...
0
votes
2
answers
71
views
For every environment variable, create an environment variable with the base64 encoded value
For certain environment variables (*_PASSWORD), I want to create a second environment variable containing a base64 encoded copy of that variable (*PASSWORD_B64). I have a working solution for bash, ...
-1
votes
2
answers
32
views
'open' called with O_CREAT or O_TMPFILE, but missing mode
On Linux I open a file with the following code:
auto file = ::open("file.dat", O_RDWR | O_CREAT);
but when I try to compile this code for Android (android-ndk-r26-beta2) I get the following ...
0
votes
1
answer
90
views
Why call tcsetattr() with termios->c_cflag |= PARENB, will return -1 with errno is EINVAL?
I'm studying Linux TTY. And there is a phenomenon that I cannot understand:
Set PARENB into c_cflag , tcsetattr() will return -1 with errno is EINVAL.
Why PARENB can cause EINVAL? Where return -1.
I ...
0
votes
1
answer
42
views
Creating Message Queue with the help of threads
I am learning about creating threads and how they interact with each other, so I thought to create a simple message queue.
The model I am following is this:
Now I am kinda stuck on an issue I am ...
2
votes
0
answers
71
views
Why `wait $PID` returns immediately after SIGTERM signal is received, and not after $PID has actually terminated
I have a use-case where a shell script runs a child process, and should propgate any Termination Singals (SIGINT, SIGTERM, and SIGQUIT) to the child process and wait for its termination, then ...
0
votes
0
answers
22
views
15 minute groups for logons instead of hour
I have some code to take unit log ons and log offs by hour and group them so that I can see how many units are logged in by hour and division.
Code is as follows:
rm(list = ls())
library(dplyr)
...
2
votes
2
answers
82
views
Is the use of regex here POSIX compliant and is the code used appropriate for the problem described?
Following from my previous question here, please see below a fuller form of my question.
Code use case
The current code is a module for use in polybar, a customisable status bar. As per the first link,...
0
votes
0
answers
54
views
POSIX Yacc does not support
I have this makefile:
CC = gcc
CFLAGS = -Wall -Wno-yacc
BISON = /usr/bin/bison
OBJ = pasc200.tab.c lex.yy.c hashtbl.o semantic.o types.o ast.o
pasc200: lex.yy.c pasc200.tab.c pasc200.tab.h hashtbl.o ...
0
votes
1
answer
43
views
Check whether string contains emoji in POSIX if statement
I have written a shell script that outputs a modified time, according to UTC. At present, my if statements to grab and alter the hour are as follows:
if [[ "$emoji" =~ \.☁ ]];
then
...
0
votes
1
answer
40
views
How does this python regular expresssion work? [duplicate]
I don't understand the result of this python regular expression "re.match("([abc])+", "abc")".
Can anybody explain how this regex works step by step?
import re
m = re....
0
votes
0
answers
30
views
Bash function to check if string A starts with string B [duplicate]
I'm currently refreshing my shell scripting and trying to write a function which checks if string arg1 starts with string arg2.
Following code always prints the opposite result, but I can't find my ...
1
vote
2
answers
112
views
Can we add attributes to standard function declarations without breaking standard?
I wonder if adding attributes to a C method will break standard compliance or not.
Because in glibc 2.38, a nonnull attribute is added to fclose() and freopen() like this:
extern int fclose (FILE *...
0
votes
0
answers
8
views
UNIX Terminal: Replace text inside of a printed string without clearing the rest of the line
I have written "Hello world" to the standard output.
I print the ESC[{y};{x}f to put the cursor where the letter w is.
I print b.
What I get is Hello b.
I'd like to get a Hello borld, or ...
0
votes
1
answer
43
views
setlocale in C Does Not Effect Error Message Strings Given By strerror
I want to print error messages in Turkish on Mint Linux which is running on VMware Workstation 17 Player by strerror and fprintf. To do that, I try to call setlocale with necessary arguments as shown ...
0
votes
0
answers
36
views
Convert PCRE2 to Extended POSIX RE, do I really require lazy?
I have written the following regex:
^project\(.+?version\s*:\s*'(.+?)'.*\)$
The first capture group will grab 0.9.20 from the following block of text:
project(
'waybar', 'cpp', 'c',
version: '...
3
votes
1
answer
429
views
iOS Simulator Error: NSPOSIXErrorDomain Code 3 - No such process
Details: Simulator device returned an error for the requested operation. Domain: NSPOSIXErrorDomain Code: 3 Failure Reason: No such process User Info: { DVTErrorCreationDateKey = "2023-07-31 ...
1
vote
1
answer
40
views
time conversion in R using the timevis package
In the following I have a shiny app which add an item to timeline using timevis package. The problem is when user add the first item everything is fine, as soon as user tries to add more item, the ...
1
vote
0
answers
45
views
Unable to intercept Page Up/Down keys
I am here on a tutorial to build a text editor.
I'm finding that on my macOS (also tested on a Linux VM on the machine -- and it works properly there), even with raw mode enabled, I'm unable to ...
1
vote
1
answer
49
views
Date - time issue on timevis in shiny app in R
I have a shiny app which I would like to use the timevis package for Gantt chart :
library(timevis)
library(shiny)
ui <- fluidPage(
textAreaInput("addText", "Add item:", &...
0
votes
0
answers
23
views
Linux 22 posix shared memory for ipc between python and c++/unreal sigbus errors
In an existing project I've started to help work on that has worked fine in the past, we're using posix shared memory for ipc between python and c++ code for Unreal Engine 4.27.
Recently the code ...
1
vote
0
answers
44
views
ftruncate return invalid argument when called twice on OSX on shared memory [duplicate]
This code seems to run fine on linux but fail on OSX Ventura 13.3.1:
#include <iostream>
#include <unistd.h>
#include <string.h>
#include <sys/mman.h>
#include <sys/types.h&...
0
votes
0
answers
38
views
Auto-translation of newline character in the terminal
I'm following along here.
I notice (this is not complete, just for demonstration) that at this point:
#include <termios.h>
raw.c_iflag &= ~(ICRNL | IXON);
raw.c_oflag &= ~(OPOST);
...
1
vote
0
answers
72
views
Why do I get Operation Not Permitted for Files.setPosixFilePermissions?
I have a java function in my springboot application where I am trying to set 777 POSIX permissions to all the folders and sub folders in my NAS path.
@Async
@EventListener(...
1
vote
1
answer
75
views
C, get resource values in UNIX environment
In "Advanced programming in the UNIX environment", in Figure 7.16, in pr_limits function, the following two lines are written to show resource limit.
lim = limit.rlim_max;
printf("%...