Do some minor reformatting of 'extern "C"' use throughout.
* autoload.cc (GetSystemTimes): Define new autoload function. * fhandler_proc.cc (proc_listing): Add cpuinfo and partitions entries. (fhandler_proc::fill_filebuf): Add PROC_CPUINFO and PROC_PARTITIONS cases. (format_proc_uptime): Use GetSystemTimes if available. (read_value): New macro. (print): New macro. (cpuid): New function. (can_set_flag): New function. (format_proc_cpuinfo): New function. (format_proc_partitions): New function.
This commit is contained in:
parent
90fec0fa7a
commit
c367dfd02c
|
@ -1,3 +1,21 @@
|
||||||
|
2003-03-09 Christopher Faylor <cgf@redhat.com>
|
||||||
|
|
||||||
|
Do some minor reformatting of 'extern "C"' use throughout.
|
||||||
|
|
||||||
|
2003-03-06 Christopher January <chris@atomice.net>
|
||||||
|
|
||||||
|
* autoload.cc (GetSystemTimes): Define new autoload function.
|
||||||
|
* fhandler_proc.cc (proc_listing): Add cpuinfo and partitions entries.
|
||||||
|
(fhandler_proc::fill_filebuf): Add PROC_CPUINFO and PROC_PARTITIONS
|
||||||
|
cases.
|
||||||
|
(format_proc_uptime): Use GetSystemTimes if available.
|
||||||
|
(read_value): New macro.
|
||||||
|
(print): New macro.
|
||||||
|
(cpuid): New function.
|
||||||
|
(can_set_flag): New function.
|
||||||
|
(format_proc_cpuinfo): New function.
|
||||||
|
(format_proc_partitions): New function.
|
||||||
|
|
||||||
2003-03-09 Christopher Faylor <cgf@redhat.com>
|
2003-03-09 Christopher Faylor <cgf@redhat.com>
|
||||||
|
|
||||||
* syscalls.cc (unlink): Attempt to be more clever about setting
|
* syscalls.cc (unlink): Attempt to be more clever about setting
|
||||||
|
|
|
@ -501,6 +501,7 @@ LoadDLLfuncEx (CreateHardLinkA, 12, kernel32, 1)
|
||||||
LoadDLLfuncEx (CreateToolhelp32Snapshot, 8, kernel32, 1)
|
LoadDLLfuncEx (CreateToolhelp32Snapshot, 8, kernel32, 1)
|
||||||
LoadDLLfuncEx2 (GetCompressedFileSizeA, 8, kernel32, 1, 0xffffffff)
|
LoadDLLfuncEx2 (GetCompressedFileSizeA, 8, kernel32, 1, 0xffffffff)
|
||||||
LoadDLLfuncEx (GetConsoleWindow, 0, kernel32, 1)
|
LoadDLLfuncEx (GetConsoleWindow, 0, kernel32, 1)
|
||||||
|
LoadDLLfuncEx (GetSystemTimes, 12, kernel32, 1)
|
||||||
LoadDLLfuncEx2 (IsDebuggerPresent, 0, kernel32, 1, 1)
|
LoadDLLfuncEx2 (IsDebuggerPresent, 0, kernel32, 1, 1)
|
||||||
LoadDLLfuncEx (Process32First, 8, kernel32, 1)
|
LoadDLLfuncEx (Process32First, 8, kernel32, 1)
|
||||||
LoadDLLfuncEx (Process32Next, 8, kernel32, 1)
|
LoadDLLfuncEx (Process32Next, 8, kernel32, 1)
|
||||||
|
|
|
@ -20,8 +20,7 @@ details. */
|
||||||
#include "cygheap.h"
|
#include "cygheap.h"
|
||||||
#include "thread.h"
|
#include "thread.h"
|
||||||
|
|
||||||
extern "C"
|
extern "C" int
|
||||||
int
|
|
||||||
_fcntl (int fd, int cmd,...)
|
_fcntl (int fd, int cmd,...)
|
||||||
{
|
{
|
||||||
void *arg = NULL;
|
void *arg = NULL;
|
||||||
|
|
|
@ -8,6 +8,8 @@ This software is a copyrighted work licensed under the terms of the
|
||||||
Cygwin license. Please consult the file "CYGWIN_LICENSE" for
|
Cygwin license. Please consult the file "CYGWIN_LICENSE" for
|
||||||
details. */
|
details. */
|
||||||
|
|
||||||
|
#define _WIN32_WINNT 0x0501
|
||||||
|
|
||||||
#include "winsup.h"
|
#include "winsup.h"
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
@ -25,6 +27,7 @@ details. */
|
||||||
#include <sys/utsname.h>
|
#include <sys/utsname.h>
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include "ntdll.h"
|
#include "ntdll.h"
|
||||||
|
#include <winioctl.h>
|
||||||
|
|
||||||
#define _COMPILING_NEWLIB
|
#define _COMPILING_NEWLIB
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
|
@ -36,6 +39,8 @@ static const int PROC_REGISTRY = 4; // /proc/registry
|
||||||
static const int PROC_STAT = 5; // /proc/stat
|
static const int PROC_STAT = 5; // /proc/stat
|
||||||
static const int PROC_VERSION = 6; // /proc/version
|
static const int PROC_VERSION = 6; // /proc/version
|
||||||
static const int PROC_UPTIME = 7; // /proc/uptime
|
static const int PROC_UPTIME = 7; // /proc/uptime
|
||||||
|
static const int PROC_CPUINFO = 8; // /proc/cpuinfo
|
||||||
|
static const int PROC_PARTITIONS = 9; // /proc/partitions
|
||||||
|
|
||||||
/* names of objects in /proc */
|
/* names of objects in /proc */
|
||||||
static const char *proc_listing[] = {
|
static const char *proc_listing[] = {
|
||||||
|
@ -47,6 +52,8 @@ static const char *proc_listing[] = {
|
||||||
"stat",
|
"stat",
|
||||||
"version",
|
"version",
|
||||||
"uptime",
|
"uptime",
|
||||||
|
"cpuinfo",
|
||||||
|
"partitions",
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -63,7 +70,9 @@ static const DWORD proc_fhandlers[PROC_LINK_COUNT] = {
|
||||||
FH_REGISTRY,
|
FH_REGISTRY,
|
||||||
FH_PROC,
|
FH_PROC,
|
||||||
FH_PROC,
|
FH_PROC,
|
||||||
FH_PROC
|
FH_PROC,
|
||||||
|
FH_PROC,
|
||||||
|
FH_PROC,
|
||||||
};
|
};
|
||||||
|
|
||||||
/* name of the /proc filesystem */
|
/* name of the /proc filesystem */
|
||||||
|
@ -73,20 +82,20 @@ const int proc_len = sizeof (proc) - 1;
|
||||||
static __off64_t format_proc_meminfo (char *destbuf, size_t maxsize);
|
static __off64_t format_proc_meminfo (char *destbuf, size_t maxsize);
|
||||||
static __off64_t format_proc_stat (char *destbuf, size_t maxsize);
|
static __off64_t format_proc_stat (char *destbuf, size_t maxsize);
|
||||||
static __off64_t format_proc_uptime (char *destbuf, size_t maxsize);
|
static __off64_t format_proc_uptime (char *destbuf, size_t maxsize);
|
||||||
|
static __off64_t format_proc_cpuinfo (char *destbuf, size_t maxsize);
|
||||||
|
static __off64_t format_proc_partitions (char *destbuf, size_t maxsize);
|
||||||
|
|
||||||
/* auxillary function that returns the fhandler associated with the given path
|
/* Auxillary function that returns the fhandler associated with the given path
|
||||||
* this is where it would be nice to have pattern matching in C - polymorphism
|
this is where it would be nice to have pattern matching in C - polymorphism
|
||||||
* just doesn't cut it
|
just doesn't cut it. */
|
||||||
*/
|
|
||||||
DWORD
|
DWORD
|
||||||
fhandler_proc::get_proc_fhandler (const char *path)
|
fhandler_proc::get_proc_fhandler (const char *path)
|
||||||
{
|
{
|
||||||
debug_printf ("get_proc_fhandler(%s)", path);
|
debug_printf ("get_proc_fhandler(%s)", path);
|
||||||
path += proc_len;
|
path += proc_len;
|
||||||
/* Since this method is called from path_conv::check we can't rely on
|
/* Since this method is called from path_conv::check we can't rely on
|
||||||
* it being normalised and therefore the path may have runs of slashes
|
it being normalised and therefore the path may have runs of slashes
|
||||||
* in it.
|
in it. */
|
||||||
*/
|
|
||||||
while (isdirsep (*path))
|
while (isdirsep (*path))
|
||||||
path++;
|
path++;
|
||||||
|
|
||||||
|
@ -121,8 +130,7 @@ fhandler_proc::get_proc_fhandler (const char *path)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Returns 0 if path doesn't exist, >0 if path is a directory,
|
/* Returns 0 if path doesn't exist, >0 if path is a directory,
|
||||||
* <0 if path is a file.
|
<0 if path is a file. */
|
||||||
*/
|
|
||||||
int
|
int
|
||||||
fhandler_proc::exists ()
|
fhandler_proc::exists ()
|
||||||
{
|
{
|
||||||
|
@ -363,6 +371,18 @@ fhandler_proc::fill_filebuf ()
|
||||||
filesize = format_proc_meminfo (filebuf, bufalloc);
|
filesize = format_proc_meminfo (filebuf, bufalloc);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case PROC_CPUINFO:
|
||||||
|
{
|
||||||
|
filebuf = (char *) realloc (filebuf, bufalloc = 16384);
|
||||||
|
filesize = format_proc_cpuinfo (filebuf, bufalloc);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case PROC_PARTITIONS:
|
||||||
|
{
|
||||||
|
filebuf = (char *) realloc (filebuf, bufalloc = 4096);
|
||||||
|
filesize = format_proc_partitions (filebuf, bufalloc);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -403,10 +423,17 @@ format_proc_uptime (char *destbuf, size_t maxsize)
|
||||||
unsigned long long uptime = 0ULL, idle_time = 0ULL;
|
unsigned long long uptime = 0ULL, idle_time = 0ULL;
|
||||||
SYSTEM_PROCESSOR_TIMES spt;
|
SYSTEM_PROCESSOR_TIMES spt;
|
||||||
|
|
||||||
|
if (!GetSystemTimes ((FILETIME *) &spt.IdleTime, (FILETIME *) &spt.KernelTime,
|
||||||
|
(FILETIME *) &spt.UserTime)
|
||||||
|
&& GetLastError () == ERROR_PROC_NOT_FOUND)
|
||||||
|
{
|
||||||
NTSTATUS ret = NtQuerySystemInformation (SystemProcessorTimes, (PVOID) &spt,
|
NTSTATUS ret = NtQuerySystemInformation (SystemProcessorTimes, (PVOID) &spt,
|
||||||
sizeof spt, NULL);
|
sizeof spt, NULL);
|
||||||
if (!ret && GetLastError () == ERROR_PROC_NOT_FOUND)
|
if (!ret && GetLastError () == ERROR_PROC_NOT_FOUND)
|
||||||
|
{
|
||||||
uptime = GetTickCount () / 10;
|
uptime = GetTickCount () / 10;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
else if (ret != STATUS_SUCCESS)
|
else if (ret != STATUS_SUCCESS)
|
||||||
{
|
{
|
||||||
__seterrno_from_win_error (RtlNtStatusToDosError (ret));
|
__seterrno_from_win_error (RtlNtStatusToDosError (ret));
|
||||||
|
@ -415,12 +442,11 @@ format_proc_uptime (char *destbuf, size_t maxsize)
|
||||||
ret, RtlNtStatusToDosError (ret));
|
ret, RtlNtStatusToDosError (ret));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
{
|
|
||||||
idle_time = spt.IdleTime.QuadPart / 100000ULL;
|
idle_time = spt.IdleTime.QuadPart / 100000ULL;
|
||||||
uptime = (spt.KernelTime.QuadPart +
|
uptime = (spt.KernelTime.QuadPart +
|
||||||
spt.UserTime.QuadPart) / 100000ULL;
|
spt.UserTime.QuadPart) / 100000ULL;
|
||||||
}
|
out:
|
||||||
|
|
||||||
return __small_sprintf (destbuf, "%U.%02u %U.%02u\n",
|
return __small_sprintf (destbuf, "%U.%02u %U.%02u\n",
|
||||||
uptime / 100, long (uptime % 100),
|
uptime / 100, long (uptime % 100),
|
||||||
|
@ -500,3 +526,398 @@ format_proc_stat (char *destbuf, size_t maxsize)
|
||||||
context_switches,
|
context_switches,
|
||||||
boot_time);
|
boot_time);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define read_value(x,y) \
|
||||||
|
do {\
|
||||||
|
dwCount = BUFSIZE; \
|
||||||
|
if ((dwError = RegQueryValueEx (hKey, x, NULL, &dwType, (BYTE *) szBuffer, &dwCount)), \
|
||||||
|
(dwError != ERROR_SUCCESS && dwError != ERROR_MORE_DATA)) \
|
||||||
|
{ \
|
||||||
|
__seterrno_from_win_error (dwError); \
|
||||||
|
debug_printf ("RegQueryValueEx failed retcode %d", dwError); \
|
||||||
|
return 0; \
|
||||||
|
} \
|
||||||
|
if (dwType != y) \
|
||||||
|
{ \
|
||||||
|
debug_printf ("Value %s had an unexpected type (expected %d, found %d)", y, dwType); \
|
||||||
|
return 0; \
|
||||||
|
}\
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define print(x) \
|
||||||
|
do { \
|
||||||
|
strcpy (bufptr, x), \
|
||||||
|
bufptr += sizeof (x) - 1; \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
cpuid (unsigned *a, unsigned *b, unsigned *c, unsigned *d, unsigned in)
|
||||||
|
{
|
||||||
|
asm ("cpuid"
|
||||||
|
: "=a" (*a),
|
||||||
|
"=b" (*b),
|
||||||
|
"=c" (*c),
|
||||||
|
"=d" (*d)
|
||||||
|
: "a" (in));
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline bool
|
||||||
|
can_set_flag (unsigned flag)
|
||||||
|
{
|
||||||
|
unsigned r1, r2;
|
||||||
|
asm("pushfl\n"
|
||||||
|
"popl %0\n"
|
||||||
|
"movl %0, %1\n"
|
||||||
|
"xorl %2, %0\n"
|
||||||
|
"pushl %0\n"
|
||||||
|
"popfl\n"
|
||||||
|
"pushfl\n"
|
||||||
|
"popl %0\n"
|
||||||
|
"pushl %1\n"
|
||||||
|
"popfl\n"
|
||||||
|
: "=&r" (r1), "=&r" (r2)
|
||||||
|
: "ir" (flag)
|
||||||
|
);
|
||||||
|
return ((r1 ^ r2) & flag) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static __off64_t
|
||||||
|
format_proc_cpuinfo (char *destbuf, size_t maxsize)
|
||||||
|
{
|
||||||
|
SYSTEM_INFO siSystemInfo;
|
||||||
|
HKEY hKey;
|
||||||
|
DWORD dwError, dwCount, dwType;
|
||||||
|
DWORD dwOldThreadAffinityMask;
|
||||||
|
int cpu_number;
|
||||||
|
const int BUFSIZE = 256;
|
||||||
|
CHAR szBuffer[BUFSIZE];
|
||||||
|
char *bufptr = destbuf;
|
||||||
|
|
||||||
|
GetSystemInfo (&siSystemInfo);
|
||||||
|
|
||||||
|
for (cpu_number = 0;;cpu_number++)
|
||||||
|
{
|
||||||
|
__small_sprintf (szBuffer, "HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\%d", cpu_number);
|
||||||
|
|
||||||
|
if ((dwError = RegOpenKeyEx (HKEY_LOCAL_MACHINE, szBuffer, 0, KEY_QUERY_VALUE, &hKey)) != ERROR_SUCCESS)
|
||||||
|
{
|
||||||
|
if (dwError == ERROR_FILE_NOT_FOUND)
|
||||||
|
break;
|
||||||
|
__seterrno_from_win_error (dwError);
|
||||||
|
debug_printf ("RegOpenKeyEx failed retcode %d", dwError);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
dwOldThreadAffinityMask = SetThreadAffinityMask (GetCurrentThread (), 1 << cpu_number);
|
||||||
|
if (dwOldThreadAffinityMask == 0)
|
||||||
|
debug_printf ("SetThreadAffinityMask failed %E");
|
||||||
|
// I'm not sure whether the thread changes processor immediately
|
||||||
|
// and I'm not sure whether this function will cause the thread to be rescheduled
|
||||||
|
low_priority_sleep (0);
|
||||||
|
|
||||||
|
bool has_cpuid = false;
|
||||||
|
|
||||||
|
if (!can_set_flag (0x00040000))
|
||||||
|
debug_printf ("386 processor - no cpuid");
|
||||||
|
else
|
||||||
|
{
|
||||||
|
debug_printf ("486 processor");
|
||||||
|
if (can_set_flag (0x00200000))
|
||||||
|
{
|
||||||
|
debug_printf ("processor supports CPUID instruction");
|
||||||
|
has_cpuid = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
debug_printf ("processor does not support CPUID instruction");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!has_cpuid)
|
||||||
|
{
|
||||||
|
bufptr += __small_sprintf (bufptr, "processor : %d\n", cpu_number);
|
||||||
|
read_value ("VendorIdentifier", REG_SZ);
|
||||||
|
bufptr += __small_sprintf (bufptr, "vendor id : %s\n", szBuffer);
|
||||||
|
read_value ("Identifier", REG_SZ);
|
||||||
|
bufptr += __small_sprintf (bufptr, "identifier : %s\n", szBuffer);
|
||||||
|
read_value ("~Mhz", REG_DWORD);
|
||||||
|
bufptr += __small_sprintf (bufptr, "cpu MHz : %u\n", *(DWORD *) szBuffer);
|
||||||
|
|
||||||
|
print ("flags :");
|
||||||
|
if (IsProcessorFeaturePresent (PF_3DNOW_INSTRUCTIONS_AVAILABLE))
|
||||||
|
print (" 3dnow");
|
||||||
|
if (IsProcessorFeaturePresent (PF_COMPARE_EXCHANGE_DOUBLE))
|
||||||
|
print (" cx8");
|
||||||
|
if (!IsProcessorFeaturePresent (PF_FLOATING_POINT_EMULATED))
|
||||||
|
print (" fpu");
|
||||||
|
if (IsProcessorFeaturePresent (PF_MMX_INSTRUCTIONS_AVAILABLE))
|
||||||
|
print (" mmx");
|
||||||
|
if (IsProcessorFeaturePresent (PF_PAE_ENABLED))
|
||||||
|
print (" pae");
|
||||||
|
if (IsProcessorFeaturePresent (PF_RDTSC_INSTRUCTION_AVAILABLE))
|
||||||
|
print (" tsc");
|
||||||
|
if (IsProcessorFeaturePresent (PF_XMMI_INSTRUCTIONS_AVAILABLE))
|
||||||
|
print (" sse");
|
||||||
|
if (IsProcessorFeaturePresent (PF_XMMI64_INSTRUCTIONS_AVAILABLE))
|
||||||
|
print (" sse2");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
bufptr += __small_sprintf (bufptr, "processor : %d\n", cpu_number);
|
||||||
|
unsigned maxf, vendor_id[4], unused;
|
||||||
|
cpuid (&maxf, &vendor_id[0], &vendor_id[1], &vendor_id[2], 0);
|
||||||
|
maxf &= 0xffff;
|
||||||
|
vendor_id[3] = 0;
|
||||||
|
bufptr += __small_sprintf (bufptr, "vendor id : %s\n", (char *)vendor_id);
|
||||||
|
read_value ("~Mhz", REG_DWORD);
|
||||||
|
unsigned cpu_mhz = *(DWORD *)szBuffer;
|
||||||
|
if (maxf >= 1)
|
||||||
|
{
|
||||||
|
unsigned features2, features1, extra_info, cpuid_sig;
|
||||||
|
cpuid (&cpuid_sig, &extra_info, &features2, &features1, 1);
|
||||||
|
/* unsigned extended_family = (cpuid_sig & 0x0ff00000) >> 20,
|
||||||
|
extended_model = (cpuid_sig & 0x000f0000) >> 16; */
|
||||||
|
unsigned type = (cpuid_sig & 0x00003000) >> 12,
|
||||||
|
family = (cpuid_sig & 0x00000f00) >> 8,
|
||||||
|
model = (cpuid_sig & 0x000000f0) >> 4,
|
||||||
|
stepping = cpuid_sig & 0x0000000f;
|
||||||
|
unsigned brand_id = extra_info & 0x0000000f,
|
||||||
|
cpu_count = (extra_info & 0x00ff0000) >> 16,
|
||||||
|
apic_id = (extra_info & 0xff000000) >> 24;
|
||||||
|
const char *type_str;
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
type_str = "primary processor";
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
type_str = "overdrive processor";
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
type_str = "secondary processor";
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
default:
|
||||||
|
type_str = "reserved";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
unsigned maxe = 0;
|
||||||
|
cpuid (&maxe, &unused, &unused, &unused, 0x80000000);
|
||||||
|
if (maxe >= 0x80000004)
|
||||||
|
{
|
||||||
|
unsigned *model_name = (unsigned *) szBuffer;
|
||||||
|
cpuid (&model_name[0], &model_name[1], &model_name[2], &model_name[3], 0x80000002);
|
||||||
|
cpuid (&model_name[4], &model_name[5], &model_name[6], &model_name[7], 0x80000003);
|
||||||
|
cpuid (&model_name[8], &model_name[9], &model_name[10], &model_name[11], 0x80000004);
|
||||||
|
model_name[12] = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// could implement a lookup table here if someone needs it
|
||||||
|
strcpy (szBuffer, "unknown");
|
||||||
|
}
|
||||||
|
bufptr += __small_sprintf (bufptr, "type : %s\n"
|
||||||
|
"cpu family : %d\n"
|
||||||
|
"model : %d\n"
|
||||||
|
"model name : %s\n"
|
||||||
|
"stepping : %d\n"
|
||||||
|
"brand id : %d\n"
|
||||||
|
"cpu count : %d\n"
|
||||||
|
"apic id : %d\n"
|
||||||
|
"cpu MHz : %d\n"
|
||||||
|
"fpu : %s\n",
|
||||||
|
type_str,
|
||||||
|
family,
|
||||||
|
model,
|
||||||
|
szBuffer,
|
||||||
|
stepping,
|
||||||
|
brand_id,
|
||||||
|
cpu_count,
|
||||||
|
apic_id,
|
||||||
|
cpu_mhz,
|
||||||
|
IsProcessorFeaturePresent (PF_FLOATING_POINT_EMULATED) ? "no" : "yes");
|
||||||
|
print ("flags :");
|
||||||
|
if (features1 & (1 << 0))
|
||||||
|
print (" fpu");
|
||||||
|
if (features1 & (1 << 1))
|
||||||
|
print (" vme");
|
||||||
|
if (features1 & (1 << 2))
|
||||||
|
print (" de");
|
||||||
|
if (features1 & (1 << 3))
|
||||||
|
print (" pse");
|
||||||
|
if (features1 & (1 << 4))
|
||||||
|
print (" tsc");
|
||||||
|
if (features1 & (1 << 5))
|
||||||
|
print (" msr");
|
||||||
|
if (features1 & (1 << 6))
|
||||||
|
print (" pae");
|
||||||
|
if (features1 & (1 << 7))
|
||||||
|
print (" mce");
|
||||||
|
if (features1 & (1 << 8))
|
||||||
|
print (" cx8");
|
||||||
|
if (features1 & (1 << 9))
|
||||||
|
print (" apic");
|
||||||
|
if (features1 & (1 << 11))
|
||||||
|
print (" sep");
|
||||||
|
if (features1 & (1 << 12))
|
||||||
|
print (" mtrr");
|
||||||
|
if (features1 & (1 << 13))
|
||||||
|
print (" pge");
|
||||||
|
if (features1 & (1 << 14))
|
||||||
|
print (" mca");
|
||||||
|
if (features1 & (1 << 15))
|
||||||
|
print (" cmov");
|
||||||
|
if (features1 & (1 << 16))
|
||||||
|
print (" pat");
|
||||||
|
if (features1 & (1 << 17))
|
||||||
|
print (" pse36");
|
||||||
|
if (features1 & (1 << 18))
|
||||||
|
print (" psn");
|
||||||
|
if (features1 & (1 << 19))
|
||||||
|
print (" clfl");
|
||||||
|
if (features1 & (1 << 21))
|
||||||
|
print (" dtes");
|
||||||
|
if (features1 & (1 << 22))
|
||||||
|
print (" acpi");
|
||||||
|
if (features1 & (1 << 23))
|
||||||
|
print (" mmx");
|
||||||
|
if (features1 & (1 << 24))
|
||||||
|
print (" fxsr");
|
||||||
|
if (features1 & (1 << 25))
|
||||||
|
print (" sse");
|
||||||
|
if (features1 & (1 << 26))
|
||||||
|
print (" sse2");
|
||||||
|
if (features1 & (1 << 27))
|
||||||
|
print (" ss");
|
||||||
|
if (features1 & (1 << 28))
|
||||||
|
print (" htt");
|
||||||
|
if (features1 & (1 << 29))
|
||||||
|
print (" tmi");
|
||||||
|
if (features1 & (1 << 30))
|
||||||
|
print (" ia-64");
|
||||||
|
if (features1 & (1 << 31))
|
||||||
|
print (" pbe");
|
||||||
|
if (features2 & (1 << 0))
|
||||||
|
print (" sse3");
|
||||||
|
if (features2 & (1 << 3))
|
||||||
|
print (" mon");
|
||||||
|
if (features2 & (1 << 4))
|
||||||
|
print (" dscpl");
|
||||||
|
if (features2 & (1 << 8))
|
||||||
|
print (" tm2");
|
||||||
|
if (features2 & (1 << 10))
|
||||||
|
print (" cid");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
bufptr += __small_sprintf (bufptr, "cpu MHz : %d\n"
|
||||||
|
"fpu : %s\n",
|
||||||
|
cpu_mhz,
|
||||||
|
IsProcessorFeaturePresent (PF_FLOATING_POINT_EMULATED) ? "no" : "yes");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (dwOldThreadAffinityMask != 0)
|
||||||
|
SetThreadAffinityMask (GetCurrentThread (), dwOldThreadAffinityMask);
|
||||||
|
|
||||||
|
RegCloseKey (hKey);
|
||||||
|
bufptr += __small_sprintf (bufptr, "\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
return bufptr - destbuf;
|
||||||
|
}
|
||||||
|
|
||||||
|
#undef read_value
|
||||||
|
|
||||||
|
static __off64_t
|
||||||
|
format_proc_partitions (char *destbuf, size_t maxsize)
|
||||||
|
{
|
||||||
|
char *bufptr = destbuf;
|
||||||
|
print ("major minor #blocks name\n\n");
|
||||||
|
|
||||||
|
if (wincap.is_winnt ())
|
||||||
|
{
|
||||||
|
for (int drive_number=0;;drive_number++)
|
||||||
|
{
|
||||||
|
CHAR szDriveName[MAX_PATH];
|
||||||
|
__small_sprintf (szDriveName, "\\\\.\\PHYSICALDRIVE%d", drive_number);
|
||||||
|
HANDLE hDevice;
|
||||||
|
hDevice = CreateFile (szDriveName,
|
||||||
|
GENERIC_READ,
|
||||||
|
FILE_SHARE_READ | FILE_SHARE_WRITE,
|
||||||
|
NULL,
|
||||||
|
OPEN_EXISTING,
|
||||||
|
0,
|
||||||
|
NULL);
|
||||||
|
if (hDevice == INVALID_HANDLE_VALUE)
|
||||||
|
{
|
||||||
|
if (GetLastError () == ERROR_PATH_NOT_FOUND)
|
||||||
|
break;
|
||||||
|
__seterrno ();
|
||||||
|
debug_printf ("CreateFile %d %E", GetLastError ());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DWORD dwBytesReturned, dwRetCode;
|
||||||
|
DISK_GEOMETRY dg;
|
||||||
|
int buf_size = 4096;
|
||||||
|
char buf[buf_size];
|
||||||
|
dwRetCode = DeviceIoControl (hDevice,
|
||||||
|
IOCTL_DISK_GET_DRIVE_GEOMETRY,
|
||||||
|
NULL,
|
||||||
|
0,
|
||||||
|
&dg,
|
||||||
|
sizeof (dg),
|
||||||
|
&dwBytesReturned,
|
||||||
|
NULL);
|
||||||
|
if (!dwRetCode)
|
||||||
|
debug_printf ("DeviceIoControl %E");
|
||||||
|
else
|
||||||
|
{
|
||||||
|
bufptr += __small_sprintf (bufptr, "%5d %5d %9U sd%c\n",
|
||||||
|
FH_FLOPPY,
|
||||||
|
drive_number * 16 + 32,
|
||||||
|
(long long)((dg.Cylinders.QuadPart * dg.TracksPerCylinder *
|
||||||
|
dg.SectorsPerTrack * dg.BytesPerSector) >> 6),
|
||||||
|
drive_number + 'a');
|
||||||
|
}
|
||||||
|
while (dwRetCode = DeviceIoControl (hDevice,
|
||||||
|
IOCTL_DISK_GET_DRIVE_LAYOUT,
|
||||||
|
NULL,
|
||||||
|
0,
|
||||||
|
(DRIVE_LAYOUT_INFORMATION *) buf,
|
||||||
|
buf_size,
|
||||||
|
&dwBytesReturned,
|
||||||
|
NULL),
|
||||||
|
!dwRetCode && GetLastError () == ERROR_INSUFFICIENT_BUFFER)
|
||||||
|
buf_size *= 2;
|
||||||
|
if (!dwRetCode)
|
||||||
|
debug_printf ("DeviceIoControl %E");
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DRIVE_LAYOUT_INFORMATION *dli = (DRIVE_LAYOUT_INFORMATION *) buf;
|
||||||
|
for (unsigned partition = 0; partition < dli->PartitionCount; partition++)
|
||||||
|
{
|
||||||
|
if (dli->PartitionEntry[partition].PartitionLength.QuadPart == 0)
|
||||||
|
continue;
|
||||||
|
bufptr += __small_sprintf (bufptr, "%5d %5d %9U sd%c%d\n",
|
||||||
|
FH_FLOPPY,
|
||||||
|
drive_number * 16 + partition + 33,
|
||||||
|
(long long)(dli->PartitionEntry[partition].PartitionLength.QuadPart >> 6),
|
||||||
|
drive_number + 'a',
|
||||||
|
partition + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CloseHandle (hDevice);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// not worth the effort
|
||||||
|
// you need a 16 bit thunk DLL to access the partition table on Win9x
|
||||||
|
// and then you have to decode it yourself
|
||||||
|
}
|
||||||
|
return bufptr - destbuf;
|
||||||
|
}
|
||||||
|
|
||||||
|
#undef print
|
||||||
|
|
|
@ -421,8 +421,7 @@ map::erase (int i)
|
||||||
|
|
||||||
static map *mmapped_areas;
|
static map *mmapped_areas;
|
||||||
|
|
||||||
extern "C"
|
extern "C" caddr_t
|
||||||
caddr_t
|
|
||||||
mmap64 (caddr_t addr, size_t len, int prot, int flags, int fd, __off64_t off)
|
mmap64 (caddr_t addr, size_t len, int prot, int flags, int fd, __off64_t off)
|
||||||
{
|
{
|
||||||
syscall_printf ("addr %x, len %d, prot %x, flags %x, fd %d, off %D",
|
syscall_printf ("addr %x, len %d, prot %x, flags %x, fd %d, off %D",
|
||||||
|
@ -583,8 +582,7 @@ mmap64 (caddr_t addr, size_t len, int prot, int flags, int fd, __off64_t off)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C"
|
extern "C" caddr_t
|
||||||
caddr_t
|
|
||||||
mmap (caddr_t addr, size_t len, int prot, int flags, int fd, __off32_t off)
|
mmap (caddr_t addr, size_t len, int prot, int flags, int fd, __off32_t off)
|
||||||
{
|
{
|
||||||
return mmap64 (addr, len, prot, flags, fd, (__off64_t)off);
|
return mmap64 (addr, len, prot, flags, fd, (__off64_t)off);
|
||||||
|
@ -593,8 +591,7 @@ mmap (caddr_t addr, size_t len, int prot, int flags, int fd, __off32_t off)
|
||||||
/* munmap () removes an mmapped area. It insists that base area
|
/* munmap () removes an mmapped area. It insists that base area
|
||||||
requested is the same as that mmapped, error if not. */
|
requested is the same as that mmapped, error if not. */
|
||||||
|
|
||||||
extern "C"
|
extern "C" int
|
||||||
int
|
|
||||||
munmap (caddr_t addr, size_t len)
|
munmap (caddr_t addr, size_t len)
|
||||||
{
|
{
|
||||||
syscall_printf ("munmap (addr %x, len %d)", addr, len);
|
syscall_printf ("munmap (addr %x, len %d)", addr, len);
|
||||||
|
@ -654,8 +651,7 @@ munmap (caddr_t addr, size_t len)
|
||||||
|
|
||||||
/* Sync file with memory. Ignore flags for now. */
|
/* Sync file with memory. Ignore flags for now. */
|
||||||
|
|
||||||
extern "C"
|
extern "C" int
|
||||||
int
|
|
||||||
msync (caddr_t addr, size_t len, int flags)
|
msync (caddr_t addr, size_t len, int flags)
|
||||||
{
|
{
|
||||||
syscall_printf ("addr = %x, len = %d, flags = %x",
|
syscall_printf ("addr = %x, len = %d, flags = %x",
|
||||||
|
@ -878,8 +874,7 @@ fhandler_disk_file::fixup_mmap_after_fork (HANDLE h, DWORD access, DWORD offset,
|
||||||
|
|
||||||
/* Set memory protection */
|
/* Set memory protection */
|
||||||
|
|
||||||
extern "C"
|
extern "C" int
|
||||||
int
|
|
||||||
mprotect (caddr_t addr, size_t len, int prot)
|
mprotect (caddr_t addr, size_t len, int prot)
|
||||||
{
|
{
|
||||||
DWORD old_prot;
|
DWORD old_prot;
|
||||||
|
|
|
@ -142,8 +142,7 @@ NTReadEA (const char *file, const char *attrname, char *attrbuf, int len)
|
||||||
* pointer to buffer with file's EAs, or NULL if any error occured.
|
* pointer to buffer with file's EAs, or NULL if any error occured.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static
|
static PFILE_FULL_EA_INFORMATION
|
||||||
PFILE_FULL_EA_INFORMATION
|
|
||||||
NTReadEARaw (HANDLE hFileSource, int *len)
|
NTReadEARaw (HANDLE hFileSource, int *len)
|
||||||
{
|
{
|
||||||
WIN32_STREAM_ID StreamId;
|
WIN32_STREAM_ID StreamId;
|
||||||
|
|
|
@ -26,8 +26,7 @@
|
||||||
#include "cygheap.h"
|
#include "cygheap.h"
|
||||||
#include "sigproc.h"
|
#include "sigproc.h"
|
||||||
|
|
||||||
extern "C"
|
extern "C" int
|
||||||
int
|
|
||||||
poll (struct pollfd *fds, unsigned int nfds, int timeout)
|
poll (struct pollfd *fds, unsigned int nfds, int timeout)
|
||||||
{
|
{
|
||||||
int max_fd = 0;
|
int max_fd = 0;
|
||||||
|
|
|
@ -413,8 +413,7 @@ getacl (const char *file, DWORD attr, int nentries, __aclent32_t *aclbufp)
|
||||||
return pos;
|
return pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
static
|
static int
|
||||||
int
|
|
||||||
acl_worker (const char *path, int cmd, int nentries, __aclent32_t *aclbufp,
|
acl_worker (const char *path, int cmd, int nentries, __aclent32_t *aclbufp,
|
||||||
int nofollow)
|
int nofollow)
|
||||||
{
|
{
|
||||||
|
@ -493,22 +492,19 @@ acl_worker (const char *path, int cmd, int nentries, __aclent32_t *aclbufp,
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C"
|
extern "C" int
|
||||||
int
|
|
||||||
acl32 (const char *path, int cmd, int nentries, __aclent32_t *aclbufp)
|
acl32 (const char *path, int cmd, int nentries, __aclent32_t *aclbufp)
|
||||||
{
|
{
|
||||||
return acl_worker (path, cmd, nentries, aclbufp, 0);
|
return acl_worker (path, cmd, nentries, aclbufp, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C"
|
extern "C" int
|
||||||
int
|
|
||||||
lacl32 (const char *path, int cmd, int nentries, __aclent32_t *aclbufp)
|
lacl32 (const char *path, int cmd, int nentries, __aclent32_t *aclbufp)
|
||||||
{
|
{
|
||||||
return acl_worker (path, cmd, nentries, aclbufp, 1);
|
return acl_worker (path, cmd, nentries, aclbufp, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C"
|
extern "C" int
|
||||||
int
|
|
||||||
facl32 (int fd, int cmd, int nentries, __aclent32_t *aclbufp)
|
facl32 (int fd, int cmd, int nentries, __aclent32_t *aclbufp)
|
||||||
{
|
{
|
||||||
cygheap_fdget cfd (fd);
|
cygheap_fdget cfd (fd);
|
||||||
|
@ -528,8 +524,7 @@ facl32 (int fd, int cmd, int nentries, __aclent32_t *aclbufp)
|
||||||
return acl_worker (path, cmd, nentries, aclbufp, 0);
|
return acl_worker (path, cmd, nentries, aclbufp, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C"
|
extern "C" int
|
||||||
int
|
|
||||||
aclcheck32 (__aclent32_t *aclbufp, int nentries, int *which)
|
aclcheck32 (__aclent32_t *aclbufp, int nentries, int *which)
|
||||||
{
|
{
|
||||||
BOOL has_user_obj = FALSE;
|
BOOL has_user_obj = FALSE;
|
||||||
|
@ -661,8 +656,8 @@ aclcheck32 (__aclent32_t *aclbufp, int nentries, int *which)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static
|
static int
|
||||||
int acecmp (const void *a1, const void *a2)
|
acecmp (const void *a1, const void *a2)
|
||||||
{
|
{
|
||||||
#define ace(i) ((const __aclent32_t *) a##i)
|
#define ace(i) ((const __aclent32_t *) a##i)
|
||||||
int ret = ace (1)->a_type - ace (2)->a_type;
|
int ret = ace (1)->a_type - ace (2)->a_type;
|
||||||
|
@ -672,8 +667,7 @@ int acecmp (const void *a1, const void *a2)
|
||||||
#undef ace
|
#undef ace
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C"
|
extern "C" int
|
||||||
int
|
|
||||||
aclsort32 (int nentries, int, __aclent32_t *aclbufp)
|
aclsort32 (int nentries, int, __aclent32_t *aclbufp)
|
||||||
{
|
{
|
||||||
if (aclcheck32 (aclbufp, nentries, NULL))
|
if (aclcheck32 (aclbufp, nentries, NULL))
|
||||||
|
@ -687,8 +681,7 @@ aclsort32 (int nentries, int, __aclent32_t *aclbufp)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C"
|
extern "C" int
|
||||||
int
|
|
||||||
acltomode32 (__aclent32_t *aclbufp, int nentries, mode_t *modep)
|
acltomode32 (__aclent32_t *aclbufp, int nentries, mode_t *modep)
|
||||||
{
|
{
|
||||||
int pos;
|
int pos;
|
||||||
|
@ -727,8 +720,7 @@ acltomode32 (__aclent32_t *aclbufp, int nentries, mode_t *modep)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C"
|
extern "C" int
|
||||||
int
|
|
||||||
aclfrommode32 (__aclent32_t *aclbufp, int nentries, mode_t *modep)
|
aclfrommode32 (__aclent32_t *aclbufp, int nentries, mode_t *modep)
|
||||||
{
|
{
|
||||||
int pos;
|
int pos;
|
||||||
|
@ -765,15 +757,13 @@ aclfrommode32 (__aclent32_t *aclbufp, int nentries, mode_t *modep)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C"
|
extern "C" int
|
||||||
int
|
|
||||||
acltopbits32 (__aclent32_t *aclbufp, int nentries, mode_t *pbitsp)
|
acltopbits32 (__aclent32_t *aclbufp, int nentries, mode_t *pbitsp)
|
||||||
{
|
{
|
||||||
return acltomode32 (aclbufp, nentries, pbitsp);
|
return acltomode32 (aclbufp, nentries, pbitsp);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C"
|
extern "C" int
|
||||||
int
|
|
||||||
aclfrompbits32 (__aclent32_t *aclbufp, int nentries, mode_t *pbitsp)
|
aclfrompbits32 (__aclent32_t *aclbufp, int nentries, mode_t *pbitsp)
|
||||||
{
|
{
|
||||||
return aclfrommode32 (aclbufp, nentries, pbitsp);
|
return aclfrommode32 (aclbufp, nentries, pbitsp);
|
||||||
|
@ -791,8 +781,7 @@ permtostr (mode_t perm)
|
||||||
return pbuf;
|
return pbuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C"
|
extern "C" char *
|
||||||
char *
|
|
||||||
acltotext32 (__aclent32_t *aclbufp, int aclcnt)
|
acltotext32 (__aclent32_t *aclbufp, int aclcnt)
|
||||||
{
|
{
|
||||||
if (!aclbufp || aclcnt < 1 || aclcnt > MAX_ACL_ENTRIES
|
if (!aclbufp || aclcnt < 1 || aclcnt > MAX_ACL_ENTRIES
|
||||||
|
@ -868,8 +857,7 @@ permfromstr (char *perm)
|
||||||
return mode;
|
return mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C"
|
extern "C" __aclent32_t *
|
||||||
__aclent32_t *
|
|
||||||
aclfromtext32 (char *acltextp, int *)
|
aclfromtext32 (char *acltextp, int *)
|
||||||
{
|
{
|
||||||
if (!acltextp)
|
if (!acltextp)
|
||||||
|
@ -992,79 +980,68 @@ acl16to32 (__aclent16_t *aclbufp, int nentries)
|
||||||
return aclbufp32;
|
return aclbufp32;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C"
|
extern "C" int
|
||||||
int
|
|
||||||
acl (const char *path, int cmd, int nentries, __aclent16_t *aclbufp)
|
acl (const char *path, int cmd, int nentries, __aclent16_t *aclbufp)
|
||||||
{
|
{
|
||||||
return acl32 (path, cmd, nentries, acl16to32 (aclbufp, nentries));
|
return acl32 (path, cmd, nentries, acl16to32 (aclbufp, nentries));
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C"
|
extern "C" int
|
||||||
int
|
|
||||||
facl (int fd, int cmd, int nentries, __aclent16_t *aclbufp)
|
facl (int fd, int cmd, int nentries, __aclent16_t *aclbufp)
|
||||||
{
|
{
|
||||||
return facl32 (fd, cmd, nentries, acl16to32 (aclbufp, nentries));
|
return facl32 (fd, cmd, nentries, acl16to32 (aclbufp, nentries));
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C"
|
extern "C" int
|
||||||
int
|
|
||||||
lacl (const char *path, int cmd, int nentries, __aclent16_t *aclbufp)
|
lacl (const char *path, int cmd, int nentries, __aclent16_t *aclbufp)
|
||||||
{
|
{
|
||||||
return lacl32 (path, cmd, nentries, acl16to32 (aclbufp, nentries));
|
return lacl32 (path, cmd, nentries, acl16to32 (aclbufp, nentries));
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C"
|
extern "C" int
|
||||||
int
|
|
||||||
aclcheck (__aclent16_t *aclbufp, int nentries, int *which)
|
aclcheck (__aclent16_t *aclbufp, int nentries, int *which)
|
||||||
{
|
{
|
||||||
return aclcheck32 (acl16to32 (aclbufp, nentries), nentries, which);
|
return aclcheck32 (acl16to32 (aclbufp, nentries), nentries, which);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C"
|
extern "C" int
|
||||||
int
|
|
||||||
aclsort (int nentries, int i, __aclent16_t *aclbufp)
|
aclsort (int nentries, int i, __aclent16_t *aclbufp)
|
||||||
{
|
{
|
||||||
return aclsort32 (nentries, i, acl16to32 (aclbufp, nentries));
|
return aclsort32 (nentries, i, acl16to32 (aclbufp, nentries));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
extern "C"
|
extern "C" int
|
||||||
int
|
|
||||||
acltomode (__aclent16_t *aclbufp, int nentries, mode_t *modep)
|
acltomode (__aclent16_t *aclbufp, int nentries, mode_t *modep)
|
||||||
{
|
{
|
||||||
return acltomode32 (acl16to32 (aclbufp, nentries), nentries, modep);
|
return acltomode32 (acl16to32 (aclbufp, nentries), nentries, modep);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C"
|
extern "C" int
|
||||||
int
|
|
||||||
aclfrommode (__aclent16_t *aclbufp, int nentries, mode_t *modep)
|
aclfrommode (__aclent16_t *aclbufp, int nentries, mode_t *modep)
|
||||||
{
|
{
|
||||||
return aclfrommode32 ((__aclent32_t *)aclbufp, nentries, modep);
|
return aclfrommode32 ((__aclent32_t *)aclbufp, nentries, modep);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C"
|
extern "C" int
|
||||||
int
|
|
||||||
acltopbits (__aclent16_t *aclbufp, int nentries, mode_t *pbitsp)
|
acltopbits (__aclent16_t *aclbufp, int nentries, mode_t *pbitsp)
|
||||||
{
|
{
|
||||||
return acltopbits32 (acl16to32 (aclbufp, nentries), nentries, pbitsp);
|
return acltopbits32 (acl16to32 (aclbufp, nentries), nentries, pbitsp);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C"
|
extern "C" int
|
||||||
int
|
|
||||||
aclfrompbits (__aclent16_t *aclbufp, int nentries, mode_t *pbitsp)
|
aclfrompbits (__aclent16_t *aclbufp, int nentries, mode_t *pbitsp)
|
||||||
{
|
{
|
||||||
return aclfrompbits32 ((__aclent32_t *)aclbufp, nentries, pbitsp);
|
return aclfrompbits32 ((__aclent32_t *)aclbufp, nentries, pbitsp);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C"
|
extern "C" char *
|
||||||
char *
|
|
||||||
acltotext (__aclent16_t *aclbufp, int aclcnt)
|
acltotext (__aclent16_t *aclbufp, int aclcnt)
|
||||||
{
|
{
|
||||||
return acltotext32 (acl16to32 (aclbufp, aclcnt), aclcnt);
|
return acltotext32 (acl16to32 (aclbufp, aclcnt), aclcnt);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C"
|
extern "C" __aclent16_t *
|
||||||
__aclent16_t *
|
|
||||||
aclfromtext (char *acltextp, int * aclcnt)
|
aclfromtext (char *acltextp, int * aclcnt)
|
||||||
{
|
{
|
||||||
return (__aclent16_t *) aclfromtext32 (acltextp, aclcnt);
|
return (__aclent16_t *) aclfromtext32 (acltextp, aclcnt);
|
||||||
|
|
|
@ -95,8 +95,7 @@ typedef long fd_mask;
|
||||||
|
|
||||||
/* The main select code.
|
/* The main select code.
|
||||||
*/
|
*/
|
||||||
extern "C"
|
extern "C" int
|
||||||
int
|
|
||||||
cygwin_select (int maxfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
|
cygwin_select (int maxfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
|
||||||
struct timeval *to)
|
struct timeval *to)
|
||||||
{
|
{
|
||||||
|
|
|
@ -35,8 +35,7 @@
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
extern "C"
|
extern "C" char *
|
||||||
char *
|
|
||||||
strsep (char **stringp,
|
strsep (char **stringp,
|
||||||
const char *delim)
|
const char *delim)
|
||||||
{
|
{
|
||||||
|
|
|
@ -60,8 +60,7 @@ static int process_logmask = LOG_UPTO (LOG_DEBUG);
|
||||||
* openlog: save the passed args. Don't open the
|
* openlog: save the passed args. Don't open the
|
||||||
* system log (NT) or log file (95) yet.
|
* system log (NT) or log file (95) yet.
|
||||||
*/
|
*/
|
||||||
extern "C"
|
extern "C" void
|
||||||
void
|
|
||||||
openlog (const char *ident, int logopt, int facility)
|
openlog (const char *ident, int logopt, int facility)
|
||||||
{
|
{
|
||||||
debug_printf ("openlog called with (%s, %d, %d)",
|
debug_printf ("openlog called with (%s, %d, %d)",
|
||||||
|
@ -208,8 +207,7 @@ pass_handler::print_va (const char *fmt, va_list list)
|
||||||
* always point to that.
|
* always point to that.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
extern "C"
|
extern "C" void
|
||||||
void
|
|
||||||
syslog (int priority, const char *message, ...)
|
syslog (int priority, const char *message, ...)
|
||||||
{
|
{
|
||||||
debug_printf ("%x %s", priority, message);
|
debug_printf ("%x %s", priority, message);
|
||||||
|
@ -410,8 +408,7 @@ syslog (int priority, const char *message, ...)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C"
|
extern "C" void
|
||||||
void
|
|
||||||
closelog (void)
|
closelog (void)
|
||||||
{
|
{
|
||||||
;
|
;
|
||||||
|
|
|
@ -28,22 +28,19 @@ details. */
|
||||||
|
|
||||||
extern fhandler_tty_master *tty_master;
|
extern fhandler_tty_master *tty_master;
|
||||||
|
|
||||||
extern "C"
|
extern "C" int
|
||||||
int
|
|
||||||
grantpt (int fd)
|
grantpt (int fd)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C"
|
extern "C" int
|
||||||
int
|
|
||||||
unlockpt (int fd)
|
unlockpt (int fd)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C"
|
extern "C" int
|
||||||
int
|
|
||||||
ttyslot (void)
|
ttyslot (void)
|
||||||
{
|
{
|
||||||
if (NOTSTATE (myself, PID_USETTY))
|
if (NOTSTATE (myself, PID_USETTY))
|
||||||
|
|
|
@ -20,20 +20,19 @@ details. */
|
||||||
/* This is called _wait and not wait because the real wait is defined
|
/* This is called _wait and not wait because the real wait is defined
|
||||||
in libc/syscalls/syswait.c. It calls us. */
|
in libc/syscalls/syswait.c. It calls us. */
|
||||||
|
|
||||||
extern "C"
|
extern "C" pid_t
|
||||||
pid_t
|
|
||||||
wait (int *status)
|
wait (int *status)
|
||||||
{
|
{
|
||||||
return wait4 (-1, status, 0, NULL);
|
return wait4 (-1, status, 0, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
pid_t
|
extern "C" pid_t
|
||||||
waitpid (pid_t intpid, int *status, int options)
|
waitpid (pid_t intpid, int *status, int options)
|
||||||
{
|
{
|
||||||
return wait4 (intpid, status, options, NULL);
|
return wait4 (intpid, status, options, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
pid_t
|
extern "C" pid_t
|
||||||
wait3 (int *status, int options, struct rusage *r)
|
wait3 (int *status, int options, struct rusage *r)
|
||||||
{
|
{
|
||||||
return wait4 (-1, status, options, r);
|
return wait4 (-1, status, options, r);
|
||||||
|
@ -44,7 +43,7 @@ wait3 (int *status, int options, struct rusage *r)
|
||||||
* not work correctly.
|
* not work correctly.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
pid_t
|
extern "C" pid_t
|
||||||
wait4 (int intpid, int *status, int options, struct rusage *r)
|
wait4 (int intpid, int *status, int options, struct rusage *r)
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
|
|
Loading…
Reference in New Issue