Commit 09cee18a authored by Pavel Emelyanov's avatar Pavel Emelyanov

util: Move shmalloc to rst-malloc

Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent 6319ca2b
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
#include "files.h" #include "files.h"
#include "image.h" #include "image.h"
#include "list.h" #include "list.h"
#include "util.h" #include "rst-malloc.h"
#include "fs-magic.h" #include "fs-magic.h"
#include "asm/atomic.h" #include "asm/atomic.h"
#include "namespaces.h" #include "namespaces.h"
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
#include "file-lock.h" #include "file-lock.h"
#include "image.h" #include "image.h"
#include "list.h" #include "list.h"
#include "util.h" #include "rst-malloc.h"
#include "util-pie.h" #include "util-pie.h"
#include "lock.h" #include "lock.h"
#include "sockets.h" #include "sockets.h"
......
...@@ -71,4 +71,7 @@ extern void rst_mem_align(int type); ...@@ -71,4 +71,7 @@ extern void rst_mem_align(int type);
extern unsigned long rst_mem_lock(void); extern unsigned long rst_mem_lock(void);
extern int rst_mem_remap(void *to); extern int rst_mem_remap(void *to);
extern void *shmalloc(size_t bytes);
extern void shfree_last(void *ptr);
#endif /* __CR_RST_MALLOC__H__ */ #endif /* __CR_RST_MALLOC__H__ */
...@@ -169,9 +169,6 @@ extern int is_anon_link_type(char *link, char *type); ...@@ -169,9 +169,6 @@ extern int is_anon_link_type(char *link, char *type);
((c) >= 'a' && (c) <= 'f') || \ ((c) >= 'a' && (c) <= 'f') || \
((c) >= 'A' && (c) <= 'F')) ((c) >= 'A' && (c) <= 'F'))
extern void *shmalloc(size_t bytes);
extern void shfree_last(void *ptr);
#define CRS_CAN_FAIL 0x1 /* cmd can validly exit with non zero code */ #define CRS_CAN_FAIL 0x1 /* cmd can validly exit with non zero code */
extern int cr_system(int in, int out, int err, char *cmd, char *const argv[], unsigned flags); extern int cr_system(int in, int out, int err, char *cmd, char *const argv[], unsigned flags);
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
#include <sched.h> #include <sched.h>
#include <sys/capability.h> #include <sys/capability.h>
#include "util.h" #include "rst-malloc.h"
#include "imgset.h" #include "imgset.h"
#include "uts_ns.h" #include "uts_ns.h"
#include "ipc_ns.h" #include "ipc_ns.h"
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
#include "compiler.h" #include "compiler.h"
#include "asm/types.h" #include "asm/types.h"
#include "log.h" #include "log.h"
#include "util.h" #include "rst-malloc.h"
#include "string.h" #include "string.h"
#include "sockets.h" #include "sockets.h"
#include "cr_options.h" #include "cr_options.h"
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
#include "cr_options.h" #include "cr_options.h"
#include "pstree.h" #include "pstree.h"
#include "util.h" #include "rst-malloc.h"
#include "lock.h" #include "lock.h"
#include "namespaces.h" #include "namespaces.h"
#include "files.h" #include "files.h"
......
...@@ -231,3 +231,16 @@ int rst_mem_remap(void *to) ...@@ -231,3 +231,16 @@ int rst_mem_remap(void *to)
return ret; return ret;
} }
void *shmalloc(size_t bytes)
{
rst_mem_align(RM_SHARED);
return rst_mem_alloc(bytes, RM_SHARED);
}
/* Only last chunk can be released */
void shfree_last(void *ptr)
{
rst_mem_free_last(RM_SHARED);
}
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
#include "files.h" #include "files.h"
#include "image.h" #include "image.h"
#include "log.h" #include "log.h"
#include "util.h" #include "rst-malloc.h"
#include "sockets.h" #include "sockets.h"
#include "sk-inet.h" #include "sk-inet.h"
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
#include <fcntl.h> #include <fcntl.h>
#include <sys/time.h> #include <sys/time.h>
#include "asm/atomic.h" #include "asm/atomic.h"
#include "rst-malloc.h"
#include "protobuf.h" #include "protobuf.h"
#include "stats.h" #include "stats.h"
#include "image.h" #include "image.h"
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
#include "imgset.h" #include "imgset.h"
#include "servicefd.h" #include "servicefd.h"
#include "image.h" #include "image.h"
#include "util.h" #include "rst-malloc.h"
#include "log.h" #include "log.h"
#include "list.h" #include "list.h"
#include "util-pie.h" #include "util-pie.h"
......
...@@ -558,18 +558,6 @@ int is_anon_link_type(char *link, char *type) ...@@ -558,18 +558,6 @@ int is_anon_link_type(char *link, char *type)
return !strcmp(link, aux); return !strcmp(link, aux);
} }
void *shmalloc(size_t bytes)
{
rst_mem_align(RM_SHARED);
return rst_mem_alloc(bytes, RM_SHARED);
}
/* Only last chunk can be released */
void shfree_last(void *ptr)
{
rst_mem_free_last(RM_SHARED);
}
#define DUP_SAFE(fd, out) \ #define DUP_SAFE(fd, out) \
({ \ ({ \
int ret__; \ int ret__; \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment