Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 28 Aug 2002 16:21:03 -0400 (EDT)
From:      Pavan Balaji <balaji@cis.ohio-state.edu>
To:        freebsd-questions@freebsd.org
Subject:   Question about Posting Buffers
Message-ID:  <Pine.GSO.4.40.0208281619180.27754-100000@gamma.cis.ohio-state.edu>

next in thread | raw e-mail | index | archive | help


Example implementation:

Implementation of PostRecv (in the kernel):
PostRecv (void* userbuf)
{
	<create new node in linked list>
	newNode -> buf = userbuf;
}

Kernel Process (when the msg arrives):
	print (incomingdata);  --> works fine
	copyout (incomingdata, newNode -> buf);
	print (newNode -> buf);  --> works fine

User Process:
	void* userbuf;
	PostRecv (userbuf);
	sleep (zillion seconds);
	print (userbuf);  --> gives garbage


Am I missing something over here? The problem I'm having is that the
incomingdata in the kernel is perfect. Also, the copy does not return any
error, but after the data has been placed, when I try to print out the
userbuf, it does not contain any data -- contains garbage.

It's kind of illogical, but I tried using void** instead of void* while
posting the buffer, and copying it to *(newNode -> buf), but it gives the
same problem -- as expected.


 -- Pavan

    =======================================================
        Pavan Balaji,           |    774, Dreese Labs,
        78C, W 9th Ave,         |    2015, Neil Avenue,
        Columbus, OH43201       |    Columbus, OH43210
        (614) 291 3757          |    (614) 292 8501
    =======================================================

"Being happy doesn't mean that everything's perfect... It just means that
you have decided to see Beyond the Imperfections"  -- Rash


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.GSO.4.40.0208281619180.27754-100000>