All of lore.kernel.org
 help / color / mirror / Atom feed
* system call
@ 2016-04-07  6:23 Nitin Varyani
  2016-04-07  6:30 ` Giedrius Statkevičius
                   ` (2 more replies)
  0 siblings, 3 replies; 17+ messages in thread
From: Nitin Varyani @ 2016-04-07  6:23 UTC (permalink / raw)
  To: kernelnewbies

Hi,
      I want to implement a system call as explained in Linux kernel
development by Robert Love.

He does three things
 adding entry to entry.S
adding entry to asm/unistd.h
and adding the system call code to sched.c


and then make + make install

I do not want to implement for all architectures but only for my PC which
is 64 bit. I am not able to locate files entry. S and unistd.h which he is
telling in his tutorial.
Please help me out to figure out the exact steps. Please also mention the
linux kernel version I should use.

Nitin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20160407/c7282824/attachment.html 

^ permalink raw reply	[flat|nested] 17+ messages in thread

* system call
  2016-04-07  6:23 system call Nitin Varyani
@ 2016-04-07  6:30 ` Giedrius Statkevičius
  2016-04-07  6:45 ` Sharath Chandra
  2016-04-07  7:38 ` Pranay Srivastava
  2 siblings, 0 replies; 17+ messages in thread
From: Giedrius Statkevičius @ 2016-04-07  6:30 UTC (permalink / raw)
  To: kernelnewbies

On Thu, Apr 7, 2016 at 9:23 AM, Nitin Varyani <varyani.nitin1@gmail.com>
wrote:

> Hi,
>       I want to implement a system call as explained in Linux kernel
> development by Robert Love.
>
> He does three things
>  adding entry to entry.S
> adding entry to asm/unistd.h
> and adding the system call code to sched.c
>
>
> and then make + make install
>
> I do not want to implement for all architectures but only for my PC which
> is 64 bit. I am not able to locate files entry. S and unistd.h which he is
> telling in his tutorial.
> Please help me out to figure out the exact steps. Please also mention the
> linux kernel version I should use.
>

Not sure if that is still applicable but you could refer to this recent
example: https://lkml.org/lkml/2016/3/31/1109
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20160407/7f2c2a76/attachment.html 

^ permalink raw reply	[flat|nested] 17+ messages in thread

* system call
  2016-04-07  6:23 system call Nitin Varyani
  2016-04-07  6:30 ` Giedrius Statkevičius
@ 2016-04-07  6:45 ` Sharath Chandra
  2016-04-07  7:38 ` Pranay Srivastava
  2 siblings, 0 replies; 17+ messages in thread
From: Sharath Chandra @ 2016-04-07  6:45 UTC (permalink / raw)
  To: kernelnewbies

Hi Nitin,

Take a look at this link, it'll give you a start:

http://blog.techveda.org/adding-system-calls-linux-kernel-3-5-x/

On Wed, Apr 6, 2016 at 11:23 PM, Nitin Varyani <varyani.nitin1@gmail.com>
wrote:

> Hi,
>       I want to implement a system call as explained in Linux kernel
> development by Robert Love.
>
> He does three things
>  adding entry to entry.S
> adding entry to asm/unistd.h
> and adding the system call code to sched.c
>
>
> and then make + make install
>
> I do not want to implement for all architectures but only for my PC which
> is 64 bit. I am not able to locate files entry. S and unistd.h which he is
> telling in his tutorial.
> Please help me out to figure out the exact steps. Please also mention the
> linux kernel version I should use.
>
> Nitin
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20160406/9e2f1f5a/attachment.html 

^ permalink raw reply	[flat|nested] 17+ messages in thread

* system call
  2016-04-07  6:23 system call Nitin Varyani
  2016-04-07  6:30 ` Giedrius Statkevičius
  2016-04-07  6:45 ` Sharath Chandra
@ 2016-04-07  7:38 ` Pranay Srivastava
  2016-04-09 11:33   ` Nitin Varyani
  2 siblings, 1 reply; 17+ messages in thread
From: Pranay Srivastava @ 2016-04-07  7:38 UTC (permalink / raw)
  To: kernelnewbies

Nitin


On Thu, Apr 7, 2016 at 11:53 AM, Nitin Varyani <varyani.nitin1@gmail.com> wrote:
>
> Hi,
>       I want to implement a system call as explained in Linux kernel development by Robert Love.
>
> He does three things
>  adding entry to entry.S
> adding entry to asm/unistd.h
> and adding the system call code to sched.c
>
>
> and then make + make install
>
> I do not want to implement for all architectures but only for my PC which is 64 bit. I am not able to locate files entry. S and unistd.h which he is telling in his tutorial.
> Please help me out to figure out the exact steps. Please also mention the linux kernel version I should use.
>

Please refer this. I wrote this quite a while back but should be good to go.

http://codewithkernel.blogspot.my/2014/06/adding-new-system-call-in-linux-x86-and.html

> Nitin
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>



-- 
        ---P.K.S

^ permalink raw reply	[flat|nested] 17+ messages in thread

* system call
  2016-04-07  7:38 ` Pranay Srivastava
@ 2016-04-09 11:33   ` Nitin Varyani
  2016-04-09 14:09     ` Pranay Srivastava
  0 siblings, 1 reply; 17+ messages in thread
From: Nitin Varyani @ 2016-04-09 11:33 UTC (permalink / raw)
  To: kernelnewbies

Neither of the solution is working.
@ Pranay: kernel is not booting after making the changes you have mentioned.
somethings like
"dropping to shell
initramfs:"
is displayed on booting.


On Thu, Apr 7, 2016 at 1:08 PM, Pranay Srivastava <pranjas@gmail.com> wrote:

> Nitin
>
>
> On Thu, Apr 7, 2016 at 11:53 AM, Nitin Varyani <varyani.nitin1@gmail.com>
> wrote:
> >
> > Hi,
> >       I want to implement a system call as explained in Linux kernel
> development by Robert Love.
> >
> > He does three things
> >  adding entry to entry.S
> > adding entry to asm/unistd.h
> > and adding the system call code to sched.c
> >
> >
> > and then make + make install
> >
> > I do not want to implement for all architectures but only for my PC
> which is 64 bit. I am not able to locate files entry. S and unistd.h which
> he is telling in his tutorial.
> > Please help me out to figure out the exact steps. Please also mention
> the linux kernel version I should use.
> >
>
> Please refer this. I wrote this quite a while back but should be good to
> go.
>
>
> http://codewithkernel.blogspot.my/2014/06/adding-new-system-call-in-linux-x86-and.html
>
> > Nitin
> >
> > _______________________________________________
> > Kernelnewbies mailing list
> > Kernelnewbies at kernelnewbies.org
> > http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
> >
>
>
>
> --
>         ---P.K.S
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20160409/861f725b/attachment.html 

^ permalink raw reply	[flat|nested] 17+ messages in thread

* system call
  2016-04-09 11:33   ` Nitin Varyani
@ 2016-04-09 14:09     ` Pranay Srivastava
  2016-04-09 14:21       ` Nitin Varyani
  0 siblings, 1 reply; 17+ messages in thread
From: Pranay Srivastava @ 2016-04-09 14:09 UTC (permalink / raw)
  To: kernelnewbies

Hi Nitin

On Sat, Apr 9, 2016 at 5:03 PM, Nitin Varyani <varyani.nitin1@gmail.com> wrote:
> Neither of the solution is working.
> @ Pranay: kernel is not booting after making the changes you have mentioned.
> somethings like
> "dropping to shell
> initramfs:"
> is displayed on booting.

I don't think this is related to the changes you made. I would advise
you just build the sources for your
distro and try to get to boot the kernel you compiled. Perhaps some
steps you might have missed specific to your
distro?

>
>
> On Thu, Apr 7, 2016 at 1:08 PM, Pranay Srivastava <pranjas@gmail.com> wrote:
>>
>> Nitin
>>
>>
>> On Thu, Apr 7, 2016 at 11:53 AM, Nitin Varyani <varyani.nitin1@gmail.com>
>> wrote:
>> >
>> > Hi,
>> >       I want to implement a system call as explained in Linux kernel
>> > development by Robert Love.
>> >
>> > He does three things
>> >  adding entry to entry.S
>> > adding entry to asm/unistd.h
>> > and adding the system call code to sched.c
>> >
>> >
>> > and then make + make install
>> >
>> > I do not want to implement for all architectures but only for my PC
>> > which is 64 bit. I am not able to locate files entry. S and unistd.h which
>> > he is telling in his tutorial.
>> > Please help me out to figure out the exact steps. Please also mention
>> > the linux kernel version I should use.
>> >
>>
>> Please refer this. I wrote this quite a while back but should be good to
>> go.
>>
>>
>> http://codewithkernel.blogspot.my/2014/06/adding-new-system-call-in-linux-x86-and.html
>>
>> > Nitin
>> >
>> > _______________________________________________
>> > Kernelnewbies mailing list
>> > Kernelnewbies at kernelnewbies.org
>> > http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>> >
>>
>>
>>
>> --
>>         ---P.K.S
>
>



