On Unix, when I press up arrow key, it shows this string, but while scanf, it does not take it as input. Please explain how to take it as input. Can we something like compare the character by charater like first ^[ is Esc key and so on?
...
I'm busting my head but cannot find a solution for this. Please consider this scenario:
I have writers that want to write to non-blocking "queue" to another machine on the local network and have a reader that will read data (blocking mode if there are no writers) and do some job A and then return after a long hour and take next data.
...
I want to compile a program using the standard ./configure , make, make install.
I am using 64 bits machine but I want the executable to be 32 bits executable.
What is the way to do this, I did ./configure --help but saw nothing on this (it has the --disable-64bit but it does not seem to do the work
...
Hi,
I am doing file-upload for a web-application (running on unix/linux). I'm wondering if there would be a concern if I planned to create a new directory for each file upload? This is the out-of-the-box approach for the Ruby on Rails plugin "paperclip". I debating what the trade-offs are, or whether perhaps it's just not a concern, ...
I'm looking for good books on concurrent programming in C in the Unix environment. They need to cover classic concurrency, Unix multi-processing, and POSIX thread. Most of the books I have found are not for C or Unix. Keep in mind that I am not expecting one book to cover all of that though it would be great if such a book existed.
The ...
Please tell me the difference between a process group ID and a jobid. Is jobid a builtin of a shell program or is it related to the kernel? What are the uses of each of them? When a process is run in background, is only jobid set or is the pgid set as well?
What are the uses of the setpgid() function?
When a process is run in background...
Does the shell allocates a job ID to all processes(foreground and background)?
jobs command shows the existing background jobs. How do we see job ID of foreground process?
I want to use a function in C (like getpid()) to get the job ID and status of a given process given the pid of the process.
What is the maximum value of a job ID?
...
I asked a related question
'Difference between process group id and job id in Unix',
but I have a doubt that was not answered. In that answer, it was written that job id is built in data related to shell (kernel has nothing to do with it), so foreground / background is understanding of shell, but when we do "ps x" then it display in st...
I am writing my own shell as part of course assignment. So I need to support background jobs. I am maintaining data strutures for job id and background jobs. But I need to tell kernel also that this is background process so that there is only one terminal foreground process. Till now I am handling background jobs at my program level.
W...
In my program I am forking (in parallel) child processes in a finite while loop and doing exec on each of them. I want the parent process to resume execution (the point after this while loop ) only after all children have terminated. How should I do that?
i have tried several approaches. In one approach, I made parent pause after while ...
Possible Duplicate:
How to retrieve a list of directories QUICKLY in Java?
Java does not have a listDirectories/listFiles method, in order to find out your set of directories or files, you have to iterate through each one and call isDirectory. This proves to be a huge performance problem for us in the unix platform. Is there a n...
I want to use function:
pid_t tcgetpgrp(int fildes);
How to retrieve the fildes(to be passed to this function).
And is process group id returned by this function is same as the one returned by
getpgrp(0)//0 for the calling process
??
...
Hi I am using raw.c for keyboard capture. Following code finds when an arrow key/ esc is pressed. At the same time I want to read whole words that user inputs and these should be shown on stdout as well.
char pp = 0;
char p = 0;
while( (i = read(0, &c, 1)) == 1) {
if (pp == 033 && p == 0133 && (c &= 255) == 0102) /* DOWN */ break;
if (c...
I have a child process which has received a SIGTSTP signal.
When I call
waitpid(-1,NULL,0);
the parent blocks, but in documentation, its written that waitpid returns with pid for stopped jobs.
#include<unistd.h>
#include<stdio.h>
#include<signal.h>
#include<sys/wait.h>
main() {
int pid;
if( (pid=fork()) > 0) {
sleep(5);
if(ki...
I want a alternative function call for setpgid to call on a process that has done exec() call.
setpgid returns error if it is called on a child which has already called exec.
Does any alternative function exists?
...
I am writing a shell. It forks background and foreground processes. I have a problem with the SIGTSTP signal. So after giving Ctrl ^ Z, SIGTSTP is generated since this signal is delivered to my shell and its child processes (all background and foreground processes that my shell has forked). But like in actual shell, SIGTSTP is delivered ...
Not the base ones (like wc)... I need tools to build tag clouds, to compute semantic distance between files, to extract word-dictionary from a file, etc.
...
I want to capture the Control+D signal in my program and write a signal handler for it.
How can I do that?
I am working on C and using a linux system.
...
I'm trying to do the opposite of this question, replacing Unix line endings with Windows line endings, so that I can use SQL Server bcp over samba to import the file. I have sed installed but not dos2unix. I tried reversing the examples but to no avail.
Here's the command I'm using.
sed -e 's/\n/\r\n/g' myfile
I executed this and the...
Hi there!
I'm trying to update the crontab from a GNU Make file.
The idea is like this: I look through the existing cron table and filter out all entries marked as mine (via the comment) and save that to a temporary file. Then I add my jobs to that temporary file and make it a new cron table. That way the make file can be run several ti...