diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2012-07-18 11:17:25 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2012-07-18 11:17:25 +0000 |
commit | 010f7350bad61a6d306a5ee755e7ed9e9761404a (patch) | |
tree | de26ee9e894f9bcc8b536fed14d17fbde8a3c569 | |
parent | 03b7882aa0eb4b772f9bbf51df22145412bc27cd (diff) | |
download | newlib-010f7350bad61a6d306a5ee755e7ed9e9761404a.zip newlib-010f7350bad61a6d306a5ee755e7ed9e9761404a.tar.gz newlib-010f7350bad61a6d306a5ee755e7ed9e9761404a.tar.bz2 |
* 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.
-rw-r--r-- | winsup/cygwin/ChangeLog | 8 | ||||
-rw-r--r-- | winsup/cygwin/cygwin.din | 1 | ||||
-rw-r--r-- | winsup/cygwin/include/cygwin/version.h | 3 | ||||
-rw-r--r-- | winsup/cygwin/include/mntent.h | 1 | ||||
-rw-r--r-- | winsup/cygwin/mount.cc | 29 | ||||
-rw-r--r-- | winsup/cygwin/posix.sgml | 1 | ||||
-rw-r--r-- | winsup/cygwin/release/1.7.16 | 2 |
7 files changed, 43 insertions, 2 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index cca6875..60b1808 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -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. diff --git a/winsup/cygwin/cygwin.din b/winsup/cygwin/cygwin.din index 7084f49..acd043b 100644 --- a/winsup/cygwin/cygwin.din +++ b/winsup/cygwin/cygwin.din @@ -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 diff --git a/winsup/cygwin/include/cygwin/version.h b/winsup/cygwin/include/cygwin/version.h index 0e9ead9..7b85d88 100644 --- a/winsup/cygwin/include/cygwin/version.h +++ b/winsup/cygwin/include/cygwin/version.h @@ -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 diff --git a/winsup/cygwin/include/mntent.h b/winsup/cygwin/include/mntent.h index 8ad270b..5fb8e3a 100644 --- a/winsup/cygwin/include/mntent.h +++ b/winsup/cygwin/include/mntent.h @@ -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 diff --git a/winsup/cygwin/mount.cc b/winsup/cygwin/mount.cc index 17d9a45..efd4d41 100644 --- a/winsup/cygwin/mount.cc +++ b/winsup/cygwin/mount.cc @@ -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 *) { diff --git a/winsup/cygwin/posix.sgml b/winsup/cygwin/posix.sgml index e9b4e08..0c6f6e5 100644 --- a/winsup/cygwin/posix.sgml +++ b/winsup/cygwin/posix.sgml @@ -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 diff --git a/winsup/cygwin/release/1.7.16 b/winsup/cygwin/release/1.7.16 index a55c8ae..39bf8bd 100644 --- a/winsup/cygwin/release/1.7.16 +++ b/winsup/cygwin/release/1.7.16 @@ -1,7 +1,7 @@ What's new: ----------- -- New API: memrchr. +- New API: getmntent_r, memrchr. - Support ReFS. |