ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
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.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
I'm not sure, if that is the proper way to phrase, what I am asking, anyway...
I am making a program which allows me to moniter users using my box, (knock 'em off sshd/view what they're doing, etc) but I can't figure out how to kill the proper terminal, I can get the login pid using utmp, but I need the tty/pty/pts id.. Any ideas on how to do this?
the numbers are all process id's and are folders. in a process id folder it looks like this:
<o7:> cd 985
cmdline cwd environ exe fd maps mem mounts root stat statm status
<o7:> cat stat
985 (xmms) S 1 984 984 0 -1 0 589 0 1501 0 5484 925 0 0 15 0 0 0 18942 50507776 2066 4294967295 134512640 135467008 3221224240 3221223788 1108157003 0 0 4102 1024 3222420269 0 0 17 0
however using /proc/, to quote stevens, is an ugly hodgepodge. iirc the way to do this stuff is thru sysctl calls. i've used sysctl for routing and network stuff, but not for process stuff yet. however it would be a fun project and im going to try now i think thanks for the inspiration! for now tho you can just parse the data in /proc/your_pid/stat file.
ps. if you're interested in doing the sysctl way, have a look at file: /usr/include/linux/sysctl.h it shows you the request structure kinda. you'll need to read the man pages and prolly google for a sysctl() tutorial. i may have some old code lying around if you want to check it out?
Last edited by infamous41md; 11-25-2003 at 04:20 PM.
damn there seems to be not much info at all on how to use sysctl. this seems to be another one of those things to just hack ur way thru. all of the standard linux utilities DONT use sysctl, they all cheat and use /proc. does anyone else have any source for utilities that use sysctl? here is teh little piece of code i wrote awhile ago, it shows the general idea. if you read the above mentioned header file you'll see how it works. the requests form a hierarchical structure.