I'm trying to start developing a program using ncurses on Linux. I can't even get the Hello World example to compile. Here's the code:
#include <curses.h>
int
main()
{
initscr();
printw("Hello, world.");
refresh();
getch();
endwin();
return 0;
}
When I attempt to compile, I get:...
Now I want to create a netlink which is used to communicate between the user and kernel space. My Linux kernel version is 2.6.28. the following is my wrong code:
nf_sock=netlink_kernel_create(NL_PROTO,0,nl_user_skb,THIS_MODULE);
The error message is briefly as:
error: too few arguments to function 'netlink_kernel_creat'
In the file...
Is there a way to find the object files from which the current executable is generated in Linux (RHEL to be specific). I understand that one can use "nm" to find the exported symbols, "ldd" to find dependent shared object.
But I could not find command to find out the name of object (.o) files of which executable is composed of. Is it p...
I just can't figure out how do I make sure an argument passed to my script is a number or not.
All I want to do is something like this:
test *isnumber* $1 && VAR=$1 || echo "need a number"
Any help?
UPDATE:
I managed (whit Charles' help) to do it, but I'm not yet sure it's the best way to do that (even though it worked on my tests)....
I've recently heard a few people say that in Linux, it is almost always better to use processes instead of threads, since Linux is very efficient in handling processes, and because there are so many problems (such as locking) associated with threads. However, I am suspicious, because it seems like threads could give a pretty big perform...
I've got a application that makes a shell call out to the HPUX resetpw command. It doesn't exist in Linux. Is there another command with similar functionality I could reference from my code?
...
Hi all,
This is a very simple bash script i wrote:
#!/bin/bash
ITEM_LIST=items.txt
LOG_FILE=log.log
TOTAL_ITEMS=$(wc -l ${ITEM_LIST} | awk '{ print $1 }')
let NOT_FOUND=0
cat ${ITEM_LIST} | while read item; do
grep "${item}" ${LOG_FILE} > /dev/null
FOUND=${?}
if [ ${FOUND} -ne 0 ]; then
let NOT_FOUND=NOT_FOUND+1
...
In HPUX the command "machinfo" list machine information such as Number of CPUs, Clock speed, Bus speed, processor type, Cache information, total memory, and OS version information.
Is there an equivalent Linux utility?
...
Someone is FTPing a file of size 10Mb to folder on a linux server.
While the file is in transition a cron wakes up and fires off a Perl script that is designed to look at the ftp folder and move whatever it finds there to some alternate folder. I'm using the move() function from File::Copy. The Perl process actually renames the files as...
In a Linux environment, I need to detect the physical connected or disconnected state of an RJ45 connector to its socket. Preferably using BASH scripting only.
The following solutions which have been proposed on other sites do NOT work for this purpose:
Using 'ifconfig' - since a network cable may be connected but the network not pro...
This is a similar problem: Link
Which was solved by calling GetAsyncKeyState(). While all fine and dandy, I need a Linux alternative. I need to know if a button is being held down, not just being pressed (because of the keyboard buffer delay). Does anything like this exist in the OpenGL/Glut libraries, or will I have to look elsewhere?
...
Opening a gtk FileChooserDialog is painfully slow for nfs directories containing many files. strace shows a lot of time calling "stat". About 5 calls for each of the files in the directory. How can we switch off the calls to 'stat' and just show a list of filenames without the modification time?
We're using operating Redhat enterprise 4...
I often do the command such as:
mv folder $something_that_does_not_exist
mv files* $something_that_does_not_exist
Then, I realise that my files are gone. I cannot see them even in the folder "$something_that_does_not_exist". Where have my files and folders gone? How can I get them back?
...
Let's take an example. A "file1" -file has a content "file1", its own name. A "file2"-file has a content "file2", again its own name. The pattern continues until we have covered 77 files. What is the easiest way to do the 77 files?
Since I tend to have hard time in compiling, I sum up some details.
Intructions how to compile the codes
...
Is it possible to use shared object files in a portable way like DLLs in Windows??
I'm wondering if there is a way I could provide a compiled library, ready to use, for Linux. As the same way you can compile a DLL in Windows and it can be used on any other Windows (ok, not ANY other, but on most of them it can).
Is that possible in Lin...
I realize this sounds like something a malware program would do, so I understand if some of you are skeptical of my intentions. I would never do this for a program intended for other people's use, but I also realize other people might look at the answers and do it themselves.
My productivity goes way down when I am on the Internet, so I...
what should i learn as a programmer to write kernel like microsoft windows
i know c and c++ but what should i do to write kernel
is it necessary to know basics of kernel programming of linux
how to become expert in both linux and windows kernel prograaming
...
Hello,
I want to know when a new file is created on a specific directory, Instead of scanning the directory from time to time,
I understand that there is a way to make the O.S tell my program that a new file was created.
how does it work?
Thanks
Edit: as suggested below, this is similar to
http://stackoverflow.com/questions/61253/how...
This Linux Magazine article http://www.linux-mag.com/id/792 explains the difference in the way threads are implemented in Linux as compared to commercial Unixs such as Solaris. In summary, Linux uses a 1-to-1 mapping of user threads to kernel threads, while Solaris uses a many to many mapping. The article implies that this might give Sol...
I'm working on migrating to Amazon EC2 for our servers and need to try out internal DNS options. I'm looking for the equivalent of Tomcat (a standard well know easy to use servlet container) in the DNS area. BIND is the only one I'm familiar with by name, but I'm wondering if there are other "better" options or if that's the one I should...