Changeset 4026

Show
Ignore:
Timestamp:
04/03/06 21:09:36 (3 years ago)
Author:
morris
Message:

Fixes for Solaris

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • libwired/trunk/config.h.in

    r4019 r4026  
    33/* Define to 1 if you have the <CoreServices/CoreServices.h> header file. */ 
    44#undef HAVE_CORESERVICES_CORESERVICES_H 
     5 
     6/* Define to 1 if you have the <curses.h> header file. */ 
     7#undef HAVE_CURSES_H 
    58 
    69/* Define to 1 if you have the `daemon' function. */ 
     
    7174#undef HAVE_SRANDOM 
    7275 
     76/* Define to 1 if you have the `statvfs' function. */ 
     77#undef HAVE_STATVFS 
     78 
    7379/* Define to 1 if you have the <stdint.h> header file. */ 
    7480#undef HAVE_STDINT_H 
     
    111117#undef HAVE_SYS_SOCKIO_H 
    112118 
     119/* Define to 1 if you have the <sys/statfs.h> header file. */ 
     120#undef HAVE_SYS_STATFS_H 
     121 
     122/* Define to 1 if you have the <sys/statvfs.h> header file. */ 
     123#undef HAVE_SYS_STATVFS_H 
     124 
    113125/* Define to 1 if you have the <sys/stat.h> header file. */ 
    114126#undef HAVE_SYS_STAT_H 
     
    117129#undef HAVE_SYS_TYPES_H 
    118130 
    119 /* Define to 1 if you have the <sys/vfs.h> header file. */ 
    120 #undef HAVE_SYS_VFS_H 
    121  
    122131/* Define to 1 if you have the <termcap.h> header file. */ 
    123132#undef HAVE_TERMCAP_H 
     
    125134/* Define to 1 if you have the <termios.h> header file. */ 
    126135#undef HAVE_TERMIOS_H 
     136 
     137/* Define to 1 if you have the <term.h> header file. */ 
     138#undef HAVE_TERM_H 
    127139 
    128140/* Define to 1 if you have the <unistd.h> header file. */ 
  • libwired/trunk/configure

    r4019 r4026  
    44294429 
    44304430 
     4431 
    44314432for ac_header in  \ 
    44324433        machine/param.h \ 
    44334434        sys/sockio.h \ 
    4434         sys/vfs.h \ 
     4435        sys/statfs.h \ 
     4436        sys/statvfs.h \ 
    44354437        getopt.h \ 
    44364438        ifaddrs.h \ 
     
    45904592 
    45914593 
     4594 
     4595 
    45924596for ac_header in  \ 
     4597                curses.h \ 
     4598                term.h \ 
    45934599                termcap.h \ 
    45944600                termios.h \ 
     
    55085514 
    55095515 
     5516 
    55105517for ac_func in  \ 
    55115518        daemon \ 
     
    55175524        setproctitle \ 
    55185525        srandom \ 
     5526        statvfs \ 
    55195527        strcasestr \ 
    55205528        strlcat \ 
  • libwired/trunk/configure.in

    r4019 r4026  
    193193        machine/param.h \ 
    194194        sys/sockio.h \ 
    195         sys/vfs.h \ 
     195        sys/statfs.h \ 
     196        sys/statvfs.h \ 
    196197        getopt.h \ 
    197198        ifaddrs.h \ 
     
    202203if test -n "$enable_termcap"; then 
    203204        AC_CHECK_HEADERS([ \ 
     205                curses.h \ 
     206                term.h \ 
    204207                termcap.h \ 
    205208                termios.h \ 
     
    230233        setproctitle \ 
    231234        srandom \ 
     235        statvfs \ 
    232236        strcasestr \ 
    233237        strlcat \ 
  • libwired/trunk/libwired/data/wi-uuid.c

    r3811 r4026  
    6262#include <sys/socket.h> 
    6363#include <sys/ioctl.h> 
     64 
     65#ifdef HAVE_SYS_SOCKIO_H 
     66#include <sys/sockio.h> 
     67#endif 
     68 
    6469#include <unistd.h> 
    6570#include <stdlib.h> 
     
    441446        struct ifconf           ifc; 
    442447        struct ifreq            ifr, *ifrp; 
    443 #ifdef HAVE_NET_IF_DL_H 
     448#if !defined(SIOCGIFHWADDR) && !defined(SIOCGENADDR) && defined(HAVE_NET_IF_DL_H) 
    444449        struct sockaddr_dl      *sdlp; 
    445450#endif 
  • libwired/trunk/libwired/file/wi-file.c

    r3828 r4026  
    3737#include <sys/stat.h> 
    3838#include <sys/mount.h> 
     39 
     40#ifdef HAVE_SYS_STATVFS_H 
     41#include <sys/statvfs.h> 
     42#endif 
     43 
     44#ifdef HAVE_SYS_STATFS_H 
     45#include <sys/statfs.h> 
     46#endif 
     47 
    3948#include <stdlib.h> 
    4049#include <unistd.h> 
     
    384393 
    385394 
    386 wi_boolean_t wi_file_statfs(wi_string_t *path, void *p) { 
    387         struct statfs           *sfp = p; 
    388  
    389         if(statfs(wi_string_cstring(path), sfp) < 0) { 
    390                 wi_error_set_errno(errno); 
    391                  
    392                 return false; 
    393         } 
     395wi_boolean_t wi_file_statfs(wi_string_t *path, wi_file_statfs_t *sfp) { 
     396#ifdef HAVE_STATVFS 
     397        struct statvfs          sfvb; 
     398 
     399        if(statvfs(wi_string_cstring(path), &sfvb) < 0) { 
     400                wi_error_set_errno(errno); 
     401                 
     402                return false; 
     403        } 
     404 
     405        sfp->f_bsize    = sfvb.f_bsize; 
     406        sfp->f_frsize   = sfvb.f_frsize; 
     407        sfp->f_blocks   = sfvb.f_blocks; 
     408        sfp->f_bfree    = sfvb.f_bfree; 
     409        sfp->f_bavail   = sfvb.f_bavail; 
     410        sfp->f_files    = sfvb.f_files; 
     411        sfp->f_ffree    = sfvb.f_ffree; 
     412        sfp->f_favail   = sfvb.f_favail; 
     413        sfp->f_fsid             = sfvb.f_fsid; 
     414        sfp->f_flag             = sfvb.f_flag; 
     415        sfp->f_namemax  = sfvb.f_namemax; 
     416#else 
     417        struct statfs           sfb; 
     418 
     419        if(statfs(wi_string_cstring(path), &sfb) < 0) { 
     420                wi_error_set_errno(errno); 
     421                 
     422                return false; 
     423        } 
     424 
     425        sfp->f_bsize    = sfb.f_bsize; 
     426        sfp->f_frsize   = sfb.f_frsize; 
     427        sfp->f_blocks   = sfb.f_blocks; 
     428        sfp->f_bfree    = sfb.f_bfree; 
     429        sfp->f_bavail   = sfb.f_bavail; 
     430        sfp->f_files    = sfb.f_files; 
     431        sfp->f_ffree    = sfb.f_ffree; 
     432        sfp->f_favail   = sfb.f_favail; 
     433        sfp->f_fsid             = sfb.f_fsid; 
     434        sfp->f_flag             = sfb.f_flag; 
     435        sfp->f_namemax  = sfb.f_namemax; 
     436#endif 
    394437         
    395438        return true; 
  • libwired/trunk/libwired/file/wi-file.h

    r3828 r4026  
    3333#include <sys/param.h> 
    3434#include <sys/stat.h> 
    35 #include <sys/mount.h> 
    36  
    37 #ifdef HAVE_SYS_VFS_H 
    38 #include <sys/vfs.h> 
    39 #endif 
    40  
    4135#include <stdio.h> 
    4236#include <wired/wi-base.h> 
     
    4539#define WI_PATH_SIZE                            MAXPATHLEN 
    4640#define WI_FILE_BUFFER_SIZE                     BUFSIZ 
     41 
     42 
     43typedef uint64_t                                        wi_file_offset_t; 
     44 
     45struct _wi_file_statfs { 
     46        uint32_t                                                f_bsize; 
     47        uint32_t                                                f_frsize; 
     48        uint32_t                                                f_blocks; 
     49        uint32_t                                                f_bfree; 
     50        uint32_t                                                f_bavail; 
     51        uint32_t                                                f_files; 
     52        uint32_t                                                f_ffree; 
     53        uint32_t                                                f_favail; 
     54        uint32_t                                                f_fsid; 
     55        uint32_t                                                f_flag; 
     56        uint32_t                                                f_namemax; 
     57}; 
     58typedef struct _wi_file_statfs          wi_file_statfs_t; 
    4759 
    4860 
     
    5567 
    5668 
    57 typedef uint64_t                                        wi_file_offset_t; 
    58  
    5969typedef struct _wi_file                         wi_file_t; 
    6070 
     
    6676WI_EXPORT wi_boolean_t                          wi_file_stat(wi_string_t *, struct stat *); 
    6777WI_EXPORT wi_boolean_t                          wi_file_lstat(wi_string_t *, struct stat *); 
    68 WI_EXPORT wi_boolean_t                          wi_file_statfs(wi_string_t *, void *); 
     78WI_EXPORT wi_boolean_t                          wi_file_statfs(wi_string_t *, wi_file_statfs_t *); 
    6979WI_EXPORT wi_boolean_t                          wi_file_create_directory(wi_string_t *, mode_t); 
    7080WI_EXPORT wi_boolean_t                          wi_file_is_alias(wi_string_t *); 
  • libwired/trunk/libwired/system/wi-log.c

    r3845 r4026  
    162162 
    163163        if(wi_log_stdout || wi_log_stderr) 
    164                 fprintf(wi_log_stdout ? stdout : stderr, "%s %s[%d]: %s\n", date, name, getpid(), cstring); 
     164                fprintf(wi_log_stdout ? stdout : stderr, "%s %s[%u]: %s\n", date, name, (uint32_t) getpid(), cstring); 
    165165        else if(wi_log_startup && priority < LOG_INFO) 
    166166                fprintf(stderr, "%s: %s\n", name, cstring); 
     
    177177 
    178178                if(fp) { 
    179                         fprintf(fp, "%s %s[%d]: %s\n", date, name, getpid(), cstring); 
     179                        fprintf(fp, "%s %s[%u]: %s\n", date, name, (uint32_t) getpid(), cstring); 
    180180                        fclose(fp); 
    181181                         
  • libwired/trunk/libwired/system/wi-terminal.c

    r4025 r4026  
    3737#include <errno.h> 
    3838 
     39#ifdef HAVE_CURSES_H 
     40#include <curses.h> 
     41#endif 
     42 
    3943#ifdef HAVE_TERM_H 
    4044#include <term.h>