irixHeaders.h

Go to the documentation of this file.
00001 /*
00002  * See the dyninst/COPYRIGHT file for copyright information.
00003  * 
00004  * We provide the Paradyn Tools (below described as "Paradyn")
00005  * on an AS IS basis, and do not warrant its validity or performance.
00006  * We reserve the right to update, modify, or discontinue this
00007  * software at any time.  We shall have no obligation to supply such
00008  * updates or modifications or any other form of support to you.
00009  * 
00010  * By your use of Paradyn, you understand and agree that we (or any
00011  * other person or entity with proprietary rights in Paradyn) are
00012  * under no obligation to provide either maintenance services,
00013  * update services, notices of latent defects, or correction of
00014  * defects for Paradyn.
00015  * 
00016  * This library is free software; you can redistribute it and/or
00017  * modify it under the terms of the GNU Lesser General Public
00018  * License as published by the Free Software Foundation; either
00019  * version 2.1 of the License, or (at your option) any later version.
00020  * 
00021  * This library is distributed in the hope that it will be useful,
00022  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00023  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00024  * Lesser General Public License for more details.
00025  * 
00026  * You should have received a copy of the GNU Lesser General Public
00027  * License along with this library; if not, write to the Free Software
00028  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
00029  */
00030 
00031 
00032 #if !defined(_irix_headers_h)
00033 #define _irix_headers_h
00034 
00035 #include <assert.h>
00036 #include <stdio.h>
00037 #include <string.h>
00038 #include <stdlib.h>
00039 #include <errno.h>
00040 #include <assert.h>
00041 #include <fcntl.h>
00042 #include <netinet/in.h>
00043 #include <netdb.h>
00044 #include <sys/types.h>
00045 #include <sys/mman.h>
00046 #include <sys/time.h>
00047 #include <unistd.h>
00048 #include <sys/file.h>
00049 #include <sys/socket.h>
00050 #include <sys/errno.h>
00051 #include <sys/wait.h>
00052 #include <signal.h>
00053 #include <sys/time.h>
00054 #include <sys/resource.h>
00055 #include <stdarg.h>
00056 #include <time.h>
00057 #include <sys/utsname.h>
00058 #include <sys/stat.h>
00059 #include <sys/un.h>
00060 
00061 #include <rpc/types.h>
00062 #include <rpc/xdr.h>
00063 
00064 /* unprototyped system calls */
00065 #if defined(__cplusplus)
00066 extern "C" {
00067 #endif
00068 extern int rexec(char **ahost, int inport, char *user, 
00069          char *passwd, char *cmd, int *fd2p);
00070 extern pid_t vfork();
00071 #if defined(__cplusplus)
00072 };
00073 #endif
00074 
00075 
00076 typedef int (*P_xdrproc_t)(XDR*, ...);
00077 extern char *sys_errlist[];
00078 
00079 /* POSIX */
00080 inline void P_abort (void) { abort();}
00081 inline int P_close (int FILEDES) { return (close(FILEDES));}
00082 inline int P_dup2 (int OLD, int NEW) { return (dup2(OLD, NEW));}
00083 inline int P_execvp (const char *FILENAME, char *const ARGV[]) {
00084   return (execvp(FILENAME, ARGV));}
00085 inline int P_execve (const char* FILENAME,
00086              char* const ARGV[], char* const ENVP[]) {
00087     return (execve(FILENAME, ARGV, ENVP));
00088 }            
00089 inline void P__exit (int STATUS) { _exit(STATUS);}
00090 inline int P_fcntl (int FILEDES, int COMMAND, int ARG2) {
00091   return (fcntl(FILEDES, COMMAND, ARG2));}
00092 inline FILE * P_fdopen (int FILEDES, const char *OPENTYPE) {
00093   return (fdopen(FILEDES, OPENTYPE));}
00094 inline FILE * P_fopen (const char *FILENAME, const char *OPENTYPE) {
00095   return (fopen(FILENAME, OPENTYPE));}
00096 inline int P_fstat (int FILEDES, struct stat *BUF) { return (fstat(FILEDES, BUF));}
00097 inline pid_t P_getpid () { return (getpid());}
00098 inline int P_kill(pid_t PID, int SIGNUM) { return (kill(PID, SIGNUM));}
00099 inline off_t P_lseek (int FILEDES, off_t OFFSET, int WHENCE) {
00100   return (lseek(FILEDES, OFFSET, WHENCE));}
00101 inline int P_open(const char *FILENAME, int FLAGS, mode_t MODE) {
00102   return (open(FILENAME, FLAGS, MODE));}
00103 inline int P_pclose (FILE *STREAM) { return (pclose(STREAM));}
00104 inline FILE *P_popen (const char *COMMAND, const char *MODE) {
00105   return (popen(COMMAND, MODE));}
00106 inline size_t P_read (int FILEDES, void *BUFFER, size_t SIZE) {
00107   return (read(FILEDES, BUFFER, SIZE));}
00108 inline int P_uname(struct utsname *un) { return (uname(un));}
00109 inline pid_t P_wait(int *status_ptr) { return (wait(status_ptr));}
00110 inline int P_waitpid(pid_t pid, int *statusp, int options) {
00111   return (waitpid(pid, statusp, options));}
00112 inline size_t P_write (int FILEDES, const void *BUFFER, size_t SIZE) {
00113   return (write(FILEDES, BUFFER, SIZE));}
00114 inline int P_chdir(const char *path) { return (chdir(path)); }
00115 inline int P_putenv(char *str) { return putenv(str); }
00116 
00117 /* SYSTEM-V shared memory */
00118 #include <sys/ipc.h>
00119 #include <sys/shm.h> /* shmid_ds */
00120 inline int P_shmget(key_t theKey, int size, int flags) {
00121    return shmget(theKey, size, flags);
00122 }
00123 inline void *P_shmat(int shmid, void *addr, int flags) {
00124    return shmat(shmid, (char *)addr, flags);
00125 }
00126 inline int P_shmdt(void *addr) {return shmdt((char*)addr);}
00127 inline int P_shmctl(int shmid, int cmd, struct shmid_ds *buf) {
00128    return shmctl(shmid, cmd, buf);
00129 }
00130 
00131 /* ANSI */
00132 inline void P_exit (int STATUS) { exit(STATUS);}
00133 inline int P_fflush(FILE *stream) { return (fflush(stream));}
00134 inline char * P_fgets (char *S, int COUNT, FILE *STREAM) {
00135   return (fgets(S, COUNT, STREAM));}
00136 inline void * P_malloc (size_t SIZE) { return (malloc(SIZE));}
00137 inline void * P_memcpy (void *A1, const void *A2, size_t SIZE) {
00138   return memcpy(A1, A2, SIZE);}
00139 inline void * P_memset (void *BLOCK, int C, size_t SIZE) {
00140   return (memset(BLOCK, C, SIZE));}
00141 inline void P_perror (const char *MESSAGE) { perror(MESSAGE);}
00142 typedef void (*P_sig_handler)(int);
00143 inline P_sig_handler P_signal (int SIGNUM, P_sig_handler ACTION) {
00144   return (signal(SIGNUM, ACTION));}
00145 inline char * P_strcat (char *TO, const char *FROM) {
00146   return (strcat(TO, FROM));}
00147 
00148 inline const char * P_strchr (const char *STRING, int C) {return (strchr(STRING, C));}
00149 inline char * P_strchr (char *STRING, int C) {return (strchr(STRING, C));}
00150 
00151 inline int P_strcmp (const char *S1, const char *S2) {
00152   return (strcmp(S1, S2));}
00153 inline char * P_strcpy (char *TO, const char *FROM) {
00154   return (strcpy(TO, FROM));}
00155 inline char *P_strdup(const char *S) { return (strdup(S));}
00156 inline size_t P_strlen (const char *S) { return (strlen(S));}
00157 inline char * P_strncat (char *TO, const char *FROM, size_t SIZE) {
00158   return (strncat(TO, FROM, SIZE)); }
00159 inline int P_strncmp (const char *S1, const char *S2, size_t SIZE) {
00160   return (strncmp(S1, S2, SIZE));}
00161 inline char * P_strncpy (char *TO, const char *FROM, size_t SIZE) {
00162   return (strncpy(TO, FROM, SIZE));}
00163 
00164 inline const char * P_strrchr (const char *STRING, int C) {return (strrchr(STRING, C));}
00165 inline char * P_strrchr (char *STRING, int C) {return (strrchr(STRING, C));}
00166 
00167 inline const char * P_strstr (const char *HAYSTACK, const char *NEEDLE) {return (strstr(HAYSTACK, NEEDLE));}
00168 inline char * P_strstr (char *HAYSTACK, const char *NEEDLE) {return (strstr(HAYSTACK, NEEDLE));}
00169 
00170 inline double P_strtod (const char *STRING, char **TAILPTR) {
00171   return (strtod(STRING, TAILPTR));}
00172 inline char * P_strtok (char *NEWSTRING, const char *DELIMITERS) {
00173   return (strtok(NEWSTRING, DELIMITERS));}
00174 inline long int P_strtol (const char *STRING, char **TAILPTR, int BASE) {
00175   return (strtol(STRING, TAILPTR, BASE));}
00176 inline unsigned long int P_strtoul(const char *STRING, char **TAILPTR, int BASE) { 
00177   return (strtoul(STRING, TAILPTR, BASE));}
00178 
00179 /* BSD */
00180 inline int P_accept (int SOCK, struct sockaddr *ADDR, size_t *LENGTH_PTR)
00181 {
00182   int len_tmp = *LENGTH_PTR;
00183   int ret = accept(SOCK, ADDR, &len_tmp);
00184   *LENGTH_PTR = len_tmp;
00185   return ret;
00186 }
00187 inline int P_bind(int socket, struct sockaddr *addr, size_t len) {
00188   return (bind(socket, addr, len));}
00189 inline int P_connect(int socket, struct sockaddr *addr, size_t len) {
00190   return (connect(socket, addr, len));}
00191 inline struct hostent * P_gethostbyname (const char *NAME) {
00192   return (gethostbyname(NAME));}
00193 inline int P_getrusage(int i, struct rusage *ru) { 
00194    return (getrusage(i, ru));}
00195 inline struct servent * P_getservbyname (const char *NAME, const char *PROTO) {
00196   return (getservbyname(NAME, PROTO));}
00197 inline int P_getsockname (int SOCKET, struct sockaddr *ADDR, size_t *LENGTH_PTR)
00198 {
00199   int len_tmp = *LENGTH_PTR;
00200   int ret = getsockname(SOCKET, ADDR, &len_tmp);
00201   *LENGTH_PTR = len_tmp;
00202   return ret;
00203 }
00204 inline int P_getsockopt(int s, int level, int optname, void *optval, int *optlen) {
00205    return getsockopt(s, level, optname, (char*)optval, optlen);}
00206 inline int P_setsockopt(int s, int level, int optname, void *optval, int optlen) {
00207    return setsockopt(s, level, optname, (const char*)optval, optlen);}
00208 
00209 inline int P_gettimeofday (struct timeval *TP, struct timezone *TZP) {
00210   return (gettimeofday(TP, TZP));} 
00211 inline int P_listen (int socket, unsigned int n) { return (listen(socket, n));}
00212 inline caddr_t P_mmap(caddr_t addr, size_t len, int prot, int flags,
00213               int fd, off_t off) {
00214   return (caddr_t)(mmap(addr, len, prot, flags, fd, off));}
00215 inline int P_munmap(caddr_t addr, int i) { return (munmap(addr, i));}
00216 inline int P_socket (int NAMESPACE, int STYLE, int PROTOCOL) {
00217   return (socket(NAMESPACE, STYLE, PROTOCOL));}
00218 inline int P_socketpair(int namesp, int style, int protocol, int filedes[2]) {
00219   return (socketpair(namesp, style, protocol, filedes));}
00220 inline int P_pipe(int fds[2]) { return (pipe(fds)); }
00221 inline int P_strcasecmp(const char *s1, const char *s2) {
00222   return (strcasecmp(s1, s2));}
00223 inline int P_strncasecmp (const char *S1, const char *S2, size_t N) {
00224   return (strncasecmp(S1, S2,N));}
00225 inline int P_endservent(void) { endservent(); return 0; }
00226 
00227   /* Ugly hack to match ptrace definition in <unistd.h>.
00228    * See core/dyninstAPI/mips-sgi-irix6.5/Makefile for explanation.
00229    */
00230 #if defined(HAVE_OLD_UNISTD)
00231 inline int P_ptrace(int req, pid_t pid, int addr, int data) {
00232     return (ptrace(req, pid, addr, data));}
00233 #else
00234 inline int P_ptrace(int req, pid_t pid, long addr, long data) {
00235     return (ptrace(req, pid, (void *)addr, data));}
00236 #endif
00237 
00238 inline int P_select(int wid, fd_set *rd, fd_set *wr, fd_set *ex,
00239             struct timeval *tm) {
00240   return (select(wid, rd, wr, ex, tm));}
00241 
00242 inline int P_rexec(char **ahost, u_short inport, char *user,
00243            char *passwd, char *cmd, int *fd2p) {
00244   return (rexec(ahost, (int)inport, user, passwd, cmd, fd2p));}
00245 
00246 // for matherr()
00247 #ifdef USES_NATIVE_CC
00248 struct exception { // CSS
00249         int type;
00250         char *name;
00251         double arg1;
00252         double arg2;
00253         double retval;
00254 };
00255 #endif
00256 
00257 extern "C" char *cplus_demangle(char *, int);
00258 inline char * P_cplus_demangle( const char * symbol, bool /* nativeCompiler */ ) {
00259    return cplus_demangle( (char *)symbol, 0);
00260    } /* end P_cplus_demangle() */
00261 
00262 inline void   P_xdr_destroy(XDR *x) { xdr_destroy(x);}
00263 inline bool_t P_xdr_u_char(XDR *x, u_char *uc) { return (xdr_u_char(x, uc));}
00264 inline bool_t P_xdr_int(XDR *x, int *i) { return (xdr_int(x, i));}
00265 inline bool_t P_xdr_double(XDR *x, double *d) {
00266   return (xdr_double(x, d));}
00267 inline bool_t P_xdr_u_int(XDR *x, u_int *u){
00268   return (xdr_u_int(x, u));}
00269 inline bool_t P_xdr_float(XDR *x, float *f) {
00270   return (xdr_float(x, f));}
00271 inline bool_t P_xdr_char(XDR *x, char *c) {
00272   return (xdr_char(x, c));}
00273 inline bool_t P_xdr_string(XDR *x, char **h, const u_int maxsize) {
00274   return (xdr_string(x, h, maxsize));}
00275 
00276 inline void P_xdrrec_create(XDR *x, const u_int send_sz, const u_int rec_sz,
00277                 const caddr_t handle, 
00278                 xdr_rd_func read_r, xdr_wr_func write_f) {
00279   xdrrec_create(x, send_sz, rec_sz, handle, 
00280         (int (*)(void *, void *, u_int))read_r, 
00281         (int (*)(void *, void *, u_int))write_f);
00282 }
00283 inline bool_t P_xdrrec_endofrecord(XDR *x, int now) { 
00284   return (xdrrec_endofrecord(x, now));}
00285 inline bool_t P_xdrrec_skiprecord(XDR *x) { return (xdrrec_skiprecord(x));}
00286 inline bool_t P_xdrrec_eof(XDR *x) { return (xdrrec_eof(x)); }
00287 
00288 #endif
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 12 Jul 2013 for SymtabAPI by  doxygen 1.6.1