Posted-By: auto-faq 3.3 (Perl 5.005) Archive-name: aix-faq/part5 Revision: 1.14 2000/01/04 02:34:26 Posting-Frequency: monthly ------------------------------ Subject: 6.05 What publications are available for AIX and RS/6000? Publications list: http://www.rs6000.ibm.com/resource/aix_resource/Pubs/ AIXpert magazine: http://www.developer.ibm.com/library/aixpert/ AIXpert IBM Corporation Mail Stop 36 472 Wheelers Farms Road Milford, CT 06460 FAX: (203) 783-7669 These manuals should be available from your favorite IBM office. SC23-2204-02 Problem Solving Guide SC23-2365-01 Performance Monitoring and Tuning Guide for AIX 3.2 SA23-2629-07 Service Request Number Cross Reference, Ver 2.2 SA23-2631-05 Diagnostic Programs: Operator Guide SA23-2632-05 Diagnostic Programs: Service Guide SA23-2643-01 Hardware Technical Reference: General Information SA23-2646-01 Hardware Technical Reference: Options and Devices IBM's International Technical Support Center produces redbooks - practical, how-to manuals - on a wide range of technical topics including AIX migration, system management, internet security, and RS/6000 hardware. Abstracts and ordering information areavailable from the redbooks homepage <http://www.redbooks.ibm.com/>. (See Question 6.09 also.) Computer bookstores often carry many of the following: "Power RISC System/6000: Concepts, Facilities, Architecture", Chakravarty McGraw-Hill ISBN 0070110476 "PowerPC: Concepts, Facilities, Architecture", Chakravarty/Cannon McGraw-Hill ISBN 0070111928 "The Advanced Programmer's Guide to AIX 3.x", Colledge McGraw-Hill ISBN 007707663X "AIX Companion" , Cohn Prentice-Hall ISBN 0132912201 "AIX for RS/6000: System & Administration Guide", DeRoest McGraw-Hill ISBN 0070364397 "A Guide to AIX 3.2", Franklin Metro-Info Systems 05/1993 "IBM RS6000 AIX System Administration", Hollicker Prentice-Hall ISBN 0134526163 "IBM RISC SYSTEM/6000 - A Business Perspective", Hoskins John Wiley & Sons ISBN 0471599352 "The Advanced Programmer's Guide to AIX 3.x", Phil Colledge McGraw-Hill, 1994, ISBN: 0-07-707663-x "AIX Performance Tuning", Frank Waters Prentice-Hall 1996 ISBN 0-13-386707-2 "The AIX Survival Guide", Andreas Siegert Addison-Wesley 1996 ISBN 1-201-59388-2 ------------------------------ Subject: 6.06: Some acronyms APAR - Authorized Program Analysis Report Created internaly by a systems programmer to solve a code bug. BOS - Base Operating System DCR - design change request Someone asked to change something. LPP - Licensed Program Product ODM - Object Data Manager Don't touch until you grok it. PRPQ - programming request for price quotation Essentialy, a program that is not available off-the-shelf. (e.g. HACMP started as a PRPQ, you could not order HACMP, but you could ask IBM for a highly-available solution) PTF - Program Temporary Fix Temporary ? Yes! Read "The Tao of Computing". SMIT - System Management Interface Tool SMITTY - SMIT, tty interface, no bells, no whistles. "alias smit=smitty" Y2K - Done. Total non-event. ------------------------------ Subject: 6.07: How do I get this by mailserver or ftp? Since the articles are crossposted to news.answers, any archive carrying that newsgroup will also have these articles. In particular, try ftp'ing to rtfm.mit.edu and checking the directory pub/usenet/news.answers. This FAQ is archived as "aix-faq/part[12345]". The FAQ is also availible via email using the address mail-server@rtfm.MIT.edu two examples of how you might use this from a UNIX prompt follow: echo help | mail mail-server@rtfm.MIT.edu echo send usenet/news.answers/aix-faq/part1 | mail mail-server@rtfm.MIT.edu ------------------------------ Subject: 6.08: Hypertext version of the FAQ United States: <http://www.emerson.emory.edu/services/aix-faq/> <http://www.cis.ohio-state.edu/hypertext/faq/usenet/aix-faq/top.html> New Zealand: <http://www.abstract.co.nz/aix-faq/faq.html> France: <http://www-resus.univ-mrs.fr/Us/CS/RS6k/> Canada: <http://auk.uwaterloo.ca/aixgroup/aix-faq> ------------------------------ Subject: 6.09: IBM AIX documentation on the WWW. <http://www.ibm.com/servers/aix/library/> contains links to IBM documentation, this includes links to the redbooks site (how to documents) as well as links to the AIX 4.3 manuals. ------------------------------ Subject: 6.10: Comp.unix.aix archive availible on the WWW Michael Staats & Fred Hucht have informed me that a searchable archive of comp.unix.aix is availible at: <http://www.thp.Uni-Duisburg.DE/cuaix/cuaix.html>. ------------------------------ Subject: 6.11: How can I access the comp.unix.aix newsgroup via email (or Web)? From: Ciaran Deignan <C.Deignan@frec.bull.fr> It is possible to get "digests" of the AIX newsgroup by email. Each digest contains a summary (just the subject lines from each post) plus the contents of a series of news articles posted to the newsgroup. Each digest is about 800 lines long, and the newsgroup typically generates 5 digest mails per day. To get these digests, you have to subscribe to a mailing list. Send an email to the address majordomo@dmshome.youngstown.oh.us, and put the text "subscribe aix-digest" in the body of the message. [Editor's note: The above address does not appear to work any longer, if anyone knows of a functional equivalent please drop me a note.] It is equally possible to post articles to the newsgroup via email. Any mail sent to the address aixnews@cc.ysu.edu will be forwarded to the comp.unix.aix newsgroup. These services are provided by Doug Sewell <doug@cc.ysu.edu>. Comp.unix.aix can be accessed from the web via http://www.deja.com/ ------------------------------ Subject: 8.03: How do I set up postscript accounting? [ formerly in section 1.118 ] /* pswrap.c compile with: cc pswrap.c -o pswrap -lqb (for doc on the qb library see "understanding backend routines in libqb") BTW: The log_charge() function doesn't seem to do anything, but log_pages() updates the accounting info. Ephraim Vider, original author -- Feb 10, 1993 You can set pswrap up to use either the accounting file specified in /etc/qconfig (which means that you need to get your data from 'pac') or you can comment out the #define WANT_PAC line and then the accounting data will only go into the ACCTFILE. Also modified the logging to the ASCII acctfile so that it looks more readable. Vince Taluskie */ #include <stdio.h> #include <string.h> #include <ctype.h> #include <fcntl.h> #include <signal.h> #include <setjmp.h> #include <sys/wait.h> #include <IN/backend.h> #include <IN/standard.h> #include "qprocs.h" char *nextword (char *p); char *skipvalue (char *p); #define LOGDIR "/tmp" #define ACCTFILE "/usr/adm/acct/lpr/ps-acct" /* #define WANT_PAC 1 */ /* this define will also send accounting info to the acctfile specified in /etc/qconfig file. If this define is commented out then accounting info will only go to ACCTFILE */ char pcprog[] = "statusdict begin pagecount = end\n\x04"; char *keyw[] = { "idle", "busy", "waiting", "printing", "initializing", NULL }; enum { PS_IDLE, PS_BUSY, PS_WAIT, PS_PRINT, PS_INIT, PS_UNKNOWN }; void giveup(); jmp_buf jumper; char logfname[30]; FILE *logfile, *acctfile; main (argc, argv) int argc; char *argv[]; { char *devname; int pagcnt, c; int pid; int w, status; if (argc < 2) { fprintf(stderr, "Usage: psbe file\n"); exit(-1); } if (log_init(argv[1]) < 0) { fprintf(stderr, "log_init failed!\n"); exit(EXITBAD); } sprintf(logfname, "%s/%s.log", LOGDIR, get_device_name()); if ((logfile = fopen(logfname, "a")) == NULL) { fprintf(stderr, "Can't open logfile.\n"); exit(EXITBAD); } if ((acctfile = fopen(ACCTFILE, "a")) == NULL) { fprintf(stderr, "Can't open logfile.\n"); exit(EXITBAD); } setvbuf(logfile, NULL, _IOLBF, BUFSIZ); setvbuf(acctfile, NULL, _IOLBF, BUFSIZ); setvbuf(stdin, NULL, _IONBF, 0); setvbuf(stdout, NULL, _IONBF, 0); fprintf(logfile, "start Job no. %d, queued on %s\n", get_job_number(), get_qdate()); log_status(WAITING); pagcnt = getpagecnt(); log_status(RUNNING); if ((pid = fork()) < 0) { perror("fork"); exit(EXITBAD); } if (pid == 0) { argv[0] = "piobe"; execv("/usr/lpd/piobe", argv); perror("exec"); exit(EXITBAD); } while ((w = wait(&status)) != pid) if (w == -1) { perror("wait"); exit(EXITBAD); } if (WEXITSTATUS(status) != 0) exit(WEXITSTATUS(status)); log_status(WAITING); if (pagcnt > 0 && (c = getpagecnt()) > 0) { #ifdef WANT_PAC log_pages(c - pagcnt); #endif } fprintf(logfile, "end Job no. %d, queued on %s\n", get_job_number(), get_qdate()); /* the accounting file format is pages_printed user queue_printed_on time_queued */ fprintf(acctfile, "%d %35s %7s %s \n", (c - pagcnt), get_from(), get_queue_name(), get_qdate()); fclose(logfile); fclose(acctfile); exit(EXITOK); } void giveup () { longjmp(jumper, 1); } getpagecnt () { int pc = 0, pstat; char buf[81]; if (setjmp(jumper) != 0) { fprintf(logfile, "giving up on status\n"); return (0); } alarm(60 * 2); signal(SIGALRM, giveup); do { if (!gets(buf)) { sleep(5); putchar('\x14'); /* ^T returns status */ sleep(1); /* wait for answer from printer */ if (!gets(buf)) return (0); } fprintf(logfile, "%s\n", buf); if ((pstat = getstatus(buf)) == PS_WAIT) { putchar('\x04'); sleep(1); } } while (pstat != PS_IDLE); alarm(0); while (gets(buf)) fprintf(logfile, "%s\n", buf); printf("%s", pcprog); sleep(1); /* wait for answer from printer */ if (!gets(buf)) return (0); if (sscanf(buf, "%d", &pc) != 1) return (0); fprintf(logfile, "%d\n", pc); return (pc); } /* * Parser for printer status messages */ getstatus (p) char *p; { char *t; int i; if ((p = strchr(p, '%')) == NULL) return (PS_UNKNOWN); if (strncmp(p, "%%[", 3) != 0) return (PS_UNKNOWN); for (p = nextword(p + 3) ; p != NULL ; p = skipvalue(p)) { t = p; p = strchr(p, ':'); *p++ = '\0'; p = nextword(p); if (strcmp(t, "status") == 0) break; } if (p == NULL) return (PS_UNKNOWN); t = p; p = strchr(p, ' '); if (p[-1] == ';') p--; *p = '\0'; for (i = 0 ; keyw[i] != NULL ; i++) if (strcmp(t, keyw[i]) == 0) break; return (i); } char *nextword (p) char *p; { while (isspace(*p)) p++; if (strncmp(p, "]%%", 3) == 0) return (NULL); return (p); } char *skipvalue (p) char *p; { char *t; while (p != NULL) { p = strchr(p, ' '); t = p; p = nextword(p); if (t[-1] == ';') break; } return (p); } /********* qprocs.h ***********/ /* functions for communication between qdaemon and the backend */ char *get_from(); char *get_to(); char *get_qdate(); char *get_queue_name(); char *get_device_name(); char *get_title(); ------------------------------ Subject: 8.04: How can I find out the machine type? From: anonymous [ formerly in section 1.126 ] #!/bin/ksh # Determine machine type # Jim O'Quinn 2/28/93 # AIX Software Support # This does not represent my employer, use at own risk..... # Changed to report newer machines and unknown ids. /Fred # More new machines. /David MachType=`uname -m | cut -c9-10` case $MachType in 02) nMachType="7015/930";; 10) nMachType="7013/530 or 7016/720 or 7016/730";; 11|14) nMachType="7013/540";; 18) nMachType="7013/53H";; 1C) nMachType="7013/550";; 20) nMachType="7015/930";; 2E) nMachType="7015/950 or 7015/950E";; 30) nMachType="7013/520 or 7018/740 or 7018/741";; 31) nMachType="7012/320";; 34) nMachType="7013/52H";; 35) nMachType="7012/32H or 7012/320E";; 37) nMachType="7012/340 or 7012/34H";; 38) nMachType="7012/350";; 41) nMachType="7011/220 or 7011/22W or 7011/22G or 7011/230";; 42) nMachType="7006/41T or 7006/41W";; 43) nMachType="7008/M20";; 45) nMachType="7011/220 or 7011/M20 or 7011/230 or 7011/23W";; 46) nMachType="7011/250";; 47) nMachType="7011/230";; 48) nMachType="7009/C10";; 49) nMachType="7011/250";; 4C) nMachType="604/43P";; 4D) nMachType="601/40P";; 57) nMachType="7012/390 or 7012/3BT or 7030/3BT or 7032/3AT or 7011/390";; 58) nMachType="7012/380 or 7012/3AT or 7030/3BT";; 59) nMachType="3CT or 39H";; 5C) nMachType="7013/560";; 63) nMachType="7015/970 or 7015/97B";; 64) nMachType="7015/980 or 7015/98B";; 66) nMachType="7013/580 or 7013/58F or 7015/580";; 67) nMachType="7013/570 or 7013/770 or 7013/771 or 7013/R10 or 7015/570";; 70) nMachType="7013/590";; 71) nMachType="7013/58H";; 72) nMachType="7013/59H or 7013/R12 or 7013/58H";; 75) nMachType="7012/370 or 7012/375 or 7012/37T";; 76) nMachType="7012/360 or 7012/365 or 7012/36T";; 77) nMachType="7012/315 or 7012/350 or 7012/355 or 7012/510 or 7012/55H or 7012/55L";; 78) nMachType="7012/315 or 7013/510";; 79) nMachType="7013/590";; 80) nMachType="7015/990";; 82) nMachType="7015/R00 or 7015/R24";; 90) nMachType="IBM C20";; 91) nMachType="604/42T";; A0) nMachType="7013/J30 or 7013/R30";; A3) nMachType="7013/R30";; A6) nMachType="7012/G30";; C4) nMachType="F40";; E0) nMachType="603/MOTOROLA PowerStack";; *) nMachType="Unknown($MachType)" esac echo "Machine type: "$nMachType" From: Jan Just Keijser <KeijserJJ@logica.com> I've attached a C program which determines the model and the amount of memory installed in C code (by querying the ODM directly). It can be compiled using cc -o model model.c -lcfg -lodm #include <stdio.h> #include <sys/utsname.h> #include <unistd.h> #include <string.h> #include <cf.h> #include <sys/cfgodm.h> #include <sys/cfgdb.h> void main (void) { struct utsname name; int memsize; char s[3]; int model; struct CuAt *odm_obj; int how_many; uname(&name); printf( "sysname = %s\n", name.sysname ); printf( "nodename = %s\n", name.nodename ); printf( "release = %s\n", name.release ); printf( "version = %s\n", name.version ); printf( "machine = %s\n", name.machine ); printf( "model = " ); /* On AIX, the model is encoded in the last 2 non-zero digits of the model code (uname -m) */ s[0] = name.machine[ strlen( name.machine ) - 4 ]; s[1] = name.machine[ strlen( name.machine ) - 3 ]; s[2] = '\0'; model = strtol(s, NULL, 16); switch (model) { case 0x10: puts ( "Model 530/730" ); break; case 0x11: case 0x14: puts ( "Model 540" ); break; case 0x18: puts ( "Model 530H" ); break; case 0x1C: puts ( "Model 550" ); break; case 0x20: puts ( "Model 930" ); break; case 0x2E: puts ( "Model 950/950E" ); break; case 0x30: puts ( "Model 520 or 740/741" ); break; case 0x31: puts ( "Model 320" ); break; case 0x34: puts ( "Model 520H" ); break; case 0x35: puts ( "Model 32H/320E" ); break; case 0x37: puts ( "Model 340/34H" ); break; case 0x38: puts ( "Model 350" ); break; case 0x41: puts ( "Model 220/22W/22G/230" ); break; case 0x42: puts ( "Model 41T/41W" ); break; case 0x43: puts ( "Model M20" ); break; case 0x45: puts ( "Model 220/M20/230/23W" ); break; case 0x46: case 0x49: puts ( "Model 250" ); break; case 0x47: puts ( "Model 230" ); break; case 0x48: puts ( "Model C10" ); break; case 0x4C: puts ( "PowerPC 603/604 model" ); break; case 0x4D: puts ( "Model 40P" ); break; case 0x57: puts ( "Model 390/3AT/3BT" ); break; case 0x58: puts ( "Model 380/3AT/3BT" ); break; case 0x59: puts ( "Model 39H/3CT" ); break; case 0x5C: puts ( "Model 560" ); break; case 0x63: puts ( "Model 970/97B" ); break; case 0x64: puts ( "Model 980/98B" ); break; case 0x66: puts ( "Model 580/58F" ); break; case 0x67: puts ( "Model 570/770/R10" ); break; case 0x70: puts ( "Model 590" ); break; case 0x71: puts ( "Model 58H" ); break; case 0x72: puts ( "Model 59H/58H/R12/R20" ); break; case 0x75: puts ( "Model 370/375/37T" ); break; case 0x76: puts ( "Model 360/365/36T" ); break; case 0x77: puts ( "Model 315/350/355/510/550H/550L" ); break; case 0x79: puts ( "Model 591" ); break; case 0x80: puts ( "Model 990" ); break; case 0x81: puts ( "Model R24" ); break; case 0x82: puts ( "Model R00/R24" ); break; case 0x89: puts ( "Model 595" ); break; case 0x90: puts ( "Model C20" ); break; case 0x91: puts ( "Model 42T" ); break; case 0x94: puts ( "Model 397" ); break; case 0xA0: puts ( "Model J30" ); break; case 0xA1: puts ( "Model J40" ); break; case 0xA3: puts ( "Model R30" ); break; case 0xA4: puts ( "Model R40" ); break; case 0xA6: puts ( "Model G30" ); break; case 0xA7: puts ( "Model G40" ); break; case 0xC4: puts ( "Model F30" ); break; default: printf( "Model code: %s\n", s ); break; } /* Get the amount of installed memory */ odm_set_path("/etc/objrepos"); /* Get a single ODM object */ odm_obj = getattr("sys0", "realmem", 0, &how_many); memsize = atoi(odm_obj->value) / 1024; odm_terminate(); printf( "Memory = %d MB\n", memsize ); /* Print the number of processors */ printf("#processor configured = %d\n", sysconf(_SC_NPROCESSORS_CONF)); printf("#processor online = %d\n", sysconf(_SC_NPROCESSORS_ONLN)); } ------------------------------ Subject: 8.05: Updating to 3.2.5 [ formerly in section 1.127 ] =-=-=-=-=-=-=-= cut here =-=-=-=-=-=-=-=-=-=-= #!/bin/ksh # @(#) mktape2disk.sh creates files from tape on disk. # change name prefix here NAME="f" # from file #i to file #j integer i=1 integer j # test arguments if [ -z "${1}" ] then echo "\nusage: $(basename ${0}) <drive_no> <#files>\n" echo "\t<drive_no>: tape drive number (e.g. 0)" echo "\t<#files> : number of files to copy from the tape\n" exit 1 fi device=/dev/rmt${1}.1 # test arguments if [ -z "${2}" ] then echo "\nusage: $(basename ${0}) <drive_no> <#files>\n" echo "\t<drive_no>: tape drive number (e.g. 0)" echo "\t<#files> : number of files to copy from the tape\n" exit 1 fi j=${2} tctl -f ${device} rewind if [ $? -ne 0 ] then exit 1 fi # create tape while [ ${i} -le ${j} ] do echo "Copy file #${i} of #${j} from (${device}) to disk as (${NAME}${i})." dd if=${device} of="${NAME}${i}" bs=200k i=i+1 done tctl -f ${device} rewind exit 0 =-=-=-=-=-=-=-= cut here =-=-=-=-=-=-=-=-=-=-= 5) Create a new .toc file # cd /pub/pmp3250 # inutoc . # pg .toc 6) Place the following file named 'runme.sh' in the PMP directory =-=-=-=-=-=-=-= cut here =-=-=-=-=-=-=-=-=-=-= #!/bin/ksh # @(#) runme.sh for PMP3250 # INSTP="/usr/sbin/installp" LOG="/tmp/installp.log" TEE="/usr/bin/tee" PATCHDIR=$(pwd) # /usr/bin/cp /usr/lpp/info/data/ispaths /usr/lpp/info/data/ispaths.save # INFODIR="/usr/lpp/info/$LANG/aixmin" /usr/bin/mkdir ${INFODIR} 2>/dev/null >/dev/null if [ ! -w ${INFODIR} ] then print "\n\t*ERROR* Can not (write) access [${INFODIR}]." print "\tPlease unmount CD or NFS filesystems.\n" exit -1 fi # # Commit all ptf's # ${INSTP} -Xc all 2>&1 | ${TEE} ${LOG}.0 # # Install latest installp patch # ${INSTP} -BXacgq -d ${PATCHDIR} bos.obj 3.2.0.0.U422463 2>&1 | ${TEE} ${LOG}.1 # # Install latest installp patch # ${INSTP} -BXacgq -d ${PATCHDIR} bos.obj 3.2.0.0.U422467 2>&1 | ${TEE} ${LOG}.6 # # Run the ptfdir clean utility. # /usr/sbin/ptfdir_clean -y -f -v 2>&1 | ${TEE} ${LOG}.2 # # Install the PMP. Version 1 # /usr/lib/instl/sm_inst installp_cmd \ -T m -q -a -g -B \ -d ${PATCHDIR} \ -S '3250 AIX Maintenance Level U493250' \ -c -N -X \ 2>&1 | ${TEE} ${LOG}.3 # # Install the PMP. Version 2 # # /usr/sbin/update_all # # Install latest installp patch # /usr/bin/lppchk -v | ${TEE} ${LOG}.4 # # Show level of installp patch # /usr/bin/lslpp -m bos.obj | ${TEE} ${LOG}.5 # # Guess you should reboot now. # sync;sync print - "\n\n\tDone......guess you should reboot now !!\n" exit 0 =-=-=-=-=-=-=-= cut here =-=-=-=-=-=-=-=-=-=-= 7) To run the update on your server ===>> Please read the Installation Instructions first <<== # cd /pub/pmp3250 # ./runme.sh ........WAIT........... # /etc/shutdown -Fr 8) NFS export the PMP dir as READ-ONLY to all your clients. 9) To update a client system a - Mount the PMP filesystem from the server b - cd <mounted_filesystem> c - execute ./runme.sh d - Unmount PMP filesystem e - reboot 10) To create a copy 1:1 of the tape you received use the script 'mktape.sh' # cd /pub/pmp3250 # mktape.sh 0 =-=-=-=-=-=-=-= cut here =-=-=-=-=-=-=-=-=-=-= #!/bin/ksh # @(#) mktape.sh: creates a bootable tape from images on disk # change name prefix here NAME="f" # usage: mktape drive_no # drive_no = tape drive number # test arguments if [ -z "${1}" ] then echo "\nusage: mktape <drive_no>" echo " <drive_no>: tape drive number (e.g. 0)\n" exit 1 fi device=/dev/rmt${1}.1 tctl -f ${device} rewind if [ $? -ne 0 ] then exit 1 fi # create tape i=1 while test -r "${NAME}${i}" do echo "copy ${i}" if [ $i -le 3 ] then dd if="${NAME}${i}" of=${device} conv=sync bs=1k else dd if="${NAME}${i}" of=${device} bs=200k fi let i=${i}+1 done tctl -f ${device} rewind exit 0 ------------------------------ Subject: 8.06: How do I do remote backup? From: kraemerf@franvm3.VNET.IBM.COM (Frank Kraemer) [ formerly in section 1.201 ] #!/bin/ksh # @(#) Create a backup tape of the private user data. #=================================================================# # Script : usave.sh # # Author : F. Kraemer # # Date : 92/02/19 # # Update : 92/10/29 # # Info : the ultimative backup script # # Example: usave.sh /dev/rmt0 - save to local tape # # usave.sh /save/save.me - save to local file # # usave.sh /tmp/pipe - save to remote tape # #-----------------------------------------------------------------# PS4="(+) " #set -x PROG=$(basename $0) HOST=$(hostname) TODAY=$(date +%H:%M:%S) # # cleanup # cleanup () { ec=$1 error=$2 case "$ec" in "$USAGE_EC") # usage error error="Usage:\t$PROG DeviceName\n" 1>&2 ;; "$NOTAP_EC") # Tape error error="error:\t$PROG: $DEVICE is not available on the system.\n" 1>&2 ;; "$LISTE_EC") # list error error="error:\t$PROG: could not create tar list for $LOGNAME.\n" 1>&2 ;; "$NOTAR_EC") # tar command error error="error:\t$PROG: tar command failed.\n" 1>&2 ;; "$PIPEP_EC") # pipe error error="error:\t$PROG: mknod command failed.\n" 1>&2 ;; "$NORSH_EC") # rsh error error="error:\t$PROG: rsh - Remote Shell command failed.\n" 1>&2 ;; "$RHOST_EC") # remote host error error="error:\t$PROG: Remote Host unknown.\n" 1>&2 ;; *) ;; esac case "$DEVICE" in # # Fix the block size if $DEVICE is a tape device # /dev/rmt[0-9]*) echo "\n\t$PROG: Rewinding tape to begin.........(please wait)\n" tctl -f $DEVICE rewind 2>/dev/null ;; *) ;; esac rm -f ${LIST} ${PIPE} 2>/dev/null [ -n "$error" ] && echo "\n${error}\n" trap '' 0 1 2 15 exit "$ec" } # # Variables # USAGE_EC=1 # exit code for usage error NOMNT_EC=2 # exit code wrong device name NOTAP_EC=3 # exit code no tape available LISTE_EC=4 # exit code backup list error NOTAR_EC=5 # exit code for wrong tar TRAPP_EC=6 # exit code for trap PIPEP_EC=7 # exit code for pipe RHOST_EC=8 # exit code for bad ping NORSH_EC=9 # exit code for bad rsh DEVICE="$1" # device to tar into LIST="/tmp/.tar.$LOGNAME.$$" # REMOTEH="" # Remote host for backup REMOTET="" # Remote tape for backup tapedev= # PIPE="/tmp/pipe" # Pipe for remote backup # # main() # tput clear echo "\n\t$PROG started from $LOGNAME@$HOST on $TERM at $TODAY.\n" rm -f $LIST 2>/dev/null # # Trap on exit/interrupt/break to clean up # trap "cleanup $TRAPP_EC \"Abnormal program termination. $PROG"\" 0 1 2 15 # # Check command options # [ "$#" -ne 1 ] && cleanup "$USAGE_EC" "" # # Check device name # [ `expr "$DEVICE" : "[/]"` -eq 0 ] && cleanup "$NOMNT_EC" \ "$PROG: Backup device or file name must start with a '/'." # # Check tape device # case "$DEVICE" in # # Fix the block size if $DEVICE is a tape device # /dev/rmt[0-9]*) # echo "\n\t$PROG: Verify backup media ($DEVICE)............\n" # # see if a low or high density tape device was specified # (eg rmt0.1) density="`expr $DEVICE : \ "/dev/rmt[0-9]*\.\([0-9]*\)"`" # # strip /dev/ from device name and # get the base name (eg translate: # /dev/rmt0.2 to rmt0) # tapedev="`expr $DEVICE : \ "/dev/\(rmt[0-9]*\)[\.]*[0-9]*"`" # # Check if the tape is defined in the system. lsdev -C -c tape -S Available -F "name" | grep $tapedev >/dev/null 2>&1 rc=$? [ "$rc" -ne 0 ] && cleanup "$NOTAP_EC" "" # # Restore old tape name. # [ "${density:-1}" -lt 4 ] && density=1 || density=5 DEVICE="/dev/${tapedev}.${density}" echo "\n\t$PROG: Insert a tape in ($DEVICE)........(press enter)\n" read TEMP echo "\n\t$PROG: Rewinding tape to begin...........(please wait)\n" tctl -f $DEVICE rewind 2>/dev/null ;; # # Backup is done on remote host. The remote shell facility # must be set up and running. # ${PIPE}*) # echo "\n\t$PROG: Assuming remote backup via network.\n" echo "\t$PROG: Enter name of Remote Host ===> \c" read REMOTEH echo "\n\t$PROG: Pinging Remote Host to test connection.\n" ping ${REMOTEH} 1 1 >/dev/null 2>&1 rc=$? # give up unknown host [ "$rc" -ne 0 ] && cleanup "$RHOST_EC" "" JUNK=$(rsh ${REMOTEH} "/usr/sbin/lsdev -C -c tape -S Available") rc=$? # give up rsh failed [ "$rc" -ne 0 ] && cleanup "$NORSH_EC" "" echo "\t$PROG: Available Tapes on ${REMOTEH} are :\n\n\t\t${JUNK}\n" echo "\t$PROG: Enter name of Remote Tape (e.g. /dev/rmt0) ===> \c" read REMOTET echo "\n\t$PROG: Insert tape on ${REMOTEH} in ${REMOTET}..(press enter)" read TEMP echo "\t$PROG: Rewinding Remote Tape ${REMOTET} on ${REMOTEH}.\n" rsh ${REMOTEH} "tctl -f ${REMOTET} rewind" rc=$? # give up rsh failed [ "$rc" -ne 0 ] && cleanup "$NOTAP_EC" "" rm -f ${PIPE} 2>/dev/null mknod ${PIPE} p rc=$? # give up mknod failed [ "$rc" -ne 0 ] && cleanup "$PIPEP_EC" "" cat ${DEVICE} | rsh ${REMOTEH} "dd of=${REMOTET} obs=100b 2>/dev/null" & ;; *) ;; esac # # Prepare the list # echo "\n\t$PROG: Create list of files to be saved...." find $HOME -print > $LIST rc=$? [ "$rc" -ne 0 ] && cleanup "$LISTE_EC" "" # # tar the files # echo "\n\t$PROG: Changing current directory to (/)...." cd / > /dev/null 2>&1 echo "\n\t$PROG: Running tar format backup from user ($LOGNAME)...." tar -cvf "$DEVICE" -L "$LIST" rc="$?" [ "$rc" -ne 0 ] && cleanup "$NOTAR_EC" "" # # Backup completed # TODAY=$(date +%H:%M:%S) echo "\n\t$PROG ended at $TODAY............................\n\n" cleanup 0 ------------------------------ Subject: 8.06: How do I do remote backup? (cont.) From: Henk van Doorn <hvdoorn@xs4all.nl> #!/bin/ksh ####################################################################### # rmksysb # ####################################################################### # # # Description: # # creates a bootable mksysb backup of a remote system running # # AIX 3.x or lists the Table of Contents of the current tape # # # # Usage: # # ./rmksysb $1 [$2] # # $1 - remote host to be backed up # # $2 - optional: local tape device (default: rmt0) # # or: # # ./rmksysb -l [$2] # # to list Table of Contents saveset on tape in $2 # # (only useful on tapes created by rmksysb) # # # # Output: # # a bootable mksysb of the remote system # # or a listing of the TOC saveset on the current tape # # # # Remarks: # # . rmksysb can only be used by root # # . this script will use tapedevice .1, so if # # a >2.3GB drive is used: check density_set_1 # # . the remote host needs /.rhosts to include the local host # # for root access (+ shell enabled in /etc/inetd.conf) # # . you will need some room (>1.5MB) on /tmp on the remote host # # for standard mksysb .archive.list.* etc. # # . remote standard output & standard error (except dd/chdev) # # will go to local stdout & stderr # # . redirecting stdout can create quite large log-files (2MB) # # . AIX versions should not be too far apart as the boot-saveset# # comes from the local system & the rest from the remote # # (tested on AIX 3.2.5, AIX 4+ definitely won't work!!!) # # . most likely this script will fail with multi-tape mksysb's: # # another incentive to keep rootvg as small as possible! # # # # Author: # # Henk van Doorn # # Email: hvdoorn@xs4all.nl # # # # Thanks to all who contributed. Esp. Paul Wynn (AIXpert '93), # # my colleagues Dominic Dinardo & Douwe van Terwisga # # + the input from Usenet were stimulating; thanks folks! # # I would welcome any additions & changes for the better... # # # ####################################################################### # CHANGES # ####################################################################### # # # ID WHO DATE DESCR # # -- --- ------- --------------------------------------------- # # X000 HvD 6Jan95 Created this file. # # X001 HvD 2Feb95 Final version # ####################################################################### set +u # Global variable definitions. UMASK=`umask` BLK_SZ=1024 BOOT_BLK_SZ=512 HOST=${1} # TAPE = $2 with /dev/ & .* removed, defaulting to rmt0 TAPE=${2:-rmt0} TAPE=${TAPE#/dev/} TAPE=${TAPE%.*} usage() { echo "Usage: ./rmksysb <remote_host_name> [<tape_device>] or" >&2 echo " ./rmksysb -l [<tape_device>]" >&2 echo " with <tape_device>= e.g. rmt1" >&2 echo "Default <tape_device>=rmt0" >&2 return } check_parms() { if [ "${HOST}" = "" ] then usage exit 1 fi if [ "${HOST}" = "-l" ] then # show TOC block which contains some backup details on rmksysb tapes get_tape_block_size chdev -l ${TAPE} -a block_size=${BOOT_BLK_SZ} >/dev/null 2>&1 mt -f /dev/${TAPE} rewind mt -f /dev/${TAPE}.1 fsf 2 dd if=/dev/${TAPE} count=1 2>/dev/null chdev -l ${TAPE} -a block_size=${OLD_BLK_SZ} >/dev/null 2>&1 exit fi } check_host() { rsh ${HOST} hostname >/dev/null 2>&1 if [ $? -ne 0 ] then echo "Check hostname & rsh access" >&2 exit 1 fi } get_tape_block_size() { VALID= `lsdev -Cc tape | cut -f1 -d" " | grep ${TAPE} 2>&1 >/dev/null` && { OLD_BLK_SZ=`lsattr -El ${TAPE} -a block_size | cut -f2 -d" "` VALID=true } if [ "$VALID" = "" ] then echo "Tape drive $TAPE is not a valid local drive!" >&2 exit 1 fi } # # The main procedure is analogous to its C counterpart, # This is the basic driver routine. # main() { if [ "`id | grep 'uid=0'`" = "" ] then echo "rmksysb can only be run as root!" >&2 exit 2 fi umask 022 check_parms check_host get_tape_block_size # display some info on this rmksysb session echo "`date`\n\nRemote System Backup from remote ${HOST} to local `hostname` on device:\n`lscfg -v -l ${TAPE} | sed -n '3,6p' | grep "[a-z]" `\n" # Here the action starts rsh $HOST -n /usr/bin/mkszfile rsh $HOST -n "echo ${BLK_SZ} > /tapeblksz" rsh $HOST -n "rm -f /tmp/pipe.rmksysb" rsh $HOST -n "rm -f /tmp/pipe.rmksysb.out" rsh $HOST -n "rm -f /tmp/pipe.rmksysb.err" rsh $HOST -n "/etc/mknod /tmp/pipe.rmksysb p" rsh $HOST -n "/etc/mknod /tmp/pipe.rmksysb.out p" rsh $HOST -n "/etc/mknod /tmp/pipe.rmksysb.err p" # create remote startup file for mkinsttape rsh $HOST -n "echo '#!/bin/ksh\nexport PATH=$PATH ; /usr/sbin/mkinsttape /tmp/pipe.rmksysb >/tmp/pipe.rmksysb.out 2>/tmp/pipe.rmksysb.err &' > /tmp/mkinsttape.start " rsh $HOST -n "chmod 700 /tmp/mkinsttape.start" chdev -l $TAPE -a block_size=${BOOT_BLK_SZ} >/dev/null 2>&1 tctl -f /dev/${TAPE} retension echo echo echo ">>> SAVESET 1: BOS boot image from `hostname`" echo bosboot -d /dev/${TAPE}.1 -a echo echo echo ">>> SAVESET 2: BOS install utilities from ${HOST} (backup format)" echo rsh $HOST -n "nohup /tmp/mkinsttape.start" & # get remote standard out & err to local stdout & err rsh $HOST -n "dd if=/tmp/pipe.rmksysb.out 2>/dev/null" | dd 2>/dev/null & rsh $HOST -n "dd if=/tmp/pipe.rmksysb.err 2>/dev/null" | ( dd 2>/dev/null ) >&2 & # get remote mkinsttape to local tape device rsh $HOST -n "dd if=/tmp/pipe.rmksysb 2>/dev/null" | dd 2>/dev/null | dd of=/dev/${TAPE}.1 conv=sync 2>/dev/null echo echo echo ">>> SAVESET 3: Backup information (list with ./rmksysb -l [<tapedevice>])" echo # add dummy TOC to tape with some backup information echo "`date`\n\nRemote System Backup from remote ${HOST} to local `hostname` on device:\n`lscfg -v -l ${TAPE} | sed -n '3,6p' | grep "[a-z]" `\n" | dd of=/dev/${TAPE}.1 conv=sync 2>/dev/null # change blocksize to 1024 for better performance chdev -l ${TAPE} -a block_size=${BLK_SZ} >/dev/null 2>&1 # rewind & skip first 3 savesets mt -f /dev/${TAPE} rewind mt -f /dev/${TAPE}.1 fsf 3 echo echo echo ">>> SAVESET 4: mksysb (rootvg backup) from ${HOST} (tar format)" echo # start the actual remote mksysb echo "The contents of the /.fs.size file on ${HOST} are:" rsh $HOST -n "cat /.fs.size" echo rsh $HOST -n "nohup /usr/bin/mksysb /tmp/pipe.rmksysb >/tmp/pipe.rmksysb.out 2>/tmp/pipe.rmksysb.err &" & # get remote standard out & err to local stdout rsh $HOST -n "dd if=/tmp/pipe.rmksysb.out 2>/dev/null" | dd 2>/dev/null & rsh $HOST -n "dd if=/tmp/pipe.rmksysb.err 2>/dev/null" | ( dd 2>/dev/null ) >&2 & # get remote mksysb to local tape device rsh $HOST -n "dd if=/tmp/pipe.rmksysb 2>/dev/null" | dd obs=${BLK_SZ} 2>/dev/null | dd of=/dev/${TAPE} bs=${BLK_SZ} conv=sync 2>/dev/null # cleaning up rsh $HOST -n "rm -f /tmp/pipe.rmksysb" rsh $HOST -n "rm -f /tmp/pipe.rmksysb.out" rsh $HOST -n "rm -f /tmp/pipe.rmksysb.err" rsh $HOST -n "rm -f /tmp/mkinsttape.start" chdev -l ${TAPE} -a block_size=${OLD_BLK_SZ} >/dev/null 2>&1 umask $UMASK # display some closing info on this rmksysb session echo "Remote System Backup from remote ${HOST} to local `hostname` is finished.\n`date`\n" } #end of main # Call the driver main ------------------------------ Subject: 8.07: How to configure dialup SLIP [ formerly in section 1.606 part 5 ] #!/bin/ksh # SLIP login .profile # Adapted from comp.unix.aix FAQ # by Davide Migliavacca (davide.migliavacca@inferentia.it) # $Revision: 1.14 $ # Set this variable != 0 to allow multiple logins from this userid ALLOW_MULTIPLE_LOGINS=0 # NOTE: script currently determines destination IP address from the SLIP # interface attributes, but it assumes a correspondence # ttyxx <-> slipxx # (see the "IPADDRESS=" awk line) # It relies on a client being able to read the IP address from # the logon procedure output. PATH=/usr/bin:/etc:/usr/sbin:/usr/ucb:$HOME/bin:/usr/bin/X11:/sbin:/usr/local/bin:. export PATH ENV HISTSIZE # # Search for a LCK-File for our tty if there is one # TTYDEV=`tty` TTYBASENAME=`basename $TTYDEV` TTYNUMBER=`echo $TTYBASENAME | sed -n -e "s/tty\([0-9]\{1,\}\)/\1/p"` if [ -f /etc/locks/LCK..$TTYBASENAME ]; then SHPID=`cat /etc/locks/LCK..$TTYBASENAME`; else { /usr/bin/logger -t SLIP -p error "No LCK file for $TTYDEV" exit 64; } fi; # Search for another login from this userid OTHERSLIP=`ps -fu$USER | sed -n -e "s/^ *$USER *[0-9][0-9]* .*-.*\/usr\/sbin\/slattach \(tty[0-9]\{1,\}\) *$/\1/p`; if [ ! -z "$OTHERSLIP" ]; then if [ $ALLOW_MULTIPLE_LOGINS -eq 0 ]; then echo "Sorry, you are already connected to $OTHERSLIP."; echo "Multiple logins are NOT allowed."; echo "For any question, contact helpdesk@inferentia.it"; /usr/bin/logger -t SLIP -p warn "$USER: attempt to connect on $TTYBASENAME when already connected on $OTHERSLIP - refused"; exit 64; fi #else... /usr/bin/logger -t SLIP -p warn "$USER: multiple login allowed, now using also $TTYBASENAME"; fi # # Search for our own Shell to get the PID for checking against LCK-File # SH2PID=`ps -ft$TTYNUMBER | sed -n -e "s/^ *$USER *\([0-9][0-9]*\) .*-.*sh *$/\1/p` # # Is it the the same PID as in the LCK File so that we can start working ?? DEBUG=0 if [ $DEBUG -eq 1 ]; then echo TTYDEV: $TTYDEV echo TTYBASENAME: $TTYBASENAME echo USER: $USER echo SHPID: $SHPID echo SH2PID: $SH2PID fi if [ "$SHPID" -eq "$SH2PID" ]; then # remove the LCK-File because slattach does not like it. rm -rf /etc/locks/LCK..$TTYBASENAME # Add RTS/CTS Handshakeing to our own tty: Better do it in /etc/rc, # using the program from the comp.unix.aix FAQ. # stty add rts SLIPLINE=`echo $TTYBASENAME | awk '//{print substr($1,4);}'` IPADDRESS=`lsattr -E -l sl$SLIPLINE -a dest 2>/dev/null | awk '//{print $2;}'` if [ -z "$IPADDRESS" ] then /usr/bin/logger -t SLIP -p error "$USER: attempt to use tty with no slip interface defined ($TTYBASENAME)" echo "This tty ($TTYBASENAME) has not been enabled for SLIP. Please try another one or contact the system administrator." exit 64 fi echo SLIP starting. Your IP address is $IPADDRESS /usr/sbin/slattach $TTYBASENAME # Get the pid of slattach so that we can kill him later on. SLPID=`ps -aef | sed -n -e "s/^ *$USER *\([0-9][0-9]*\) .*-.*\/usr\/sbin\/slattach $TTYBASENAME *$/\1/p` # Just say that we are up. logger -t SLIP -p info "$USER: Starting up daemon (pid $SLPID) for [$IPADDRESS] on $TTYDEV" else # Something must be wrong with the LCK-File SH3PID=`ps -aef | awk ' {print $2}' | grep $SHPID` if [ ."$SH3PID" = ."" ] then SH3PID="NO_SUCH_PROCESS" fi if [ $SHPID = $SH3PID ] then # There is a living process which owns the LCK-File !! /usr/bin/logger -t SLIP -p error "$USER: Cannot remove LCK file for $TTYDEV (not owner)" exit 64 else # Who the hell didn't remove the LCK-File (should never happen) /usr/bin/logger -t SLIP -p error "$USER: LCK file for $TTYDEV found with no owner" #echo `date` " LCK-File with no owner found !!!" >>$SLIPLOG exit 64 fi fi if [ $DEBUG -eq 1] then /usr/bin/logger -t SLIP -p debug "$USER: going to trap signals..." fi Nov 28 11:18:46 sauternes rexecd[21420]: connect from brachetto.inferentia.it # terminated ) trap "kill $SLPID; /usr/bin/logger -t SLIP -p info \"$USER: Killing daemon (pid $SLPID) for $TTYDEV\"; exit 0" 1 if [ $DEBUG -eq 1] then trap "/usr/bin/logger -t SLIP -p debug \"$USER: trap ERR\"" ERR trap "/usr/bin/logger -t SLIP -p debug \"$USER: trap 0\"" 0 trap > /tmp/trap.$TTYBASENAME.log /usr/bin/logger -t SLIP -p debug "$USER: trap returns $?..." fi # We will have a nice sleep and nice dreamings if [ $DEBUG -eq 1] then /usr/bin/logger -t SLIP -p debug "$USER: going to sleep-loop..." fi while [ true ]; do sleep 60; done # Sanity check (should never happen...) /usr/bin/logger -t SLIP -p error "$USER: ERROR: .profile broken" ------------------------------ Subject: 8.08: Disabling software flow control; using RTS/CTS. [ formerly in section 1.613 ] /* This program is an adaptation of a program provided by IBM Defect Support. It is provided without warrantee, or support. The syntax of the command is: setrts tty [tty [tty [...]]] The program will loop through each tty provided on the command line, and turn on the 'rts' line discipline. The program does not require that the Carrier Detect signal be held high to keep the serial device from blocking on the attempt to open it. The program works for all valid ttys. BUGS: None that are known; however, using the program to set 'ptys' may cause the 'pty' to become unusable. This program was written by Robin D. Wilson, Pencom Software (with the specific 'ioctl()' call provided by the IBM Defect Support Center. I call it: "setrts" To compile: cc -O -o setrts setrts.c strip setrts (Funny, but if you strip with the compiler (i.e., cc -s), you end up with 120 extra bytes in the executable...) */ #include <stdio.h> #include <fcntl.h> #include <termios.h> #include <sys/tty.h> #include <string.h> #include <sys/param.h> #include <unistd.h> #define DEVDIR "/dev/" #define LINEDISP "rts" main (argc, argv) int argc; char **argv; { int tty; char ttyname[MAXPATHLEN]; /* Give a 'usage' recommendation if they don't provide an argument */ if (argc < 2) { fprintf(stderr, "usage: %s <ttyn> [ttyn [ttyn [...]]]\n",argv[0]); exit(-1); } /* Otherwise, loop through all the arguments... */ else while (--argc >= 1) { argv++; /* Check to see if they input the 'tty' names with the DEVDIR on them... * If not, put it on... */ if (strncmp(DEVDIR, argv[0], strlen(DEVDIR)) != 0) { strcpy(ttyname, DEVDIR); strcat(ttyname, argv[0]); } else strcpy(ttyname, argv[0]); /* Open the tty. Use the non-blocking open (O_NDELAY) to open without a * carrier (CD) present on the line... */ if ((tty = open(ttyname, O_RDWR|O_NDELAY)) < 0) { fprintf(stderr, "%s: couldn't open tty device.\n",ttyname); exit (-2); } /* Add the 'rts' line discipline... */ (void)ioctl(tty, TXADDCD, LINEDISP); (void)close(tty); } } ------------------------------ Subject: 8.09: How can I hack libc.a to alter how hostnames are resolved? [ formerly in section 1.618 ] [ Editor's note: You might want to see Question 2.07 for advice on recovering from a deleted or corrupted libc.a before attempting this hack. Note that this procedure is for AIX 3.2 ONLY --- AIX 4.x already has a supported method of controling name resolution. See question 1.800.] 1. get the resolv+ source (I see a copy on ftp.uu.net in networking/ip/dns and there are likely copies elsewhere). We are using version 2.1.1, which appears to be the latest available. gethostnamadr.c needs a couple of additions: 23a24,26 > #ifdef _AIX > #include <sys/time.h> > #endif 35a39,41 > #ifdef _AIX > #include <sys/ioctl.h> /* for SIOCGIFCONF */ > #else 36a43 > #endif 2. Use the following instead of the supplied shlib/Makefile: LIBP= gethostnamadr.o herror.o res_data.o res_query.o res_mkquery.o \ sethostent.o res_send.o res_debug.o res_comp.o res_init.o CFLAGS= -O -D_BSD=43 -D_NO_PROTO -DNIS -DDEBUG -U__STR__ all: shr.o shr.o: $(LIBP) setup ld -o $@ /lib/syscalls.exp $(LIBP) tmp.o -bM:SRE -bE:shr.exp -bE:/lib/syscalls.exp -bI:crypt.imp -H512 -T512 -bh:4 -lc setup: rm -f libc.a crypt.imp cp /lib/libc.a . chmod 755 libc.a ar xv libc.a shr.o /bin/dump -nv shr.o | grep EXP | awk '{print $$NF}' > shr.exp ld -o tmp.o -bnso shr.o -r @ echo '#!' > crypt.imp @ echo __crypt >> crypt.imp @ echo __setkey >> crypt.imp @ echo __encrypt >> crypt.imp clean: rm -f shr.o tmp.o crypt.imp shr.exp $(LIBP) libc.a install_libc: install_libc.c cc -o $@ install_libc.c -bnso -bI:/lib/syscalls.exp herror.o: ../herror.c $(CC) $(CFLAGS) -c ../herror.c res_comp.o: ../res_comp.c $(CC) $(CFLAGS) -c ../res_comp.c res_debug.o: ../res_debug.c $(CC) $(CFLAGS) -c ../res_debug.c res_data.o: ../res_data.c $(CC) $(CFLAGS) -c ../res_data.c res_init.o: ../res_init.c $(CC) $(CFLAGS) -c ../res_init.c res_mkquery.o: ../res_mkquery.c $(CC) $(CFLAGS) -c ../res_mkquery.c res_query.o: ../res_query.c $(CC) $(CFLAGS) -c ../res_query.c res_send.o: ../res_send.c $(CC) $(CFLAGS) -c ../res_send.c gethostnamadr.o: ../gethostnamadr.c $(CC) $(CFLAGS) -c ../gethostnamadr.c sethostent.o: ../sethostent.c $(CC) $(CFLAGS) -c ../sethostent.c strpbrk.o: ../strpbrk.c $(CC) $(CFLAGS) -c ../strpbrk.c strerror.o: ../strerror.c $(CC) $(CFLAGS) -c ../strerror.c 3. As shipped, IBM's /lib/syscalls.exp contains an entry for fork(). This needs to be removed as it will cause the new shr.o to use the system call entry point rather than the library wrapper and this can cause some rather odd behavior. For example, I ran across one using the '!' command in vi where the error/informational messages were corrupted. 4. You can use "ar r libc.a shr.o" but that will leave a big hole in libc.a, since the new shr.o is slightly bigger than the original. I always extract all the .o's from libc.a and build a brand new one - suit yourself. 5. Before the next step, you'll want to set up the two configuration files. The first is /etc/resolv.conf and it is basically the same as before except for the new keyword "search" - intended to replace the "domain". See the resolver.5 manual page for details (included with the resolv+ source). The other file is /etc/host.conf, which is where you set the order of search. See resolv+.8 for information on this. 6. Now, the only tricky part left is to get the new libc.a installed. You'll note the Makefile has a target for install_libc. Just put the following in install_lib.c and run "make install_libc" to build. ------------------------------- begin install_libc.c ------------------------- #include <stdio.h> static char *nodns[] = { "/usr/ccs/lib/libc.a" , "/usr/ccs/lib/libc.a.ORIG" }; static char *hasdns[] = { "/usr/ccs/lib/libc.a.NEW" , "/usr/ccs/lib/libc.a" }; #define OLD (0) #define NEW (1) main() { if(link(nodns[OLD],nodns[NEW])) { perror("link"); exit(1); } if(unlink(nodns[OLD])) { perror("unlink"); exit(1); } if(link(hasdns[OLD],hasdns[NEW])) { perror("link"); exit(1); } if(unlink(hasdns[OLD])) { perror("unlink"); exit(1); } exit(0); } ------------------------------- end install_libc.c --------------------------- 7. You'll want to do this on a quiet machine. Move the new libc.a to /usr/ccs/lib/libc.a.NEW, then run install_libc. It is probably a good idea to reboot afterwords (though not strictly required). We have a similar program called restore_libc (exercise for the reader) for backing out the change. Rather than do this on every machine (we have 170+ RS/6000's), I simply put this new libc.a into my network-installable image, which I blasted out over the year-end holiday break (I created a method for loading a new image onto machines without having to boot off of floppies and turn keys). Of course, for the really cautious, you can always make the change after booting off of the maintenance floppies... ------------------------------ Subject: 8.10: How do I make an export list from a library archive? [ formerly in section 2.17 ] This script will only extract the "export"able names and should be useful in starting the shared library creation process. The user must determine which names should be included in the import and export lists. It's only been tested on a few library archives. #!/bin/ksh # # mkexps - make export list # This program creates an export list by combining all the "." and normal names # into one list. # if [[ "$#" -ne 1 ]] then print "Usage: mkexps ArchiveFile" exit -2 fi if [[ ! -f $1 ]] then print "mkexps: Cannot open file \"$1\"" exit -1 fi dump -g $1 | awk ' BEGIN { top = 1 } /^[ ]*[0-9][0-9]*/ { if ( (n = index( $2, "." )) > 0 ) { export_array[ top++ ] = substr( $2, n+1, length( $2 )) } else { export_array[ top++ ] = $2 } } END { for ( i = 1; i < top; i++ ) { print export_array[ i ] } }' | sort | uniq ------------------------------ Subject: 9.00: Contributors The following persons have contributed to this list. If you want to contribute anonymously, just let me know - but do tell me who you are. I apologize if I omitted anyone. Thank you all, this would definitely not be the same without _your_ input. First and foremost (primus inter pares), Jens-Uwe Mager <jum@anubis.han.de> for keeping this FAQ from falling into the Great Bit Bucket (for $$ knows how long). And all the people that insist on making the difference: Luis Basto <basto@cactus.org> Rudy Chukran <chukran@austin.VNET.IBM.COM> Christopher Carlyle O'Callaghan <asdfjkl@wam.umd.edu> Poul-Henning Kamp <phk@data.fls.dk> Richard Wendland <richard@praxis.co.uk> Ge van Geldorp <ge@dutlru2.tudelft.nl> Chris Jacobsen <jacobsen@sbhep2.phy.sunysb.edu> Peter Jeffe <peter@ski.austin.ibm.com> Jean-Francois Panisset <panisset@thunder.mcrcim.mcgill.edu> John Cary <cary@boulder.colorado.edu> Vijay Debbad <vijay@ingres.com> Dick Karpinski <dick@ccnext.ucsf.edu> Konrad Haedener <haedener@iac.unibe.ch> Doug Sewell <DOUG@YSUB.YSU.EDU> David Cordes <cordes@athos.cs.ua.edu> Graeme Moffat <g.moffat@aukuni.ac.nz> Andrew Pierce <pierce@claven.cambridge.ibm.com> Stephen Linam <sdl@glasnost.austin.ibm.com> Jerome Park <jerome%aixserv@uunet.UU.NET> Konrad Haedener <haedener@iacrs1.unibe.ch> Steve Roseman <lusgr@chili.CC.Lehigh.Edu> John Burton <burton@asdsun.larc.nasa.gov> Thierry Forveille <FORVEILL@FRGAG51.BITNET> Joubert Berger <afc-tci!joubert> Minh Tran-Le <tranle@intellicorp.com> Paul Amaranth <amaranth@vela.acs.oakland.edu> Mark Whetzel <mark.whetzel@waii.com> Daniel Packman <pack@acd.ucar.edu> Ken Bowman <bowman@uiatma.atmos.uiuc.edu> Cary E. Burnette <kerm@mcnc.org> Christophe Wolfhugel <wolf@grasp1.univ-lyon1.fr> Leonard B. Tropiano <lenny@aixwiz.austin.ibm.com> Bill Wohler <wohler@newt.com> James Salter <jsalter@netscape.com> Witold Jan Owoc <witold@enme.ucalgary.ca> Marc Kwiatkowski <marc@ultra.com> Ronald S. Woan <woan@austin.ibm.com> Mijan Huq <huq@hagar.ph.utexas.edu> Herbert van den Bergh <hbergh@nl.oracle.com> Michael Stefanik <mike@bria.UUCP> Julianne F. Haugh <jfh@austin.ibm.com> Ed Kubaitis <ejk@ux2.cso.uiuc.edu> Jaime Vazquez <jaime@austin.vnet.ibm.com> Bjorn Engsig <bengsig@oracle.com> Frank Kraemer <kraemerf@franvm3.VNET.IBM.COM> Andreas Siegert <afx@muc.ibm.de> Thomas Braunbeck <braunbec@aixserv.mainz.ibm.de> Marc Pawliger <marc@sti.com> Mel Beckman <mbeckman@mbeckman.mbeckman.com > Ole Holm Nielsen <Ole.H.Nielsen@fysik.dtu.dk> David Dennerline <d.dennerline@bull.com> David Alexander <dave_alexander@rednet.co.uk> Ciaran Deignan <C.Deignan@frec.bull.fr> Varouj Vosguian <Varouj@Planmatics.com> Richard Kessler <71051.1106@compuserve.com> Jeff Warrington <jwarring@aol.net> Gary R. Hook <hook@austin.ibm.com> David Edelsohn <dje@watson.ibm.com> Mark Bergman <mark.bergman@syseca.co.uk> Jonathan S. Stibal <Jonathan_S_Stibal@email.whirlpool.com> Charles J. Fisher <cfisher@bigfoot.com> Lawry Simm <lawry.simm@heywood.co.uk> Michael Wojcik <mww@microfocus.com> Matt Willman <Willman.matt@cnf.com> Jan Just Keijser <KeijserJJ@logica.com> Olaf Meeuwissen <olaf@IMSL.shinshu-u.ac.jp> Michael Bhalla <mbhalla@us.ibm.com> Brent Burkholder <bburk@bicnet.net> Joerg Schumacher <schuma@gaertner.de> Frank Winans <fwinans@yahoo.com> Franz Pestenhofer <franz.pestenhofer@debis.com> Opinions expressed here have nothing to do with IBM or my employer. In fact, most of these opinions are borrowed from other people :) All trademarks are the property of their respective owners. $HOME is where the $HEART is. (but you already knew that)
Закладки на сайте Проследить за страницей |
Created 1996-2024 by Maxim Chirkov Добавить, Поддержать, Вебмастеру |