Switch to 32/64 datatypes:

* Makefile.in (OBSOLETE_FUNCTIONS): Add open acl aclcheck aclfrommode
	aclfrompbits aclfromtext aclsort acltomode acltopbits acltotext chown
	facl fchown fgetpos fopen freopen fseeko fsetpos fstat ftello
	ftruncate getegid geteuid getgid getgrent getgrgid getgrnam getgroups
	getpwuid getpwuid_r getuid initgroups lchown lseek lstat mknod mmap
	seekdir setegid seteuid setgid setgroups setregid setreuid setuid stat
	telldir truncate.
	(NEW_FUNCTIONS): Add _open64 acl32 aclcheck32 aclfrommode32
	aclfrompbits32 aclfromtext32 aclsort32 acltomode32 acltopbits32
	acltotext32 chown32 facl32 fchown32 fgetpos64 fopen64 freopen64
	fseeko64 fsetpos64 fstat64 ftello64 ftruncate64 getegid32 geteuid32
	getgid32 getgrent32 getgrgid32 getgrnam32 getgroups32 getpwuid32
	getpwuid_r32 getuid32 initgroups32 lchown32 lseek64 lstat64 mknod32
	mmap64 seekdir64 setegid32 seteuid32 setgid32 setgroups32 setregid32
	setreuid32 setuid32 stat64 telldir64 truncate64 to substitute the
	above.
	* cygserver_shm.h (class client_request_shm): Change uid_t and gid_t
	members to __uid32_t and __gid32_t.
	* cygwin.din: Add symbols acl32 aclcheck32 aclfrommode32
	aclfrompbits32 aclfromtext32 aclsort32 acltomode32 acltopbits32
	acltotext32 facl32 fgetpos64 fopen64 freopen64 fseeko64 fsetpos64
	_fstat64 ftello64 _lseek64 mknod32 _open64.
	* glob.c: Include perprocess.h.
	(globtilde): Call getpwuid32 and getuid32 instead of getpwuid and
	getuid.
	(g_lstat): Check for applications API version to call the appropriate
	typed gl_lstat function.
	(g_stat): Ditto for gl_stat.
	* shm.cc (client_request_shm::client_request_shm): Call geteuid32
	and getegid32 instead of geteuid and getegid throughout.
	* syscalls.cc (_open64): New alias for open.
	(_lseek64): New alias for lseek64.
	(_fstat64): New alias for fseek64.
	(mknod32): New function.
	(mknod): Calls mknod32 now.
	* winsup.h: Make function declarations for getuid32, geteuid32,
	and getpwuid32 accessible for plain C sources.  Add declarations
	for getegid32 and getpwnam.
	* include/cygwin/version.h: Bum API minor number to 78.
	* include/sys/cygwin.h: Guard C++ specific members of struct
	per_process against inclusion in plain C sources.
	* include/sys/mman.h (mman): Add guard to avoid type clash when
	compiling Cygwin.
This commit is contained in:
Corinna Vinschen 2003-03-09 21:51:00 +00:00
parent f882fd15b0
commit b1aae492d0
12 changed files with 192 additions and 45 deletions

View File

@ -118,8 +118,8 @@ private:
int cmd;
pid_t cygpid;
DWORD winpid;
uid_t uid;
gid_t gid;
__uid32_t uid;
__gid32_t gid;
struct shmid_ds ds;
} in;

View File

