Hello, all, I have a Q on filedesc.h: i am wondering whether the order of the field in struct _filedesc_ (in sys/filedesc.h) matters? I added a field to _filedesc_ struct in filedesc.h. It is a dynamically allocated list, just as fd_ofiles, or fd_ofilefalgs. I put my new added list right after fd_fileflags, and allocate/initialize it just as fd_ofiles or fd_ofileflags. Even if I put little of my extra code in except this data field, and codes to allocate and initialize it ( i put it in fdgrowtable(), just as the existing kernel initialize fd_ofiles, or fd_ofileflgs. (i believe i did this allcaotion/initialization part right:) the problem i had is page fault and then crashes the kernel. If I put my extra data fields at the end of _filedesc_ or _filedesc0_ struct, it then works..
My Q is: is there places in the kernel that not directly use the field name to access a member of "filedesc" struct, but implicitly assuming the ordering of the fields in "strcut filedesc", e.g., they may use offset to access a field? so then my new added field may mess up the original code? I found one such place in fdgrowtable() in kern_descrip.c there is one such line: ------------------------------------------ nfileflags = (char *)&ntable[nnfiles]; ------------------------------------------ so it allocates and assumes that fd_ofileflags is right after fd_ofiles in _filedesc_ struct. I am curious is there other places in the kernel that implicitly use the info on the order that those fields are defined? i hope my Q makes sense.. many thanks, yan _______________________________________________ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "[EMAIL PROTECTED]"