When i execute binary i want their stack segment to be filled with special data. All i do is just write program that allocate huge buffer on a stack, call a lot of malloc and mmap and for example fill all this memory with ‘A’ character. Then i check and see that about 80% of whole memory are used …
Tag: linux
If a File is Empty, Write Text to First Line
I need to check to see if two files are empty. If they are, then write “-999” to the file, else run an average on the numbers within the file. Here is the coding I’ve been trying to use: Code: Contents of file_all: Answer the appropriate way to check whether a file is empty is using -s not -…
Why can’t this user delete this file?
If I do: I see: If I sudo to root and then su to jenkins, I should be able to delete this, yes? Other relevant information about the directory and its parent: If I do: then I see than the user “jenkins” has been added to the “root” group: But if I: I get: Why is permission denied? Answ…
How to compute Cumulative values in Shell?
I would like to compute cumulative values from the below data file and writing them into columns after inserting a serial number. Where ifile.txt has 3 rows and 9 columns in this example. Desire output: Here first column is used for the serial number. So what I did is: I first converted into columns using The…
How OpenVZ boot OS?
I bought VPS on OpenVZ virtualization and enabled Debian guest OS. Guest /boot dir is empty. /etc/inittab is empty. How is the OS initialization process performed? What is the meaning of reboot for OpenVZ container? Answer After research I clone vzctl tool as main job about starting/stopping done here: vzctl …
When a large block of memory is requested on the heap, if contiguous space is not available on the RAM, is it allocated on the disk(swap)?
In Linux, when memory is requested (using calloc / malloc), if a contiguous block of the requested size is not available does the kernel map multiple separate pieces of memory into one single virtual block and hand it over to the application or is it allocated on disk? If it is allocated on disk, when a large…
Extract substring from string in linux
i need to extract oracle-xe-11.2.0-1.0.x86_64.rpm from oracle-xe-11.2.0-1.0.x86_64.rpm.zip and i have no clue how to start. The condition that must be met is only .zip needs to be removed. If there is no .zip then nothing should happen to the string . How to go with it ? Answer Use basename instead: Result:
In a setuid root program, how to check that the current user (that root is doing the work for) owns a file?
The use case is a mount tool, I want to restrict mounting (a unionfs(r+x dir, squashfs) ) to files owned by the caller. I know about fusefs, But I’d like to use overlayfs and squashfs in the kernel. Answer So long as you haven’t called setuid() or setreuid() yet, you can use getuid() to get the us…
Parameter passing with usr/bin/php p in cron jobs
I have a problem with cron task creating. I created the task, and its working just fine on my server if I run the following command: At the crontab I use the following command: If I run this command, I only get the symfony commands list. In other words, it looks the same as if I type in just php
Expanding asterisk in glob
I want to be able to print a list of all file in a directory in linux but my code only print out the first item in the directory inside home directory is text1.txt, text2.txt, text3.txt sys.argv[1] should be /home/* when I run it on command line: Script: the output is only the first file in the directory any …