Tagged Questions
0
votes
0answers
42 views
change process name without change argv[0] in Linux
I need to modify the process name of my program in C langage.
But the only solution, I found is to modify the value of argv[0].
I have found also another solution with prctl(PR_SET_NAME, "newname"), ...
0
votes
1answer
24 views
exevp skips over all code until wait call in c
I am trying to execute a file using fork and execvp, however I am encountering some errors. I have not found any solutions to the problem I am having here online, since I don't get any errors from my ...
1
vote
1answer
43 views
Why there is no switching between the process
I have the following program
#include<stdio.h>
#include<unistd.h>
#include<stdlib.h>
main()
{
pid_t pid, ppid;
printf("Hello World1\n");
pid=fork();
if(pid==0)
{
...
0
votes
2answers
23 views
When do process switching takes place
I am confused about the process switching between two processes. When a new process is created using fork, what are the general rules applicable for switching between processes. Is it only when one ...
1
vote
2answers
65 views
A program where parent process creates a child process and both parent and child run same program different code
//same program different code
#include<stdio.h>
#include<unistd.h>
#include<stdlib.h>
int main()
{
int pid;
pid=fork();
if(pid<0)
{
printf("\n ...
0
votes
2answers
56 views
Process synchronization with C language
I tried to synchronize tow process (child & parent) with semaphore, but my try is failed.
The C source code is the following:
#include <stdio.h>
#include <stdlib.h>
#include ...
0
votes
2answers
47 views
How to create a file using execl command in c
#include<stdio.h>
#include<unistd.h>
#include<string.h>
#define MAXLINIE 100
main(int argc, char* argv[]) {
if (fork()==0){
execl("/bin/> temporar.txt", ...
0
votes
1answer
59 views
waitpid returns ECHILD - but pid was valid
I have a program that spawns other processes with execve:
s32 ret = execve( argv[0], argv.data(), (char* const*) req.posixEnv() );
Then later in a loop I call waitpid to watch for when the ...
-4
votes
0answers
51 views
Process Communication [closed]
I'm trying to implement a program which generate a sequence of processes that communicate with each other .
./prog "cmd1 arg1_1" "cmd2 arg1_2 arg2_2" "cmd3"
where cmdX represent a linux shell ...
-1
votes
1answer
43 views
C:How Process communicate in linux
I want to count the number of processes that are created with a for 1,10 and where fork() si executed. The program is executed in linux. I really don't get how to use wait or WEXITSTATUS and I've ...
0
votes
3answers
59 views
Child Process Creation through fork() in C
I'm completely new to C and learning about processes. I'm a little confused as to what the code below is actually doing, it's taken from Wikipedia but I've seen it in several books and am unsure as to ...
2
votes
4answers
61 views
What is the use of fork() - ing before exec()?
In *nix systems, processes are created by using fork() system call. Consider for example, init process creates another process.. First it forks itself and creates the a process which has the context ...
-3
votes
0answers
39 views
How can I handle this confusing process? [closed]
I am making a sample form of -ls function in linux. The program searches all files in a directory. And If there is a directory in the current directory that we are searching for files, Program gets in ...
0
votes
1answer
71 views
implementing pipe in C for shell with winapi
I m implementing a pipe in C for a shell I am writing, the pipe should be able to support stuff like ls | grep | grep | grep ( in other words, it should be recursive).
Shell is running on cygwin ...
-1
votes
1answer
56 views
How to get the Status of a Windows Process (Running or Terminated) using C language?
I want to know weather the Process on Windows task manager is Terminated?
(that means I want to make a function like database trigger)
at the moment that some particular Process is terminated I want ...