diff options
author | rsc <devnull@localhost> | 2003-12-03 22:50:48 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2003-12-03 22:50:48 +0000 |
commit | 669250d159e93a6933afa4cd25f410af801515ec (patch) | |
tree | 1f053fd518cf1a172863e07050e6e3bf13762f7d /src/lib9 | |
parent | 5a82f26e50fbfbb3090b4cf839decf012637a00e (diff) | |
download | plan9port-669250d159e93a6933afa4cd25f410af801515ec.tar.gz plan9port-669250d159e93a6933afa4cd25f410af801515ec.tar.bz2 plan9port-669250d159e93a6933afa4cd25f410af801515ec.zip |
Various fixes.
B - fixed usage, DISPLAY :0 vs :0.0
9term - fixed various terminal things
rc - notice traps in Read
_p9dir - only run disk code for disks
dirread - getdirentries on FreeBSD and Linux
are different w.r.t. meaning of off.
notify - set up so signals interrupt system calls
bprint - use bfmt.
Diffstat (limited to 'src/lib9')
-rw-r--r-- | src/lib9/_p9dir.c | 32 | ||||
-rw-r--r-- | src/lib9/dirread.c | 11 | ||||
-rw-r--r-- | src/lib9/notify.c | 11 |
3 files changed, 39 insertions, 15 deletions
diff --git a/src/lib9/_p9dir.c b/src/lib9/_p9dir.c index 43752222..af2a16c4 100644 --- a/src/lib9/_p9dir.c +++ b/src/lib9/_p9dir.c @@ -10,6 +10,36 @@ #if defined(__FreeBSD__) #include <sys/disklabel.h> +static int diskdev[] = { + 151, /* aacd */ + 116, /* ad */ + 157, /* ar */ + 118, /* afd */ + 133, /* amrd */ + 13, /* da */ + 102, /* fla */ + 109, /* idad */ + 95, /* md */ + 131, /* mlxd */ + 168, /* pst */ + 147, /* twed */ + 43, /* vn */ + 3, /* wd */ + 87, /* wfd */ +}; +static int +isdisk(struct stat *st) +{ + int i, dev; + + if(!S_ISCHR(st->st_mode)) + return 0; + dev = major(st->st_rdev); + for(i=0; i<nelem(diskdev); i++) + if(diskdev[i] == dev) + return 1; + return 0; +} #define _HAVEDISKLABEL #endif @@ -108,7 +138,7 @@ _p9dir(struct stat *st, char *name, Dir *d, char **str, char *estr) /* fetch real size for disks */ #ifdef _HAVEDISKLABEL - if(S_ISCHR(st->st_mode)){ + if(isdisk(st)){ int fd, n; struct disklabel lab; diff --git a/src/lib9/dirread.c b/src/lib9/dirread.c index 1e479fe4..5aa5c449 100644 --- a/src/lib9/dirread.c +++ b/src/lib9/dirread.c @@ -10,7 +10,6 @@ extern int _p9dir(struct stat*, char*, Dir*, char**, char*); static int mygetdents(int fd, struct dirent *buf, int n) { - ssize_t nn; off_t off; off = p9seek(fd, 0, 1); @@ -23,14 +22,8 @@ mygetdents(int fd, struct dirent *buf, int n) static int mygetdents(int fd, struct dirent *buf, int n) { - ssize_t nn; long off; - - off = p9seek(fd, 0, 1); - nn = getdirentries(fd, (void*)buf, n, &off); - if(nn > 0) - p9seek(fd, off, 0); - return nn; + return getdirentries(fd, (void*)buf, n, &off); } #elif defined(__sun__) static int @@ -38,7 +31,7 @@ mygetdents(int fd, struct dirent *buf, int n) { return getdents(fd, (void*)buf, n); } -#endif +#endif static int countde(char *p, int n) diff --git a/src/lib9/notify.c b/src/lib9/notify.c index 7e3c04f7..460eabfe 100644 --- a/src/lib9/notify.c +++ b/src/lib9/notify.c @@ -13,7 +13,7 @@ static int sigs[] = { SIGQUIT, SIGILL, SIGTRAP, - SIGABRT, +/* SIGABRT, */ #ifdef SIGEMT SIGEMT, #endif @@ -63,16 +63,17 @@ int notify(void (*f)(void*, char*)) { int i; - void (*sf)(int); + struct sigaction sa; + memset(&sa, 0, sizeof sa); if(f == nil) - sf = SIG_DFL; + sa.sa_handler = SIG_DFL; else{ notifyf = f; - sf = notifysigf; + sa.sa_handler = notifysigf; } for(i=0; i<nelem(sigs); i++) - signal(sigs[i], sf); + sigaction(sigs[i], &sa, 0); return 0; } |