-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Linux Memory Manager Integrated with the Project
- Loading branch information
1 parent
a3fc648
commit fcfc247
Showing
36 changed files
with
1,397 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
CC=gcc | ||
CFLAGS=-g | ||
TARGET:testapp.exe libmm.a | ||
OUTFILES=testapp.exe libmm.a | ||
EXTERNAL_LIBS= | ||
OBJS=gluethread/glthread.o mm.o | ||
|
||
testapp.exe:testapp.o ${OBJS} | ||
${CC} ${CFLAGS} testapp.o ${OBJS} -o testapp.exe ${EXTERNAL_LIBS} | ||
testapp.o:testapp.c | ||
${CC} ${CFLAGS} -c testapp.c -o testapp.o | ||
gluethread/glthread.o:gluethread/glthread.c | ||
${CC} ${CFLAGS} -c -I gluethread gluethread/glthread.c -o gluethread/glthread.o | ||
mm.o:mm.c | ||
${CC} ${CFLAGS} -c mm.c -o mm.o | ||
libmm.a:${OBJ} | ||
ar rs libmm.a ${OBJ} | ||
clean: | ||
rm -f testapp.o | ||
rm -f ${OUTFILES} | ||
rm -f ${OBJS} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#ifndef __CSS__ | ||
#define __CSS__ | ||
|
||
#define ANSI_COLOR_RED "\x1b[31m" | ||
#define ANSI_COLOR_GREEN "\x1b[32m" | ||
#define ANSI_COLOR_YELLOW "\x1b[33m" | ||
#define ANSI_COLOR_BLUE "\x1b[34m" | ||
#define ANSI_COLOR_MAGENTA "\x1b[35m" | ||
#define ANSI_COLOR_CYAN "\x1b[36m" | ||
#define ANSI_COLOR_RESET "\x1b[0m" | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
/* | ||
* ===================================================================================== | ||
* | ||
* Filename: glthread.h | ||
* | ||
* Description: This file defines the Data structure and APIs for Glue thread | ||
* | ||
* Version: 1.0 | ||
* Created: Monday 12 March 2018 02:01:51 IST | ||
* Revision: 1.0 | ||
* Compiler: gcc | ||
* | ||
* Author: Er. Abhishek Sagar, Networking Developer (AS), sachinites@gmail.com | ||
* Company: Brocade Communications(Jul 2012- Mar 2016), Current : Juniper Networks(Apr 2017 - Present) | ||
* | ||
* This file is part of the SPFComputation distribution (https://github.com/sachinites). | ||
* Copyright (c) 2017 Abhishek Sagar. | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, version 3. | ||
* | ||
* This program is distributed in the hope that it will be useful, but | ||
* WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
* ===================================================================================== | ||
*/ | ||
|
||
#ifndef __GLUETHREAD__ | ||
#define __GLUETHREAD__ | ||
|
||
typedef struct _glthread{ | ||
|
||
struct _glthread *left; | ||
struct _glthread *right; | ||
} glthread_t; | ||
|
||
void | ||
glthread_add_next(glthread_t *base_glthread, glthread_t *new_glthread); | ||
|
||
void | ||
glthread_add_before(glthread_t *base_glthread, glthread_t *new_glthread); | ||
|
||
void | ||
remove_glthread(glthread_t *glthread); | ||
|
||
void | ||
init_glthread(glthread_t *glthread); | ||
|
||
void | ||
glthread_add_last(glthread_t *base_glthread, glthread_t *new_glthread); | ||
|
||
#define IS_GLTHREAD_LIST_EMPTY(glthreadptr) \ | ||
((glthreadptr)->right == 0 && (glthreadptr)->left == 0) | ||
|
||
#define GLTHREAD_TO_STRUCT(fn_name, structure_name, field_name, glthreadptr) \ | ||
static inline structure_name * fn_name(glthread_t *glthreadptr){ \ | ||
return (structure_name *)((char *)(glthreadptr) - (char *)&(((structure_name *)0)->field_name)); \ | ||
} | ||
|
||
/* delete safe loop*/ | ||
/*Normal continue and break can be used with this loop macro*/ | ||
|
||
#define BASE(glthreadptr) ((glthreadptr)->right) | ||
|
||
#define ITERATE_GLTHREAD_BEGIN(glthreadptrstart, glthreadptr) \ | ||
{ \ | ||
glthread_t *_glthread_ptr = NULL; \ | ||
glthreadptr = BASE(glthreadptrstart); \ | ||
for(; glthreadptr!= NULL; glthreadptr = _glthread_ptr){ \ | ||
_glthread_ptr = (glthreadptr)->right; | ||
|
||
#define ITERATE_GLTHREAD_END(glthreadptrstart, glthreadptr) \ | ||
}} | ||
|
||
#define GLTHREAD_GET_USER_DATA_FROM_OFFSET(glthreadptr, offset) \ | ||
(void *)((char *)(glthreadptr) - offset) | ||
|
||
void | ||
delete_glthread_list(glthread_t *base_glthread); | ||
|
||
unsigned int | ||
get_glthread_list_count(glthread_t *base_glthread); | ||
|
||
void | ||
glthread_priority_insert(glthread_t *base_glthread, | ||
glthread_t *glthread, | ||
int (*comp_fn)(void *, void *), | ||
int offset); | ||
|
||
|
||
#if 0 | ||
void * | ||
gl_thread_search(glthread_t *base_glthread, | ||
void *(*thread_to_struct_fn)(glthread_t *), | ||
void *key, | ||
int (*comparison_fn)(void *, void *)); | ||
|
||
#endif | ||
#endif /* __GLUETHREAD__ */ |
Oops, something went wrong.