⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 getpagesize.c

📁 早期freebsd实现
💻 C
字号:
/* Emulation of getpagesize() for systems that need it.   Copyright (C) 1991 Free Software Foundation, Inc.This file is part of the libiberty library.Libiberty is free software; you can redistribute it and/ormodify it under the terms of the GNU Library General PublicLicense as published by the Free Software Foundation; eitherversion 2 of the License, or (at your option) any later version.Libiberty is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNULibrary General Public License for more details.You should have received a copy of the GNU Library General PublicLicense along with libiberty; see the file COPYING.LIB.  Ifnot, write to the Free Software Foundation, Inc., 675 Mass Ave,Cambridge, MA 02139, USA.  *//*NAME	getpagesize -- return the number of bytes in page of memorySYNOPSIS	int getpagesize (void)DESCRIPTION	Returns the number of bytes in a page of memory.  This is the	granularity of many of the system memory management routines.	No guarantee is made as to whether or not it is the same as the	basic memory management hardware page size.BUGS	Is intended as a reasonable replacement for systems where this	is not provided as a system call.  The value of 4096 may or may	not be correct for the systems where it is returned as the default	value.*/#include <sys/types.h>#include <sys/param.h>#ifdef HAVE_SYSCONF#include <unistd.h>#define GNU_OUR_PAGESIZE sysconf(_SC_PAGESIZE)#else#ifdef	PAGESIZE#define	GNU_OUR_PAGESIZE PAGESIZE#else	/* no PAGESIZE */#ifdef	EXEC_PAGESIZE#define	GNU_OUR_PAGESIZE EXEC_PAGESIZE#else	/* no EXEC_PAGESIZE */#ifdef	NBPG#define	GNU_OUR_PAGESIZE (NBPG * CLSIZE)#ifndef	CLSIZE#define	CLSIZE 1#endif	/* CLSIZE */#else	/* no NBPG */#ifdef	NBPC#define	GNU_OUR_PAGESIZE NBPC#else	/* no NBPC */#define	GNU_OUR_PAGESIZE 4096	/* Just punt and use reasonable value */#endif /* NBPC */#endif /* NBPG */#endif /* EXEC_PAGESIZE */#endif /* PAGESIZE */#endif /* HAVE_SYSCONF */intgetpagesize (){  return (GNU_OUR_PAGESIZE);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -