Fix small matters and improve sysconf()

- Fix mkdeps.com out of memory error
- Remove static memory from __get_cpu_count()
- Add support for passing hyphen to cat in cocmd
- Change more ZipOS errors from ENOTSUP to EROFS
- Specify mem_unit in sysinfo() output on BSD OSes
This commit is contained in:
Justine Tunney 2023-08-17 00:25:01 -07:00
parent eebc24b9cd
commit 3a9cac4892
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
55 changed files with 411 additions and 262 deletions

View file

@ -16,10 +16,13 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/calls/internal.h"
#include "libc/calls/struct/fd.internal.h"
#include "libc/calls/syscall_support-sysv.internal.h"
#include "libc/calls/termios.h"
#include "libc/errno.h"
#include "libc/intrin/strace.internal.h"
#include "libc/sysv/errfuns.h"
static char g_ptsname[16];
@ -30,7 +33,10 @@ static char g_ptsname[16];
*/
char *ptsname(int fd) {
char *res;
if (!_ptsname(fd, g_ptsname, sizeof(g_ptsname))) {
if (fd < g_fds.n && g_fds.p[fd].kind == kFdZip) {
enotty();
res = 0;
} else if (!_ptsname(fd, g_ptsname, sizeof(g_ptsname))) {
res = g_ptsname;
} else {
res = 0;