newlib/winsup/cygserver/shm.h
Corinna Vinschen b1aae492d0 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 21:51:00 +00:00

148 lines
3.0 KiB
C++
Executable File

/* cygserver_shm.h: Single unix specification IPC interface for Cygwin.
Copyright 2002 Red Hat, Inc.
Written by Conrad Scott <conrad.scott@dsl.pipex.com>.
Based on code by Robert Collins <robert.collins@hotmail.com>.
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 __CYGSERVER_SHM_H__
#define __CYGSERVER_SHM_H__
#include <sys/types.h>
#include <cygwin/shm.h>
#include <assert.h>
#include <limits.h>
#include "cygserver_ipc.h"
#include "cygwin/cygserver.h"
/*---------------------------------------------------------------------------*
* Values for the shminfo entries.
*
* Nb. The values are segregated between two enums so that the `small'
* values aren't promoted to `unsigned long' equivalents.
*---------------------------------------------------------------------------*/
enum
{
SHMMAX = ULONG_MAX,
SHMSEG = ULONG_MAX,
SHMALL = ULONG_MAX
};
enum
{
SHMMIN = 1,
SHMMNI = IPCMNI // Must be <= IPCMNI.
};
/*---------------------------------------------------------------------------*
* class client_request_shm
*---------------------------------------------------------------------------*/
#ifndef __INSIDE_CYGWIN__
class transport_layer_base;
class process_cache;
#endif
class client_request_shm : public client_request
{
friend class client_request;
public:
enum shmop_t
{
SHMOP_shmat,
SHMOP_shmctl,
SHMOP_shmdt,
SHMOP_shmget
};
#ifdef __INSIDE_CYGWIN__
client_request_shm (int shmid, int shmflg); // shmat
client_request_shm (int shmid, int cmd, const struct shmid_ds *); // shmctl
client_request_shm (int shmid); // shmdt
client_request_shm (key_t, size_t, int shmflg); // shmget
#endif
// Accessors for out parameters.
int shmid () const
{
assert (!error_code ());
return _parameters.out.shmid;
}
HANDLE hFileMap () const
{
assert (!error_code ());
return _parameters.out.hFileMap;
}
const struct shmid_ds & ds () const
{
assert (!error_code ());
return _parameters.out.ds;
}
const struct shminfo & shminfo () const
{
assert (!error_code ());
return _parameters.out.shminfo;
}
const struct shm_info & shm_info () const
{
assert (!error_code ());
return _parameters.out.shm_info;
}
private:
union
{
struct
{
shmop_t shmop;
key_t key;
size_t size;
int shmflg;
int shmid;
int cmd;
pid_t cygpid;
DWORD winpid;
__uid32_t uid;
__gid32_t gid;
struct shmid_ds ds;
} in;
struct {
int shmid;
union
{
HANDLE hFileMap;
struct shmid_ds ds;
struct shminfo shminfo;
struct shm_info shm_info;
};
} out;
} _parameters;
#ifndef __INSIDE_CYGWIN__
client_request_shm ();
#endif
#ifndef __INSIDE_CYGWIN__
virtual void serve (transport_layer_base *, process_cache *);
#endif
};
#endif /* __CYGSERVER_SHM_H__ */