文章浏览阅读822次。一、文件open函数 打开和创建文件的操作#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>#include <stdio.h>int main(){ int fd = 0; // open 函数会返回一个int类型的变量,用fd变量来保存 fd = open("......
2024-01-12 20:27 阅读 阅读全文linux系统库函数(2010-08-12 17:36:04)标签:杂谈第1章 字符测试函数isalnum(测试字符是否为英文字母或数字)isalpha(测试字符是否为英文字母)isascii(测试字符是否为ASCII码字符)isblank(测试字符是否为空格字符)iscntrl(测试字符是否为ASCII码......
2023-10-13 07:51 阅读 阅读全文位置位于 /usr/include/asm/unistd.h 由于我是64位系统,所以有一些额外的东西。我的这个文件为下文#ifndef _ASM_X86_UNISTD_H#define _ASM_X86_UNISTD_H#define __X32_SYSCALL_BIT 0x40000000# ifdef __i386__# in_linux系统调用号...
2023-10-13 08:18 阅读 阅读全文文章浏览阅读1.9k次。stat()/fstat()/lstat()系统调用功能获取文件状态头文件#include #include #include 函数原型int stat(const char *file_name, struct stat *buf);int fstat(int filedes, struct stat *buf)_linux 查看系统调用...
2023-11-13 14:20 阅读 阅读全文一、概念介绍系统调用原子操作的概念:将某一系统调用所需要完成的各个动作作为不可中断的操作一次性加以执行,原子操作是许多操作系统调用得以正确执行的必要条件。原子操作是内核保证了某系统调用中所有步骤会作为......
2023-10-10 01:11 阅读 阅读全文在Linux下面,我们经常调用系统API来完成内核的操作,例如调用open打开一个文件。这个过程看似简单,其实已经包括了一次从用户态到内核态,然后由内核态返回用户态的过程。当然用户不会直接调用系统调用,而是调用glibc中......
2023-10-10 01:15 阅读 阅读全文这篇文章主要介绍了图解Linux系统的系统架构,Linux系统由硬件、内核、系统调用、shell、库函数构成,本文分别对他们做了讲解,需要的朋友可以参考下我以下图为基础,说明Linux的架构(architecture)。(该图参考《Advanced Programming in Unix......
2023-10-13 09:52 阅读 阅读全文一、介绍uname()系统调用返回一系列关于主机系统的标识信息,存储到传入的 struct utsname *buf 中#include <sys/utsname.h>int uname(struct utsname *buf);参数: buf: 传入的struct utsname 的结构体指针 返回值: 成功返回0,错误-1并设置errno #de..._l......
2023-10-10 01:13 阅读 阅读全文《Linux系统调用:用户篇》《Linux系统调用:getpwnam,getpwuid》《Linux系统调用:getgrnam,getgrgid》《Linux系统调用:getpwent,setpwent,endpwent》《Linux系统调用:getgrent,setgrent,endgrent》《Linux系..._linux系统调用:getgrnam,getgrgid...
2023-10-10 02:29 阅读 阅读全文