Skip to content

Commit e7340be

Browse files
committed
sync with upstream
2 parents f8d4a2c + 4c54893 commit e7340be

File tree

1,111 files changed

+9684
-12263
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,111 files changed

+9684
-12263
lines changed

INSTALL

+28-26
Original file line numberDiff line numberDiff line change
@@ -23,48 +23,49 @@ x-r)
2323
exit 1
2424
esac
2525

26-
PLAN9=`pwd` export PLAN9
27-
PATH=/bin:/usr/bin:$PLAN9/bin:$PATH export PATH
28-
case `uname` in
29-
SunOS)
30-
awk=nawk
31-
;;
32-
*)
33-
awk=awk
34-
;;
35-
esac
36-
3726
echo "+ Mailing list: https://groups.google.com/group/plan9port-dev"
3827
echo "+ Issue tracker: https://github.com/9fans/plan9port/issues/"
3928
echo "+ Submitting changes: https://github.com/9fans/plan9port/pulls"
4029
echo " "
4130
echo "* Resetting $PLAN9/config"
4231
rm -f config
4332

44-
(
45-
if [ `uname` = FreeBSD ]; then
33+
PLAN9=`pwd` export PLAN9
34+
PATH=/bin:/usr/bin:$PLAN9/bin:$PATH export PATH
35+
case `uname` in
36+
SunOS)
37+
awk=nawk
38+
;;
39+
DragonFly|*BSD)
4640
case `cc -v 2>&1` in
4741
*clang*)
4842
echo "CC9=clang" >> $PLAN9/config
4943
;;
44+
*gcc*)
45+
echo "CC9=gcc" >> $PLAN9/config
46+
;;
47+
esac
48+
echo "* Running on" `uname`", adjusting linker flags"
49+
case `uname` in
50+
OpenBSD)
51+
echo "LDFLAGS='-L/usr/X11R6/lib -pthread'" >> $PLAN9/config
52+
;;
53+
NetBSD)
54+
echo "LDFLAGS='-L/usr/X11R7/lib -pthread'" >> $PLAN9/config
55+
;;
5056
*)
57+
echo "LDFLAGS='-L/usr/local/lib -pthread'" >> $PLAN9/config
5158
;;
5259
esac
53-
echo "* Running on FreeBSD, adjusting linker flags"
54-
echo "LDFLAGS='-L/usr/local/lib'" >> $PLAN9/config
55-
fi
56-
57-
if [ `uname` = DragonFly ]; then
58-
echo "* Running on DragonFly BSD, adjusting linker flags"
59-
echo "LDFLAGS='-L/usr/local/lib -pthread'" >> $PLAN9/config
6060
echo "CFLAGS='-pthread'" >> $PLAN9/config
61-
fi
62-
63-
if [ `uname` = OpenBSD ]; then
64-
echo "* Running on OpenBSD, adjusting linker flags"
65-
echo "LDFLAGS='-L/usr/X11R6/lib -pthread'" >> $PLAN9/config
66-
fi
61+
awk=awk
62+
;;
63+
*)
64+
awk=awk
65+
;;
66+
esac
6767

