Cygwin: (mostly) drop NT4 and Samba < 3.0 support
[newlib-cygwin.git] / winsup / cygwin / local_includes / cygserver_ipc.h
blob2938e1a738fadc770da22d7c6656747aa2f0ec2b
1 /* cygserver_ipc.h
3 This file is part of Cygwin.
5 This software is a copyrighted work licensed under the terms of the
6 Cygwin license. Please consult the file "CYGWIN_LICENSE" for
7 details. */
9 #ifndef __CYGSERVER_IPC_H__
10 #define __CYGSERVER_IPC_H__
13 * Datastructure which is part of any IPC input parameter block.
15 struct vmspace {
16 void *vm_map; /* UNUSED */
17 struct shmmap_state *vm_shm;
20 struct proc {
21 pid_t cygpid;
22 DWORD winpid;
23 uid_t uid;
24 gid_t gid;
25 int gidcnt;
26 gid_t *gidlist;
27 bool is_admin;
28 struct vmspace *p_vmspace;
29 HANDLE signal_arrived;
32 #ifdef __INSIDE_CYGWIN__
33 #include "sigproc.h"
34 extern inline void
35 ipc_set_proc_info (proc &blk, bool in_fork = false)
37 blk.cygpid = getpid ();
38 blk.winpid = GetCurrentProcessId ();
39 blk.uid = geteuid ();
40 blk.gid = getegid ();
41 blk.gidcnt = 0;
42 blk.gidlist = NULL;
43 blk.is_admin = false;
44 blk.signal_arrived = in_fork ? NULL : _my_tls.get_signal_arrived (true);
46 #endif /* __INSIDE_CYGWIN__ */
48 #ifndef __INSIDE_CYGWIN__
49 class ipc_retval {
50 private:
51 union {
52 int i;
53 ssize_t ssz;
54 size_t sz;
55 vm_offset_t off;
56 vm_object_t obj;
59 public:
60 ipc_retval () { ssz = 0; }
61 ipc_retval (ssize_t nssz) { ssz = nssz; }
63 operator int () const { return i; }
64 int operator = (int ni) { return i = ni; }
66 /* size_t == vm_offset_t == unsigned long. Ssize_t needs overloading */
67 operator ssize_t () const { return ssz; }
68 ssize_t operator = (ssize_t nssz) { return ssz = nssz; }
70 operator vm_offset_t () const { return off; }
71 vm_offset_t operator = (vm_offset_t noff) { return off = noff; }
73 operator vm_object_t () const { return obj; }
74 vm_object_t operator = (vm_object_t nobj) { return obj = nobj; }
77 class thread {
78 private:
79 /* Implemented in cgyserver/process.cc */
80 void dup_signal_arrived ();
81 void close_signal_arrived ();
82 public:
83 class process *client;
84 proc *ipcblk;
85 ipc_retval td_retval[2];
87 thread (class process *_client, proc *_proc, bool _init_m1)
88 : client (_client), ipcblk (_proc)
90 td_retval[0] = td_retval[1] = _init_m1 ? -1 : 0;
91 dup_signal_arrived ();
93 ~thread () { close_signal_arrived (); }
95 #define td_proc ipcblk
96 #define p_pid cygpid
97 #endif
99 #endif /* __CYGSERVER_IPC_H__ */