On 23/01/17(Mon) 16:05, Theo de Raadt wrote: > File descriptor passing internalizes process fd's to an array of > struct file *. This results in tricky pointer management. > > How about passing it as an array of structs instead. Only one field > inside for now, struct file *. However soon I'll need to pass additional > fields along with the file, and I didn't want to use the low bits of the > pointer :)
Less magic is good. If you're only going to use 'struct fdpass' inside kern/uipc_usrreq.c I'd suggest to declare it there, to avoid namespace pollution. One nit below, with that ok mpi@ > @@ -911,7 +915,7 @@ unp_gc(void *arg __unused) > unp_rights--; > (void) closef(fp, NULL); > } > - free(defer, M_TEMP, sizeof(*defer) + sizeof(fp) * defer->ud_n); > + free(defer, M_TEMP, sizeof(*defer) + sizeof(struct fdpass) * > defer->ud_n); ^^^^^^^^^ Line too long.
