* thread.h (struct _winsup_t): Remove obsolete elements. Add available_drives

element.
* path.cc (mount_info::getmntent): Report "/cygdrive" drives when mounted
drives are exhausted.
(fillout_mntent): New function.
(mount_item::getmntent): Use fillout_mntent.
(cygdrives_mntent): New function.  Returns next available "/cygdrive".
(setmntent): Initialize available "/cygdrives".
* syscalls.cc: Remove some if 0'ed code.
* times.cc (timezone): Use more descriptive variable name.
This commit is contained in:
Christopher Faylor 2001-04-01 03:06:02 +00:00
parent f611148366
commit f2aeff27f0
5 changed files with 130 additions and 135 deletions

View File

@ -1,3 +1,16 @@
Sat Mar 31 21:56:19 2001 Christopher Faylor <cgf@cygnus.com>
* thread.h (struct _winsup_t): Remove obsolete elements. Add
available_drives element.
* path.cc (mount_info::getmntent): Report "/cygdrive" drives when
mounted drives are exhausted.
(fillout_mntent): New function.
(mount_item::getmntent): Use fillout_mntent.
(cygdrives_mntent): New function. Returns next available "/cygdrive".
(setmntent): Initialize available "/cygdrives".
* syscalls.cc: Remove some if 0'ed code.
* times.cc (timezone): Use more descriptive variable name.
Sat Mar 31 18:59:52 2001 Christopher Faylor <cgf@cygnus.com>
* sigproc.h (class sigframe): Implement 'unregister()' method.

View File

@ -77,6 +77,14 @@ details. */
#include <assert.h>
#include "shortcut.h"
#ifdef _MT_SAFE
#define iteration _reent_winsup ()->_iteration
#define available_drives _reent_winsup ()->available_drives
#else
static int iteration;
static DWORD available_drives;
#endif
static int normalize_win32_path (const char *src, char *dst);
static void slashify (const char *src, char *dst, int trailing_slash_p);
static void backslashify (const char *src, char *dst, int trailing_slash_p);
@ -1720,15 +1728,6 @@ mount_info::get_cygdrive_info (char *user, char *system, char* user_flags,
return (res != ERROR_SUCCESS) ? res : res2;
}
struct mntent *
mount_info::getmntent (int x)
{
if (x < 0 || x >= nmounts)
return NULL;
return mount[native_sorted[x]].getmntent ();
}
static mount_item *mounts_for_sort;
/* sort_by_posix_name: qsort callback to sort the mount entries. Sort
@ -2028,11 +2027,11 @@ mount_info::import_v1_mounts ()
/************************* mount_item class ****************************/
struct mntent *
mount_item::getmntent ()
static mntent *
fillout_mntent (const char *native_path, const char *posix_path, unsigned flags)
{
#ifdef _MT_SAFE
struct mntent &ret=_reent_winsup()->_ret;
struct mntent &ret=_reent_winsup()->mntbuf;
#else
static NO_COPY struct mntent ret;
#endif
@ -2053,7 +2052,7 @@ mount_item::getmntent ()
strcpy (mount_table->mnt_type, (char *) "system");
if ((flags & MOUNT_AUTO)) /* cygdrive */
strcat (mount_table->mnt_type, (char *) ",auto");
strcat (mount_table->mnt_type, (char *) ",noumount");
ret.mnt_type = mount_table->mnt_type;
@ -2079,6 +2078,42 @@ mount_item::getmntent ()
return &ret;
}
struct mntent *
mount_item::getmntent ()
{
return fillout_mntent (native_path, posix_path, flags);
}
static struct mntent *
cygdrive_getmntent ()
{
if (!available_drives)
return NULL;
DWORD mask, drive;
for (mask = 1, drive = 'a'; drive <= 'z'; mask <<= 1, drive++)
if (available_drives & mask)
{
available_drives &= ~mask;
break;
}
char native_path[3];
char posix_path[MAX_PATH];
__small_sprintf (native_path, "%c:", drive);
__small_sprintf (posix_path, "%s%c", mount_table->cygdrive, drive);
return fillout_mntent (native_path, posix_path, mount_table->cygdrive_flags);
}
struct mntent *
mount_info::getmntent (int x)
{
if (x < 0 || x >= nmounts)
return cygdrive_getmntent ();
return mount[native_sorted[x]].getmntent ();
}
/* Fill in the fields of a mount table entry. */
void
@ -2161,17 +2196,12 @@ cygwin_umount (const char *path, unsigned flags)
return res;
}
#ifdef _MT_SAFE
#define iteration _reent_winsup()->_iteration
#else
static int iteration;
#endif
extern "C"
FILE *
setmntent (const char *filep, const char *)
{
iteration = 0;
available_drives = GetLogicalDrives ();
return (FILE *) filep;
}

View File

@ -665,38 +665,6 @@ done:
return res;
}
#if 0
static BOOL
rel2abssd (PSECURITY_DESCRIPTOR psd_rel, PSECURITY_DESCRIPTOR psd_abs,
DWORD abslen)
{
#ifdef _MT_SAFE
struct _winsup_t *r=_reent_winsup ();
char *dacl_buf=r->_dacl_buf;
char *sacl_buf=r->_sacl_buf;
char *ownr_buf=r->_ownr_buf;
char *grp_buf=r->_grp_buf;
#else
static char dacl_buf[1024];
static char sacl_buf[1024];
static char ownr_buf[1024];
static char grp_buf[1024];
#endif
DWORD dacl_len = 1024;
DWORD sacl_len = 1024;
DWORD ownr_len = 1024;
DWORD grp_len = 1024;
BOOL res = MakeAbsoluteSD (psd_rel, psd_abs, &abslen, (PACL) dacl_buf,
&dacl_len, (PACL) sacl_buf, &sacl_len,
(PSID) ownr_buf, &ownr_len, (PSID) grp_buf,
&grp_len);
syscall_printf ("%d = rel2abssd (...)", res);
return res;
}
#endif
/* chown: POSIX 5.6.5.1 */
/*
* chown () is only implemented for Windows NT. Under other operating

View File

@ -70,7 +70,6 @@ extern "C"
*/
struct group _grp;
char *_namearray[2];
char _linebuf[100];
int _grp_pos;
/* console.cc */
@ -82,23 +81,17 @@ extern "C"
/* passwd.cc */
struct passwd _res;
char _tmpbuf[100];
char _pass[_PASSWORD_LEN];
int _pw_pos;
/* path.cc */
struct mntent _ret;
struct mntent mntbuf;
int _iteration;
DWORD available_drives;
/* strerror */
char _strerror_buf[20];
/* syscalls.cc */
char _dacl_buf[1024];
char _sacl_buf[1024];
char _ownr_buf[1024];
char _grp_buf[1024];
/* sysloc.cc */
char *_process_ident;
int _process_logopt;
@ -106,10 +99,8 @@ extern "C"
int _process_logmask;
/* times.cc */
char _b[20];
char timezone_buf[20];
struct tm _localtime_buf;
char _buf1[33];
char _buf2[33];
/* uinfo.cc */
char _username[MAX_USER_NAME];
@ -141,9 +132,7 @@ class pinfo;
class ResourceLocks
{
public:
ResourceLocks ()
{
};
ResourceLocks () {}
LPCRITICAL_SECTION Lock (int);
void Init ();
void Delete ();
@ -216,13 +205,11 @@ public:
private:
DWORD thread_id;
};
class pthread_mutexattr:public verifyable_object
{
public:
pthread_mutexattr ();
~pthread_mutexattr ();
};
@ -319,14 +306,12 @@ public:
void Init (int);
MTinterface ():reent_index (0), indexallocated (0)
{
}
{}
};
extern "C"
{
void *thread_init_wrapper (void *);
/* ThreadCreation */
@ -400,7 +385,6 @@ __pthread_attr_getstackaddr(...);
int __sem_wait (sem_t * sem);
int __sem_trywait (sem_t * sem);
int __sem_post (sem_t * sem);
};
#endif // MT_SAFE

View File

@ -123,7 +123,7 @@ extern "C" char *
timezone ()
{
#ifdef _MT_SAFE
char *b=_reent_winsup()->_b;
char *b=_reent_winsup()->timezone_buf;
#else
static NO_COPY char b[20] = {0};
#endif