Week 09 Lab 2

.docx

School

University of Texas, Dallas *

*We aren’t endorsed by this school

Course

3377

Subject

Computer Science

Date

May 8, 2024

Type

docx

Pages

6

Uploaded by CoachSparrowMaster99 on coursehero.com

Week 09 Lab 02 Muhammad login as: axm210331 Pre-authentication banner message from server: | University of Texas at Dallas | Department of Computer Science | | Use of UTD Information Systems is subject to | the UTD Information Security and Acceptable Use Policy. | | Pursuant to Texas Administrative Code 202: | (1) Unauthorized use is prohibited; | (2) Usage may be subject to security testing and monitoring; | (3) Misuse is subject to criminal prosecution; and | (4) No expectation of privacy except as otherwise provided by applicable | privacy laws. | | ATTENTION: utdnetid != utdnetid@utdallas.edu (UTD != Google!) | | Just use utdnetid, and for the love of programming, STOP USING ALL CAPS! | | [[NOTE: All CS Graduate Students should use csgrads1.utdallas.edu ]] | [[ If you are a CS Graduate Student, you cannot logon to this server.]] | | | ***** This system will require a connection to the GlobalProtect VPN startin > g | on the following dates: | | cslinux1.utdallas.edu - June 15, 2020 | cslinux2.utdallas.edu - June 22, 2020 | | ***** GlobalProtect VPN Instructions: https://www.utdallas.edu/oit/howto/vpn > / | End of banner message from server Keyboard-interactive authentication prompts from server: End of keyboard-interactive prompts from server +----------------------------------------------------------------------+ MobaXterm Personal Edition v23.2 (SSH client, X server and network tools) ? SSH session to axm210331@cslinux1.utdallas.edu Direct SSH : ?
SSH compression : ? SSH-browser : ? X11-forwarding : ? (remote display is forwarded through SSH) ? For more info, ctrl+click on help or visit our website. +----------------------------------------------------------------------+ Last login: Fri Oct 20 22:50:54 2023 from 10.50.240.241 ***---***---***---***---***---*** csgrads1.utdallas.edu - CentOS Linux 7.9 --All CS Graduate Students should use csgrads1-- cs1.utdallas.edu - CentOS Linux 7.9 cs2.utdallas.edu - CentOS Linux 7.9 ***---***---***---***---***---*** This system is for use by CS students who need a general purpose Linux system to complete homework assignments. Computationally or resource intensive simulations will be throttled automatically. Thank you, CS Lab Manager cs-labs@utdallas.edu /scratch disk space can be used for temporary files. All files within /scratch will be erased on a regular basis (Sunday 0300). {cslinux1:~} whoami axm210331 {cslinux1:~} date Fri Oct 20 23:52:29 CDT 2023 {cslinux1:~} ls abc.txt dog lab1 pwd w5l1 Week05Lab2 welcome.c a.out first.txt lab2 sample.txt w5l2 week07Lab1 welcome.h apue hello lab3 scriptForNew w6l1 week07Lab2 welcome.h.gch cat.txt hello(2).c Makefile script.sh w7l1 week08Lab01 ch4lab1 hello(3).c new.txt short w7l2 week09Lab01 ch4lab2 hello.c perl5 typescript Week05Lab1 Week4Lab1 data.txt hey practice Untitled.txt Week05Lab12 week4lab2 days hey.txt public_html w4l1 Week05Lab13 week5lab1 {cslinux1:~} cd week09Lab02 {cslinux1:~/week09Lab02} script w9l2 Script started, file is w9l2 {cslinux1:~/week09Lab02} ls
w9l2 a)Program Startup / Building {cslinux1:~/week09Lab02} vi shell22.c {cslinux1:~/week09Lab02} gedit shell22.c ** (gedit:48765): WARNING **: 23:53:47.652: Set document metadata failed: Setting attribute metadata::gedit-spell-language not supported ** (gedit:48765): WARNING **: 23:53:47.653: Set document metadata failed: Setting attribute metadata::gedit-encoding not supported ** (gedit:48765): WARNING **: 23:53:50.032: Set document metadata failed: Setting attribute metadata::gedit-position not supported {cslinux1:~/week09Lab02} cat shell22.c #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <signal.h> #include <string.h> int alarm_duration = 0; // Signal handler for SIGINT (Ctrl+C) void mysig_handler(int signo) { printf("\n ** This is the message from week09 lab2 - Signal Handler! ** \n"); } // Signal handler for timer-alarm void alarm_handler(int signo) { if (alarm_duration > 0) { printf("\nAlarm set for %d seconds has expired. Exiting.\n", alarm_duration); exit(0); } } int main() { struct sigaction sa; sa.sa_handler = mysig_handler; sigaction(SIGINT, &sa, NULL); sa.sa_handler = alarm_handler; sigaction(SIGALRM, &sa, NULL); while (1) {
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help