Sponsored Content
Top Forums UNIX for Dummies Questions & Answers a for loop that doesn't make sense Post 302240964 by sdsd on Saturday 27th of September 2008 07:35:28 AM
Old 09-27-2008
a for loop that doesn't make sense

I've been referring bash info for processes and came across a structure for a process which is defined like
typedef struct process
{
struct process *next;
char ** argv
.
.
.
}process;

What I don't understand is that in the program there's a for loop which goes like this
job *j;//pointer to a structure that holds data about the jobs running
process *p;//pointer to a structure that holds process information
for(p=j->first_process;p;p=p->next) {...}
I don't understand how the p highlighted in red can be used as a condition in a for loop. What purpose does it serve? How does the for loop evaluate p as a terminating condition for the loop?
 

8 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

my make doesn't work

hi I wrote the following makefile, I have just one problem, when i type make clean I get the message make 'clean' is up to date and any obj file is removed from my folder, what's wrong? Thank you CC = cc all: es.o elaboration.o $(CC) -o es es.o elaboration.o elaboration.o:... (0 Replies)
Discussion started by: Puntino
0 Replies

2. High Performance Computing

Rocks clusters make sense for educational environments

08-18-2008 11:00 AM Cluster computing has played a pivotal role in the way research is conducted in educational environments. Because the amount of available money and hardware varies between university researchers, often it's necessary to find a clustering solution that can work well on a small... (0 Replies)
Discussion started by: Linux Bot
0 Replies

3. UNIX for Dummies Questions & Answers

trying to make sense of rsync output...

I'm running the following rsync command to sync a directory between the 2 servers: rsync -az --delete --stats /some_dir/ server_name:/some_dir I'm getting the following output: Number of files: 655174 Number of files transferred: 14221 Total file size: 1138531979331 bytes Total... (0 Replies)
Discussion started by: GKnight
0 Replies

4. Shell Programming and Scripting

GNU make doesn't pick up changes

It's been a while since I had to write a Makefile, but I've managed to clobber this together: SRC=module1.c module2.c OBJS=$(SRC:%.c=%.o) HDR=include1.h include2.h CC=gcc CFLAGS=-Wall -ggdb -D_XOPEN_SOURCE -I. -ansi all: program program: $(OBJS) $(CC) $(CFLAGS) -o $@ $(OBJS) ... (3 Replies)
Discussion started by: pludi
3 Replies

5. UNIX for Advanced & Expert Users

sar -d output... does not make sense

Can someone explain the correlation between how sar names the disk drives and how the rest of the OS names the disk drives? sar lists my disk drives as sd0, sd1, sd2, etc..... while format lists my disk drives as c1t0d0, c1t1d0, c1t2d0,etc... And also why sar shows 8 disks but format... (2 Replies)
Discussion started by: s ladd
2 Replies

6. Cybersecurity

Root login in Linux - does it make sense?

I stumbled upon this thread and one aspect of it got me thinking. As i am building a small Linux network right now for a friend i would like to hear your opinion on this. I'd like to respectfully disagree. I think the Linux habit of disabling root login per default is wrong (not entirely... (6 Replies)
Discussion started by: bakunin
6 Replies

7. Shell Programming and Scripting

Do loop doesn't iterate

I'm trying to send the file list as parameter to another job and execute it. But the loop doesn't work, the inner job is running only once and not twice as expected for filelist in $(ls -rt *.txt | tail -2) do echo $filelist export filelist cmd="$Program -config $configfile -autoexec... (11 Replies)
Discussion started by: asandy1234
11 Replies

8. Red Hat

Does it make sense to reduce the total shared memory

We have several dozen Redhat 5, 6 and 7 servers that are running Oracle databases. On some databases we are using automatic memory management, which uses shared memory. On other databases we are use manual memory management, which does not use shared memory. When I see that a server is swapping... (2 Replies)
Discussion started by: gandolf989
2 Replies
iv_popen(3)						    ivykis programmer's manual						       iv_popen(3)

NAME
IV_POPEN_REQUEST_INIT, iv_popen_request_submit, iv_popen_request_close - popen(3) for ivykis applications SYNOPSIS
#include <iv_popen.h> struct iv_popen_request { char *file; char **argv; char *type; }; void IV_POPEN_REQUEST_INIT(struct iv_popen_request *this); int iv_popen_request_submit(struct iv_popen_request *this); void iv_popen_request_close(struct iv_popen_request *this); DESCRIPTION
iv_popen provides ivykis(3) applications with an asynchronous version of popen(3) that is integrated with the ivykis event loop. After initialising a struct iv_popen_request object using IV_POPEN_REQUEST_INIT and assigning its ->file and ->argv and ->type members, one can call iv_popen_request_submit on it to fork off a child process which will call execvp(2) on ->file and ->argv, while in the parent process returning a file descriptor that is connected to the child's standard input (if ->type equals "w") or standard output (if ->type equals "r"). When the application is done with the child process, it should call iv_popen_request_close, and close the file descriptor returned by iv_popen_request_submit (this is not done automatically). iv_popen will continue to monitor the child's process state while it is running, by registering an iv_wait(3) interest for its process ID. If the child process has not yet terminated when iv_popen_request_close is called, iv_popen will attempt to terminate the child process in the background by sending it a series of SIGTERM and SIGKILL signals. iv_popen_request_close must be called from the same thread that iv_popen_request_submit was called from on this object. SEE ALSO
ivykis(3), iv_wait(3), execvp(2), popen(3) ivykis 2010-09-04 iv_popen(3)
All times are GMT -4. The time now is 04:48 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy