LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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-26-2008, 10:35 AM   #1
hosseinyounesi
LQ Newbie
 
Registered: Aug 2008
Posts: 4

Rep: Reputation: 0
Lightbulb Linux API Reference [urgent]


Hi guys,
I'm going to write a program in Linux and I need some API function, but I can't find a reference for Linux (similar to MSDN in Windows) !!! I know that I can for example log off a user in command line with skill, pkill but I want to do with API functions. Now I need get user home directory, logged on user name, reboot the system, kill a process and ...
After that I have to learn forks, NTPL, sockets, ...
Any Reference, help, tutorial, Documentation ... ?
Thanks for your considerations
 
Old 08-26-2008, 10:38 AM   #2
rocket357
Member
 
Registered: Mar 2007
Location: 127.0.0.1
Distribution: OpenBSD-CURRENT
Posts: 485
Blog Entries: 187

Rep: Reputation: 74
You sound like an accomplished coder, so please don't take this wrong...but...what more documentation do you need than the code itself? This isn't Windows. It's open source...you can download and view/modify/redistribute the code as you see fit.
 
Old 08-26-2008, 10:39 AM   #3
dmail
Member
 
Registered: Oct 2005
Posts: 970

Rep: Reputation: Disabled
Who is this urgent to? Not me!
 
Old 08-26-2008, 10:46 AM   #4
jcookeman
Member
 
Registered: Jul 2003
Location: London, UK
Distribution: FreeBSD, OpenSuse, Ubuntu, RHEL
Posts: 417

Rep: Reputation: 33
The first advice I would give you is to familiarize yourself with POSIX standards. You're going to be most interested in Shell and Utilities and System Interfaces.

At the same time you will need to become acquainted with the way Linux handles libraries, binaries and linking. Take a look at the man pages for ld and make or any other tutorials you can find online.
 
Old 08-26-2008, 10:56 AM   #5
hosseinyounesi
LQ Newbie
 
Registered: Aug 2008
Posts: 4

Original Poster
Rep: Reputation: 0
Thanks for your answers, but NOW I need to do sth like the following commands :
computer_id hostname - try the `hostname` command
logged on users - try `users` command, or `who`
shutdown = `shutdown -h -P now`, or `poweroff`, or `runlevel 0`
reboot = `reboot`, or `runlevel 6`
kill a proccess = `kill proccessid`, or `killall processname`
get home = just filters through `env`

I searched in this site : http://www.die.net/
I found just reboot and getlogin() that returns just the username that runs my program not the all 7 linux terminals !!!
Anyone help me ?
 
Old 08-26-2008, 10:59 AM   #6
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,928

Rep: Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612
Sounds to me like what you want to do is mostly accomplished with glibc functions, not kernel calls.
 
Old 08-26-2008, 11:02 AM   #7
hosseinyounesi
LQ Newbie
 
Registered: Aug 2008
Posts: 4

Original Poster
Rep: Reputation: 0
NOW NOW NOW, I just NEED these. Any one know how to do it ?
 
Old 08-26-2008, 11:38 AM   #8
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,634

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by hosseinyounesi View Post
NOW NOW NOW, I just NEED these. Any one know how to do it ?
Need what??? Your question (???)

Quote:
Thanks for your answers, but NOW I need to do sth like the following commands :
computer_id hostname - try the `hostname` command
logged on users - try `users` command, or `who`
shutdown = `shutdown -h -P now`, or `poweroff`, or `runlevel 0`
reboot = `reboot`, or `runlevel 6`
kill a proccess = `kill proccessid`, or `killall processname`
get home = just filters through `env`

I searched in this site : http://www.die.net/
I found just reboot and getlogin() that returns just the username that runs my program not the all 7 linux terminals !!!
Anyone help me ?
makes no sense. You "need to do sth like the following". What's sth? You found just reboot and getlogin...what are you trying to do? What's your goal?

And don't TELL people to answer you quickly...saying "NOW NOW NOW" isn't very polite. We all volunteer our time.
 
Old 08-26-2008, 02:48 PM   #9
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,928

