[Asterisk-cvs] asterisk/include/asterisk dlfcn-compat.h,NONE,1.1 poll-compat.h,NONE,1.1 io.h,1.1.1.1,1.2

markster at lists.digium.com markster at lists.digium.com
Sun Oct 26 12:24:47 CST 2003


Update of /usr/cvsroot/asterisk/include/asterisk
In directory mongoose.digium.com:/tmp/cvs-serv12438/include/asterisk

Modified Files:
	io.h 
Added Files:
	dlfcn-compat.h poll-compat.h 
Log Message:
Make it build and run on MacOS X


--- NEW FILE: dlfcn-compat.h ---
/*
Copyright (c) 2002 Jorge Acereda  <jacereda at users.sourceforge.net> &
                   Peter O'Gorman <ogorman at users.sourceforge.net>
                   
Portions may be copyright others, see the AUTHORS file included with this
distribution.

Maintained by Peter O'Gorman <ogorman at users.sourceforge.net>

Bug Reports and other queries should go to <ogorman at users.sourceforge.net>

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef _DLFCN_H_
#define _DLFCN_H_

#ifdef __cplusplus
extern "C" {
#endif

#if defined (__GNUC__) && __GNUC__ > 3
#define dl_restrict __restrict
#else
#define dl_restrict
#endif
/*
 * Structure filled in by dladdr().
 */

typedef struct dl_info {
        const char      *dli_fname;     /* Pathname of shared object */
        void            *dli_fbase;     /* Base address of shared object */
        const char      *dli_sname;     /* Name of nearest symbol */
        void            *dli_saddr;     /* Address of nearest symbol */
} Dl_info;

extern void * dlopen(const char *path, int mode);
extern void * dlsym(void * dl_restrict handle, const char * dl_restrict symbol);
extern const char * dlerror(void);
extern int dlclose(void * handle);
extern int dladdr(const void * dl_restrict, Dl_info * dl_restrict);

#define RTLD_LAZY	0x1
#define RTLD_NOW	0x2
#define RTLD_LOCAL	0x4
#define RTLD_GLOBAL	0x8
#define RTLD_NOLOAD	0x10
#define RTLD_NODELETE	0x80

/*
 * Special handle arguments for dlsym().
 */
#define	RTLD_NEXT		((void *) -1)	/* Search subsequent objects. */
#define	RTLD_DEFAULT	((void *) -2)	/* Use default search algorithm. */

#ifdef __cplusplus
}
#endif

#endif /* _DLFCN_H_ */

--- NEW FILE: poll-compat.h ---
/*---------------------------------------------------------------------------*\
  $Id: poll-compat.h,v 1.1 2003/10/26 18:50:49 markster Exp $

  NAME

	poll - select(2)-based poll() emulation function for BSD systems.

  SYNOPSIS
	#include "poll.h"

	struct pollfd
	{
	    int     fd;
	    short   events;
	    short   revents;
	}

	int poll (struct pollfd *pArray, unsigned long n_fds, int timeout)

  DESCRIPTION

	This file, and the accompanying "poll.c", implement the System V
	poll(2) system call for BSD systems (which typically do not provide
	poll()).  Poll() provides a method for multiplexing input and output
	on multiple open file descriptors; in traditional BSD systems, that
	capability is provided by select().  While the semantics of select()
	differ from those of poll(), poll() can be readily emulated in terms
	of select() -- which is how this function is implemented.

  REFERENCES
	Stevens, W. Richard. Unix Network Programming.  Prentice-Hall, 1990.

  NOTES
	1. This software requires an ANSI C compiler.

  LICENSE

	This software is released under the following license:

		Copyright (c) 1995-2002 Brian M. Clapper
		All rights reserved.

		Redistribution and use in source and binary forms are
		permitted provided that: (1) source distributions retain
		this entire copyright notice and comment; (2) modifications
		made to the software are prominently mentioned, and a copy
		of the original software (or a pointer to its location) are
		included; and (3) distributions including binaries display
		the following acknowledgement: "This product includes
		software developed by Brian M. Clapper <bmc at clapper.org>"
		in the documentation or other materials provided with the
		distribution. The name of the author may not be used to
		endorse or promote products derived from this software
		without specific prior written permission.

		THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS
		OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE
		IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
		PARTICULAR PURPOSE.

	Effectively, this means you can do what you want with the software
	except remove this notice or take advantage of the author's name.
	If you modify the software and redistribute your modified version,
	you must indicate that your version is a modification of the
	original, and you must provide either a pointer to or a copy of the
	original.
\*---------------------------------------------------------------------------*/

#ifndef _POLL_EMUL_H_
#define _POLL_EMUL_H_

#define POLLIN		0x01
#define POLLPRI		0x02
#define POLLOUT		0x04
#define POLLERR		0x08
#define POLLHUP		0x10
#define POLLNVAL	0x20

struct pollfd
{
    int     fd;
    short   events;
    short   revents;
};

#ifdef __cplusplus
extern "C"
{
#endif

#if (__STDC__ > 0) || defined(__cplusplus)
extern int poll (struct pollfd *pArray, unsigned long n_fds, int timeout);
#else
extern int poll();
#endif

#ifdef __cplusplus
}
#endif

#endif /* _POLL_EMUL_H_ */

Index: io.h
===================================================================
RCS file: /usr/cvsroot/asterisk/include/asterisk/io.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- io.h	12 Feb 2003 13:59:15 -0000	1.1.1.1
+++ io.h	26 Oct 2003 18:50:49 -0000	1.2
@@ -14,7 +14,11 @@
 #ifndef _IO_H
 #define _IO_H
 
+#ifdef __APPLE__
+#include <asterisk/poll-compat.h>
+#else
 #include <sys/poll.h>		/* For POLL* constants */
+#endif
 
 #if defined(__cplusplus) || defined(c_plusplus)
 extern "C" {




More information about the svn-commits mailing list