root/Whitix/trunk/kernel/gc.c

Revision 1976, 1.7 KB (checked in by mwhitworth, 3 years ago)

Add stub for kernel garbage collection of userspace apps. To come soon.

Line 
1/*  This file is part of Whitix.
2 *
3 *  Whitix is free software; you can redistribute it and/or modify
4 *  it under the terms of the GNU General Public License as published by
5 *  the Free Software Foundation; either version 2 of the License, or
6 *  (at your option) any later version.
7 *
8 *  Whitix is distributed in the hope that it will be useful,
9 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
10 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 *  GNU General Public License for more details.
12 *
13 *  You should have received a copy of the GNU General Public License
14 *  along with Whitix; if not, write to the Free Software
15 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
16 *
17 */
18
19#include <error.h> 
20
21/* System calls */
22
23/* SysGcCreate
24
25 * Create a GC collection thread, using an already created thread to call gcFree
26 * with. This garbage collection thread calls GcCollect when it thinks a collection
27 * should happen (time or memory pressure), sets a GC flag on the process (which means that no other threads)
28 * will be scheduled, and waits on a waitqueue while no other thread from the same
29 * process is being scheduled.
30 *
31 * It then runs the kernel garbage collector (mark and sweep),
32 * which then returns to userspace
33 * to call gcFree, and then returns, making sure threads from the same process
34 * can schedule again.
35 *
36 * Different algorithms can be selected via SysGcControl
37 */
38
39int SysGcCreate(int threadId, void (*gcFree)(void* freeList, int items), int type)
40{
41        return -ENOTIMPL;
42}
43
44int SysGcControl(int command, void* type)
45{
46        return -ENOTIMPL;
47}
48
49int SysGcCollect()
50{
51        return -ENOTIMPL;
52}
53
54int SysGcClose()
55{
56        return 0;
57}
58
59int GcInit()
60{
61        return 0;
62}
Note: See TracBrowser for help on using the browser.