|
1d
|
|
comment |
How do I set redirected pipes to be non-buffered so I can use system() multiple times? Also, this is a classic XY problem You need to run a pipeline of subprocesses but you're having problems with that, and you've already decided the solution is to somehow make pipes "unbuffered". |
|
1d
|
|
comment |
How do I set redirected pipes to be non-buffered so I can use system() multiple times? If the pipes don't buffer any data internally, such a deadlock is probably just about inevitable, and likely very quickly, too. |
|
1d
|
|
comment |
How do I set redirected pipes to be non-buffered so I can use system() multiple times? We are asked to make a 3 subprocesses and have a pipe from parent to each child, also have child processes piped as "pipe1 -> pipe2 -> pipe3 -> parent" With a single-threaded parent process, that has a high risk of deadlocking, especially if there is no buffering in the pipes. If each process is single-threaded, if it's blocked trying to write to a full pipe, it won't ever read from its input pipe, eventually blocking the previous process. If the pipe the parent is writing to ever backs up, the parent will never read from the last process in the pipeline. |
|
Feb
25 |
|
comment |
Should I return EXIT_SUCCESS or 0 from main()? Also, I'm not aware of any shell that doesn't consider all non-zero exit values from any process as indication of an error. Try writing a command-line utility that implements "exit value of 1 is success, and 0 is failure" and see how well that goes over. (Hint: run set -e in bash before running that command and see what happens...)
|
|
Feb
25 |
|
comment |
Should I return EXIT_SUCCESS or 0 from main()? The sooner such programmers learn that there is only one way to be completely successful but many, many ways to fail, the better. That's why 0 means success for any well-thought-out scheme as it makes a boolean-style check for success trivial.
|
|
Feb
24 |
|
comment |
New site design and philosophy for Stack Overflow: Starting February 24, 2026 at beta.stackoverflow.com IMO it looks like a stack of books falling over. A "stack over fall", if you will. Seems appropriate. What's that saying about understanding, organizations, and cabals of enemies again? |
|
Feb
24 |
|
answered | How can I check if a returned value is an integer in Java and C? |
|
Feb
24 |
|
answered | How can I check if a returned value is an integer in Java and C? |
|
Feb
24 |
|
comment |
Any good ways to solve recursively header including problem? So, what happens if identical headers show up in your build with different names for some reason? Your "just fine" is a very low standard to write code to. #pragma once is a flawed "Look how smart I am!" oh-so-clever bad solution in search of a problem.
|
|
Feb
23 |
|
comment |
Use zstd compression for a client with Ktor gzip is just deflate with extra metadata and therefore overhead: "The format presently uses the DEFLATE method of compression..." |
|
Feb
23 |
|
comment |
How to strengthen Magicshine 1700 Evo front light mount? The light, on the other hand, sure looks like its CG is not centered under the mount's pivot, as the bulk of the light's body is centered well behind the pivot, and the volume that is in front of the pivot looks to be the empty space in the beam-forming reflector, meaning almost all the mass is behind the pivot. So when vibration pulls up on the mount, the light will rotate its aim upward. Likewise downward motion of the mount will drive the aim point downward. |
|
Feb
23 |
|
comment |
How to strengthen Magicshine 1700 Evo front light mount? @ChrisH Don't discount the differences in behavior to vibration or other types of motion that variations in the moment of inertia and the relative position of the center of gravity of the camera or battery will have. If the camera has its CG is centered under the mount's pivot, it won't have its aim wobble up and down as a response to sudden vertical motion. |
|
Feb
22 |
|
comment |
Many processes writing to a FIFO at the same time And yes, that means Linux violates the POSIX standard by defining PATH_MAX: "A definition of one of the values shall be omitted ... where the value can vary depending on the file to which it is applied ... {PATH_MAX}"
|
|
Feb
22 |
|
comment |
Many processes writing to a FIFO at the same time And sysconf(_PC_PATH_MAX) is also wrong. sysconf() would take _SC_PATH_MAX if such a thing existed. [f]pathconf( ) is the proper way to determine the max path length of a particular filesystem. N.B. that there is no one "path max" on any POSIX system - a maximum path length is an implementation detail of a specific filesystem, and any one POSIX system can use many different filesystems all at once.
|
|
Feb
22 |
|
comment |
Many processes writing to a FIFO at the same time Quite wrong, apparently. I literally cited the ruling POSIX standard. SUSv2 from 1997 also states "Write requests to a pipe or FIFO ... Write requests of {PIPE_BUF} bytes or less will not be interleaved with data from other processes doing writes on the same pipe", which is consistent with the latest POSIX standard. Pipes and PIPE_BUF both predate APUE by several decades, and FIFOs are literally "named pipes".
|
|
Feb
22 |
|
comment |
Many processes writing to a FIFO at the same time Cite? POSIX 8 states: "Write requests of {PIPE_BUF} bytes or less shall not be interleaved with data from other threads performing write operations on the same pipe or FIFO." There's no mention of _PC_PATH_MAX or any other form of PATH_MAX.
|
|
Feb
22 |
|
comment |
Strange result with pointer arithmetic in C @Fract Offhand, I'd think [u]intptr_t would be best. My first impression is none of the OPs code is actually strictly-conforming C as pointer arithmetic is strictly only defined when referring to actual objects and one past the end of an object. And size_t isn't guaranteed to be able to hold a pointer value.
|
|
Feb
22 |
|
comment |
Use zstd compression for a client with Ktor If Ktor supports "deflate" per RFC 1951 you should be able to use standard deflater streams to compress data. Would that be performant enough to meet your needs? |
|
Feb
22 |
|
comment |
Type casting char pointer to be of type struct pointer @Davislor If you believe you understand parallel structures in English grammar better than just about everyone else here, please demonstrate that. |
|
Feb
22 |
|
comment |
Type casting char pointer to be of type struct pointer @Davislor And explaining your reasoning is almost certain to require you to actually parse the C standard's statements. See languagetools.info/grammarpedia/parse.htm for what that entails. IMO if you can not parse the language of the C standard and demonstrate your "Since the system call copied the objects to the buffer as arrays of character type, the pointer casts are legal" claim is true, that claim is literally baseless. |