* autoload.cc (LoadFuncEx): Define via new LoadFuncEx2 macro.

(LoadFuncEx2): Adapted from LoadFuncEx.  Provides control of return value for
nonexistent function.
(NtQueryObject): Declare.
(IsDebuggerPresent): Declare via LoadFuncEx2 and always return true if not
available.
* debug.h (being_debugged): Just rely on IsDebuggerPresent return value.
* dtable.cc (handle_to_fn): New function.
(dtable::init_std_file_from_handle): Attempt to derive std handle's name via
handle_to_fn.
(dtable::build_fhandler_from_name): Fill in what we can in path_conv structure
when given a handle and path doesn't exist.
* fhandler.cc (fhandler_base::open): Don't set the file pointer here.  Use
pc->exists () to determine if file exists rather than calling GetFileAttributes
again.
* fhandler.h (fhandler_base::exec_state_isknown): New method.
(fhandler_base::fstat_helper): Add extra arguments to declaration.
(fhandler_base::fstat_by_handle): Declare new method.
(fhandler_base::fstat_by_name): Declare new method.
* fhandler_disk_file (num_entries): Make __stdcall.
(fhandler_base::fstat_by_handle): Define new method.
(fhandler_base::fstat_by_name): Define new method.
(fhandler_base:fstat): Call fstat_by_{handle,name} as appropriate.
(fhandler_disk_file::fstat_helper): Accept extra arguments for filling out stat
structure.  Move handle or name specific stuff to new methods above.
(fhandler_disk_file::open): Use real_path->exists rather than calling
GetFileAttributes again.
* ntdll.h (FILE_NAME_INFORMATION): Define new structure.
(OBJECT_INFORMATION_CLASS): Partially define new enum.
(OBJECT_NAME_INFORMATION): Define new structure.
(NtQueryInformationFile): New declaration.
(NtQueryObject): New declaration.
* path.cc (path_conv::fillin): Define new method.
* path.h (path_conv::fillin): Declare new method.
(path_conv::drive_thpe): Rename from 'get_drive_type'.
(path_conv::volser): Declare new method.
(path_conv::volname): Declare new method.
(path_conv::root_dir): Declare new method.
* syscalls.cc (fstat64): Send real path_conv to fstat as second argument.
This commit is contained in:
Christopher Faylor
2002-05-28 01:55:40 +00:00
parent 74b2f73ea4
commit 2402700d07
32 changed files with 1070 additions and 917 deletions

View File

@@ -1,14 +1,14 @@
/* shm.cc: Single unix specification IPC interface for Cygwin
Copyright 2001 Red Hat, Inc.
Copyright 2001 Red Hat, Inc.
Originally written by Robert Collins <robert.collins@hotmail.com>
Originally written by Robert Collins <robert.collins@hotmail.com>
This file is part of Cygwin.
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. */
This software is a copyrighted work licensed under the terms of the
Cygwin license. Please consult the file "CYGWIN_LICENSE" for
details. */
#include "winsup.h"
#include <sys/stat.h>
@@ -63,9 +63,9 @@ client_request (CYGSERVER_REQUEST_SHM_GET, sizeof (parameters))
}
client_request_shm::client_request_shm (key_t nkey, size_t nsize,
int nshmflg,
char psdbuf[4096],
pid_t npid):
int nshmflg,
char psdbuf[4096],
pid_t npid):
client_request (CYGSERVER_REQUEST_SHM_GET, sizeof (parameters))
{
buffer = (char *) &parameters;
@@ -145,12 +145,12 @@ delete_inprocess_shmds (shmnode **nodeptr)
{
shmnode *tempnode = shm_head;
while (tempnode && tempnode->next != node)
tempnode = tempnode->next;
tempnode = tempnode->next;
if (tempnode)
tempnode->next = node->next;
// else log the unexpected !
}
// release the shared data view
UnmapViewOfFile (node->shmds);
CloseHandle (node->filemap);
@@ -221,7 +221,7 @@ shmat (int shmid, const void *shmaddr, int shmflg)
if (!tempnode)
{
/* couldn't find a currently open shm control area for the key - probably because
* shmget hasn't been called.
* shmget hasn't been called.
* Allocate a new control block - this has to be handled by the daemon */
client_request_shm *req =
new client_request_shm (SHM_REATTACH, shmid, GetCurrentProcessId ());
@@ -333,11 +333,11 @@ shmdt (const void *shmaddr)
debug_printf ("failed to tell deaemon that we have detached\n");
}
delete req;
return 0;
}
//FIXME: who is allowed to perform STAT?
//FIXME: who is allowed to perform STAT?
extern "C" int
shmctl (int shmid, int cmd, struct shmid_ds *buf)
{
@@ -395,17 +395,17 @@ shmctl (int shmid, int cmd, struct shmid_ds *buf)
break;
case IPC_RMID:
{
/* TODO: check permissions. Or possibly, the daemon gets to be the only
/* TODO: check permissions. Or possibly, the daemon gets to be the only
* one with write access to the memory area?
*/
if (tempnode->shmds->shm_nattch)
system_printf
("call to shmctl with cmd= IPC_RMID when memory area still has"
" attachees\n");
/* how does this work?
/* how does this work?
* we mark the ds area as "deleted", and the at and get calls all fail from now on
* on, when nattch becomes 0, the mapped data area is destroyed.
* and each process, as they touch this area detaches. eventually only the
* and each process, as they touch this area detaches. eventually only the
* daemon has an attach. The daemon gets asked to detach immediately.
*/
//waiting for the daemon to handle terminating process's
@@ -431,7 +431,7 @@ shmctl (int shmid, int cmd, struct shmid_ds *buf)
// FIXME: create a destructor
delete_inprocess_shmds (&tempnode);
}
break;
case IPC_SET:
@@ -460,7 +460,7 @@ shmget (key_t key, size_t size, int shmflg)
PSECURITY_DESCRIPTOR psd = (PSECURITY_DESCRIPTOR) sd_buf;
/* create a sd for our open requests based on shmflag & 0x01ff */
InitializeSecurityDescriptor (psd,
SECURITY_DESCRIPTOR_REVISION);
SECURITY_DESCRIPTOR_REVISION);
psd = alloc_sd (getuid (), getgid (), cygheap->user.logsrv (),
shmflg & 0x01ff, psd, &sd_size);