[newlib-cygwin] Add sethostname
Corinna Vinschen
corinna@sourceware.org
Wed Jun 17 09:11:00 GMT 2015
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=50b00d2b936c937099c24d6fa1f0b6f642462900
commit 50b00d2b936c937099c24d6fa1f0b6f642462900
Author: Corinna Vinschen <corinna@vinschen.de>
Date: Wed Jun 17 11:11:02 2015 +0200
Add sethostname
* net.cc (sethostname): New function.
* common.din (sethostname): Export
* include/cygwin/version.h (CYGWIN_VERSION_DLL_MAJOR): Bump to 2001.
(CYGWIN_VERSION_DLL_MINOR): Set to 0.
* new-features.xml (ov-new): Rename from ov-new1.7.
(ov-new2.1): Add new section. Document sethostname.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Diff:
---
winsup/cygwin/ChangeLog | 7 +++++++
winsup/cygwin/common.din | 1 +
winsup/cygwin/include/cygwin/version.h | 4 ++--
winsup/cygwin/net.cc | 14 ++++++++++++++
winsup/cygwin/release/{2.0.5 => 2.1.0} | 2 ++
winsup/doc/ChangeLog | 5 +++++
winsup/doc/new-features.xml | 14 +++++++++++++-
7 files changed, 44 insertions(+), 3 deletions(-)
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 062b065..58a3821 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,10 @@
+2015-06-17 Corinna Vinschen <corinna@vinschen.de>
+
+ * net.cc (sethostname): New function.
+ * common.din (sethostname): Export
+ * include/cygwin/version.h (CYGWIN_VERSION_DLL_MAJOR): Bump to 2001.
+ (CYGWIN_VERSION_DLL_MINOR): Set to 0.
+
2015-06-15 Corinna Vinschen <corinna@vinschen.de>
* fhandler_socket.cc (LOCK_EVENTS): Don't enter critical section with
diff --git a/winsup/cygwin/common.din b/winsup/cygwin/common.din
index f14b331..dd9bb25 100644
--- a/winsup/cygwin/common.din
+++ b/winsup/cygwin/common.din
@@ -1054,6 +1054,7 @@ sendmsg = cygwin_sendmsg SIGFE
sendto = cygwin_sendto SIGFE
setbuf SIGFE
setbuffer SIGFE
+sethostname SIGFE
setdtablesize SIGFE
setegid SIGFE
setenv SIGFE
diff --git a/winsup/cygwin/include/cygwin/version.h b/winsup/cygwin/include/cygwin/version.h
index 8305b07..3d5d4de 100644
--- a/winsup/cygwin/include/cygwin/version.h
+++ b/winsup/cygwin/include/cygwin/version.h
@@ -42,8 +42,8 @@ details. */
the Cygwin shared library". This version is used to track important
changes to the DLL and is mainly informative in nature. */
-#define CYGWIN_VERSION_DLL_MAJOR 2000
-#define CYGWIN_VERSION_DLL_MINOR 5
+#define CYGWIN_VERSION_DLL_MAJOR 2001
+#define CYGWIN_VERSION_DLL_MINOR 0
/* Major numbers before CYGWIN_VERSION_DLL_EPOCH are
incompatible. */
diff --git a/winsup/cygwin/net.cc b/winsup/cygwin/net.cc
index ae86129..20b4d3c 100644
--- a/winsup/cygwin/net.cc
+++ b/winsup/cygwin/net.cc
@@ -1095,6 +1095,20 @@ cygwin_gethostname (char *name, size_t len)
return res;
}
+extern "C" int
+sethostname (const char *name, size_t len)
+{
+ WCHAR wname[MAX_COMPUTERNAME_LENGTH + 1];
+
+ sys_mbstowcs (wname, MAX_COMPUTERNAME_LENGTH + 1, name, len);
+ if (!SetComputerNameExW (ComputerNamePhysicalDnsHostname, wname))
+ {
+ __seterrno ();
+ return -1;
+ }
+ return 0;
+}
+
/* exported as gethostbyname: standards? */
extern "C" struct hostent *
cygwin_gethostbyname (const char *name)
diff --git a/winsup/cygwin/release/2.0.5 b/winsup/cygwin/release/2.1.0
similarity index 93%
rename from winsup/cygwin/release/2.0.5
rename to winsup/cygwin/release/2.1.0
index 9f26a8a..5680cb3 100644
--- a/winsup/cygwin/release/2.0.5
+++ b/winsup/cygwin/release/2.1.0
@@ -1,6 +1,8 @@
What's new:
-----------
+- New API: sethostname.
+
What changed:
-------------
diff --git a/winsup/doc/ChangeLog b/winsup/doc/ChangeLog
index 6f1b01a..02bf22e 100644
--- a/winsup/doc/ChangeLog
+++ b/winsup/doc/ChangeLog
@@ -1,3 +1,8 @@
+2015-06-17 Corinna Vinschen <corinna@vinschen.de>
+
+ * new-features.xml (ov-new): Rename from ov-new1.7.
+ (ov-new2.1): Add new section. Document sethostname.
+
2015-06-12 Jon Turney <jon.turney@dronecode.org.uk>
* Makefile.in (install-man, utils2man.stamp): Add rules to build
diff --git a/winsup/doc/new-features.xml b/winsup/doc/new-features.xml
index 2d0ed0b..6edde24 100644
--- a/winsup/doc/new-features.xml
+++ b/winsup/doc/new-features.xml
@@ -2,7 +2,19 @@
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
-<sect1 id="ov-new1.7"><title>What's new and what changed in Cygwin</title>
+<sect1 id="ov-new"><title>What's new and what changed in Cygwin</title>
+
+<sect2 id="ov-new2.1"><title>What's new and what changed in 2.1</title>
+
+<itemizedlist mark="bullet">
+
+<listitem><para>
+New API: sethostname.
+</para></listitem>
+
+</itemizedlist>
+
+</sect2>
<sect2 id="ov-new2.0"><title>What's new and what changed in 2.0</title>
More information about the Cygwin-cvs
mailing list