@ -1,3 +1,50 @@
2003-03-09 Corinna Vinschen <corinna@vinschen.de>
Switch to 32/64 datatypes:
* Makefile.in (OBSOLETE_FUNCTIONS): Add open acl aclcheck aclfrommode
aclfrompbits aclfromtext aclsort acltomode acltopbits acltotext chown
facl fchown fgetpos fopen freopen fseeko fsetpos fstat ftello
ftruncate getegid geteuid getgid getgrent getgrgid getgrnam getgroups
getpwuid getpwuid_r getuid initgroups lchown lseek lstat mknod mmap
seekdir setegid seteuid setgid setgroups setregid setreuid setuid stat
telldir truncate.
(NEW_FUNCTIONS): Add _open64 acl32 aclcheck32 aclfrommode32
aclfrompbits32 aclfromtext32 aclsort32 acltomode32 acltopbits32
acltotext32 chown32 facl32 fchown32 fgetpos64 fopen64 freopen64
fseeko64 fsetpos64 fstat64 ftello64 ftruncate64 getegid32 geteuid32
getgid32 getgrent32 getgrgid32 getgrnam32 getgroups32 getpwuid32
getpwuid_r32 getuid32 initgroups32 lchown32 lseek64 lstat64 mknod32
mmap64 seekdir64 setegid32 seteuid32 setgid32 setgroups32 setregid32
setreuid32 setuid32 stat64 telldir64 truncate64 to substitute the
above.
* cygserver_shm.h (class client_request_shm): Change uid_t and gid_t
members to __uid32_t and __gid32_t.
* cygwin.din: Add symbols acl32 aclcheck32 aclfrommode32
aclfrompbits32 aclfromtext32 aclsort32 acltomode32 acltopbits32
acltotext32 facl32 fgetpos64 fopen64 freopen64 fseeko64 fsetpos64
_fstat64 ftello64 _lseek64 mknod32 _open64.
* glob.c: Include perprocess.h.
(globtilde): Call getpwuid32 and getuid32 instead of getpwuid and
getuid.
(g_lstat): Check for applications API version to call the appropriate
typed gl_lstat function.
(g_stat): Ditto for gl_stat.
* shm.cc (client_request_shm::client_request_shm): Call geteuid32
and getegid32 instead of geteuid and getegid throughout.
* syscalls.cc (_open64): New alias for open.
(_lseek64): New alias for lseek64.
(_fstat64): New alias for fseek64.
(mknod32): New function.
(mknod): Calls mknod32 now.
* winsup.h: Make function declarations for getuid32, geteuid32,
and getpwuid32 accessible for plain C sources. Add declarations
for getegid32 and getpwnam.
* include/cygwin/version.h: Bum API minor number to 78.
* include/sys/cygwin.h: Guard C++ specific members of struct
per_process against inclusion in plain C sources.
* include/sys/mman.h (mman): Add guard to avoid type clash when
compiling Cygwin.
2003-03-09 Christopher Faylor <cgf@redhat.com>
* include/cygwin/version.h: Bump DLL minor number to 22.

View File

@ -170,11 +170,69 @@ DLL_OFILES:=assert.o autoload.o cxx.o cygheap.o cygserver_client.o \
GMON_OFILES:=gmon.o mcount.o profil.o
OBSOLETE_FUNCTIONS:=regcomp regerror regexec regfree regsub
OBSOLETE_FUNCTIONS:=regcomp regerror regexec regfree regsub \
open acl aclcheck aclfrommode aclfrompbits \
aclfromtext aclsort acltomode acltopbits \
acltotext chown facl fchown fgetpos fopen \
freopen fseeko fsetpos fstat ftello ftruncate \
getegid geteuid getgid getgrent getgrgid getgrnam \
getgroups getpwuid getpwuid_r getuid initgroups \
lchown lseek lstat mknod mmap seekdir setegid seteuid \
setgid setgroups setregid setreuid setuid stat \
telldir truncate
NEW_FUNCTIONS:=regcomp posix_regcomp \
regerror posix_regerror \
regexec posix_regexec \
regfree posix_regfree
regfree posix_regfree \
open _open64 \
acl acl32 \
aclcheck aclcheck32 \
aclfrommode aclfrommode32 \
aclfrompbits aclfrompbits32 \
aclfromtext aclfromtext32 \
aclsort aclsort32 \
acltomode acltomode32 \
acltopbits acltopbits32 \
acltotext acltotext32 \
chown chown32 \
facl facl32 \
fchown fchown32 \
fgetpos fgetpos64 \
fopen fopen64 \
freopen freopen64 \
fseeko fseeko64 \
fsetpos fsetpos64 \
fstat fstat64 \
ftello ftello64 \
ftruncate ftruncate64 \
getegid getegid32 \
geteuid geteuid32 \
getgid getgid32 \
getgrent getgrent32 \
getgrgid getgrgid32 \
getgrnam getgrnam32 \
getgroups getgroups32 \
getpwuid getpwuid32 \
getpwuid_r getpwuid_r32 \
getuid getuid32 \
initgroups initgroups32 \
lchown lchown32 \
lseek lseek64 \
lstat lstat64 \
mknod mknod32 \
mmap mmap64 \
seekdir seekdir64 \
setegid setegid32 \
seteuid seteuid32 \
setgid setgid32 \
setgroups setgroups32 \
setregid setregid32 \
setreuid setreuid32 \
setuid setuid32 \
stat stat64 \
telldir telldir64 \
truncate truncate64
API_VER:=$(srcdir)/include/cygwin/version.h

