Note that there are some explanatory texts on larger screens.

plurals
  1. POHow POSIX Message Queue names used in makefile
    primarykey
    data
    text
    <p>I have a homework related to Operating Systems course. In this homework , two programs will be implemented: a client program called "get" and a server program called "iserv". The server will be a multi-process program. POSIX message queues will be used for inter-process communication. Server will be started as follows: iserv Here , is the name of a message queue to be created by the server. is the name of a text file containing integer numbers.</p> <p>My iserv.c program: ( not completed )</p> <pre><code>#include &lt;linux/types.h&gt; #include &lt;linux/unistd.h&gt; #include &lt;stdio.h&gt; #include &lt;mqueue.h&gt; #include &lt;stdlib.h&gt; #include &lt;linux/string.h&gt; #include &lt;linux/fcntl.h&gt; #include &lt;linux/errno.h&gt; #include &lt;linux/wait.h&gt; #include &lt;msg.h&gt; int main(int argc , char *argv[]) { pid_t apid1; FILE *fp; mqd_t mq; const char *msgqueue = "/serverqueue"; int oflag = (O_RDWR|O_CREAT); mode_t mode = (S_IRUSR|S_IWUSR); struct mq_attr *attr = NULL; if(argc != 1) { printf("wrong number of arguments"); exit(1); } //create message queue mq = mq_open(msgqueue ,oflag , mode , attr); if(mq==-1) { perror("can not open msg queue\n"); exit(1); } printf("mq opened , mq id = %d\n" , (int) mq); //create child process apid1 = fork(); if(apid1 &lt; 0) { perror("main():"); exit(1); } if(apid1 == 0) { printf("this is the first child, pid = %d\n", (int) getpid()); fflush(stdout); } } </code></pre> <p>As the code suggests , message queue is created with the name "serverqueue". Then , I have created my makefile as:</p> <pre><code>iserv:iserv.c gcc -o iserv serverqueue infile.txt -lrt clean: rm -r *.o iserv </code></pre> <p>When I run this makefile with the make command , I get serverqueue: No such file or directory error. Where and how the server will be started with the line iserv ? Where is the wrong?</p> <p>Please help me , thanks!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload