Index: head/lang/siod/Makefile =================================================================== --- head/lang/siod/Makefile (revision 566017) +++ head/lang/siod/Makefile (revision 566018) @@ -1,85 +1,85 @@ # Created by: jkoshy # $FreeBSD$ PORTNAME= siod PORTVERSION= 3.6.2 CATEGORIES= lang scheme MASTER_SITES= http://people.delphiforums.com/gjc/ DISTNAME= siod DIST_SUBDIR= ${PORTNAME}-${PORTVERSION} # Upstream aren't versioned :( MAINTAINER= mi@aldan.algebra.com COMMENT= Small footprint implementation of the Scheme programming language LICENSE= LGPL21 # Declared inside slib.c USES= uidfix tar:tgz dos2unix USE_LDCONFIG= ${PREFIX}/lib ${PREFIX}/lib/siod DOS2UNIX_FILES= sql_oracle.c ss.c siod.scm OPTIONS_DEFINE= SQL_SYBASE GD NDBM REGEX SS DOCS OPTIONS_DEFINE_i386=SQL_ORACLE # oracle-client port only available for i386 OPTIONS_DEFAULT=NDBM REGEX SS SQL_ORACLE_DESC=Build Oracle client-module (i386 only) SQL_SYBASE_DESC=Build Sybase (and MS-SQL) client-module (using FreeTDS) SS_DESC= Sockets support - required for any network programs NDBM_DESC= Support for NDBM-databases NO_WRKSUBDIR= yes EXTRACT_AFTER_ARGS=--exclude md5\* --exclude regex.h --exclude reg????*.c MAKE_ARGS= VPATH=${WRKSRC} MODULES=${MODULES:Q} MAKEFILE= ${FILESDIR}/BSDmakefile MAKE_ENV= MKDIR=${MKDIR:Q} STAGEDIR=${STAGEDIR:Q} MAKE_ENV+= MAN1PREFIX=${MAN1PREFIX} PREFIX=${PREFIX:Q} MAKE_ENV+= INSTALL_MAN=${INSTALL_MAN:Q} INSTALL_SCRIPT=${INSTALL_SCRIPT:Q} MAKE_ENV+= INSTALL_DATA=${INSTALL_DATA:Q} -MODULES= statfs tar parser_pratt +MODULES= acct statfs tar parser_pratt SQL_SYBASE_LIB_DEPENDS= libct.so:databases/freetds # Or freetds-devel GD_LIB_DEPENDS= libgd.so:graphics/gd # Or ukrainian/gd REGEX_LIB_DEPENDS= libgnuregex.so:devel/libgnuregex OPTIONS_SUB= yes SQL_ORACLE_BUILD_DEPENDS=${LOCALBASE}/oracle8-client/lib/libclntsh.a:databases/oracle8-client .if "${PREFIX}" != "/usr/local" post-patch: ${REINPLACE_CMD} 's|/usr/local|${PREFIX}|g' ${WRKSRC}/slib.c \ ${WRKSRC}/*.man .endif post-build: ${REINPLACE_CMD} -e 's|\./siod|env LD_LIBRARY_PATH=lib siod/siod|g' \ -e 's|/usr/local|${PREFIX}|g' ${WRKSRC}/makefile ${MAKE} -C ${WRKSRC} -f makefile build_driver .include MODULES+= ${SELECTED_OPTIONS:NDOCS:tl} # XXX This should not be necessary: .if ${ARCH} != i386 PLIST_SUB+= SQL_ORACLE="@comment " .endif do-configure: ${MKDIR} ${WRKSRC}/lib ${LN} -sf ${FILESDIR}/BSDmakefile.lib ${WRKSRC}/lib/BSDmakefile .for s in ${MODULES} ${MKDIR} ${WRKSRC}/$s ${SED} "s,%%MODULE%%,$s,g" ${FILESDIR}/BSDmakefile.module > \ ${WRKSRC}/$s/BSDmakefile .endfor .for s in siod sample ${MKDIR} ${WRKSRC}/$s ${SED} "s,%%PROG%%,$s,g" ${FILESDIR}/BSDmakefile.prog > \ ${WRKSRC}/$s/BSDmakefile .endfor post-install-DOCS-off: ${RM} ${STAGEDIR}${PREFIX}/lib/siod/siod.html post-install-DOCS-on: ${MKDIR} ${STAGEDIR}${DOCSDIR} ${MV} ${STAGEDIR}${PREFIX}/lib/siod/siod.html ${STAGEDIR}${DOCSDIR}/ .include Index: head/lang/siod/files/patch-acct =================================================================== --- head/lang/siod/files/patch-acct (nonexistent) +++ head/lang/siod/files/patch-acct (revision 566018) @@ -0,0 +1,259 @@ +--- acct.c 2014-03-25 06:16:47.000000000 -0400 ++++ acct.c 2021-02-18 19:25:12.351120000 -0500 +@@ -1,6 +1,8 @@ + #include + #include ++#include + #include +-#include ++#include ++#include + #if defined(__osf__) + #include +@@ -10,9 +12,10 @@ + static void init_acct_version(void) + {setvar(cintern("*acct-version*"), +- cintern("$Id: acct.c,v 1.1 1996/10/17 18:40:18 gjc Exp $"), ++ cintern("$FreeBSD$"), + NIL);} + + /* decode various accounting structures */ + ++#if defined(__osf__) + /* I could not find any include file for this structure, only documentation + for it in the "man acct" */ +@@ -32,26 +35,77 @@ + unsigned short ta_sc; + unsigned short ta_dc;}; ++#endif + ++static struct utmpx_types { ++ const char *name; ++ short type; ++} utmpx_types[] = { ++ /* Keep sorted by name */ ++#define T(name) { #name, name } ++#ifdef ACCOUNTING ++ T(ACCOUNTING), ++#endif ++ T(BOOT_TIME), ++ T(DEAD_PROCESS), ++#ifdef EMPTY ++ T(EMPTY), ++#endif ++ T(INIT_PROCESS), ++ T(LOGIN_PROCESS), ++ T(NEW_TIME), ++ T(OLD_TIME), ++#ifdef RUN_LVL ++ T(RUN_LVL), ++#endif ++ T(USER_PROCESS) ++}; ++#undef T ++ ++static LISP utmpx_type_name(short type) ++{ ++ unsigned u; ++ ++ for (u = 0; u < sizeof(utmpx_types)/sizeof(utmpx_types[0]); u++) ++ if (utmpx_types[u].type == type) ++ return cintern(utmpx_types[u].name); ++ return flocons(type); ++} ++ ++static short utmpx_type_num(LISP type) ++{ ++ int64_t _type; ++ short result; ++ const char *name; ++ unsigned u; ++ ++ switch (TYPE(type)) { ++ case tc_flonum: ++ result = _type = FLONM(type); ++ if (result < 0) ++ err("UTMPX cannot be negative", type); ++ if (result != _type) ++ err("Number too large to be a UTMPX type", type); ++ return result; ++ /* Any special cases for other types? */ ++ default: ++ name = get_c_string(type); ++ } ++ for (u = 0; u < sizeof(utmpx_types)/sizeof(utmpx_types[0]); u++) { ++ int cmp = strcmp(utmpx_types[u].name, name); ++ ++ if (cmp == 0) ++ return utmpx_types[u].type; ++ if (cmp > 0) ++ break; ++ } ++ err("No such UTMPX type", type); ++ return -1; ++} + +-LISP decode_utmp(struct utmp *p) ++static LISP decode_utmpx(struct utmpx *p) + {return(symalist("user",strcons(SAFE_STRLEN(p->ut_user),p->ut_user), + "id",strcons(SAFE_STRLEN(p->ut_id),p->ut_id), + "line",strcons(SAFE_STRLEN(p->ut_line),p->ut_line), +- "type", +-#ifdef EMPTY +- (p->ut_type == EMPTY) ? cintern("EMPTY") : +-#endif +- (p->ut_type == RUN_LVL) ? cintern("RUN_LVL") : +- (p->ut_type == BOOT_TIME) ? cintern("BOOT_TIME") : +- (p->ut_type == OLD_TIME) ? cintern("OLD_TIME") : +- (p->ut_type == NEW_TIME) ? cintern("NEW_TIME") : +- (p->ut_type == INIT_PROCESS) ? cintern("INIT_PROCESS") : +- (p->ut_type == LOGIN_PROCESS) ? cintern("LOGIN_PROCESS") : +- (p->ut_type == USER_PROCESS) ? cintern("USER_PROCESS") : +- (p->ut_type == DEAD_PROCESS) ? cintern("DEAD_PROCESS") : +-#ifdef ACCOUNTING +- (p->ut_type == ACCOUNTING) ? cintern("ACCOUNTING") : +-#endif +- flocons(p->ut_type), ++ "type", utmpx_type_name(p->ut_type), + "pid",flocons(p->ut_pid), + #if defined(__osf__) +@@ -59,34 +113,69 @@ + "exit",flocons(p->ut_exit.e_exit), + #endif +- "ut_time",flocons(p->ut_time), ++ "ut_time", flocons(time(&p->ut_tv.tv_sec)), + "host",strcons(SAFE_STRLEN(p->ut_host),p->ut_host), + NULL));} + +-LISP lgetutent(void) +-{struct utmp *p; ++static LISP lgetutent(void) ++{struct utmpx *p; + long iflag; + iflag = no_interrupt(1); +- p = getutent(); ++ p = getutxent(); + no_interrupt(iflag); +- return((p) ? decode_utmp(p) : NIL);} ++ return((p) ? decode_utmpx(p) : NIL);} + +-LISP lsetutent(void) +-{long iflag; +- iflag = no_interrupt(1); +- setutent(); +- no_interrupt(iflag); +- return(NIL);} ++static LISP lgetutxid(LISP ltype, LISP lid) ++{ ++ const char *id; ++ long idlen; ++ ++ struct utmpx *p, utmpx = { ++ .ut_type = utmpx_type_num(ltype) ++ }; ++ if (lid != NULL) { ++ id = get_c_string_dim(lid, &idlen); ++ if ((size_t)idlen > sizeof(utmpx.ut_id)) ++ err("String too long to be a UTMPX ID", lid); ++ memcpy(&utmpx.ut_id, id, idlen); ++ } ++ p = getutxid(&utmpx); ++ return p == NULL ? NULL : decode_utmpx(p); ++} ++ ++static LISP lgetutxline(LISP lline) ++{ ++ long linelen; ++ const char *line = get_c_string_dim(lline, &linelen); ++ struct utmpx *p, utmpx = { .ut_type = 0 }; ++ ++ if (line == NULL || linelen == 0 || ++ (size_t)linelen > sizeof utmpx.ut_line) { ++ err("Not a valid UTMPX line", lline); ++ } ++ memcpy(&utmpx.ut_line, line, linelen); ++ p = getutxline(&utmpx); ++ return p == NULL ? NULL : decode_utmpx(p); ++} ++ ++static LISP lgetutxuser(LISP luser) ++{ ++ const char *user = get_c_string(luser); ++ struct utmpx *p; ++ ++ p = getutxuser(user); ++ return p == NULL ? NULL : decode_utmpx(p); ++} + +-LISP lendutent(void) ++static LISP lsetutent(void) + {long iflag; + iflag = no_interrupt(1); +- endutent(); ++ setutxent(); + no_interrupt(iflag); + return(NIL);} + +-LISP lutmpname(LISP name) ++static LISP lendutent(void) + {long iflag; + iflag = no_interrupt(1); +- utmpname(get_c_string(name)); ++ endutxent(); + no_interrupt(iflag); + return(NIL);} +@@ -94,5 +183,5 @@ + #if defined(__osf__) + +-LISP decode_acct(struct acct *p) ++static LISP decode_acct(struct acct *p) + {LISP flags = NIL; + if (p->ac_flag & AFORK) flags = cons(cintern("FORK"),flags); +@@ -121,5 +210,5 @@ + NULL));} + +-LISP ldecode_acct(LISP l) ++static LISP ldecode_acct(LISP l) + {char *buffer; + long n; +@@ -129,5 +218,5 @@ + return(decode_acct((struct acct *) buffer));} + +-LISP decode_tacct(struct tacct *p) ++static LISP decode_tacct(struct tacct *p) + {return(symalist("uid",flocons(p->ta_uid), + "name",strcons(SAFE_STRLEN(p->ta_name),p->ta_name), +@@ -155,5 +244,5 @@ + NULL));} + +-LISP ldecode_tacct(LISP l) ++static LISP ldecode_tacct(LISP l) + {char *buffer; + long n; +@@ -165,11 +254,17 @@ + #endif + ++void init_acct(void); /* The function invoked by siod upon loading module */ ++ + void init_acct(void) +-{setvar(cintern("UTMP_FILE"),strcons(strlen(UTMP_FILE),UTMP_FILE),NIL); +- setvar(cintern("WTMP_FILE"),strcons(strlen(WTMP_FILE),WTMP_FILE),NIL); ++{ + init_subr_0("getutent",lgetutent); ++ init_subr_0("getutxent", lgetutent); + init_subr_0("setutent",lsetutent); ++ init_subr_0("setutxent", lsetutent); + init_subr_0("endutent",lendutent); +- init_subr_1("utmpname",lutmpname); ++ init_subr_0("endutxent", lendutent); ++ init_subr_2("getutxid", lgetutxid); ++ init_subr_1("getutxline", lgetutxline); ++ init_subr_1("getutxuser", lgetutxuser); + #if defined(__osf__) + setvar(cintern("SIZEOF_ACCT"),flocons(sizeof(struct acct)),NIL); +@@ -179,5 +274,2 @@ + #endif + init_acct_version();} +- +- +- Property changes on: head/lang/siod/files/patch-acct ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: head/lang/siod/files/patch-statfs =================================================================== --- head/lang/siod/files/patch-statfs (revision 566017) +++ head/lang/siod/files/patch-statfs (revision 566018) @@ -1,158 +1,168 @@ --- statfs.c 2014-03-25 04:10:42.000000000 -0400 -+++ statfs.c 2021-02-17 22:30:00.996673000 -0500 ++++ statfs.c 2021-02-18 18:56:33.147163000 -0500 @@ -4,9 +4,15 @@ #include +#ifdef HAVE_SYS_PARAM_H +#include +#endif #include +#ifndef BSD #include +#endif #include #include "siod.h" +#ifndef BSD #define MNT_NUMTYPES 128 /* -@@ -14,16 +20,87 @@ +@@ -14,16 +20,98 @@ */ extern char *mnt_names[]; +#endif -LISP lstatfs(LISP path) +#ifdef BSD +static LISP decode_fstat_flags(uint64_t flags) +{ +#define FLAGCODE(name) { #name, MNT_ ## name } + struct { + const char *name; + uint64_t flag; + } flagcodes[] = { + /* Flags listed in statfs(2). Keep sorted for consistency */ + FLAGCODE(ACLS), + FLAGCODE(ASYNC), + FLAGCODE(DEFEXPORTED), + FLAGCODE(EXKERB), + FLAGCODE(EXPORTANON), + FLAGCODE(EXPORTED), + FLAGCODE(EXPUBLIC), + FLAGCODE(EXRDONLY), + FLAGCODE(GJOURNAL), + FLAGCODE(LOCAL), + FLAGCODE(MULTILABEL), + FLAGCODE(NOATIME), + FLAGCODE(NOCLUSTERR), + FLAGCODE(NOCLUSTERW), + FLAGCODE(NOEXEC), + FLAGCODE(NOSUID), + FLAGCODE(NOSYMFOLLOW), + FLAGCODE(QUOTA), + FLAGCODE(RDONLY), + FLAGCODE(ROOTFS), + FLAGCODE(SOFTDEP), + FLAGCODE(SUIDDIR), + FLAGCODE(SYNCHRONOUS), + FLAGCODE(UNION), + FLAGCODE(USER) + }; +#undef FLAGCODE + unsigned u; + LISP result = NULL, val, l; + + for (u = 0; u < sizeof(flagcodes) / sizeof(flagcodes[0]); u++) { + if (!(flags & flagcodes[u].flag)) + continue; + val = cintern(flagcodes[u].name); + if (result == NULL) { + l = result = cons(val, NULL); + continue; + } + CDR(l) = cons(val, NULL); + l = CDR(l); + } + return result; +} +#endif /* BSD */ + + +static LISP lstatfs(LISP path) {long iflag; struct statfs s; ++#ifdef BSD ++ LISP lfsid; ++#endif iflag = no_interrupt(1); - if (statfs(get_c_string(path),&s,sizeof(s))) + if (TYPE(path) == tc_c_file) { + int fd = fileno(path->storage_as.c_file.f); + if (fstatfs(fd, &s)) + return(err("fstatfs", llast_c_errmsg(-1))); + } else if (statfs(get_c_string(path), &s +#if !defined(BSD) && !defined(linux) + ,sizeof(s) +#endif + )) return(err("statfs",llast_c_errmsg(-1))); + no_interrupt(iflag); - return(symalist("type",(((s.f_type >= 0) && (s.f_type < MNT_NUMTYPES) && ++ if (s.f_fsid.val[0] != 0 || s.f_fsid.val[1] != 0) { ++ lfsid = strcons(sizeof(s.f_fsid) * 2, NULL); ++ unsigned u; ++ char *p = get_string_data(lfsid); ++ for (u = 0; u < sizeof(s.f_fsid); u++, p += 2) ++ sprintf(p, "%02x", ((u_char *)&s.f_fsid)[u]); ++ } else ++ lfsid = NULL; + return(symalist("type", +#ifdef BSD + s.f_fstypename[0] != '\0' + ? rintern(s.f_fstypename) +#else + ((s.f_type >= 0) && (s.f_type < MNT_NUMTYPES) && mnt_names[s.f_type]) ? rintern(mnt_names[s.f_type]) - : flocons(s.f_type)), +#endif + : flocons(s.f_type), "bsize",flocons(s.f_bsize), "blocks",flocons(s.f_blocks), -@@ -34,8 +111,18 @@ +@@ -34,8 +122,17 @@ "mntonname",strcons(-1,s.f_mntonname), "mntfromname",strcons(-1,s.f_mntfromname), +#ifdef BSD + "syncwrites", flocons(s.f_syncwrites), + "asyncwrites", flocons(s.f_asyncwrites), + "syncreads", flocons(s.f_syncreads), + "asyncreads", flocons(s.f_asyncreads), + "namemax", flocons(s.f_namemax), -+ "fsid", flocons(((uint64_t)s.f_fsid.val[0] << 32) + -+ s.f_fsid.val[1]), + "flags", decode_fstat_flags(s.f_flags), ++ lfsid == NULL ? NULL : "fsid", lfsid, +#endif NULL));} -static LISP decode_fstab(struct fstab *p) +static LISP decode_fstab(const struct fstab *p) {if (p) return(symalist("spec",strcons(-1,p->fs_spec), -@@ -50,5 +137,5 @@ +@@ -50,5 +147,5 @@ return(NIL);} -LISP lgetfsent(void) +static LISP lgetfsent(void) {long iflag; LISP result; -@@ -58,5 +145,5 @@ +@@ -58,5 +155,5 @@ return(result);} -LISP lsetfsent(void) +static LISP lsetfsent(void) {long iflag; LISP result; -@@ -66,5 +153,5 @@ +@@ -66,5 +163,5 @@ return(result);} -LISP lendfsent(void) +static LISP lendfsent(void) {long iflag; iflag = no_interrupt(1); -@@ -73,4 +160,6 @@ +@@ -73,4 +170,6 @@ return(NIL);} +void init_statfs(void); /* The sole symbol exported from a SIOD-module */ + void init_statfs(void) {init_subr_1("statfs",lstatfs); Index: head/lang/siod/pkg-plist =================================================================== --- head/lang/siod/pkg-plist (revision 566017) +++ head/lang/siod/pkg-plist (revision 566018) @@ -1,60 +1,61 @@ bin/csiod bin/snapshot-dir bin/snapshot-compare bin/http-get bin/cp-build bin/ftp-cp bin/ftp-put bin/ftp-test bin/ftp-get bin/http-stress bin/proxy-server bin/siod lib/siod/fork-test.scm lib/siod/http-server.scm lib/siod/http-stress.scm lib/siod/http.scm lib/siod/maze-support.scm lib/siod/pratt.scm lib/siod/siod.scm lib/siod/smtp.scm lib/siod/sql_oracle.scm lib/siod/sql_rdb.scm lib/siod/sql_sybase.scm lib/siod/cgi-echo.scm lib/siod/find-files.scm lib/siod/hello.scm lib/siod/parser_pratt.scm lib/siod/pop3.scm lib/siod/selfdoc.scm lib/siod/sample.c %%PORTDOCS%%%%DOCSDIR%%/siod.html lib/siod/piechart.scm lib/siod/cgi.scm lib/siod/ftp.scm lib/siod/sql_msql.scm +lib/siod/acct.so %%GD%%lib/siod/gd.so %%NDBM%%lib/siod/ndbm.so %%SS%%lib/siod/ss.so lib/siod/statfs.so lib/siod/tar.so %%SQL_ORACLE%%lib/siod/sql_oracle.so %%SQL_SYBASE%%lib/siod/sql_sybase.so %%REGEX%%lib/siod/regex.so lib/siod/parser_pratt.so lib/libsiod.a lib/libsiod.so lib/libsiod.so.3 include/siod.h man/man1/cp-build.1.gz man/man1/csiod.1.gz man/man1/ftp-cp.1.gz man/man1/ftp-get.1.gz man/man1/ftp-put.1.gz man/man1/ftp-test.1.gz man/man1/http-get.1.gz man/man1/http-stress.1.gz man/man1/proxy-server.1.gz man/man1/siod.1.gz man/man1/snapshot-compare.1.gz man/man1/snapshot-dir.1.gz