My program is reading a text file containing various lines of text for a settings file. Some of the lines could get very large. Currently the buffer size is 4096 chars. It is possible that some lines could exceed this, whether through maliciousness or due to various factors operating within the program.
The current routines were rather ...
What does malloc(0) returns? Would the answer be same for realloc(malloc(0),0) ?
#include<stdio.h>
#include<malloc.h>
int main()
{
printf("%p\n", malloc(0));
printf("%p\n", realloc(malloc(0), 0));
return 0;
}
Output from linux gcc:
manav@manav-workstation:~$ gcc -Wall mal.c
manav@manav-workstation:~$ ./a.out
0...
Dear All,
I am writing one simple server daemon and running with /etc/init.d/server
its running properly but when i want to run one simple QT GUI with system() function , its not able to run it and returning 256 as return code .
if same daemon i m running from terminal then its working properly and also system() function is getting succ...
I have a set of python scripts that I run frequently on different machines that depend on a few external libraries as well as some other applications spawned via subprocess.Popen.
As expected depending on the version of the installed modules and applications the output varies. To address this I would like to keep track of which versions...
First, I would like to clarify a quick question I have, am I right in thinking that files in svn repo don't actually exist in the heirarchical structure you see when you check them out?
I have tried to use svn export ~/svn/project1 ~/public_html/project1 but it didn't work.
What I actually want is to have the export command automatical...
If I do the following command on my executable called "version", compiled on Fedora Core 11, I get this output
file version
version: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, not stripped
What's the significance of the 2.6.18 number towards the end, and is it...
I'm trying to write a PHP script to download a zip file from a web server that contains a single CSV file and then load the contents of the extracted CSV file into an existing MySQL database table.
$targetFile = 'data-' . md5(microtime()) . '.zip';
$url = 'http://www.address.com/data.zip';
$out = fopen('/path/to/zip/save/folder/' . $ta...
I have some daemons that use PID files to prevent parallel execution of my program. I have set up a signal handler to trap SIGTERM and do the necessary clean-up including the PID file. This works great when I test using "kill -s SIGTERM #PID". However, when I reboot the server the PID files are still hanging around preventing start-up...
Hi,
Is it possible to 'hibernate' a process in linux?
Just like 'hibernate' in laptop, I would to write all the memory used by a process to disk, free up the RAM. And then later on, I can 'resume the process', i.e, reading all the data from memory and put it back to RAM and I can continue with my process?
Thank you.
...
What is the name of the runtime library which implements Linux network interfaces, like sockets, tuntaps, netlink, etc...? For example when I create an UDP socket and make an ioctl call to fetch network interface info, which library actually implements that call? What are the corresponding *.so files on most linux dstirbutions?
...
I'm working on an application that contains several server sockets that each run in a unique thread.
An external utility (script) is called by one of the threads. This script calls a utility (client) that sends a message to one of the server sockets.
Initially, I was using system() to execute this external script, but we couldn't use t...
Edited: How do I programmatically add programs to launch on user session startup on Ubuntu?
I know how to perform this operation through Nautilus but I'd like to know how do this through a script.
...
Is there a Windows equivalent to Linux's readahead syscall?
EDIT:
I would like a full function signature if possible, showing the equivalent offset/count parameters (or lower/upper).
Eg:
The Linux function signature is:
ssize_t readahead(int fd, off64_t *offset, size_t count);
and an example of it's use is
readahead(file, 100, 500...
I know how to config aliases in bash but is there a way to configure an alias for a sequence of commands?
i.e say I want one command to change to a particular directory, then run another command
In addition, is there a way to setup a command that runs "sudo mycommand" then enters the password? In the MSDOS days I'd be looking for a .bat...
Hi,
In linux, how can synchronize between 2 thread (using pthreads on linux)?
I would like, under some conditions, a thread will block itself and then later on, it will be resume by another thread. In Java, there is wait(), notify() functions. I am looking for something the same on pthreads:
I have read this, but it only has mutex, whi...
I'm just getting started with svn so please, help me out if I saw anything stupid.
I'm developing on a windows laptop using tortoisesvn.
I'm deploying to a linux server.
I have my repo set up and checked out on my laptop.
I can't manage to check it out to a directory on the server. I've created a directory for it but can't get svn chec...
I've been considering using mmap for filereading, and was wondering how portable that is.
I'm developing on a linux platform, but would like my program to work on osx and windows.
Can I assume mmap is working on these platforms?
thanks
...
I've just thrown together the following shell script:
cd /home/firefli/webprojects/project1
svn checkout file:///home/firefli/svn/project1/trunk .
rm -rf /home/firefli/public_html/project1
svn export . /home/firefli/public_html/project1
It does work when I do a commit and then run the script manually but I still have a couple of quest...
I'm working on a project and I came to a point where the following stack trace popped up:
#0 0x0017c30c in _IO_flush_all_lockp () from /lib/libc.so.6
#1 0x0017d030 in _IO_cleanup () from /lib/libc.so.6
#2 0x0013e042 in exit () from /lib/libc.so.6
#3 0x00126bbe in __libc_start_main () from /lib/libc.so.6
#4 0x08049d11 in _start ()
...
I am learning posix api. I could not get logic behind names used by posix api
e.g.
S_IRUSR, S_IRUSR
What does What does S stand for? I can get R and W are for read and write. But what naming convention followed by POSIX ?
Its just an example. What about other names ? Just like Win32 follow Hungarian Notation for naming what does P...