Facebook Twitter

A Simple Terminal Emulator. One of the most basic needs when working in the embedded control industry is to comunicate with target processors. After migrating to Linux from MS-DOS, we searched in vain for a simple, light-weight terminal emulator program. Such a program is necessary to talk to target processors through the RS-232 ports commonly available in PC hosts. We developed xt to satisfy this need; it was initially derived from miniterm.c written by Sven Goldt. Features xt's main features are: small size and simple designportable to most Unix systemssupports up to 115200 bpscan be used with other Unix tools like expect and tee. Note that xt performs special processing on some input characters before sending them to the serial port: DEL is mapped to BACKSPACENEWLINE is mapped to CARRIAGE RETURNxt exits upon receiving ESC or EOFxt sends a line break upon receiving ^B Source You can find the source, makefile and man page here.

How to install xt Feedback We offer this project in the hopes that you will find it useful. Cs.brown.edu/people/twd/ThreadsPaper.pdf. Cplusplus.com - The C++ Resources Network. List module. This module provides functions for manipulating and iterating over lists of homogeneous data (or heterogeneous data if it's polymorphic).

Lists may own their items. Lists created with a non-null destroy function use that function to destroy an item when it is removed from the list and to destroy each item when the list itself is destroyed. Be careful not to insert items owned by one list into a list that doesn't own its own items unless you know that the source list (and all of the shared items) will outlive the destination list. List *list_create(list_release_t *destroy) Creates a List with destroy as its item destructor. List *list_make(list_release_t *destroy, ...) Creates a List with destroy as its item destructor and the remaining arguments as its initial items. List *list_vmake(list_release_t *destroy, va_list args) Equivalent to list_make(3) with the variable argument list specified directly as for vprintf(3). POSIX semaphores. Now it is time to take a look at some code that does something a little unexpected. The program threadadd.c creates two new threads, both of which increment a global variable called count exactly NITER, with NITER = 1,000,000.

But the program produces unexpected results. Exercise 1. Create a directory called posixsem in your class Unix directory. Download in this directory the code threadadd.c and compile it using gcc threadadd.c -o threadadd -lpthread Run the executable threadadd and observe the ouput. Quite unexpected! Threads can greatly simplify writing elegant and efficient programs. To understand what might happen, let us analyze this simple piece of code: THREAD 1 THREAD 2 a = data; b = data; a++; b--; data = a; data = b; Now if this code is executed serially (for instance, THREAD 1 first and then THREAD 2), there are no problems.

So data could end up +1, 0, -1, and there is NO WAY to know which value! Valgrind. The Valgrind tool suite provides a number of debugging and profiling tools that help you make your programs faster and more correct. The most popular of these tools is called Memcheck. It can detect many memory-related errors that are common in C and C++ programs and that can lead to crashes and unpredictable behaviour. The rest of this guide gives the minimum information you need to start detecting memory errors in your program with Memcheck. For full documentation of Memcheck and the other tools, please read the User Manual. 2. Compile your program with -g to include debugging information so that Memcheck's error messages include exact line numbers. 3. If you normally run your program like this: myprog arg1 arg2 Use this command line: valgrind --leak-check=yes myprog arg1 arg2 Memcheck is the default tool.

Your program will run much slower (eg. 20 to 30 times) than normal, and use a lot more memory. 4. Things to notice: Memory leak messages look like this: