4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-01-22 15:07:43 +08:00
newlib-cygwin/winsup/cygwin/cygserver_ipc.h
Ken Brown 2d9b48760c Cygwin: simplify some function names
Remove "32" or "64" from each of the following names: acl32,
aclcheck32, aclfrommode32, aclfrompbits32, aclfromtext32, aclsort32,
acltomode32, acltopbits32, acltotext32, facl32, fchown32, fcntl64,
fstat64, _fstat64, _fstat64_r, ftruncate64, getgid32, getgrent32,
getgrgid32, getgrnam32, getgroups32, getpwuid32, getpwuid_r32,
getuid32, getuid32, initgroups32, lseek64, lstat64, mknod32, mmap64,
setegid32, seteuid32, setgid32, setgroups32, setregid32, setreuid32,
setuid32, stat64, _stat64_r, truncate64.

Remove prototypes and macro definitions of these names.

Remove "#ifndef __INSIDE_CYGWIN__" from some headers so that the new
names will be available when compiling Cygwin.

Remove aliases that are no longer needed.

Include <unistd.h> in fhandler_clipboard.cc for the declarations of
geteuid and getegid.
2022-05-29 17:45:52 -04:00

100 lines
2.2 KiB
C++

/* cygserver_ipc.h
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_IPC_H__
#define __CYGSERVER_IPC_H__
/*
* Datastructure which is part of any IPC input parameter block.
*/
struct vmspace {
void *vm_map; /* UNUSED */
struct shmmap_state *vm_shm;
};
struct proc {
pid_t cygpid;
DWORD winpid;
uid_t uid;
gid_t gid;
int gidcnt;
gid_t *gidlist;
bool is_admin;
struct vmspace *p_vmspace;
HANDLE signal_arrived;
};
#ifdef __INSIDE_CYGWIN__
#include "sigproc.h"
extern inline void
ipc_set_proc_info (proc &blk, bool in_fork = false)
{
blk.cygpid = getpid ();
blk.winpid = GetCurrentProcessId ();
blk.uid = geteuid ();
blk.gid = getegid ();
blk.gidcnt = 0;
blk.gidlist = NULL;
blk.is_admin = false;
blk.signal_arrived = in_fork ? NULL : _my_tls.get_signal_arrived (true);
}
#endif /* __INSIDE_CYGWIN__ */
#ifndef __INSIDE_CYGWIN__
class ipc_retval {
private:
union {
int i;
ssize_t ssz;
size_t sz;
vm_offset_t off;
vm_object_t obj;
};
public:
ipc_retval () { ssz = 0; }
ipc_retval (ssize_t nssz) { ssz = nssz; }
operator int () const { return i; }
int operator = (int ni) { return i = ni; }
/* size_t == vm_offset_t == unsigned long. Ssize_t needs overloading */
operator ssize_t () const { return ssz; }
ssize_t operator = (ssize_t nssz) { return ssz = nssz; }
operator vm_offset_t () const { return off; }
vm_offset_t operator = (vm_offset_t noff) { return off = noff; }
operator vm_object_t () const { return obj; }
vm_object_t operator = (vm_object_t nobj) { return obj = nobj; }
};
class thread {
private:
/* Implemented in cgyserver/process.cc */
void dup_signal_arrived ();
void close_signal_arrived ();
public:
class process *client;
proc *ipcblk;
ipc_retval td_retval[2];
thread (class process *_client, proc *_proc, bool _init_m1)
: client (_client), ipcblk (_proc)
{
td_retval[0] = td_retval[1] = _init_m1 ? -1 : 0;
dup_signal_arrived ();
}
~thread () { close_signal_arrived (); }
};
#define td_proc ipcblk
#define p_pid cygpid
#endif
#endif /* __CYGSERVER_IPC_H__ */