Professional Documents
Culture Documents
Os 5
Os 5
#include <stdio.h>
#include <unistd.h>
Void main(){
Prinff(“welcome to cdac”);
return 0;
4.1
#include <stdio.h>
#include "common.h"
#include <sys/shm.h>
Void main()
Int shmid;
4.1
#include <stdio.h>
#include "common.h"
#include <sys/shm.h>
#include <string.h>
int main ()
int shmid;
void *mem;
shmdt(mem);
return 0;
}
4.2 –
#include <stdio.h>
#include "common.h"
#include <sys/shm.h>
#include <string.h>
int main()
int shmid;
void *mem;
shmdt(mem);
return 0;
4.3
Hinclude <stdio.h>
#include "common.h"
#include <sys/shm.h>
#include <string.h>
int main()
if(shmid >0)
{
ret= shmctl(shmid,IPC_RMID,0);
if(ret=0)
else
return 0;
4.5,4.6,4.7
#include <stdio.h>
#include "common.h"
#include <sys/shm.h>
#include <time.h>
int main()
shmid=shmget(MY_SHM_ID,0,0);
if(shmid 20)
ret=shmctl(shmid, , &shmds);
if(ret=0)
ret=shmctl(shmid, , &shmds);
else
printf("shmctl() failed\n");
else
return 0;
}
5
5.1
#include <stdio.h>
#include "common.h"
#include <sys/msg.h>
#include <string.h>
int main()
myObject;
msgid=msgget( AUD
if(msgid 20)
myObject.type =1L;
if(ret!=-1)
return 0;
}
5.2 –
#include "common.h"
#tinclude <sys/msg.h>
#include <string.h>
int main()
MY_STR_T myObject;
msgid=msgget(MY_MQ_ID,0);
if(msgid >0)
if(ret *#-1)
return 0;
}
5.3 –
#include "common.h"
#tinclude <sys/msg.h>
#include <string.h>
int main()
MY_STR_T myObject;
msgid=msgget(MY_MQ_ID,0);
if(msgid >0)
if(ret !=-1)
return 0;
#include <stdio.h>
#include <unistd.h>
int main()
{
int a[2];
char buff[10];
if(pipe(a) # -1)
printf("%s\n", buff);
return 0;