Hi -
1. I downloaded and examined the VSFTP source:
Code:
wget ftp://vsftpd.beasts.org/users/cevans/vsftpd-2.3.0pre2.tar.gz
tar xvzf vsftpd-2.3.0pre2.tar.gz
cd vs*pre2
grep vsf_sysutil_statbuf *|less =>
sysutil.h
sysutil.c
<= these are the VSFTP modules that "define" vsf_sysutil_statbuf
2. I found exactly the same "definition" as you've been seeing:
Code:
less sysutil.h =>
struct vsf_sysutil_statbuf;
<= Nothing but a forward definition...
3. So I looked at how it's being used:
Code:
less sysutil.c =>
int
vsf_sysutil_stat(const char* p_name, struct vsf_sysutil_statbuf** p_ptr)
{
vsf_sysutil_alloc_statbuf(p_ptr);
return stat(p_name, (struct stat*) (*p_ptr));
}
...
static void
vsf_sysutil_alloc_statbuf(struct vsf_sysutil_statbuf** p_ptr)
{
if (*p_ptr == NULL)
{
*p_ptr = vsf_sysutil_malloc(sizeof(struct stat));
}
}
...
Soooooooo.......
1. vsf_sysutil_statbuf is nothing more than a wrapper around the OS's "stat" struct.
2. vsf_sysutil_alloc_statbuf() only allocates memory once (and re-uses the memory if it's already been allocated)
3. The whole scheme "insulates" the rest of the VSFTP code from "stat" being different on different OS's. All of the "details" are encapsulated entirely within sysutil.c
'Hope that helps.. PSM