09-09-2004
why doesnt this compile correctly
hello there
when i try and compile i keep getting this error that 'error C2115: 'function' : incompatible types' on the following line of the code:
for (i = 0; i < nCommands; ++i) {
printf(" Command[%d]: \n", i);
printComStruct(com[i]); // HERE
}
the following is my printComStruct function:
void printComStruct(struct command *com) { /* print function */
int i;
fprintf(stderr,"com_pathname=%s\n", com->com_pathname);
fprintf(stderr,"argc=%d\n", com->argc);
for(i=0; com->argv[i]!=NULL; i++)
fprintf(stderr,"argv[%d]=%s\n", i, com->argv[i]);
fprintf(stderr,"#######\n");
if (com->redirect_in == NULL)
fprintf(stderr,"redirect_in=NULL\n");
else
fprintf(stderr,"redirect_in=%s\n", com->redirect_in);
if (com->redirect_out == NULL)
fprintf(stderr,"redirect_out=NULL\n");
else
fprintf(stderr,"redirect_out=%s\n", com->redirect_out);
fprintf(stderr,"com_suffix=%c\n\n", com->com_suffix);
} /*end of function*/
can anyone please help. cheers
mile
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
hi
when i want to go to previous directory by typing cd.. i get the following message
$ cd..
ksh: cd..: not found
Please help
rintingtong (2 Replies)
Discussion started by: rintingtong
2 Replies
2. UNIX for Dummies Questions & Answers
When trying to copy a file in Solaris 8 it doesnt copy file or give a error. This worked 100% until the 29th. I've checked the rights and everything seems fine:
drwxrwxrwx 2 bmuser bmgroup 11776 Jan 3 10:32 spool
This is the file I want to copy:
-rwxrwxrwx 1 bmuser bmgroup ... (26 Replies)
Discussion started by: rudi.okelly
26 Replies
3. UNIX for Dummies Questions & Answers
Hi everyone,
I'm pretty new using UNIX, but a friend of mine was helping me configure the unix terminal on my mac, and he changed some stuff on the bash profile .bash_profile. Everything was going well until I shut my computer and restarted it. When I opened the terminal this time this is what... (1 Reply)
Discussion started by: thefloydpink
1 Replies
4. Red Hat
Hii All,
I am using openldap v2.3 on redhat El-4. When i run ldapsearch it returns all the entries. The command runs successfully. But when I run the ldapsearch with following filter option it doesnt work and immediately returns to the shell.
ldapsearch uidNumber>=2000
I've started slapd... (0 Replies)
Discussion started by: shamik
0 Replies
5. Shell Programming and Scripting
It just does the break...even though the files are not the same...
# Compare extracts
#==========================================
count=0
while (( count < 5 ))
do
(( count+=1 ))
echo "Try $count"
file1=$(ls -l /tmp/psjava.xml|... (5 Replies)
Discussion started by: sigh2010
5 Replies
6. Shell Programming and Scripting
this is my file I have written.
// My first C++ program
#include <iostream>
int main()
{
std::cout << "Hi there!" << std::endl";
std::cout << "This is my first C++ program" << std::endl";
return(0);
}
This is the error I get, why?
$ g++ first.cpp
ksh: g++: not found (1 Reply)
Discussion started by: gustave
1 Replies
7. UNIX for Dummies Questions & Answers
I have just installed OpenBSD on a 333MHz PPC iMac G3. It has a 6GB HDD that has been partitioned as 1GB MacOS 8.5.1, 3GB MacOS X 10.3.9, 2GB OpenBSD 4.8. I now need to install a bootloader so that my computer can recognize the OpenBSD partition at startup. I have been trying to install... (0 Replies)
Discussion started by: t04st3r
0 Replies
8. AIX
Hi Guys,
I have a strange problem.( AIX 6.1) "vi" is not working at all..Whenever i #vi <anythin> ,, it returns the prompt back. Any clues folks?? (14 Replies)
Discussion started by: muzahed
14 Replies
9. UNIX for Dummies Questions & Answers
I am trying to print out two fields in a file using awk. So, I have got
awk -F '\t' 'NF = 2 {print $1 $2 "]"}' two.txt
in a script called what.awk
When i run this version like this - ./what.awk then it runs however I want to run the program like this
awk -f what.awk two.txt.
When I... (8 Replies)
Discussion started by: The undertaker
8 Replies
10. Post Here to Contact Site Administrators and Moderators
Just got penalised for not performing a feature that didnt work for me.
I tried to edit the post twice to add code tags, both manually and via button did not work.
code - manual
code - button (7 Replies)
Discussion started by: 06s23
7 Replies
LEARN ABOUT DEBIAN
ibv_get_cq_event
IBV_GET_CQ_EVENT(3) Libibverbs Programmer's Manual IBV_GET_CQ_EVENT(3)
NAME
ibv_get_cq_event, ibv_ack_cq_events - get and acknowledge completion queue (CQ) events
SYNOPSIS
#include <infiniband/verbs.h>
int ibv_get_cq_event(struct ibv_comp_channel *channel,
struct ibv_cq **cq, void **cq_context);
void ibv_ack_cq_events(struct ibv_cq *cq, unsigned int nevents);
DESCRIPTION
ibv_get_cq_event() waits for the next completion event in the completion event channel channel. Fills the arguments cq with the CQ that
got the event and cq_context with the CQ's context.
ibv_ack_cq_events() acknowledges nevents events on the CQ cq.
RETURN VALUE
ibv_get_cq_event() returns 0 on success, and -1 on error.
ibv_ack_cq_events() returns no value.
NOTES
All completion events that ibv_get_cq_event() returns must be acknowledged using ibv_ack_cq_events(). To avoid races, destroying a CQ will
wait for all completion events to be acknowledged; this guarantees a one-to-one correspondence between acks and successful gets.
Calling ibv_ack_cq_events() may be relatively expensive in the datapath, since it must take a mutex. Therefore it may be better to amor-
tize this cost by keeping a count of the number of events needing acknowledgement and acking several completion events in one call to
ibv_ack_cq_events().
EXAMPLES
The following code example demonstrates one possible way to work with completion events. It performs the following steps:
Stage I: Preparation
1. Creates a CQ
2. Requests for notification upon a new (first) completion event
Stage II: Completion Handling Routine
3. Wait for the completion event and ack it
4. Request for notification upon the next completion event
5. Empty the CQ
Note that an extra event may be triggered without having a corresponding completion entry in the CQ. This occurs if a completion entry is
added to the CQ between Step 4 and Step 5, and the CQ is then emptied (polled) in Step 5.
cq = ibv_create_cq(ctx, 1, ev_ctx, channel, 0);
if (!cq) {
fprintf(stderr, "Failed to create CQ
");
return 1;
}
/* Request notification before any completion can be created */
if (ibv_req_notify_cq(cq, 0)) {
fprintf(stderr, "Couldn't request CQ notification
");
return 1;
}
.
.
.
/* Wait for the completion event */
if (ibv_get_cq_event(channel, &ev_cq, &ev_ctx)) {
fprintf(stderr, "Failed to get cq_event
");
return 1;
}
/* Ack the event */
ibv_ack_cq_events(ev_cq, 1);
/* Request notification upon the next completion event */
if (ibv_req_notify_cq(ev_cq, 0)) {
fprintf(stderr, "Couldn't request CQ notification
");
return 1;
}
/* Empty the CQ: poll all of the completions from the CQ (if any exist) */
do {
ne = ibv_poll_cq(cq, 1, &wc);
if (ne < 0) {
fprintf(stderr, "Failed to poll completions from the CQ
");
return 1;
}
/* there may be an extra event with no completion in the CQ */
if (ne == 0)
continue;
if (wc.status != IBV_WC_SUCCESS) {
fprintf(stderr, "Completion with status 0x%x was found
", wc.status);
return 1;
}
} while (ne);
The following code example demonstrates one possible way to work with completion events in non-blocking mode. It performs the following
steps:
1. Set the completion event channel to be non-blocked
2. Poll the channel until there it has a completion event
3. Get the completion event and ack it
/* change the blocking mode of the completion channel */
flags = fcntl(channel->fd, F_GETFL);
rc = fcntl(channel->fd, F_SETFL, flags | O_NONBLOCK);
if (rc < 0) {
fprintf(stderr, "Failed to change file descriptor of completion event channel
");
return 1;
}
/*
* poll the channel until it has an event and sleep ms_timeout
* milliseconds between any iteration
*/
my_pollfd.fd = channel->fd;
my_pollfd.events = POLLIN;
my_pollfd.revents = 0;
do {
rc = poll(&my_pollfd, 1, ms_timeout);
} while (rc == 0);
if (rc < 0) {
fprintf(stderr, "poll failed
");
return 1;
}
ev_cq = cq;
/* Wait for the completion event */
if (ibv_get_cq_event(channel, &ev_cq, &ev_ctx)) {
fprintf(stderr, "Failed to get cq_event
");
return 1;
}
/* Ack the event */
ibv_ack_cq_events(ev_cq, 1);
SEE ALSO
ibv_create_comp_channel(3), ibv_create_cq(3), ibv_req_notify_cq(3), ibv_poll_cq(3)
AUTHORS
Dotan Barak
<dotanba@gmail.com>
libibverbs 2006-10-31 IBV_GET_CQ_EVENT(3)