Project

General

Profile

Bug #63906 » memset.c

Tao Lyu, 01/05/2024 09:15 AM

 
#define _GNU_SOURCE
#include <sys/mman.h>
#include <endian.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/syscall.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/stat.h>
#include <fcntl.h>


void main(int argc, char **argv){

//loop for star
int mfd = open("/sys/bus/pci/devices/0000:00:10.0/resource2", O_RDWR);
if (mfd <= 0) printf("open IVSHM error\n");
volatile char *msg = (char *)mmap(0, 1 * 1024 * 1024, PROT_READ | PROT_WRITE, MAP_SHARED, mfd, 0);
if(msg == NULL) printf("mmap failed\n");
msg[0]=0;
msg[1]=0;
msg[2]=0;
}
(2-2/3)