/rc/bin/termrc
% cat >/sys/lib/dist/changes/1176444006.0.txt << EOF
• Remove local terminal startup settings for inclusion in termrc.local.
• Condense some rather nasty case / if statements.
EOF
[geoff] --rwxrwxr-x M 121 glenda sys 1665 Apr 13 02:01 rc/bin/termrc
/n/sourcesdump/2007/0413/plan9/rc/bin/termrc:1,12 -
/n/sources/plan9/rc/bin/termrc:1,5
- #!/bin/rc -x
-
- # replace FILESERVER with the name of your file server
- # here we start with kfs, your local disk file system
- fileserver=kfs
- # replace CPU with the name of your cpu server
- cpu=CPU
- # replace FACEDOM with the local domain to be used in the faces database
- facedom=FACEDOM
+ #!/bin/rc
+ # terminal startup
TIMESYNCARGS=(-rLa1000000)
NDBFILE=/lib/ndb/local
/n/sourcesdump/2007/0413/plan9/rc/bin/termrc:15,21 -
/n/sources/plan9/rc/bin/termrc:8,13
mntgen -s slashn && chmod 666 /srv/slashn
-
# cs sets sysname
ndb/cs -f $NDBFILE
sysname=`{cat /dev/sysname}
/n/sourcesdump/2007/0413/plan9/rc/bin/termrc:38,102 -
/n/sources/plan9/rc/bin/termrc:30,78
aux/timesync $TIMESYNCARGS
- switch($terminal){
- case carrera*
- bind -a '#t' /dev
- case *' ss'*
- /bin/bind -a '#w' /dev >/dev/null >[2=1]
- /bin/bind -a '#t' /dev >/dev/null >[2=1]
- case *' magnum'*
- /bin/bind -a '#m' /dev >/dev/null >[2=1]
- /bin/bind -a '#t' /dev >/dev/null >[2=1]
- aux/mouse -dC 0
- case *' indigo'*
- /bin/bind -a '#L' /dev >/dev/null >[2=1]
- /bin/bind -a '#w1' /dev >/dev/null >[2=1]
- /bin/bind -a '#t' /dev >/dev/null >[2=1]
- /bin/bind -a '#A' /dev >/dev/null >[2=1]
- case NCR* 'AT&TNSX'* generic* _MP_* 'alpha apc'*
- for(i in H w f t m v L S P U '$' Σ κ)
- /bin/bind -a '#'^$i /dev >/dev/null >[2=1]
+ # bind all likely devices (#S was bound in boot)
+ for(i in f t m v L P U '$' Σ κ)
+ /bin/bind -a '#'^$i /dev >/dev/null >[2=1]
- diskparts
+ diskparts
- if(! ~ `{cat /dev/user} none)
- aux/vmware
- if(~ $mouseport ask){
- echo -n 'mouseport is (ps2, ps2intellimouse, 0, 1, 2)[ps2]: '
- mouseport=`{read}
- if(~ $#mouseport 0)
- mouseport=ps2
+ # watch this space
+
+ if(! ~ `{cat /dev/user} none)
+ aux/vmware
+ if(~ $mouseport ask){
+ echo -n 'mouseport is (ps2, ps2intellimouse, 0, 1, 2)[ps2]: '
+ mouseport=`{read}
+ if(~ $#mouseport 0)
+ mouseport=ps2
+ }
+ if(~ $vgasize ask){
+ echo -n 'vgasize [640x480x8]: '
+ vgasize=`{read}
+ if(~ $#vgasize 0)
+ vgasize=640x480x8
+ }
+ if(~ $monitor ask){
+ echo -n 'monitor is [xga]: '
+ monitor=`{read}
+ if(~ $#monitor 0)
+ monitor=xga
+ }
+ if(test -f /dev/mousectl){
+ switch($mouseport){
+ case ps2 ps2intellimouse 0 1 2
+ aux/mouse $mouseport
+ # parse vgasize into fields
+ vgasize=`{echo $vgasize}
+ if(! ~ $"monitor '' && ! ~ `{cat /dev/user} none)
+ aux/vga -l $vgasize
+ if(~ $accupoint 1)
+ pipefile -dr /bin/aux/accupoint /dev/mouse
}
- if(~ $vgasize ask){
- echo -n 'vgasize [640x480x8]: '
- vgasize=`{read}
- if(~ $#vgasize 0)
- vgasize=640x480x8
- }
- if(~ $monitor ask){
- echo -n 'monitor is [xga]: '
- monitor=`{read}
- if(~ $#monitor 0)
- monitor=xga
- }
- if(test -f /dev/mousectl){
- switch($mouseport){
- case ps2 ps2intellimouse 0 1 2
- aux/mouse $mouseport
- # parse vgasize into fields
- vgasize=`{echo $vgasize}
- if(! ~ $"monitor '' && ! ~ `{cat /dev/user} none)
- aux/vga -l $vgasize
- if(~ $accupoint 1)
- pipefile -dr /bin/aux/accupoint /dev/mouse
- }
- }
- # start up local swapping, mount dos fat fs
- disk=`{ls /dev/sd*/swap >[2]/dev/null}
- if (! ~ $#disk 0) {
- swap $disk(1) >/dev/null >[2=1]
- dossrv
- c:
- }
- rm /env/disk
}
+
+ # start up local swapping
+ disk=`{ls /dev/sd*/swap >[2]/dev/null}
+ if (! ~ $#disk 0)
+ swap $disk(1) >/dev/null >[2=1]
+ rm /env/disk
[geoff] --rwxrwxr-x M 121 glenda sys 1665 Apr 13 02:01 rc/bin/termrc
/rc/bin/cpurc.local
% cat >/sys/lib/dist/changes/1176444006.1.txt << EOF
Create a new default cpurc.local based on local site settings that were
ripped from the default cpurc
EOF
[geoff] --rwxrwxr-x M 121 geoff sys 448 Apr 13 18:06 rc/bin/cpurc.local
[geoff] --rwxrwxr-x M 121 geoff sys 448 Apr 13 18:06 rc/bin/cpurc.local
/tmp/diff100000003574:0 -
/n/sources/plan9/rc/bin/cpurc.local:1,14
+ #!/bin/rc
+ # local cpu startup
+
+ # used only by upas, as default return domain appended to all unqualified
+ # return addresses, even local ones
+ site=plan9
+ # replace FILESERVER with the name of your file server
+ # here we start with kfs, your local disk file system
+ fileserver=kfs
+ # replace FACEDOM with the local domain to be used in the faces database
+ facedom=FACEDOM
+
+ # turn on cooperative scheduling (assuming it starts off)
+ echo coop > /dev/reboot
[geoff] --rwxrwxr-x M 121 geoff sys 448 Apr 13 18:06 rc/bin/cpurc.local
/rc/bin/termrc.local
% cat >/sys/lib/dist/changes/1176444006.2.txt << EOF
Create a new default cpurc.local based on local site settings that were
ripped from the default cpurc
EOF
[geoff] --rwxrwxr-x M 121 geoff sys 425 Apr 13 17:34 rc/bin/termrc.local
[geoff] --rwxrwxr-x M 121 geoff sys 425 Apr 13 17:34 rc/bin/termrc.local
/tmp/diff100000003615:0 -
/n/sources/plan9/rc/bin/termrc.local:1,13
+ #!/bin/rc
+ # local terminal startup
+
+ # used only by upas, as default return domain appended to all unqualified
+ # return addresses, even local ones
+ site=plan9
+ # replace FILESERVER with the name of your file server
+ # here we start with kfs, your local disk file system
+ fileserver=kfs
+ # replace FACEDOM with the local domain to be used in the faces database
+ facedom=FACEDOM
+ # replace CPU with the name of your cpu server
+ cpu=CPU
[geoff] --rwxrwxr-x M 121 geoff sys 425 Apr 13 17:34 rc/bin/termrc.local
% cat >/sys/lib/dist/changes/1176445806.0.txt << EOF
• Remove local terminal startup settings for inclusion in cpurc.local.
• Take some changes mentioned on 9fans about what sections are commented
out and which are not into account.
• On that note, provide some extra comments on how one might customize
or use cpurc. Step in the right direction; makes using this much more
friendly.
• Whitespace / spelling / consistency changes
EOF
[geoff] --rwxrwxr-x M 121 glenda sys 1884 Apr 13 02:13 rc/bin/cpurc
/n/sourcesdump/2007/0413/plan9/rc/bin/cpurc:1,14 -
/n/sources/plan9/rc/bin/cpurc:1,7
#!/bin/rc
- echo -n cpu > /env/service
+ # cpu server start up
date > /env/boottime
- # replace FILESERVER with the name of your file server
- # here we start with kfs, your local disk file system
- fileserver=kfs
-
- # replace FACEDOM with the local domain to be used in the faces database
- facedom=FACEDOM
-
# mount points
mntgen -s slashn && chmod 666 /srv/slashn
/n/sourcesdump/2007/0413/plan9/rc/bin/cpurc:15,21 -
/n/sources/plan9/rc/bin/cpurc:8,13
# name translation, cs sets /dev/sysname
ndb/cs
sysname=`{cat /dev/sysname}
- ndb/dns -r
# parallelism for mk
NPROC = `{wc -l </dev/sysstat}
/n/sourcesdump/2007/0413/plan9/rc/bin/cpurc:22,32 -
/n/sources/plan9/rc/bin/cpurc:14,28
prompt=($sysname^'# ' ' ')
- # site specific startup
+ # site-specific startup
if(test -e /rc/bin/cpurc.local)
. /rc/bin/cpurc.local
- # cpu specific startup
+ # cpu-specific startup such as
+ # ip/ipconfig ether /dev/ether0 ip gw ...
+ # ndb/dns -s
+ # ip/dhcpd
+ # ip/tftpd
if(test -e /cfg/$sysname/cpurc)
. /cfg/$sysname/cpurc
/n/sourcesdump/2007/0413/plan9/rc/bin/cpurc:40,49 -
/n/sources/plan9/rc/bin/cpurc:36,41
if(! grep -s 127.0.0.1 /net/ipselftab)
ip/ipconfig loopback /dev/null 127.1
- # uncomment the following for booting other systems
- #ip/dhcpd
- #ip/tftpd
-
# If you are on an auth server, start these before listening:
#
# auth/keyfs -wp -m /mnt/keys /adm/keys >/dev/null >[2=1]
/n/sourcesdump/2007/0413/plan9/rc/bin/cpurc:61,68 -
/n/sources/plan9/rc/bin/cpurc:53,61
# start listeners if it hasn't already been done (dicey check)
if(! netstat -n | grep -s 'tcp.*Listen.* (7|9|21|22|23|25|110|113|565|993|17007|17009|17010) .*')
aux/listen -q tcp
- #if(! netstat -n | grep -v 17008 | grep -s il.*Listen)
- # aux/listen -q il
+ # we don't use IL, maybe you do
+ if(! netstat -n | grep -v 17008 | grep -s il.*Listen)
+ aux/listen -q il
if(! ps|grep -s timesync) {
aux/timesync -n pool.ntp.org
/n/sourcesdump/2007/0413/plan9/rc/bin/cpurc:72,81 -
/n/sources/plan9/rc/bin/cpurc:65,74
} &
}
- # cpu specific startup
- #if(test -e /cfg/$sysname/cpustart)
- # . /cfg/$sysname/cpustart
+ # cpu-specific late startup
+ if(test -e /cfg/$sysname/cpustart)
+ . /cfg/$sysname/cpustart
- #echo `{date} $sysname >>/sys/log/boot
+ # echo `{date} $sysname >>/sys/log/boot
exit ''
/sys/lib/man/lookman/index
% cat >/sys/lib/dist/changes/1176485406.0.txt << EOF
Dunno. Looks like the same file to me. Guess it got updated due to the other
manpage updates that were submitted today.
EOF
[sys] --rw-rw-r-- M 121 glenda sys 1500899 Apr 13 13:32 sys/lib/man/lookman/index
[sys] --rw-rw-r-- M 121 glenda sys 1500899 Apr 13 13:32 sys/lib/man/lookman/index
/sys/include/ip.h
% cat >/sys/lib/dist/changes/1176499807.0.txt << EOF
• Fix comment style (more on the // -> /* */ rampage!)
• s/cntrol/control/
EOF
[geoff] --rw-rw-r-- M 121 glenda sys 2978 Apr 13 17:22 sys/include/ip.h
/n/sourcesdump/2007/0413/plan9/sys/include/ip.h:63,69 -
/n/sources/plan9/sys/include/ip.h:63,69
};
/*
- * user level udp headers with cntrol message "oldheaders".
+ * user level udp headers with control message "oldheaders".
* this is now considered obsolete.
*/
enum
/n/sourcesdump/2007/0413/plan9/sys/include/ip.h:74,87 -
/n/sources/plan9/sys/include/ip.h:74,87
typedef struct OUdphdr OUdphdr;
struct OUdphdr
{
- uchar raddr[IPaddrlen]; /* remote address and port */
- uchar laddr[IPaddrlen]; /* local address and port */
- uchar rport[2];
- uchar lport[2];
+ uchar raddr[IPaddrlen]; /* V6 remote address */
+ uchar laddr[IPaddrlen]; /* V6 local address */
+ uchar rport[2]; /* remote port */
+ uchar lport[2]; /* local port */
};
/*
- * user level udp headers with cntrol message "headers"
+ * user level udp headers with control message "headers"
*/
enum
{
/n/sourcesdump/2007/0413/plan9/sys/include/ip.h:91,101 -
/n/sources/plan9/sys/include/ip.h:91,100
typedef struct Udphdr Udphdr;
struct Udphdr
{
- uchar raddr[IPaddrlen]; /* remote address */
- uchar laddr[IPaddrlen]; /* local address */
- uchar ifcaddr[IPaddrlen]; /* address of ifc message was received from
- (only useful on reception) */
- uchar rport[2]; /* remove port */
+ uchar raddr[IPaddrlen]; /* V6 remote address */
+ uchar laddr[IPaddrlen]; /* V6 local address */
+ uchar ifcaddr[IPaddrlen]; /* V6 ifc addr msg was received on */
+ uchar rport[2]; /* remote port */
uchar lport[2]; /* local port */
};
/sys/include/mp.h
% cat >/sys/lib/dist/changes/1176499807.1.txt << EOF
• Fix comment style (more on the // -> /* */ rampage!)
EOF
[geoff] --rw-rw-r-- M 121 glenda sys 4803 Apr 13 17:18 sys/include/mp.h
/n/sourcesdump/2007/0413/plan9/sys/include/mp.h:3,19 -
/n/sources/plan9/sys/include/mp.h:3,21
#define _MPINT 1
- // the code assumes mpdigit to be at least an int
- // mpdigit must be an atomic type. mpdigit is defined
- // in the architecture specific u.h
+ /*
+ * the code assumes mpdigit to be at least an int
+ * mpdigit must be an atomic type. mpdigit is defined
+ * in the architecture specific u.h
+ */
typedef struct mpint mpint;
struct mpint
{
- int sign; // +1 or -1
- int size; // allocated digits
- int top; // significant digits
+ int sign; /* +1 or -1 */
+ int size; /* allocated digits */
+ int top; /* significant digits */
mpdigit *p;
char flags;
};
/n/sourcesdump/2007/0413/plan9/sys/include/mp.h:21,137 -
/n/sources/plan9/sys/include/mp.h:23,139
enum
{
MPstatic= 0x01,
- Dbytes= sizeof(mpdigit), // bytes per digit
- Dbits= Dbytes*8 // bits per digit
+ Dbytes= sizeof(mpdigit), /* bytes per digit */
+ Dbits= Dbytes*8 /* bits per digit */
};
- // allocation
- void mpsetminbits(int n); // newly created mpint's get at least n bits
- mpint* mpnew(int n); // create a new mpint with at least n bits
+ /* allocation */
+ void mpsetminbits(int n); /* newly created mpint's get at least n bits */
+ mpint* mpnew(int n); /* create a new mpint with at least n bits */
void mpfree(mpint *b);
- void mpbits(mpint *b, int n); // ensure that b has at least n bits
- void mpnorm(mpint *b); // dump leading zeros
+ void mpbits(mpint *b, int n); /* ensure that b has at least n bits */
+ void mpnorm(mpint *b); /* dump leading zeros */
mpint* mpcopy(mpint *b);
void mpassign(mpint *old, mpint *new);
- // random bits
+ /* random bits */
mpint* mprand(int bits, void (*gen)(uchar*, int), mpint *b);
- // conversion
- mpint* strtomp(char*, char**, int, mpint*); // ascii
+ /* conversion */
+ mpint* strtomp(char*, char**, int, mpint*); /* ascii */
int mpfmt(Fmt*);
char* mptoa(mpint*, int, char*, int);
- mpint* letomp(uchar*, uint, mpint*); // byte array, little-endian
+ mpint* letomp(uchar*, uint, mpint*); /* byte array, little-endian */
int mptole(mpint*, uchar*, uint, uchar**);
- mpint* betomp(uchar*, uint, mpint*); // byte array, little-endian
+ mpint* betomp(uchar*, uint, mpint*); /* byte array, little-endian */
int mptobe(mpint*, uchar*, uint, uchar**);
- uint mptoui(mpint*); // unsigned int
+ uint mptoui(mpint*); /* unsigned int */
mpint* uitomp(uint, mpint*);
- int mptoi(mpint*); // int
+ int mptoi(mpint*); /* int */
mpint* itomp(int, mpint*);
- uvlong mptouv(mpint*); // unsigned vlong
+ uvlong mptouv(mpint*); /* unsigned vlong */
mpint* uvtomp(uvlong, mpint*);
- vlong mptov(mpint*); // vlong
+ vlong mptov(mpint*); /* vlong */
mpint* vtomp(vlong, mpint*);
- // divide 2 digits by one
+ /* divide 2 digits by one */
void mpdigdiv(mpdigit *dividend, mpdigit divisor, mpdigit *quotient);
- // in the following, the result mpint may be
- // the same as one of the inputs.
- void mpadd(mpint *b1, mpint *b2, mpint *sum); // sum = b1+b2
- void mpsub(mpint *b1, mpint *b2, mpint *diff); // diff = b1-b2
- void mpleft(mpint *b, int shift, mpint *res); // res = b<<shift
- void mpright(mpint *b, int shift, mpint *res); // res = b>>shift
- void mpmul(mpint *b1, mpint *b2, mpint *prod); // prod = b1*b2
- void mpexp(mpint *b, mpint *e, mpint *m, mpint *res); // res = b**e mod m
- void mpmod(mpint *b, mpint *m, mpint *remainder); // remainder = b mod m
+ /* in the following, the result mpint may be */
+ /* the same as one of the inputs. */
+ void mpadd(mpint *b1, mpint *b2, mpint *sum); /* sum = b1+b2 */
+ void mpsub(mpint *b1, mpint *b2, mpint *diff); /* diff = b1-b2 */
+ void mpleft(mpint *b, int shift, mpint *res); /* res = b<<shift */
+ void mpright(mpint *b, int shift, mpint *res); /* res = b>>shift */
+ void mpmul(mpint *b1, mpint *b2, mpint *prod); /* prod = b1*b2 */
+ void mpexp(mpint *b, mpint *e, mpint *m, mpint *res); /* res = b**e mod m */
+ void mpmod(mpint *b, mpint *m, mpint *remainder); /* remainder = b mod m */
- // quotient = dividend/divisor, remainder = dividend % divisor
+ /* quotient = dividend/divisor, remainder = dividend % divisor */
void mpdiv(mpint *dividend, mpint *divisor, mpint *quotient, mpint *remainder);
- // return neg, 0, pos as b1-b2 is neg, 0, pos
+ /* return neg, 0, pos as b1-b2 is neg, 0, pos */
int mpcmp(mpint *b1, mpint *b2);
- // extended gcd return d, x, and y, s.t. d = gcd(a,b) and ax+by = d
+ /* extended gcd return d, x, and y, s.t. d = gcd(a,b) and ax+by = d */
void mpextendedgcd(mpint *a, mpint *b, mpint *d, mpint *x, mpint *y);
- // res = b**-1 mod m
+ /* res = b**-1 mod m */
void mpinvert(mpint *b, mpint *m, mpint *res);
- // bit counting
- int mpsignif(mpint*); // number of sigificant bits in mantissa
- int mplowbits0(mpint*); // k, where n = 2**k * q for odd q
+ /* bit counting */
+ int mpsignif(mpint*); /* number of sigificant bits in mantissa */
+ int mplowbits0(mpint*); /* k, where n = 2**k * q for odd q */
- // well known constants
+ /* well known constants */
extern mpint *mpzero, *mpone, *mptwo;
- // sum[0:alen] = a[0:alen-1] + b[0:blen-1]
- // prereq: alen >= blen, sum has room for alen+1 digits
+ /* sum[0:alen] = a[0:alen-1] + b[0:blen-1] */
+ /* prereq: alen >= blen, sum has room for alen+1 digits */
void mpvecadd(mpdigit *a, int alen, mpdigit *b, int blen, mpdigit *sum);
- // diff[0:alen-1] = a[0:alen-1] - b[0:blen-1]
- // prereq: alen >= blen, diff has room for alen digits
+ /* diff[0:alen-1] = a[0:alen-1] - b[0:blen-1] */
+ /* prereq: alen >= blen, diff has room for alen digits */
void mpvecsub(mpdigit *a, int alen, mpdigit *b, int blen, mpdigit *diff);
- // p[0:n] += m * b[0:n-1]
- // prereq: p has room for n+1 digits
+ /* p[0:n] += m * b[0:n-1] */
+ /* prereq: p has room for n+1 digits */
void mpvecdigmuladd(mpdigit *b, int n, mpdigit m, mpdigit *p);
- // p[0:n] -= m * b[0:n-1]
- // prereq: p has room for n+1 digits
+ /* p[0:n] -= m * b[0:n-1] */
+ /* prereq: p has room for n+1 digits */
int mpvecdigmulsub(mpdigit *b, int n, mpdigit m, mpdigit *p);
- // p[0:alen*blen-1] = a[0:alen-1] * b[0:blen-1]
- // prereq: alen >= blen, p has room for m*n digits
+ /* p[0:alen*blen-1] = a[0:alen-1] * b[0:blen-1] */
+ /* prereq: alen >= blen, p has room for m*n digits */
void mpvecmul(mpdigit *a, int alen, mpdigit *b, int blen, mpdigit *p);
- // sign of a - b or zero if the same
+ /* sign of a - b or zero if the same */
int mpveccmp(mpdigit *a, int alen, mpdigit *b, int blen);
- // divide the 2 digit dividend by the one digit divisor and stick in quotient
- // we assume that the result is one digit - overflow is all 1's
+ /* divide the 2 digit dividend by the one digit divisor and stick in quotient */
+ /* we assume that the result is one digit - overflow is all 1's */
void mpdigdiv(mpdigit *dividend, mpdigit divisor, mpdigit *quotient);
- // playing with magnitudes
+ /* playing with magnitudes */
int mpmagcmp(mpint *b1, mpint *b2);
- void mpmagadd(mpint *b1, mpint *b2, mpint *sum); // sum = b1+b2
- void mpmagsub(mpint *b1, mpint *b2, mpint *sum); // sum = b1+b2
+ void mpmagadd(mpint *b1, mpint *b2, mpint *sum); /* sum = b1+b2 */
+ void mpmagsub(mpint *b1, mpint *b2, mpint *sum); /* sum = b1+b2 */
- // chinese remainder theorem
- typedef struct CRTpre CRTpre; // precomputed values for converting
- // twixt residues and mpint
- typedef struct CRTres CRTres; // residue form of an mpint
+ /* chinese remainder theorem */
+ typedef struct CRTpre CRTpre; /* precomputed values for converting */
+ /* twixt residues and mpint */
+ typedef struct CRTres CRTres; /* residue form of an mpint */
struct CRTres
{
- int n; // number of residues
- mpint *r[1]; // residues
+ int n; /* number of residues */
+ mpint *r[1]; /* residues */
};
- CRTpre* crtpre(int, mpint**); // precompute conversion values
- CRTres* crtin(CRTpre*, mpint*); // convert mpint to residues
- void crtout(CRTpre*, CRTres*, mpint*); // convert residues to mpint
+ CRTpre* crtpre(int, mpint**); /* precompute conversion values */
+ CRTres* crtin(CRTpre*, mpint*); /* convert mpint to residues */
+ void crtout(CRTpre*, CRTres*, mpint*); /* convert residues to mpint */
void crtprefree(CRTpre*);
void crtresfree(CRTres*);
/sys/src/cmd/cwfs/9p1.c
% cat >/sys/lib/dist/changes/1176501605.1.txt << EOF
This is a pointer, so let's not cast it as such since we have a type for it.
EOF
[geoff] --rw-rw-r-- M 121 geoff sys 29749 Apr 13 17:35 sys/src/cmd/cwfs/9p1.c
/n/sourcesdump/2007/0413/plan9/sys/src/cmd/cwfs/9p1.c:37,43 -
/n/sources/plan9/sys/src/cmd/cwfs/9p1.c:37,43
{
int i;
- srand((ulong)aip + time(nil));
+ srand((uintptr)aip + time(nil));
for(i = 0; i < CHALLEN; i++)
aip->chal[i] = nrand(256);
[geoff] --rw-rw-r-- M 121 geoff sys 5842 Apr 13 17:35 sys/src/cmd/cwfs/auth.c
/n/sourcesdump/2007/0413/plan9/sys/src/cmd/cwfs/auth.c:141,147 -
/n/sources/plan9/sys/src/cmd/cwfs/auth.c:141,147
int i;
if(*why)print("authentication failed: %s: %s\n", phasename[s->phase], why);
- srand((ulong)s + time(nil));
+ srand((uintptr)s + time(nil));
for(i = 0; i < CHALLEN; i++)
s->tr.chal[i] = nrand(256);
s->uid = -1;
[geoff] --rw-rw-r-- M 121 geoff sys 4722 Apr 13 17:34 sys/src/cmd/cwfs/iobuf.c
/n/sourcesdump/2007/0413/plan9/sys/src/cmd/cwfs/iobuf.c:15,21 -
/n/sources/plan9/sys/src/cmd/cwfs/iobuf.c:15,21
if(DEBUG)
print("getbuf %Z(%lld) f=%x\n", d, (Wideoff)addr, flag);
- h = addr + (Off)d*1009;
+ h = addr + (Off)(uintptr)d*1009;
if(h < 0)
h = ~h;
h %= nhiob;
[geoff] --rw-rw-r-- M 121 geoff sys 28859 Apr 13 17:35 sys/src/cmd/cwfs/juke.c
[geoff] --rw-rw-r-- M 121 geoff sys 24371 Apr 13 17:34 sys/src/cmd/cwfs/sub.c
/n/sourcesdump/2007/0413/plan9/sys/src/cmd/cwfs/sub.c:116,122 -
/n/sources/plan9/sys/src/cmd/cwfs/sub.c:116,122
if(fid == NOFID)
return 0;
- h = (long)cp + fid;
+ h = (long)(uintptr)cp + fid;
if(h < 0)
h = ~h;
h %= nelem(flist);
/n/sourcesdump/2007/0413/plan9/sys/src/cmd/cwfs/sub.c:201,207 -
/n/sources/plan9/sys/src/cmd/cwfs/sub.c:201,207
if(!fp || !(cp = fp->cp))
return;
- h = (long)cp + fp->fid;
+ h = (long)(uintptr)cp + fp->fid;
if(h < 0)
h = ~h;
h %= nelem(flist);
/sys/src/cmd/fossil/cache.c
% cat >/sys/lib/dist/changes/1176501605.6.txt << EOF
We know that the I/O error is in reading, so we should specify so.
EOF
[geoff] --rw-rw-r-- M 121 rsc sys 43930 Apr 13 17:36 sys/src/cmd/fossil/cache.c
/n/sourcesdump/2007/0413/plan9/sys/src/cmd/fossil/cache.c:462,468 -
/n/sources/plan9/sys/src/cmd/fossil/cache.c:462,468
return nil;
case BioReadError:
blockPut(b);
- vtSetError("i/o error block 0x%.8ux", addr);
+ vtSetError("error reading block 0x%.8ux", addr);
return nil;
}
}
/n/sourcesdump/2007/0413/plan9/sys/src/cmd/fossil/cache.c:577,583 -
/n/sources/plan9/sys/src/cmd/fossil/cache.c:577,583
case BioReadError:
blockSetIOState(b, BioEmpty);
blockPut(b);
- vtSetError("i/o error block 0x%.8ux", addr);
+ vtSetError("error reading block 0x%.8ux", addr);
return nil;
}
}
/n/sourcesdump/2007/0413/plan9/sys/src/cmd/fossil/cache.c:681,687 -
/n/sources/plan9/sys/src/cmd/fossil/cache.c:681,689
if(n < 0 || !vtSha1Check(score, b->data, n)){
blockSetIOState(b, BioVentiError);
blockPut(b);
- vtSetError("venti i/o error block %V: %r", score);
+ vtSetError(
+ "venti error reading block %V or wrong score: %r",
+ score);
return nil;
}
vtZeroExtend(vtType[type], b->data, n, c->size);
/n/sourcesdump/2007/0413/plan9/sys/src/cmd/fossil/cache.c:691,701 -
/n/sources/plan9/sys/src/cmd/fossil/cache.c:693,703
return b;
case BioVentiError:
blockPut(b);
- vtSetError("venti i/o error block %V", score);
+ vtSetError("venti i/o error or wrong score, block %V", score);
return nil;
case BioReadError:
blockPut(b);
- vtSetError("i/o error block %V", b->score);
+ vtSetError("error reading block %V", b->score);
return nil;
}
/* NOT REACHED */
/sys/man/3/sd
% cat >/sys/lib/dist/changes/1176503406.1.txt << EOF
We should define LUNs at its first usage.
EOF
[geoff] --rw-rw-r-- M 121 glenda sys 5678 Apr 13 18:09 sys/man/3/sd
/n/sourcesdump/2007/0413/plan9/sys/man/3/sd:241,248 -
/n/sources/plan9/sys/man/3/sd:241,249
.SH BUGS
Still in development.
.PP
+ LUNs (logical unit numbers) are not implemented.
For (S)ATA drives,
- LUNs (logical unit numbers) are not merely ignored but are actively
+ LUNs are not merely ignored but are actively
prevented from working except for INQUIRY commands.
.PP
The 4 controller limit for ATA(PI) is not enforced.
/sys/man/8/ipconfig /sys/src/cmd/ip/ipconfig.c
% cat >/sys/lib/dist/changes/1176503406.2.txt << EOF
• Alphabetize options
• Fix section formatting
• More massive // to /* */! Yay.
• Apparently, we're still too lazy to mail presotto a corrected array.
• Fix usage()
• Make ARGF usage consistent
• Whitespace changes
• Do extra argument checking and display usage() if it fails (mostly IP
parsing)
EOF
[geoff] --rw-rw-r-- M 121 glenda sys 6209 Apr 13 18:13 sys/man/8/ipconfig
/n/sourcesdump/2007/0413/plan9/sys/man/8/ipconfig:3,9 -
/n/sources/plan9/sys/man/8/ipconfig:3,9
ipconfig, rip \- Internet configuration and routing
.SH SYNOPSIS
.B ip/ipconfig
- .RB [ -NDGPOdnpr ]
+ .RB [ -DGNOPdnpr ]
.RB [ -b
.IR baud ]
.RB [ -c
/n/sourcesdump/2007/0413/plan9/sys/man/8/ipconfig:20,25 -
/n/sources/plan9/sys/man/8/ipconfig:20,27
.IR dhcpoption ]
.I type
.I device
+ .br
+ .ti +0.5i
.RI [ verb ]
.RI [ local-addr ]
.RI [ mask ]
/n/sourcesdump/2007/0413/plan9/sys/man/8/ipconfig:69,74 -
/n/sources/plan9/sys/man/8/ipconfig:71,77
The verb (default
.IR add )
determines the action performed. The verbs are:
+ .TF remove
.TP
.B add
if the device is not bound to the IP stack, bind it.
/n/sourcesdump/2007/0413/plan9/sys/man/8/ipconfig:81,97 -
/n/sources/plan9/sys/man/8/ipconfig:84,98
.B unbind
unbind the device interface and all its addresses from the
IP stack.
+ .PD
.PP
The options are:
+ .TF M
+ .PD
.TP
.B D
turn on debugging.
.TP
- .B N
- look in /lib/ndb for the IP parameters. This only works if the
- interface is an ethernet. It uses the ethernet address to find
- a matching entry.
- .TP
.B G
use only generic DHCP options. Without this option,
.I ipconfig
/n/sourcesdump/2007/0413/plan9/sys/man/8/ipconfig:102,107 -
/n/sources/plan9/sys/man/8/ipconfig:103,115
Replies to these options contain a list of IP addresses for possible
file servers and auth servers.
.TP
+ .B N
+ look in
+ .B /lib/ndb
+ for the IP parameters. This only works if the
+ interface is an ethernet. It uses the ethernet address to find
+ a matching entry.
+ .TP
.B p
write configuration information to
.BR /net/ndb ,
/n/sourcesdump/2007/0413/plan9/sys/man/8/ipconfig:163,184 -
/n/sources/plan9/sys/man/8/ipconfig:171,195
result will appear in
.B /net/ndb
should this be the first interface. The known options are:
- .EX
- ipmask, timeoff, ipgw, time, name, dns, log, cookie,
- lpr, impress, rl, sys, bflen, dumpfile, dom, swap,
- rootpath, extpath, ipforward, nonlocal, policyfilter,
- maxdatagram, ttl, pathtimeout, pathplateau, mtu,
- subnetslocal, baddr, discovermask, supplymask,
- discoverrouter, rs, staticroutes, trailerencap,
- arptimeout, etherencap, tcpttl, tcpka, tcpkag,
- nisdomain, ni, ntp, netbiosns, netbiosdds,
- netbiostype, netbiosscope, xfont, xdispmanager,
- nisplusdomain, nisplus, homeagent, smtp, pop3, nntp,
- www, finger, irc, st, stdar, ipaddr, lease,
- overload, type, serverid, params, message, maxmsg,
- renewaltime, rebindingtime, vendorclass, clientid,
- tftp, bootfile
- .EE
+ .TP 0.5i
+ \&
+ .ft CW
+ ipmask, timeoff, ipgw, time, name, dns, log, cookie,
+ lpr, impress, rl, sys, bflen, dumpfile, dom, swap,
+ rootpath, extpath, ipforward, nonlocal, policyfilter,
+ maxdatagram, ttl, pathtimeout, pathplateau, mtu,
+ subnetslocal, baddr, discovermask, supplymask,
+ discoverrouter, rs, staticroutes, trailerencap,
+ arptimeout, etherencap, tcpttl, tcpka, tcpkag,
+ nisdomain, ni, ntp, netbiosns, netbiosdds,
+ netbiostype, netbiosscope, xfont, xdispmanager,
+ nisplusdomain, nisplus, homeagent, smtp, pop3, nntp,
+ www, finger, irc, st, stdar, ipaddr, lease,
+ overload, type, serverid, params, message, maxmsg,
+ renewaltime, rebindingtime, vendorclass, clientid,
+ tftp, bootfile
+ .PD
+ .LP
The options
.BR ipmask ,
.BR ipgw ,
/n/sourcesdump/2007/0413/plan9/sys/man/8/ipconfig:187,198 -
/n/sources/plan9/sys/man/8/ipconfig:198,210
and
.B ntp
are always requested.
+ .TF M
+ .PD
.TP
.B O
addresses specified on the command line override those obtained
via DHCP.
A command line address of 0 implies no override.
- .PD
.PP
If DHCP is requested, a process is forked
off to renew the lease before it
[geoff] --rw-rw-r-- M 121 glenda sys 35429 Apr 13 18:14 sys/src/cmd/ip/ipconfig.c
/n/sourcesdump/2007/0413/plan9/sys/src/cmd/ip/ipconfig.c:21,27 -
/n/sources/plan9/sys/src/cmd/ip/ipconfig.c:21,27
Ipifc *ifc;
- // possible verbs
+ /* possible verbs */
enum
{
Vadd,
/n/sourcesdump/2007/0413/plan9/sys/src/cmd/ip/ipconfig.c:33,45 -
/n/sources/plan9/sys/src/cmd/ip/ipconfig.c:33,45
};
struct {
- // locally generated
+ /* locally generated */
char *type;
char *dev;
char mpoint[32];
- int cfd; // ifc control channel
+ int cfd; /* ifc control channel */
char *cputype;
- uchar hwa[32]; // hardware address
+ uchar hwa[32]; /* hardware address */
int hwatype;
int hwalen;
uchar cid[32];
/n/sourcesdump/2007/0413/plan9/sys/src/cmd/ip/ipconfig.c:46,52 -
/n/sources/plan9/sys/src/cmd/ip/ipconfig.c:46,52
int cidlen;
char *baud;
- // learned info
+ /* learned info */
uchar gaddr[IPaddrlen];
uchar laddr[IPaddrlen];
uchar mask[IPaddrlen];
/n/sourcesdump/2007/0413/plan9/sys/src/cmd/ip/ipconfig.c:57,63 -
/n/sources/plan9/sys/src/cmd/ip/ipconfig.c:57,63
uchar ntp[IPaddrlen];
int mtu;
- // dhcp specific
+ /* dhcp specific */
int state;
int fd;
ulong xid;
/n/sourcesdump/2007/0413/plan9/sys/src/cmd/ip/ipconfig.c:89,97 -
/n/sources/plan9/sys/src/cmd/ip/ipconfig.c:89,99
int type;
};
- // I was too lazy to look up the types for each of these
- // options. If someone feels like it, please mail me a
- // corrected array -- presotto
+ /*
+ * I was too lazy to look up the types for each of these
+ * options. If someone feels like it, please mail me a
+ * corrected array -- presotto
+ */
Option option[256] =
{
[OBmask] { "ipmask", Taddr },
/n/sourcesdump/2007/0413/plan9/sys/src/cmd/ip/ipconfig.c:236,242 -
/n/sources/plan9/sys/src/cmd/ip/ipconfig.c:238,246
void
usage(void)
{
- fprint(2, "usage: %s [-ndDrGX] [-x netmtpt] [-m mtu] [-b baud] [-g gateway] [-h hostname] [-c control-string]* type device [verb] [localaddr [mask [remoteaddr [fsaddr [authaddr]]]]]\n", argv0);
+ fprint(2,
+ "usage: %s [-ndDrGX] [-x netmtpt] [-m mtu] [-b baud] [-g gateway] [-h hostname] [-c ctlmsg]* type device [verb] [localaddr [mask [remoteaddr [fsaddr [authaddr]]]]]\n",
+ argv0);
exits("usage");
}
/n/sourcesdump/2007/0413/plan9/sys/src/cmd/ip/ipconfig.c:261,267 -
/n/sources/plan9/sys/src/cmd/ip/ipconfig.c:265,271
retry = 0;
ctll = &firstctl;
- // init set of requested parameters with the default
+ /* init set of requested parameters with the default */
nrequested = sizeof(defrequested);
memcpy(requested, defrequested, nrequested);
/n/sourcesdump/2007/0413/plan9/sys/src/cmd/ip/ipconfig.c:284,298 -
/n/sources/plan9/sys/src/cmd/ip/ipconfig.c:288,296
case 'P':
beprimary = 0;
case 'b':
- p = ARGF();
- if(p == nil)
- usage();
- conf.baud = p;
+ conf.baud = EARGF(usage());
break;
case 'c':
- p = ARGF();
- if(p == nil)
- usage();
cp = malloc(sizeof(*cp));
if(cp == nil)
sysfatal("%r");
/n/sourcesdump/2007/0413/plan9/sys/src/cmd/ip/ipconfig.c:299,320 -
/n/sources/plan9/sys/src/cmd/ip/ipconfig.c:297,314
*ctll = cp;
ctll = &cp->next;
cp->next = nil;
- cp->ctl = p;
+ cp->ctl = EARGF(usage());
break;
case 'd':
dodhcp = 1;
break;
case 'g':
- p = ARGF();
- if(p == nil)
+ if (parseip(conf.gaddr, EARGF(usage())) == -1)
usage();
- parseip(conf.gaddr, p);
break;
case 'h':
- p = ARGF();
- if(p == nil)
- usage();
- snprint(conf.hostname, sizeof(conf.hostname), "%s", p);
+ snprint(conf.hostname, sizeof conf.hostname, "%s",
+ EARGF(usage()));
sendhostname = 1;
break;
case 'n':
/n/sourcesdump/2007/0413/plan9/sys/src/cmd/ip/ipconfig.c:321,350 -
/n/sources/plan9/sys/src/cmd/ip/ipconfig.c:315,341
noconfig = 1;
break;
case 'm':
- p = ARGF();
- if(p == nil)
- usage();
- conf.mtu = atoi(p);
+ conf.mtu = atoi(EARGF(usage()));
break;
case 'r':
retry = 1;
break;
case 'x':
- p = ARGF();
- if(p == nil)
- usage();
- setnetmtpt(conf.mpoint, sizeof(conf.mpoint), p);
+ setnetmtpt(conf.mpoint, sizeof conf.mpoint, EARGF(usage()));
break;
case 'X':
nodhcpwatch = 1;
break;
case 'o':
- if(addoption(ARGF()) < 0)
+ if(addoption(EARGF(usage())) < 0)
usage();
break;
+ default:
+ usage();
+ break;
} ARGEND;
- // default to any host name we already have
+ /* default to any host name we already have */
if(*conf.hostname == 0){
p = getenv("sysname");
if(p == nil || *p == 0)
/n/sourcesdump/2007/0413/plan9/sys/src/cmd/ip/ipconfig.c:351,364 -
/n/sources/plan9/sys/src/cmd/ip/ipconfig.c:342,355
p = sysname();
if(p != nil)
strncpy(conf.hostname, p, sizeof(conf.hostname)-1);
- }
+ }
- // default
+ /* default */
conf.type = "ether";
conf.dev = "/net/ether0";
action = Vadd;
- // get verb, default is "add"
+ /* get verb, default is "add" */
while(argc > 0){
verb = parseverb(argv[0]);
switch(verb){
/n/sourcesdump/2007/0413/plan9/sys/src/cmd/ip/ipconfig.c:382,405 -
/n/sources/plan9/sys/src/cmd/ip/ipconfig.c:373,406
argc--, argv++;
}
- // get addresses
+ /* get addresses */
switch(argc){
case 5:
- parseip(conf.auth, argv[4]);
+ if (parseip(conf.auth, argv[4]) == -1)
+ usage();
/* fall through */
case 4:
- parseip(conf.fs, argv[3]);
+ if (parseip(conf.fs, argv[3]) == -1)
+ usage();
/* fall through */
case 3:
- parseip(conf.raddr, argv[2]);
+ if (parseip(conf.raddr, argv[2]) == -1)
+ usage();
/* fall through */
case 2:
if(strcmp(argv[1], "0") != 0)
- parseipmask(conf.mask, argv[1]);
+ if (parseipmask(conf.mask, argv[1]) == -1)
+ usage();
/* fall through */
case 1:
- parseip(conf.laddr, argv[0]);
+ if (parseip(conf.laddr, argv[0]) == -1)
+ usage();
break;
+ case 0:
+ break;
+ default:
+ usage();
+ break;
}
switch(action){
/n/sourcesdump/2007/0413/plan9/sys/src/cmd/ip/ipconfig.c:439,450 -
/n/sources/plan9/sys/src/cmd/ip/ipconfig.c:440,451
{
int tries;
- // get number of preexisting interfaces
+ /* get number of preexisting interfaces */
nip = nipifcs(conf.mpoint);
if(beprimary == -1 && (nip == 0 || !havendb(conf.mpoint)))
beprimary = 1;
- // get ipifc into name space and condition device for ip
+ /* get ipifc into name space and condition device for ip */
if(!noconfig){
lookforip(conf.mpoint);
controldevice();
/n/sourcesdump/2007/0413/plan9/sys/src/cmd/ip/ipconfig.c:458,464 -
/n/sources/plan9/sys/src/cmd/ip/ipconfig.c:459,465
dodhcp = 1;
}
- // run dhcp if we need something
+ /* run dhcp if we need something */
if(dodhcp){
mkclientid();
for(tries = 0; tries < 6; tries++){
/n/sourcesdump/2007/0413/plan9/sys/src/cmd/ip/ipconfig.c:487,493 -
/n/sources/plan9/sys/src/cmd/ip/ipconfig.c:488,494
dhcpwatch(0);
}
- // leave everything we've learned somewhere other procs can find it
+ /* leave everything we've learned somewhere other procs can find it */
if(beprimary == 1){
putndb();
tweakservers();
/n/sourcesdump/2007/0413/plan9/sys/src/cmd/ip/ipconfig.c:555,561 -
/n/sources/plan9/sys/src/cmd/ip/ipconfig.c:556,562
}
}
- // set the default route
+ /* set the default route */
void
adddefroute(char *mpoint, uchar *gaddr)
{
/n/sourcesdump/2007/0413/plan9/sys/src/cmd/ip/ipconfig.c:573,579 -
/n/sources/plan9/sys/src/cmd/ip/ipconfig.c:574,580
close(cfd);
}
- // create a client id
+ /* create a client id */
void
mkclientid(void)
{
/n/sourcesdump/2007/0413/plan9/sys/src/cmd/ip/ipconfig.c:591,597 -
/n/sources/plan9/sys/src/cmd/ip/ipconfig.c:592,598
}
}
- // bind ip into the namespace
+ /* bind ip into the namespace */
void
lookforip(char *net)
{
/n/sourcesdump/2007/0413/plan9/sys/src/cmd/ip/ipconfig.c:603,609 -
/n/sources/plan9/sys/src/cmd/ip/ipconfig.c:604,610
sysfatal("no ip stack bound onto %s", net);
}
- // send some ctls to a device
+ /* send some ctls to a device */
void
controldevice(void)
{
/n/sourcesdump/2007/0413/plan9/sys/src/cmd/ip/ipconfig.c:628,636 -
/n/sources/plan9/sys/src/cmd/ip/ipconfig.c:629,638
sysfatal("ctl message %s: %r", cp->ctl);
seek(fd, 0, 0);
}
+ // close(fd); /* or does it need to be left hanging? */
}
- // bind an ip stack to a device, leave the control channel open
+ /* bind an ip stack to a device, leave the control channel open */
void
binddevice(void)
{
/n/sourcesdump/2007/0413/plan9/sys/src/cmd/ip/ipconfig.c:637,653 -
/n/sources/plan9/sys/src/cmd/ip/ipconfig.c:639,655
char buf[256];
if(myifc < 0){
- // get a new ip interface
+ /* get a new ip interface */
snprint(buf, sizeof(buf), "%s/ipifc/clone", conf.mpoint);
conf.cfd = open(buf, ORDWR);
if(conf.cfd < 0)
sysfatal("opening %s/ipifc/clone: %r", conf.mpoint);
- // specify the medium as an ethernet, and bind the interface to it
+ /* specify the medium as an ethernet, and bind the interface to it */
if(fprint(conf.cfd, "bind %s %s", conf.type, conf.dev) < 0)
sysfatal("binding device: %r");
} else {
- // open the old interface
+ /* open the old interface */
snprint(buf, sizeof(buf), "%s/ipifc/%d/ctl", conf.mpoint, myifc);
conf.cfd = open(buf, ORDWR);
if(conf.cfd < 0)
/n/sourcesdump/2007/0413/plan9/sys/src/cmd/ip/ipconfig.c:656,662 -
/n/sources/plan9/sys/src/cmd/ip/ipconfig.c:658,664
}
- // add a logical interface to the ip stack
+ /* add a logical interface to the ip stack */
int
ipconfig(void)
{
/n/sourcesdump/2007/0413/plan9/sys/src/cmd/ip/ipconfig.c:690,696 -
/n/sources/plan9/sys/src/cmd/ip/ipconfig.c:692,698
return 0;
}
- // remove a logical interface to the ip stack
+ /* remove a logical interface to the ip stack */
void
ipunconfig(void)
{
/n/sourcesdump/2007/0413/plan9/sys/src/cmd/ip/ipconfig.c:713,719 -
/n/sources/plan9/sys/src/cmd/ip/ipconfig.c:715,721
ipmove(conf.raddr, IPnoaddr);
ipmove(conf.mask, IPnoaddr);
- // forget configuration info
+ /* forget configuration info */
if(beprimary==1)
writendb("", 0, 0);
}
/n/sourcesdump/2007/0413/plan9/sys/src/cmd/ip/ipconfig.c:739,745 -
/n/sources/plan9/sys/src/cmd/ip/ipconfig.c:741,747
}
notify(ding);
- // try dhcp for 10 seconds
+ /* try dhcp for 10 seconds */
conf.xid = lrand();
conf.starttime = time(0);
conf.state = startstate;
/n/sourcesdump/2007/0413/plan9/sys/src/cmd/ip/ipconfig.c:789,795 -
/n/sources/plan9/sys/src/cmd/ip/ipconfig.c:791,797
break;
}
- // keep trying to renew the lease
+ /* keep trying to renew the lease */
for(;;){
if(conf.lease == 0)
secs = 5;
/n/sourcesdump/2007/0413/plan9/sys/src/cmd/ip/ipconfig.c:796,802 -
/n/sources/plan9/sys/src/cmd/ip/ipconfig.c:798,804
else
secs = conf.lease>>1;
- // avoid overflows
+ /* avoid overflows */
for(s = secs; s > 0; s -= t){
if(s > MAXSLEEP)
t = MAXSLEEP;
/n/sourcesdump/2007/0413/plan9/sys/src/cmd/ip/ipconfig.c:806,813 -
/n/sources/plan9/sys/src/cmd/ip/ipconfig.c:808,817
}
if(conf.lease > 0){
- // during boot, the starttime can be bogus so avoid
- // spurious ipinconfig's
+ /*
+ * during boot, the starttime can be bogus so avoid
+ * spurious ipinconfig's
+ */
t = time(0) - conf.starttime;
if(t > (3*secs)/2)
t = secs;
/n/sourcesdump/2007/0413/plan9/sys/src/cmd/ip/ipconfig.c:827,833 -
/n/sources/plan9/sys/src/cmd/ip/ipconfig.c:831,837
sysfatal("can't start ip: %r");
needconfig = 0;
- // leave everything we've learned somewhere other procs can find it
+ /* leave everything we've learned somewhere other procs can find it */
if(beprimary==1){
putndb();
tweakservers();
/n/sourcesdump/2007/0413/plan9/sys/src/cmd/ip/ipconfig.c:919,925 -
/n/sources/plan9/sys/src/cmd/ip/ipconfig.c:923,929
default:
sysfatal("dhcpsend: unknown message type: %d", type);
case Discover:
- ipmove(up->raddr, IPv4bcast); // broadcast
+ ipmove(up->raddr, IPv4bcast); /* broadcast */
if(*conf.hostname && sendhostname)
p = optaddstr(p, OBhostname, conf.hostname);
if(plan9){
/n/sourcesdump/2007/0413/plan9/sys/src/cmd/ip/ipconfig.c:937,947 -
/n/sources/plan9/sys/src/cmd/ip/ipconfig.c:941,951
v6tov4(bp.ciaddr, conf.laddr);
break;
case Srebinding:
- ipmove(up->raddr, IPv4bcast); // broadcast
+ ipmove(up->raddr, IPv4bcast); /* broadcast */
v6tov4(bp.ciaddr, conf.laddr);
break;
case Srequesting:
- ipmove(up->raddr, IPv4bcast); // broadcast
+ ipmove(up->raddr, IPv4bcast); /* broadcast */
p = optaddaddr(p, ODipaddr, conf.laddr);
p = optaddaddr(p, ODserverid, conf.server);
break;
/n/sourcesdump/2007/0413/plan9/sys/src/cmd/ip/ipconfig.c:954,960 -
/n/sources/plan9/sys/src/cmd/ip/ipconfig.c:958,964
p = optaddvec(p, ODparams, requested, nrequested);
if(*conf.hostname && sendhostname)
p = optaddstr(p, OBhostname, conf.hostname);
- break;
+ break;
case Release:
ipmove(up->raddr, conf.server);
v6tov4(bp.ciaddr, conf.laddr);
/n/sourcesdump/2007/0413/plan9/sys/src/cmd/ip/ipconfig.c:1051,1057 -
/n/sources/plan9/sys/src/cmd/ip/ipconfig.c:1055,1061
if(conf.state != Srebinding)
break;
- // ignore a bad lease
+ /* ignore a bad lease */
lease = optgetulong(bp->optdata, ODlease);
if(lease == 0){
/*
/n/sourcesdump/2007/0413/plan9/sys/src/cmd/ip/ipconfig.c:1063,1069 -
/n/sources/plan9/sys/src/cmd/ip/ipconfig.c:1067,1073
}
DEBUG("lease=%lud ", lease);
- // address and mask
+ /* address and mask */
if(!validip(conf.laddr) || !Oflag)
v4tov6(conf.laddr, bp->yiaddr);
if(!validip(conf.mask) || !Oflag){
/n/sourcesdump/2007/0413/plan9/sys/src/cmd/ip/ipconfig.c:1072,1079 -
/n/sources/plan9/sys/src/cmd/ip/ipconfig.c:1076,1085
}
DEBUG("ipaddr=%I ipmask=%M ", conf.laddr, conf.mask);
- // get a router address either from the router option
- // or from the router that forwarded the dhcp packet
+ /*
+ * get a router address either from the router option
+ * or from the router that forwarded the dhcp packet
+ */
if(!validip(conf.gaddr) || !Oflag){
if(optgetaddr(bp->optdata, OBrouter, conf.gaddr)){
DEBUG("ipgw=%I ", conf.gaddr);
/n/sourcesdump/2007/0413/plan9/sys/src/cmd/ip/ipconfig.c:1087,1093 -
/n/sources/plan9/sys/src/cmd/ip/ipconfig.c:1093,1099
else
DEBUG("ipgw=%I ", conf.gaddr);
- // get dns servers
+ /* get dns servers */
memset(conf.dns, 0, sizeof(conf.dns));
n = optgetaddrs(bp->optdata, OBdnserver, conf.dns,
sizeof(conf.dns)/IPaddrlen);
/n/sourcesdump/2007/0413/plan9/sys/src/cmd/ip/ipconfig.c:1094,1100 -
/n/sources/plan9/sys/src/cmd/ip/ipconfig.c:1100,1106
for(i = 0; i < n; i++)
DEBUG("dns=%I ", conf.dns+i*IPaddrlen);
- // get ntp servers
+ /* get ntp servers */
memset(conf.ntp, 0, sizeof(conf.ntp));
n = optgetaddrs(bp->optdata, OBntpserver, conf.ntp,
sizeof(conf.ntp)/IPaddrlen);
/n/sourcesdump/2007/0413/plan9/sys/src/cmd/ip/ipconfig.c:1101,1114 -
/n/sources/plan9/sys/src/cmd/ip/ipconfig.c:1107,1120
for(i = 0; i < n; i++)
DEBUG("ntp=%I ", conf.ntp+i*IPaddrlen);
- // get names
+ /* get names */
optgetstr(bp->optdata, OBhostname, conf.hostname, sizeof(conf.hostname));
optgetstr(bp->optdata, OBdomainname, conf.domainname, sizeof(conf.domainname));
- // get anything else we asked for
+ /* get anything else we asked for */
getoptions(bp->optdata);
- // get plan9 specific options
+ /* get plan9 specific options */
n = optgetvec(bp->optdata, OBvendorinfo, vopts, sizeof(vopts)-1);
if(n > 0 && parseoptions(vopts, n) == 0){
if(validip(conf.fs) && Oflag)
/n/sourcesdump/2007/0413/plan9/sys/src/cmd/ip/ipconfig.c:1157,1163 -
/n/sources/plan9/sys/src/cmd/ip/ipconfig.c:1163,1169
if(!noconfig)
sysfatal("can't announce for dhcp: %r");
- // might be another client - wait and try again
+ /* might be another client - wait and try again */
fprint(2, "%s: can't announce: %r\n", argv0);
sleep((nrand(10)+1)*1000);
if(n > 10)
/n/sourcesdump/2007/0413/plan9/sys/src/cmd/ip/ipconfig.c:1228,1234 -
/n/sources/plan9/sys/src/cmd/ip/ipconfig.c:1234,1240
{
int n;
- n = strlen(v)+1; // microsoft leaves on the null, so we do too
+ n = strlen(v)+1; /* microsoft leaves on the null, so we do too */
p[0] = op;
p[1] = n;
memmove(p+2, v, n);
/n/sourcesdump/2007/0413/plan9/sys/src/cmd/ip/ipconfig.c:1348,1356 -
/n/sources/plan9/sys/src/cmd/ip/ipconfig.c:1354,1364
return len;
}
- // sanity check options area
- // - options don't overflow packet
- // - options end with an OBend
+ /*
+ * sanity check options area
+ * - options don't overflow packet
+ * - options end with an OBend
+ */
int
parseoptions(uchar *p, int n)
{
/n/sourcesdump/2007/0413/plan9/sys/src/cmd/ip/ipconfig.c:1377,1393 -
/n/sources/plan9/sys/src/cmd/ip/ipconfig.c:1385,1403
return -1;
}
p += len;
- n -= len;
+ n -= len;
}
- // make sure packet ends with an OBend all the optget code
+ /* make sure packet ends with an OBend all the optget code */
*p = OBend;
return 0;
}
- // sanity check received packet:
- // - magic is dhcp magic
- // - options don't overflow packet
+ /*
+ * sanity check received packet:
+ * - magic is dhcp magic
+ * - options don't overflow packet
+ */
Bootp *
parsebootp(uchar *p, int n)
{
/n/sourcesdump/2007/0413/plan9/sys/src/cmd/ip/ipconfig.c:1427,1433 -
/n/sources/plan9/sys/src/cmd/ip/ipconfig.c:1437,1443
return bp;
}
- // write out an ndb entry
+ /* write out an ndb entry */
void
writendb(char *s, int n, int append)
{
/n/sourcesdump/2007/0413/plan9/sys/src/cmd/ip/ipconfig.c:1444,1450 -
/n/sources/plan9/sys/src/cmd/ip/ipconfig.c:1454,1460
close(fd);
}
- // put server addresses into the ndb entry
+ /* put server addresses into the ndb entry */
char*
putaddrs(char *p, char *e, char *attr, uchar *a, int len)
{
/n/sourcesdump/2007/0413/plan9/sys/src/cmd/ip/ipconfig.c:1458,1464 -
/n/sources/plan9/sys/src/cmd/ip/ipconfig.c:1468,1474
return p;
}
- // make an ndb entry and put it into /net/ndb for the servers to see
+ /* make an ndb entry and put it into /net/ndb for the servers to see */
void
putndb(void)
{
/n/sourcesdump/2007/0413/plan9/sys/src/cmd/ip/ipconfig.c:1498,1510 -
/n/sources/plan9/sys/src/cmd/ip/ipconfig.c:1508,1519
writendb(buf, p-buf, append);
}
- // get an ndb entry someone else wrote
+ /* get an ndb entry someone else wrote */
int
getndb(void)
{
char buf[1024];
- int fd;
- int n;
+ int fd, n;
char *p;
snprint(buf, sizeof buf, "%s/ndb", conf.mpoint);
/n/sourcesdump/2007/0413/plan9/sys/src/cmd/ip/ipconfig.c:1522,1528 -
/n/sources/plan9/sys/src/cmd/ip/ipconfig.c:1531,1537
return 0;
}
- // tell a server to refresh
+ /* tell a server to refresh */
void
tweakserver(char *server)
{
/n/sourcesdump/2007/0413/plan9/sys/src/cmd/ip/ipconfig.c:1537,1543 -
/n/sources/plan9/sys/src/cmd/ip/ipconfig.c:1546,1552
close(fd);
}
- // tell all servers to refresh their information
+ /* tell all servers to refresh their information */
void
tweakservers(void)
{
/n/sourcesdump/2007/0413/plan9/sys/src/cmd/ip/ipconfig.c:1545,1551 -
/n/sources/plan9/sys/src/cmd/ip/ipconfig.c:1554,1560
tweakserver("cs");
}
- // return number of networks
+ /* return number of networks */
int
nipifcs(char *net)
{
/n/sourcesdump/2007/0413/plan9/sys/src/cmd/ip/ipconfig.c:1572,1578 -
/n/sources/plan9/sys/src/cmd/ip/ipconfig.c:1581,1587
return n;
}
- // return true if this is a valid v4 address
+ /* return true if this is a valid v4 address */
int
validip(uchar *addr)
{
/n/sourcesdump/2007/0413/plan9/sys/src/cmd/ip/ipconfig.c:1584,1609 -
/n/sources/plan9/sys/src/cmd/ip/ipconfig.c:1593,1615
[Vremove] "remove",
[Vunbind] "unbind",
[Vether] "ether",
- [Vgbe] "gbe",
+ [Vgbe] "gbe",
[Vloopback] "loopback",
};
- // look for an action
+ /* look for an action */
int
parseverb(char *name)
{
int i;
- for(i = 0; i < nelem(verbs); i++){
- if(verbs[i] == 0)
- continue;
- if(strcmp(name, verbs[i]) == 0)
+ for(i = 0; i < nelem(verbs); i++)
+ if(verbs[i] != nil && strcmp(name, verbs[i]) == 0)
return i;
- }
return -1;
}
- // get everything out of ndb
+ /* get everything out of ndb */
void
ndbconfig(void)
{
/n/sourcesdump/2007/0413/plan9/sys/src/cmd/ip/ipconfig.c:1619,1625 -
/n/sources/plan9/sys/src/cmd/ip/ipconfig.c:1625,1632
db = ndbopen(0);
if(db == nil)
sysfatal("can't open ndb: %r");
- if((strcmp(conf.type, "ether") != 0 && strcmp(conf.type, "gbe") != 0) || myetheraddr(conf.hwa, conf.dev) != 0)
+ if((strcmp(conf.type, "ether") != 0 && strcmp(conf.type, "gbe") != 0) ||
+ myetheraddr(conf.hwa, conf.dev) != 0)
sysfatal("can't read hardware address");
sprint(etheraddr, "%E", conf.hwa);
nattr = 0;
/n/sourcesdump/2007/0413/plan9/sys/src/cmd/ip/ipconfig.c:1632,1654 -
/n/sources/plan9/sys/src/cmd/ip/ipconfig.c:1639,1659
attrs[nattr++] = "@auth";
attrs[nattr] = nil;
t = ndbipinfo(db, "ether", etheraddr, attrs, nattr);
- for(nt = t; nt != nil; nt = nt->entry){
- if(strcmp(nt->attr, "ip") == 0){
+ for(nt = t; nt != nil; nt = nt->entry)
+ if(strcmp(nt->attr, "ip") == 0)
parseip(conf.laddr, nt->val);
- } else if(strcmp(nt->attr, "ipmask") == 0){
+ else if(strcmp(nt->attr, "ipmask") == 0)
parseipmask(conf.mask, nt->val);
- } else if(strcmp(nt->attr, "ipgw") == 0){
+ else if(strcmp(nt->attr, "ipgw") == 0)
parseip(conf.gaddr, nt->val);
- } else if(ndns < 2 && strcmp(nt->attr, "dns") == 0){
+ else if(ndns < 2 && strcmp(nt->attr, "dns") == 0)
parseip(conf.dns+IPaddrlen*ndns, nt->val);
- } else if(strcmp(nt->attr, "ntp") == 0){
+ else if(strcmp(nt->attr, "ntp") == 0)
parseip(conf.ntp, nt->val);
- } else if(nfs < 2 && strcmp(nt->attr, "fs") == 0){
+ else if(nfs < 2 && strcmp(nt->attr, "fs") == 0)
parseip(conf.fs+IPaddrlen*nfs, nt->val);
- } else if(nauth < 2 && strcmp(nt->attr, "auth") == 0){
+ else if(nauth < 2 && strcmp(nt->attr, "auth") == 0)
parseip(conf.auth+IPaddrlen*nauth, nt->val);
- }
- }
ndbfree(t);
if(!validip(conf.laddr))
sysfatal("address not found in ndb");
/src/libdraw/mouse.c /src/libdraw/writecolmap.c
% cat >/sys/lib/dist/changes/1176503406.4.txt << EOF
• Return nil if we have no memory to allocate. We already returned nil
before, so we shouldn't need to check callers to ensure error checking.
• We're writecolmap, not wrcolmap. Don't confuse people if they want to
grep for writecolmap.
EOF
[geoff] --rw-rw-r-- M 121 glenda sys 2623 Apr 13 18:11 sys/src/libdraw/mouse.c
/n/sourcesdump/2007/0413/plan9/sys/src/libdraw/mouse.c:108,113 -
/n/sources/plan9/sys/src/libdraw/mouse.c:108,118
return nil;
}
t = malloc(strlen(file)+16);
+ if (t == nil) {
+ close(mc->mfd);
+ free(mc);
+ return nil;
+ }
strcpy(t, file);
sl = utfrrune(t, '/');
if(sl)
[geoff] --rw-rw-r-- M 121 glenda sys 788 Apr 13 18:11 sys/src/libdraw/writecolmap.c
/n/sourcesdump/2007/0413/plan9/sys/src/libdraw/writecolmap.c:18,25 -
/n/sources/plan9/sys/src/libdraw/writecolmap.c:18,27
sprint(buf, "/dev/draw/%d/colormap", d->dirno);
fd = open(buf, OWRITE);
if(fd < 0)
- drawerror(d, "wrcolmap: open colormap failed");
+ drawerror(d, "writecolmap: open colormap failed");
t = malloc(8192);
+ if (t == nil)
+ drawerror(d, "writecolmap: no memory");
n = 0;
for(i = 0; i < 256; i++) {
r = m[i].red>>24;
/n/sourcesdump/2007/0413/plan9/sys/src/libdraw/writecolmap.c:31,35 -
/n/sources/plan9/sys/src/libdraw/writecolmap.c:33,37
free(t);
close(fd);
if(i != n)
- drawerror(d, "wrcolmap: bad write");
+ drawerror(d, "writecolmap: bad write");
}
/sys/src/cmd/mkfile
% cat >/sys/lib/dist/changes/1176521407.113.txt << EOF
Bootstrap compilers with new version before compiling them.
EOF
[geoff] --rw-rw-r-- M 152 glenda sys 2674 Apr 13 23:22 sys/src/cmd/mkfile
/n/sourcesdump/2007/0413/plan9/sys/src/cmd/mkfile:123,138 -
/n/sources/plan9/sys/src/cmd/mkfile:123,139
update $stem.c /386/bin/$stem
compilers:V:
- @{
- cd cc
- mk clean
- mk installall
- mk clean
- }
for(i in ?c)
- if(! ~ $i cc rc) @{
- cd $i;
- mk clean
- mk installall
- mk clean
- }
+ if(! ~ $i cc rc) @{
+ cd $i
+ mk clean
+ objtype=$cputype mk install
+ mk clean
+ }
+ for(i in ?c)
+ if(! ~ $i cc rc) @{
+ cd $i
+ mk clean
+ mk installall
+ mk clean
+ }
|