Ticket #22716: macports.patch

File macports.patch, 2.3 KB (added by mmpestorich (Mike M Pestorich), 14 years ago)
  • src/macports1.0/sysctl.c

     
    4141#include <sys/types.h>
    4242#include <sys/sysctl.h>
    4343
     44#include <sys/cdefs.h>
     45
    4446#include "sysctl.h"
    4547
    4648/*
     49 * Work around for linux
     50 */
     51int
     52sysctlbyname(const char *name, void *oldp, size_t *oldlenp, void *newp, size_t newlen)
     53{
     54        int name2oid_oid[2];
     55        int real_oid[CTL_MAXNAME+2];
     56        int error;
     57        size_t oidlen;
     58
     59        name2oid_oid[0] = 0;    /* This is magic & undocumented! */
     60        name2oid_oid[1] = 3;
     61
     62        oidlen = sizeof(real_oid);
     63        error = sysctl(name2oid_oid, 2, real_oid, &oidlen, (void *)name,
     64                                   strlen(name));
     65        if (error < 0)
     66                return error;
     67        oidlen /= sizeof (int);
     68        error = sysctl(real_oid, oidlen, oldp, oldlenp, newp, newlen);
     69        return (error);
     70}
     71
     72/*
    4773 * Read-only wrapper for sysctlbyname(3). Only works for values of type CTLTYPE_INT and CTLTYPE_QUAD.
    4874 */
    4975int SysctlCmd(ClientData clientData UNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
  • src/pextlib1.0/tracelib.c

     
    4646#include <pthread.h>
    4747#include <limits.h>
    4848#include "tracelib.h"
     49#include <sys/cdefs.h>
    4950
    5051static char * name;
    5152static char * sandbox;
     
    7374
    7475#define MAX_SOCKETS ((FD_SETSIZE)-1)
    7576
     77/*
     78 * Copy src to string dst of size siz.  At most siz-1 characters
     79 * will be copied.  Always NUL terminates (unless siz == 0).
     80 * Returns strlen(src); if retval >= siz, truncation occurred.
     81 */
     82size_t strlcpy(dst, src, siz)
     83        char *dst;
     84        const char *src;
     85        size_t siz;
     86{
     87        char *d = dst;
     88        const char *s = src;
     89        size_t n = siz;
     90
     91        /* Copy as many bytes as will fit */
     92        if (n != 0 && --n != 0) {
     93                do {
     94                        if ((*d++ = *s++) == 0)
     95                                break;
     96                } while (--n != 0);
     97        }
     98
     99        /* Not enough room in dst, add NUL and traverse rest of src */
     100        if (n == 0) {
     101                if (siz != 0)
     102                        *d = '\0';/* NUL-terminate dst */
     103                        while (*s++)
     104                                ;
     105        }
     106
     107        return(s - src - 1);/* count does not include NUL */
     108}
     109
    76110static int TracelibSetNameCmd(Tcl_Interp * interp, int objc, Tcl_Obj *CONST objv[])
    77111{
    78112        if (objc != 3)