LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > *BSD
User Name
Password
*BSD This forum is for the discussion of all BSD variants.
FreeBSD, OpenBSD, NetBSD, etc.

Notices


Reply
  Search this Thread
Old 04-10-2005, 10:37 PM   #1
GodSendDeath
Member
 
Registered: Mar 2004
Posts: 71

Rep: Reputation: 15
System Call Implementation


Where is the system call implementation portion of the FreeBSD source tree? I am mainly interested in sys_read, sys_write, sys_open. I have yahoo'ed and looked for days. I found a write implementation in /usr/src/lib/libstand/ but I doubt that is correct. Thank you.

-GSD
 
Old 04-11-2005, 12:01 PM   #2
frob23
Senior Member
 
Registered: Jan 2004
Location: Roughly 29.467N / 81.206W
Distribution: OpenBSD, Debian, FreeBSD
Posts: 1,450

Rep: Reputation: 48
They are in various places in the source tree (under /usr/src/sys) depending on exactly what they do.

open (kern/vfs_syscalls.c)
read (kern/sys_generic.c)
write (kern/sys_generic.c)

In the kernel (where the syscalls are implemented) they are rarely prefixed with "sys_" although it is not unheard of. (sys_exit for example)

This question is a little advanced for this segment of BSD users... if you are doing anything tricky, I would recommend the FreeBSD mailing lists... just because I am not sure I'll be able to help very much if you are doing more then basic kernel hacking.
 
Old 04-11-2005, 03:44 PM   #3
GodSendDeath
Member
 
Registered: Mar 2004
Posts: 71

Original Poster
Rep: Reputation: 15
Thanks for the response. I will check these files out when I get home. I will take your mailing list suggestion and I will post and more kernel based topics to the appropriate forums. Thank you.


-GSD
 
Old 04-11-2005, 05:06 PM   #4
frob23
Senior Member
 
Registered: Jan 2004
Location: Roughly 29.467N / 81.206W
Distribution: OpenBSD, Debian, FreeBSD
Posts: 1,450

Rep: Reputation: 48
lol, I'm not saying you "can't" post your questions here... just that I am not sure how much of a response you could expect from these boards. I have some experience mucking around the kernel because it was a great interest for me back when I was seeking a degree in computer engineering. I don't mess around with is much anymore... so anything I can say off the top of my head it probably wrong and anything I have to search for, you could find by the time I get back to you.

Hint, install cscope (devel/cscope) as it can be used to index the entire kernel source tree and will allow you to quickly search for files, keywords, function definitions, comments, etc... (cd /usr/src/sys ; cscope -Rk).

I would try my best to help but I can't really promise much. And I'm sure that anyone here who could... is probably on the mailing lists already.

EDIT: Make sure you define $EDITOR variable to your editor of choice (it defaults to vi ... I prefer vim but that is just me)... as cscope will open the file with your defined editor when you select it.

Here is an example (where I looked for the global definition of write).
Code:
Global definition: write

  File             Line
0 nehemiah.c         51 .write = (random_write_func_t *)random_null_func,
1 randomdev.h        46 random_write_func_t *write;
2 randomdev_soft.c   69 .write = random_yarrow_write,
3 wd7000.c          219 u_int8_t write;
4 cserial.h         440 int (*write) (chan_t *h, unsigned short flg, const char
                        *buf, int len);
5 sys_generic.c     274 write(td, uap)
6 zlib.c           3578 Bytef *write;




Find this C symbol:
Find this global definition: 
Find functions called by this function:
Find functions calling this function:
Find this text string:
Change this text string:
Find this egrep pattern:
Find this file:
Find files #including this file:

Last edited by frob23; 04-11-2005 at 05:11 PM.
 
  


Reply



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
using system call ej25 Programming 9 11-30-2004 11:45 AM
the procudre of implementation of system call in kernel 2.6 with example abhis_mail2002 Fedora 0 10-15-2004 10:17 AM
Is it possible to use system() and get the return value from the system call newguy21 Programming 1 08-11-2004 01:37 PM
System call dami Linux - General 0 11-18-2003 11:18 AM
system call implementation.. modular approach udayan Programming 0 05-13-2002 11:46 AM

LinuxQuestions.org > Forums > Other *NIX Forums > *BSD

All times are GMT -5. The time now is 05:53 PM.

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