mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-22 21:32:31 +00:00
Get Fat Emacs working on Apple Silicon
This commit is contained in:
parent
3f9b39883f
commit
bf835de612
14 changed files with 294 additions and 144 deletions
|
@ -18,7 +18,6 @@
|
|||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/dce.h"
|
||||
#include "libc/intrin/weaken.h"
|
||||
#include "libc/log/backtrace.internal.h"
|
||||
#include "libc/log/log.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/runtime/symbols.internal.h"
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include "libc/calls/struct/stat.h"
|
||||
#include "libc/runtime/zipos.internal.h"
|
||||
#include "libc/sysv/consts/ok.h"
|
||||
#include "libc/sysv/consts/s.h"
|
||||
#include "libc/sysv/errfuns.h"
|
||||
#include "libc/zip.internal.h"
|
||||
|
||||
|
@ -43,7 +44,12 @@ int __zipos_access(struct ZiposUri *name, int amode) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
int mode = GetZipCfileMode(z->map + cf);
|
||||
int mode;
|
||||
if (cf != ZIPOS_SYNTHETIC_DIRECTORY) {
|
||||
mode = GetZipCfileMode(z->map + cf);
|
||||
} else {
|
||||
mode = S_IFDIR | 0555;
|
||||
}
|
||||
if (amode == F_OK) {
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -33,16 +33,28 @@ static int64_t __zipos_lseek_impl(struct ZiposHandle *h, int64_t offset,
|
|||
}
|
||||
switch (whence) {
|
||||
case SEEK_SET:
|
||||
return offset;
|
||||
if (offset >= 0) {
|
||||
return offset;
|
||||
} else {
|
||||
return einval();
|
||||
}
|
||||
case SEEK_CUR:
|
||||
if (!ckd_add(&pos, h->pos, offset)) {
|
||||
return pos;
|
||||
if (pos >= 0) {
|
||||
return pos;
|
||||
} else {
|
||||
return einval();
|
||||
}
|
||||
} else {
|
||||
return eoverflow();
|
||||
}
|
||||
case SEEK_END:
|
||||
if (!ckd_sub(&pos, h->size, offset)) {
|
||||
return pos;
|
||||
if (pos >= 0) {
|
||||
return pos;
|
||||
} else {
|
||||
return einval();
|
||||
}
|
||||
} else {
|
||||
return eoverflow();
|
||||
}
|
||||
|
@ -61,7 +73,6 @@ static int64_t __zipos_lseek_impl(struct ZiposHandle *h, int64_t offset,
|
|||
*/
|
||||
int64_t __zipos_lseek(struct ZiposHandle *h, int64_t offset, unsigned whence) {
|
||||
int64_t pos;
|
||||
if (offset < 0) return einval();
|
||||
pthread_mutex_lock(&h->lock);
|
||||
if ((pos = __zipos_lseek_impl(h, offset, whence)) != -1) {
|
||||
h->pos = pos;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue