Changeset b678410 in mainline for uspace/app/tester/mm/malloc2.c


Ignore:
Timestamp:
2011-04-27T20:01:13Z (14 years ago)
Author:
Jiri Svoboda <jiri@…>
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.
Message:

Merge mainline changes.

File:
1 moved

Legend:

Unmodified
Added
Removed
  • uspace/app/tester/mm/malloc2.c

    r628d548 rb678410  
    11/*
    2  * Copyright (c) 2007 Jan Hudecek
    3  * Copyright (c) 2008 Martin Decky
     2 * Copyright (c) 2011 Jakub Jermar
    43 * All rights reserved.
    54 *
     
    2827 */
    2928
    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"
    3634
    37 #ifndef KERN_TASKLET_H_
    38 #define KERN_TASKLET_H_
     35const char *test_malloc2(void)
     36{
     37        int cnt = 0;
     38        char *p;
    3939
    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");
    4146
    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.