LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 04-04-2018, 06:50 AM   #1
Smurfbot
LQ Newbie
 
Registered: Apr 2018
Posts: 3

Rep: Reputation: Disabled
Difference between SYS_getdents and SYS_getdents64


Hi, I am trying to make some modifications to some source code for a program which makes a call to getdents system call via the syscall function. The code only supports a call via using the constant SYS_getdents which doesn't seem to be present on a version of armbian I am using. I did a grep for this under ubuntu and it seems that the exact value is defined differently in different header files(__NR_getdents). What is the correct way to include support for 64 and 32 bit platforms? I would like to have the code so it correctly compiles on both armbian 64 bit and regular x86 variants of linux

Thanks in advance,
 
Old 04-04-2018, 07:47 AM   #2
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,148

Rep: Reputation: 855Reputation: 855Reputation: 855Reputation: 855Reputation: 855Reputation: 855Reputation: 855
You just need to find what arch you are using, from cli
Code:
uname -m
Then use the appropriate call.
 
Old 04-04-2018, 02:02 PM   #3
Smurfbot
LQ Newbie
 
Registered: Apr 2018
Posts: 3

Original Poster
Rep: Reputation: Disabled
Thanks for the reply. I guess a followup question would be how does one determine which define to use in cases when they are both defined? For example the x86 headers seem to have them defined to different constants and thus different functions in the kernel syscall table. I am actually a bit confused by why arm has only one of these defined yet on 64 bit x86 they are both defined?

Thanks.
 
Old 04-04-2018, 02:45 PM   #4
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,148

Rep: Reputation: 855Reputation: 855Reputation: 855Reputation: 855Reputation: 855Reputation: 855Reputation: 855
The first place to start is the system manpages.
You then need to decide whether you need the extra info that the getdents64 call supplies, but see this in the manpage:
'These are not the interfaces you are interested in. Look at readdir(3) for the POSIX-conforming C library interface. This page documents the bare kernel system call interfaces.'

Last edited by Keith Hedger; 04-04-2018 at 05:43 PM. Reason: removed accidental icon in title
 
1 members found this post helpful.
Old 04-05-2018, 10:08 AM   #5
Smurfbot
LQ Newbie
 
Registered: Apr 2018
Posts: 3

Original Poster
Rep: Reputation: Disabled
Is there some reason then that armbian (64 bit) lacks the SYS_getdents define but has the SYS_getdents64 variant?
 
Old 04-05-2018, 11:49 AM   #6
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,148

Rep: Reputation: 855Reputation: 855Reputation: 855Reputation: 855Reputation: 855Reputation: 855Reputation: 855
Quote:
Originally Posted by Smurfbot View Post
Is there some reason then that armbian (64 bit) lacks the SYS_getdents define but has the SYS_getdents64 variant?
Ask me one on sport!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Making a Difference; Selling a Difference LXer Syndicated Linux News 0 09-23-2010 05:00 AM
shell script to find the difference betwwn two file and place the difference to other kittunot4u Linux - General 3 07-19-2010 04:26 AM
Difference? meo_beo Linux - Newbie 4 11-21-2008 07:07 AM
What's the difference between dominionlife Linux - Newbie 5 10-18-2004 08:26 PM
is there any difference/use of su - twice? darkleaf Linux - Software 2 10-12-2004 04:54 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 10:50 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration