tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: prop_*_internalize and copyin/out for syscall ?



On Jun 9, 11:09am, Manuel Bouyer wrote:
} 
} so I'm evaluating how to use proplib for the new quotactl(2) I'm working on.
} I see there is already provision of function to pass property list between
} kernel and userland using ioctl, but there is no equivalent for syscalls.
} Should there be ?

     The way that modload(8) does it is that it calls
prop_dictionary_externalize() to put the dictionary in a string.  It
then fills in a structure that contains amongst other things the length
of the string and a pointer to it (see src/sbin/modload/main.c), and
calls modctl(2).  In the kernel, modctl(2) allocates memory based on
the size passed in, calls copyinstr() to get the string, and then calls
prop_dictionary_internalize() (see src/sys/kern/sys_module.c).  Whether
or not there should be dedicated functions to do this is another
question.

} For kernel land, prop_{array,dictionary}_copy{in,out} would do it
} (prop_{array,dictionary}_copyout is documented but not implemented,
} this is easy).
} For userland, we probably need a prop_{array,dictionary}_recv_syscall(),
} wich takes as parameter the pref we got from kernel, and internalize it.
} Parameters would be the pref, and a pointer to the prop_array_t or
} prop_dictionary_t that will get the result. What this would do in
} addition to call prop_{array,dictionary}_internalize_from_pref() is
} to unmap the buffer the kernel mmaped for us. I don't think this details of 
the
} kernel/userland communication should be exposed outside of the
} proplib code.

     modctl(2) doesn't copyout any dictionaries.  Off the top of my head,
I'm not aware of any precedence for that.

} For symetry, we probably want a prop_{array,dictionary}_send_syscall()
} which is just an alias to prop_{array,dictionary}_externalize_to_pref()
} 
}-- End of excerpt from Manuel Bouyer


Home | Main Index | Thread Index | Old Index