DEADSOFTWARE

Patched for Linux
[mp3cc.git] / MPC.3.5.LINUX / preverifier / sysmacros_md.h
1 /*
2 * @(#)sysmacros_md.h 1.5 02/09/27
3 *
4 * Copyright 1995-1998 by Sun Microsystems, Inc.,
5 * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
6 * All rights reserved.
7 *
8 * This software is the confidential and proprietary information
9 * of Sun Microsystems, Inc. ("Confidential Information"). You
10 * shall not disclose such Confidential Information and shall use
11 * it only in accordance with the terms of the license agreement
12 * you entered into with Sun.
13 * Use is subject to license terms.
14 */
16 #ifndef _SYSMACROS_MD_H_
17 #define _SYSMACROS_MD_H_
19 /*
20 * Because these are used directly as function ptrs, just redefine the name
21 */
22 #define sysMalloc malloc
23 #define sysFree free
24 #define sysCalloc calloc
25 #define sysRealloc realloc
27 /* A macro for sneaking into a sys_mon_t to get the owner sys_thread_t */
28 #define sysMonitorOwner(mid) ((mid)->monitor_owner)
30 #ifdef DEBUG
31 extern void DumpThreads(void);
32 void panic (const char *, ...);
33 #define sysAssert(expression) { \
34 if (!(expression)) { \
35 DumpThreads(); \
36 panic("\"%s\", line %d: assertion failure\n", __FILE__, __LINE__); \
37 } \
38 }
39 #else
40 #define sysAssert(expression)
41 #endif
43 /*
44 * Case insensitive compare of ASCII strings
45 */
46 #define sysStricmp(a, b) strcasecmp(a, b)
48 /*
49 * File system macros
50 */
51 #ifdef UNIX
52 #define sysOpen(_path, _oflag, _mode) open(_path, _oflag, _mode)
53 #define sysNativePath(path) (path)
54 #endif
55 #ifdef WIN32
56 #include <io.h>
57 #define sysOpen(_path, _oflag, _mode) open(_path, _oflag | O_BINARY, _mode)
58 char *sysNativePath(char *);
59 #endif
60 #define sysRead(_fd, _buf, _n) read(_fd, _buf, _n)
61 #define sysWrite(_fd, _buf, _n) write(_fd, _buf, _n)
62 #define sysClose(_fd) close(_fd)
63 #define sysAccess(_path, _mode) access(_path, _mode)
64 #define sysStat(_path, _buf) stat(_path, _buf)
65 #define sysMkdir(_path, _mode) mkdir(_path, _mode)
66 #define sysUnlink(_path) unlink(_path)
67 #define sysIsAbsolute(_path) (*(_path) == '/')
68 #define sysCloseDir(_dir) closedir(_dir)
69 #define sysOpenDir(_path) opendir(_path)
70 #define sysRmdir(_dir) remove(_dir)
71 #define sysSeek(fd, offset, whence) lseek(fd, offset, whence)
72 #define sysRename(s, d) rename(s, d)
74 #endif /*_SYSMACROS_MD_H_*/