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