# 1. task - logging daemon (C) In the first task you have to implement logging daemon. It is a simple program which is taking care of system logs on the Linux System. What it does: - it creates(owns) unix socket /dev/log with a read and writes perms for anybody - it parses the command line arguments as file names - it reads logs from the socket and write them to the files provided on the command line - it prints logs to STDOUT as well - it runs under root - it detects duplicate logs - it handles SIGINT therefore it prints the most frequent message before exit - it accepts -f option so that it forks itself to the background - when using -f it writes /var/run/logging-daemon.pid file with its PID after forking - it removes /var/run/logging-daemon.pid when it is killed Project should be available on github/gilab repository. It should use cmake. Useful Info: For start it useful to look at rsyslog. The link for inspiration see: createLogSocket() : https://github.com/rsyslog/rsyslog/blob/master/plugins/imuxsock/imuxsock.c On Fedora: # dnf install rsyslog # systemctl start rsyslog - logging daemon - reads from /dev/log and writes to /var/log/messages Using logger command: $ logger - logging of message(writing to the /dev/log socket) - after logging of message, message should be available in /var/log/messages (in case rsyslog is running) Before running your own program: # systemctl stop rsyslog # systemctl stop systemd-journald # unlink /dev/log Actual run: $ sudo ./logging-daemon /tmp/output1.log /tmp/output2.log /tmp/output3.log [sudo] password for rsroka: <13>May 14 19:02:59 rsroka: some message <13>May 14 19:03:07 rsroka: some message <13>May 14 19:03:07 rsroka: some message <13>May 14 19:03:08 rsroka: some message <13>May 14 19:03:14 rsroka: some other message <13>May 14 19:03:15 rsroka: some other message 4 --> rsroka: some message The END! Meanwhile: $ logger some message $ logger some message $ logger some message $ logger some message $ logger some other message $ logger some other message # 2. task - C++ buffer (C++) Project should be available on github/gilab repository. It should use cmake. - it is simple program in C++ - it reads from STDIN multiple commands Commands: exit - after reading program dies value:priority - value is integer - priority is integer - save the value to the buffer so it is ordered by priority - if there are two same priorities they will be stored in order they come print - it prints buffer to STDOUT get - it prints the first element of the buffer remove - it removes the first element of the buffer # Please send a link to the repositories to rsroka(at)redhat.com. # Repositories have to be public # If any questions feel free to contact me via email or IRC - rsroka on #freenode. # https://github.com/radosroka