busybox-1.3.0 getmntent_r() and dietlibc-0.30, installment 4

Denis Vlasenko vda.linux at googlemail.com
Mon Dec 18 14:47:17 PST 2006


On Monday 18 December 2006 07:28, sampo at symlabs.com wrote:
> +#if defined(__dietlibc__)
> +/* 16.12.2006, Sampo Kellomaki (sampo at iki.fi)
> + * dietlibc-0.30 does not appear to have implementation of getmntent_r() 
> although
> + * it does feature in supplied headers (<mntent.h>). Seems the overall 
> situation is a mess.
> + * From glibc man page for getmntent_r():
> + * CONFORMING TO
> + *   The  non-reentrant functions are from SunOS 4.1.3.  A routine 
> getmntent_r() was introduced
> + *   in HPUX 10, but it returns an int. The prototype shown above is  
> glibc-only.   LSB  depre-
> + *   cates the functions endhostent(), sethostent() and setmntent().
> + *
> + * NOTES
> + *   SysV  also  has  a getmntent() function but the calling sequence 
> differs, and the returned
> + *   structure is different. Under SysV /etc/mnttab is used.  BSD 4.4 and 
> Digital Unix  have  a
> + *   routine getmntinfo(), a wrapper around the system call getfsstat().
> + */
> +
> +struct mntent *getmntent_r(FILE* stream, struct mntent* result, char* 
> buffer, int bufsize)
> +{
> +  /* *** XXX FIXME WARNING: This hack is NOT thread safe. --Sampo */
> +  struct mntent* ment = getmntent(stream);
> +  memcpy(result, ment, sizeof(struct mntent));
> +  return result;
> +}
> +#endif

Applying, thanks
--
vda


More information about the busybox mailing list