README 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. QUICK AND DIRTY
  2. ===============
  3. Execute the following from the src/ directory:
  4. ./configure # try to figure out all implementation differences
  5. cd lib # build the basic library that all programs need
  6. make # use "gmake" everywhere on BSD/OS systems
  7. cd ../libfree # continue building the basic library
  8. make
  9. # note the following two lines are not needed on Linux systems
  10. cd ../libroute # only if your system supports 4.4BSD style routing sockets
  11. make # only if your system supports 4.4BSD style routing sockets
  12. cd ../intro # build and test a basic client program
  13. make daytimetcpcli
  14. ./daytimetcpcli 127.0.0.1
  15. If all that works, you're all set to start compiling individual programs.
  16. Notice that all the source code assumes tabs every 4 columns, not 8.
  17. MORE DETAILS
  18. ============
  19. 5. If you need to make any changes to the "unp.h" header, notice that it
  20. is a hard link in each directory, so you only need to change it once.
  21. 6. Go into the "lib/" directory and type "make". This builds the library
  22. "libunp.a" that is required by almost all of the programs. There may
  23. be compiler warnings (see NOTES below). This step is where you'll find
  24. all of your system's dependencies, and you must just update your cf/
  25. files from step 1, rerun "config" and do this step again.
  26. 6. Go into the "libfree/" directory and type "make". This adds to the
  27. "libunp.a" library. The files in this directory do not #include
  28. the "unp.h" header, as people may want to use these functions
  29. independent of the book's examples.
  30. 8. Once the library is made from steps 5 and 6, you can then go into any
  31. of the source code directories and make whatever program you are
  32. interested in. Note that the horizontal rules at the beginning and
  33. end of each program listing in the book contain the directory name and
  34. filename.
  35. BEWARE: Not all programs in each directory will compile on all systems
  36. (e.g., the file src/advio/recvfromflags.c will not compile unless your
  37. system supports the IP_RECVDSTADDR socket option). Also, not all files
  38. in each directory are included in the book. Beware of any files with
  39. "test" in the filename: they are probably a quick test program that I
  40. wrote to check something, and may or may not work.
  41. NOTES
  42. -----
  43. - Many systems do not have correct function prototypes for the socket
  44. functions, and this can cause many warnings during compilation.
  45. For example, Solaris 2.5 omits the "const" from the 2nd argument
  46. to connect(). Lots of systems use "int" for the length of socket
  47. address structures, while Posix.1g specifies "size_t". Lots of
  48. systems still have the pointer argument to [sg]etsockopt() as a
  49. "char *" instead of a "void *", and this also causes warnings.
  50. - SunOS 4.1.x: If you are using Sun's acc compiler, you need to run
  51. the configure program as
  52. CC=acc CFLAGS=-w CPPFLAGS=-w ./configure
  53. Failure to do this results in numerous system headers (<sys/sockio.h>)
  54. not being found during configuration, causing compile errors later.
  55. - If your system supports IPv6 and you want to run the examples in the
  56. book using hostnames, you must install the latest BIND release. You
  57. can get it from ftp://ftp.vix.com/pub/bind/release. All you need from
  58. this release is a resolver library that you should then add to the
  59. LDLIBS and LDLIBS_THREADS lines.
  60. - IPv6 support is still in its infancy. There may be differences
  61. between the IPv6 sockets API specifications and what the vendor
  62. provides. This may require hand tweaking, but should get better
  63. over time.
  64. - If your system supports an older draft of the Posix pthreads standard,
  65. but configure detects the support of pthreads, you will have to disable
  66. this by hand. Digital Unix V3.2C has this problem, for example, as it
  67. supports draft 4, not the final draft.
  68. To fix this, remove wrappthread.o from LIB_OBJS in "Make.defines" and
  69. don't try to build and run any of the threads programs.
  70. COMMON DIFFERENCES
  71. ------------------
  72. These are the common differences that I see in various headers that are
  73. not "yet" at the level of Posix.1g or X/Open XNS Issue 5.
  74. - getsockopt() and setsockopt(): 5th argument is not correct type.
  75. - t_bind(): second argument is missing "const".
  76. - t_connect(): second argument is missing "const".
  77. - t_open(): first argument is missing "const".
  78. - t_optmsmg(): second argument is missing "const".
  79. - If your <xti.h> defines the members of the t_opthdr{} as longs,
  80. instead of t_uscalar_t, some of the printf formats of these value
  81. might generate warnings from your compiler, since you are printing
  82. a long without a corresponding long format specifier.