Rep: Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612
Sounds like you are looking for someone to do your homework... As I mentioned, most of what you are talking about is done by libc functions, not by kernel functions calls.
The programs you mention do their work by using/linking to glibc functions. here's a link to the reference manual:
http://www.gnu.org/software/libc/man...ode/index.html
 
Old 08-26-2008, 03:51 PM   #10
theYinYeti
Senior Member
 
Registered: Jul 2004
Location: France
Distribution: Arch Linux
Posts: 1,897

Rep: Reputation: 66
It even looks to me like bash' job…
Either 1/ man bash, or 2/ better explain the need.

Yves.
 
Old 08-26-2008, 04:10 PM   #11
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 65
I recommend you take the key word in each of the things you want to do, and try this:
Code:
man -k keyword
And look for something in section 2 or 3 of the manual. The example would be hostname:
Code:
$ man -k hostname
BIO_get_conn_hostname (3ssl) - connect BIO
BIO_set_conn_hostname (3ssl) - connect BIO
gethostname (2)      - get/set host name
gethostname (3posix) - get name of current host
hostname (1)         - show or set the system's host name
kdontchangethehostname (1) - Informs KDE about a change in hostname
sethostname (2)      - get/set host name
ssh-argv0 (1)        - replaces the old ssh command-name as hostname handling
Sys::Hostname (3perl) - Try every conceivable way to get hostname
tor-resolve (1)      - resolve a hostname to an IP address via tor
Lines which look interesting are highlighted in bold.

You many need to install development manual pages for glibc and the manual pages for system calls.

As a programmer you should be familiar with iteration. Iterate over the list of keywords extracted from your list of tasks/homework questions.
 
Old 08-26-2008, 07:26 PM   #12
jiml8
Senior Member
 
Registered: Sep 2003
Posts: 3,171

Rep: Reputation: 116Reputation: 116
Also, Linux APIs are documented all over the web. There is no shortage of information; quite the contrary.

You'll do a lot better by formulating a specific question about a specific issue, and asking for someone to point you in the right direction. People are quite willing to do that. But when you go "NOW NOW NOW" you will find that people here...will often realize they could be doing other things, rather than answer your demands.
 
Old 08-26-2008, 07:36 PM   #13
ta0kira
Senior Member
 
Registered: Sep 2004
Distribution: FreeBSD 9.1, Kubuntu 12.10
Posts: 3,078

Rep: Reputation: Disabled
Quote:
Originally Posted by gnashley View Post
Sounds like you are looking for someone to do your homework... As I mentioned, most of what you are talking about is done by libc functions, not by kernel functions calls.
The programs you mention do their work by using/linking to glibc functions. here's a link to the reference manual:
http://www.gnu.org/software/libc/man...ode/index.html
This is by far the best reference I've used and it's almost verbatim in info libc.
ta0kira
 
Old 08-26-2008, 07:38 PM   #14
ta0kira
Senior Member
 
Registered: Sep 2004
Distribution: FreeBSD 9.1, Kubuntu 12.10
Posts: 3,078

Rep: Reputation: Disabled
Quote:
Originally Posted by hosseinyounesi View Post
NOW NOW NOW, I just NEED these. Any one know how to do it ?
I thought this was a used car ad for a minute, but then I saw the word "I"...
ta0kira
 
Old 08-27-2008, 04:05 AM   #15
hosseinyounesi
LQ Newbie
 
Registered: Aug 2008
Posts: 4

Original Poster
Rep: Reputation: 0
Hi everybody, believe that I'm not an impolite man, I just wanted to say that I will need more in the future and now I'm interested to theses functions. I'm doing an accounting program that should be cross-platform. I used xmlrpc++ to communicate between server and clients !!!
I found my answer I will post it when I done it completely and will ask more useful questions later.
Thanks for your considerations GOOD PEOPLE
 
  


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
Installation of Linux API Headers... crik91 Linux From Scratch 7 01-05-2008 03:11 PM
QoS API in Linux _den Programming 2 05-31-2006 02:53 PM
linux crypto api saajii Programming 3 08-31-2004 09:16 PM
What API availible under the Linux? sonm Programming 3 12-30-2003 03:45 AM
Does Linux have API-like functions solartear Programming 8 04-03-2002 12:40 PM

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

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