Date: Fri, 13 Oct 2000 13:04:39 +0900 (KST) From: <smcho@tsp.korea.ac.kr> To: FreeBSD-gnats-submit@freebsd.org Cc: freebsd-bugs@freebsd.org Subject: kern/21947: smget(2) assumes the size in pages Message-ID: <Pine.BSO.4.10.10010131255420.20037-100000@tsp.korea.ac.kr>
next in thread | raw e-mail | index | archive | help
>Number: 21947 >Category: kern >Synopsis: shmget(2) takes 'size' in pages as opposed to bytes. >Confidential: no >Severity: serious >Priority: high >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Oct 12 21:10:01 PDT 2000 >Closed-Date: >Last-Modified: >Originator: smcho@tsp.korea.ac.kr >Release: FreeBSD 3.5.1-RELEASE i386 >Organization: >Environment: All branches supporting SYSV shared memory. >Description: shmget(2) is described to take the second argument as 'the desired size of the new segment in bytes', but in reality, it takes the second argument as the size in _pages_. >How-To-Repeat: Read the source: sys/kern/sysv_shm.c lib/libc/gen/shmget.c >Fix: Attached is a patch to lib/libc/gen/shmget.c *** /usr/src/lib/libc/gen/shmget.c.orig Thu Oct 12 20:43:52 2000 --- /usr/src/lib/libc/gen/shmget.c Thu Oct 12 20:47:36 2000 *************** *** 5,10 **** --- 5,11 ---- #include <sys/types.h> #include <sys/ipc.h> #include <sys/shm.h> + #include <sys/param.h> #if __STDC__ int shmget(key_t key, int size, int shmflg) *************** *** 15,19 **** int shmflg; #endif { ! return (shmsys(3, key, size, shmflg)); } --- 16,25 ---- int shmflg; #endif { ! int page = size / PAGE_SIZE; ! ! if (size % PAGE_SIZE > 0) ! page++; ! ! return (shmsys(3, key, page, shmflg)); } >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSO.4.10.10010131255420.20037-100000>