add js to tree

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@3693 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Brian West committed 2006-12-18 15:53:47 +00:00
1 parent 855c7b9a77
commit fff98f6316
1137 files changed
+386873

No files matched your search

+1
View File
@@ -0,0 +1 @@
Makefile
@@ -0,0 +1,7 @@
/.cvsignore/1.2/Sat May 12 04:47:04 2001//
/Makefile.in/1.15/Sun Apr 25 15:01:01 2004//
/prgcleak.c/1.2/Sun Apr 25 15:01:01 2004//
/prseg.c/3.8/Sun Apr 25 15:01:01 2004//
/prshm.c/3.4/Sun Apr 25 15:01:01 2004//
/prshma.c/3.4/Sun Apr 25 15:01:01 2004//
D
@@ -0,0 +1 @@
mozilla/nsprpub/pr/src/memory
+1
View File
@@ -0,0 +1 @@
:pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot
+69
View File
@@ -0,0 +1,69 @@
#
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is the Netscape Portable Runtime (NSPR).
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1998-2000
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
#! gmake
MOD_DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(MOD_DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/config.mk
CSRCS = prseg.c prshm.c prshma.c
ifdef GC_LEAK_DETECTOR
CSRCS += prgcleak.c
endif
TARGETS = $(OBJS)
INCLUDES = -I$(dist_includedir) -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private
ifdef GC_LEAK_DETECTOR
INCLUDES += -I$(dist_includedir)/.. -I$(dist_includedir)/../boehm
endif
DEFINES += -D_NSPR_BUILD_
include $(topsrcdir)/config/rules.mk
export:: $(TARGETS)
+122
View File
@@ -0,0 +1,122 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is the Netscape Portable Runtime (NSPR).
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1999-2000
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Patrick Beard <beard@netscape.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/*
* prgcleak.c
*/
#ifdef GC_LEAK_DETECTOR
/* for FILE */
#include <stdio.h>
/* NSPR stuff */
#include "generic_threads.h"
#include "primpl.h"
extern FILE *GC_stdout, *GC_stderr;
extern void GC_gcollect(void);
extern void GC_clear_roots(void);
static PRStatus PR_CALLBACK scanner(PRThread* t, void** baseAddr,
PRUword count, void* closure)
{
if (count) {
char* begin = (char*)baseAddr;
char* end = (char*)(baseAddr + count);
GC_mark_range_proc marker = (GC_mark_range_proc) closure;
marker(begin, end);
}
return PR_SUCCESS;
}
static void mark_all_stacks(GC_mark_range_proc marker)
{
PR_ScanStackPointers(&scanner, (void *)marker);
}
#if defined(_PR_PTHREADS)
#define _PR_MD_CURRENT_CPU() 1
#endif
static void locker(void* mutex)
{
if (_PR_MD_CURRENT_CPU())
PR_EnterMonitor(mutex);
}
static void unlocker(void* mutex)
{
if (_PR_MD_CURRENT_CPU())
PR_ExitMonitor(mutex);
}
static void stopper(void* unused)
{
if (_PR_MD_CURRENT_CPU())
PR_SuspendAll();
}
static void starter(void* unused)
{
if (_PR_MD_CURRENT_CPU())
PR_ResumeAll();
}
void _PR_InitGarbageCollector()
{
void* mutex;
/* redirect GC's stderr to catch startup leaks. */
GC_stderr = fopen("StartupLeaks", "w");
mutex = PR_NewMonitor();
PR_ASSERT(mutex != NULL);
GC_generic_init_threads(&mark_all_stacks, mutex,
&locker, &unlocker,
&stopper, &starter);
}
void _PR_ShutdownGarbageCollector()
{
/* do anything you need to shut down the collector. */
}
#endif /* GC_LEAK_DETECTOR */
+93
View File
@@ -0,0 +1,93 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is the Netscape Portable Runtime (NSPR).
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998-2000
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "primpl.h"
#if defined(_PR_PTHREADS)
/*
** The pthreads version doesn't use these functions.
*/
void _PR_InitSegs(void)
{
}
#else /* _PR_PTHREADS */
void _PR_InitSegs(void)
{
_PR_MD_INIT_SEGS();
}
/*
** Allocate a memory segment. The size value is rounded up to the native
** system page size and a page aligned portion of memory is returned.
** This memory is not part of the malloc heap. If "vaddr" is not NULL
** then PR tries to allocate the segment at the desired virtual address.
*/
PRSegment* _PR_NewSegment(PRUint32 size, void *vaddr)
{
PRSegment *seg;
/* calloc the data structure for the segment */
seg = PR_NEWZAP(PRSegment);
if (seg) {
size = ((size + _pr_pageSize - 1) >> _pr_pageShift) << _pr_pageShift;
/*
** Now, allocate the actual segment memory (or map under some OS)
** The OS specific code decides from where or how to allocate memory.
*/
if (_PR_MD_ALLOC_SEGMENT(seg, size, vaddr) != PR_SUCCESS) {
PR_DELETE(seg);
return NULL;
}
}
return seg;
}
/*
** Free a memory segment.
*/
void _PR_DestroySegment(PRSegment *seg)
{
_PR_MD_FREE_SEGMENT(seg);
PR_DELETE(seg);
}
#endif /* _PR_PTHREADS */
+156
View File
@@ -0,0 +1,156 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is the Netscape Portable Runtime (NSPR).
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998-2000
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/*
** prshm.c -- NSPR Named Shared Memory
**
** lth. Jul-1999.
*/
#include <string.h>
#include "primpl.h"
extern PRLogModuleInfo *_pr_shm_lm;
#if defined PR_HAVE_SYSV_NAMED_SHARED_MEMORY
/* SysV implementation is in pr/src/md/unix/uxshm.c */
#elif defined PR_HAVE_POSIX_NAMED_SHARED_MEMORY
/* Posix implementation is in pr/src/md/unix/uxshm.c */
#elif defined PR_HAVE_WIN32_NAMED_SHARED_MEMORY
/* Win32 implementation is in pr/src/md/windows/w32shm.c */
#else
/*
** there is no named_shared_memory
*/
extern PRSharedMemory* _MD_OpenSharedMemory( const char *name, PRSize size, PRIntn flags, PRIntn mode )
{
PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
return NULL;
}
extern void * _MD_AttachSharedMemory( PRSharedMemory *shm, PRIntn flags )
{
PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
return NULL;
}
extern PRStatus _MD_DetachSharedMemory( PRSharedMemory *shm, void *addr )
{
PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
return PR_FAILURE;
}
extern PRStatus _MD_CloseSharedMemory( PRSharedMemory *shm )
{
PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
return PR_FAILURE;
}
extern PRStatus _MD_DeleteSharedMemory( const char *name )
{
PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
return PR_FAILURE;
}
#endif /* HAVE_SYSV_NAMED_SHARED_MEMORY */
/*
** FUNCTION: PR_OpenSharedMemory()
**
*/
PR_IMPLEMENT( PRSharedMemory * )
PR_OpenSharedMemory(
const char *name,
PRSize size,
PRIntn flags,
PRIntn mode
)
{
if (!_pr_initialized) _PR_ImplicitInitialization();
return( _PR_MD_OPEN_SHARED_MEMORY( name, size, flags, mode ));
} /* end PR_OpenSharedMemory() */
/*
** FUNCTION: PR_AttachSharedMemory()
**
*/
PR_IMPLEMENT( void * )
PR_AttachSharedMemory(
PRSharedMemory *shm,
PRIntn flags
)
{
return( _PR_MD_ATTACH_SHARED_MEMORY( shm, flags ));
} /* end PR_AttachSharedMemory() */
/*
** FUNCTION: PR_DetachSharedMemory()
**
*/
PR_IMPLEMENT( PRStatus )
PR_DetachSharedMemory(
PRSharedMemory *shm,
void *addr
)
{
return( _PR_MD_DETACH_SHARED_MEMORY( shm, addr ));
} /* end PR_DetachSharedMemory() */
/*
** FUNCTION: PR_CloseSharedMemory()
**
*/
PR_IMPLEMENT( PRStatus )
PR_CloseSharedMemory(
PRSharedMemory *shm
)
{
return( _PR_MD_CLOSE_SHARED_MEMORY( shm ));
} /* end PR_CloseSharedMemory() */
/*
** FUNCTION: PR_DeleteSharedMemory()
**
*/
PR_EXTERN( PRStatus )
PR_DeleteSharedMemory(
const char *name
)
{
if (!_pr_initialized) _PR_ImplicitInitialization();
return(_PR_MD_DELETE_SHARED_MEMORY( name ));
} /* end PR_DestroySharedMemory() */
/* end prshm.c */
+142
View File
@@ -0,0 +1,142 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is the Netscape Portable Runtime (NSPR).
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998-2000
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/*
** prshma.h -- NSPR Anonymous Shared Memory
**
**
*/
#include "primpl.h"
extern PRLogModuleInfo *_pr_shma_lm;
#if defined(XP_UNIX)
/* defined in pr/src/md/unix/uxshm.c */
#elif defined(WIN32)
/* defined in pr/src/md/windows/w32shm.c */
#else
extern PRFileMap * _PR_MD_OPEN_ANON_FILE_MAP( const char *dirName, PRSize size, PRFileMapProtect prot )
{
PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
return NULL;
}
extern PRStatus _PR_MD_EXPORT_FILE_MAP_AS_STRING(PRFileMap *fm, PRSize bufSize, char *buf)
{
PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
return PR_FAILURE;
}
extern PRFileMap * _PR_MD_IMPORT_FILE_MAP_FROM_STRING(const char *fmstring)
{
PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
return NULL;
}
#endif
/*
** PR_OpenAnonFileMap() -- Creates an anonymous file-mapped shared memory
**
*/
PR_IMPLEMENT(PRFileMap*)
PR_OpenAnonFileMap(
const char *dirName,
PRSize size,
PRFileMapProtect prot
)
{
return(_PR_MD_OPEN_ANON_FILE_MAP( dirName, size, prot ));
} /* end PR_OpenAnonFileMap() */
/*
** PR_ProcessAttrSetInheritableFileMap() -- Prepare FileMap for export
** to my children processes via PR_CreateProcess()
**
**
*/
PR_IMPLEMENT( PRStatus)
PR_ProcessAttrSetInheritableFileMap(
PRProcessAttr *attr,
PRFileMap *fm,
const char *shmname
)
{
PR_SetError( PR_NOT_IMPLEMENTED_ERROR, 0 );
return( PR_FAILURE);
} /* end PR_ProcessAttrSetInheritableFileMap() */
/*
** PR_GetInheritedFileMap() -- Import a PRFileMap previously exported
** by my parent process via PR_CreateProcess()
**
*/
PR_IMPLEMENT( PRFileMap *)
PR_GetInheritedFileMap(
const char *shmname
)
{
PRFileMap *fm = NULL;
PR_SetError( PR_NOT_IMPLEMENTED_ERROR, 0 );
return( fm );
} /* end PR_GetInhteritedFileMap() */
/*
** PR_ExportFileMapAsString() -- Creates a string identifying a PRFileMap
**
*/
PR_IMPLEMENT( PRStatus )
PR_ExportFileMapAsString(
PRFileMap *fm,
PRSize bufSize,
char *buf
)
{
return( _PR_MD_EXPORT_FILE_MAP_AS_STRING( fm, bufSize, buf ));
} /* end PR_ExportFileMapAsString() */
/*
** PR_ImportFileMapFromString() -- Creates a PRFileMap from the identifying string
**
**
*/
PR_IMPLEMENT( PRFileMap * )
PR_ImportFileMapFromString(
const char *fmstring
)
{
return( _PR_MD_IMPORT_FILE_MAP_FROM_STRING(fmstring));
} /* end PR_ImportFileMapFromString() */
/* end prshma.c */