RE: Unable to talk to tap(4)
- From: "Bob McConnell" <rvm@xxxxxxxxx>
- Date: Fri, 16 May 2008 11:18:29 -0400
From: Wojciech Puchar
if (buffer = NULL) {
if (buffer == NULL) {
anyway not using malloc is good habit :) but it should work anyway.
try
The test after the malloc was the problem. I have been working in a
poorly designed scripting language for several months where the single
'=' is used for comparisons and didn't "see" the difference when I got
back into C. Setting a pointer to NULL should always cause an EFAULT.
Unfortunately, even 'gcc -Wall' didn't generate an appropriate warning
for it.
I only use malloc when I won't know how many buffers I need until run
time. In this case the application will count records in a configuration
file and malloc (1514 * count * 2) bytes, where count can range from 1
to 2000. That becomes an array of buffers, so I can pass just an index
or pointer between threads, usually through a mailbox or message queue.
It's a simple trick for message passing that I picked up years ago while
using the CTASK and XINU kernels.
Thanks for all the help,
Bob McConnell
_______________________________________________
freebsd-questions@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscribe@xxxxxxxxxxx"
- Follow-Ups:
- RE: Unable to talk to tap(4)
- From: Wojciech Puchar
- RE: Unable to talk to tap(4)
- References:
- Unable to talk to tap(4)
- From: Bob McConnell
- Re: Unable to talk to tap(4)
- From: Wojciech Puchar
- RE: Unable to talk to tap(4)
- From: Bob McConnell
- Re: Unable to talk to tap(4)
- From: Steve Randall
- Re: Unable to talk to tap(4)
- From: Wojciech Puchar
- Unable to talk to tap(4)
- Prev by Date: JRE problem after installing linux-sun-jre1.6.0
- Next by Date: Re: Xorg with multiple cards
- Previous by thread: Re: Unable to talk to tap(4)
- Next by thread: RE: Unable to talk to tap(4)
- Index(es):
Relevant Pages
|