new fd allocation code
Dag-ErlingSmørgrav
des at des.no
Thu Dec 4 06:16:07 PST 2003
[cc: to current@ instead of re@ since this will not go into 5.2]
Tim Robbins <tjr at freebsd.org> writes:
> Why would it be incorrect? I changed NDENTRIES to sizeof(u_int) * NBBY
> as well.
If you made sure that NDENTRIES and NDENTRYSHIFT are derived from
sizeof(u_int), then the only problem is the misspelling of unsigned
int as u_int. You should take note, though, that using unsigned int
instead of uint32_t most does not do what I think you think it does;
unsigned int is 32 bits wide on all platforms FreeBSD supports. If
you want 64 bits on 64-bit platforms, use unsigned long.
des at ultra ~% uname -a
FreeBSD ultra.des.no 5.2-BETA FreeBSD 5.2-BETA #4: Mon Nov 24 15:47:18 CET 2003 des at ultra.des.no:/usr/src/sys/sparc64/compile/ultra sparc64
des at ultra ~% cat int.c
#include <stdio.h>
int main(void) { printf("%lu %lu\n", (unsigned long)sizeof(int) * 8, (unsigned long)sizeof(long) * 8); return 0; }
des at ultra ~% cc -Wall -pedantic -O -pipe -o int int.c
des at ultra ~% ./int
32 64
> What do your assertions look like?
I assert that the fd passed to fd_used() is not already marked as
used, and similarly that the fd passed fd_unused() is not already
marked as unused.
DES
--
Dag-Erling Smørgrav - des at des.no
More information about the freebsd-current
mailing list