Computer Systems: A Programmer's Perspective (3rd Edition)
Computer Systems: A Programmer's Perspective (3rd Edition)
3rd Edition
ISBN: 9780134092669
Author: Bryant, Randal E. Bryant, David R. O'Hallaron, David R., Randal E.; O'Hallaron, Bryant/O'hallaron
Publisher: PEARSON
Question
Book Icon
Chapter 11, Problem 11.13HW
Program Plan Intro

IP addresses:

  • The IP address denotes an unsigned integer that is 32-bit.
  • The IP addresses is been stored by network programs in IP address structure.
  • The addresses present in IP address structure are stored in network byte order.
  •  An unsigned 32-bit integer is transformed from host byte order to network byte order by “htonl” function.
  • An unsigned 32-bit integer is transformed from network byte order host byte order by “ntohl” function.
  • The IP address is presented to humans in a form known as “dotted-decimal” notation.
    • Each byte is been represented by its corresponding decimal value and is separated by a period from other bytes.

Passing program arguments to server:

  • The arguments for “GET” requests are passed in the URI.
  • The character “?” separates filename from the arguments.
  • The character “&” separates each argument.
  • The arguments do not allow spaces in it.

Server passes arguments to child:

  • The server calls “fork” to create a child process and calls “execve” to run program in child’s context once it receives a request.
  • The child process sets CGI environment variable values.
  • The “adder” program can reference it at run time using “getenv” function of linux.

Output is sent by child:

  • The dynamic content of a CGI program is to be sent to standard output.
  • A CGI program sends dynamic content to standard output.
  • It uses “dup2” function for redirecting standard output to connected descriptor associated with client.
  • The result written to standard output by CGI program, it goes directly to client.

Blurred answer
Students have asked these similar questions
Write a program that scans all directories in a UNIX file system and finds and locates all i-nodes with a hard link count of two or more. For each such file, it lists together all file names that point to a file. Explain the key steps in your code and suggest one alternative approach.
Write a device driver for a character device which implements a simple way of message passing. The kernel maintains a list of messages. To limit memory usage, we impose a limit of 4KB = 4*1024 bytes for each message and also impose a limit of the  total number of messages stored in the kernel, which is 1000. Your device driver should perform the following operations: * When the module is loaded, the device is created. An empty list of messages is created as well. * Removing the module deallocates all messages, removes the list of messages and removes the device. * Reading from the device returns one message, and removes this message from the kernel list. If the list of messages is empty, the reader returns -EAGAIN. * Writing to the device stores the message in kernel space and adds it to the list if the message is below the maximum size, and the limit of the number of all messages stored in the kernel  wouldn't be surpassed with this message. If the message is too big, -EINVAL is…
Write a C program that scans all directories in a UNIX file system and finds and locates all i-nodes with a hard link count of two or more. For each such file, it lists together all file names that point to a file. Explain the key steps in your code and suggest one alternative approach.
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education