aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2011-03-29 10:42:11 +0000
committerCorinna Vinschen <corinna@vinschen.de>2011-03-29 10:42:11 +0000
commit5f660ecf247e43918946a84a164269ae8082e73f (patch)
tree466bd7fcbd83ad3d6b2be0de48ffcfc5c6548ae1
parentcabe8aa22ae768527ebb921ece53b14a2d0ca7ca (diff)
downloadnewlib-5f660ecf247e43918946a84a164269ae8082e73f.zip
newlib-5f660ecf247e43918946a84a164269ae8082e73f.tar.gz
newlib-5f660ecf247e43918946a84a164269ae8082e73f.tar.bz2
* autoload.cc (UuidCreate): Remove.
(UuidCreateSequential): Remove. * passwd.cc (internal_getpwsid): Avoid a strict-aliasing compiler error with gcc 4.5.1. * fhandler_floppy.cc (fhandler_dev_floppy::get_drive_info): Ditto. * ntdll.h (NtAllocateUuids): Declare. * syscalls.cc (gethostid): Use NtAllocateUuids function rather than UuidCreateSequential/UuidCreate to get rid of rpcrt4 dependency.
-rw-r--r--winsup/cygwin/ChangeLog11
-rw-r--r--winsup/cygwin/autoload.cc3
-rw-r--r--winsup/cygwin/fhandler_floppy.cc4
-rw-r--r--winsup/cygwin/ntdll.h1
-rw-r--r--winsup/cygwin/passwd.cc13
-rw-r--r--winsup/cygwin/syscalls.cc33
6 files changed, 42 insertions, 23 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index fc9aac2..8518b99 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,5 +1,16 @@
2011-03-29 Corinna Vinschen <corinna@vinschen.de>
+ * autoload.cc (UuidCreate): Remove.
+ (UuidCreateSequential): Remove.
+ * passwd.cc (internal_getpwsid): Avoid a strict-aliasing compiler
+ error with gcc 4.5.1.
+ * fhandler_floppy.cc (fhandler_dev_floppy::get_drive_info): Ditto.
+ * ntdll.h (NtAllocateUuids): Declare.
+ * syscalls.cc (gethostid): Use NtAllocateUuids function rather than
+ UuidCreateSequential/UuidCreate to get rid of rpcrt4 dependency.
+
+2011-03-29 Corinna Vinschen <corinna@vinschen.de>
+
* cygwin.din (pthread_spin_destroy): Export.
(pthread_spin_init): Export.
(pthread_spin_lock): Export.
diff --git a/winsup/cygwin/autoload.cc b/winsup/cygwin/autoload.cc
index c0ab2ed..587f7eb 100644
--- a/winsup/cygwin/autoload.cc
+++ b/winsup/cygwin/autoload.cc
@@ -403,9 +403,6 @@ LoadDLLfuncEx (GetModuleInformation, 16, psapi, 1)
LoadDLLfuncEx (GetProcessMemoryInfo, 12, psapi, 1)
LoadDLLfuncEx (QueryWorkingSet, 12, psapi, 1)
-LoadDLLfunc (UuidCreate, 4, rpcrt4)
-LoadDLLfuncEx (UuidCreateSequential, 4, rpcrt4, 1)
-
LoadDLLfunc (LsaDeregisterLogonProcess, 4, secur32)
LoadDLLfunc (LsaFreeReturnBuffer, 4, secur32)
LoadDLLfunc (LsaLogonUser, 56, secur32)
diff --git a/winsup/cygwin/fhandler_floppy.cc b/winsup/cygwin/fhandler_floppy.cc
index 5ebcd14..a5adcae 100644
--- a/winsup/cygwin/fhandler_floppy.cc
+++ b/winsup/cygwin/fhandler_floppy.cc
@@ -41,6 +41,7 @@ fhandler_dev_floppy::get_drive_info (struct hd_geometry *geo)
char dbuf[256];
char pbuf[256];
+ DISK_GEOMETRY_EX *dix = NULL;
DISK_GEOMETRY *di = NULL;
PARTITION_INFORMATION_EX *pix = NULL;
PARTITION_INFORMATION *pi = NULL;
@@ -57,7 +58,8 @@ fhandler_dev_floppy::get_drive_info (struct hd_geometry *geo)
__seterrno ();
else
{
- di = &((DISK_GEOMETRY_EX *) dbuf)->Geometry;
+ dix = (DISK_GEOMETRY_EX *) dbuf;
+ di = &dix->Geometry;
if (!DeviceIoControl (get_handle (),
IOCTL_DISK_GET_PARTITION_INFO_EX, NULL, 0,
pbuf, 256, &bytes_read, NULL))
diff --git a/winsup/cygwin/ntdll.h b/winsup/cygwin/ntdll.h
index cd8e1f1..5f7f5cf 100644
--- a/winsup/cygwin/ntdll.h
+++ b/winsup/cygwin/ntdll.h
@@ -907,6 +907,7 @@ extern "C"
{
NTSTATUS NTAPI NtAdjustPrivilegesToken (HANDLE, BOOLEAN, PTOKEN_PRIVILEGES,
ULONG, PTOKEN_PRIVILEGES, PULONG);
+ NTSTATUS NTAPI NtAllocateUuids (PLARGE_INTEGER, PULONG, PULONG, PUCHAR);
NTSTATUS NTAPI NtClose (HANDLE);
NTSTATUS NTAPI NtCommitTransaction (HANDLE, BOOLEAN);
NTSTATUS NTAPI NtCreateDirectoryObject (PHANDLE, ACCESS_MASK,
diff --git a/winsup/cygwin/passwd.cc b/winsup/cygwin/passwd.cc
index 8c51c22..44343af 100644
--- a/winsup/cygwin/passwd.cc
+++ b/winsup/cygwin/passwd.cc
@@ -98,11 +98,14 @@ internal_getpwsid (cygpsid &sid)
{
endptr = strchr (sid_string + 2, 0) - 1;
for (int i = 0; i < pr.curr_lines; i++)
- if ((pw = passwd_buf + i)->pw_dir > pw->pw_gecos + 8)
- for (ptr1 = endptr, ptr2 = pw->pw_dir - 2;
- *ptr1 == *ptr2; ptr2--)
- if (!*--ptr1)
- return pw;
+ {
+ pw = passwd_buf + i;
+ if (pw->pw_dir > pw->pw_gecos + 8)
+ for (ptr1 = endptr, ptr2 = pw->pw_dir - 2;
+ *ptr1 == *ptr2; ptr2--)
+ if (!*--ptr1)
+ return pw;
+ }
}
return NULL;
}
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc
index e3a8f2d..350edc3 100644
--- a/winsup/cygwin/syscalls.cc
+++ b/winsup/cygwin/syscalls.cc
@@ -3760,24 +3760,29 @@ long gethostid (void)
}
}
- UUID Uuid;
- RPC_STATUS status = UuidCreateSequential (&Uuid);
- if (GetLastError () == ERROR_PROC_NOT_FOUND)
- status = UuidCreate (&Uuid);
- if (status == RPC_S_OK)
- {
- data[4] = *(unsigned *)&Uuid.Data4[2];
- data[5] = *(unsigned short *)&Uuid.Data4[6];
+ LARGE_INTEGER u1;
+ ULONG u2, u3;
+ union {
+ UCHAR mac[6];
+ struct {
+ ULONG m1;
+ USHORT m2;
+ };
+ } u4;
+ NTSTATUS status = NtAllocateUuids (&u1, &u2, &u3, u4.mac);
+ if (NT_SUCCESS (status))
+ {
+ data[4] = u4.m1;
+ data[5] = u4.m2;
// Unfortunately Windows will sometimes pick a virtual Ethernet card
// e.g. VMWare Virtual Ethernet Adaptor
- debug_printf ("MAC address of first Ethernet card: %02x:%02x:%02x:%02x:%02x:%02x",
- Uuid.Data4[2], Uuid.Data4[3], Uuid.Data4[4],
- Uuid.Data4[5], Uuid.Data4[6], Uuid.Data4[7]);
+ debug_printf ("MAC address of first Ethernet card: "
+ "%02x:%02x:%02x:%02x:%02x:%02x",
+ u4.mac[0], u4.mac[1], u4.mac[2],
+ u4.mac[3], u4.mac[4], u4.mac[5]);
}
else
- {
- debug_printf ("no Ethernet card installed");
- }
+ debug_printf ("no Ethernet card installed");
reg_key key (HKEY_LOCAL_MACHINE, KEY_READ, "SOFTWARE", "Microsoft",
"Windows NT", "CurrentVersion", NULL);