Find the answer to your Linux question:
Results 1 to 5 of 5
Hi all! I'm new here. I've been studying Minix and Linux for a little while now, since a group of us is going to try to build an OS soon. ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Mar 2004
    Posts
    3

    Where do i find system call implementation code?


    Hi all!
    I'm new here.

    I've been studying Minix and Linux for a little while now, since a group of us is going to try to build an OS soon. I think i have a grip on the mechanism of system calls that Minix and Linux use, with all the message passing and what happens at each level, and blah blah, until i reach the part that deals with the libc stub.

    But i still have not been able to find the actual code for the system call implementation ..... read, write, open, close....where do i find these codes?

    Where can i locate these codes? I appreciate any help.

    Thanks,
    Pramod

  2. #2
    Linux Guru
    Join Date
    Oct 2001
    Location
    Täby, Sweden
    Posts
    7,578
    That depends on the level... as for glibc, the code to do the actual syscalls are in sysdeps/unix/sysv/linux/i386/syscall.S and sysdep.h in the same directory. The kernel intercepts them in arch/i386/kernel/entry.S. The actual syscalls are scattered all over the place. To find read(2), for example, look in fs/read_write.c in the kernel source.
    Was that the information that you wanted?

    But you know, if you want to build an entirely new O/S, you shouldn't build it on something as old and obsolete as UNIX. =)

  3. #3
    Just Joined!
    Join Date
    Mar 2004
    Posts
    3
    Thanks, that was helpful. I've managed to locate some of the code, and i guess i'll find the rest soon enough.

    The OS we're building is not going to be built on UNIX. It is an Object-oriented OS (experimental - we're IT students, doing this as a project), and i just wanted to read the code to get an idea of how exactly the functions were performed. The mechanism used in making the calls will be unique to our OS, of course, but the actual implementation could be reused in many cases, don't you think?

    Pramod

  4. $spacer_open
    $spacer_close
  5. #4
    Linux Guru
    Join Date
    Oct 2001
    Location
    Täby, Sweden
    Posts
    7,578
    Oh yes, I agree. I was just thinking that since you were looking at Linux and Minix, you would do something related. Sorry for underestimating you! =)

    Would you mind telling me a bit about how you were planning on designing this O/S?

  6. #5
    Just Joined!
    Join Date
    Mar 2004
    Posts
    3
    Underestimating? Not at all, my friend. In fact, you may be in danger of overestimating me. =)

    Well, since we had to do a project this semester, we had decided on building an OS more than a few months back. The actual work started less than a month back, but it's been more research than coding so far, because we wanted to get a hang of the thing before actually making any serious design decisions. But we did manage to put some basic things together - In fact, we've already done most of a small working protoype.

    Then, just a week back, i suggested making it object-oriented - and we pounced on the idea. Until then, yes, we had been planning to model it after Linux/Minix because we wanted POSIX compatibility first of all.

    You know the deal, of course - everything is treated as an object, a module with its own permissions and its own protection. There will be separate modules for memory management, process management, file systems. Withing them too, everything is arranged according to classes in a hierarchy. Communication between modules is done through their interfaces, obviously. Every module can thus exist on its own. In that case, the concept of the kernel disappears altogether, and protection can in fact be at a much higher level - with the sacrifice of some efficiency. Also, it adds the huge advantage of making the OS extensible, which is our focus now. We've come up with some good ideas now, and work is beginning to get exciting.

    We've split the work - there are four of us, and my job is to build an Object-oriented file system. I've got most of it figured out, and its been thrilling so far because it's a completely original design. Our prof says we might even present a paper at the end of it. Don't know. So far so good, but it looks a daunting task nevertheless - what with 4 20-year olds trying to pull off an original OS design in 3 months! Ouch.

    We're bound to have a million problems along the way, and that's the reason i joined this forum. I'll post questions as they arise. I know that most of the questions will sound very naive, but bear with me - i'm learning!

    Thanks,
    Pramod

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •