ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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
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.
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.
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 ?
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.
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
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.
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.
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
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
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.