Date: Thu, 11 Feb 1999 14:07:56 -0500 From: "Md. Ahsan Habib" <mhabib@vt.edu> To: freebsd-hackers@FreeBSD.ORG Subject: /dev/kmem Message-ID: <3.0.5.32.19990211140756.0090e4f0@csgrad.cs.vt.edu>
next in thread | raw e-mail | index | archive | help
Hi
I am facing some problems to use /dev/kmem. I tried a lot, post it to the
news groups but couldn't come up to a solution. In one of my experiments I
need to write in /dev/kmem. I can't use normal file because it will consume
more time which will affect my experiments.
This is a sample code I tried to execute:
#include <fcntl.h>
#include <stdio.h>
#include <errno.h>
extern int errno;
int main()
{
int fp,w,c;
long l;
char * Buff = "1234";
fp = open("/dev/kmem", O_RDWR);
if (fp == -1) {
printf("open returned error\n");
perror("open");
}
l = lseek(fp, 0x000a000,0);
w = write(fp,Buff,4);
c = close(fp);
return 0;
}
It can open the file, change the file pointer, close the file but can't
write anything in the file. The value of w is always -1. I tried with
several locations instead of the beginning one 0x000a000.
I set all necessary mod and ownership.
I will be happy if anyone can help me. It's really important to me.
Sincerely,
--Ahsan Habib
Department of Computer Science
Virginia Tech.
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3.0.5.32.19990211140756.0090e4f0>
