In Linux you don't do this directly but you use library calls and macros provided with the OS (or compilers) both on the user land and on the system site.
The way it is done internally depends on the processor architecture. Of course using traps or "int" instructions is a usual way (in fact Kernel
2.6 uses "int" for older X86 processors and the newer "sysenter" instruction for new ones).
For self-made Kernel functions (I/O drivers etc.) you create device drivers in C. Same communicate with user land software via standard file I/O functions. Macros to install same and to move data from/to userland address space are provided with the Kernel and in userland they are available in any program language.
Read "Linux device drivers" by Rubini (available even online) to learn more.
-Michael