View File

@ -118,8 +118,8 @@ private:
int cmd;
pid_t cygpid;
DWORD winpid;
uid_t uid;
gid_t gid;
__uid32_t uid;
__gid32_t gid;
struct shmid_ds ds;
} in;

View File

@ -102,22 +102,31 @@ access
_access = access
acl
_acl = acl
acl32
aclcheck
_aclcheck = aclcheck
aclcheck32
aclfrommode
_aclfrommode = aclfrommode
aclfrommode32
aclfrompbits
_aclfrompbits = aclfrompbits
aclfrompbits32
aclfromtext
_aclfromtext = aclfromtext
aclfromtext32
aclsort
_aclsort = aclsort
aclsort32
acltomode
_acltomode = acltomode
acltomode32
acltopbits
_acltopbits = acltopbits
acltopbits32
acltotext
_acltotext = acltotext
acltotext32
acos
_acos = acos
acosf
@ -389,6 +398,7 @@ fabsf
_fabsf = fabsf
facl
_facl = facl
facl32
fchdir
_fchdir = fchdir
fchmod
@ -424,6 +434,7 @@ fgetc
_fgetc = fgetc
fgetpos
_fgetpos = fgetpos
fgetpos64
fgets
_fgets = fgets
fileno
@ -452,6 +463,7 @@ fnmatch
_fnmatch = fnmatch
fopen
_fopen = fopen
fopen64
fork
_fork = fork
fpathconf
@ -467,6 +479,7 @@ free
_free = free
freopen
_freopen = freopen
freopen64
frexp
_frexp = frexp
frexpf
@ -477,9 +490,12 @@ fseek
_fseek = fseek
fseeko
_fseeko = fseeko
fseeko64
fsetpos
_fsetpos = fsetpos
fsetpos64
fstat64
_fstat64 = fstat64
fstatfs
_fstatfs = fstatfs
fsync
@ -488,6 +504,7 @@ ftell
_ftell = ftell
ftello
_ftello = ftello
ftello64
ftime
_ftime = ftime
ftruncate
@ -766,6 +783,7 @@ lroundf
lseek
_lseek = lseek
lseek64
_lseek64 = lseek64
lstat64
mallinfo
mallinfo
@ -806,6 +824,7 @@ _mkdir = mkdir
mkfifo
mknod
_mknod = mknod
mknod32
mkstemp
_mkstemp = mkstemp
mktemp
@ -849,6 +868,7 @@ _ntohs = ntohs
on_exit
open
_open = open
_open64
opendir
_opendir = opendir
openlog

View File

