Tutorials: http://www.ecst.csuchico.edu/~beej/guide/ http://www.geocities.com/chuidiang/ http://en.wikipedia.org/wiki/Inter-process_communication ---------------- IPC APIs: shmget(), shmctl(), shmat(), shmdt() msgget(), msgctl(), msgsnd(), msgrcv() semget(), semctl(), semop() ftok(); Command line tools: ipcs, ipcrm, ipcclean -------------------------------- Also, Posix Semaphores: sem_close(3), sem_destroy(3), sem_init(3), sem_getvalue(3), sem_open(3), sem_post(3), sem_unlink(3), sem_wait(3) see: man sem_overview -------------------------------- Also, Posix Shared Memory: shm_open(3), shm_unlink(3), mmap(2) -------------------------------- Also, Posix message queues: mq_send(3), mq_timedsend(3), mq_close(3), mq_getattr(3), mq_notify(3), mq_open(3), mq_receive(3), mq_unlink(3), see: man mq_overview --------------- dbus, used for CUPS, other projects http://freedesktop.org/Software/dbus/ ---------------- Message passing www.mcs.anl.gov/mpi ---------------- pipes: pipe(), read(), write(), dup() ---------------- FIFOs (named pipes) mknod("myfifo", S_IFIFO | 0644 , 0); read(), write(), open(), close() ---------------- File Locking: flock(), lockf(), fcntl() ---------------- Memory mapped files: mmap(), munmap(), msync(), open(), close() ---------------- Sockets: socket(), accept(), bind(), connect(), listen(), read(), recv(), recvfrom(), select(), send(), sendto(), shutdown(), write(), getprotoent(), socket(), getsockname(), getpeername(), close(), shutdown(), getsockopt(), setsockopt(), inet_ntoa inet_aton(), inet_addr(), inet_network(), inet_ntoa(), inet_makeaddr(), inet_lnaof(), inet_netof() gethostname(), gethostbyname(), gethostbyaddr(), getservbyname(), getservbyport() You can do a flush with tcflush (man tcflush) and use the flags you need. Ex: tcflush(socket,TCIFLUSH); ---------------- processes fork(), exec(), getpid(), getppid(), wait(), waitpid() ---------------- threads pthread_create(), pthread_exit(), pthread_self() pthread_join(), pthread_detach(), pthread_attr_init() pthread_setschedparam(), pthread_getschedparam() pthread_equal() pthread_cleanup_push(), pthread_cleanup_pop() pthread_sigmask(), pthread_kill(), sigwait() gettid() clone() ---------------- makefiles make, autoconf, automake, autoreconf, autoupdate, autoheader, autoscan, config.guess, config.sub, ifnames, libtool Most Open Source software projects use a 'configure' script to configure their software for compilation. This script is produced by tools called 'autoconf' and 'automake', which processes 'm4' macros written by the application developer. The script will generate the Makefiles that are used for building the software and a 'config.h' header file containing defines for features found on the build system. Configure is meant to ease configuring the software for compilation and its default assumption is that the software will be run in the same environment and processor in which it was compiled in and run from the place where it was installed to. ---------------- shared objects g++ -o libshared.so -shared shrobj.o shrobj2.o g++ -fPIC -g -c -Wall b.c g++ -fpic -c shrobj2.cpp export LD_LIBRARY_PATH=./ Or, better yet, specify the full path or a relative path to the shared object on the command line. /etc/ld.so.conf ldd, ldconfig, lsof, objdump, nm, readelf, ld.so http://en.wikipedia.org/wiki/Executable_and_Linkable_Format http://en.wikipedia.org/wiki/Position_independent_code http://en.wikipedia.org/wiki/Plugin http://en.wikipedia.org/wiki/Shared_library ---------------- dynamic shared objects http://www.linuxforum.com/apache/dso.html http://virtus.ath.cx/texts/dl.html #include dlclose(), dlerror(), dlopen(), dlsym() Important flag for dlopen() is RTLD_GLOBAL if you want following programs to be able to access the symbols in the file you load. Also, if you want your functions loaded dynamically to be able to load the symbols in your program, you MUST link with the -rdynamic flag. Maybe not true for all compilers / platforms?? ar(1), nm(1), objcopy(1), objdump(1), readelf(1) http://www-128.ibm.com/developerworks/aix/library/au-unixtools.html?ca=dgr-lnxw09ExpObjectFiles The problem of mangled names: http://www.linux.com/howtos/C++-dlopen/theproblem.shtml Really, to create objects for C++, you need to create "class factory functions". Each function would return a pointer to a class that is a sub-class of a virtual base class. You should use virtual destructors if clean up is needed. Also, consider creating a class factor function that loads a "class factory object". The class factory object would have functions for creating an object, as well as information about the underlying object. In this manner, you class factory object tells you program how to interact with the new objet type. export LD_LIBRARY_PATH=./ Or, better yet, specify the FULL path (starts with '/'), or a relative path (starts with './') to the shared object when you call dlopen. ---------------- signals #include kill(), raise(), sigaction(), sigprocmask(), sigpending(), sigsuspend(), pause(), killpg(), sigaltstack(), siginterrupt(), command line: kill #include longjmp(), siglongjmp(), setjmp(), sigsetjmp() #define SIGHUP 1 /* Hangup (POSIX). */ #define SIGINT 2 /* Interrupt (ANSI). */ #define SIGQUIT 3 /* Quit (POSIX). */ #define SIGILL 4 /* Illegal instruction (ANSI). */ #define SIGTRAP 5 /* Trace trap (POSIX). */ #define SIGABRT 6 /* Abort (ANSI). */ #define SIGIOT 6 /* IOT trap (4.2 BSD). */ #define SIGBUS 7 /* BUS error (4.2 BSD). */ #define SIGFPE 8 /* Floating-point exception (ANSI). */ #define SIGKILL 9 /* Kill, unblockable (POSIX). */ #define SIGUSR1 10 /* User-defined signal 1 (POSIX). */ #define SIGSEGV 11 /* Segmentation violation (ANSI). */ #define SIGUSR2 12 /* User-defined signal 2 (POSIX). */ #define SIGPIPE 13 /* Broken pipe (POSIX). */ #define SIGALRM 14 /* Alarm clock (POSIX). */ #define SIGTERM 15 /* Termination (ANSI). */ #define SIGSTKFLT 16 /* Stack fault. */ #define SIGCLD SIGCHLD /* Same as SIGCHLD (System V). */ #define SIGCHLD 17 /* Child status has changed (POSIX). */ #define SIGCONT 18 /* Continue (POSIX). */ #define SIGSTOP 19 /* Stop, unblockable (POSIX). */ #define SIGTSTP 20 /* Keyboard stop (POSIX). */ #define SIGTTIN 21 /* Background read from tty (POSIX). */ #define SIGTTOU 22 /* Background write to tty (POSIX). */ #define SIGURG 23 /* Urgent condition on socket (4.2 BSD). */ #define SIGXCPU 24 /* CPU limit exceeded (4.2 BSD). */ #define SIGXFSZ 25 /* File size limit exceeded (4.2 BSD). */ #define SIGVTALRM 26 /* Virtual alarm clock (4.2 BSD). */ #define SIGPROF 27 /* Profiling alarm clock (4.2 BSD). */ #define SIGWINCH 28 /* Window size change (4.3 BSD, Sun). */ #define SIGPOLL SIGIO /* Pollable event occurred (System V). */ #define SIGIO 29 /* I/O now possible (4.2 BSD). */ #define SIGPWR 30 /* Power failure restart (System V). */ #define SIGSYS 31 /* Bad system call. */ #define SIGUNUSED 31 #define _NSIG 65 /* Biggest signal number + 1 ---------------- variable parameters in C va_start va_end see vprintf(), vsnprintf(), vfprintf() --------------- Resource Limits int getrlimit(int resource, struct rlimit *rlim); int getrusage(int who, struct rusage *usage); int setrlimit(int resource, const struct rlimit *rlim); --------------- Time Functions time_t time(time_t *t); int gettimeofday(struct timeval *tv, struct timezone *tz); int settimeofday(const struct timeval *tv, const struct timezone *tz); unsigned int sleep(unsigned int seconds); void usleep(unsigned long usec); int nanosleep(const struct timespec *req, struct timespec *rem); struct tm *localtime_r(const time_t *timep, struct tm *result); time_t mktime(struct tm *tm); size_t strftime(char *s, size_t max, const char *format, const struct tm *tm); char *strptime(const char *s, const char *format, struct tm *tm); int clock_getres(clockid_t clk_id, struct timespec *res); int clock_gettime(clockid_t clk_id, struct timespec *tp); int clock_settime(clockid_t clk_id, const struct timespec *tp); int sched_setscheduler(pid_t pid, int policy, const struct sched_param *p); int sched_getscheduler(pid_t pid); int timer_create(clockid_t clockid, struct sigevent *restrict evp, timer_t *restrict timerid); --------------- RPC --------------- Debugging gdb strace ---------------