Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
Hello, all. Here is a snippet of kernel space code written to test read/write of an rs485 interface board. Ports 1 & 2 are connected via a loopback cable. System is Pentium 4 PC running RedHat 7.3
Seems simple. The loopback works fine when tempChar is initialized to a value between 0 and 0x7f. But when tempChar is 0x80 or greater, the subsequent read hangs forever. I am new to linux, so maybe I am missing something simple??? Thank you for any help you may provide.
1. I did make sure that the write was successful. I had some debug error messages that I omitted in this post.
2. I will check the buffering scheme... thanks.
Here is another piece of info:
The same code works fine when executed from userspace. Any char value gets successfully read back, even greater than 0x7f. Its just when executed from a kernel program that the read hangs. As you may already know, in order to execute a system call from kernelspace, the following steps have to be taken:
1. the directive __KERNEL_SYSCALLS__ must be included in the source file
2. set_fs(), get_fs(), get_ds() must be used appropriately to resolve any kernel/user addressing incompatibilities.
Also noticed that the read()/write() definitions in /usr/include/unistd.h (userspace) and /usr/src/linux/include/asm/unistd.h (kernelspace) differ slightly between files. One takes a 'void *' as the 2nd parameter, while the other takes a 'char *', or a 'const char *'. These definitions are included via the __KERNEL_SYSCALLS__ directive. Maybe this is why I can use values less than 0x7f, as well as any character string (since the highest ASCII value of any character is 0x7F) with successful results.