68+
(
6869
if [ `uname` = Linux ]; then
6970
# On Linux, we use the kernel version to decide whether
7071
# to use pthreads or not. On 2.6 versions that aren't
@@ -135,6 +136,7 @@ if [ `uname` != Darwin ]; then
135136
# Determine whether fontsrv X11 files are available.
136137
rm -f a.out
137138
cc -o a.out -c -Iinclude -I/usr/include -I/usr/local/include -I/usr/include/freetype2 -I/usr/local/include/freetype2 \
139+
-I/usr/X11R7/include -I/usr/X11R7/include/freetype2 \
138140
-I/usr/X11R6/include -I/usr/X11R6/include/freetype2 src/cmd/fontsrv/x11.c >/dev/null 2>&1
139141
if [ -f a.out ]; then
140142
echo " fontsrv dependencies found."

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Installation
44
------------
55

66
To install, run ./INSTALL. It builds mk and then uses mk to
7-
run the rest of the installation.
7+
run the rest of the installation.
88

99
For more details, see install(1), at install.txt in this directory
1010
and at https://9fans.github.io/plan9port/man/man1/install.html.
@@ -22,15 +22,15 @@ or differences from Plan 9.
2222
Helping out
2323
-----------
2424

25-
If you'd like to help out, great! The TODO file contains a small list.
25+
If you'd like to help out, great!
2626

2727
If you port this code to other architectures, please share your changes
2828
so others can benefit.
2929

3030
Git
3131
---
3232

33-
You can use Git to keep your local copy up-to-date as we make
33+
You can use Git to keep your local copy up-to-date as we make
3434
changes and fix bugs. See the git(1) man page here ("9 man git")
3535
for details on using Git.
3636

TODO

-12
This file was deleted.

bin/9c

+7-4
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ usegcc()
1414
-Wno-comment \
1515
-Wno-sign-compare \
1616
-Wno-unknown-pragmas \
17+
-Wno-misleading-indentation \
18+
-Wno-stringop-truncation \
19+
-Wno-stringop-overflow \
20+
-Wno-format-truncation \
1721
-fno-omit-frame-pointer \
1822
-fsigned-char \
1923
"
@@ -79,9 +83,8 @@ useclang()
7983

8084
tag="${SYSNAME:-`uname`}-${OBJTYPE:-`uname -m`}-${CC9:-cc}"
8185
case "$tag" in
82-
*FreeBSD*gcc*) usegcc ;;
83-
*FreeBSD*clang*) useclang ;;
84-
*DragonFly*|*BSD*) usegcc ;;
86+
*DragonFly*gcc*|*BSD*gcc*) usegcc ;;
87+
*DragonFly*clang|*BSD*clang*) useclang ;;
8588
*Darwin-x86_64*)
8689
useclang
8790
cflags="$ngflags -g3 -m64"
@@ -133,7 +136,7 @@ case "$tag" in
133136
esac
134137

135138
# N.B. Must use temp file to avoid pipe; pipe loses status.
136-
xtmp=/tmp/9c.$$.$USER.out
139+
xtmp=${TMPDIR-/tmp}/9c.$$.$USER.out
137140
$cc -DPLAN9PORT -I$PLAN9/include $cflags "$@" 2>$xtmp
138141
status=$?
139142
quiet $xtmp

bin/9l

+2-15
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,6 @@ nmflags=""
1111
extralibs="-lm"
1212
tag="${SYSNAME:-`uname`}-${OBJTYPE:-`uname -m`}"
1313
case "$tag" in
14-
*FreeBSD*)
15-
ld=${CC9:-gcc}
16-
userpath=true
17-
extralibs="$extralibs -lutil"
18-
case "`uname -r`" in
19-
5.2.*)
20-
extralibs="$extralibs -lkse"
21-
;;
22-
[5-9].*|1[0-9].*)
23-
extralibs="$extralibs -lpthread"
24-
;;
25-
esac
26-
;;
2714
*DragonFly*|*BSD*)
2815
ld=${CC9:-gcc}
2916
userpath=true
@@ -40,7 +27,7 @@ case "$tag" in
4027
userpath=true
4128
extralibs="$extralibs -lutil -lresolv"
4229
case "${SYSVERSION:-`uname -r`}" in
43-
2.6.* | 3.* | 4.*)
30+
2.6.* | [3-9].* | [1-9][0-9].*)
4431
extralibs="$extralibs -lpthread"
4532
;;
4633
esac
@@ -346,7 +333,7 @@ then
346333
echo $ld -L$PLAN9/lib "$@" $libsl $extralibs $frameworks
347334
fi
348335

349-
xtmp=/tmp/9l.$$.$USER.out
336+
xtmp="${TMPDIR-/tmp}/9l.$$.$USER.out"
350337
xxout() {
351338
sed 's/.*: In function `[^:]*: *//' $xtmp | egrep . |
352339
egrep -v 'is (often|almost always) misused|is dangerous, better use|text-based stub'

bin/quote1

+1-10
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,10 @@
22

33
. 9.rc
44

5-
fn text {
6-
if(~ $winid [0-9]*)
7-
9p read acme/$winid/body
8-
if not if(~ $text9term unix!*)
9-
dial -e $text9term </dev/null
10-
if not
11-
status=''
12-
}
13-
145
PROMPT='[^ ]*[%;$#][ ]+'
156

167
fn cmds {
17-
text | sed -n 's/^'$PROMPT'([^"])/ \1/p'
8+
wintext | sed -n 's/^'$PROMPT'([^"])/ \1/p'
189
}
1910

2011
switch($#*) {

bin/quote2

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/local/plan9/bin/rc
22

3-
cmd = `{" $* | tail -1}
3+
cmd = `{quote1 $* | tail -1}
44
if (~ $#cmd 0) {
55
echo no such command found >[1=2]
66
exit notfound

bin/wintext

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/sh
1+
#!/bin/bash
22

33
case "$winid" in
44
[0-9]*)
@@ -12,5 +12,11 @@ unix!*)
1212
exit 0
1313
esac
1414

15+
case "$TMUX" in
16+
?*)
17+
tmux capture-pane -p
18+
exit 0
19+
esac
20+
1521
echo 'no running window found' 2>&1
1622
exit 1

dist/buildmk

+2-17
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,6 @@
11
#!/bin/sh
22

33
# run this in the src directory
4-
SYSNAME=`uname` export SYSNAME
5-
OBJTYPE=`(uname -m -p 2>/dev/null || uname -m) | sed '
6-
s;.*i[3-6]86.*;386;;
7-
s;.*i86pc.*;386;;
8-
s;.*amd64.*;x86_64;;
9-
s;.*x86_64.*;x86_64;;
10-
s;.*armv.*;arm;g;
11-
s;.*powerpc.*;power;g;
12-
s;.*PowerMacintosh.*;power;g;
13-
s;.*Power.Macintosh.*;power;g;
14-
s;.*macppc.*;power;g;
15-
s;.*mips.*;mips;g;
16-
s;.*ppc64.*;power;g;
17-
s;.*ppc.*;power;g;
18-
s;.*alpha.*;alpha;g;
19-
s;.*sun4u.*;sun4u;g;
20-
'` export OBJTYPE
4+
. ../src/mkenv
5+
export SYSNAME OBJTYPE
216
sh -x mkmk.sh

include/drawfcall.h

+6
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ tag[1] Rrdkbd rune[2]
2525
tag[1] Tlabel label[s]
2626
tag[1] Rlabel
2727
28+
tag[1] Tctxt wsysid[s]
29+
tag[1] Rctxt
30+
2831
tag[1] Tinit winsize[s] label[s] font[s]
2932
tag[1] Rinit
3033
@@ -94,6 +97,8 @@ enum {
9497
Rresize,
9598
Tcursor2 = 28,
9699
Rcursor2,
100+
Tctxt = 30,
101+
Rctxt,
97102
Tmax,
98103
};
99104

@@ -116,6 +121,7 @@ struct Wsysmsg
116121
char *label;
117122
char *snarf;
118123
char *error;
124+
char *id;
119125
uchar *data;
120126
uint count;
121127
Rectangle rect;

include/libc.h

+17-12
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@
1111
#define _LIBC_H_ 1
1212
#if defined(__cplusplus)
1313
extern "C" {
14-
#endif
14+
#endif
1515

1616
#include <utf.h>
1717
#include <fmt.h>
1818

1919
/*
20-
* Begin usual libc.h
20+
* Begin usual libc.h
2121
*/
2222

2323
#ifndef nil
@@ -361,7 +361,7 @@ enum
361361
extern int p9atexit(void(*)(void));
362362
extern void p9atexitdont(void(*)(void));
363363
extern int atnotify(int(*)(void*, char*), int);
364-
/*
364+
/*
365365
* <stdlib.h>
366366
extern double atof(char*); <stdlib.h>
367367
*/
@@ -383,8 +383,11 @@ extern int encodefmt(Fmt*);
383383
extern int dirmodefmt(Fmt*);
384384
extern int exitcode(char*);
385385
extern void exits(char*);
386-
extern double frexp(double, int*);
386+
extern double p9frexp(double, int*);
387387
extern ulong getcallerpc(void*);
388+
#if defined(__GNUC__) || defined(__clang__)
389+
#define getcallerpc(x) ((ulong)__builtin_return_address(0))
390+
#endif
388391
extern char* p9getenv(char*);
389392
extern int p9putenv(char*, char*);
390393
extern int getfields(char*, char**, int, int, char*);
@@ -433,6 +436,8 @@ extern void (*_unpin)(void);
433436
#define atoll p9atoll
434437
#define encrypt p9encrypt
435438
#define decrypt p9decrypt
439+
#undef frexp
440+
#define frexp p9frexp
436441
#define getenv p9getenv
437442
#define getwd p9getwd
438443
#define longjmp p9longjmp
@@ -479,7 +484,7 @@ extern void lock(Lock*);
479484
extern void unlock(Lock*);
480485
extern int canlock(Lock*);
481486
extern int (*_lock)(Lock*, int, ulong);
482-
extern void (*_unlock)(Lock*, ulong);
487+
extern void (*_unlock)(Lock*, ulong);
483488

484489
typedef struct QLock QLock;
485490
struct QLock
@@ -670,15 +675,15 @@ extern void freenetconninfo(NetConnInfo*);
670675

671676
enum
672677
{
673-
RFNAMEG = (1<<0),
674-
RFENVG = (1<<1),
678+
RFNAMEG = (1<<0),
679+
RFENVG = (1<<1),
675680
RFFDG = (1<<2),
676681
RFNOTEG = (1<<3),
677682
RFPROC = (1<<4),
678683
RFMEM = (1<<5),
679684
RFNOWAIT = (1<<6),
680-
RFCNAMEG = (1<<10),
681-
RFCENVG = (1<<11),
685+
RFCNAMEG = (1<<10),
686+
RFCENVG = (1<<11),
682687
RFCFDG = (1<<12)
683688
/* RFREND = (1<<13), */
684689
/* RFNOMNT = (1<<14) */
@@ -707,7 +712,7 @@ struct Dir {
707712
char *uid; /* owner name */
708713
char *gid; /* group name */
709714
char *muid; /* last modifier name */
710-
715+
711716
/* 9P2000.u extensions */
712717
uint uidnum; /* numeric uid */
713718
uint gidnum; /* numeric gid */
@@ -750,7 +755,7 @@ extern int p9exec(char*, char*[]);
750755
extern int p9execl(char*, ...);
751756
/* extern int p9fork(void); */
752757
extern int p9rfork(int);
753-
/* not implemented
758+
/* not implemented
754759
extern int fauth(int, char*);
755760
extern int fstat(int, uchar*, int);
756761
extern int fwstat(int, uchar*, int);
@@ -767,7 +772,7 @@ extern int notifyoff(char*);
767772
extern int p9open(char*, int);
768773
extern int fd2path(int, char*, int);
769774
extern int p9pipe(int*);
770-
/*
775+
/*
771776
* use defs from <unistd.h>
772777
extern long pread(int, void*, long, vlong);
773778
extern long preadv(int, IOchunk*, int, vlong);

0 commit comments

Comments
 (0)