#include &#34;stdio.h&#34;
#include &#34;sys/socket.h&#34;
#include &#34;sys/errno.h&#34;
#include &#34;stdlib.h&#34;
#include &#34;string.h&#34;
#include &#34;unistd.h&#34;
#include &#34;arpa/inet.h&#34;
#include &#34;sys/utsname.h&#34;
#include &#34;sys/sysctl.h&#34;

#define FAILURE -1
#define SUCCESS 0

// prints the operating system version information
static void print_host_details() {
    // print OS version
    char os_prod_version[100];
    size_t len = sizeof(os_prod_version);
    int ret = sysctlbyname(&#34;kern.osproductversion&#34;, os_prod_version, &amp;len, NULL, 0);
    if (ret != 0) {
        perror(&#34;failed to get MacOS version&#34;);
    } else {
        fprintf(stderr, &#34;MacOS version: %s\n&#34;, os_prod_version);
    }

    // print the kernel info
    struct utsname kernel_info;
    ret = uname(&amp;kernel_info);
    if (ret != 0) {
        perror(&#34;failed to get kernel info&#34;);
    } else {
        fprintf(stderr, &#34;Kernel version: %s\n&#34;, kernel_info.version);
    }
}

/*
 * Creates a socket() and then calls setsockopt() for the SO_LINGER option, with
 * various different values and examines the return value of that call.
 */
int main() {
	fprintf(stderr, &#34;-----------------------\n&#34;);
	print_host_details();
	fprintf(stderr, &#34;-----------------------\n&#34;);

	// create a socket
	int socket_fd = socket(PF_INET, SOCK_STREAM, 0);
	if (socket_fd &lt; 0) {
		fprintf(stderr, &#34;failed to create socket, reason=%s\n&#34;, strerror(errno));
		return FAILURE;
	}
	// setsockopt() for SO_LINGER with different values
	const int vals[] = {
		10, 42, 1024, 32767, 32768, 65535, 65536, (65536 + 42)
	};	
	for (int i = 0; i &lt; sizeof(vals) / sizeof(int); i++) {
		const int val = vals[i];
		struct linger linger;
    	linger.l_onoff = 1;
    	linger.l_linger = val;
    	const int r = setsockopt(socket_fd, SOL_SOCKET, SO_LINGER, &amp;linger, sizeof(linger));
		if (r != 0) {
			fprintf(stderr, &#34;FAILURE - failed to set SO_LINGER to value %d, reason: %s\n&#34;, val, strerror(errno));
		} else {
			fprintf(stderr, &#34;SUCCESS - set SO_LINGER to value %d\n&#34;, val);
		}
	}
	close(socket_fd);
	return SUCCESS;
}