-- 
        ---P.K.S

^ permalink raw reply	[flat|nested] 17+ messages in thread

* system call
  2016-04-09 14:09     ` Pranay Srivastava
@ 2016-04-09 14:21       ` Nitin Varyani
  2016-04-09 14:34         ` Pranay Srivastava
  0 siblings, 1 reply; 17+ messages in thread
From: Nitin Varyani @ 2016-04-09 14:21 UTC (permalink / raw)
  To: kernelnewbies

I have a 64 bit machine

I am changing linux 3.5.4 source tree.

I modified syscall_64.tbl
I had put your code in linux_3.5.4/arch/x86/pks_first/pks_first_call.c

Then, I created pks_first/Makefile

Modified the arch/x86/Kbuild

Modified include/linux/syscalls.h


I ran "make menuconfig" and then simply exit.

Then I ran

"make"

I saw that pks_first_call.o was created

I then ran

"make modules_install"
"make install"

After then I restarted my system and booted linux 3.5.4. But it was stuck
half way.

On Sat, Apr 9, 2016 at 7:39 PM, Pranay Srivastava <pranjas@gmail.com> wrote:

> Hi Nitin
>
> On Sat, Apr 9, 2016 at 5:03 PM, Nitin Varyani <varyani.nitin1@gmail.com>
> wrote:
> > Neither of the solution is working.
> > @ Pranay: kernel is not booting after making the changes you have
> mentioned.
> > somethings like
> > "dropping to shell
> > initramfs:"
> > is displayed on booting.
>
> I don't think this is related to the changes you made. I would advise
> you just build the sources for your
> distro and try to get to boot the kernel you compiled. Perhaps some
> steps you might have missed specific to your
> distro?
>
> >
> >
> > On Thu, Apr 7, 2016 at 1:08 PM, Pranay Srivastava <pranjas@gmail.com>
> wrote:
> >>
> >> Nitin
> >>
> >>
> >> On Thu, Apr 7, 2016 at 11:53 AM, Nitin Varyani <
> varyani.nitin1 at gmail.com>
> >> wrote:
> >> >
> >> > Hi,
> >> >       I want to implement a system call as explained in Linux kernel
> >> > development by Robert Love.
> >> >
> >> > He does three things
> >> >  adding entry to entry.S
> >> > adding entry to asm/unistd.h
> >> > and adding the system call code to sched.c
> >> >
> >> >
> >> > and then make + make install
> >> >
> >> > I do not want to implement for all architectures but only for my PC
> >> > which is 64 bit. I am not able to locate files entry. S and unistd.h
> which
> >> > he is telling in his tutorial.
> >> > Please help me out to figure out the exact steps. Please also mention
> >> > the linux kernel version I should use.
> >> >
> >>
> >> Please refer this. I wrote this quite a while back but should be good to
> >> go.
> >>
> >>
> >>
> http://codewithkernel.blogspot.my/2014/06/adding-new-system-call-in-linux-x86-and.html
> >>
> >> > Nitin
> >> >
> >> > _______________________________________________
> >> > Kernelnewbies mailing list
> >> > Kernelnewbies at kernelnewbies.org
> >> > http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
> >> >
> >>
> >>
> >>
> >> --
> >>         ---P.K.S
> >
> >
>
>
>
> --
>         ---P.K.S
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20160409/08a4dcb5/attachment-0001.html 

^ permalink raw reply	[flat|nested] 17+ messages in thread

* system call
  2016-04-09 14:21       ` Nitin Varyani
@ 2016-04-09 14:34         ` Pranay Srivastava
  2016-04-09 14:41           ` Nitin Varyani
  0 siblings, 1 reply; 17+ messages in thread
From: Pranay Srivastava @ 2016-04-09 14:34 UTC (permalink / raw)
  To: kernelnewbies

On Sat, Apr 9, 2016 at 7:51 PM, Nitin Varyani <varyani.nitin1@gmail.com> wrote:
> I have a 64 bit machine
>

Before changing the source try to build, install and boot your kernel.
I'm sure there are some extra steps you might need to perform to boot your
compiled kernel. Which distro are you using? I used OpenSuse for this work.


> I am changing linux 3.5.4 source tree.
>
> I modified syscall_64.tbl
> I had put your code in linux_3.5.4/arch/x86/pks_first/pks_first_call.c
>
> Then, I created pks_first/Makefile
>
> Modified the arch/x86/Kbuild
>
> Modified include/linux/syscalls.h
>
>
> I ran "make menuconfig" and then simply exit.
>
> Then I ran
>
> "make"
>
> I saw that pks_first_call.o was created
>
> I then ran
>
> "make modules_install"
> "make install"
>
> After then I restarted my system and booted linux 3.5.4. But it was stuck
> half way.
>
> On Sat, Apr 9, 2016 at 7:39 PM, Pranay Srivastava <pranjas@gmail.com> wrote:
>>
>> Hi Nitin
>>
>> On Sat, Apr 9, 2016 at 5:03 PM, Nitin Varyani <varyani.nitin1@gmail.com>
>> wrote:
>> > Neither of the solution is working.
>> > @ Pranay: kernel is not booting after making the changes you have
>> > mentioned.
>> > somethings like
>> > "dropping to shell
>> > initramfs:"
>> > is displayed on booting.
>>
>> I don't think this is related to the changes you made. I would advise
>> you just build the sources for your
>> distro and try to get to boot the kernel you compiled. Perhaps some
>> steps you might have missed specific to your
>> distro?
>>
>> >
>> >
>> > On Thu, Apr 7, 2016 at 1:08 PM, Pranay Srivastava <pranjas@gmail.com>
>> > wrote:
>> >>
>> >> Nitin
>> >>
>> >>
>> >> On Thu, Apr 7, 2016 at 11:53 AM, Nitin Varyani
>> >> <varyani.nitin1@gmail.com>
>> >> wrote:
>> >> >
>> >> > Hi,
>> >> >       I want to implement a system call as explained in Linux kernel
>> >> > development by Robert Love.
>> >> >
>> >> > He does three things
>> >> >  adding entry to entry.S
>> >> > adding entry to asm/unistd.h
>> >> > and adding the system call code to sched.c
>> >> >
>> >> >
>> >> > and then make + make install
>> >> >
>> >> > I do not want to implement for all architectures but only for my PC
>> >> > which is 64 bit. I am not able to locate files entry. S and unistd.h
>> >> > which
>> >> > he is telling in his tutorial.
>> >> > Please help me out to figure out the exact steps. Please also mention
>> >> > the linux kernel version I should use.
>> >> >
>> >>
>> >> Please refer this. I wrote this quite a while back but should be good
>> >> to
>> >> go.
>> >>
>> >>
>> >>
>> >> http://codewithkernel.blogspot.my/2014/06/adding-new-system-call-in-linux-x86-and.html
>> >>
>> >> > Nitin
>> >> >
>> >> > _______________________________________________
>> >> > Kernelnewbies mailing list
>> >> > Kernelnewbies at kernelnewbies.org
>> >> > http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>> >> >
>> >>
>> >>
>> >>
>> >> --
>> >>         ---P.K.S
>> >
>> >
>>
>>
>>
>> --
>>         ---P.K.S
>
>



-- 
        ---P.K.S

^ permalink raw reply	[flat|nested] 17+ messages in thread

* system call
  2016-04-09 14:34         ` Pranay Srivastava
@ 2016-04-09 14:41           ` Nitin Varyani
  2016-04-09 14:46             ` Pranay Srivastava
  0 siblings, 1 reply; 17+ messages in thread
From: Nitin Varyani @ 2016-04-09 14:41 UTC (permalink / raw)
  To: kernelnewbies

I am using Ubuntu

On Sat, Apr 9, 2016 at 8:04 PM, Pranay Srivastava <pranjas@gmail.com> wrote:

> On Sat, Apr 9, 2016 at 7:51 PM, Nitin Varyani <varyani.nitin1@gmail.com>
> wrote:
> > I have a 64 bit machine
> >
>
> Before changing the source try to build, install and boot your kernel.
> I'm sure there are some extra steps you might need to perform to boot your
> compiled kernel. Which distro are you using? I used OpenSuse for this work.
>
>
> > I am changing linux 3.5.4 source tree.
> >
> > I modified syscall_64.tbl
> > I had put your code in linux_3.5.4/arch/x86/pks_first/pks_first_call.c
> >
> > Then, I created pks_first/Makefile
> >
> > Modified the arch/x86/Kbuild
> >
> > Modified include/linux/syscalls.h
> >
> >
> > I ran "make menuconfig" and then simply exit.
> >
> > Then I ran
> >
> > "make"
> >
> > I saw that pks_first_call.o was created
> >
> > I then ran
> >
> > "make modules_install"
> > "make install"
> >
> > After then I restarted my system and booted linux 3.5.4. But it was stuck
> > half way.
> >
> > On Sat, Apr 9, 2016 at 7:39 PM, Pranay Srivastava <pranjas@gmail.com>
> wrote:
> >>
> >> Hi Nitin
> >>
> >> On Sat, Apr 9, 2016 at 5:03 PM, Nitin Varyani <varyani.nitin1@gmail.com
> >
> >> wrote:
> >> > Neither of the solution is working.
> >> > @ Pranay: kernel is not booting after making the changes you have
> >> > mentioned.
> >> > somethings like
> >> > "dropping to shell
> >> > initramfs:"
> >> > is displayed on booting.
> >>
> >> I don't think this is related to the changes you made. I would advise
> >> you just build the sources for your
> >> distro and try to get to boot the kernel you compiled. Perhaps some
> >> steps you might have missed specific to your
> >> distro?
> >>
> >> >
> >> >
> >> > On Thu, Apr 7, 2016 at 1:08 PM, Pranay Srivastava <pranjas@gmail.com>
> >> > wrote:
> >> >>
> >> >> Nitin
> >> >>
> >> >>
> >> >> On Thu, Apr 7, 2016 at 11:53 AM, Nitin Varyani
> >> >> <varyani.nitin1@gmail.com>
> >> >> wrote:
> >> >> >
> >> >> > Hi,
> >> >> >       I want to implement a system call as explained in Linux
> kernel
> >> >> > development by Robert Love.
> >> >> >
> >> >> > He does three things
> >> >> >  adding entry to entry.S
> >> >> > adding entry to asm/unistd.h
> >> >> > and adding the system call code to sched.c
> >> >> >
> >> >> >
> >> >> > and then make + make install
> >> >> >
> >> >> > I do not want to implement for all architectures but only for my PC
> >> >> > which is 64 bit. I am not able to locate files entry. S and
> unistd.h
> >> >> > which
> >> >> > he is telling in his tutorial.
> >> >> > Please help me out to figure out the exact steps. Please also
> mention
> >> >> > the linux kernel version I should use.
> >> >> >
> >> >>
> >> >> Please refer this. I wrote this quite a while back but should be good
> >> >> to
> >> >> go.
> >> >>
> >> >>
> >> >>
> >> >>
> http://codewithkernel.blogspot.my/2014/06/adding-new-system-call-in-linux-x86-and.html
> >> >>
> >> >> > Nitin
> >> >> >
> >> >> > _______________________________________________
> >> >> > Kernelnewbies mailing list
> >> >> > Kernelnewbies at kernelnewbies.org
> >> >> > http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
> >> >> >
> >> >>
> >> >>
> >> >>
> >> >> --
> >> >>         ---P.K.S
> >> >
> >> >
> >>
> >>
> >>
> >> --
> >>         ---P.K.S
> >
> >
>
>
>
> --
>         ---P.K.S
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20160409/65a8d643/attachment.html 

^ permalink raw reply	[flat|nested] 17+ messages in thread

* system call
  2016-04-09 14:41           ` Nitin Varyani
