Find Jobs
Hire Freelancers

Program that reads the utmpx (/var/adm/utmpx) file

$20-25 USD

Complété
Publié il y a environ 20 ans

$20-25 USD

Payé lors de la livraison
The purpose of this assignment is to write a program using C programming that reads the utmpx (/var/adm/utmpx) file and prints a list of currently logged-in users. For each user, the getpwnam() function is used to obtain the user's real name. Description ----------- You will write a program 'whom', which will display the login name, Name of the user, name of the device on which the user is logged in, and name of the remote host. e.g. $whom The output of the program will be something like this: Login Name Line Time Host --------------------------------------------------------------------- schakrav S. Chakravarthy pts/1 May 28 08:04 [login to view URL] kpalmer Karen Palmer pts/2 May 23 12:28 [login to view URL] rowe2746 Donald Rowe pts/4 May 28 12:40 [login to view URL] jsalacus J. Salacus pts/3 May 21 12:21 [login to view URL] ragrawal Rajeev Agrawal pts/10 May 28 12:41 [login to view URL] harr4321 Winfred Harrelso pts/11 May 28 11:57 [login to view URL] ellis R. Stewart Ellis pts/12 May 19 13:45 [login to view URL] Note: 1. The difference between utmp and utmpx is that the utmpx also contains the name of the remote host for users who log in via the network. 2. You will use getutxent() function to read the next entry from utmpx file. Use man command to get help on this function. 3. I also recommend to have a look into . 4. You may find the full name of the user by accessing the comment field in pwd structure ( char *pw_gecos). See /etc/passwd file. 5. Here we are interested only in USER_PROCESS type entries. 6. The description of ut_type and ut_time fields: 7. Other fields are explained in the utmpx structure. ## Deliverables The record format for the utmpx file is described in the utmpx.h ( See in the directory /user/include) include file: struct utmpx { char ut_user[32]; /* user login name */ char ut_id[4]; /* inittab id */ char ut_line[32]; /* device name (console, lnxx) */ pid_t ut_pid; /* process id */ short ut_type; /* type of entry */ struct exit_status ut_exit; /* process termination/exit status */ struct timeval ut_tv; /* time entry was made */ int ut_session; /* session ID, used for windowing */ int pad[5]; /* reserved for future use */ short ut_syslen; /* significant length of ut_host */ /* including terminating null */ char ut_host[257]; /* remote host name */ }; struct exit_status { short e_termination; short e_exit; }; ut_type ------- EMPTY The record is empty RUN_LVL This record indicates a change in the system [login to view URL] new level can be determined from the ut_id field. BOOT_TIME A system boot. The time is recorded in the ut_time field. OLD_TIME A change in the system time with the date command. This record stores the time prior to the change. NEW_TIME A change in the system time with the date command. This record stores the time after the change. INIT_PROCESS A process spawned by init. The process' name is stored in ut_name,its process ID number is stored in ut_pid. LOGIN_PROCESS A process waiting for a user to login; there is usually one of these for each terminal connected to the system. USER_PROCESS A user login session. DEAD PROCESS A process that has exited. The exit status and return code are stored in ut_exit. ACCOUNTING An accounting record ( not implemented). ut_time ------- The time at which this record was last modified. 1) Complete and fully-functional working program(s) in executable form as well as complete source code of all work done. 2) Deliverables must be in ready-to-run condition, as follows? (depending on the nature? of the deliverables): a)? For web sites or? other server-side deliverables intended to only ever exist in one place in the Buyer's environment--Deliverables must be installed by the Seller in ready-to-run condition in the Buyer's environment. 3) All deliverables will be considered "work made for hire" under U.S. Copyright law. Buyer will receive exclusive and complete copyrights to all work purchased. (No GPL, GNU, 3rd party components, etc. unless all copyright ramifications are explained AND AGREED TO by the buyer on the site per the coder's Seller Legal Agreement). 4)Program must work on Solaris platform ## Platform Unix (Solaris)
N° de projet : 3126618

Concernant le projet

3 propositions
Projet à distance
Actif à il y a 20 ans

Cherchez-vous à gagner de l'argent ?

Avantages de faire une offre sur Freelancer

Fixez votre budget et vos délais
Soyez payé pour votre travail
Surlignez votre proposition
Il est gratuit de s'inscrire et de faire des offres sur des travaux
Décerné à :
Avatar de l'utilisateur
See private message.
$7 USD en 2 jours
5,0 (39 commentaires)
5,1
5,1
3 freelances proposent en moyenne $12 USD pour ce travail
Avatar de l'utilisateur
See private message.
$17 USD en 2 jours
0,0 (0 commentaires)
0,0
0,0
Avatar de l'utilisateur
See private message.
$12,75 USD en 2 jours
0,0 (0 commentaires)
0,0
0,0

À propos du client

Drapeau de UNITED STATES
United States
4,9
11
Membre depuis févr. 5, 2004

Vérification du client

Merci ! Nous vous avons envoyé un lien par e-mail afin de réclamer votre crédit gratuit.
Une erreur a eu lieu lors de l'envoi de votre e-mail. Veuillez réessayer.
Utilisateurs enregistrés Total des travaux publiés
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Chargement de l'aperçu
Permission donnée pour la géolocalisation.
Votre session de connexion a expiré et vous avez été déconnecté. Veuillez vous connecter à nouveau.