9front - general discussion about 9front
 help / color / mirror / Atom feed
* [9front] miscellaneous changes in ape
@ 2021-04-03  5:11 Xiao-Yong Jin
  0 siblings, 0 replies; only message in thread
From: Xiao-Yong Jin @ 2021-04-03  5:11 UTC (permalink / raw)
  To: 9front

They are pretty much disjoint.
1. ape/grep, ape/ls: handles/ignores more arguments
2. ape/signal.h, ape/sys/stat.h, plan9/lib.h, python/pyconfig.h: define more macros that does nothing, and remove those from pyconfig.h
3. getfcr.s, _envsetup.c: calls setfcr(FPPDBL|FPRNR) for all APE executables
4. nanosleep: sets errno when error

diff -r cc26fdf57bb2 rc/bin/ape/grep
--- a/rc/bin/ape/grep	Sat Mar 13 14:57:53 2021 +0100
+++ b/rc/bin/ape/grep	Fri Apr 02 23:54:39 2021 -0500
@@ -7,7 +7,10 @@
 argv0=$0
 while(! ~ $#* 0){
 	switch($1){
-	case -[cefinsv]
+	case -[ef]
+		opts=($opts $1 $2)
+		shift
+	case -[cinsv]
 		opts=($opts $1)
 	case -q
 		opts=($opts -s)
diff -r cc26fdf57bb2 rc/bin/ape/ls
--- a/rc/bin/ape/ls	Sat Mar 13 14:57:53 2021 +0100
+++ b/rc/bin/ape/ls	Fri Apr 02 23:54:39 2021 -0500
@@ -14,6 +14,7 @@
 # -c	show ctime
 # -d	dirs
 # -f	no sorting
+# -i	inode
 # -l	long
 # -p	put slash after dir (-F)
 # -r	reverse
@@ -23,7 +24,7 @@
 # -1	single-column
 
 
-flagfmt='A,C,F,H,L,R,U,a,c,d,f,l,p,r,s,t,u,1'
+flagfmt='A,C,F,H,L,R,U,a,c,d,f,i,l,p,r,s,t,u,1'
 args='[file ...]'
 
 if(! ifs=() eval `{aux/getflags $*}){
@@ -48,6 +49,7 @@
 # ignore -a, -c
 if(~ $flagd 1) all=($all -d)
 if(~ $flagf 1) all=($all -n)
+# ignore -i
 if(~ $flagl 1) { all=($all -l); post=fixlong }
 if(~ $flagp 1) all=($all -F)
 if(~ $flagr 1) all=($all -r)
diff -r cc26fdf57bb2 sys/include/ape/signal.h
--- a/sys/include/ape/signal.h	Sat Mar 13 14:57:53 2021 +0100
+++ b/sys/include/ape/signal.h	Fri Apr 02 23:54:39 2021 -0500
@@ -37,11 +37,12 @@
 #define SIGTSTP	18	/* interactive stop */
 #define SIGTTIN	19	/* read from ctl tty by member of background */
 #define SIGTTOU	20	/* write to ctl tty by member of background */
-#define SIGVTALRM 21 /* virtual alarm clock */
-#define SIGPROF 22  /* profiling alarm clock */
+#define SIGVTALRM 21	/* virtual alarm clock */
+#define SIGPROF 22	/* profiling alarm clock */
+#define SIGWINCH 23	/* window size change */
 
 #ifdef _BSD_EXTENSION
-#define NSIG 23
+#define NSIG 24
 #endif
 
 #ifdef __cplusplus
diff -r cc26fdf57bb2 sys/src/ape/lib/ap/plan9/lib.h
--- a/sys/src/ape/lib/ap/plan9/lib.h	Sat Mar 13 14:57:53 2021 +0100
+++ b/sys/src/ape/lib/ap/plan9/lib.h	Fri Apr 02 23:54:39 2021 -0500
@@ -44,7 +44,7 @@
 #define FD_BUFFEREDX	0x8
 #define FD_ISTTY	0x20
 
-#define MAXSIG SIGPROF
+#define MAXSIG SIGWINCH
 
 extern Fdinfo	_fdinfo[];
 
diff -r cc26fdf57bb2 sys/include/ape/sys/stat.h
--- a/sys/include/ape/sys/stat.h	Sat Mar 13 14:57:53 2021 +0100
+++ b/sys/include/ape/sys/stat.h	Fri Apr 02 23:54:39 2021 -0500
@@ -27,6 +27,7 @@
 #define	S__MASK		     0170000
 #ifdef _RESEARCH_SOURCE
 #define S_ISLNK(m)	(((m)&S__MASK) == 0120000)
+#define S_ISSOCK(m)	(((m)&S__MASK) == 0010000)
 #endif
 #define S_ISREG(m)	(((m)&S__MASK) == 0100000)
 #define S_ISDIR(m)	(((m)&S__MASK) == 0040000)
diff -r cc26fdf57bb2 sys/src/cmd/python/pyconfig.h
--- a/sys/src/cmd/python/pyconfig.h	Sat Mar 13 14:57:53 2021 +0100
+++ b/sys/src/cmd/python/pyconfig.h	Fri Apr 02 23:54:39 2021 -0500
@@ -44,10 +44,6 @@
 typedef unsigned short u_short;
 typedef unsigned long u_long;
 
-#define SIGWINCH 21	/* for curses */
-
-#define S_ISSOCK S_ISFIFO /* for hg, see /sys/include/ape/sys/stat.h */
-
 /* Define if --enable-ipv6 is specified */
 #define ENABLE_IPV6 1
 
diff -r cc26fdf57bb2 sys/src/ape/lib/ap/amd64/getfcr.s
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/src/ape/lib/ap/amd64/getfcr.s	Fri Apr 02 23:54:39 2021 -0500
@@ -0,0 +1,38 @@
+
+TEXT	setfcr(SB), $4
+	XORL	$(0x3F<<7),RARG	/* bits are cleared in csr to enable them */
+	ANDL	$0xFFC0, RARG	/* just the fcr bits */
+	WAIT	/* is this needed? */
+	STMXCSR	0(SP)
+	MOVL	0(SP), AX
+	ANDL	$~0x3F, AX
+	ORL	RARG, AX
+	MOVL	AX, 0(SP)
+	LDMXCSR	0(SP)
+	RET
+
+TEXT	getfcr(SB), $4
+	WAIT
+	STMXCSR	0(SP)
+	MOVWLZX	0(SP), AX
+	ANDL	$0xFFC0, AX
+	XORL	$(0x3F<<7),AX
+	RET
+
+TEXT	getfsr(SB), $4
+	WAIT
+	STMXCSR	0(SP)
+	MOVL	0(SP), AX
+	ANDL	$0x3F, AX
+	RET
+
+TEXT	setfsr(SB), $4
+	ANDL	$0x3F, RARG
+	WAIT
+	STMXCSR	0(SP)
+	MOVL	0(SP), AX
+	ANDL	$~0x3F, AX
+	ORL	RARG, AX
+	MOVL	AX, 0(SP)
+	LDMXCSR	0(SP)
+	RET
diff -r cc26fdf57bb2 sys/src/ape/lib/ap/amd64/mkfile
--- a/sys/src/ape/lib/ap/amd64/mkfile	Sat Mar 13 14:57:53 2021 +0100
+++ b/sys/src/ape/lib/ap/amd64/mkfile	Fri Apr 02 23:54:39 2021 -0500
@@ -5,6 +5,7 @@
 OFILES=\
 	_seek.$O\
 	cycles.$O\
+	getfcr.$O\
 	lock.$O\
 	main9.$O\
 	main9p.$O\
--- a/sys/src/ape/lib/ap/plan9/_envsetup.c	Sat Mar 13 14:57:53 2021 +0100
+++ b/sys/src/ape/lib/ap/plan9/_envsetup.c	Fri Apr 02 23:54:39 2021 -0500
@@ -6,6 +6,7 @@
 #include <unistd.h>
 #include <string.h>
 #include <signal.h>
+#include <float.h>
 #include "sys9.h"
 #include "dir.h"
 
@@ -23,6 +24,7 @@
 unsigned long _clock;
 static void fdsetup(char *, char *);
 static void sigsetup(char *, char *);
+extern void setfcr(ulong);
 
 enum {
 	Envhunk=7000,
@@ -45,6 +47,9 @@
 	nohandle = 0;
 	fdinited = 0;
 	cnt = 0;
+
+	setfcr(FPPDBL|FPRNR);
+
 	dfd = _OPEN("/env", OREAD);
 	if(dfd < 0)
 		goto done;
diff -r cc26fdf57bb2 sys/src/ape/lib/ap/posix/nanosleep.c
--- a/sys/src/ape/lib/ap/posix/nanosleep.c	Sat Mar 13 14:57:53 2021 +0100
+++ b/sys/src/ape/lib/ap/posix/nanosleep.c	Fri Apr 02 23:54:39 2021 -0500
@@ -11,6 +11,7 @@
 
 	ms = req->tv_sec * 1000 + (req->tv_nsec + 999999) / 1000000;
 	if(_SLEEP(ms) < 0) {
+		_syserrno();
 		if(rem) {
 			rem->tv_sec = rem->tv_nsec = 0; /* needs better handling */
 		}


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-04-03  8:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-03  5:11 [9front] miscellaneous changes in ape Xiao-Yong Jin

9front - general discussion about 9front

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://inbox.vuxu.org/9front

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 9front 9front/ http://inbox.vuxu.org/9front \
		9front@9front.org
	public-inbox-index 9front

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.9front


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git