* 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:
parent
f611148366
commit
f2aeff27f0
|
@ -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>
|
Sat Mar 31 18:59:52 2001 Christopher Faylor <cgf@cygnus.com>
|
||||||
|
|
||||||
* sigproc.h (class sigframe): Implement 'unregister()' method.
|
* sigproc.h (class sigframe): Implement 'unregister()' method.
|
||||||
|
|
|
@ -77,6 +77,14 @@ details. */
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include "shortcut.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 int normalize_win32_path (const char *src, char *dst);
|
||||||
static void slashify (const char *src, char *dst, int trailing_slash_p);
|
static void slashify (const char *src, char *dst, int trailing_slash_p);
|
||||||
static void backslashify (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;
|
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;
|
static mount_item *mounts_for_sort;
|
||||||
|
|
||||||
/* sort_by_posix_name: qsort callback to sort the mount entries. 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 ****************************/
|
/************************* mount_item class ****************************/
|
||||||
|
|
||||||
struct mntent *
|
static mntent *
|
||||||
mount_item::getmntent ()
|
fillout_mntent (const char *native_path, const char *posix_path, unsigned flags)
|
||||||
{
|
{
|
||||||
#ifdef _MT_SAFE
|
#ifdef _MT_SAFE
|
||||||
struct mntent &ret=_reent_winsup()->_ret;
|
struct mntent &ret=_reent_winsup()->mntbuf;
|
||||||
#else
|
#else
|
||||||
static NO_COPY struct mntent ret;
|
static NO_COPY struct mntent ret;
|
||||||
#endif
|
#endif
|
||||||
|
@ -2053,7 +2052,7 @@ mount_item::getmntent ()
|
||||||
strcpy (mount_table->mnt_type, (char *) "system");
|
strcpy (mount_table->mnt_type, (char *) "system");
|
||||||
|
|
||||||
if ((flags & MOUNT_AUTO)) /* cygdrive */
|
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;
|
ret.mnt_type = mount_table->mnt_type;
|
||||||
|
|
||||||
|
@ -2079,6 +2078,42 @@ mount_item::getmntent ()
|
||||||
return &ret;
|
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. */
|
/* Fill in the fields of a mount table entry. */
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -2161,17 +2196,12 @@ cygwin_umount (const char *path, unsigned flags)
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _MT_SAFE
|
|
||||||
#define iteration _reent_winsup()->_iteration
|
|
||||||
#else
|
|
||||||
static int iteration;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
FILE *
|
FILE *
|
||||||
setmntent (const char *filep, const char *)
|
setmntent (const char *filep, const char *)
|
||||||
{
|
{
|
||||||
iteration = 0;
|
iteration = 0;
|
||||||
|
available_drives = GetLogicalDrives ();
|
||||||
return (FILE *) filep;
|
return (FILE *) filep;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -665,38 +665,6 @@ done:
|
||||||
return res;
|
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: POSIX 5.6.5.1 */
|
||||||
/*
|
/*
|
||||||
* chown () is only implemented for Windows NT. Under other operating
|
* chown () is only implemented for Windows NT. Under other operating
|
||||||
|
|
|
@ -26,9 +26,9 @@ details. */
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
#if defined (_CYG_THREAD_FAILSAFE) && defined (_MT_SAFE)
|
#if defined (_CYG_THREAD_FAILSAFE) && defined (_MT_SAFE)
|
||||||
void AssertResourceOwner (int, int);
|
void AssertResourceOwner (int, int);
|
||||||
#else
|
#else
|
||||||
# define AssertResourceOwner(i,ii)
|
#define AssertResourceOwner(i,ii)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,73 +63,64 @@ extern "C"
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
|
|
||||||
struct _winsup_t
|
struct _winsup_t
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
Needed for the group functions
|
Needed for the group functions
|
||||||
*/
|
*/
|
||||||
struct group _grp;
|
struct group _grp;
|
||||||
char *_namearray[2];
|
char *_namearray[2];
|
||||||
char _linebuf[100];
|
|
||||||
int _grp_pos;
|
int _grp_pos;
|
||||||
|
|
||||||
/* console.cc */
|
/* console.cc */
|
||||||
unsigned _rarg;
|
unsigned _rarg;
|
||||||
|
|
||||||
/* dlfcn.cc */
|
/* dlfcn.cc */
|
||||||
int _dl_error;
|
int _dl_error;
|
||||||
char _dl_buffer[256];
|
char _dl_buffer[256];
|
||||||
|
|
||||||
/* passwd.cc */
|
/* passwd.cc */
|
||||||
struct passwd _res;
|
struct passwd _res;
|
||||||
char _tmpbuf[100];
|
|
||||||
char _pass[_PASSWORD_LEN];
|
char _pass[_PASSWORD_LEN];
|
||||||
int _pw_pos;
|
int _pw_pos;
|
||||||
|
|
||||||
/* path.cc */
|
/* path.cc */
|
||||||
struct mntent _ret;
|
struct mntent mntbuf;
|
||||||
int _iteration;
|
int _iteration;
|
||||||
|
DWORD available_drives;
|
||||||
|
|
||||||
/* strerror */
|
/* strerror */
|
||||||
char _strerror_buf[20];
|
char _strerror_buf[20];
|
||||||
|
|
||||||
/* syscalls.cc */
|
/* sysloc.cc */
|
||||||
char _dacl_buf[1024];
|
|
||||||
char _sacl_buf[1024];
|
|
||||||
char _ownr_buf[1024];
|
|
||||||
char _grp_buf[1024];
|
|
||||||
|
|
||||||
/* sysloc.cc */
|
|
||||||
char *_process_ident;
|
char *_process_ident;
|
||||||
int _process_logopt;
|
int _process_logopt;
|
||||||
int _process_facility;
|
int _process_facility;
|
||||||
int _process_logmask;
|
int _process_logmask;
|
||||||
|
|
||||||
/* times.cc */
|
/* times.cc */
|
||||||
char _b[20];
|
char timezone_buf[20];
|
||||||
struct tm _localtime_buf;
|
struct tm _localtime_buf;
|
||||||
char _buf1[33];
|
|
||||||
char _buf2[33];
|
|
||||||
|
|
||||||
/* uinfo.cc */
|
/* uinfo.cc */
|
||||||
char _username[MAX_USER_NAME];
|
char _username[MAX_USER_NAME];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct __reent_t
|
struct __reent_t
|
||||||
{
|
{
|
||||||
struct _reent *_clib;
|
struct _reent *_clib;
|
||||||
struct _winsup_t *_winsup;
|
struct _winsup_t *_winsup;
|
||||||
};
|
};
|
||||||
|
|
||||||
_reent *_reent_clib ();
|
_reent *_reent_clib ();
|
||||||
_winsup_t *_reent_winsup ();
|
_winsup_t *_reent_winsup ();
|
||||||
void SetResourceLock (int, int, const char *) __attribute__ ((regparm (3)));
|
void SetResourceLock (int, int, const char *) __attribute__ ((regparm (3)));
|
||||||
void ReleaseResourceLock (int, int, const char *)
|
void ReleaseResourceLock (int, int, const char *)
|
||||||
__attribute__ ((regparm (3)));
|
__attribute__ ((regparm (3)));
|
||||||
|
|
||||||
#ifdef _CYG_THREAD_FAILSAFE
|
#ifdef _CYG_THREAD_FAILSAFE
|
||||||
void AssertResourceOwner (int, int);
|
void AssertResourceOwner (int, int);
|
||||||
#else
|
#else
|
||||||
#define AssertResourceOwner(i,ii)
|
#define AssertResourceOwner(i,ii)
|
||||||
#endif
|
#endif
|
||||||
|
@ -141,9 +132,7 @@ class pinfo;
|
||||||
class ResourceLocks
|
class ResourceLocks
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ResourceLocks ()
|
ResourceLocks () {}
|
||||||
{
|
|
||||||
};
|
|
||||||
LPCRITICAL_SECTION Lock (int);
|
LPCRITICAL_SECTION Lock (int);
|
||||||
void Init ();
|
void Init ();
|
||||||
void Delete ();
|
void Delete ();
|
||||||
|
@ -216,13 +205,11 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DWORD thread_id;
|
DWORD thread_id;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class pthread_mutexattr:public verifyable_object
|
class pthread_mutexattr:public verifyable_object
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
pthread_mutexattr ();
|
pthread_mutexattr ();
|
||||||
~pthread_mutexattr ();
|
~pthread_mutexattr ();
|
||||||
};
|
};
|
||||||
|
@ -319,14 +306,12 @@ public:
|
||||||
void Init (int);
|
void Init (int);
|
||||||
|
|
||||||
MTinterface ():reent_index (0), indexallocated (0)
|
MTinterface ():reent_index (0), indexallocated (0)
|
||||||
{
|
{}
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
|
|
||||||
void *thread_init_wrapper (void *);
|
void *thread_init_wrapper (void *);
|
||||||
|
|
||||||
/* ThreadCreation */
|
/* ThreadCreation */
|
||||||
|
@ -400,7 +385,6 @@ __pthread_attr_getstackaddr(...);
|
||||||
int __sem_wait (sem_t * sem);
|
int __sem_wait (sem_t * sem);
|
||||||
int __sem_trywait (sem_t * sem);
|
int __sem_trywait (sem_t * sem);
|
||||||
int __sem_post (sem_t * sem);
|
int __sem_post (sem_t * sem);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MT_SAFE
|
#endif // MT_SAFE
|
||||||
|
|
|
@ -123,7 +123,7 @@ extern "C" char *
|
||||||
timezone ()
|
timezone ()
|
||||||
{
|
{
|
||||||
#ifdef _MT_SAFE
|
#ifdef _MT_SAFE
|
||||||
char *b=_reent_winsup()->_b;
|
char *b=_reent_winsup()->timezone_buf;
|
||||||
#else
|
#else
|
||||||
static NO_COPY char b[20] = {0};
|
static NO_COPY char b[20] = {0};
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue