Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve hostname functions #874

Conversation

matthiasblaesing
Copy link
Member

Fix wrong mapping of libc function gethostname, sethostname,
getdomainname and setdomainname. The functions are defined as:

   int getdomainname(char *name, size_t len);
   int setdomainname(const char *name, size_t len);

   int gethostname(char *name, size_t len);
   int sethostname(const char *name, size_t len);

and a C char[] maps by default to a byte[] in java.

In addition bind the winsock gethostname function:

com.sun.jna.platform.win32.Winsock2.gethostname(byte[], int)

The sethostname and setdomainname were tested manually,
as changing the hostname is a privileged operation and
is not regularly possible in unittests.

This closes #871

Fix wrong mapping of libc function gethostname, sethostname,
getdomainname  and setdomainname. The functions are defined as:

       int getdomainname(char *name, size_t len);
       int setdomainname(const char *name, size_t len);

       int gethostname(char *name, size_t len);
       int sethostname(const char *name, size_t len);

and a C char[] maps by default to a byte[] in java.

In addition bind the winsock gethostname function:

com.sun.jna.platform.win32.Winsock2.gethostname(byte[], int)

The sethostname and setdomainname were tested manually,
as changing the hostname is a privileged operation and
is not regularly possible in unittests.

This closes java-native-access#871
@matthiasblaesing matthiasblaesing merged commit 41e1701 into java-native-access:4.5.1-dev Nov 10, 2017
@matthiasblaesing matthiasblaesing deleted the hostname_utils2 branch November 18, 2017 17:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant