From owner-freebsd-hackers Wed Apr 24 7:44:13 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from pacbell.net (adsl-63-199-179-203.dsl.snfc21.pacbell.net [63.199.179.203]) by hub.freebsd.org (Postfix) with ESMTP id 6A66F37B41E for ; Wed, 24 Apr 2002 07:44:00 -0700 (PDT) Received: (from paleph@localhost) by pacbell.net (8.11.0/8.9.3) id g3OEEhB02234 for freebsd-hackers@Freebsd.org; Wed, 24 Apr 2002 07:14:43 -0700 From: paleph@pacbell.net Message-Id: <200204241414.g3OEEhB02234@pacbell.net> Subject: question on use of kernel memory allocation routines To: freebsd-hackers@Freebsd.org Date: Wed, 24 Apr 2002 07:14:42 -0700 (PDT) X-Mailer: ELM [version 2.5 PL3] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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