Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 24 Apr 2002 07:14:42 -0700 (PDT)
From:      paleph@pacbell.net
To:        freebsd-hackers@Freebsd.org
Subject:   question on use of kernel memory allocation routines
Message-ID:  <200204241414.g3OEEhB02234@pacbell.net>

next in thread | raw e-mail | index | archive | help
I have a few questions on the kernel memory allocation
available in the FreeBSD kernel and also on the
process of adding new system calls.

I working on adding an audit subsystem to the kernel
to support C2 auditing.

I have two questions:

--------------------------------
1. What is the correct (standard) way to add a new
   system call to the kernel so it will be
   compatible with 4.* and 5.* ?

--------------------------------
2. I notice a large number of memory allocation routines that
   are used through out the kernel. I tried looking at the
   FreeBSD archives and also did a google search to see what
   I could find about their semantics. I did not have very good
   success. The kernel file comments with these interfaces were
   not very helpful in determining when they should be used.

   Is there any documentation on them and when they should be
   used. I could probably get away with just using malloc() and
   free(), however it would be nice to understand what these
   memory allocation functions do in case they are more appropriate.

   ======== taken from vm/vm_kern.c ========

    vm_offset_t
    kmem_alloc_pageable(map, size)
    
    vm_offset_t
    kmem_alloc_nofault(map, size)
    
    vm_offset_t
    kmem_alloc(map, size)
    
    void
    kmem_free(map, addr, size)
    
    vm_map_t
    kmem_suballoc(parent, min, max, size)
    
    vm_offset_t
    kmem_malloc(map, size, flags)
    
    vm_offset_t
    kmem_alloc_wait(map, size)
    
    void
    kmem_free_wakeup(map, addr, size)
    
    void
    kmem_init(start, end)
    	vm_offset_t start, end;

   ======= taken from kern/kern_malloc.c ======
    
    void *
    malloc(size, type, flags)
    
    void
    free(addr, type)

----------------------------------
Any help or pointers to documentation is appreciated

Paul Fronberg
paleph@pacbell.net

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200204241414.g3OEEhB02234>