Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

getpagesize(3) [freebsd man page]

GETPAGESIZE(3)						   BSD Library Functions Manual 					    GETPAGESIZE(3)

getpagesize -- get system page size LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <unistd.h> int getpagesize(void); DESCRIPTION
The getpagesize() function returns the number of bytes in a page. Page granularity is the granularity of many of the memory management calls. The page size is a system page size and may not be the same as the underlying hardware page size. SEE ALSO
pagesize(1), sbrk(2) HISTORY
The getpagesize() function appeared in 4.2BSD. BSD
June 4, 1993 BSD

Check Out this Related Man Page

getpagesize(3C) 					   Standard C Library Functions 					   getpagesize(3C)

getpagesize - get system page size SYNOPSIS
#include <unistd.h> int getpagesize(void); DESCRIPTION
The getpagesize() function returns the number of bytes in a page. Page granularity is the granularity of many of the memory management calls. The page size is a system page size and need not be the same as the underlying hardware page size. The getpagesize() function is equivalent to sysconf(_SC_PAGE_SIZE) and sysconf(_SC_PAGESIZE). See sysconf(3C). RETURN VALUES
The getpagesize() function returns the current page size. ERRORS
No errors are defined. USAGE
The value returned by getpagesize() need not be the minimum value that malloc(3C) can allocate. Moreover, the application cannot assume that an object of this size can be allocated with malloc(). ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ SEE ALSO
pagesize(1), brk(2), getrlimit(2), mmap(2), mprotect(2), munmap(2), malloc(3C), msync(3C), sysconf(3C), attributes(5) SunOS 5.11 27 Jun 2000 getpagesize(3C)
Man Page

14 More Discussions You Might Find Interesting

1. Programming

Memory usage

Hi., I want to know amount of memory used by a process inside the same process. For example, I am writing a program and I want to know the memory used by it from the program. So, I could do some actions (flush some unwanted data structures/ log the memory usage) in my program based on this... (2 Replies)
Discussion started by: nagalenoj
2 Replies

2. Programming

Writing files using O_DIRECT in C

I am trying to write .pgm images using the O_DIRECT flag in open(). I have a char* buffer which has the image data. I know that I have to align the buffers and have done that using posix_memalign() yet only a part of the image gets written. Has someone used O_DIRECT for writing files... (3 Replies)
Discussion started by: anchit87
3 Replies

3. Programming

code to find the top of the stack, not able to figure it out

OFFSET=100; PAGESIZE=4096; int dummy_last; TOPSTACK = (caddr_t)(&dummy_last - OFFSET); TOPSTACK = (caddr_t)((unsigned long)TOPSTACK - ((unsigned long)TOPSTACK % PAGESIZE)); this i a code to find the top of the stack, but not able to figure it out. can... (2 Replies)
Discussion started by: holla4ni
2 Replies

4. Linux

Hugetlbfs and Shared Memory

I am trying to add support for hugepages into an existing application. I have done a lot of online research, but I still have a few questions that I haven't been able get answers to. Hopefully someone here can help! (1) My application requires that all mapped memory segments be shared. The... (2 Replies)
Discussion started by: ms_farenheit
2 Replies

5. Programming

shared memory with linked list??

is this possible, if so plz please share with me.. Correct English please, not Cyber-/Leetspeak (11 Replies)
Discussion started by: vijay_manpage
11 Replies

6. Programming

Loading Data in shared memory (C++)

I'll try to keep this short, but basically I need to figure out a way to load data in shared memory (this file will be called load.c) I will later access the data with a print.c program. The "data" is in the form of a student database that looks like this John Blakeman 111223333 560... (7 Replies)
Discussion started by: Mercfh
7 Replies

7. UNIX for Dummies Questions & Answers


how to use mmap() to map a file to memory space. Do you have any simple program???? Because I have to implement lot of concepts into it. (3 Replies)
Discussion started by: gokult
3 Replies

8. UNIX for Advanced & Expert Users

Regarding MMAP, MLOCK etc..

Hi I want to lock or prevent a portion of memory which I allocated. So I tried MLOCK, MPROTECT and some like this. But all these functions works only on page border. Can I know why that so. Is that possible to protect a portion of memory which is in middle of the page. Example. int A; ... (1 Reply)
Discussion started by: jionnet
1 Replies

9. UNIX for Advanced & Expert Users

How to create SIGSEGV at particular memory?

Hi I want to create a SIGSEGV when program tries to access one particular area in memory. Is this possible. If so whats the command. (4 Replies)
Discussion started by: jionnet
4 Replies

10. Filesystems, Disks and Memory

How does memory mapping work?

I can't find a guide or tutorial that explains it at all. Its there a better search term than Memory Mapping? What's the magic inbetween having the hard drive behave like the memory? (4 Replies)
Discussion started by: theKbStockpiler
4 Replies

11. AIX

mprotect fails with ENOMEM in text segment

Hi guys, I use AIX version 5 on IBM Power 5+ machine. I am currently trying to experiment with sort of self-modifying code, like this: ucontext_t ut; getcontext(&ut); int iar = ut.uc_mcontext.jmp_context.iar; int pageSize = getpagesize(); int rest = iar % pageSize; void *ptr = iar -... (6 Replies)
Discussion started by: manolo123
6 Replies

12. UNIX for Advanced & Expert Users

Linux Page Sharing

Hi, I have following doubts regarding page sharing in Linux (please also correct me if any of my assumptions are wrong), 1. In recent kernel KSM does the page sharing for user process' anonymous pages. 2. What about pages where the program text is stored ? are they shared between two... (4 Replies)
Discussion started by: kumaran_5555
4 Replies

13. Programming

Shared memory between two c program

i have to shared a variable between two different c programs with shared memory and i do these: int main() { int a=5,b=7; int buffer; int *point; int shmid; shmid=shmget(IPC_PRIVATE , sizeof(buffer),0666); point=(int *)shmat(shmid,NULL,0); point=a; ... (21 Replies)
Discussion started by: tafazzi87
21 Replies

14. Programming

Merge two strings by overlapped region

Hello, I am trying to concatenate two strings by merging the overlapped region. E.g. Seq1=ACGTGCCC Seq2=CCCCCGTGTGTGT Seq_merged=ACGTGCCCCCGTGTGTGTFunction strcat(char *dest, char *src) appends the src string to the dest string, ignoring the overlapped parts (prefix of src and suffix of dest).... (30 Replies)
Discussion started by: yifangt
30 Replies