1 Aug 2003 01:26
Re: sys/param.h
Matthew Dillon <dillon <at> apollo.backplane.com>
2003-07-31 23:26:54 GMT
2003-07-31 23:26:54 GMT
:Matt,
:
:are we going to use the priority queues from sys/param.h?
:
:Right now they're #if 0'd out.
:
:tsleep() code uses it, for example.
:
:--
:Jeroen Ruigrok van der Werven <asmodai(at)wxs.nl> / asmodai
You mean all the Pxxx stuff? No, we aren't going to use that any
more. That is used in 4.x and 5.x because kernel threads are scheduled
by the user process scheduler. In DragonFly kernel threads are
scheduled by the LWKT scheduler and (typically) have a set fixed
priority based on whether the thread represents an interrupt, software
interrupt, mainline kernel code, etc. You may have noticed that I removed
all the priority junk from tsleep, only flags are passed now.
We may reintroduce some sort of priority mechanism to deal with certain
obscure situations but at the moment I am leaning against it. If we do
it will take on a different form.. probably a flag to tsleep rather then
a 'priority'.
-Matt
Matthew Dillon
<dillon <at> backplane.com>
(Continue reading)
.
Seriously, though, the C lib has new functions, e.g. snprintf(), and
the only way to avoid most buffer overflow problems is to use these
bounded functions and never, ever use the unbounded functions, even
if you *know* a particular use will not overflow a buffer.
The second type of buffer overflow is an array index overflow, where
an array index is incorrectly calculated or incorrectly bounded. For
example, consider the age-old misuse of malloc() where beginning
programmers would do something like: str2 = malloc(strlen(str1)),
which doesn't account for the \0 terminating the string, or programmers
who check the high side but forget that they are using a signed index
variable which could very well be negative.
RSS Feed