@ 2016-04-09 14:46             ` Pranay Srivastava
  0 siblings, 0 replies; 17+ messages in thread
From: Pranay Srivastava @ 2016-04-09 14:46 UTC (permalink / raw)
  To: kernelnewbies

On Sat, Apr 9, 2016 at 8:11 PM, Nitin Varyani <varyani.nitin1@gmail.com> wrote:
> I am using Ubuntu
>
> On Sat, Apr 9, 2016 at 8:04 PM, Pranay Srivastava <pranjas@gmail.com> wrote:
>>
>> On Sat, Apr 9, 2016 at 7:51 PM, Nitin Varyani <varyani.nitin1@gmail.com>
>> wrote:
>> > I have a 64 bit machine
>> >
>>
>> Before changing the source try to build, install and boot your kernel.
>> I'm sure there are some extra steps you might need to perform to boot your
>> compiled kernel. Which distro are you using? I used OpenSuse for this
>> work.
>>
>>
>> > I am changing linux 3.5.4 source tree.
>> >
>> > I modified syscall_64.tbl
>> > I had put your code in linux_3.5.4/arch/x86/pks_first/pks_first_call.c
>> >
>> > Then, I created pks_first/Makefile
>> >
>> > Modified the arch/x86/Kbuild
>> >
>> > Modified include/linux/syscalls.h
>> >
>> >
>> > I ran "make menuconfig" and then simply exit.
>> >
>> > Then I ran
>> >
>> > "make"
>> >
>> > I saw that pks_first_call.o was created
>> >
>> > I then ran
>> >
>> > "make modules_install"
>> > "make install"
>> >
>> > After then I restarted my system and booted linux 3.5.4. But it was
>> > stuck
>> > half way.
>> >
>> > On Sat, Apr 9, 2016 at 7:39 PM, Pranay Srivastava <pranjas@gmail.com>
>> > wrote:
>> >>
>> >> Hi Nitin
>> >>
>> >> On Sat, Apr 9, 2016 at 5:03 PM, Nitin Varyani
>> >> <varyani.nitin1@gmail.com>
>> >> wrote:
>> >> > Neither of the solution is working.
>> >> > @ Pranay: kernel is not booting after making the changes you have
>> >> > mentioned.
>> >> > somethings like
>> >> > "dropping to shell
>> >> > initramfs:"
>> >> > is displayed on booting.
>> >>
>> >> I don't think this is related to the changes you made. I would advise
>> >> you just build the sources for your
>> >> distro and try to get to boot the kernel you compiled. Perhaps some
>> >> steps you might have missed specific to your
>> >> distro?
>> >>
>> >> >
>> >> >
>> >> > On Thu, Apr 7, 2016 at 1:08 PM, Pranay Srivastava <pranjas@gmail.com>
>> >> > wrote:
>> >> >>
>> >> >> Nitin
>> >> >>
>> >> >>
>> >> >> On Thu, Apr 7, 2016 at 11:53 AM, Nitin Varyani
>> >> >> <varyani.nitin1@gmail.com>
>> >> >> wrote:
>> >> >> >
>> >> >> > Hi,
>> >> >> >       I want to implement a system call as explained in Linux
>> >> >> > kernel
>> >> >> > development by Robert Love.
>> >> >> >
>> >> >> > He does three things
>> >> >> >  adding entry to entry.S
>> >> >> > adding entry to asm/unistd.h
>> >> >> > and adding the system call code to sched.c
>> >> >> >
>> >> >> >
>> >> >> > and then make + make install
>> >> >> >
>> >> >> > I do not want to implement for all architectures but only for my
>> >> >> > PC
>> >> >> > which is 64 bit. I am not able to locate files entry. S and
>> >> >> > unistd.h
>> >> >> > which
>> >> >> > he is telling in his tutorial.
>> >> >> > Please help me out to figure out the exact steps. Please also
>> >> >> > mention
>> >> >> > the linux kernel version I should use.
>> >> >> >
>> >> >>
>> >> >> Please refer this. I wrote this quite a while back but should be
>> >> >> good
>> >> >> to
>> >> >> go.
>> >> >>
>> >> >>
>> >> >>
>> >> >>
>> >> >> http://codewithkernel.blogspot.my/2014/06/adding-new-system-call-in-linux-x86-and.html
>> >> >>
>> >> >> > Nitin
>> >> >> >
>> >> >> > _______________________________________________
>> >> >> > Kernelnewbies mailing list
>> >> >> > Kernelnewbies at kernelnewbies.org
>> >> >> > http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>> >> >> >
>> >> >>
>> >> >>
>> >> >>
>> >> >> --
>> >> >>         ---P.K.S
>> >> >
>> >> >
>> >>
>> >>
>> >>
>> >> --
>> >>         ---P.K.S
>> >
>> >
>>
>>
>>
>> --
>>         ---P.K.S
>
>

Check this

http://unix.stackexchange.com/questions/123632/newly-compiled-kernel-not-booting-up-vanilla-kernel-3-12-14



-- 
        ---P.K.S

^ permalink raw reply	[flat|nested] 17+ messages in thread

* system call
  2011-06-11  9:39 Venkateswarlu P
  2011-06-11  9:58 ` Rajat Sharma
