newlib/winsup/cygwin/wincap.h

116 lines
4.2 KiB
C
Raw Normal View History

/* wincap.h: Header for OS capability class.
Copyright 2001, 2002 Red Hat, Inc.
This file is part of Cygwin.
This software is a copyrighted work licensed under the terms of the
Cygwin license. Please consult the file "CYGWIN_LICENSE" for
details. */
#ifndef _WINCAP_H
#define _WINCAP_H
struct wincaps
2001-11-05 07:09:15 +01:00
{
DWORD lock_file_highword;
DWORD chunksize;
int shared;
unsigned is_winnt : 1;
unsigned access_denied_on_delete : 1;
unsigned has_delete_on_close : 1;
unsigned has_page_guard : 1;
unsigned has_security : 1;
unsigned has_security_descriptor_control : 1;
unsigned has_get_process_times : 1;
unsigned has_lseek_bug : 1;
unsigned has_lock_file_ex : 1;
unsigned has_signal_object_and_wait : 1;
unsigned has_eventlog : 1;
unsigned has_ip_helper_lib : 1;
unsigned has_set_handle_information : 1;
unsigned has_set_handle_information_on_console_handles: 1;
unsigned supports_smp : 1;
unsigned map_view_of_file_ex_sucks : 1;
unsigned altgr_is_ctrl_alt : 1;
unsigned has_physical_mem_access : 1;
unsigned has_working_copy_on_write : 1;
unsigned share_mmaps_only_by_name : 1;
unsigned virtual_protect_works_on_shared_pages : 1;
unsigned has_hard_links : 1;
unsigned can_open_directories : 1;
unsigned has_move_file_ex : 1;
unsigned has_negative_pids : 1;
unsigned has_unreliable_pipes : 1;
unsigned has_try_enter_critical_section : 1;
unsigned has_raw_devices : 1;
unsigned has_valid_processorlevel : 1;
* cygwin.din (fstat64): New symbol. (ftruncate64): Ditto. (lseek64): Ditto. (lstat64): Ditto. (mmap64): Ditto. (seekdir64): Ditto. (stat64): Ditto. (telldir64): Ditto. (truncate64): Ditto. * dir.cc (telldir64): New function. (telldir): Call telldir64(). (seekdir64): New function. (seekdir): Call seekdir64(). * fhandler.h: Redefine all methods using __off32_t to use __off64_t. * fhandler.cc: Use __off64_t and struct __stat64 throughout. * fhandler_clipboard.cc: Ditto. * fhandler_disk_file.cc: Ditto. * fhandler_dsp.cc: Ditto. * fhandler_floppy.cc: Ditto. * fhandler_mem.cc: Ditto. * fhandler_random.cc: Ditto. * fhandler_socket.cc: Ditto. * fhandler_tape.cc: Ditto. * fhandler_zero.cc: Ditto. * pipe.cc: Ditto. * glob.c: Ditto, call lstat64 and stat64 in Cygwin. * mmap.cc: Use __off64_t throughout. (mmap64): New function. * sec_acl.cc (acl_worker): Use struct __stat64, call stat64 and lstat64. * syscalls.cc (lseek64): New function. (stat64_to_stat32): Ditto. (fstat64): Ditto. (stat64): Ditto. (lstat64): Ditto. (ftruncate64): Ditto. (truncate64): Ditto. (_fstat): Call fstat64. (_stat): Call stat64. (cygwin_lstat): Rename to avoid declaration problem. Call lstat64. (stat_worker): Use struct __stat64. (access): Ditto. (ftruncate): Call ftruncate64. (truncate): Call truncate64. * wincap.cc: Set flag has_64bit_file_access appropriately. * wincap.h: Add flag has_64bit_file_access. * winsup.h (ILLEGAL_SEEK): Define as __off64_t. (stat_dev): Declare using struct __stat64. (stat_worker): Ditto. * include/cygwin/stat.h (struct __stat32): Define if compiling Cygwin. (struct __stat64): Ditto. (struct stat): Revert definition with explicitly sized datatypes. Eliminate sized field names. * include/cygwin/types.h (blksize_t): New type. (__blkcnt32_t): Ditto. (__blkcnt64_t): Ditto. (blkcnt_t): Ditto.
2002-02-25 18:47:51 +01:00
unsigned has_64bit_file_access : 1;
* autoload.cc: Add dynamic load statements for 'ZwQueryInformationProcess' and 'ZwQueryVirtualMemory'. * fhandler.h: Change type of bufalloc and filesize members of fhandler_virtual from int to size_t. Change type of position member from __off32_t to __off64_t. Add new fileid member to fhandler_virtual class. Make seekdir take an __off64_t argument. Make lseek take an __off64_t argument. Add fill_filebuf method to fhandler_virtual. Add fill_filebuf method to fhandler_proc. Add fill_filebuf method to fhandler_registry. Add fill_filebuf method to fhandler_process. Add saved_pid and saved_p members to fhandler_process. * fhandler_proc.cc (proc_listing_array): Add 'loadavg', 'meminfo', and 'stat'. (proc_fhandlers array): Ditto. (fhandler_proc::open): Use fill_filebuf to flesh out the file contents. (fhandler_proc::fill_filebuf): New method. (fhandler_proc::format_proc_meminfo): Ditto. (fhandler_proc::format_proc_stat): Ditto. (fhandler_proc::format_proc_uptime): Ditto. * fhandler_process.cc (process_listing): Add 'stat' and 'statm'. (fhandler_process::fstat): Find the _pinfo structure for the process named in the filename. Return ENOENT if the process is no longer around. Set the gid and uid fields of the stat structure. (fhandler_process::open): Store pid and pointer to _pinfo structure in saved_pid and saved_p respectively. Use fill_filebuf to flesh out file contents. (fhandler_proc::fill_filebuf): New method. (format_process_stat): New function. (format_process_status): Ditto. (format_process_statm): Ditto. (get_process_state): Ditto. (get_mem_values): Ditto. * fhandler_registry.cc (fhandler_registry::seekdir): Change argument type from __off32_t to __off64_t. (fhandler_registry::fill_filebuf): New method. * fhandler_virtual.cc (fhandler_virtual::seekdir): Change argument type from __off32_t to __off64_t. (fhandler_virtual::lseek): Ditto. (fhandler_virtual::fill_filebuf): New method. (fhandler_virtual::fhandler_virtual): Initialise fileid to -1. * wincap.cc: Set flag has_process_io_counters appropriately. * wincap.h: Add flag has_process_io_counters.
2002-05-12 03:37:48 +02:00
unsigned has_process_io_counters : 1;
unsigned supports_reading_modem_output_lines : 1;
unsigned needs_memory_protection : 1;
unsigned pty_needs_alloc_console : 1;
unsigned has_terminal_services : 1;
};
class wincapc
{
OSVERSIONINFO version;
char osnam[40];
void *caps;
public:
void init ();
void set_chunksize (DWORD nchunksize);
2001-11-05 07:09:15 +01:00
const char *osname () const { return osnam; }
#define IMPLEMENT(cap) cap() const { return ((wincaps *)this->caps)->cap; }
DWORD IMPLEMENT (lock_file_highword)
DWORD IMPLEMENT (chunksize)
int IMPLEMENT (shared)
bool IMPLEMENT (is_winnt)
bool IMPLEMENT (access_denied_on_delete)
bool IMPLEMENT (has_delete_on_close)
bool IMPLEMENT (has_page_guard)
bool IMPLEMENT (has_security)
bool IMPLEMENT (has_security_descriptor_control)
bool IMPLEMENT (has_get_process_times)
bool IMPLEMENT (has_lseek_bug)
bool IMPLEMENT (has_lock_file_ex)
bool IMPLEMENT (has_signal_object_and_wait)
bool IMPLEMENT (has_eventlog)
bool IMPLEMENT (has_ip_helper_lib)
bool IMPLEMENT (has_set_handle_information)
bool IMPLEMENT (has_set_handle_information_on_console_handles)
bool IMPLEMENT (supports_smp)
bool IMPLEMENT (map_view_of_file_ex_sucks)
bool IMPLEMENT (altgr_is_ctrl_alt)
bool IMPLEMENT (has_physical_mem_access)
bool IMPLEMENT (has_working_copy_on_write)
bool IMPLEMENT (share_mmaps_only_by_name)
bool IMPLEMENT (virtual_protect_works_on_shared_pages)
bool IMPLEMENT (has_hard_links)
bool IMPLEMENT (can_open_directories)
bool IMPLEMENT (has_move_file_ex)
bool IMPLEMENT (has_negative_pids)
bool IMPLEMENT (has_unreliable_pipes)
bool IMPLEMENT (has_try_enter_critical_section)
bool IMPLEMENT (has_raw_devices)
bool IMPLEMENT (has_valid_processorlevel)
* cygwin.din (fstat64): New symbol. (ftruncate64): Ditto. (lseek64): Ditto. (lstat64): Ditto. (mmap64): Ditto. (seekdir64): Ditto. (stat64): Ditto. (telldir64): Ditto. (truncate64): Ditto. * dir.cc (telldir64): New function. (telldir): Call telldir64(). (seekdir64): New function. (seekdir): Call seekdir64(). * fhandler.h: Redefine all methods using __off32_t to use __off64_t. * fhandler.cc: Use __off64_t and struct __stat64 throughout. * fhandler_clipboard.cc: Ditto. * fhandler_disk_file.cc: Ditto. * fhandler_dsp.cc: Ditto. * fhandler_floppy.cc: Ditto. * fhandler_mem.cc: Ditto. * fhandler_random.cc: Ditto. * fhandler_socket.cc: Ditto. * fhandler_tape.cc: Ditto. * fhandler_zero.cc: Ditto. * pipe.cc: Ditto. * glob.c: Ditto, call lstat64 and stat64 in Cygwin. * mmap.cc: Use __off64_t throughout. (mmap64): New function. * sec_acl.cc (acl_worker): Use struct __stat64, call stat64 and lstat64. * syscalls.cc (lseek64): New function. (stat64_to_stat32): Ditto. (fstat64): Ditto. (stat64): Ditto. (lstat64): Ditto. (ftruncate64): Ditto. (truncate64): Ditto. (_fstat): Call fstat64. (_stat): Call stat64. (cygwin_lstat): Rename to avoid declaration problem. Call lstat64. (stat_worker): Use struct __stat64. (access): Ditto. (ftruncate): Call ftruncate64. (truncate): Call truncate64. * wincap.cc: Set flag has_64bit_file_access appropriately. * wincap.h: Add flag has_64bit_file_access. * winsup.h (ILLEGAL_SEEK): Define as __off64_t. (stat_dev): Declare using struct __stat64. (stat_worker): Ditto. * include/cygwin/stat.h (struct __stat32): Define if compiling Cygwin. (struct __stat64): Ditto. (struct stat): Revert definition with explicitly sized datatypes. Eliminate sized field names. * include/cygwin/types.h (blksize_t): New type. (__blkcnt32_t): Ditto. (__blkcnt64_t): Ditto. (blkcnt_t): Ditto.
2002-02-25 18:47:51 +01:00
bool IMPLEMENT (has_64bit_file_access)
* autoload.cc: Add dynamic load statements for 'ZwQueryInformationProcess' and 'ZwQueryVirtualMemory'. * fhandler.h: Change type of bufalloc and filesize members of fhandler_virtual from int to size_t. Change type of position member from __off32_t to __off64_t. Add new fileid member to fhandler_virtual class. Make seekdir take an __off64_t argument. Make lseek take an __off64_t argument. Add fill_filebuf method to fhandler_virtual. Add fill_filebuf method to fhandler_proc. Add fill_filebuf method to fhandler_registry. Add fill_filebuf method to fhandler_process. Add saved_pid and saved_p members to fhandler_process. * fhandler_proc.cc (proc_listing_array): Add 'loadavg', 'meminfo', and 'stat'. (proc_fhandlers array): Ditto. (fhandler_proc::open): Use fill_filebuf to flesh out the file contents. (fhandler_proc::fill_filebuf): New method. (fhandler_proc::format_proc_meminfo): Ditto. (fhandler_proc::format_proc_stat): Ditto. (fhandler_proc::format_proc_uptime): Ditto. * fhandler_process.cc (process_listing): Add 'stat' and 'statm'. (fhandler_process::fstat): Find the _pinfo structure for the process named in the filename. Return ENOENT if the process is no longer around. Set the gid and uid fields of the stat structure. (fhandler_process::open): Store pid and pointer to _pinfo structure in saved_pid and saved_p respectively. Use fill_filebuf to flesh out file contents. (fhandler_proc::fill_filebuf): New method. (format_process_stat): New function. (format_process_status): Ditto. (format_process_statm): Ditto. (get_process_state): Ditto. (get_mem_values): Ditto. * fhandler_registry.cc (fhandler_registry::seekdir): Change argument type from __off32_t to __off64_t. (fhandler_registry::fill_filebuf): New method. * fhandler_virtual.cc (fhandler_virtual::seekdir): Change argument type from __off32_t to __off64_t. (fhandler_virtual::lseek): Ditto. (fhandler_virtual::fill_filebuf): New method. (fhandler_virtual::fhandler_virtual): Initialise fileid to -1. * wincap.cc: Set flag has_process_io_counters appropriately. * wincap.h: Add flag has_process_io_counters.
2002-05-12 03:37:48 +02:00
bool IMPLEMENT (has_process_io_counters)
bool IMPLEMENT (supports_reading_modem_output_lines)
bool IMPLEMENT (needs_memory_protection)
bool IMPLEMENT (pty_needs_alloc_console)
bool IMPLEMENT (has_terminal_services)
#undef IMPLEMENT
};
extern wincapc wincap;
#endif /* _WINCAP_H */