Merge trunk version 204345 into gupc branch.
[official-gcc.git] / libgupc / smp / upc_sysdep.h
blob9c0ef610a9efd6fec1e447b250c85c1a523f9c04
1 /* GNU UPC Runtime Operating System and Target Platform Dependent Support
2 Copyright (C) 2003-2013 Free Software Foundation, Inc.
3 Free Software Foundation, Inc.
4 This file is part of the UPC runtime Library.
5 Written by Gary Funck <gary@intrepid.com>
6 and Nenad Vukicevic <nenad@intrepid.com>
8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License as
10 published by the Free Software Foundation; either version 2, or (at
11 your option) any later version.
13 This library is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this library; see the file COPYING. If not, write to
20 the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
21 MA 02111-1307, USA.
23 As a special exception, if you link this library with files
24 compiled with a GNU compiler to produce an executable, this does
25 not cause the resulting executable to be covered by the GNU General
26 Public License. This exception does not however invalidate any
27 other reasons why the executable file might be covered by the GNU
28 General Public License. */
30 #ifndef _UPC_OS_H_
31 #define _UPC_OS_H_
34 /* An actual heap is required only for the SGI Irix
35 based systems, because spin lock related data
36 structures must live there. The runtime doesn't
37 otherwise need its own heap, so a null handle is
38 passed around. */
39 #ifdef __sgi__
40 typedef usptr_t os_heap_t;
41 #else
42 typedef void *os_heap_t;
43 #endif
44 typedef os_heap_t *os_heap_p;
46 #ifdef __sgi__
47 typedef volatile ptrdiff_t os_atomic_t;
48 #else
49 typedef volatile int os_atomic_t;
50 #endif
51 typedef os_atomic_t *os_atomic_p;
53 #define OS_ATOMIC_WORD_SIZE (sizeof(os_atomic_t))
54 #define OS_BITS_PER_ATOMIC_WORD (OS_ATOMIC_WORD_SIZE * 8)
56 #ifdef __sgi__
57 typedef ulock_t os_lock_t;
58 #else
59 typedef os_atomic_t os_lock_t;
60 #endif
61 typedef os_lock_t *os_lock_p;
63 extern void __upc_sys_init (void);
65 extern int __upc_atomic_get_bit (os_atomic_p, int);
66 extern void __upc_atomic_set_bit (os_atomic_p, int);
68 extern void __upc_init_lock (os_lock_p);
69 extern void __upc_acquire_lock (os_lock_p);
70 extern int __upc_try_acquire_lock (os_lock_p);
71 extern void __upc_release_lock (os_lock_p);
73 extern os_heap_p __upc_create_runtime_heap (size_t, const char **);
74 extern void *__upc_runtime_alloc (size_t, os_heap_p *, const char **);
75 extern int __upc_create_temp_file (const char *tag, char *tmp_fname,
76 const char **err_msg);
77 extern int __upc_create_global_mem_file (char *tmp_fname, const char **err_msg);
78 extern char *__upc_strsignal (int);
80 #endif /* !_UPC_OS_H_ */