mm.h   mm.h 
/* ==================================================================== /* ====================================================================
* Copyright (c) 1999-2000 Ralf S. Engelschall. All rights reserved. * Copyright (c) 1999-2002 Ralf S. Engelschall. All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions
* are met: * are met:
* *
* 1. Redistributions of source code must retain the above copyright * 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* *
* 2. Redistributions in binary form must reproduce the above copyright * 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in * notice, this list of conditions and the following disclaimer in
skipping to change at line 75 skipping to change at line 75
typedef enum { typedef enum {
MM_LOCK_RD, MM_LOCK_RW MM_LOCK_RD, MM_LOCK_RW
} mm_lock_mode; } mm_lock_mode;
/* /*
** ____ Private Part of the API ___________________________ ** ____ Private Part of the API ___________________________
*/ */
#if defined(MM_PRIVATE) #if defined(MM_PRIVATE)
#include "mm_conf.h" #include "config.h"
#include <errno.h> #include <errno.h>
#include <limits.h> #include <limits.h>
#include <unistd.h> #include <unistd.h>
#include <fcntl.h> #include <fcntl.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/types.h> #include <sys/types.h>
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#ifdef MM_OS_SUNOS #ifdef MM_OS_SUNOS
#include <memory.h> #include <memory.h>
/* SunOS4 lacks prototypes */ /* SunOS4 lacks prototypes */
extern int getpagesize(void); extern int getpagesize(void);
extern int munmap(caddr_t, int); extern int munmap(caddr_t, int);
extern int ftruncate(int, off_t); extern int ftruncate(int, off_t);
extern int flock(int, int); extern int flock(int, int);
extern char *strerror(int); extern char *strerror(int);
#endif #endif
skipping to change at line 270 skipping to change at line 273
/* /*
* Define the structure holding per-process filedescriptors * Define the structure holding per-process filedescriptors
*/ */
#if defined(MM_SEMT_FLOCK) #if defined(MM_SEMT_FLOCK)
struct mem_core_fd { struct mem_core_fd {
pid_t pid; pid_t pid;
int fd; int fd;
}; };
typedef struct mem_core_fd mem_core_fd; typedef struct mem_core_fd mem_core_fd;
#define SIZEOF_mem_core_fd (sizeof(mem_core_fd) #define SIZEOF_mem_core_fd (sizeof(mem_core_fd))
#endif #endif
/* /*
* Define the structure describing a shared memory core area * Define the structure describing a shared memory core area
* (the actual contents depends on the shared memory and * (the actual contents depends on the shared memory and
* semaphore/mutex type and is stripped down to a minimum * semaphore/mutex type and is stripped down to a minimum
* required) * required)
*/ */
struct mem_core { struct mem_core {
size_t mc_size; size_t mc_size;
skipping to change at line 326 skipping to change at line 329
** ____ Public Part (II) of the API _______________________ ** ____ Public Part (II) of the API _______________________
*/ */
#if defined(MM_PRIVATE) #if defined(MM_PRIVATE)
typedef mem_pool MM; typedef mem_pool MM;
#else #else
typedef void MM; typedef void MM;
#endif #endif
/* Global Malloc-Replacement API */ /* Global Malloc-Replacement API */
int MM_create(size_t size, const char *file); int MM_create(size_t, const char *);
int MM_permission(mode_t mode, uid_t owner, gid_t group); int MM_permission(mode_t, uid_t, gid_t);
void MM_destroy(void); void MM_destroy(void);
int MM_lock(mm_lock_mode mode); int MM_lock(mm_lock_mode);
int MM_unlock(void); int MM_unlock(void);
void *MM_malloc(size_t size); void *MM_malloc(size_t);
void *MM_realloc(void *ptr, size_t size); void *MM_realloc(void *, size_t);
void MM_free(void *ptr); void MM_free(void *);
void *MM_calloc(size_t number, size_t size); void *MM_calloc(size_t, size_t);
char *MM_strdup(const char *str); char *MM_strdup(const char *);
size_t MM_sizeof(const void *ptr); size_t MM_sizeof(const void *);
size_t MM_maxsize(void); size_t MM_maxsize(void);
size_t MM_available(void); size_t MM_available(void);
char *MM_error(void); char *MM_error(void);
/* Standard Malloc-Style API */ /* Standard Malloc-Style API */
MM *mm_create(size_t size, const char *file); MM *mm_create(size_t, const char *);
int mm_permission(MM *mm, mode_t mode, uid_t owner, gid_t group); int mm_permission(MM *, mode_t, uid_t, gid_t);
void mm_destroy(MM *mm); void mm_destroy(MM *);
int mm_lock(MM *mm, mm_lock_mode mode); int mm_lock(MM *, mm_lock_mode);
int mm_unlock(MM *mm); int mm_unlock(MM *);
void *mm_malloc(MM *mm, size_t size); void *mm_malloc(MM *, size_t);
void *mm_realloc(MM *mm, void *ptr, size_t size); void *mm_realloc(MM *, void *, size_t);
void mm_free(MM *mm, void *ptr); void mm_free(MM *, void *);
void *mm_calloc(MM *mm, size_t number, size_t size); void *mm_calloc(MM *, size_t, size_t);
char *mm_strdup(MM *mm, const char *str); char *mm_strdup(MM *, const char *);
size_t mm_sizeof(MM *mm, const void *ptr); size_t mm_sizeof(MM *, const void *);
size_t mm_maxsize(void); size_t mm_maxsize(void);
size_t mm_available(MM *mm); size_t mm_available(MM *);
char *mm_error(void); char *mm_error(void);
void mm_display_info(MM *mm); void mm_display_info(MM *);
/* Low-Level Shared Memory API */ /* Low-Level Shared Memory API */
void *mm_core_create(size_t size, const char *file); void *mm_core_create(size_t, const char *);
int mm_core_permission(void *core, mode_t mode, uid_t owner, gid_t grou int mm_core_permission(void *, mode_t, uid_t, gid_t);
p); void mm_core_delete(void *);
void mm_core_delete(void *core); size_t mm_core_size(const void *);
size_t mm_core_size(const void *core); int mm_core_lock(const void *, mm_lock_mode);
int mm_core_lock(const void *core, mm_lock_mode mode); int mm_core_unlock(const void *);
int mm_core_unlock(const void *core);
size_t mm_core_maxsegsize(void); size_t mm_core_maxsegsize(void);
size_t mm_core_align2page(size_t size); size_t mm_core_align2page(size_t);
size_t mm_core_align2word(size_t size); size_t mm_core_align2word(size_t);
/* Internal Library API */ /* Internal Library API */
void mm_lib_error_set(unsigned int, const char *str); void mm_lib_error_set(unsigned int, const char *);
char *mm_lib_error_get(void); char *mm_lib_error_get(void);
int mm_lib_version(void); int mm_lib_version(void);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif /* _MM_H_ */ #endif /* _MM_H_ */
 End of changes. 13 change blocks. 
35 lines changed or deleted 37 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/