mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-10-28 05:00:59 +01:00
compare mapped zwc files using stat instead of the pathnames (10699)
This commit is contained in:
parent
4a3b94ca40
commit
c80d9e45e6
3 changed files with 23 additions and 12 deletions
|
|
@ -1,5 +1,8 @@
|
||||||
2000-04-12 Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
|
2000-04-12 Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
|
||||||
|
|
||||||
|
* 10699: Src/parse.c, Src/zsh.h: compare mapped zwc files using
|
||||||
|
stat instead of the pathnames
|
||||||
|
|
||||||
* 10695: Completion/Core/_files, Completion/Core/_tags,
|
* 10695: Completion/Core/_files, Completion/Core/_tags,
|
||||||
Doc/Zsh/compsys.yo: allow brace expansion on patterns for
|
Doc/Zsh/compsys.yo: allow brace expansion on patterns for
|
||||||
file-patterns and tag-order
|
file-patterns and tag-order
|
||||||
|
|
|
||||||
29
Src/parse.c
29
Src/parse.c
|
|
@ -2741,7 +2741,7 @@ static FuncDump dumps;
|
||||||
/* Load a dump file (i.e. map it). */
|
/* Load a dump file (i.e. map it). */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
load_dump_file(char *dump, int other, int len)
|
load_dump_file(char *dump, struct stat *sbuf, int other, int len)
|
||||||
{
|
{
|
||||||
FuncDump d;
|
FuncDump d;
|
||||||
Wordcode addr;
|
Wordcode addr;
|
||||||
|
|
@ -2781,7 +2781,8 @@ load_dump_file(char *dump, int other, int len)
|
||||||
d = (FuncDump) zalloc(sizeof(*d));
|
d = (FuncDump) zalloc(sizeof(*d));
|
||||||
d->next = dumps;
|
d->next = dumps;
|
||||||
dumps = d;
|
dumps = d;
|
||||||
d->name = ztrdup(dump);
|
d->dev = sbuf->st_dev;
|
||||||
|
d->ino = sbuf->st_ino;
|
||||||
d->fd = fd;
|
d->fd = fd;
|
||||||
d->map = addr + (other ? (len - off) / sizeof(wordcode) : 0);
|
d->map = addr + (other ? (len - off) / sizeof(wordcode) : 0);
|
||||||
d->addr = addr;
|
d->addr = addr;
|
||||||
|
|
@ -2806,7 +2807,7 @@ try_dump_file(char *path, char *name, char *file, int *ksh)
|
||||||
char *dig, *wc;
|
char *dig, *wc;
|
||||||
|
|
||||||
if (strsfx(FD_EXT, path))
|
if (strsfx(FD_EXT, path))
|
||||||
return check_dump_file(path, name, ksh);
|
return check_dump_file(path, NULL, name, ksh);
|
||||||
|
|
||||||
dig = dyncat(path, FD_EXT);
|
dig = dyncat(path, FD_EXT);
|
||||||
wc = dyncat(file, FD_EXT);
|
wc = dyncat(file, FD_EXT);
|
||||||
|
|
@ -2822,13 +2823,13 @@ try_dump_file(char *path, char *name, char *file, int *ksh)
|
||||||
if (!rd &&
|
if (!rd &&
|
||||||
(rc || std.st_mtime > stc.st_mtime) &&
|
(rc || std.st_mtime > stc.st_mtime) &&
|
||||||
(rn || std.st_mtime > stn.st_mtime) &&
|
(rn || std.st_mtime > stn.st_mtime) &&
|
||||||
(prog = check_dump_file(dig, name, ksh)))
|
(prog = check_dump_file(dig, &std, name, ksh)))
|
||||||
return prog;
|
return prog;
|
||||||
|
|
||||||
/* No digest file. Now look for the per-function compiled file. */
|
/* No digest file. Now look for the per-function compiled file. */
|
||||||
if (!rc &&
|
if (!rc &&
|
||||||
(rn || stc.st_mtime > stn.st_mtime) &&
|
(rn || stc.st_mtime > stn.st_mtime) &&
|
||||||
(prog = check_dump_file(wc, name, ksh)))
|
(prog = check_dump_file(wc, &stc, name, ksh)))
|
||||||
return prog;
|
return prog;
|
||||||
|
|
||||||
/* No compiled file for the function. The caller (getfpfunc() will
|
/* No compiled file for the function. The caller (getfpfunc() will
|
||||||
|
|
@ -2853,7 +2854,7 @@ try_source_file(char *file)
|
||||||
tail = file;
|
tail = file;
|
||||||
|
|
||||||
if (strsfx(FD_EXT, file))
|
if (strsfx(FD_EXT, file))
|
||||||
return check_dump_file(file, tail, NULL);
|
return check_dump_file(file, NULL, tail, NULL);
|
||||||
|
|
||||||
wc = dyncat(file, FD_EXT);
|
wc = dyncat(file, FD_EXT);
|
||||||
|
|
||||||
|
|
@ -2861,7 +2862,7 @@ try_source_file(char *file)
|
||||||
rn = stat(file, &stn);
|
rn = stat(file, &stn);
|
||||||
|
|
||||||
if (!rc && (rn || stc.st_mtime > stn.st_mtime) &&
|
if (!rc && (rn || stc.st_mtime > stn.st_mtime) &&
|
||||||
(prog = check_dump_file(wc, tail, NULL)))
|
(prog = check_dump_file(wc, &stc, tail, NULL)))
|
||||||
return prog;
|
return prog;
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
@ -2872,12 +2873,19 @@ try_source_file(char *file)
|
||||||
|
|
||||||
/**/
|
/**/
|
||||||
static Eprog
|
static Eprog
|
||||||
check_dump_file(char *file, char *name, int *ksh)
|
check_dump_file(char *file, struct stat *sbuf, char *name, int *ksh)
|
||||||
{
|
{
|
||||||
int isrec = 0;
|
int isrec = 0;
|
||||||
Wordcode d;
|
Wordcode d;
|
||||||
FDHead h;
|
FDHead h;
|
||||||
FuncDump f;
|
FuncDump f;
|
||||||
|
struct stat lsbuf;
|
||||||
|
|
||||||
|
if (!sbuf) {
|
||||||
|
if (stat(file, &lsbuf))
|
||||||
|
return NULL;
|
||||||
|
sbuf = &lsbuf;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef USE_MMAP
|
#ifdef USE_MMAP
|
||||||
|
|
||||||
|
|
@ -2890,7 +2898,7 @@ check_dump_file(char *file, char *name, int *ksh)
|
||||||
#ifdef USE_MMAP
|
#ifdef USE_MMAP
|
||||||
|
|
||||||
for (f = dumps; f; f = f->next)
|
for (f = dumps; f; f = f->next)
|
||||||
if (!strcmp(file, f->name)) {
|
if (f->dev == sbuf->st_dev && f->ino == sbuf->st_ino) {
|
||||||
d = f->map;
|
d = f->map;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -2935,7 +2943,7 @@ check_dump_file(char *file, char *name, int *ksh)
|
||||||
|
|
||||||
return prog;
|
return prog;
|
||||||
} else if (fdflags(d) & FDF_MAP) {
|
} else if (fdflags(d) & FDF_MAP) {
|
||||||
load_dump_file(file, (fdflags(d) & FDF_OTHER), fdother(d));
|
load_dump_file(file, sbuf, (fdflags(d) & FDF_OTHER), fdother(d));
|
||||||
isrec = 1;
|
isrec = 1;
|
||||||
goto rec;
|
goto rec;
|
||||||
} else
|
} else
|
||||||
|
|
@ -3017,7 +3025,6 @@ decrdumpcount(FuncDump f)
|
||||||
dumps = p->next;
|
dumps = p->next;
|
||||||
munmap((void *) f->addr, f->len);
|
munmap((void *) f->addr, f->len);
|
||||||
zclose(f->fd);
|
zclose(f->fd);
|
||||||
zsfree(f->name);
|
|
||||||
zfree(f, sizeof(*f));
|
zfree(f, sizeof(*f));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -487,7 +487,8 @@ typedef struct eprog *Eprog;
|
||||||
|
|
||||||
struct funcdump {
|
struct funcdump {
|
||||||
FuncDump next; /* next in list */
|
FuncDump next; /* next in list */
|
||||||
char *name; /* path name */
|
dev_t dev; /* device */
|
||||||
|
ino_t ino; /* indoe number */
|
||||||
int fd; /* file descriptor */
|
int fd; /* file descriptor */
|
||||||
Wordcode map; /* pointer to header */
|
Wordcode map; /* pointer to header */
|
||||||
Wordcode addr; /* mapped region */
|
Wordcode addr; /* mapped region */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue