Re: new fd allocation code

From: Dag-Erling Smørgrav <des_at_des.no>
Date: Thu, 04 Dec 2003 15:15:55 +0100
[cc: to current_at_ instead of re_at_ 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
Received on Thu Dec 04 2003 - 05:16:07 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:32 UTC