Re: [PATCH] Add getmntent_r

2012-07-19 Thread Corinna Vinschen
On Jul 18 15:23, Yaakov (Cygwin/X) wrote: > On 2012-07-18 06:17, Corinna Vinschen wrote: > >On Jul 18 05:21, Yaakov (Cygwin/X) wrote: > >>On 2012-06-06 02:33, Corinna Vinschen wrote: > >>>In case of Cygwin this is not needed since we don't read from the file > >>>but from the internal datastructure

Re: [PATCH] Add getmntent_r

2012-07-18 Thread Yaakov (Cygwin/X)
On 2012-07-18 06:17, Corinna Vinschen wrote: On Jul 18 05:21, Yaakov (Cygwin/X) wrote: On 2012-06-06 02:33, Corinna Vinschen wrote: In case of Cygwin this is not needed since we don't read from the file but from the internal datastructure. There's no reason to create garbage in buf just becaus

Re: [PATCH] Add getmntent_r

2012-07-18 Thread Corinna Vinschen
On Jul 18 05:21, Yaakov (Cygwin/X) wrote: > Somehow this one fell through the cracks. Picking up where we left off: > > On 2012-06-06 02:33, Corinna Vinschen wrote: > >On Jun 5 21:29, Yaakov (Cygwin/X) wrote: > >>The string returned into buf is in the following format: > >> > >>mnt_fsname\0mnt_d

Re: [PATCH] Add getmntent_r

2012-07-18 Thread Yaakov (Cygwin/X)
Somehow this one fell through the cracks. Picking up where we left off: On 2012-06-06 02:33, Corinna Vinschen wrote: On Jun 5 21:29, Yaakov (Cygwin/X) wrote: The string returned into buf is in the following format: mnt_fsname\0mnt_dir\0mnt_type\0mnt_opts\0mnt_freq" "mnt_passno\0 Yes, but t

Re: [PATCH] Add getmntent_r

2012-06-06 Thread Corinna Vinschen
On Jun 5 21:29, Yaakov (Cygwin/X) wrote: > On 2012-06-05 07:42, Corinna Vinschen wrote: > >>+extern "C" struct mntent * > >>+getmntent_r (FILE *, struct mntent *mntbuf, char *buf, int buflen) > >>+{ > >>+ struct mntent *mnt = mount_table->getmntent (_my_tls.locals.iteration++); > >>+ char *tmpbu

Re: [PATCH] Add getmntent_r

2012-06-05 Thread Yaakov (Cygwin/X)
On 2012-06-05 07:42, Corinna Vinschen wrote: +extern "C" struct mntent * +getmntent_r (FILE *, struct mntent *mntbuf, char *buf, int buflen) +{ + struct mntent *mnt = mount_table->getmntent (_my_tls.locals.iteration++); + char *tmpbuf; + int len = 0, maxlen; + + if (!mnt) +{ + mntbuf

Re: [PATCH] Add getmntent_r

2012-06-05 Thread Corinna Vinschen
On Jun 5 16:39, Corinna Vinschen wrote: > And I missed a line in my dirty code example: And I missed to add a + 1 to the pointers returned from stpcpy. Sigh. Let's restart: struct mntent *mnt = mount_table->getmntent (_my_tls.locals.iteration++); if (!mnt) return NULL; int maxlen = st

Re: [PATCH] Add getmntent_r

2012-06-05 Thread Corinna Vinschen
And I missed a line in my dirty code example: On Jun 5 14:42, Corinna Vinschen wrote: > What you want is more like this (untested): > > struct mntent *mnt = mount_table->getmntent (_my_tls.locals.iteration++); > if (!mnt) > return NULL; >int maxlen = strlen (mnt->mnt_fsname) + strl

Re: [PATCH] Add getmntent_r

2012-06-05 Thread Corinna Vinschen
On Jun 5 14:42, Corinna Vinschen wrote: > Hi Yaakov, > > thanks for the patch, but this won't fly. > > On Jun 5 00:08, Yaakov (Cygwin/X) wrote: > > This patch set implements getmntent_r, a GNU extension: > > > > http://man7.org/linux/man-pages/man3/getmntent.3.html > > > > libvirt needs this[

Re: [PATCH] Add getmntent_r

2012-06-05 Thread Corinna Vinschen
Hi Yaakov, thanks for the patch, but this won't fly. On Jun 5 00:08, Yaakov (Cygwin/X) wrote: > This patch set implements getmntent_r, a GNU extension: > > http://man7.org/linux/man-pages/man3/getmntent.3.html > > libvirt needs this[1], as I just (re)discovered. Patches for > winsup/cygwin an

Re: [PATCH] Add getmntent_r

2012-06-04 Thread Yaakov (Cygwin/X)
On 2012-06-05 00:08, Yaakov (Cygwin/X) wrote: This patch set implements getmntent_r, a GNU extension: http://man7.org/linux/man-pages/man3/getmntent.3.html libvirt needs this[1], as I just (re)discovered. Patches for winsup/cygwin and winsup/doc attached. And here is the code I used to test o

[PATCH] Add getmntent_r

2012-06-04 Thread Yaakov (Cygwin/X)
This patch set implements getmntent_r, a GNU extension: http://man7.org/linux/man-pages/man3/getmntent.3.html libvirt needs this[1], as I just (re)discovered. Patches for winsup/cygwin and winsup/doc attached. Yaakov [1] http://cygwin.com/ml/cygwin/2010-04/msg00885.html cygwin-getmntent_