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>
This commit is contained in:
Corinna Vinschen 2015-06-17 11:11:02 +02:00
parent c7af199237
commit 50b00d2b93
7 changed files with 44 additions and 3 deletions

View File

@ -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> 2015-06-15 Corinna Vinschen <corinna@vinschen.de>
* fhandler_socket.cc (LOCK_EVENTS): Don't enter critical section with * fhandler_socket.cc (LOCK_EVENTS): Don't enter critical section with

View File

@ -1054,6 +1054,7 @@ sendmsg = cygwin_sendmsg SIGFE
sendto = cygwin_sendto SIGFE sendto = cygwin_sendto SIGFE
setbuf SIGFE setbuf SIGFE
setbuffer SIGFE setbuffer SIGFE
sethostname SIGFE
setdtablesize SIGFE setdtablesize SIGFE
setegid SIGFE setegid SIGFE
setenv SIGFE setenv SIGFE

View File

@ -42,8 +42,8 @@ details. */
the Cygwin shared library". This version is used to track important the Cygwin shared library". This version is used to track important
changes to the DLL and is mainly informative in nature. */ changes to the DLL and is mainly informative in nature. */
#define CYGWIN_VERSION_DLL_MAJOR 2000 #define CYGWIN_VERSION_DLL_MAJOR 2001
#define CYGWIN_VERSION_DLL_MINOR 5 #define CYGWIN_VERSION_DLL_MINOR 0
/* Major numbers before CYGWIN_VERSION_DLL_EPOCH are /* Major numbers before CYGWIN_VERSION_DLL_EPOCH are
incompatible. */ incompatible. */

View File

@ -1095,6 +1095,20 @@ cygwin_gethostname (char *name, size_t len)
return res; 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? */ /* exported as gethostbyname: standards? */
extern "C" struct hostent * extern "C" struct hostent *
cygwin_gethostbyname (const char *name) cygwin_gethostbyname (const char *name)

View File

@ -1,6 +1,8 @@
What's new: What's new:
----------- -----------
- New API: sethostname.
What changed: What changed:
------------- -------------

View File

@ -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> 2015-06-12 Jon Turney <jon.turney@dronecode.org.uk>
* Makefile.in (install-man, utils2man.stamp): Add rules to build * Makefile.in (install-man, utils2man.stamp): Add rules to build

View File

@ -2,7 +2,19 @@
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook V4.5//EN" <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"> "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> <sect2 id="ov-new2.0"><title>What's new and what changed in 2.0</title>