On Linux, /proc/version also displays the username of the kernel compiler and the version of gcc used to compile[1]. This patch does the same for Cygwin:
$ cat /proc/version CYGWIN_NT-6.1-WOW64 version 1.7.10(0.238/5/3) (Yaakov@YAAKOV04) (gcc version 4.5.2 (GCC) ) 2011-03-30 18:56 Patches for winsup/cygwin and winsup/doc attached. Yaakov [1] http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/s2-proc-version.html
2011-04-03 Yaakov Selkowitz <[email protected]> * new-features.sgml (ov-new1.7.10): Document additional information in /proc/version. Index: new-features.sgml =================================================================== RCS file: /cvs/src/src/winsup/doc/new-features.sgml,v retrieving revision 1.71 diff -u -r1.71 new-features.sgml --- new-features.sgml 1 Apr 2011 19:49:16 -0000 1.71 +++ new-features.sgml 3 Apr 2011 23:55:49 -0000 @@ -20,6 +20,15 @@ shared memory. </para></listitem> +<listitem><para> +/proc/version now shows the username of whomever compiled the Cygwin DLL +as well as the version of GCC used when compiling. +</para></listitem> + </itemizedlist> </sect2>
2011-04-03 Yaakov Selkowitz <[email protected]> * Makefile.in (fhandler_proc_CFLAGS): Define USERNAME, HOSTNAME, and GCC_VERSION. * fhandler_proc.cc (format_proc_version): Add build machine and GCC version information as on Linux. Index: Makefile.in =================================================================== RCS file: /cvs/src/src/winsup/cygwin/Makefile.in,v retrieving revision 1.243 diff -u -r1.243 Makefile.in --- Makefile.in 1 Apr 2011 19:48:19 -0000 1.243 +++ Makefile.in 3 Apr 2011 23:38:41 -0000 @@ -287,6 +287,9 @@ uinfo_CFLAGS:=-fomit-frame-pointer endif +fhandler_proc_CFLAGS+=-DUSERNAME="\"$(USER)\"" -DHOSTNAME="\"$(HOSTNAME)\"" +fhandler_proc_CFLAGS+=-DGCC_VERSION="\"`$(CC) -v 2>&1 | tail -n 1`\"" + _cygwin_crt0_common_STDINCFLAGS:=yes libstdcxx_wrapper_STDINCFLAGS:=yes cxx_STDINCFLAGS:=yes Index: fhandler_proc.cc =================================================================== RCS file: /cvs/src/src/winsup/cygwin/fhandler_proc.cc,v retrieving revision 1.98 diff -u -r1.98 fhandler_proc.cc --- fhandler_proc.cc 2 Apr 2011 11:32:55 -0000 1.98 +++ fhandler_proc.cc 3 Apr 2011 23:38:41 -0000 @@ -361,15 +361,19 @@ static _off64_t format_proc_version (void *, char *&destbuf) { + tmp_pathbuf tp; + char *buf = tp.c_get (); + char *bufptr = buf; struct utsname uts_name; uname (&uts_name); - destbuf = (char *) crealloc_abort (destbuf, strlen (uts_name.sysname) - + strlen (uts_name.release) - + strlen (uts_name.version) - + 4); - return __small_sprintf (destbuf, "%s %s %s\n", - uts_name.sysname, uts_name.release, uts_name.version); + bufptr += __small_sprintf (bufptr, "%s version %s (%s@%s) (%s) %s\n", + uts_name.sysname, uts_name.release, USERNAME, HOSTNAME, + GCC_VERSION, uts_name.version); + + destbuf = (char *) crealloc_abort (destbuf, bufptr - buf); + memcpy (destbuf, buf, bufptr - buf); + return bufptr - buf; } static _off64_t
