Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2014-09-05 23:11:01 +0400
committerCorinna Vinschen <corinna@vinschen.de>2014-09-05 23:11:01 +0400
commitf207699a539ac11f2966631e0f1b107849b34ef4 (patch)
treedcbc6644275b95dccdd52e97abdba868f9d0c05d /winsup/cygwin/fhandler_proc.cc
parentc8a01afd974007a09f64a1830056ed11d5ebeec8 (diff)
* fhandler_proc.cc (proc_tab): Add entry for cygdrive symlink.
(format_proc_cygdrive): New function to implement /proc/cygdrive.
Diffstat (limited to 'winsup/cygwin/fhandler_proc.cc')
-rw-r--r--winsup/cygwin/fhandler_proc.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/winsup/cygwin/fhandler_proc.cc b/winsup/cygwin/fhandler_proc.cc
index 5db8ea2c5..0ae6ab0c9 100644
--- a/winsup/cygwin/fhandler_proc.cc
+++ b/winsup/cygwin/fhandler_proc.cc
@@ -17,6 +17,7 @@ details. */
#include "cygerrno.h"
#include "security.h"
#include "path.h"
+#include "shared_info.h"
#include "fhandler.h"
#include "fhandler_virtual.h"
#include "pinfo.h"
@@ -44,6 +45,7 @@ static off_t format_proc_uptime (void *, char *&);
static off_t format_proc_cpuinfo (void *, char *&);
static off_t format_proc_partitions (void *, char *&);
static off_t format_proc_self (void *, char *&);
+static off_t format_proc_cygdrive (void *, char *&);
static off_t format_proc_mounts (void *, char *&);
static off_t format_proc_filesystems (void *, char *&);
static off_t format_proc_swaps (void *, char *&);
@@ -55,6 +57,7 @@ static const virt_tab_t proc_tab[] = {
{ _VN ("."), FH_PROC, virt_directory, NULL },
{ _VN (".."), FH_PROC, virt_directory, NULL },
{ _VN ("cpuinfo"), FH_PROC, virt_file, format_proc_cpuinfo },
+ { _VN ("cygdrive"), FH_PROC, virt_symlink, format_proc_cygdrive },
{ _VN ("devices"), FH_PROC, virt_file, format_proc_devices },
{ _VN ("filesystems"), FH_PROC, virt_file, format_proc_filesystems },
{ _VN ("loadavg"), FH_PROC, virt_file, format_proc_loadavg },
@@ -1329,6 +1332,15 @@ format_proc_self (void *, char *&destbuf)
}
static off_t
+format_proc_cygdrive (void *, char *&destbuf)
+{
+ destbuf = (char *) crealloc_abort (destbuf, mount_table->cygdrive_len + 1);
+ char *dend = stpcpy (destbuf, mount_table->cygdrive);
+ *--dend = '\0';
+ return dend - destbuf;
+}
+
+static off_t
format_proc_mounts (void *, char *&destbuf)
{
destbuf = (char *) crealloc_abort (destbuf, sizeof ("self/mounts"));