I tried using the following code to execute a program but it doesnt seems to be working .. I would like to know whats wrong wit it .
execve("/bin/cat", "words", NULL); (0 Replies)
Hi,
Program A: uses pipe()
I am able to read the stdout of PROGAM B (stdout got through system() command) into PROGRAM A using:
* child
-> dup2(fd, STDOUT_FILENO);
-> execl("/path/PROGRAM B", "PROGRAM B", NULL);
* parent
-> char line;
-> read(fd, line, 100);
Question:... (2 Replies)
hello everybode.Got some sort of "problems" with this stuff;
well this is a program
int main()
{
int Pipe;
int origStdin, origStdout;
int childPID;
origStdin = dup(0);
origStdout = dup(1);
pipe(Pipe);
if( (childPID = fork()) < 0 )
{
perror(... (2 Replies)
Hi,
I'm writing a monitor program that can be notified once a process makes an execve system call and then stop that process for examining before it starts to run the new code. I know I can ptrace a process to achieve this, but I do not want to ptrace every process in the system. Is it possible?... (1 Reply)
Disclaimer: This is just a rainy day experiment. There is no expected "goal" other than to understand UNIX better.
After reading about fork and exec, my understanding is that forking, as the UNIX shell does by design, consequentially may sacrafice some speed versus an approach that runs in... (1 Reply)
Hello everybody.I want to make clear that i am not going to ask from anybody to build my asignement but i have a big problem. I can't seem to find anywhere ONE good example on C about what i am trying to do:wall:.I think it is simple. All i ask is one example, even a link is fine.
So, i want to... (1 Reply)
Hi guys,
I need to know how i can ignore Pipe '|' if Pipe is coming as a column in Pipe delimited file
for eg:
file 1:
xx|yy|"xyz|zzz"|zzz|12...
using below awk command
awk 'BEGIN {FS=OFS="|" } print $3
i would get xyz
But i want as :
xyz|zzz to consider as whole column... (13 Replies)
Hi,
I have the following scenario..
1) I have a binary which i launch from command line. It executes fine.
2) But when I launch it from another file using execve command, it gives a message that it is not able to access a shared object ".so" in /usr/bin (message is "Permission... (4 Replies)
The task I have to do is something along the lines "I receive some input and based on the first character I send it through pipe to one of the children to print".
The scheme it is based on is 1->2; 1->3; 1->4; 2 will print all the input that starts with a letter, 3 will print all the input that... (2 Replies)
Discussion started by: Ildiko
2 Replies
LEARN ABOUT OPENSOLARIS
setpgid
setpgid(2) System Calls setpgid(2)NAME
setpgid - set process group ID
SYNOPSIS
#include <sys/types.h>
#include <unistd.h>
int setpgid(pid_t pid, pid_t pgid);
DESCRIPTION
The setpgid() function sets the process group ID of the process with ID pid to pgid.
If pgid is equal to pid, the process becomes a process group leader. See Intro(2) for more information on session leaders and process group
leaders.
If pgid is not equal to pid, the process becomes a member of an existing process group.
If pid is equal to 0, the process ID of the calling process is used. If pgid is equal to 0, the process specified by pid becomes a process
group leader.
RETURN VALUES
Upon successful completion, 0 is returned. Otherwise, -1 is returned and errno is set to indicate the error.
ERRORS
The setpgid() function will fail if:
EACCES The pid argument matches the process ID of a child process of the calling process and the child process has successfully executed
one of the exec family of functions (see exec(2)).
EINVAL The pgid argument is less than (pid_t) 0 or greater than or equal to PID_MAX, or the calling process has a controlling terminal
that does not support job control.
EPERM The process indicated by the pid argument is a session leader.
EPERM The pid argument matches the process ID of a child process of the calling process and the child process is not in the same ses-
sion as the calling process.
EPERM The pgid argument does not match the process ID of the process indicated by the pid argument, and there is no process with a
process group ID that matches pgid in the same session as the calling process.
ESRCH The pid argument does not match the process ID of the calling process or of a child process of the calling process.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Interface Stability |Standard |
+-----------------------------+-----------------------------+
|MT-Level |Async-Signal-Safe |
+-----------------------------+-----------------------------+
SEE ALSO Intro(2), exec(2), exit(2), fork(2), getpid(2), getsid(2), attributes(5), standards(5)SunOS 5.11 28 Dec 1996 setpgid(2)