Date: Thu, 11 Feb 1999 11:12:50 -0800 From: David Greenman <dg@root.com> To: "Md. Ahsan Habib" <mhabib@vt.edu> Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: /dev/kmem Message-ID: <199902111912.LAA01519@implode.root.com> In-Reply-To: Your message of "Thu, 11 Feb 1999 14:07:56 EST." <3.0.5.32.19990211140756.0090e4f0@csgrad.cs.vt.edu>
next in thread | previous in thread | raw e-mail | index | archive | help
>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. /dev/kmem addresses start at the kernel start address, KERNBASE. Attempts to access memory locations below that will fail. -DG David Greenman Co-founder/Principal Architect, The FreeBSD Project 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?199902111912.LAA01519>