Changeset b678410 in mainline for uspace/app/tester/mm/malloc2.c
- Timestamp:
- 2011-04-27T20:01:13Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a6dffb8
- Parents:
- 628d548 (diff), 933cadf (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/tester/mm/malloc2.c
r628d548 rb678410 1 1 /* 2 * Copyright (c) 2007 Jan Hudecek 3 * Copyright (c) 2008 Martin Decky 2 * Copyright (c) 2011 Jakub Jermar 4 3 * All rights reserved. 5 4 * … … 28 27 */ 29 28 30 /** @addtogroup genericproc 31 * @{ 32 */ 33 /** @file tasklet.h 34 * @brief Tasklets declarations 35 */ 29 #include <stdio.h> 30 #include <unistd.h> 31 #include <stdlib.h> 32 #include <malloc.h> 33 #include "../tester.h" 36 34 37 #ifndef KERN_TASKLET_H_ 38 #define KERN_TASKLET_H_ 35 const char *test_malloc2(void) 36 { 37 int cnt = 0; 38 char *p; 39 39 40 #include <adt/list.h> 40 TPRINTF("Provoking the kernel into overcommitting memory to us...\n"); 41 while ((p = malloc(1024 * 1024))) { 42 TPRINTF("%dM ", ++cnt); 43 *p = 'A'; 44 } 45 TPRINTF("\nWas refused more memory as expected.\n"); 41 46 42 /** Tasklet callback type */ 43 typedef void (* tasklet_callback_t)(void *arg); 44 45 /** Tasklet state */ 46 typedef enum { 47 NotActive, 48 Scheduled, 49 InProgress, 50 Disabled 51 } tasklet_state_t; 52 53 /** Structure describing a tasklet */ 54 typedef struct tasklet_descriptor { 55 link_t link; 56 57 /** Callback to call */ 58 tasklet_callback_t callback; 59 60 /** Argument passed to the callback */ 61 void *arg; 62 63 /** State of the tasklet */ 64 tasklet_state_t state; 65 } tasklet_descriptor_t; 66 67 68 extern void tasklet_init(void); 69 70 #endif 71 72 /** @} 73 */ 47 return NULL; 48 }
Note:
See TracChangeset
for help on using the changeset viewer.