* cygwin.din (getmntent_r): Export.

* mount.cc (getmntent_r): New function.
	* posix.sgml (std-gnu): Add getmntent_r.
	* include/mntent.h (getmntent_r): Declare.
	* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
This commit is contained in:
Corinna Vinschen 2012-07-18 11:17:25 +00:00
parent 03b7882aa0
commit 010f7350ba
7 changed files with 43 additions and 2 deletions

View File

@ -1,3 +1,11 @@
2012-07-18 Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
* cygwin.din (getmntent_r): Export.
* mount.cc (getmntent_r): New function.
* posix.sgml (std-gnu): Add getmntent_r.
* include/mntent.h (getmntent_r): Declare.
* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
2012-07-12 Corinna Vinschen <corinna@vinschen.de>
* winlean.h: Make sure certain Windows macros are undefined again.

View File

@ -738,6 +738,7 @@ _getlogin = getlogin NOSIGFE
getlogin_r NOSIGFE
getmntent SIGFE
_getmntent = getmntent SIGFE
getmntent_r SIGFE
getmode SIGFE
_getmode = getmode SIGFE
getnameinfo = cygwin_getnameinfo SIGFE

View File

@ -430,12 +430,13 @@ details. */
259: Export pthread_sigqueue.
260: Export scandirat.
261: Export memrchr.
262: Export getmntent_r.
*/
/* Note that we forgot to bump the api for ualarm, strtoll, strtoull */
#define CYGWIN_VERSION_API_MAJOR 0
#define CYGWIN_VERSION_API_MINOR 261
#define CYGWIN_VERSION_API_MINOR 262
/* There is also a compatibity version number associated with the
shared memory regions. It is incremented when incompatible

View File

@ -31,6 +31,7 @@ struct mntent
#include <stdio.h>
FILE *setmntent (const char *__filep, const char *__type);
struct mntent *getmntent (FILE *__filep);
struct mntent *getmntent_r (FILE *, struct mntent *, char *, int);
int endmntent (FILE *__filep);
#endif

View File

@ -1899,6 +1899,35 @@ getmntent (FILE *)
return mount_table->getmntent (_my_tls.locals.iteration++);
}
extern "C" struct mntent *
getmntent_r (FILE *, struct mntent *mntbuf, char *buf, int buflen)
{
struct mntent *mnt = mount_table->getmntent (_my_tls.locals.iteration++);
int fsname_len, dir_len, type_len, opts_len, tmplen = buflen;
if (!mnt)
return NULL;
fsname_len = strlen (mnt->mnt_fsname) + 1;
dir_len = strlen (mnt->mnt_dir) + 1;
type_len = strlen (mnt->mnt_type) + 1;
opts_len = strlen (mnt->mnt_opts) + 1;
snprintf (buf, buflen, "%s%c%s%c%s%c%s", mnt->mnt_fsname, '\0',
mnt->mnt_dir, '\0', mnt->mnt_type, '\0', mnt->mnt_opts);
mntbuf->mnt_fsname = buf;
tmplen -= fsname_len;
mntbuf->mnt_dir = tmplen > 0 ? buf + fsname_len : (char *)"";
tmplen -= dir_len;
mntbuf->mnt_type = tmplen > 0 ? buf + fsname_len + dir_len : (char *)"";
tmplen -= type_len;
mntbuf->mnt_opts = tmplen > 0 ? buf + fsname_len + dir_len + type_len : (char *)"";
mntbuf->mnt_freq = mnt->mnt_freq;
mntbuf->mnt_passno = mnt->mnt_passno;
return mntbuf;
}
extern "C" int
endmntent (FILE *)
{

View File

@ -1115,6 +1115,7 @@ also IEEE Std 1003.1-2008 (POSIX.1-2008).</para>
get_phys_pages
get_nprocs
get_nprocs_conf
getmntent_r
getopt_long
getopt_long_only
getpt

View File

@ -1,7 +1,7 @@
What's new:
-----------
- New API: memrchr.
- New API: getmntent_r, memrchr.
- Support ReFS.