UNIX PROGRAMMING FAQ

UNIX PROGRAMMING FAQ

  • What does fork() do?

    What does fork() do? #include #include

  • What's the difference between fork() and vfork()?

    What's the difference between fork() and vfork()? Some systems have a system call

  • Why use _exit rather than exit in the child branch of a fork?

    Why use _exit rather than exit in the child branch of a fork? There are a few dif

  • Creating new processes: fork()

    Creating new processes: fork()

  • What's the return value of system/pclose/waitpid?

    What's the return value of system/pclose/waitpid? The return value of

  • How do I find out about a process' memory usage?

    How do I find out about a process' memory usage? Look at getrusage() , if availa

  • Why do processes never decrease in size?

    Why do processes never decrease in size? When you free memory back to the heap wi

  • How do I change the name of my program (as seen by `ps')?

    How do I change the name of my program (as seen by `ps')? On BSDish systems, the

  • So where do I put my configuration files then?

    So where do I put my configuration files then? The correct directory for this usu

  • How can I find a process' executable file?

    How can I find a process' executable file? This would be a good candidate for a l

  • Why doesn't my process get SIGHUP when its parent dies?

    Why doesn't my process get SIGHUP when its parent dies? Because it's not supposed

  • How can I kill all descendents of a process?

    How can I kill all descendents of a process? There isn't a fully general approach

  • How can I get/set an environment variable from a program?

    How can I get/set an environment variable from a program? Getting the value of an

  • How can I read the whole environment?

    How can I read the whole environment? If you don't know the names of the environm

  • Environment variables

    Environment variables

  • How can I sleep for less than a second?

    How can I sleep for less than a second? The sleep() function, which is availabl

  • How can I get a finer-grained version of alarm()?

    How can I get a finer-grained version of alarm()? Modern Unixes tend to implement

  • How can a parent and child process communicate?

    How can a parent and child process communicate? A parent and child can communicat

  • What is a zombie?

    What is a zombie? When a program forks and the child finishes before the parent,

  • How do I prevent them from occuring?

    How do I prevent them from occuring? You need to ensure that your parent process

  • How do I get rid of zombie processes?

    How do I get rid of zombie processes?

  • How do I get my program to act like a daemon?

    How do I get my program to act like a daemon? A daemon process is usually defin

  • How can I look at process in the system like ps does?

    How can I look at process in the system like ps does? You really don't want to

  • Given a pid, how can I tell if it's a running program?

    Given a pid, how can I tell if it's a running program? Use kill() with 0 for th

  • How do I use select()?

    How do I use select()? The interface to select() is primarily based on the conc

  • How do I use poll()?

    How do I use poll()? poll() accepts a pointer to a list of struct pollfd , in

  • Can I use SysV IPC at the same time as select or poll?

    Can I use SysV IPC at the same time as select or poll? No. (Except on AIX, whic

  • How to manage multiple connections?

    How to manage multiple connections? I have to monitor more than one (f

  • What is a named pipe?

    What is a named pipe? A named pipe is a special file that is used to transfer d

  • How do I create a named pipe?

    How do I create a named pipe? To create a named pipe interactively, you'll use ei

  • How do I use a named pipe?

    How do I use a named pipe? To use the pipe, you open it like a normal file, and u

  • Can I use a named pipe across NFS?

    Can I use a named pipe across NFS? No, you can't. There is no facility in the NFS

  • Can multiple processes write to the pipe simultaneously?

    Can multiple processes write to the pipe simultaneously? If each piece of data wr

  • Using named pipes in applications

    Using named pipes in applications How can I implement two way communic

  • What can I do with named pipes (FIFOs)?

    What can I do with named pipes (FIFOs)?

  • How can I tell when the other end of a connection shuts down?

    How can I tell when the other end of a connection shuts down? If you try to read

  • Best way to read directories?

    Best way to read directories? While historically there have been several differen

  • How can I find out if someone else has a file open?

    How can I find out if someone else has a file open? This is another candidate for

  • How do I `lock' a file?

    How do I `lock' a file? There are three main file locking mechanisms available. A

  • How do I find out if a file has been updated by another process?

    How do I find out if a file has been updated by another process? This is close to

  • How does the `du' utility work?

    How does the `du' utility work? du simply traverses the directory structure cal

  • How do I find the size of a file?

    How do I find the size of a file? Use stat() , or fstat() if you have the file

  • How do I expand `~' in a filename like the shell does?

    How do I expand `~' in a filename like the shell does? The standard interpretatio

  • How can I make my program not echo input?

    How can I make my program not echo input? How can I make my program no

  • How can I read single characters from the terminal?

    How can I read single characters from the terminal? How can I read sin

  • How can I check and see if a key was pressed?

    How can I check and see if a key was pressed? How can I check and see

  • How can I move the cursor around the screen?

    How can I move the cursor around the screen? How can I move the cursor

  • What are pttys?

    What are pttys? Pseudo-teletypes (pttys, ptys, other variant abbreviations) are

  • Serial device names and types

    Serial device names and types The device names used for serial port devices vary

  • Setting up termios flags

    Setting up termios flags Some hints on setting up the termios flags when using a

  • How to handle a serial port or modem?

    How to handle a serial port or modem? The handling of serial devices under Unix i

  • How can I tell how much memory my system has?

    How can I tell how much memory my system has? This is another `Frequently Unanswe

  • How do I get a user's password?

    How do I get a user's password? Traditionally user passwords were kept in the `/

  • How do I get shadow passwords by uid?

    How do I get shadow passwords by uid? My system uses the getsp* suite

  • How do I verify a user's password?

    How do I verify a user's password? The fundamental problem here is, that various

  • How do I check a user's password?

    How do I check a user's password?

  • How do I compare strings using filename patterns?

    How do I compare strings using filename patterns? Unless you are unlucky, your sy

  • How do I compare strings using regular expressions?

    How do I compare strings using regular expressions? There are a number of slightl

  • How do I compare strings using wildcards?

    How do I compare strings using wildcards? The answer to that depends on what ex

  • The simple method: /bin/mail

    The simple method: /bin/mail For simple applications, it may be sufficient to inv

  • Invoking the MTA directly: /usr/lib/sendmail

    Invoking the MTA directly: /usr/lib/sendmail The mail program is an example of

  • What's the best way to send mail from a program?

    What's the best way to send mail from a program? There are several ways to send e

  • How can I debug the children after a fork?

    How can I debug the children after a fork? Depending on the tools available there

  • How to build library from other libraries?

    How to build library from other libraries? Assuming we're talking about an archiv

  • How to create shared libraries / dlls?

    How to create shared libraries / dlls? The precise method for creating shared lib

  • Can I replace objects in a shared library?

    Can I replace objects in a shared library? Generally, no. On

  • How can I generate a stack dump from within a running program?

    How can I generate a stack dump from within a running program? Some systems provi

  • Credits

    $Id: rawfaq.texi,v 1.37 2000/09/01 06:34:57 andrew Exp $



    Home FAQ