* Syscall() vs _syscallN() @ 2005-03-29 7:20 Alex LIU 2005-03-29 9:36 ` J. 0 siblings, 1 reply; 6+ messages in thread From: Alex LIU @ 2005-03-29 7:20 UTC (permalink / raw) To: Linux Newbie Hi: With either of syscall() or _syscallN() we can define a system call in the user space program.I think they do the same work.What's the difference between them? Thanks! Alex - To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.linux-learn.org/faqs ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Syscall() vs _syscallN() 2005-03-29 7:20 Syscall() vs _syscallN() Alex LIU @ 2005-03-29 9:36 ` J. 2005-03-30 1:38 ` Alex LIU 0 siblings, 1 reply; 6+ messages in thread From: J. @ 2005-03-29 9:36 UTC (permalink / raw) To: Linux Newbie On Tue, 29 Mar 2005, Alex LIU wrote: > Hi: > > With either of syscall() or _syscallN() we can define a system call in the user space program.I think they do the same work.What's the difference between them? Thanks! > > Alex This is described in the manual page for syscalss ~: man syscalls .... 164 system calls.. depending on your kernel version.. etc.. Roughly speaking, the code belonging to the system call with number __NR_xxx defined in /usr/include/asm/unistd.h can be found in the kernel source in the routine sys_xxx(). ...... etc... ...... J. - To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.linux-learn.org/faqs ^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: Syscall() vs _syscallN() 2005-03-29 9:36 ` J. @ 2005-03-30 1:38 ` Alex LIU 2005-03-30 13:05 ` J. 2005-03-30 16:56 ` Manish Regmi 0 siblings, 2 replies; 6+ messages in thread From: Alex LIU @ 2005-03-30 1:38 UTC (permalink / raw) To: 'Linux Newbie' Sorry for my unclear words... I want to know the DIFFERENCE between SYSCALL() and _SYSCALLN()... _syscallN() ( _syscall0(),_syscall1(),...._syscall6() ) is a macro defined in include/asm/unist.h while syscall() is a glibc function which I'm not sure. Thanks! Alex -----Original Message----- From: linux-newbie-owner@vger.kernel.org [mailto:linux-newbie-owner@vger.kernel.org] On Behalf Of J. Sent: Tuesday, March 29, 2005 5:36 PM To: Linux Newbie Subject: Re: Syscall() vs _syscallN() On Tue, 29 Mar 2005, Alex LIU wrote: > Hi: > > With either of syscall() or _syscallN() we can define a system call in > the user space program.I think they do the same work.What's the > difference between them? Thanks! > > Alex This is described in the manual page for syscalss ~: man syscalls .... 164 system calls.. depending on your kernel version.. etc.. Roughly speaking, the code belonging to the system call with number __NR_xxx defined in /usr/include/asm/unistd.h can be found in the kernel source in the routine sys_xxx(). ...... etc... ...... J. - To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.linux-learn.org/faqs - To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.linux-learn.org/faqs ^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: Syscall() vs _syscallN() 2005-03-30 1:38 ` Alex LIU @ 2005-03-30 13:05 ` J. 2005-04-01 7:35 ` Alex LIU 2005-03-30 16:56 ` Manish Regmi 1 sibling, 1 reply; 6+ messages in thread From: J. @ 2005-03-30 13:05 UTC (permalink / raw) To: 'Linux Newbie' On Wed, 30 Mar 2005, Alex LIU wrote: > Sorry for my unclear words... > I want to know the DIFFERENCE between SYSCALL() and _SYSCALLN()... > _syscallN() ( _syscall0(),_syscall1(),...._syscall6() ) is a macro defined > in include/asm/unist.h while syscall() is a glibc function which I'm not > sure. Thanks! > > Alex One is a macro to call the NN'th systemcall directly by symbolic nr. The other is a function in which you have to specify the call number yourself and then calls the NN'th systemcall or the systemcall if it's not defined in the glbic yet... What distro are u using ? There should be a manual-page that describes the difference quite clearly. Unfortunatly documentation of this level in the system is often omitted among newer distro's. The NN number you are refering to is nothing more than a symbolic Number. ############ man page.... System calls like close() are implemented in the Linux libc. This implementation often involves: calling a macro <---------#!# which eventually calls syscall(). Parameters passed to syscall() are the number of the system call followed by the needed arguments. The actual system call numbers can be found in <linux/unistd.h> while <sys/syscall.h> gets updated with a new libc. If new calls appear that don't have a stub in libc yet, you can use syscall(). As an example, you can close a file using syscall() like this (not advised): #include <syscall.h> extern int syscall(int, ...); int my_close(int filedescriptor) { return syscall(SYS_close, filedescriptor); } Bit more clear or .. ?? J. ~: man -k syscall afs_syscall (2) - unimplemented system calls syscalls (2) - list of all system calls > -----Original Message----- > From: linux-newbie-owner@vger.kernel.org > [mailto:linux-newbie-owner@vger.kernel.org] On Behalf Of J. > Sent: Tuesday, March 29, 2005 5:36 PM > To: Linux Newbie > Subject: Re: Syscall() vs _syscallN() > > > On Tue, 29 Mar 2005, Alex LIU wrote: > > > Hi: > > > > With either of syscall() or _syscallN() we can define a system call in > > the user space program.I think they do the same work.What's the > > difference between them? Thanks! > > > > Alex > > This is described in the manual page for syscalss > > ~: man syscalls > > .... 164 system calls.. depending on your kernel version.. etc.. > > Roughly speaking, the code belonging to the system call with number > __NR_xxx defined in /usr/include/asm/unistd.h can be found in the kernel > source in the routine sys_xxx(). ...... etc... > > ...... > > J. > > - > To unsubscribe from this list: send the line "unsubscribe linux-newbie" in > the body of a message to majordomo@vger.kernel.org More majordomo info at > http://vger.kernel.org/majordomo-info.html > Please read the FAQ at http://www.linux-learn.org/faqs > > - > To unsubscribe from this list: send the line "unsubscribe linux-newbie" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > Please read the FAQ at http://www.linux-learn.org/faqs > Wednesday, March 30 14:51:46 -- http://www.rdrs.net/ - To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.linux-learn.org/faqs ^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: Syscall() vs _syscallN() 2005-03-30 13:05 ` J. @ 2005-04-01 7:35 ` Alex LIU 0 siblings, 0 replies; 6+ messages in thread From: Alex LIU @ 2005-04-01 7:35 UTC (permalink / raw) To: 'Linux Newbie' Thanks a lot for your detailed explanation and now I'm more clear... I'm using RedHat9.0. Alex -----Original Message----- From: linux-newbie-owner@vger.kernel.org [mailto:linux-newbie-owner@vger.kernel.org] On Behalf Of J. Sent: Wednesday, March 30, 2005 9:05 PM To: 'Linux Newbie' Subject: RE: Syscall() vs _syscallN() On Wed, 30 Mar 2005, Alex LIU wrote: > Sorry for my unclear words... > I want to know the DIFFERENCE between SYSCALL() and _SYSCALLN()... > _syscallN() ( _syscall0(),_syscall1(),...._syscall6() ) is a macro > defined in include/asm/unist.h while syscall() is a glibc function > which I'm not sure. Thanks! > > Alex One is a macro to call the NN'th systemcall directly by symbolic nr. The other is a function in which you have to specify the call number yourself and then calls the NN'th systemcall or the systemcall if it's not defined in the glbic yet... What distro are u using ? There should be a manual-page that describes the difference quite clearly. Unfortunatly documentation of this level in the system is often omitted among newer distro's. The NN number you are refering to is nothing more than a symbolic Number. ############ man page.... System calls like close() are implemented in the Linux libc. This implementation often involves: calling a macro <---------#!# which eventually calls syscall(). Parameters passed to syscall() are the number of the system call followed by the needed arguments. The actual system call numbers can be found in <linux/unistd.h> while <sys/syscall.h> gets updated with a new libc. If new calls appear that don't have a stub in libc yet, you can use syscall(). As an example, you can close a file using syscall() like this (not advised): #include <syscall.h> extern int syscall(int, ...); int my_close(int filedescriptor) { return syscall(SYS_close, filedescriptor); } Bit more clear or .. ?? J. ~: man -k syscall afs_syscall (2) - unimplemented system calls syscalls (2) - list of all system calls > -----Original Message----- > From: linux-newbie-owner@vger.kernel.org > [mailto:linux-newbie-owner@vger.kernel.org] On Behalf Of J. > Sent: Tuesday, March 29, 2005 5:36 PM > To: Linux Newbie > Subject: Re: Syscall() vs _syscallN() > > > On Tue, 29 Mar 2005, Alex LIU wrote: > > > Hi: > > > > With either of syscall() or _syscallN() we can define a system call > > in > > the user space program.I think they do the same work.What's the > > difference between them? Thanks! > > > > Alex > > This is described in the manual page for syscalss > > ~: man syscalls > > .... 164 system calls.. depending on your kernel version.. etc.. > > Roughly speaking, the code belonging to the system call with > number __NR_xxx defined in /usr/include/asm/unistd.h can be found in > the kernel source in the routine sys_xxx(). ...... etc... > > ...... > > J. > > - > To unsubscribe from this list: send the line "unsubscribe > linux-newbie" in the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > Please read the FAQ at http://www.linux-learn.org/faqs > > - > To unsubscribe from this list: send the line "unsubscribe > linux-newbie" in the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > Please read the FAQ at http://www.linux-learn.org/faqs > Wednesday, March 30 14:51:46 -- http://www.rdrs.net/ - To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.linux-learn.org/faqs - To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.linux-learn.org/faqs ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Syscall() vs _syscallN() 2005-03-30 1:38 ` Alex LIU 2005-03-30 13:05 ` J. @ 2005-03-30 16:56 ` Manish Regmi 1 sibling, 0 replies; 6+ messages in thread From: Manish Regmi @ 2005-03-30 16:56 UTC (permalink / raw) To: linux-newbie On Wed, 30 Mar 2005 09:38:09 +0800, Alex LIU <alex.liu@st.com> wrote: > Sorry for my unclear words... > I want to know the DIFFERENCE between SYSCALL() and _SYSCALLN()... > _syscallN() ( _syscall0(),_syscall1(),...._syscall6() ) is a macro defined > in include/asm/unist.h while syscall() is a glibc function which I'm not > sure. Thanks! > > Alex > You are absolutely correct. _syscallN is a macro on unistd.h whah takes no of parameters according to the value of N. i.e _syscall0() does not take any parameters whereas _syscall6() takes 6 parameters. _syscallN calls calls the glibc function syscall which is an assembly entry in sysdeps\unix\sysv\linux\i386\syscall.S (glibc source). regards Manish Regmi - To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.linux-learn.org/faqs ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2005-04-01 7:35 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2005-03-29 7:20 Syscall() vs _syscallN() Alex LIU 2005-03-29 9:36 ` J. 2005-03-30 1:38 ` Alex LIU 2005-03-30 13:05 ` J. 2005-04-01 7:35 ` Alex LIU 2005-03-30 16:56 ` Manish Regmi
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox