6,104
questions
2
votes
2
answers
55
views
How to use posix regexp operator for substring match
I'm trying to move from ILIKE to Postgres ~* operator. Tables have bpchar columns (cannot changed). Tried in Postgres 12
create temp table test ( tasudok char(25), nimetus char (100) ) on commit drop ;...
5
votes
1
answer
113
views
Regarding POSIX ERE's new ? repetition modifier
The 2024 version of POSIX specifies the ? repetition modifier. In the published document, it's specified that the ? modifier changes the behavior of its immediately preceeding repetition from matching ...
2
votes
2
answers
53
views
Daylight saving overlap, when casting strings to POSIX in R
I have a file of datetime strings which I read in, with the added information, if it is daylight saving time or not, so for example the format:
"2024-10-27 02:30:00 CEST"
But this time ...
2
votes
0
answers
51
views
Good way to understand if file has been just created rather than modified in Linux
I need a way to learn if a file has been just created (rather than e.g. modified). I do it like this:
const bool isCreated =
((f.atime.tv_sec == f.mtime.tv_sec) &&
...
2
votes
0
answers
45
views
Attempting to write to disk and check the before and after availability of space using statvfs, but I see no change in blocks available
I am using statvfs to monitor my disk space. I run this program and see no changes in the amount of available blocks within my system, but when I run the df command I am able to see that there's disk ...
1
vote
3
answers
73
views
sed - Posix compliant generic multiple insert/appends single command
I'd like to perform multiple inserts/appends in a single sed command that is portable.
In GNU sed, I can do something like:
sed -e '1i hi' -e '$a bye' <(seq 1 10)
I've the found the following works,...
3
votes
2
answers
140
views
Repeated short identical parallel jobs
I have an algorithm that requires many parallel reruns of the same code. The code is short and finishes in less than a microsecond. This will be run millions of times which creates some problems when ...
0
votes
0
answers
25
views
Where should a binary file that must be executed by another program be stored on a UNIX system?
I am writing a program that uses a library which requires that my program be called by a driver which initializes the environment etc first. This is done by passing the path of my executable (or just ...
1
vote
0
answers
100
views
Problem with malloc and shared memory in C
I am trying to put shared_pid_data in shared memory. I need to have a dynamic array, so I use malloc, I also tried using calloc getting the same result. The problem I am encountering is that the data ...
1
vote
1
answer
63
views
File created with fmemopen has no contents after writing
I have some files on disk that I want to read in and concatenate. I don't want to create a new temporary file on disk. So I decided to use fmemopen to read/write to memory and access it using FILE ...
0
votes
1
answer
155
views
comparison operator syntax in posix shell
I'm trying to understand the grammar/syntax of the shell command language (to be able to parse it) and I cannot seem to find where the syntax of the comparison operations is defined.
As an example:
x=...
3
votes
0
answers
118
views
POSIX or Linux-specific method of connecting a readable file descriptor to a writable file descriptor?
I've got a file descriptor, which might've come from a socket, a pipe, or an actual file, that can be read from. I've got another file descriptor (again, might represent a socket or an actual file) ...
0
votes
3
answers
61
views
How can you force a blocked mq_receive call to give up?
I am trying to upgrade a messaging library from SYSV message queues to POSIX message queues. Unlike with SYSV queues, closing and/or deleting a POSIX message queue that is blocked in mq_receive() ...
0
votes
0
answers
70
views
Process synchronisation for different processes not working with 2 semaphores [duplicate]
I am trying to learn process synchronization , I am trying semaphore,to print odd and even numbers alternatively using 2 processes , one process will execute odd function and another process will ...
1
vote
1
answer
73
views
For wrappers around syscalls that retry on EINTR, how many times does retrying make sense?
Often syscalls like write(2), read(2), close(2) et cetera fail due to being interrupted by a signal with the errno value EINTR (say the size of the terminal window changed and SIGWINCH was received), ...