OSDN Git Service

* transport_pipes.cc: Include ntdef.h to accommodate cygerrno.h.
[pf3gnuchains/pf3gnuchains4x.git] / winsup / cygserver / bsd_helper.h
1 /* bsd_helper.h: Helps integrating BSD kernel code
2
3    Copyright 2003 Red Hat, Inc.
4
5 This file is part of Cygwin.
6
7 This software is a copyrighted work licensed under the terms of the
8 Cygwin license.  Please consult the file "CYGWIN_LICENSE" for
9 details. */
10 #ifndef _BSD_HELPER_H
11 #define _BSD_HELPER_H
12
13 #include <sys/types.h>
14 #include <sys/syslog.h>
15
16 enum tun_bool_t {
17   TUN_UNDEF = 0,
18   TUN_FALSE = 1,
19   TUN_TRUE  = 2
20 };
21
22 #define TUNABLE_INT_FETCH(a,b)  tunable_int_fetch((a),(b))
23 #define TUNABLE_BOOL_FETCH(a,b) tunable_bool_fetch((a),(b))
24
25 #define sys_malloc(a,b,c) (malloc(a)?:(panic("malloc failed in %s, line %d"),(void*)NULL))
26 #define sys_free(a,b) free(a)
27
28 #define jail_sysvipc_allowed true
29 #define jailed(a) false
30
31 extern const char *__progname;
32
33 /* Global vars, determining whether the IPC stuff should be started or not. */
34 extern tun_bool_t support_sharedmem;
35 extern tun_bool_t support_msgqueues;
36 extern tun_bool_t support_semaphores;
37
38 extern SECURITY_ATTRIBUTES sec_all_nih;
39
40 void securityinit (void);
41
42 int win_copyin (struct thread *, const void *, void *, size_t);
43 int win_copyout (struct thread *, const void *, void *, size_t);
44 #define copyin(a,b,c) win_copyin((td),(a),(b),(c))
45 #define copyout(a,b,c) win_copyout((td),(a),(b),(c))
46
47 void *get_token_info (HANDLE, TOKEN_INFORMATION_CLASS);
48 int ipcperm (struct thread *, struct ipc_perm *, unsigned int);
49 int suser (struct thread *);
50 bool adjust_identity_info (struct proc *p);
51
52 struct vmspace *ipc_p_vmspace (struct proc *);
53 int ipcexit_creat_hookthread(struct thread *);
54 void ipcinit (void);
55 int ipcunload (void);
56
57 vm_object_t _vm_pager_allocate (int, int);
58 #define vm_pager_allocate(a,b,s,c,d) _vm_pager_allocate((s),(mode))
59 vm_object_t vm_object_duplicate (struct thread *td, vm_object_t object);
60 void vm_object_deallocate (vm_object_t object);
61
62 void tunable_param_init (const char *, bool);
63 void tunable_int_fetch (const char *, long *);
64 void tunable_bool_fetch (const char *, tun_bool_t *);
65
66 #endif /* _BSD_HELPER_H */