May I know why the .so file in linux will show up the string value from my cpp code? Even with fvisibility=hidden set in gcc make. for example, i set “Hello World” and it will show up. I tried google but found nothing related.. Thanks. Answer -fvisibility=hidden only affects the linker visibility, i.e. whether symbols are visible when a linker
Tag: linux
Can an already opened FILE handle reflect changes to the underlying file without re-opening it?
Assuming a plain text file, foo.txt, and two processes: Process A, a shell script, overwrites the file in regular intervals $ echo “example” > foo.txt Process B, a C program, reads from the file in regular intervals fopen(“foo.txt”, “r”); getline(buf, len, fp); fclose(fp); In the C program, keeping the FILE* fp open after the initial fopen(), doing a rewind() and
Calling libc functions from another shared library in AT&T syntax?
i was trying to assemble codes below to shared library via gcc. i used command below in terminal and got errors. Then i googled the question and got a seemingly feasible answer in undefined-reference-to-main-for-shared-library. Then i added option -no-pie, used commands below and got another error. It seems that the order of options matters. But i used codes in 32-bits
Bash script conversion to fish
I’m trying to convert this script to fish: https://github.com/masahide/OmniSSHAgent/blob/main/hack/ubuntu-bash.setup.sh This is my progress so far: It should be fully converted except that main command substitution in the last function: that raises this error: And I don’t understand how to convert it. Can you help me? Thanks Answer Found the correct way to convert it (thanks to @masahide: https://github.com/masahide/OmniSSHAgent/issues/16#issuecomment-1107446991):
Slurm job arrays don’t work when used in argparse
I am trying to run multiple things at once (i.e. in a parallel manner) with different values of the variable –start_num. I have designed the following bash script, Then, I ran sbatch –exclude master array_bash_2, but it doesn’t work. I have tried searching many sites and have tried multiple things, but still the error FINAL_ARGPARSE_RUN.py: error: argument –start_num: expected one
Linux systemd service file to start and stop a minecraft server
I am trying to run a minecraft server on a remote linux instance. I would like the instance to start up the server on a screen named serverscreen which is owned by the user named minecraft once the system boots up, and run a stop command to the serverscreen when the instance shuts down. Then, it needs to wait untill
How to get difference between 2 dates (Z format) in milliseconds
Well I’m trying to get the difference between two dates in Seconds.MilliSeconds The dates are in Zulu format I have tried these two approaches doesn’t work out for me Is there any better way to get the difference in Seconds.MilliSeconds In linux for Z format time zones Answer Suggesting Output:
Bash: No such file or directory when running shell comands with node.js spawn on linux
I wrote the following web server in node.js using express and hbs that can run shell files, but I keep getting the following error when I type this url into a web browser linux username here is replaced with my linux username Contents of nodejs file: This is the contents of run.sh: Answer Hello, I don’t know why I decided
How to use Ansible to add Linux environment variables
I’m trying to add environment variables to a Linux machine using vars like below: I’m using this task to add the variables to /etc/environment. But I’m getting the error below: What am I missing here? Answer The playbook below works as expected and created the file I only added the parameter create: true to avoid error msg: Destination /tmp/environment does
If grep value not found return an echo [korn shell]
I have an issue with this script. What I’m trying to do is there are 3 conditions: 1- i put a valid input that is found inside the file and it gives me the output 2- I put a wrong input that can’t be found inside the file and give me an output of “Value not Found” 3- I don’t