svn commit: r240984 - head/sys/dev/ath/ath_hal/ar5416
Author: adrian Date: Thu Sep 27 06:05:54 2012 New Revision: 240984 URL: http://svn.freebsd.org/changeset/base/240984 Log: Track the last ANI TX/RX sample correctly. This doesn't specifically fix the issue(s) i'm seeing in this 2GHz environment (where setting/increasing spur immunity causes OFDM restart errors to skyrocket through the roof; but leaving it at 0 would leave the environment cleaner..) Pointy-hat-to:me, for committing this broken code in the first place. Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_ani.c Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_ani.c == --- head/sys/dev/ath/ath_hal/ar5416/ar5416_ani.cThu Sep 27 05:39:42 2012(r240983) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_ani.cThu Sep 27 06:05:54 2012(r240984) @@ -874,8 +874,8 @@ ar5416AniGetListenTime(struct ath_hal *a */ if (ANI_ENA(ah)) { aniState-cycleCount = AH5416(ah)-ah_cycleCount; - aniState-txFrameCount = AH5416(ah)-ah_rxBusy; - aniState-rxFrameCount = AH5416(ah)-ah_txBusy; + aniState-rxFrameCount = AH5416(ah)-ah_rxBusy; + aniState-txFrameCount = AH5416(ah)-ah_txBusy; } return listenTime; ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r240985 - head/sys/netinet
Author: glebius Date: Thu Sep 27 07:13:21 2012 New Revision: 240985 URL: http://svn.freebsd.org/changeset/base/240985 Log: Fix bug in TCP_KEEPCNT setting, which slipped in in the last round of reviewing of r231025. Unlike other options from this family TCP_KEEPCNT doesn't specify time interval, but a count, thus parameter supplied doesn't need to be multiplied by hz. Reported tested by: amdmi3 Modified: head/sys/netinet/tcp_usrreq.c Modified: head/sys/netinet/tcp_usrreq.c == --- head/sys/netinet/tcp_usrreq.c Thu Sep 27 06:05:54 2012 (r240984) +++ head/sys/netinet/tcp_usrreq.c Thu Sep 27 07:13:21 2012 (r240985) @@ -1473,7 +1473,6 @@ unlock_and_done: case TCP_KEEPIDLE: case TCP_KEEPINTVL: - case TCP_KEEPCNT: case TCP_KEEPINIT: INP_WUNLOCK(inp); error = sooptcopyin(sopt, ui, sizeof(ui), sizeof(ui)); @@ -1506,13 +1505,6 @@ unlock_and_done: tcp_timer_activate(tp, TT_2MSL, TP_MAXIDLE(tp)); break; - case TCP_KEEPCNT: - tp-t_keepcnt = ui; - if ((tp-t_state == TCPS_FIN_WAIT_2) - (TP_MAXIDLE(tp) 0)) - tcp_timer_activate(tp, TT_2MSL, - TP_MAXIDLE(tp)); - break; case TCP_KEEPINIT: tp-t_keepinit = ui; if (tp-t_state == TCPS_SYN_RECEIVED || @@ -1523,6 +1515,20 @@ unlock_and_done: } goto unlock_and_done; + case TCP_KEEPCNT: + INP_WUNLOCK(inp); + error = sooptcopyin(sopt, ui, sizeof(ui), sizeof(ui)); + if (error) + return (error); + + INP_WLOCK_RECHECK(inp); + tp-t_keepcnt = ui; + if ((tp-t_state == TCPS_FIN_WAIT_2) + (TP_MAXIDLE(tp) 0)) + tcp_timer_activate(tp, TT_2MSL, + TP_MAXIDLE(tp)); + goto unlock_and_done; + default: INP_WUNLOCK(inp); error = ENOPROTOOPT; ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r240990 - head/sys/dev/pci
Author: glebius Date: Thu Sep 27 10:30:11 2012 New Revision: 240990 URL: http://svn.freebsd.org/changeset/base/240990 Log: Fix several build failures for !COMPAT_FREEBSD32 and !COMPAT_FREEBSD* kernels introduced by r240981. Pointy hat to:sobomax Modified: head/sys/dev/pci/pci_user.c Modified: head/sys/dev/pci/pci_user.c == --- head/sys/dev/pci/pci_user.c Thu Sep 27 09:00:22 2012(r240989) +++ head/sys/dev/pci/pci_user.c Thu Sep 27 10:30:11 2012(r240990) @@ -266,7 +266,7 @@ struct pci_conf_io32 { }; #definePCIOCGETCONF_OLD32 _IOWR('p', 1, struct pci_conf_io32) -#endif +#endif /* COMPAT_FREEBSD32 */ #definePCIOCGETCONF_OLD_IOWR('p', 1, struct pci_conf_io) #definePCIOCREAD_OLD _IOWR('p', 2, struct pci_io_old) @@ -338,6 +338,7 @@ pci_conf_match_old(struct pci_match_conf return(1); } +#ifdef COMPAT_FREEBSD32 static int pci_conf_match_old32(struct pci_match_conf_old32 *matches, int num_matches, struct pci_conf *match_buf) @@ -400,8 +401,8 @@ pci_conf_match_old32(struct pci_match_co return(1); } - -#endif +#endif /* COMPAT_FREEBSD32 */ +#endif /* PRE7_COMPAT */ static int pci_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *td) @@ -410,7 +411,7 @@ pci_ioctl(struct cdev *dev, u_long cmd, void *confdata; const char *name; struct devlist *devlist_head; - struct pci_conf_io *cio; + struct pci_conf_io *cio = NULL; struct pci_devinfo *dinfo; struct pci_io *io; struct pci_bar_io *bio; @@ -420,20 +421,16 @@ pci_ioctl(struct cdev *dev, u_long cmd, int error, ionum, i, num_patterns; #ifdef PRE7_COMPAT #ifdef COMPAT_FREEBSD32 - struct pci_conf_io32 *cio32; + struct pci_conf_io32 *cio32 = NULL; + struct pci_conf_old32 conf_old32; + struct pci_match_conf_old32 *pattern_buf_old32; #endif struct pci_conf_old conf_old; - struct pci_conf_old32 conf_old32; struct pci_io iodata; struct pci_io_old *io_old; struct pci_match_conf_old *pattern_buf_old; - struct pci_match_conf_old32 *pattern_buf_old32; - cio = NULL; - cio32 = NULL; io_old = NULL; - pattern_buf_old = NULL; - pattern_buf_old32 = NULL; if (!(flag FWRITE) cmd != PCIOCGETBAR cmd != PCIOCGETCONF cmd != PCIOCGETCONF_OLD) @@ -445,6 +442,7 @@ pci_ioctl(struct cdev *dev, u_long cmd, switch(cmd) { #ifdef PRE7_COMPAT +#ifdef COMPAT_FREEBSD32 case PCIOCGETCONF_OLD32: cio32 = (struct pci_conf_io32 *)data; cio = malloc(sizeof(struct pci_conf_io), M_TEMP, M_WAITOK); @@ -458,14 +456,24 @@ pci_ioctl(struct cdev *dev, u_long cmd, cio-generation = cio32-generation; cio-status = cio32-status; cio32-num_matches = 0; - /* FALLTHROUGH */ + break; +#endif + case PCIOCGETCONF_OLD: +#endif + case PCIOCGETCONF: + cio = (struct pci_conf_io *)data; + } + switch(cmd) { +#ifdef PRE7_COMPAT +#ifdef COMPAT_FREEBSD32 + case PCIOCGETCONF_OLD32: + pattern_buf_old32 = NULL; +#endif case PCIOCGETCONF_OLD: - /* FALLTHROUGH */ + pattern_buf_old = NULL; #endif case PCIOCGETCONF: - if (cio == NULL) - cio = (struct pci_conf_io *)data; pattern_buf = NULL; num_patterns = 0; @@ -566,19 +574,21 @@ pci_ioctl(struct cdev *dev, u_long cmd, * Allocate a buffer to hold the patterns. */ #ifdef PRE7_COMPAT +#ifdef COMPAT_FREEBSD32 if (cmd == PCIOCGETCONF_OLD32) { pattern_buf_old32 = malloc(cio-pat_buf_len, M_TEMP, M_WAITOK); error = copyin(cio-patterns, pattern_buf_old32, cio-pat_buf_len); } else +#endif /* COMPAT_FREEBSD32 */ if (cmd == PCIOCGETCONF_OLD) { pattern_buf_old = malloc(cio-pat_buf_len, M_TEMP, M_WAITOK); error = copyin(cio-patterns, pattern_buf_old, cio-pat_buf_len); } else -#endif +#endif /* PRE7_COMPAT */ { pattern_buf = malloc(cio-pat_buf_len, M_TEMP, M_WAITOK); @@ -629,11 +639,14 @@ pci_ioctl(struct cdev *dev, u_long cmd, } #ifdef PRE7_COMPAT - if ((cmd == PCIOCGETCONF_OLD32 - (pattern_buf_old32 == NULL || -
svn commit: r240992 - head/sys/dev/pci
Author: glebius Date: Thu Sep 27 10:46:22 2012 New Revision: 240992 URL: http://svn.freebsd.org/changeset/base/240992 Log: Fix zillions of style(9) and spacing bugs introduced by r240981. Pointy hat to:sobomax Modified: head/sys/dev/pci/pci_user.c Modified: head/sys/dev/pci/pci_user.c == --- head/sys/dev/pci/pci_user.c Thu Sep 27 10:41:34 2012(r240991) +++ head/sys/dev/pci/pci_user.c Thu Sep 27 10:46:22 2012(r240992) @@ -227,45 +227,47 @@ struct pci_io_old { #ifdef COMPAT_FREEBSD32 struct pci_conf_old32 { - struct pcisel_old pc_sel; /* bus+slot+function */ - u_int8_tpc_hdr; /* PCI header type */ - u_int16_t pc_subvendor; /* card vendor ID */ - u_int16_t pc_subdevice; /* card device ID, assigned by - card vendor */ - u_int16_t pc_vendor; /* chip vendor ID */ - u_int16_t pc_device; /* chip device ID, assigned by - chip vendor */ - u_int8_tpc_class; /* chip PCI class */ - u_int8_tpc_subclass;/* chip PCI subclass */ - u_int8_tpc_progif; /* chip PCI programming interface */ - u_int8_tpc_revid; /* chip revision ID */ - charpd_name[PCI_MAXNAMELEN + 1]; /* device name */ - u_int32_t pd_unit;/* device unit number (u_long) */ + struct pcisel_old pc_sel; /* bus+slot+function */ + uint8_t pc_hdr; /* PCI header type */ + uint16_tpc_subvendor; /* card vendor ID */ + uint16_tpc_subdevice; /* card device ID, assigned by + card vendor */ + uint16_tpc_vendor; /* chip vendor ID */ + uint16_tpc_device; /* chip device ID, assigned by + chip vendor */ + uint8_t pc_class; /* chip PCI class */ + uint8_t pc_subclass;/* chip PCI subclass */ + uint8_t pc_progif; /* chip PCI programming interface */ + uint8_t pc_revid; /* chip revision ID */ + charpd_name[PCI_MAXNAMELEN + 1]; /* device name */ + uint32_tpd_unit;/* device unit number (u_long) */ }; struct pci_match_conf_old32 { - struct pcisel_old pc_sel; /* bus+slot+function */ - charpd_name[PCI_MAXNAMELEN + 1]; /* device name */ - u_int32_t pd_unit;/* Unit number (u_long) */ - u_int16_t pc_vendor; /* PCI Vendor ID */ - u_int16_t pc_device; /* PCI Device ID */ - u_int8_tpc_class; /* PCI class */ - pci_getconf_flags_old flags; /* Matching expression */ + struct pcisel_old pc_sel; /* bus+slot+function */ + charpd_name[PCI_MAXNAMELEN + 1]; /* device name */ + uint32_tpd_unit;/* Unit number (u_long) */ + uint16_tpc_vendor; /* PCI Vendor ID */ + uint16_tpc_device; /* PCI Device ID */ + uint8_t pc_class; /* PCI class */ + pci_getconf_flags_old flags;/* Matching expression */ }; struct pci_conf_io32 { - u_int32_t pat_buf_len;/* pattern buffer length */ - u_int32_t num_patterns; /* number of patterns */ - u_int32_t patterns; /* pattern buffer (struct pci_match_conf_old32 *) */ - u_int32_t match_buf_len; /* match buffer length */ - u_int32_t num_matches;/* number of matches returned */ - u_int32_t matches;/* match buffer (struct pci_conf_old32 *) */ - u_int32_t offset; /* offset into device list */ - u_int32_t generation; /* device list generation */ - pci_getconf_status status; /* request status */ + uint32_tpat_buf_len;/* pattern buffer length */ + uint32_tnum_patterns; /* number of patterns */ + uint32_tpatterns; /* pattern buffer + (struct pci_match_conf_old32 *) */ + uint32_tmatch_buf_len; /* match buffer length */ + uint32_tnum_matches;/* number of matches returned */ + uint32_tmatches;/* match buffer + (struct pci_conf_old32 *) */ + uint32_toffset; /* offset into device list */ + uint32_tgeneration; /* device list generation */ + pci_getconf_status status; /* request status */ }; -#definePCIOCGETCONF_OLD32 _IOWR('p', 1, struct
svn commit: r240993 - head/sys/cam/ctl
Author: trasz Date: Thu Sep 27 10:51:38 2012 New Revision: 240993 URL: http://svn.freebsd.org/changeset/base/240993 Log: Remove useless NULL checks after M_WAITOK allocations. Modified: head/sys/cam/ctl/ctl.c head/sys/cam/ctl/ctl_backend_block.c head/sys/cam/ctl/ctl_backend_ramdisk.c head/sys/cam/ctl/scsi_ctl.c Modified: head/sys/cam/ctl/ctl.c == --- head/sys/cam/ctl/ctl.c Thu Sep 27 10:46:22 2012(r240992) +++ head/sys/cam/ctl/ctl.c Thu Sep 27 10:51:38 2012(r240993) @@ -1520,12 +1520,6 @@ ctl_ioctl_do_datamove(struct ctl_scsiio ext_sglist = (struct ctl_sg_entry *)malloc(ext_sglen, M_CTL, M_WAITOK); - if (ext_sglist == NULL) { - ctl_set_internal_failure(ctsio, -/*sks_valid*/ 0, -/*retry_count*/ 0); - return (CTL_RETVAL_COMPLETE); - } ext_sglist_malloced = 1; if (copyin(ctsio-ext_data_ptr, ext_sglist, ext_sglen) != 0) { @@ -2028,11 +2022,6 @@ ctl_copyin_alloc(void *user_addr, int le void *kptr; kptr = malloc(len, M_CTL, M_WAITOK | M_ZERO); - if (kptr == NULL) { - snprintf(error_str, error_str_len, Cannot allocate %d bytes, -len); - return (NULL); - } if (copyin(user_addr, kptr, len) != 0) { snprintf(error_str, error_str_len, Error copying %d bytes @@ -2764,12 +2753,6 @@ ctl_ioctl(struct cdev *dev, u_long cmd, new_err_desc = malloc(sizeof(*new_err_desc), M_CTL, M_WAITOK | M_ZERO); - if (new_err_desc == NULL) { - printf(%s: CTL_ERROR_INJECT: error allocating %zu - bytes\n, __func__, sizeof(*new_err_desc)); - retval = ENOMEM; - break; - } bcopy(err_desc, new_err_desc, sizeof(*new_err_desc)); mtx_lock(softc-ctl_lock); @@ -4203,11 +4186,6 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft } if (ctl_lun == NULL) { lun = malloc(sizeof(*lun), M_CTL, M_WAITOK); - if (lun == NULL) { - be_lun-lun_config_status(lun-be_lun-be_lun, - CTL_LUN_CONFIG_FAILURE); - return (-ENOMEM); - } lun-flags = CTL_LUN_MALLOCED; } else lun = ctl_lun; @@ -5061,12 +5039,6 @@ ctl_scsi_release(struct ctl_scsiio *ctsi if (((ctsio-io_hdr.flags CTL_FLAG_ALLOCATED) == 0) (length 0)) { ctsio-kern_data_ptr = malloc(length, M_CTL, M_WAITOK); - if (ctsio-kern_data_ptr == NULL) { - ctsio-io_hdr.status = CTL_SCSI_ERROR; - ctsio-io_hdr.status = SCSI_STATUS_BUSY; - ctl_done((union ctl_io *)ctsio); - return (CTL_RETVAL_COMPLETE); - } ctsio-kern_data_len = length; ctsio-kern_total_len = length; ctsio-kern_data_resid = 0; @@ -5202,12 +5174,6 @@ ctl_scsi_reserve(struct ctl_scsiio *ctsi if (((ctsio-io_hdr.flags CTL_FLAG_ALLOCATED) == 0) (length 0)) { ctsio-kern_data_ptr = malloc(length, M_CTL, M_WAITOK); - if (ctsio-kern_data_ptr == NULL) { - ctsio-io_hdr.status = CTL_SCSI_ERROR; - ctsio-io_hdr.status = SCSI_STATUS_BUSY; - ctl_done((union ctl_io *)ctsio); - return (CTL_RETVAL_COMPLETE); - } ctsio-kern_data_len = length; ctsio-kern_total_len = length; ctsio-kern_data_resid = 0; @@ -5573,12 +5539,6 @@ ctl_format(struct ctl_scsiio *ctsio) if (((ctsio-io_hdr.flags CTL_FLAG_ALLOCATED) == 0) (length 0)) { ctsio-kern_data_ptr = malloc(length, M_CTL, M_WAITOK); - if (ctsio-kern_data_ptr == NULL) { - ctsio-io_hdr.status = CTL_SCSI_ERROR; - ctsio-io_hdr.status = SCSI_STATUS_BUSY; - ctl_done((union ctl_io *)ctsio); - return (CTL_RETVAL_COMPLETE); - } ctsio-kern_data_len = length; ctsio-kern_total_len = length; ctsio-kern_data_resid = 0; @@ -6368,11 +6328,6 @@ ctl_mode_select(struct ctl_scsiio *ctsio */ if ((ctsio-io_hdr.flags CTL_FLAG_ALLOCATED) == 0) { ctsio-kern_data_ptr = malloc(param_len, M_CTL, M_WAITOK); - if
Re: svn commit: r240993 - head/sys/cam/ctl
On Thu, Sep 27, 2012 at 10:51:38AM +, Edward Tomasz Napierala wrote: New Revision: 240993 URL: http://svn.freebsd.org/changeset/base/240993 Log: Remove useless NULL checks after M_WAITOK allocations. @@ -1520,12 +1520,6 @@ ctl_ioctl_do_datamove(struct ctl_scsiio ext_sglist = (struct ctl_sg_entry *)malloc(ext_sglen, M_CTL, M_WAITOK); You could have also removed bogus casting of void * returned by malloc(). Perhaps it makes sense to clean up more than just this file thought. ./danfe ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r240997 - head/sys/kern
Author: trociny Date: Thu Sep 27 14:55:15 2012 New Revision: 240997 URL: http://svn.freebsd.org/changeset/base/240997 Log: Kernel and modules have set_vnet linker set, where virtualized global variables are placed. When a module is loaded by link_elf linker its variables from set_vnet linker set are copied to the kernel set_vnet (modspace) and all references to these variables inside the module are relocated accordingly. The issue is when a module is loaded that has references to global variables from another, previously loaded module: these references are not relocated so an invalid address is used when the module tries to access the variable. The example is V_layer3_chain, defined in ipfw module and accessed from ipfw_nat. The same issue is with DPCPU variables, which use set_pcpu linker set. Fix this making the link_elf linker on a module load recognize external DPCPU/VNET variables defined in the previously loaded modules and relocate them accordingly. For this set_pcpu_list and set_vnet_list are used, where the addresses of modules' set_pcpu and set_vnet linker sets are stored. Note, archs that use link_elf_obj (amd64) were not affected by this issue. Reviewed by: jhb, julian, zec (initial version) MFC after:1 month Modified: head/sys/kern/link_elf.c Modified: head/sys/kern/link_elf.c == --- head/sys/kern/link_elf.cThu Sep 27 14:29:18 2012(r240996) +++ head/sys/kern/link_elf.cThu Sep 27 14:55:15 2012(r240997) @@ -123,6 +123,15 @@ typedef struct elf_file { #endif } *elf_file_t; +struct elf_set { + Elf_Addres_start; + Elf_Addres_stop; + Elf_Addres_base; + TAILQ_ENTRY(elf_set)es_link; +}; + +TAILQ_HEAD(elf_set_head, elf_set); + #include kern/kern_ctf.c static int link_elf_link_common_finish(linker_file_t); @@ -181,6 +190,75 @@ static int parse_dynamic(elf_file_t); static int relocate_file(elf_file_t); static int link_elf_preload_parse_symbols(elf_file_t); +static struct elf_set_head set_pcpu_list; +#ifdef VIMAGE +static struct elf_set_head set_vnet_list; +#endif + +static void +elf_set_add(struct elf_set_head *list, Elf_Addr start, Elf_Addr stop, Elf_Addr base) +{ + struct elf_set *set, *iter; + + set = malloc(sizeof(*set), M_LINKER, M_WAITOK); + set-es_start = start; + set-es_stop = stop; + set-es_base = base; + + TAILQ_FOREACH(iter, list, es_link) { + + KASSERT((set-es_start iter-es_start set-es_stop iter-es_stop) || + (set-es_start iter-es_start set-es_stop iter-es_stop), + (linker sets intersection: to insert: 0x%jx-0x%jx; inserted: 0x%jx-0x%jx, + (uintmax_t)set-es_start, (uintmax_t)set-es_stop, + (uintmax_t)iter-es_start, (uintmax_t)iter-es_stop)); + + if (iter-es_start set-es_start) { + TAILQ_INSERT_BEFORE(iter, set, es_link); + break; + } + } + + if (iter == NULL) + TAILQ_INSERT_TAIL(list, set, es_link); +} + +static int +elf_set_find(struct elf_set_head *list, Elf_Addr addr, Elf_Addr *start, Elf_Addr *base) +{ + struct elf_set *set; + + TAILQ_FOREACH(set, list, es_link) { + if (addr set-es_start) + return (0); + if (addr set-es_stop) { + *start = set-es_start; + *base = set-es_base; + return (1); + } + } + + return (0); +} + +static void +elf_set_delete(struct elf_set_head *list, Elf_Addr start) +{ + struct elf_set *set; + + TAILQ_FOREACH(set, list, es_link) { + if (start set-es_start) + break; + if (start == set-es_start) { + TAILQ_REMOVE(list, set, es_link); + free(set, M_LINKER); + return; + } + } + KASSERT(0, (deleting unknown linker set (start = 0x%jx), + (uintmax_t)start)); +} + #ifdef GDB static voidr_debug_state(struct r_debug *, struct link_map *); @@ -345,6 +423,10 @@ link_elf_init(void* arg) (void)link_elf_link_common_finish(linker_kernel_file); linker_kernel_file-flags |= LINKER_FILE_LINKED; + TAILQ_INIT(set_pcpu_list); +#ifdef VIMAGE + TAILQ_INIT(set_vnet_list); +#endif } SYSINIT(link_elf, SI_SUB_KLD, SI_ORDER_THIRD, link_elf_init, 0); @@ -515,6 +597,8 @@ parse_dpcpu(elf_file_t ef) return (ENOSPC); memcpy((void *)ef-pcpu_base, (void *)ef-pcpu_start, count); dpcpu_copy((void *)ef-pcpu_base, count); + elf_set_add(set_pcpu_list, ef-pcpu_start, ef-pcpu_stop, + ef-pcpu_base); return (0); } @@ -544,6 +628,8
svn commit: r240998 - head/sys/dev/usb/controller
Author: hselasky Date: Thu Sep 27 15:23:38 2012 New Revision: 240998 URL: http://svn.freebsd.org/changeset/base/240998 Log: Make sure we record NAK tokens in the TD structure for IN direction. Improve host channel disabling. Wait two times 125us for channel to be disabled. The DWC OTG doesn't like when channels are re-used too early. Modified: head/sys/dev/usb/controller/dwc_otg.c head/sys/dev/usb/controller/dwc_otg.h head/sys/dev/usb/controller/dwc_otgreg.h Modified: head/sys/dev/usb/controller/dwc_otg.c == --- head/sys/dev/usb/controller/dwc_otg.c Thu Sep 27 14:55:15 2012 (r240997) +++ head/sys/dev/usb/controller/dwc_otg.c Thu Sep 27 15:23:38 2012 (r240998) @@ -507,7 +507,6 @@ static uint8_t dwc_otg_host_channel_wait(struct dwc_otg_td *td) { struct dwc_otg_softc *sc; - uint16_t frame; uint8_t x; x = td-channel; @@ -517,32 +516,20 @@ dwc_otg_host_channel_wait(struct dwc_otg /* get pointer to softc */ sc = DWC_OTG_PC2SC(td-pc); - if (sc-sc_chan_state[x].hcint HCINT_HALTED_ONLY) { + if (sc-sc_chan_state[x].wait_sof == 0) { dwc_otg_clear_hcint(sc, x); - return (1); + return (1); /* done */ } if (x == 0) return (0); /* wait */ - frame = DWC_OTG_READ_4(sc, DOTG_HFNUM) HFNUM_FRNUM_MASK; - /* find new disabled channel */ for (x = 1; x != sc-sc_host_ch_max; x++) { - uint32_t hcchar; - if (sc-sc_chan_state[x].allocated) continue; - - /* check if channel is enabled */ - hcchar = DWC_OTG_READ_4(sc, DOTG_HCCHAR(x)); - if (hcchar (HCCHAR_CHENA | HCCHAR_CHDIS)) { - DPRINTF(CH=%d is BUSY\n, x); - continue; - } - - if (sc-sc_chan_state[x].last_frame == frame) + if (sc-sc_chan_state[x].wait_sof != 0) continue; sc-sc_chan_state[td-channel].allocated = 0; @@ -556,9 +543,8 @@ dwc_otg_host_channel_wait(struct dwc_otg /* clear interrupts */ dwc_otg_clear_hcint(sc, x); - DPRINTF(CH=%d HCCHAR=0x%08x(0x%08x) - HCSPLT=0x%08x\n, x, td-hcchar, - hcchar, td-hcsplt); + DPRINTF(CH=%d HCCHAR=0x%08x + HCSPLT=0x%08x\n, x, td-hcchar, td-hcsplt); /* ack any pending messages */ if (sc-sc_last_rx_status != 0 @@ -583,7 +569,6 @@ static uint8_t dwc_otg_host_channel_alloc(struct dwc_otg_td *td) { struct dwc_otg_softc *sc; - uint16_t frame; uint8_t x; uint8_t max_channel; @@ -601,23 +586,11 @@ dwc_otg_host_channel_alloc(struct dwc_ot x = 1; } - frame = DWC_OTG_READ_4(sc, DOTG_HFNUM) HFNUM_FRNUM_MASK; - for (; x != max_channel; x++) { - uint32_t hcchar; - if (sc-sc_chan_state[x].allocated) continue; - - /* check if channel is enabled */ - hcchar = DWC_OTG_READ_4(sc, DOTG_HCCHAR(x)); - if (hcchar (HCCHAR_CHENA | HCCHAR_CHDIS)) { - DPRINTF(CH=%d is BUSY\n, x); - continue; - } - - if (sc-sc_chan_state[x].last_frame == frame) + if (sc-sc_chan_state[x].wait_sof != 0) continue; sc-sc_chan_state[x].allocated = 1; @@ -625,9 +598,8 @@ dwc_otg_host_channel_alloc(struct dwc_ot /* clear interrupts */ dwc_otg_clear_hcint(sc, x); - DPRINTF(CH=%d HCCHAR=0x%08x(0x%08x) - HCSPLT=0x%08x\n, x, td-hcchar, - hcchar, td-hcsplt); + DPRINTF(CH=%d HCCHAR=0x%08x + HCSPLT=0x%08x\n, x, td-hcchar, td-hcsplt); /* set active channel */ sc-sc_active_rx_ep |= (1 x); @@ -644,12 +616,18 @@ static void dwc_otg_host_channel_disable(struct dwc_otg_softc *sc, uint8_t x) { uint32_t hcchar; + if (sc-sc_chan_state[x].wait_sof != 0) + return; hcchar = DWC_OTG_READ_4(sc, DOTG_HCCHAR(x)); if (hcchar (HCCHAR_CHENA | HCCHAR_CHDIS)) { + /* disable channel */ + DWC_OTG_WRITE_4(sc, DOTG_HCCHAR(x), + HCCHAR_CHENA | HCCHAR_CHDIS); /* don't re-use channel until next SOF is transmitted */ - sc-sc_chan_state[x].last_frame = - DWC_OTG_READ_4(sc, DOTG_HFNUM) HFNUM_FRNUM_MASK; - DWC_OTG_WRITE_4(sc, DOTG_HCCHAR(x), HCCHAR_CHENA | HCCHAR_CHDIS); + sc-sc_chan_state[x].wait_sof = 2; + /* enable SOF interrupt
svn commit: r240999 - head/sys/dev/usb/controller
Author: hselasky Date: Thu Sep 27 15:45:24 2012 New Revision: 240999 URL: http://svn.freebsd.org/changeset/base/240999 Log: Make sure the wMaxPacketSize limitations are respected. Modified: head/sys/dev/usb/controller/dwc_otg.c Modified: head/sys/dev/usb/controller/dwc_otg.c == --- head/sys/dev/usb/controller/dwc_otg.c Thu Sep 27 15:23:38 2012 (r240998) +++ head/sys/dev/usb/controller/dwc_otg.c Thu Sep 27 15:45:24 2012 (r240999) @@ -3974,9 +3974,34 @@ dwc_otg_ep_init(struct usb_device *udev, return; } } else { - if (udev-speed != USB_SPEED_LOW - udev-speed != USB_SPEED_FULL - udev-speed != USB_SPEED_HIGH) { + uint16_t mps; + + mps = UGETW(edesc-wMaxPacketSize); + + /* Apply limitations of our USB host driver */ + + switch (udev-speed) { + case USB_SPEED_HIGH: + if (mps 512) { + DPRINTF(wMaxPacketSize=0x%04x + is not supported\n, (int)mps); + /* not supported */ + return; + } + break; + + case USB_SPEED_FULL: + case USB_SPEED_LOW: + if (mps 188) { + DPRINTF(wMaxPacketSize=0x%04x + is not supported\n, (int)mps); + /* not supported */ + return; + } + break; + + default: + DPRINTF(Invalid device speed\n); /* not supported */ return; } ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r240993 - head/sys/cam/ctl
.. I thought that malloc(.. , M_WAITOK) can return NULL. Wasn't there a discussion about this on IRC? Adrian ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r240993 - head/sys/cam/ctl
On Thu, Sep 27, 2012 at 8:50 AM, Adrian Chadd adr...@freebsd.org wrote: .. I thought that malloc(.. , M_WAITOK) can return NULL. Wasn't there a discussion about this on IRC? Shouldn't -- else it would break the API contract: M_WAITOK Indicates that it is OK to wait for resources. If the request cannot be immediately fulfilled, the current process is put to sleep to wait for resources to be released by other processes. The malloc(), realloc(), and reallocf() functions cannot return NULL if M_WAITOK is specified. There was some discussion a little while ago IIRC about there being a bug where it could return NULL, but that bug should really be quashed, not disguised. Thanks, -Garrett ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r241000 - head/sys/kern
Author: pjd Date: Thu Sep 27 16:43:23 2012 New Revision: 241000 URL: http://svn.freebsd.org/changeset/base/241000 Log: Revert r240931, as the previous comment was actually in sync with POSIX. I have to note that POSIX is simply stupid in how it describes O_EXEC/fexecve and friends. Yes, not only inconsistent, but stupid. In the open(2) description, O_RDONLY flag is described as: O_RDONLYOpen for reading only. Taken from: http://pubs.opengroup.org/onlinepubs/9699919799/functions/open.html Note for reading only. Not for reading or executing! In the fexecve(2) description you can find: The fexecve() function shall fail if: [EBADF] The fd argument is not a valid file descriptor open for executing. Taken from: http://pubs.opengroup.org/onlinepubs/9699919799/functions/exec.html As you can see the function shall fail if the file was not open with O_EXEC! And yet, if you look closer you can find this mess in the exec.html: Since execute permission is checked by fexecve(), the file description fd need not have been opened with the O_EXEC flag. Yes, O_EXEC flag doesn't have to be specified after all. You can open a file with O_RDONLY and you still be able to fexecve(2) it. Modified: head/sys/kern/kern_exec.c Modified: head/sys/kern/kern_exec.c == --- head/sys/kern/kern_exec.c Thu Sep 27 15:45:24 2012(r240999) +++ head/sys/kern/kern_exec.c Thu Sep 27 16:43:23 2012(r241000) @@ -441,10 +441,10 @@ interpret: } else { AUDIT_ARG_FD(args-fd); /* -* Some might argue that CAP_MMAP should also be required here; -* such arguments will be entertained. +* Some might argue that CAP_READ and/or CAP_MMAP should also +* be required here; such arguments will be entertained. * -* Descriptors opened only with O_EXEC are allowed. +* Descriptors opened only with O_EXEC or O_RDONLY are allowed. */ error = fgetvp_exec(td, args-fd, CAP_FEXECVE, binvp); if (error) ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r241001 - head/lib/libc/sys
Author: jilles Date: Thu Sep 27 17:48:04 2012 New Revision: 241001 URL: http://svn.freebsd.org/changeset/base/241001 Log: sigaction(2),sigwait(2),sigwaitinfo(2): Remove [EFAULT] error condition. Passing an invalid pointer results in undefined behaviour. The wrappers in libthr access some of the data pointed to by the arguments in userland, so that an invalid pointer will cause a signal and not an [EFAULT] error return. Furthermore, if the [EFAULT] error occurs when the kernel is writing, it is not a proper error in the sense that the call still commits (changing the signal disposition or accepting the signal). MFC after:1 week Modified: head/lib/libc/sys/sigaction.2 head/lib/libc/sys/sigwait.2 head/lib/libc/sys/sigwaitinfo.2 Modified: head/lib/libc/sys/sigaction.2 == --- head/lib/libc/sys/sigaction.2 Thu Sep 27 16:43:23 2012 (r241000) +++ head/lib/libc/sys/sigaction.2 Thu Sep 27 17:48:04 2012 (r241001) @@ -28,7 +28,7 @@ .\From: @(#)sigaction.2 8.2 (Berkeley) 4/3/94 .\ $FreeBSD$ .\ -.Dd April 18, 2010 +.Dd September 27, 2012 .Dt SIGACTION 2 .Os .Sh NAME @@ -586,13 +586,6 @@ system call will fail and no new signal handler will be installed if one of the following occurs: .Bl -tag -width Er -.It Bq Er EFAULT -Either -.Fa act -or -.Fa oact -points to memory that is not a valid part of the process -address space. .It Bq Er EINVAL The .Fa sig Modified: head/lib/libc/sys/sigwait.2 == --- head/lib/libc/sys/sigwait.2 Thu Sep 27 16:43:23 2012(r241000) +++ head/lib/libc/sys/sigwait.2 Thu Sep 27 17:48:04 2012(r241001) @@ -27,7 +27,7 @@ .\ .\ $FreeBSD$ .\ -.Dd August 24, 2011 +.Dd September 27, 2012 .Dt SIGWAIT 2 .Os .Sh NAME @@ -107,9 +107,6 @@ The .Fa set argument specifies one or more invalid signal numbers. -.It Bq Er EFAULT -Any arguments point outside the allocated address space or there is a -memory protection fault. .El .Sh SEE ALSO .Xr sigaction 2 , Modified: head/lib/libc/sys/sigwaitinfo.2 == --- head/lib/libc/sys/sigwaitinfo.2 Thu Sep 27 16:43:23 2012 (r241000) +++ head/lib/libc/sys/sigwaitinfo.2 Thu Sep 27 17:48:04 2012 (r241001) @@ -27,7 +27,7 @@ .\ .\ $FreeBSD$ .\ -.Dd August 24, 2011 +.Dd September 27, 2012 .Dt SIGTIMEDWAIT 2 .Os .Sh NAME @@ -172,9 +172,6 @@ system calls fail if: .Bl -tag -width Er .It Bq Er EINTR The wait was interrupted by an unblocked, caught signal. -.It Bq Er EFAULT -Any arguments point outside the allocated address space or there is a -memory protection fault. .Pp .El The ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r241002 - head/sys/contrib/ipfilter/netinet
Author: fjoe Date: Thu Sep 27 18:15:01 2012 New Revision: 241002 URL: http://svn.freebsd.org/changeset/base/241002 Log: Fix pseudo checksum calculation. This fixes ipfilter w/ network controllers that implement only partial rx csum offloading. PR: 106438 Obtained from:upstream MFC after:1 week Modified: head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Modified: head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c == --- head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Thu Sep 27 17:48:04 2012(r241001) +++ head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Thu Sep 27 18:15:01 2012(r241002) @@ -1357,7 +1357,9 @@ fr_info_t *fin; else sum = in_pseudo(ip-ip_src.s_addr, ip-ip_dst.s_addr, htonl(m-m_pkthdr.csum_data + - fin-fin_ip-ip_len + fin-fin_p)); + fin-fin_ip-ip_len - + (fin-fin_ip-ip_hl 2) + + fin-fin_p)); sum ^= 0x; if (sum != 0) { fin-fin_flx |= FI_BAD; ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r240822 - head/sys/geom
On Wed, Sep 26, 2012 at 09:45:41PM +0200, Pawel Jakub Dawidek wrote: On Wed, Sep 26, 2012 at 01:21:17PM -0600, Kenneth D. Merry wrote: Ahh. How about using LIST_FOREACH_SAFE? Would that address the problem at hand? Are there any other races in there? It depends. If one geom can hold more than one provider then it might be racy, but from what I see there is always only one provider - there has to be only one, because disk_destroy() destroys it and struct disk represents always only one disk. If that's true then I see not reason to have a loop in there. I'd change it to: void disk_gone(struct disk *dp) { struct g_geom *gp; struct g_provider *pp; gp = dp-d_geom; if (gp != NULL) { pp = LIST_FIRST(gp-provider); if (pp != NULL) g_wither_provider(pp, ENXIO); } } Final patch for review: http://people.freebsd.org/~pjd/patches/geom_disk.c.3.patch -- Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://tupytaj.pl pgp0yshNtQpPa.pgp Description: PGP signature
Re: svn commit: r240822 - head/sys/geom
On Thu, Sep 27, 2012 at 20:16:25 +0200, Pawel Jakub Dawidek wrote: On Wed, Sep 26, 2012 at 09:45:41PM +0200, Pawel Jakub Dawidek wrote: On Wed, Sep 26, 2012 at 01:21:17PM -0600, Kenneth D. Merry wrote: Ahh. How about using LIST_FOREACH_SAFE? Would that address the problem at hand? Are there any other races in there? It depends. If one geom can hold more than one provider then it might be racy, but from what I see there is always only one provider - there has to be only one, because disk_destroy() destroys it and struct disk represents always only one disk. If that's true then I see not reason to have a loop in there. I'd change it to: void disk_gone(struct disk *dp) { struct g_geom *gp; struct g_provider *pp; gp = dp-d_geom; if (gp != NULL) { pp = LIST_FIRST(gp-provider); if (pp != NULL) g_wither_provider(pp, ENXIO); } } Final patch for review: http://people.freebsd.org/~pjd/patches/geom_disk.c.3.patch Looks good, thanks! Ken -- Kenneth Merry k...@freebsd.org ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r241007 - in head: lib/libc/rpc sys/rpc
Author: pfg Date: Thu Sep 27 19:10:25 2012 New Revision: 241007 URL: http://svn.freebsd.org/changeset/base/241007 Log: Complete revert of r239963: The attempt to merge changes from the linux libtirpc caused rpc.lockd to exit after startup under unclear conditions. After many hours of selective experiments and inconsistent results the conclusion is that it's better to just revert everything and restart in a future time with a much smaller subset of the changes. MFC after:3 days Reported by: David Wolfskill Tested by:David Wolfskill Modified: head/lib/libc/rpc/auth_unix.c head/lib/libc/rpc/authunix_prot.c head/lib/libc/rpc/clnt_perror.c head/lib/libc/rpc/rpc_generic.c head/lib/libc/rpc/rpc_soc.3 head/lib/libc/rpc/rpcb_clnt.c head/lib/libc/rpc/svc_auth_unix.c head/lib/libc/rpc/svc_run.c head/sys/rpc/auth.h head/sys/rpc/rpcb_clnt.c Modified: head/lib/libc/rpc/auth_unix.c == --- head/lib/libc/rpc/auth_unix.c Thu Sep 27 18:53:59 2012 (r241006) +++ head/lib/libc/rpc/auth_unix.c Thu Sep 27 19:10:25 2012 (r241007) @@ -94,10 +94,10 @@ struct audata { AUTH * authunix_create(machname, uid, gid, len, aup_gids) char *machname; - uid_t uid; - gid_t gid; + int uid; + int gid; int len; - gid_t *aup_gids; + int *aup_gids; { struct authunix_parms aup; char mymem[MAX_AUTH_BYTES]; @@ -207,7 +207,9 @@ authunix_create_default() abort(); if (ngids NGRPS) ngids = NGRPS; - auth = authunix_create(machname, uid, gid, ngids, gids); + /* XXX: interface problem; those should all have been unsigned */ + auth = authunix_create(machname, (int)uid, (int)gid, ngids, + (int *)gids); free(gids); return (auth); } Modified: head/lib/libc/rpc/authunix_prot.c == --- head/lib/libc/rpc/authunix_prot.c Thu Sep 27 18:53:59 2012 (r241006) +++ head/lib/libc/rpc/authunix_prot.c Thu Sep 27 19:10:25 2012 (r241007) @@ -60,7 +60,7 @@ xdr_authunix_parms(xdrs, p) XDR *xdrs; struct authunix_parms *p; { - gid_t **paup_gids; + int **paup_gids; assert(xdrs != NULL); assert(p != NULL); @@ -69,8 +69,8 @@ xdr_authunix_parms(xdrs, p) if (xdr_u_long(xdrs, (p-aup_time)) xdr_string(xdrs, (p-aup_machname), MAX_MACHINE_NAME) -xdr_u_int(xdrs, (p-aup_uid)) -xdr_u_int(xdrs, (p-aup_gid)) +xdr_int(xdrs, (p-aup_uid)) +xdr_int(xdrs, (p-aup_gid)) xdr_array(xdrs, (char **) paup_gids, (p-aup_len), NGRPS, sizeof(int), (xdrproc_t)xdr_int) ) { return (TRUE); Modified: head/lib/libc/rpc/clnt_perror.c == --- head/lib/libc/rpc/clnt_perror.c Thu Sep 27 18:53:59 2012 (r241006) +++ head/lib/libc/rpc/clnt_perror.c Thu Sep 27 19:10:25 2012 (r241007) @@ -242,7 +242,7 @@ char * clnt_spcreateerror(s) const char *s; { - char *str, *err; + char *str; size_t len, i; assert(s != NULL); @@ -258,21 +258,8 @@ clnt_spcreateerror(s) switch (rpc_createerr.cf_stat) { case RPC_PMAPFAILURE: (void) strncat(str, - , len - 1); -err = clnt_sperrno(rpc_createerr.cf_error.re_status); - if (err) - (void) strncat(str, err+5, len-5); - switch(rpc_createerr.cf_error.re_status) { - case RPC_CANTSEND: - case RPC_CANTRECV: - i = strlen(str); - len -= i; - snprintf(str+i, len, : errno %d (%s), - rpc_createerr.cf_error.re_errno, - strerror(rpc_createerr.cf_error.re_errno)); - break; - default: - break; - } + (void) strncat(str, + clnt_sperrno(rpc_createerr.cf_error.re_status), len - 4); break; case RPC_SYSTEMERROR: Modified: head/lib/libc/rpc/rpc_generic.c == --- head/lib/libc/rpc/rpc_generic.c Thu Sep 27 18:53:59 2012 (r241006) +++ head/lib/libc/rpc/rpc_generic.c Thu Sep 27 19:10:25 2012 (r241007) @@ -269,8 +269,7 @@ __rpc_getconfip(nettype) } while ((nconf = getnetconfig(confighandle)) != NULL) { if (strcmp(nconf-nc_protofmly, NC_INET) == 0) { - if (strcmp(nconf-nc_proto, NC_TCP) == 0 - netid_tcp == NULL)
svn commit: r241008 - head/include/rpc
Author: pfg Date: Thu Sep 27 20:06:37 2012 New Revision: 241008 URL: http://svn.freebsd.org/changeset/base/241008 Log: Complete revert of r239963: The attempt to merge changes from the linux libtirpc caused rpc.lockd to exit after startup under unclear conditions. After many hours of selective experiments and inconsistent results the conclusion is that it's better to just revert everything and restart in a future time with a much smaller subset of the changes. MFC after:3 days Reported by: David Wolfskill Tested by:David Wolfskill Modified: head/include/rpc/auth.h head/include/rpc/auth_unix.h Modified: head/include/rpc/auth.h == --- head/include/rpc/auth.h Thu Sep 27 19:10:25 2012(r241007) +++ head/include/rpc/auth.h Thu Sep 27 20:06:37 2012(r241008) @@ -243,13 +243,14 @@ __END_DECLS * System style authentication * AUTH *authunix_create(machname, uid, gid, len, aup_gids) * char *machname; - * uid_t uid; - * gid_t gid; + * int uid; + * int gid; * int len; - * gid_t *aup_gids; + * int *aup_gids; */ __BEGIN_DECLS -extern AUTH *authunix_create(char *, uid_t, gid_t, int, gid_t *); +extern AUTH *authunix_create(char *, int, int, int, +int *); extern AUTH *authunix_create_default(void);/* takes no parameters */ extern AUTH *authnone_create(void);/* takes no parameters */ __END_DECLS Modified: head/include/rpc/auth_unix.h == --- head/include/rpc/auth_unix.hThu Sep 27 19:10:25 2012 (r241007) +++ head/include/rpc/auth_unix.hThu Sep 27 20:06:37 2012 (r241008) @@ -60,10 +60,10 @@ struct authunix_parms { u_long aup_time; char*aup_machname; - uid_taup_uid; - gid_taup_gid; + int aup_uid; + int aup_gid; u_intaup_len; - gid_t *aup_gids; + int *aup_gids; }; #define authsys_parms authunix_parms ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r241009 - head/sys/netgraph
Author: rstone Date: Thu Sep 27 20:12:51 2012 New Revision: 241009 URL: http://svn.freebsd.org/changeset/base/241009 Log: Ensure that all cases that enqueue a netgraph item for delivery by a ngthread properly set the item's depth to 1. In particular, prior to this change if ng_snd_item failed to acquire a lock on a node, the item's depth would not be set at all. This fix ensures that the error code from rcvmsg/ rcvdata is properly passed back to the apply callback. For example, this fixes a bug where an error from rcvmsg/rcvdata would not previously propagate back to a libnetgraph consumer when the message was queued. Reviewed by: mav MFC after:1 month Sponsored by: Sandvine Incorporated Modified: head/sys/netgraph/ng_base.c Modified: head/sys/netgraph/ng_base.c == --- head/sys/netgraph/ng_base.c Thu Sep 27 20:06:37 2012(r241008) +++ head/sys/netgraph/ng_base.c Thu Sep 27 20:12:51 2012(r241009) @@ -2008,6 +2008,7 @@ ng_queue_rw(node_p node, item_p item, i NGI_SET_WRITER(item); else NGI_SET_READER(item); + item-depth = 1; NG_QUEUE_LOCK(ngq); /* Set OP_PENDING flag and enqueue the item. */ @@ -2286,7 +2287,6 @@ ng_snd_item(item_p item, int flags) } if (queue) { - item-depth = 1; /* Put it on the queue for that node*/ ng_queue_rw(node, item, rw); return ((flags NG_PROGRESS) ? EINPROGRESS : 0); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r241010 - head/lib/libc/gen
Author: jilles Date: Thu Sep 27 22:05:54 2012 New Revision: 241010 URL: http://svn.freebsd.org/changeset/base/241010 Log: libc/fts: Use O_CLOEXEC for internal file descriptors. Because fts keeps internal file descriptors open across calls, making such descriptors close-on-exec helps not only multi-threaded applications but also single-threaded applications. In particular, this prevents passing a temporary file descriptor for saving the current directory to processes created via find -exec. Modified: head/lib/libc/gen/fts-compat.c head/lib/libc/gen/fts.c Modified: head/lib/libc/gen/fts-compat.c == --- head/lib/libc/gen/fts-compat.c Thu Sep 27 20:12:51 2012 (r241009) +++ head/lib/libc/gen/fts-compat.c Thu Sep 27 22:05:54 2012 (r241010) @@ -220,7 +220,8 @@ __fts_open_44bsd(argv, options, compar) * and .. are all fairly nasty problems. Note, if we can't get the * descriptor we run anyway, just more slowly. */ - if (!ISSET(FTS_NOCHDIR) (sp-fts_rfd = _open(., O_RDONLY, 0)) 0) + if (!ISSET(FTS_NOCHDIR) + (sp-fts_rfd = _open(., O_RDONLY | O_CLOEXEC, 0)) 0) SET(FTS_NOCHDIR); return (sp); @@ -349,7 +350,8 @@ __fts_read_44bsd(sp) (p-fts_info == FTS_SL || p-fts_info == FTS_SLNONE)) { p-fts_info = fts_stat(sp, p, 1); if (p-fts_info == FTS_D !ISSET(FTS_NOCHDIR)) { - if ((p-fts_symfd = _open(., O_RDONLY, 0)) 0) { + if ((p-fts_symfd = _open(., O_RDONLY | O_CLOEXEC, + 0)) 0) { p-fts_errno = errno; p-fts_info = FTS_ERR; } else @@ -440,7 +442,7 @@ next: tmp = p; p-fts_info = fts_stat(sp, p, 1); if (p-fts_info == FTS_D !ISSET(FTS_NOCHDIR)) { if ((p-fts_symfd = - _open(., O_RDONLY, 0)) 0) { + _open(., O_RDONLY | O_CLOEXEC, 0)) 0) { p-fts_errno = errno; p-fts_info = FTS_ERR; } else @@ -581,7 +583,7 @@ __fts_children_44bsd(sp, instr) ISSET(FTS_NOCHDIR)) return (sp-fts_child = fts_build(sp, instr)); - if ((fd = _open(., O_RDONLY, 0)) 0) + if ((fd = _open(., O_RDONLY | O_CLOEXEC, 0)) 0) return (NULL); sp-fts_child = fts_build(sp, instr); if (fchdir(fd)) @@ -1180,7 +1182,7 @@ fts_safe_changedir(sp, p, fd, path) newfd = fd; if (ISSET(FTS_NOCHDIR)) return (0); - if (fd 0 (newfd = _open(path, O_RDONLY, 0)) 0) + if (fd 0 (newfd = _open(path, O_RDONLY | O_CLOEXEC, 0)) 0) return (-1); if (_fstat(newfd, sb)) { ret = -1; Modified: head/lib/libc/gen/fts.c == --- head/lib/libc/gen/fts.c Thu Sep 27 20:12:51 2012(r241009) +++ head/lib/libc/gen/fts.c Thu Sep 27 22:05:54 2012(r241010) @@ -214,7 +214,8 @@ fts_open(argv, options, compar) * and .. are all fairly nasty problems. Note, if we can't get the * descriptor we run anyway, just more slowly. */ - if (!ISSET(FTS_NOCHDIR) (sp-fts_rfd = _open(., O_RDONLY, 0)) 0) + if (!ISSET(FTS_NOCHDIR) + (sp-fts_rfd = _open(., O_RDONLY | O_CLOEXEC, 0)) 0) SET(FTS_NOCHDIR); return (sp); @@ -339,7 +340,8 @@ fts_read(FTS *sp) (p-fts_info == FTS_SL || p-fts_info == FTS_SLNONE)) { p-fts_info = fts_stat(sp, p, 1); if (p-fts_info == FTS_D !ISSET(FTS_NOCHDIR)) { - if ((p-fts_symfd = _open(., O_RDONLY, 0)) 0) { + if ((p-fts_symfd = _open(., O_RDONLY | O_CLOEXEC, + 0)) 0) { p-fts_errno = errno; p-fts_info = FTS_ERR; } else @@ -430,7 +432,7 @@ next: tmp = p; p-fts_info = fts_stat(sp, p, 1); if (p-fts_info == FTS_D !ISSET(FTS_NOCHDIR)) { if ((p-fts_symfd = - _open(., O_RDONLY, 0)) 0) { + _open(., O_RDONLY | O_CLOEXEC, 0)) 0) { p-fts_errno = errno; p-fts_info = FTS_ERR; } else @@ -566,7 +568,7 @@ fts_children(FTS *sp, int instr) ISSET(FTS_NOCHDIR)) return (sp-fts_child = fts_build(sp, instr)); - if ((fd =
svn commit: r241011 - in head/sys: fs/ext2fs fs/hpfs fs/ntfs fs/tmpfs kern ufs/ffs ufs/ufs
Author: mdf Date: Thu Sep 27 23:30:49 2012 New Revision: 241011 URL: http://svn.freebsd.org/changeset/base/241011 Log: Fix up kernel sources to be ready for a 64-bit ino_t. Original code by: Gleb Kurtsou Modified: head/sys/fs/ext2fs/ext2_alloc.c head/sys/fs/ext2fs/ext2_inode_cnv.c head/sys/fs/hpfs/hpfs_vfsops.c head/sys/fs/ntfs/ntfs_subr.c head/sys/fs/ntfs/ntfs_vfsops.c head/sys/fs/ntfs/ntfs_vnops.c head/sys/fs/tmpfs/tmpfs_vfsops.c head/sys/kern/uipc_usrreq.c head/sys/ufs/ffs/ffs_alloc.c head/sys/ufs/ffs/ffs_snapshot.c head/sys/ufs/ffs/ffs_softdep.c head/sys/ufs/ufs/inode.h head/sys/ufs/ufs/ufs_acl.c head/sys/ufs/ufs/ufs_lookup.c head/sys/ufs/ufs/ufs_vnops.c Modified: head/sys/fs/ext2fs/ext2_alloc.c == --- head/sys/fs/ext2fs/ext2_alloc.c Thu Sep 27 22:05:54 2012 (r241010) +++ head/sys/fs/ext2fs/ext2_alloc.c Thu Sep 27 23:30:49 2012 (r241011) @@ -1026,8 +1026,8 @@ ext2_vfree(pvp, ino, mode) fs = pip-i_e2fs; ump = pip-i_ump; if ((u_int)ino fs-e2fs_ipg * fs-e2fs_gcount) - panic(ext2_vfree: range: devvp = %p, ino = %d, fs = %s, - pip-i_devvp, ino, fs-e2fs_fsmnt); + panic(ext2_vfree: range: devvp = %p, ino = %ju, fs = %s, + pip-i_devvp, (uintmax_t)ino, fs-e2fs_fsmnt); cg = ino_to_cg(fs, ino); error = bread(pip-i_devvp, Modified: head/sys/fs/ext2fs/ext2_inode_cnv.c == --- head/sys/fs/ext2fs/ext2_inode_cnv.c Thu Sep 27 22:05:54 2012 (r241010) +++ head/sys/fs/ext2fs/ext2_inode_cnv.c Thu Sep 27 23:30:49 2012 (r241011) @@ -45,7 +45,7 @@ ext2_print_inode( in ) { int i; - printf( Inode: %5d, in-i_number); + printf( Inode: %5ju, (uintmax_t)in-i_number); printf( /* Inode: %5d */ Type: %10s Mode: 0x%o Flags: 0x%x Version: %d\n, n/a, in-i_mode, in-i_flags, in-i_gen); Modified: head/sys/fs/hpfs/hpfs_vfsops.c == --- head/sys/fs/hpfs/hpfs_vfsops.c Thu Sep 27 22:05:54 2012 (r241010) +++ head/sys/fs/hpfs/hpfs_vfsops.c Thu Sep 27 23:30:49 2012 (r241011) @@ -512,7 +512,7 @@ hpfs_vget( error = bread(hpmp-hpm_devvp, ino, FNODESIZE, NOCRED, bp); if (error) { - printf(hpfs_vget: can't read ino %d\n,ino); + printf(hpfs_vget: can't read ino %ju\n, (uintmax_t)ino); vput(vp); return (error); } Modified: head/sys/fs/ntfs/ntfs_subr.c == --- head/sys/fs/ntfs/ntfs_subr.cThu Sep 27 22:05:54 2012 (r241010) +++ head/sys/fs/ntfs/ntfs_subr.cThu Sep 27 23:30:49 2012 (r241011) @@ -84,8 +84,8 @@ int ntfs_ntvattrrele(vap) struct ntvattr * vap; { - dprintf((ntfs_ntvattrrele: ino: %d, type: 0x%x\n, -vap-va_ip-i_number, vap-va_type)); + dprintf((ntfs_ntvattrrele: ino: %ju, type: 0x%x\n, + (uintmax_t)vap-va_ip-i_number, vap-va_type)); ntfs_ntrele(vap-va_ip); @@ -109,12 +109,12 @@ ntfs_findvattr(ntmp, ip, lvapp, vapp, ty struct ntvattr *vap; if((ip-i_flag IN_LOADED) == 0) { - dprintf((ntfs_findvattr: node not loaded, ino: %d\n, - ip-i_number)); + dprintf((ntfs_findvattr: node not loaded, ino: %ju\n, + (uintmax_t)ip-i_number)); error = ntfs_loadntnode(ntmp,ip); if (error) { - printf(ntfs_findvattr: FAILED TO LOAD INO: %d\n, - ip-i_number); + printf(ntfs_findvattr: FAILED TO LOAD INO: %ju\n, + (uintmax_t)ip-i_number); return (error); } } @@ -169,13 +169,13 @@ ntfs_ntvattrget( if (name) { dprintf((ntfs_ntvattrget: \ -ino: %d, type: 0x%x, name: %s, vcn: %d\n, \ -ip-i_number, type, name, (u_int32_t) vcn)); + ino: %ju, type: 0x%x, name: %s, vcn: %d\n, \ + (uintmax_t)ip-i_number, type, name, (uint32_t)vcn)); namelen = strlen(name); } else { dprintf((ntfs_ntvattrget: \ -ino: %d, type: 0x%x, vcn: %d\n, \ -ip-i_number, type, (u_int32_t) vcn)); + ino: %ju, type: 0x%x, vcn: %d\n, \ + (uintmax_t)ip-i_number, type, (uint32_t)vcn)); name = ; namelen = 0; } @@ -186,8 +186,8 @@ ntfs_ntvattrget( if (!lvap) { dprintf((ntfs_ntvattrget: UNEXISTED ATTRIBUTE: \ -
svn commit: r241013 - in head/sbin: dump fsck_ffs fsdb fsirand growfs newfs quotacheck restore tunefs
Author: mdf Date: Thu Sep 27 23:31:06 2012 New Revision: 241013 URL: http://svn.freebsd.org/changeset/base/241013 Log: Fix sbin/ build with a 64-bit ino_t. Original code by: Gleb Kurtsou Modified: head/sbin/dump/traverse.c head/sbin/fsck_ffs/suj.c head/sbin/fsdb/fsdb.c head/sbin/fsdb/fsdbutil.c head/sbin/fsirand/fsirand.c head/sbin/growfs/growfs.c head/sbin/newfs/mkfs.c head/sbin/quotacheck/quotacheck.c head/sbin/restore/dirs.c head/sbin/restore/interactive.c head/sbin/restore/restore.c head/sbin/restore/symtab.c head/sbin/restore/tape.c head/sbin/tunefs/tunefs.c Modified: head/sbin/dump/traverse.c == --- head/sbin/dump/traverse.c Thu Sep 27 23:30:58 2012(r241012) +++ head/sbin/dump/traverse.c Thu Sep 27 23:31:06 2012(r241013) @@ -197,8 +197,8 @@ mapfiles(ino_t maxino, long *tapesize) (mode IFMT) == 0) continue; if (ino = maxino) { - msg(Skipping inode %d = maxino %d\n, - ino, maxino); + msg(Skipping inode %ju = maxino %ju\n, + (uintmax_t)ino, (uintmax_t)maxino); continue; } /* @@ -400,15 +400,16 @@ searchdir( for (loc = 0; loc size; ) { dp = (struct direct *)(dblk + loc); if (dp-d_reclen == 0) { - msg(corrupted directory, inumber %d\n, ino); + msg(corrupted directory, inumber %ju\n, + (uintmax_t)ino); break; } loc += dp-d_reclen; if (dp-d_ino == 0) continue; if (dp-d_ino = maxino) { - msg(corrupted directory entry, d_ino %d = %d\n, - dp-d_ino, maxino); + msg(corrupted directory entry, d_ino %ju = %ju\n, + (uintmax_t)dp-d_ino, (uintmax_t)maxino); break; } if (dp-d_name[0] == '.') { Modified: head/sbin/fsck_ffs/suj.c == --- head/sbin/fsck_ffs/suj.cThu Sep 27 23:30:58 2012(r241012) +++ head/sbin/fsck_ffs/suj.cThu Sep 27 23:31:06 2012(r241013) @@ -1945,7 +1945,7 @@ ino_unlinked(void) if (DIP(ip, di_nlink) == 0) { if (debug) printf(Freeing unlinked ino %ju mode %o\n, - ino, mode); + (uintmax_t)ino, mode); ino_reclaim(ip, ino, mode); } else if (debug) printf(Skipping ino %ju mode %o with link %d\n, Modified: head/sbin/fsdb/fsdb.c == --- head/sbin/fsdb/fsdb.c Thu Sep 27 23:30:58 2012(r241012) +++ head/sbin/fsdb/fsdb.c Thu Sep 27 23:31:06 2012(r241013) @@ -39,6 +39,7 @@ static const char rcsid[] = #include grp.h #include histedit.h #include pwd.h +#include stdint.h #include string.h #include time.h #include timeconv.h @@ -211,7 +212,8 @@ char * prompt(EditLine *el) { static char pstring[64]; -snprintf(pstring, sizeof(pstring), fsdb (inum: %d) , curinum); +snprintf(pstring, sizeof(pstring), fsdb (inum: %ju) , + (uintmax_t)curinum); return pstring; } @@ -298,8 +300,8 @@ ino_t curinum, ocurrent; #define GETINUM(ac,inum)inum = strtoul(argv[ac], cp, 0); \ if (inum ROOTINO || inum maxino || cp == argv[ac] || *cp != '\0' ) { \ - printf(inode %d out of range; range is [%d,%d]\n, \ - inum, ROOTINO, maxino); \ + printf(inode %ju out of range; range is [%ju,%ju]\n, \ + (uintmax_t)inum, (uintmax_t)ROOTINO, (uintmax_t)maxino);\ return 1; \ } @@ -364,7 +366,8 @@ CMDFUNCSTART(uplink) if (!checkactive()) return 1; DIP_SET(curinode, di_nlink, DIP(curinode, di_nlink) + 1); -printf(inode %d link count now %d\n, curinum, DIP(curinode, di_nlink)); +printf(inode %ju link count now %d\n, + (uintmax_t)curinum, DIP(curinode, di_nlink)); inodirty(); return 0; } @@ -374,7 +377,8 @@ CMDFUNCSTART(downlink) if (!checkactive()) return 1; DIP_SET(curinode, di_nlink, DIP(curinode, di_nlink) - 1); -printf(inode %d link count now %d\n, curinum, DIP(curinode, di_nlink)); +printf(inode %ju link count now %d\n, + (uintmax_t)curinum, DIP(curinode, di_nlink)); inodirty(); return 0; } @@ -493,11 +497,11 @@ CMDFUNCSTART(findblk) if (is_ufs2 ?
svn commit: r241014 - in head/bin: ls rm
Author: mdf Date: Thu Sep 27 23:31:12 2012 New Revision: 241014 URL: http://svn.freebsd.org/changeset/base/241014 Log: Fix bin/ build with a 64-bit ino_t. Original code by: Gleb Kurtsou Modified: head/bin/ls/ls.c head/bin/ls/print.c head/bin/rm/rm.c Modified: head/bin/ls/ls.c == --- head/bin/ls/ls.cThu Sep 27 23:31:06 2012(r241013) +++ head/bin/ls/ls.cThu Sep 27 23:31:12 2012(r241014) @@ -561,7 +561,8 @@ display(const FTSENT *p, FTSENT *list, i NAMES *np; off_t maxsize; long maxblock; - u_long btotal, labelstrlen, maxinode, maxlen, maxnlink; + uintmax_t maxinode; + u_long btotal, labelstrlen, maxlen, maxnlink; u_long maxlabelstr; u_int sizelen; int maxflags; @@ -580,8 +581,9 @@ display(const FTSENT *p, FTSENT *list, i btotal = 0; initmax = getenv(LS_COLWIDTHS); /* Fields match -lios order. New ones should be added at the end. */ - maxlabelstr = maxblock = maxinode = maxlen = maxnlink = - maxuser = maxgroup = maxflags = maxsize = 0; + maxlabelstr = maxblock = maxlen = maxnlink = 0; + maxuser = maxgroup = maxflags = maxsize = 0; + maxinode = 0; if (initmax != NULL *initmax != '\0') { char *initmax2, *jinitmax; int ninitmax; @@ -609,7 +611,7 @@ display(const FTSENT *p, FTSENT *list, i strcpy(initmax2, 0); ninitmax = sscanf(jinitmax, -%lu : %ld : %lu : %u : %u : %i : %jd : %lu : %lu , +%ju : %ld : %lu : %u : %u : %i : %jd : %lu : %lu , maxinode, maxblock, maxnlink, maxuser, maxgroup, maxflags, maxsize, maxlen, maxlabelstr); f_notabs = 1; @@ -839,7 +841,7 @@ label_out: d.s_flags = maxflags; d.s_label = maxlabelstr; d.s_group = maxgroup; - d.s_inode = snprintf(NULL, 0, %lu, maxinode); + d.s_inode = snprintf(NULL, 0, %ju, maxinode); d.s_nlink = snprintf(NULL, 0, %lu, maxnlink); sizelen = f_humanval ? HUMANVALSTR_LEN : snprintf(NULL, 0, %ju, maxsize); Modified: head/bin/ls/print.c == --- head/bin/ls/print.c Thu Sep 27 23:31:06 2012(r241013) +++ head/bin/ls/print.c Thu Sep 27 23:31:12 2012(r241014) @@ -152,7 +152,8 @@ printlong(const DISPLAY *dp) continue; sp = p-fts_statp; if (f_inode) - (void)printf(%*lu , dp-s_inode, (u_long)sp-st_ino); + (void)printf(%*ju , + dp-s_inode, (uintmax_t)sp-st_ino); if (f_size) (void)printf(%*jd , dp-s_block, howmany(sp-st_blocks, blocksize)); @@ -328,7 +329,8 @@ printaname(const FTSENT *p, u_long inode sp = p-fts_statp; chcnt = 0; if (f_inode) - chcnt += printf(%*lu , (int)inodefield, (u_long)sp-st_ino); + chcnt += printf(%*ju , + (int)inodefield, (uintmax_t)sp-st_ino); if (f_size) chcnt += printf(%*jd , (int)sizefield, howmany(sp-st_blocks, blocksize)); Modified: head/bin/rm/rm.c == --- head/bin/rm/rm.cThu Sep 27 23:31:06 2012(r241013) +++ head/bin/rm/rm.cThu Sep 27 23:31:12 2012(r241014) @@ -51,6 +51,7 @@ __FBSDID($FreeBSD$); #include fts.h #include grp.h #include pwd.h +#include stdint.h #include stdio.h #include stdlib.h #include string.h @@ -429,8 +430,8 @@ rm_overwrite(char *file, struct stat *sb if (!S_ISREG(sbp-st_mode)) return (1); if (sbp-st_nlink 1 !fflag) { - warnx(%s (inode %u): not overwritten due to multiple links, - file, sbp-st_ino); + warnx(%s (inode %ju): not overwritten due to multiple links, + file, (uintmax_t)sbp-st_ino); return (0); } if ((fd = open(file, O_WRONLY|O_NONBLOCK|O_NOFOLLOW, 0)) == -1) ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r241015 - in head: usr.bin/find usr.sbin/lpr/lpr usr.sbin/makefs/ffs usr.sbin/quot usr.sbin/snapinfo
Author: mdf Date: Thu Sep 27 23:31:19 2012 New Revision: 241015 URL: http://svn.freebsd.org/changeset/base/241015 Log: Fix usr.bin/ and usr.sbin/ build with a 64-bit ino_t. Original code by: Gleb Kurtsou Modified: head/usr.bin/find/ls.c head/usr.sbin/lpr/lpr/lpr.c head/usr.sbin/makefs/ffs/ffs_alloc.c head/usr.sbin/quot/quot.c head/usr.sbin/snapinfo/snapinfo.c Modified: head/usr.bin/find/ls.c == --- head/usr.bin/find/ls.c Thu Sep 27 23:31:12 2012(r241014) +++ head/usr.bin/find/ls.c Thu Sep 27 23:31:19 2012(r241015) @@ -63,7 +63,7 @@ printlong(char *name, char *accpath, str { char modep[15]; - (void)printf(%6lu %8PRId64 , (u_long) sb-st_ino, sb-st_blocks); + (void)printf(%6ju %8PRId64 , (uintmax_t)sb-st_ino, sb-st_blocks); (void)strmode(sb-st_mode, modep); (void)printf(%s %3u %-*s %-*s , modep, sb-st_nlink, MAXLOGNAME - 1, user_from_uid(sb-st_uid, 0), MAXLOGNAME - 1, Modified: head/usr.sbin/lpr/lpr/lpr.c == --- head/usr.sbin/lpr/lpr/lpr.c Thu Sep 27 23:31:12 2012(r241014) +++ head/usr.sbin/lpr/lpr/lpr.c Thu Sep 27 23:31:19 2012(r241015) @@ -75,6 +75,7 @@ __FBSDID($FreeBSD$); #include grp.h #include unistd.h #include stdlib.h +#include stdint.h #include stdio.h #include ctype.h #include string.h @@ -386,8 +387,8 @@ main(int argc, char *argv[]) continue; /* file unreasonable */ if (sflag (cp = linked(arg)) != NULL) { - (void) snprintf(buf, sizeof(buf), %u %u, statb.st_dev, - statb.st_ino); + (void)snprintf(buf, sizeof(buf), %u %ju, + statb.st_dev, (uintmax_t)statb.st_ino); card('S', buf); if (format == 'p') card('T', title ? title : arg); Modified: head/usr.sbin/makefs/ffs/ffs_alloc.c == --- head/usr.sbin/makefs/ffs/ffs_alloc.cThu Sep 27 23:31:12 2012 (r241014) +++ head/usr.sbin/makefs/ffs/ffs_alloc.cThu Sep 27 23:31:19 2012 (r241015) @@ -48,6 +48,7 @@ __FBSDID($FreeBSD$); #include sys/time.h #include errno.h +#include stdint.h #include makefs.h @@ -439,8 +440,8 @@ ffs_blkfree(struct inode *ip, daddr_t bn } cg = dtog(fs, bno); if (bno = fs-fs_size) { - warnx(bad block %lld, ino %llu, (long long)bno, - (unsigned long long)ip-i_number); + warnx(bad block %lld, ino %ju, (long long)bno, + (uintmax_t)ip-i_number); return; } error = bread(ip-i_fd, ip-i_fs, fsbtodb(fs, cgtod(fs, cg)), Modified: head/usr.sbin/quot/quot.c == --- head/usr.sbin/quot/quot.c Thu Sep 27 23:31:12 2012(r241014) +++ head/usr.sbin/quot/quot.c Thu Sep 27 23:31:19 2012(r241015) @@ -484,8 +484,8 @@ static void donames(int fd, struct fs *super, char *name) { int c; - ino_t inode; ino_t maxino; + uintmax_t inode; union dinode *dp; maxino = super-fs_ncg * super-fs_ipg - 1; @@ -493,9 +493,9 @@ donames(int fd, struct fs *super, char * while ((c = getchar()) != EOF (c '0' || c '9')) while ((c = getchar()) != EOF c != '\n'); ungetc(c,stdin); - while (scanf(%u,inode) == 1) { + while (scanf(%ju, inode) == 1) { if (inode maxino) { - warnx(illegal inode %d,inode); + warnx(illegal inode %ju, inode); return; } errno = 0; Modified: head/usr.sbin/snapinfo/snapinfo.c == --- head/usr.sbin/snapinfo/snapinfo.c Thu Sep 27 23:31:12 2012 (r241014) +++ head/usr.sbin/snapinfo/snapinfo.c Thu Sep 27 23:31:19 2012 (r241015) @@ -34,6 +34,7 @@ #include errno.h #include ftw.h #include libufs.h +#include stdint.h #include stdio.h #include stdlib.h #include string.h @@ -149,7 +150,7 @@ compare_function(const char *path, const printf(\tsnapshot ); printf(%s, path); if (verbose) - printf( (inode %d), st-st_ino); + printf( (inode %ju), (uintmax_t)st-st_ino); printf(\n); if (!cont_search) return (EEXIST); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to
svn commit: r241012 - head/sbin/fsck_ffs
Author: mdf Date: Thu Sep 27 23:30:58 2012 New Revision: 241012 URL: http://svn.freebsd.org/changeset/base/241012 Log: Fix fsck_ffs build with a 64-bit ino_t. Original code by: Gleb Kurtsou Modified: head/sbin/fsck_ffs/fsutil.c head/sbin/fsck_ffs/gjournal.c head/sbin/fsck_ffs/inode.c head/sbin/fsck_ffs/main.c head/sbin/fsck_ffs/pass1.c head/sbin/fsck_ffs/pass2.c head/sbin/fsck_ffs/pass4.c head/sbin/fsck_ffs/suj.c Modified: head/sbin/fsck_ffs/fsutil.c == --- head/sbin/fsck_ffs/fsutil.c Thu Sep 27 23:30:49 2012(r241011) +++ head/sbin/fsck_ffs/fsutil.c Thu Sep 27 23:30:58 2012(r241012) @@ -137,7 +137,8 @@ inoinfo(ino_t inum) int iloff; if (inum maxino) - errx(EEXIT, inoinfo: inumber %d out of range, inum); + errx(EEXIT, inoinfo: inumber %ju out of range, + (uintmax_t)inum); ilp = inostathead[inum / sblock.fs_ipg]; iloff = inum % sblock.fs_ipg; if (iloff = ilp-il_numalloced) Modified: head/sbin/fsck_ffs/gjournal.c == --- head/sbin/fsck_ffs/gjournal.c Thu Sep 27 23:30:49 2012 (r241011) +++ head/sbin/fsck_ffs/gjournal.c Thu Sep 27 23:30:58 2012 (r241012) @@ -448,7 +448,8 @@ gjournal_check(const char *filesys) if (isclr(inosused, cino)) continue; if (getino(disk, p, ino, mode) == -1) - err(1, getino(cg=%d ino=%d), cg, ino); + err(1, getino(cg=%d ino=%ju), + cg, (uintmax_t)ino); dino = p; /* Not a regular file nor directory? Skip it. */ if (!S_ISREG(dino-di_mode) !S_ISDIR(dino-di_mode)) @@ -480,7 +481,8 @@ gjournal_check(const char *filesys) *dino = ufs2_zino; /* Write the inode back. */ if (putino(disk) == -1) - err(1, putino(cg=%d ino=%d), cg, ino); + err(1, putino(cg=%d ino=%ju), + cg, (uintmax_t)ino); if (cgp-cg_unrefs == 0) { //printf(No more unreferenced inodes in cg=%d.\n, cg); break; Modified: head/sbin/fsck_ffs/inode.c == --- head/sbin/fsck_ffs/inode.c Thu Sep 27 23:30:49 2012(r241011) +++ head/sbin/fsck_ffs/inode.c Thu Sep 27 23:30:58 2012(r241012) @@ -285,7 +285,8 @@ ginode(ino_t inumber) ufs2_daddr_t iblk; if (inumber ROOTINO || inumber maxino) - errx(EEXIT, bad inode number %d to ginode, inumber); + errx(EEXIT, bad inode number %ju to ginode, + (uintmax_t)inumber); if (startinum == 0 || inumber startinum || inumber = startinum + INOPB(sblock)) { iblk = ino_to_fsba(sblock, inumber); @@ -319,7 +320,8 @@ getnextinode(ino_t inumber, int rebuildc static caddr_t nextinop; if (inumber != nextino++ || inumber lastvalidinum) - errx(EEXIT, bad inode number %d to nextinode, inumber); + errx(EEXIT, bad inode number %ju to nextinode, + (uintmax_t)inumber); if (inumber = lastinum) { readcnt++; dblk = fsbtodb(sblock, ino_to_fsba(sblock, lastinum)); @@ -398,7 +400,8 @@ setinodebuf(ino_t inum) { if (inum % sblock.fs_ipg != 0) - errx(EEXIT, bad inode number %d to setinodebuf, inum); + errx(EEXIT, bad inode number %ju to setinodebuf, + (uintmax_t)inum); lastvalidinum = inum + sblock.fs_ipg - 1; startinum = 0; nextino = inum; @@ -489,7 +492,7 @@ getinoinfo(ino_t inumber) continue; return (inp); } - errx(EEXIT, cannot find inode %d, inumber); + errx(EEXIT, cannot find inode %ju, (uintmax_t)inumber); return ((struct inoinfo *)0); } Modified: head/sbin/fsck_ffs/main.c == --- head/sbin/fsck_ffs/main.c Thu Sep 27 23:30:49 2012(r241011) +++ head/sbin/fsck_ffs/main.c Thu Sep 27 23:30:58 2012(r241012) @@ -492,7 +492,7 @@ checkfilesys(char *filesys) n_ffree * 100.0 / sblock.fs_dsize); if (debug) { if (files 0) - printf(%d inodes missing\n, -files); + printf(%jd inodes missing\n, (intmax_t)-files); if (blks 0) printf(%lld blocks missing\n, -(long long)blks);
svn commit: r241019 - head/usr.sbin/bsdconfig/share
Author: dteske Date: Fri Sep 28 01:39:25 2012 New Revision: 241019 URL: http://svn.freebsd.org/changeset/base/241019 Log: Sanitize varname argument in f_sysrc_find. This is as much for security as it is for sanity. Reviewed by: jilles Approved by: adrian (co-mentor) Modified: head/usr.sbin/bsdconfig/share/sysrc.subr Modified: head/usr.sbin/bsdconfig/share/sysrc.subr == --- head/usr.sbin/bsdconfig/share/sysrc.subrFri Sep 28 01:04:10 2012 (r241018) +++ head/usr.sbin/bsdconfig/share/sysrc.subrFri Sep 28 01:39:25 2012 (r241019) @@ -49,6 +49,17 @@ f_include_lang $BSDCFG_LIBE/include/mess SUCCESS=0 FAILURE=1 +# +# Valid characters that can appear in an sh(1) variable name +# +# Please note that the character ranges A-Z and a-z should be avoided because +# these can include accent characters (which are not valid in a variable name). +# For example, A-Z matches any character that sorts after A but before Z, +# including A and Z. Although ASCII order would make more sense, that is not +# how it works. +# +VALID_VARNAME_CHARS=0-9ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_ + FUNCTIONS # f_clean_env [ --except $varname ... ] @@ -243,14 +254,16 @@ f_sysrc_get_default() # f_sysrc_find() { - local varname=$1 + local varname=${1%%[!$VALID_VARNAME_CHARS]*} local regex=^[[:space:]]*$varname= local rc_conf_files=$( f_sysrc_get rc_conf_files ) local conf_files= local file # Check parameters - [ $varname ] || return $FAILURE + case $varname in + |[0-9]*) return $FAILURE + esac # # If RC_CONFS is defined, set $rc_conf_files to an explicit ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r241020 - in head/sys: amd64/amd64 i386/i386 i386/xen ia64/ia64 mips/mips powerpc/aim sparc64/sparc64
Author: alc Date: Fri Sep 28 05:30:59 2012 New Revision: 241020 URL: http://svn.freebsd.org/changeset/base/241020 Log: Eliminate a stale comment. It describes another use case for the pmap in Mach that doesn't exist in FreeBSD. Modified: head/sys/amd64/amd64/pmap.c head/sys/i386/i386/pmap.c head/sys/i386/xen/pmap.c head/sys/ia64/ia64/pmap.c head/sys/mips/mips/pmap.c head/sys/powerpc/aim/mmu_oea.c head/sys/powerpc/aim/mmu_oea64.c head/sys/sparc64/sparc64/pmap.c Modified: head/sys/amd64/amd64/pmap.c == --- head/sys/amd64/amd64/pmap.c Fri Sep 28 01:39:25 2012(r241019) +++ head/sys/amd64/amd64/pmap.c Fri Sep 28 05:30:59 2012(r241020) @@ -82,13 +82,6 @@ __FBSDID($FreeBSD$); /* * Manages physical address maps. * - * In addition to hardware address maps, this - * module is called upon to provide software-use-only - * maps which may or may not be stored in the same - * form as hardware maps. These pseudo-maps are - * used to store intermediate results from copy - * operations to and from address spaces. - * * Since the information managed by this module is * also stored by the logical address mapping module, * this module may throw away valid virtual-to-physical Modified: head/sys/i386/i386/pmap.c == --- head/sys/i386/i386/pmap.c Fri Sep 28 01:39:25 2012(r241019) +++ head/sys/i386/i386/pmap.c Fri Sep 28 05:30:59 2012(r241020) @@ -80,13 +80,6 @@ __FBSDID($FreeBSD$); /* * Manages physical address maps. * - * In addition to hardware address maps, this - * module is called upon to provide software-use-only - * maps which may or may not be stored in the same - * form as hardware maps. These pseudo-maps are - * used to store intermediate results from copy - * operations to and from address spaces. - * * Since the information managed by this module is * also stored by the logical address mapping module, * this module may throw away valid virtual-to-physical Modified: head/sys/i386/xen/pmap.c == --- head/sys/i386/xen/pmap.cFri Sep 28 01:39:25 2012(r241019) +++ head/sys/i386/xen/pmap.cFri Sep 28 05:30:59 2012(r241020) @@ -80,13 +80,6 @@ __FBSDID($FreeBSD$); /* * Manages physical address maps. * - * In addition to hardware address maps, this - * module is called upon to provide software-use-only - * maps which may or may not be stored in the same - * form as hardware maps. These pseudo-maps are - * used to store intermediate results from copy - * operations to and from address spaces. - * * Since the information managed by this module is * also stored by the logical address mapping module, * this module may throw away valid virtual-to-physical Modified: head/sys/ia64/ia64/pmap.c == --- head/sys/ia64/ia64/pmap.c Fri Sep 28 01:39:25 2012(r241019) +++ head/sys/ia64/ia64/pmap.c Fri Sep 28 05:30:59 2012(r241020) @@ -74,13 +74,6 @@ __FBSDID($FreeBSD$); /* * Manages physical address maps. * - * In addition to hardware address maps, this - * module is called upon to provide software-use-only - * maps which may or may not be stored in the same - * form as hardware maps. These pseudo-maps are - * used to store intermediate results from copy - * operations to and from address spaces. - * * Since the information managed by this module is * also stored by the logical address mapping module, * this module may throw away valid virtual-to-physical Modified: head/sys/mips/mips/pmap.c == --- head/sys/mips/mips/pmap.c Fri Sep 28 01:39:25 2012(r241019) +++ head/sys/mips/mips/pmap.c Fri Sep 28 05:30:59 2012(r241020) @@ -42,13 +42,6 @@ /* * Manages physical address maps. * - * In addition to hardware address maps, this - * module is called upon to provide software-use-only - * maps which may or may not be stored in the same - * form as hardware maps. These pseudo-maps are - * used to store intermediate results from copy - * operations to and from address spaces. - * * Since the information managed by this module is * also stored by the logical address mapping module, * this module may throw away valid virtual-to-physical Modified: head/sys/powerpc/aim/mmu_oea.c == --- head/sys/powerpc/aim/mmu_oea.c Fri Sep 28 01:39:25 2012 (r241019) +++ head/sys/powerpc/aim/mmu_oea.c Fri Sep 28 05:30:59 2012