What worked for you? I cloned the code from the link you provided and the syscall code has build errors.
What I did to clear this out was: 1. In "syscall.cpp", I added 'unistd.h' to the includes: Ex: #include <unistd.h> 2. I did the same in callchmod.cpp, 3. Run ./build Apparently there is an issue with unistd.h not being added in certain areas with gcc. Cheers, Jon On Tue, Sep 8, 2020 at 9:05 AM Pavel Yermolenko <py.oh...@sunrise.ch> wrote: > > > On Tuesday, September 8, 2020 at 4:35:43 PM UTC+2, Dennis Bieber wrote: >> >> On Tue, 08 Sep 2020 10:24:06 -0400, in >> gmane.comp.hardware.beagleboard.user >> Dennis Lee Bieber < >> dennis.l.bieber-re5jqeeqqe8avxtiumw...@public.gmane.org> >> wrote: >> >> >> As a follow-up, using YOUR source, I added one line (and changed >> the >> file name) >> >> -=-=-=- >> debian@beaglebone:~/exploring$ cat test.cpp >> #include<gnu/libc-version.h> >> #include<sys/syscall.h> >> #include<sys/types.h> >> #include<iostream> >> #include<signal.h> >> >> #include >> <unistd.h> <=================== >> >> 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; >> >> // process id tid is thread identifier >> // look inside sys/syscall.h for System Call Numbers >> pid_t tid; //pid_t is of type integer >> tid = syscall(SYS_gettid); // make a system call to get the process >> id >> cout << "The Current PID is: " << tid << endl; >> //can also get by calling getpid() function from signal.h >> cout << "The Current PID is: " << getpid() << endl; >> >> // Can get current UserID by using: >> int uid = syscall(SYS_getuid); >> cout << "It is being run by user with ID: " << uid << endl; >> // or getting the value from syscalls.kernelgrok.com >> uid = syscall(0xc7); >> cout << "It is being run by user with ID: " << uid << endl; >> >> return 0; >> } >> debian@beaglebone:~/exploring$ >> -=-=-=- >> debian@beaglebone:~/exploring$ g++ test.cpp -o test >> debian@beaglebone:~/exploring$ ./test >> The GNU libc version is 2.28 >> The Current PID is: 2396 >> The Current PID is: 2396 >> It is being run by user with ID: 1000 >> It is being run by user with ID: 1000 >> debian@beaglebone:~/exploring$ >> >> >> The example program in the second edition has that line. >> >> >> -- >> Dennis L Bieber >> > > Works ! Thanks. > Concerning 2nd ed, as I mentioned, I used link form 2nd edition. > > -- > For more options, visit http://beagleboard.org/discuss > --- > You received this message because you are subscribed to the Google Groups > "BeagleBoard" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to beagleboard+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/beagleboard/d28ca569-05a8-4d40-845b-385f89105ea2o%40googlegroups.com > <https://groups.google.com/d/msgid/beagleboard/d28ca569-05a8-4d40-845b-385f89105ea2o%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- For more options, visit http://beagleboard.org/discuss --- You received this message because you are subscribed to the Google Groups "BeagleBoard" group. To unsubscribe from this group and stop receiving emails from it, send an email to beagleboard+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/beagleboard/CAG99bkpYwhePT95%2BrGREzmPYzNE4xhX81ZVzx0WMcGTPbBqzOA%40mail.gmail.com.