vxworksHeaders.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(_vxworks_headers_h)
00033 #define _vxworks_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/ptrace.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 #include <sys/syscall.h>
00061 
00062 #include <rpc/types.h>
00063 #include <rpc/xdr.h>
00064 
00065 #define PDSOCKET_ERROR (-1)
00066 typedef int PDSOCKET;
00067 typedef int (*P_xdrproc_t)(XDR*, ...);
00068 /* Not going to use on Linux Platform - already declared in /usr/include/errno.h
00069 extern const char *sys_errlist[];
00070 */
00071 
00072 #ifndef SYS_tkill
00073 #define SYS_tkill 238
00074 #endif
00075 /* POSIX */
00076 int P_getopt(int argc, char *argv[], const char *optstring);
00077 inline void P_abort (void) { abort();}
00078 inline int P_close (int FILEDES) { 
00079     return (close(FILEDES));
00080 }
00081 inline int P_dup2 (int OLD, int NEW) { return (dup2(OLD, NEW));}
00082 inline int P_execvp (const char *FILENAME, char *const ARGV[]) {
00083   return (execvp(FILENAME, ARGV));}
00084 inline int P_execve (const char* FILENAME,
00085              char* const ARGV[], char* const ENVP[]) {
00086     return (execve(FILENAME, ARGV, ENVP));
00087 }
00088 inline void P__exit (int STATUS) { _exit(STATUS);}
00089 inline int P_fcntl (int FILEDES, int COMMAND, int ARG2) {
00090   return (fcntl(FILEDES, COMMAND, ARG2));}
00091 inline FILE * P_fdopen (int FILEDES, const char *OPENTYPE) {
00092   return (fdopen(FILEDES, OPENTYPE));}
00093 inline FILE * P_fopen (const char *FILENAME, const char *OPENTYPE) {
00094     return fopen(FILENAME, OPENTYPE);
00095 }
00096 int P_copy(const char *from, const char *to);
00097 int P_system(const char *string);
00098 inline int P_fstat (int FILEDES, struct stat *BUF) { return (fstat(FILEDES, BUF));}
00099 inline pid_t P_getpid () { return (getpid());}
00100 inline int P_kill(pid_t PID, int SIGNUM) { return (kill(PID, SIGNUM));}
00101 inline long int P_tkill(pid_t PID, int SIGNUM) { return (syscall(SYS_tkill, PID, SIGNUM));}
00102 inline off_t P_lseek (int FILEDES, off_t OFFSET, int WHENCE) {
00103   return (lseek(FILEDES, OFFSET, WHENCE));}
00104 inline int P_open(const char *FILENAME, int FLAGS, mode_t MODE) {
00105     return open(FILENAME, FLAGS, MODE);
00106 }
00107 
00108 
00109 inline int P_pclose (FILE *STREAM) { return (pclose(STREAM));}
00110 inline FILE *P_popen (const char *COMMAND, const char *MODE) {
00111   return (popen(COMMAND, MODE));}
00112 inline size_t P_read (int FILEDES, void *BUFFER, size_t SIZE) {
00113   return (read(FILEDES, BUFFER, SIZE));}
00114 inline int P_uname(struct utsname *un) { return (uname(un));}
00115 inline pid_t P_wait(int *status_ptr) { return (wait(status_ptr));}
00116 inline int P_waitpid(pid_t pid, int *statusp, int options) {
00117   return (waitpid(pid, statusp, options));}
00118 inline size_t P_write (int FILEDES, const void *BUFFER, size_t SIZE) {
00119   return (write(FILEDES, BUFFER, SIZE));}
00120 inline int P_chdir(const char *path) { return (chdir(path)); }
00121 inline int P_putenv(char *str) { return putenv(str); }
00122 inline int P_getpagesize() { return getpagesize(); }
00123 /* SYSTEM-V shared memory */
00124 #include <sys/ipc.h>
00125 #include <sys/shm.h> /* shmid_ds */
00126 inline int P_shmget(key_t theKey, int size, int flags) {
00127    return shmget(theKey, size, flags);
00128 }
00129 inline void *P_shmat(int shmid, void *addr, int flags) {
00130    return shmat(shmid, (char *)addr, flags);
00131 }
00132 inline int P_shmdt(void *addr) {return shmdt((char*)addr);}
00133 inline int P_shmctl(int shmid, int cmd, struct shmid_ds *buf) {
00134    return shmctl(shmid, cmd, buf);
00135 }
00136 
00137 /* ANSI */
00138 inline void P_exit (int STATUS) { exit(STATUS);}
00139 inline int P_fflush(FILE *stream) { return (fflush(stream));}
00140 inline char * P_fgets (char *S, int COUNT, FILE *STREAM) {
00141   return (fgets(S, COUNT, STREAM));}
00142 inline void * P_malloc (size_t SIZE) { return (malloc(SIZE));}
00143 inline void * P_memcpy (void *A1, const void *A2, size_t SIZE)
00144     { return memcpy( A1, A2, SIZE ); }
00145 inline void * P_memset (void *BLOCK, int C, size_t SIZE) {
00146   return (memset(BLOCK, C, SIZE));}
00147 inline void P_perror (const char *MESSAGE) { perror(MESSAGE);}
00148 typedef void (*P_sig_handler)(int);
00149 inline P_sig_handler P_signal (int SIGNUM, P_sig_handler ACTION) {
00150   return (signal(SIGNUM, ACTION));}
00151 inline char * P_strcat (char *TO, const char *FROM) {
00152   return (strcat(TO, FROM));}
00153 
00154 inline const char * P_strchr (const char *P_STRING, int C) {return (strchr(P_STRING, C));}
00155 inline char * P_strchr (char *P_STRING, int C) {return (strchr(P_STRING, C));}
00156 
00157 inline int P_strcmp (const char *S1, const char *S2) {
00158   return (strcmp(S1, S2));}
00159 inline char * P_strcpy (char *TO, const char *FROM) {
00160   return (strcpy(TO, FROM));}
00161 inline char *P_strdup(const char *S) { return (strdup(S));}
00162 inline size_t P_strlen (const char *S) { return (strlen(S));}
00163 inline char * P_strncat (char *TO, const char *FROM, size_t SIZE) {
00164   return (strncat(TO, FROM, SIZE)); }
00165 inline int P_strncmp (const char *S1, const char *S2, size_t SIZE) {
00166   return (strncmp(S1, S2, SIZE));}
00167 inline char * P_strncpy (char *TO, const char *FROM, size_t SIZE) {
00168   return (strncpy(TO, FROM, SIZE));}
00169 
00170 inline const char * P_strrchr (const char *P_STRING, int C) {return (strrchr(P_STRING, C));}
00171 inline char * P_strrchr (char *P_STRING, int C) {return (strrchr(P_STRING, C));}
00172 
00173 inline const char * P_strstr (const char *HAYSTACK, const char *NEEDLE) {return (strstr(HAYSTACK, NEEDLE));}
00174 inline char * P_strstr (char *HAYSTACK, const char *NEEDLE) {return (strstr(HAYSTACK, NEEDLE));}
00175 
00176 inline double P_strtod (const char *P_STRING, char **TAILPTR) {
00177   return (strtod(P_STRING, TAILPTR));}
00178 inline char * P_strtok (char *NEWP_STRING, const char *DELIMITERS) {
00179   return (strtok(NEWP_STRING, DELIMITERS));}
00180 inline long int P_strtol (const char *P_STRING, char **TAILPTR, int BASE) {
00181   return (strtol(P_STRING, TAILPTR, BASE));}
00182 inline unsigned long int P_strtoul(const char *P_STRING, char **TAILPTR, int BASE) { 
00183   return (strtoul(P_STRING, TAILPTR, BASE));}
00184 
00185 /* BSD */
00186 inline int P_accept (int SOCK, struct sockaddr *ADDR, socklen_t *LENGTH_PTR) {
00187   return (accept(SOCK, ADDR, LENGTH_PTR));}
00188 inline int P_bind(int socket, struct sockaddr *addr, socklen_t len) {
00189   return (bind(socket, addr, len));}
00190 inline int P_connect(int socket, struct sockaddr *addr, socklen_t len) {
00191   return (connect(socket, addr, len));}
00192 inline struct hostent * P_gethostbyname (const char *NAME) {
00193   return (gethostbyname(NAME));}
00194 /* inline int P_gethostname(char *name, size_t size) {
00195    return (gethostname(name, size));} */
00196 /* inline int P_getrusage(int i, struct rusage *ru) { 
00197    return (getrusage(i, ru));} */
00198 inline struct servent * P_getservbyname (const char *NAME, const char *PROTO) {
00199   return (getservbyname(NAME, PROTO));}
00200 inline int P_getsockname (int SOCKET, struct sockaddr *ADDR, socklen_t *LENGTH_PTR) {
00201   return (getsockname(SOCKET, ADDR, LENGTH_PTR));}
00202 inline int P_getsockopt(int s, int level, int optname, void *optval, int *optlen) {
00203    return getsockopt(s, level, optname, (char*)optval, (unsigned int*)optlen);
00204 }
00205 inline int P_setsockopt(int s, int level, int optname, void *optval, int optlen) {
00206    return setsockopt(s, level, optname, (const char*)optval, optlen);
00207 }
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 /* As endservent() on Linux Platform /usr/include/netdb.h has no return value, 
00226    so P_endservent() should be a void function */
00227 inline void P_endservent(void) { endservent(); }
00228 
00229 inline ssize_t P_recv(int s, void *buf, int len, int flags) {
00230    return (recv(s, buf, len, flags));
00231 }
00232 
00233 /* Ugly */
00234 #if 0
00235 inline long int P_ptrace(int req, pid_t pid, Address addr, Address data, int word_len = -1) {
00236     if (word_len != -1 && word_len != sizeof(Address)) {
00237     return (ptrace((enum __ptrace_request)req, pid, (uint32_t)addr, (uint32_t)data));
00238     } else {
00239     return (ptrace((enum __ptrace_request)req, pid, addr, data));
00240     }
00241 }
00242 // long int P_ptrace(int req, pid_t pid, Address addr, Address data, int word_len);
00243 #else
00244 inline long int P_ptrace(int req, pid_t pid, Address addr, Address data, int = -1) {
00245     return (ptrace((enum __ptrace_request)req, pid, addr, data));}
00246 #endif
00247 
00248 inline int P_select(int wid, fd_set *rd, fd_set *wr, fd_set *ex,
00249             struct timeval *tm) {
00250   return (select(wid, rd, wr, ex, tm));}
00251 
00252 inline int P_rexec(char **ahost, u_short inport, char *user,
00253            char *passwd, char *cmd, int *fd2p) {
00254   return (rexec(ahost, inport, user, passwd, cmd, fd2p));}
00255 
00256 /* The following values are taken from demangle.h in binutils */
00257 #define DMGL_PARAMS      (1 << 0)       /* Include function args */
00258 #define DMGL_ANSI        (1 << 1)       /* Include const, volatile, etc */
00259 
00260 #define DMGL_ARM         (1 << 11)      /* Use C++ ARM name mangling */ 
00261 
00262 extern "C" char *cplus_demangle(char *, int);
00263 extern void dedemangle( char * demangled, char * dedemangled );
00264 extern char * P_cplus_demangle( const char * symbol, bool nativeCompiler,
00265                 bool includeTypes = false );
00266 
00267 inline void   P_xdr_destroy(XDR *x) { xdr_destroy(x);}
00268 inline bool_t P_xdr_u_char(XDR *x, u_char *uc) { return (xdr_u_char(x, uc));}
00269 inline bool_t P_xdr_int(XDR *x, int *i) { return (xdr_int(x, i));}
00270 inline bool_t P_xdr_double(XDR *x, double *d) {
00271   return (xdr_double(x, d));}
00272 inline bool_t P_xdr_u_int(XDR *x, u_int *u){
00273   return (xdr_u_int(x, u));}
00274 inline bool_t P_xdr_float(XDR *x, float *f) {
00275   return (xdr_float(x, f));}
00276 inline bool_t P_xdr_char(XDR *x, char *c) {
00277   return (xdr_char(x, c));}
00278 inline bool_t P_xdr_string(XDR *x, char **h, const u_int maxsize) {
00279   return (xdr_string(x, h, maxsize));}
00280 
00281 inline void P_xdrrec_create(XDR *x, const u_int send_sz, const u_int rec_sz,
00282                 const caddr_t handle, 
00283                 xdr_rd_func read_r, xdr_wr_func write_f) {
00284   xdrrec_create(x, send_sz, rec_sz, handle, (int(*)(char*, char*, int))read_r, (int(*)(char*, char*, int))write_f);}
00285 inline bool_t P_xdrrec_endofrecord(XDR *x, int now) { 
00286   return (xdrrec_endofrecord(x, now));}
00287 inline bool_t P_xdrrec_skiprecord(XDR *x) { return (xdrrec_skiprecord(x));}
00288 inline bool_t P_xdrrec_eof(XDR *x) { return (xdrrec_eof(x)); }
00289 inline int P_mkdir(const char *pathname, mode_t mode) {
00290     return mkdir(pathname, mode);
00291 }
00292 inline int P_unlink(const char *pathname) {
00293     return unlink(pathname);
00294 }
00295 #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