@ -80,6 +80,8 @@
#include <unistd.h>
#include <windows.h>
#include "perprocess.h"
#ifdef __weak_alias
#ifdef __LIBC12_SOURCE__
__weak_alias(glob,_glob);
@ -386,7 +388,7 @@ globtilde(pattern, patbuf, pglob)
* first and then trying the password file
*/
if ((h = getenv("HOME")) == NULL) {
if ((pwd = getpwuid(getuid())) == NULL)
if ((pwd = getpwuid32(getuid32())) == NULL)
return pattern;
else
h = pwd->pw_dir;
@ -831,16 +833,6 @@ g_lstat(fn, sb, pglob)
struct STAT *sb;
glob_t *pglob;
{
/* FIXME: This only works as long as the application uses the old
struct stat with 32 bit off_t types!!!
As soon as we switch over to 64 bit, we have to decide by
the applications API minor version number, whether to use
a pointer to a __stat64 or a _stat32 struct to the
pglob->gl_lstat function. */
#ifdef __CYGWIN_USE_BIG_TYPES__
#error FIXME check apps API minor and use correct struct stat
#endif
char buf[MAXPATHLEN];
g_Ctoc(fn, buf);
@ -848,7 +840,9 @@ g_lstat(fn, sb, pglob)
struct __stat32 lsb;
int ret;
if (!(ret = (*pglob->gl_lstat)(buf, &lsb)))
if (user_data->api_major > 0 || user_data->api_minor > 77)
ret = (*pglob->gl_lstat)(buf, &sb);
else if (!(ret = (*pglob->gl_lstat)(buf, &lsb)))
stat32_to_STAT (&lsb, sb);
return ret;
}
@ -865,16 +859,6 @@ g_stat(fn, sb, pglob)
struct STAT *sb;
glob_t *pglob;
{
/* FIXME: This only works as long as the application uses the old
struct stat with 32 bit off_t types!!!
As soon as we switch over to 64 bit, we have to decide by
the applications API minor version number, whether to use
a pointer to a __stat64 or a _stat32 struct to the
pglob->gl_stat function. */
#ifdef __CYGWIN_USE_BIG_TYPES__
#error FIXME check apps API minor and use correct struct stat
#endif
char buf[MAXPATHLEN];
g_Ctoc(fn, buf);
@ -882,6 +866,8 @@ g_stat(fn, sb, pglob)
struct __stat32 lsb;
int ret;
if (user_data->api_major > 0 || user_data->api_minor > 77)
ret = (*pglob->gl_stat)(buf, &sb);
if (!(ret = (*pglob->gl_stat)(buf, &lsb)))
stat32_to_STAT (&lsb, sb);
return ret;

View File

@ -186,12 +186,17 @@ details. */
truncf
76: mallinfo
77: thread-safe exit/at_exit
78: Export acl32 aclcheck32 aclfrommode32 aclfrompbits32 aclfromtext32
aclsort32 acltomode32 acltopbits32 acltotext32 facl32
fgetpos64 fopen64 freopen64 fseeko64 fsetpos64 ftello64
_open64 _lseek64 _fstat64 _stat64 mknod32
*/
/* Note that we forgot to bump the api for ualarm, strtoll, strtoull */
#define CYGWIN_VERSION_API_MAJOR 0
#define CYGWIN_VERSION_API_MINOR 77
#define CYGWIN_VERSION_API_MINOR 78
/* There is also a compatibity version number associated with the
shared memory regions. It is incremented when incompatible

View File

@ -183,7 +183,7 @@ struct per_process
add an item. */
DWORD unused2[5];
#ifdef __INSIDE_CYGWIN__
#if defined (__INSIDE_CYGWIN__) && defined (__cplusplus)
ResourceLocks *resourcelocks;
MTinterface *threadinterface;
#else

View File

@ -40,7 +40,9 @@ extern "C" {
#define MS_SYNC 2
#define MS_INVALIDATE 4
#ifndef __INSIDE_CYGWIN__
extern caddr_t mmap (caddr_t __addr, size_t __len, int __prot, int __flags, int __fd, off_t __off);
#endif
extern int munmap (caddr_t __addr, size_t __len);
extern int mprotect (caddr_t __addr, size_t __len, int __prot);
extern int msync (caddr_t __addr, size_t __len, int __flags);

View File

@ -620,8 +620,8 @@ client_request_shm::client_request_shm (const int shmid, const int shmflg)
_parameters.in.cygpid = getpid ();
_parameters.in.winpid = GetCurrentProcessId ();
_parameters.in.uid = geteuid ();
_parameters.in.gid = getegid ();
_parameters.in.uid = geteuid32 ();
_parameters.in.gid = getegid32 ();
msglen (sizeof (_parameters.in));
}
@ -644,8 +644,8 @@ client_request_shm::client_request_shm (const int shmid,
_parameters.in.cygpid = getpid ();
_parameters.in.winpid = GetCurrentProcessId ();
_parameters.in.uid = geteuid ();
_parameters.in.gid = getegid ();
_parameters.in.uid = geteuid32 ();
_parameters.in.gid = getegid32 ();
msglen (sizeof (_parameters.in));
}
@ -663,8 +663,8 @@ client_request_shm::client_request_shm (const int shmid)
_parameters.in.cygpid = getpid ();
_parameters.in.winpid = GetCurrentProcessId ();
_parameters.in.uid = geteuid ();
_parameters.in.gid = getegid ();
_parameters.in.uid = geteuid32 ();
_parameters.in.gid = getegid32 ();
msglen (sizeof (_parameters.in));
}
@ -686,8 +686,8 @@ client_request_shm::client_request_shm (const key_t key,
_parameters.in.cygpid = getpid ();
_parameters.in.winpid = GetCurrentProcessId ();
_parameters.in.uid = geteuid ();
_parameters.in.gid = getegid ();
_parameters.in.uid = geteuid32 ();
_parameters.in.gid = getegid32 ();
msglen (sizeof (_parameters.in));
}

View File

@ -13,6 +13,9 @@ details. */
#define _open __FOO_open__
#define _read __FOO_read__
#define _write __FOO_write__
#define _open64 __FOO_open64__
#define _lseek64 __FOO_lseek64__
#define _fstat64 __FOO_fstat64__
#include "winsup.h"
#include <sys/stat.h>
@ -52,6 +55,9 @@ details. */
#undef _open
#undef _read
#undef _write
#undef _open64
#undef _lseek64
#undef _fstat64
SYSTEM_INFO system_info;
@ -503,6 +509,9 @@ open (const char *unix_path, int flags, ...)
extern "C" int _open (const char *, int flags, ...)
__attribute__ ((alias ("open")));
extern "C" int _open64 (const char *, int flags, ...)
__attribute__ ((alias ("open")));
extern "C" __off64_t
lseek64 (int fd, __off64_t pos, int dir)
{
@ -527,6 +536,9 @@ lseek64 (int fd, __off64_t pos, int dir)
return res;
}
extern "C" int _lseek64 (int fd, __off64_t pos, int dir)
__attribute__ ((alias ("lseek64")));
extern "C" __off32_t
lseek (int fd, __off32_t pos, int dir)
{
@ -997,6 +1009,9 @@ fstat64 (int fd, struct __stat64 *buf)
return res;
}
extern "C" int _fstat64 (int fd, __off64_t pos, int dir)
__attribute__ ((alias ("fstat64")));
extern "C" int
_fstat (int fd, struct __stat32 *buf)
{
@ -1928,12 +1943,18 @@ regfree ()
fileutils) assume its existence so we must provide a stub that always
fails. */
extern "C" int
mknod (const char *_path, mode_t mode, dev_t dev)
mknod32 (const char *_path, mode_t mode, __dev32_t dev)
{
set_errno (ENOSYS);
return -1;
}
extern "C" int
mknod (const char *_path, mode_t mode, __dev16_t dev)
{
return mknod32 (_path, mode, (__dev32_t) dev);
}
extern "C" int
mkfifo (const char *_path, mode_t mode)
{

View File

@ -25,8 +25,6 @@ details. */
#define NO_COPY __attribute__((nocommon)) __attribute__((section(".data_cygwin_nocopy")))
#ifdef __cplusplus
#if !defined(__STDC_VERSION__) || __STDC_VERSION__ >= 199900L
#define NEW_MACRO_VARARGS
#endif
@ -38,6 +36,20 @@ details. */
#include <sys/types.h>
#include <sys/strace.h>
#ifdef __cplusplus
extern "C" {
#endif
extern __uid32_t getuid32 (void);
extern __uid32_t geteuid32 (void);
extern __gid32_t getegid32 (void);
extern struct passwd *getpwuid32 (__uid32_t);
struct passwd *getpwnam (const char *);
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
extern const char case_folded_lower[];
#define cyg_tolower(c) (case_folded_lower[(unsigned char)(c)])
extern const char case_folded_upper[];
@ -155,10 +167,6 @@ void uinfo_init (void);
#define uid16touid32(u16) ((u16)==ILLEGAL_UID16?ILLEGAL_UID:(__uid32_t)(u16))
#define gid16togid32(g16) ((g16)==ILLEGAL_GID16?ILLEGAL_GID:(__gid32_t)(g16))
extern "C" __uid32_t getuid32 (void);
extern "C" __uid32_t geteuid32 (void);
extern "C" struct passwd *getpwuid32 (__uid32_t);
/* various events */
void events_init (void);
void events_terminate (void);