I want to split output of who command and store output in variable EX. I want to split this output like Answer The following should work: Giving:
WIFSTOPPED is not working properly
I am trying to implement the fg command in my mini shell. The problem is as follows: A process(gedit) is started in foreground. I stop with ctrl+z and check exit my wait loop by checking the return value of WIFSTOPPED(status): I want this to resume when fg command is given: But WIFSTOPPED keeps returning non …
Connect to remote MS Access database from Linux Server using PHP
Does anyone know if it’s possible to connect and query an MS Access database from a Linux Server using PHP? If it is possible I’m thinking install ODBC driver on the Linux server, but will it work to connect to Access is the question. I’ve read it’s possible with MSSQL. My knowledge is…
C – Linux Kernel – Assistance with current_uid()
I have been working on part of an assignment which I am having trouble fixing. The requirement was to intercept the system call open and to replace it with a new system open call only for regular users and would print out the user id and filename in the system log. Otherwise it would just execute the standard…
Merge XML files and delete duplicate rows
I’m using the following script to merge XML files. There are 5 different XML file types, ItemAvailability.xml, ItemUpsert.xml, ItemCatDesc.xml, ItemPrice.xml and ItemDelete.xml. How can I have the same script remove duplicate rows from the combined XML files? I really only need the duplicates removed fr…
Understanding the msghdr structure from sys/socket.h
I’m trying to understand the following members of the msghdr structure of the sys/socket.h lib. struct iovec *msg_iov scatter/gather array void *msg_control ancillary data, see below It states below: Ancillary data consists of a sequence of pairs, each consisting of a cmsghdr structure followed by a dat…
kernel submit checklist “Any new or modified CONFIG options don’t muck up the config menu”?
In kernel submit checklist rule “Any new or modified CONFIG options don’t muck up the config menu” does this mean we should not add new or modify exiting config options that appear in make menuconfig options ? Please correct my understanding ? Answer It means that you should be careful when …
In Unix, how to display welcome message if user has logged in from a particular IP (or host)?
I want to display one message if user XYZ has logged in from any IP (or host). Answer Check to see if you have environment variables such as SSH_CLIENT and SSH_CONNECTION set. If so, you can access these from scripts (perl, bash, etc…) to dynamically generate a welcome message. Below, is a simple perl s…
Android file permissions on Android 6.0
I want to list files and directories under “/proc” in Android. When running as my application process, many files are not readable. If I list the directory as the shell user I get the following output: If I list the the directory as my app process (using run-as [PACKAGE_NAME]): Obviously, the file…
Signal and output in c
Some time ago I found this exercise in C: without changing the main function, so that receiving a SIGUSR1 signal output is directed and added to a file in append mode as the first parameter. At the reception of another SIGUSR1 the output is directed to the console, and so on. How do such an exercise? Answer I…