glibc源码分析之chmod系列函数

本文介绍了glibc中用于修改文件权限的chmod和fchmod函数的实现方式。这两个函数通过系统调用接口来改变文件的访问权限,并且是通过特定的模板文件生成的封装函数。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

glibc中关于chmod系列的函数有chmod,fchmod。它们都是用于改变文件的属性。
在glibc中chmod和fchmod两个函数都是使用脚本生成的系统调用的封装函数。
它们生成的.S文件内容分别为:

#define SYSCALL_NAME chmod
#define SYSCALL_NARGS 2
#define SYSCALL_SYMBOL __chmod
#define SYSCALL_CANCELLABLE 0
#define SYSCALL_NOERRNO 0
#define SYSCALL_ERRVAL 0
#include <syscall-template.S>
weak_alias (__chmod, chmod)
hidden_weak (chmod)
#define SYSCALL_NAME fchmod
#define SYSCALL_NARGS 2
#define SYSCALL_SYMBOL __fchmod
#define SYSCALL_CANCELLABLE 0
#define SYSCALL_NOERRNO 0
#define SYSCALL_ERRVAL 0
#include <syscall-template.S>
weak_alias (__fchmod, fchmod)
hidden_weak (fchmod)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值