@ 2011-06-11 17:59 ` Javier Martinez Canillas
  1 sibling, 0 replies; 17+ messages in thread
From: Javier Martinez Canillas @ 2011-06-11 17:59 UTC (permalink / raw)
  To: kernelnewbies

On Sat, Jun 11, 2011 at 6:39 PM, Venkateswarlu P
<p.venkatesh551@gmail.com> wrote:
>
>
> Where do i find system call implementation code?
>
> for? read, write, open, close

For file system related syscalls, it would depend on the fs
implementation. The Virtual File System only defines a uniform common
high level layer but is the responsibility of every fs to actually
implement the file operations (open, read, write, etc).

There is some generic file operations in linux/fs/read_write.c that
are used for simple fs like romfs and ramfs. I would recommend start
looking at these memory file systems first.

Then you could look how real file systems operations are implemented.
Every fs usually have a file.c file where a struct file_operations is
defined. This structure has a function pointer for every file
operation. The functions asigned to these function pointers are the
ones that actually implements the operations. Some of these could be
generic operations and some of them are fs specific.

Hope it helps,

-- 
Javier Mart?nez Canillas
(+34) 682 39 81 69
PhD Student in High Performance Computing
Computer Architecture and Operating System Department (CAOS)
Universitat Aut?noma de Barcelona
Barcelona, Spain

^ permalink raw reply	[flat|nested] 17+ messages in thread

* system call
  2011-06-11  9:39 Venkateswarlu P
@ 2011-06-11  9:58 ` Rajat Sharma
  2011-06-11 17:59 ` Javier Martinez Canillas
  1 sibling, 0 replies; 17+ messages in thread
From: Rajat Sharma @ 2011-06-11  9:58 UTC (permalink / raw)
  To: kernelnewbies

search for SYSCALL_DEFINE<X>(syscall) in linux source e.g.

SYSCALL_DEFINE3(open, const char __user *, filename, int, flags, int,
mode) in fs/open.c

here <X> depends on number of arguments to system call: 3 in case of open.

you would find open, read, write and close in fs directory only.

-Rajat

On Sat, Jun 11, 2011 at 3:09 PM, Venkateswarlu P
<p.venkatesh551@gmail.com> wrote:
>
>
> Where do i find system call implementation code?
>
> for? read, write, open, close
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
>

^ permalink raw reply	[flat|nested] 17+ messages in thread

* system call
@ 2011-06-11  9:39 Venkateswarlu P
  2011-06-11  9:58 ` Rajat Sharma
  2011-06-11 17:59 ` Javier Martinez Canillas
  0 siblings, 2 replies; 17+ messages in thread
From: Venkateswarlu P @ 2011-06-11  9:39 UTC (permalink / raw)
  To: kernelnewbies

Where do i find system call implementation code? *for  read, write, open,
close*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20110611/3aa5f27a/attachment.html 

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: system call
  2002-07-08 23:59   ` Vladimir Zidar
@ 2002-07-09  0:13     ` Keith Owens
  0 siblings, 0 replies; 17+ messages in thread
From: Keith Owens @ 2002-07-09  0:13 UTC (permalink / raw)
  To: linux-kernel

On 09 Jul 2002 01:59:42 +0200, 
Vladimir Zidar <vladimir@mindnever.org> wrote:
>On Mon, 2002-07-08 at 17:16, Randy.Dunlap wrote:
>>   http://www.xenotime.net/linux/syscall_ex/
>> contains a howto, kernel patch, and test program.
>
> And how to choose goot syscall number ? Are some numbers pre-reserved
>to 'private' syscalls ? What numbers are free to use, without fear that
>new kernel release will just jump over them !?
> And what about an idea to be able to add syscall by name, from loadab;e
>module of course.  Userland application will then resolve 'name' to
>number at startup, and use it just as ordinary syscall ?

http://marc.theaimsgroup.com/?t=100902098800001&r=1&w=2.  There were
alternative patches going around, primarily from Benjamin LaHaise.
Linus did not want any of the patches.


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: system call
  2002-07-08 15:16 ` Randy.Dunlap
@ 2002-07-08 23:59   ` Vladimir Zidar
  2002-07-09  0:13     ` Keith Owens
  0 siblings, 1 reply; 17+ messages in thread
From: Vladimir Zidar @ 2002-07-08 23:59 UTC (permalink / raw)
  To: Randy.Dunlap, linux-kernel

On Mon, 2002-07-08 at 17:16, Randy.Dunlap wrote:


>   http://www.xenotime.net/linux/syscall_ex/
> contains a howto, kernel patch, and test program.

 And how to choose goot syscall number ? Are some numbers pre-reserved
to 'private' syscalls ? What numbers are free to use, without fear that
new kernel release will just jump over them !?
 And what about an idea to be able to add syscall by name, from loadab;e
module of course.  Userland application will then resolve 'name' to
number at startup, and use it just as ordinary syscall ?


-- 
Bye,

 and have a very nice day !




^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: system call
  2002-07-08 10:15 Bruno Pujol
@ 2002-07-08 15:16 ` Randy.Dunlap
  2002-07-08 23:59   ` Vladimir Zidar
  0 siblings, 1 reply; 17+ messages in thread
From: Randy.Dunlap @ 2002-07-08 15:16 UTC (permalink / raw)
  To: Bruno Pujol; +Cc: linux-kernel

On Mon, 8 Jul 2002, Bruno Pujol wrote:

| Do someone know how to add a system call for the kernel 2.4.8 ?

There are _many_ examples of adding syscalls on the web.
Try searching with www.google.com if you haven't already.

I expect that the real problem is that a patch that works for
2.4.8 won't work for 2.4.18 and vice versa, e.g., due to the
method used for defining the end/size of the syscall table.

| I did know how to do it for an older version (2.0.35) :
| - add a line in the file : /usr/src/linux/include/asm/unistd.h
| 	#define __NR_my_systemcall	XXXX (where XXXX is the number
| for my new system call)
|
| - modify the file /usr/src/linux/arch/i386/kernel/entry.S
| 	- add my system call
| 		.long SYMBOL_NAME (my_systemcall) at the end of the system callslist
| 	- modify le last line of the file :
| 		.space (NR_syscalls-166)*4   <= replace the 166 by 167

That's very close to working.
Here's how I did it for 2.4.18, but like I said above, it won't
apply cleanly to 2.4.8.  You'll have to use just a small amount of
gray matter to fix it:
  http://www.xenotime.net/linux/syscall_ex/
contains a howto, kernel patch, and test program.

| After this changes, I only needed to recompile the kernel and reboot
| with it... and a user's program could use the new system call...
| But with my new kernel, this manupilation doesn't still work.

You should modify the new syscall number to a value to is not used,
and modify your userspace program to use that new syscall number.

-- 
~Randy


^ permalink raw reply	[flat|nested] 17+ messages in thread

* system call
@ 2002-07-08 10:15 Bruno Pujol
  2002-07-08 15:16 ` Randy.Dunlap
  0 siblings, 1 reply; 17+ messages in thread
From: Bruno Pujol @ 2002-07-08 10:15 UTC (permalink / raw)
  To: linux-kernel

Hi,

Do someone know how to add a system call for the kernel 2.4.8 ?

I did know how to do it for an older version (2.0.35) :
- add a line in the file : /usr/src/linux/include/asm/unistd.h
	#define __NR_my_systemcall	XXXX (where XXXX is the number for my new system call)

- modify the file /usr/src/linux/arch/i386/kernel/entry.S
	- add my system call 
		.long SYMBOL_NAME (my_systemcall) at the end of the system callslist
	- modify le last line of the file :
		.space (NR_syscalls-166)*4   <= replace the 166 by 167


After this changes, I only needed to recompile the kernel and reboot with it... and a user's program could use the new system call...
But with my new kernel, this manupilation doesn't still work.

PUJOL Bruno

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2016-04-09 14:46 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-07  6:23 system call Nitin Varyani
2016-04-07  6:30 ` Giedrius Statkevičius
2016-04-07  6:45 ` Sharath Chandra
2016-04-07  7:38 ` Pranay Srivastava
2016-04-09 11:33   ` Nitin Varyani
2016-04-09 14:09     ` Pranay Srivastava
2016-04-09 14:21       ` Nitin Varyani
2016-04-09 14:34         ` Pranay Srivastava
2016-04-09 14:41           ` Nitin Varyani
2016-04-09 14:46             ` Pranay Srivastava
  -- strict thread matches above, loose matches on Subject: below --
2011-06-11  9:39 Venkateswarlu P
2011-06-11  9:58 ` Rajat Sharma
2011-06-11 17:59 ` Javier Martinez Canillas
2002-07-08 10:15 Bruno Pujol
2002-07-08 15:16 ` Randy.Dunlap
2002-07-08 23:59   ` Vladimir Zidar
2002-07-09  0:13     ` Keith Owens

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.