Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
27 lines (22 sloc) 931 Bytes
/* A Linux chmod system call example
* Written by Derek Molloy for the book "Exploring BeagleBone: Tools and
* Techniques for Building with Embedded Linux" by John Wiley & Sons, 2014
* ISBN 9781118935125. Please see the file in the repository root
* directory for copyright and GNU GPLv3 license information. */
using namespace std;
int main(){
//gnu_get_libc_version() returns a string that identifies the
//glibc version available on the system.
cout << "The GNU libc version is " << gnu_get_libc_version() << endl;
cout << "Calling chmod using a system call:" << endl;
int ret = syscall(SYS_chmod, "test.txt", 0777);
cout << "The return value is " << ret << endl;
cout << "Reset the permissions using: chmod 644 test.txt" << endl;
return 0;
You can’t perform that action at this time.