LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-09-2001, 09:46 AM   #1
john.clifford
LQ Newbie
 
Registered: Aug 2001
Distribution: redhat 7.1, kernel 2.4.2-2
Posts: 2

Rep: Reputation: 0
Question sysctl() system call


hi,

is anyone out there familiar with the system call 'sysctl'? i'm trying to figure out what some source code (zebra) is doing:

#define MIBSIZ 6
int mib[MIBSIZ] =
{
CTL_NET,
PF_ROUTE,
0,
0, /* AF_INET & AF_INET6 */
NET_RT_IFLIST,
0
};

/* Query buffer size. */
if (sysctl (mib, MIBSIZ, NULL, &bufsiz, NULL, 0) < 0)
...

/* Fetch interface informations into allocated buffer. */
if (sysctl (mib, MIBSIZ, buf, &bufsiz, NULL, 0) < 0)
...

the first argument is an array of ints, second one says how big the array is. the other args are buffers and sizes for the value read and the value to write.

i guess what i need to know is the format and content of the first argument. where is this defined?

cheers,
john c.
PS redhat 7.2, kernel 2.4.2-2
 
Old 08-09-2001, 04:44 PM   #2
isajera
Senior Member
 
Registered: Jun 2001
Posts: 1,635

Rep: Reputation: 45
if you try to get a man page on this, you'll probably com up with info about a shell command to set kernel parameters.... that's not what you're looking for. here's a man page to the c call - it's a pretty involved function:

http://www.ajk.tele.fi/libc/gen/sysctl.3.html
 
Old 08-13-2001, 10:53 AM   #3
john.clifford
LQ Newbie
 
Registered: Aug 2001
Distribution: redhat 7.1, kernel 2.4.2-2
Posts: 2

Original Poster
Rep: Reputation: 0
cheers

hey isajera,

thanks for the info. that man page is actually a bit more helpful than the section 2 one i was looking at on my system. it appears redhat 7.1 does not install the section 3 man page for this call by default (or maybe it does - i didn't install it myself).

john c.
 
  


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
new system call soul2 Linux - General 1 11-03-2004 02:41 PM
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
about system call alchen1999 Programming 10 09-01-2003 03:43 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:07 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