Re: [PATCH 1/2] flex 2.5.39
I'll put this into a ports bulk build.
Re: remove IF_PREPEND in src/sys/dev/pci, was Re: IFQ_PREPEND
> i thought le(4) was the worst. Of course not. le(4) is slow and has some quirks (and the earliest ones can't do multicast correctly), but at least they don't collapse into fetal position under load and don't need a reset to recover.
Re: remove IF_PREPEND in src/sys/dev/pci, was Re: IFQ_PREPEND
On 2015/11/08 10:45, Miod Vallat wrote: > > i thought le(4) was the worst. > > Of course not. le(4) is slow and has some quirks (and the earliest ones > can't do multicast correctly), but at least they don't collapse into fetal > position under load and don't need a reset to recover. I see you too have experienced the old vr(4)'s. The newer ones are less bad. (I don't think I have any I can reach without going for a drive if they break though..)
Re: Patch 1/3 - make DIOCRADDADDRS to accept on IP address per ioctl() call
On Sun, Nov 08, 2015 at 02:37:58AM +0100, Alexander Bluhm wrote: > > + for (i = 0; (i < size) && (rv == 0); i++) { > > rv is unitialized in the first interation > > > + io.pfrio_buffer = addr++; > > + rv = ioctl(dev, DIOCRADDADDR, ); > > I would suggest to return (-1) if ioctl fails... > > > + add++; > > + } To keep the illusion of an atomic operation, we could remove the addresses we just added before the one add failed. bluhm
Driver for Attansic Technology E2200.
Hi, good afternoon. I don't know if this is the correct list to post the next email so, I'm sorry if this isn't the correct place. My laptop computer wich is an MSI GE70 2QE has a network interface which currently it seems to be not supported by -current so I tried to port the device driver to OpenBSD based on the driver from FreeBSD which is similar and now the network interface is working correctly. Next I paste some information about the hardware and the device driver: 1º Dmesg: alc0 at pci4 dev 0 function 0 "Attansic Technology E2200" rev 0x13: msi, address d8:cb:8a:84:db:cc atphy0 at alc0 phy 0: F1 10/100/1000 PHY, rev. 9 2º Output of ifconfig alc0 alc0: flags=8843mtu 1500 lladdr d8:cb:8a:84:db:cc priority: 0 groups: egress media: Ethernet autoselect (1000baseT full-duplex,rxpause,txpause) status: active inet 192.168.1.7 netmask 0xff00 broadcast 192.168.1.255 3º full dmesg in the attachment 4º cvs diff if_alc.c and cvs diff in the attachments. I don't know if you're interested to apply the diff's into base but I think that could be a good idea. PS: Although the driver works correctly, I'm still debugging the driver. Thank you very much for every thing. Have a nice day. Guille ,SMEP,BMI2,ERMS,INVPCID,SENSOR,ARAT cpu2: 256KB 64b/line 8-way L2 cache cpu2: smt 0, core 2, package 0 cpu3 at mainbus0: apid 6 (application processor) cpu3: Intel(R) Core(TM) i7-4720HQ CPU @ 2.60GHz, 3392.15 MHz cpu3: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,FMA3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,MOVBE,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,PAGE1GB,LONG,LAHF,ABM,PERF,ITSC,FSGSBASE,BMI1,AVX2,SMEP,BMI2,ERMS,INVPCID,SENSOR,ARAT cpu3: 256KB 64b/line 8-way L2 cache cpu3: smt 0, core 3, package 0 cpu4 at mainbus0: apid 1 (application processor) cpu4: Intel(R) Core(TM) i7-4720HQ CPU @ 2.60GHz, 3392.15 MHz cpu4: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,FMA3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,MOVBE,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,PAGE1GB,LONG,LAHF,ABM,PERF,ITSC,FSGSBASE,BMI1,AVX2,SMEP,BMI2,ERMS,INVPCID,SENSOR,ARAT cpu4: 256KB 64b/line 8-way L2 cache cpu4: smt 1, core 0, package 0 cpu5 at mainbus0: apid 3 (application processor) cpu5: Intel(R) Core(TM) i7-4720HQ CPU @ 2.60GHz, 3392.15 MHz cpu5: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,FMA3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,MOVBE,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,PAGE1GB,LONG,LAHF,ABM,PERF,ITSC,FSGSBASE,BMI1,AVX2,SMEP,BMI2,ERMS,INVPCID,SENSOR,ARAT cpu5: 256KB 64b/line 8-way L2 cache cpu5: smt 1, core 1, package 0 cpu6 at mainbus0: apid 5 (application processor) cpu6: Intel(R) Core(TM) i7-4720HQ CPU @ 2.60GHz, 3392.15 MHz cpu6: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,FMA3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,MOVBE,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,PAGE1GB,LONG,LAHF,ABM,PERF,ITSC,FSGSBASE,BMI1,AVX2,SMEP,BMI2,ERMS,INVPCID,SENSOR,ARAT cpu6: 256KB 64b/line 8-way L2 cache cpu6: smt 1, core 2, package 0 cpu7 at mainbus0: apid 7 (application processor) cpu7: Intel(R) Core(TM) i7-4720HQ CPU @ 2.60GHz, 3392.15 MHz cpu7: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,FMA3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,MOVBE,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,PAGE1GB,LONG,LAHF,ABM,PERF,ITSC,FSGSBASE,BMI1,AVX2,SMEP,BMI2,ERMS,INVPCID,SENSOR,ARAT cpu7: 256KB 64b/line 8-way L2 cache cpu7: smt 1, core 3, package 0 ioapic0 at mainbus0: apid 8 pa 0xfec0, version 20, 24 pins acpimcfg0 at acpi0 addr 0xf800, bus 0-63 acpihpet0 at acpi0: 14318179 Hz acpiprt0 at acpi0: bus 0 (PCI0) acpiprt1 at acpi0: bus 2 (RP01) acpiprt2 at acpi0: bus 3 (RP03) acpiprt3 at acpi0: bus 4 (RP04) acpiprt4 at acpi0: bus 5 (RP06) acpiprt5 at acpi0: bus 1 (PEG0) acpiprt6 at acpi0: bus -1 (PEG1) acpiprt7 at acpi0: bus -1 (PEG2) acpiec0 at acpi0 acpiec at acpi0 not configured acpicpu0 at acpi0: C2(200@148 mwait.1@0x33), C1(1000@1 mwait.1), PSS acpicpu1 at acpi0: C2(200@148 mwait.1@0x33), C1(1000@1 mwait.1), PSS acpicpu2 at acpi0: C2(200@148 mwait.1@0x33), C1(1000@1 mwait.1), PSS acpicpu3 at acpi0: C2(200@148 mwait.1@0x33), C1(1000@1 mwait.1), PSS acpicpu4 at acpi0: C2(200@148 mwait.1@0x33), C1(1000@1 mwait.1), PSS acpicpu5 at acpi0: C2(200@148 mwait.1@0x33), C1(1000@1 mwait.1), PSS acpicpu6 at acpi0: C2(200@148 mwait.1@0x33), C1(1000@1 mwait.1), PSS acpicpu7 at acpi0:
Re: [PATCH 1/2] flex 2.5.39
On 2015/11/08 11:47, Stuart Henderson wrote: > I'll put this into a ports bulk build. > Just noticed that it loses the MLINKS line that installs the flex++(1) link.
Re: unify xmalloc (was Re: [patch] cvs: retire xfree())
Hmm yes you are right, in that case, go for it. On Sun, Nov 08, 2015 at 02:00:17PM +0100, Joerg Sonnenberger wrote: > On Sun, Nov 08, 2015 at 08:36:52AM +, Nicholas Marriott wrote: > > On Sat, Nov 07, 2015 at 08:42:14PM -0500, Ted Unangst wrote: > > > Tobias Stoeckmann wrote: > > > > Is this okay for ssh and tmux, which are out to be very portable? > > > > Nicholas mentioned that malloc is not required to set errno. I've also > > > > checked the standard and it's just an extension. Although at worst, > > > > the user sees a wrong error message... > > > > > > Are they portable to not-posix? posix dictates that malloc set errno. > > > > It is optional in SUSv3: > > > > RETURN VALUE > > > > Upon successful completion with size not equal to 0, malloc() shall > > return a pointer to the allocated space. If size is 0, either > > a null pointer or a unique pointer that can be successfully > > passed to free() shall be returned. Otherwise, it shall return > > a null pointer ^[CX] [Option Start] and set errno to indicate > > the error. [Option End] > > Not really, that just means that the "and set errno" part is not > included in ISO C itself. The markup is a bit confusing, but CX is not > an option in the "pick it or not sense". > > Joerg >
Re: unify xmalloc (was Re: [patch] cvs: retire xfree())
On Sun, Nov 08, 2015 at 08:36:52AM +, Nicholas Marriott wrote: > On Sat, Nov 07, 2015 at 08:42:14PM -0500, Ted Unangst wrote: > > Tobias Stoeckmann wrote: > > > Is this okay for ssh and tmux, which are out to be very portable? > > > Nicholas mentioned that malloc is not required to set errno. I've also > > > checked the standard and it's just an extension. Although at worst, > > > the user sees a wrong error message... > > > > Are they portable to not-posix? posix dictates that malloc set errno. > > It is optional in SUSv3: > > RETURN VALUE > > Upon successful completion with size not equal to 0, malloc() shall > return a pointer to the allocated space. If size is 0, either > a null pointer or a unique pointer that can be successfully > passed to free() shall be returned. Otherwise, it shall return > a null pointer ^[CX] [Option Start] and set errno to indicate > the error. [Option End] Not really, that just means that the "and set errno" part is not included in ISO C itself. The markup is a bit confusing, but CX is not an option in the "pick it or not sense". Joerg
Re: [patch] armv7/imx/imxesdhc.c: add imxesdhc_dump_regs
> I tried enabling bits in the ccm, enabling clocks, making various > changes to imxesdhc itself and didn't get anywhere. Similiar story > with the usb otg port on the cubox. I have made some headway. Compiling with -DSDHC_DEBUG shows imxesdhc follows all the nessecary steps for initialization, voltage select, CID/CSD checking, etc. Only when the driver attempts the first actual transfer (single block read at address 0, CMD 17) does it fail: imxesdhc0: start cmd 17 arg=0 data=0xccd94000 dlen=512 flags=0x1c50 proc="sdmmc0" imxesdhc0: wait_state 1 0 ff8d8088) imxesdhc0: interrupt status=0x0001 imxesdhc0: intr status 0x1 error 0 resp[0] 0x0900 imxesdhc0: resp=0x900 datalen=512 imxesdhc0: intr status 0x107f error 0 imxesdhc0: software reset reg=0x600 imxesdhc0: data transfer done (error=60) imxesdhc0: cmd 17 done (flags=0x1c51 error=60) root on rd0a swap on rd0b dump on rd0b panic: cannot open disk, 0x1200/0x1202, error 2 This line in particular: imxesdhc0: intr status 0x107f error 0 indicates many error interrupts were received during the time the driver was waiting for the "buffer read ready" interrupt following the single block read command. That interupt never comes and a ETIMEDOUT is returned (error=60 2 lines down). This is due to the "internal DMA mode" bit being set; according to the i.MX6 reference manual this stops our target BRR interrupt from firing (page 5601): "When internal DMA is not used (DMAEN bit in Transfer Type register is not set when the command is sent), the uSDHC asserts a DMA request when the amount of data exceeds the value set in the RD_WML register, that is available and ready for system fetching data. At the same time, the uSDHC sets the BRR bit. The buffer read ready interrupt will be generated if it is enabled by software. When internal DMA is used, the uSDHC will not inform the system before all the required number of bytes are transferred (if no error was encountered)." This bit is set on line 819 in imxesdhc.c. It shouldn't be: 819 HWRITE4(sc, SDHC_MIX_CTRL, 820(HREAD4(sc, SDHC_MIX_CTRL) & (0xf << 22)) | (command & 0x)); 821 HWRITE4(sc, SDHC_CMD_XFR_TYP, command); 822 823 splx(s); 824 return 0; That doesn't look right. The rest of the driver defaults to using PIO, DMA mode must be manually enabled with -DSDHC_DMA (It currently doesn't compile). All the DMA mode-specific code is wrapped in #ifdefs except the line mentioned above. Removing it advances our progress somewhat: imxesdhc0: start cmd 17 arg=0 data=0xccd94000 dlen=512 flags=0x1c50 proc="sdmmc0" imxesdhc0: wait_state 1 0 ff8d8088) imxesdhc0: interrupt status=0x0011 imxesdhc0: intr status 0x1 error 0 resp[0] 0x0900 imxesdhc0: resp=0x900 datalen=512 imxesdhc0: intr status 0x10 error 0 imxesdhc0: wait_state 800 800 ff8d858e) imxesdhc0: timeout waiting for 800, state ff8d858e imxesdhc0: data transfer done (error=60) imxesdhc0: cmd 17 done (flags=0x1c51 error=60) imxesdhc0: interrupt status=0x0010 root on rd0a swap on rd0b dump on rd0b panic: cannot open disk, 0x1200/0x1202, error 2 We now get the BRR interrupt and move on to waiting for the state register's "buffer read enable" bit to go high. It doesn't, and we timeout again, this time without all the error interrupts firing: imxesdhc0: interrupt status=0x0010 Just one interrupt this time, as you can see. It is the "buffer write ready" interrupt, analagous to the "buffer write enable" state bit we would be looking for in this situation were we peforming a write instead of a read. Groan. This is as far as I got today, I plan on working more on it next week. > The novena has two slots one internal one with a card detect line and > one without. I was told the one without card detect (external) has > working io and can be mounted the other one can not. I see 4 slots in the IMX6 dual/quad manual (uSDHC1-4). My cubox i4pro only seems to have one actual microSD peripheral port and no onboard eMMC, maybe one of those four slots could be an alternate slot referring to the peripheral port. fwiw the linux image it shipped with booted properly. Ian
[patch] revised/tested sd/mmc sector mode fix
Hi, Uwe & I have revised my earlier sdmmc patch adding support for sector-mode bit setting on certain eMMC devices. Here were my tests confirming it works: > On Tue, Oct 27, 2015 at 10:49 PM, ian kremlinwrote: > > On Tue, Oct 27, 2015 at 9:26 PM, Uwe Stuehler wrote: > >> Can someone verify that this still works? > > > > I will test this tomorrow on my micron BBB, Kingston BBB & Cubox i4Pro > > using an array of sd/sdhc cards. > > Here are my findings. I used a fresh tree grabbed an hour ago with only > Uwe's patch applied. > > * Micron BeagleBone Black (problematic eMMC chip that wants sector mode bit): > > ommmc0 at omap0 > sdmmc0 at ommmc0 > ommmc1 at omap0 > sdmmc1 at ommmc1 > ... > scsibus0 at sdmmc0: 2 targets, initiator 0 > sd0 at scsibus0 targ 1 lun 0: SCSI2 > 0/direct fixed > sd0: 7388MB, 512 bytes/sector, 15130624 sectors > scsibus1 at sdmmc1: 2 targets, initiator 0 > sd1 at scsibus1 targ 1 lun 0: SCSI2 > 0/direct fixed > sd1: 3744MB, 512 bytes/sector, 7667712 sectors > > Both the eMMC chip and peripheral SD initialize correctly. The > peripheral SD in this case was a 8GB MicroSD (SDHC). Let's try this > again with a normal 2GB SD card (via adapter) to make sure non-SDHC > cards aren't negatively affected: > > ommmc0 at omap0 > sdmmc0 at ommmc0 > ommmc1 at omap0 > sdmmc1 at ommmc1 > ... > sd0 at scsibus0 targ 1 lun 0: SCSI2 > 0/direct fixed > sd0: 3744MB, 512 bytes/sector, 7667712 sectors > scsibus1 at sdmmc0: 2 targets, initiator 0 > sd1 at scsibus1 targ 1 lun 0: SCSI2 > 0/direct fixed > sd1: 1867MB, 512 bytes/sector, 3823616 sectors > > Everyhing looks good. Finally a test with an SDXC card to > make sure we cover all the bases: > > ommmc0 at omap0 > sdmmc0 at ommmc0 > ommmc1 at omap0 > sdmmc1 at ommmc1 > ... > sd0 at scsibus0 targ 1 lun 0: SCSI2 > 0/direct fixed > sd0: 60906MB, 512 bytes/sector, 124735488 sectors > scsibus1 at sdmmc1: 2 targets, initiator 0 > sd1 at scsibus1 targ 1 lun 0: SCSI2 > 0/direct fixed > sd1: 3744MB, 512 bytes/sector, 7667712 sectors > > Looks good. Having all possible combinations work like this > suggests we have solved the initial problem, but now let's check > the BBB with the Kingston eMMC to make sure it doesn't cause any > problems. Providing the sector-mode bits to the Kingston eMMC will > cause it to fail during init. > > * Kingston BeagleBone Black (did not have eMMC issues before patch): > > ommmc0 at omap0 > sdmmc0 at ommmc0 > ommmc1 at omap0 > sdmmc1 at ommmc1 > ... > scsibus0 at sdmmc1: 2 targets, initiator 0 > sd0 at scsibus0 targ 1 lun 0: SCSI2 > 0/direct fixed > sd0: 3688MB, 512 bytes/sector, 7553024 sectors > scsibus1 at sdmmc0: 2 targets, initiator 0 > sd1 at scsibus1 targ 1 lun 0: SCSI2 > 0/direct fixed > sd1: 7388MB, 512 bytes/sector, 15130624 sectors > > Phew. Let's try the non-microSD, non-SDHC card now: > > ommmc0 at omap0 > sdmmc0 at ommmc0 > ommmc1 at omap0 > sdmmc1 at ommmc1 > ... > scsibus0 at sdmmc1: 2 targets, initiator 0 > sd0 at scsibus0 targ 1 lun 0: SCSI2 > 0/direct fixed > sd0: 3688MB, 512 bytes/sector, 7553024 sectors > scsibus1 at sdmmc0: 2 targets, initiator 0 > sd1 at scsibus1 targ 1 lun 0: SCSI2 > 0/direct fixed > sd1: 1867MB, 512 bytes/sector, 3823616 sectors > > Cool, finally the SDXC: > > ommmc0 at omap0 > sdmmc0 at ommmc0 > ommmc1 at omap0 > sdmmc1 at ommmc1 > ... > scsibus0 at sdmmc1: 2 targets, initiator 0 > sd0 at scsibus0 targ 1 lun 0: SCSI2 > 0/direct fixed > sd0: 3688MB, 512 bytes/sector, 7553024 sectors > scsibus1 at sdmmc0: 2 targets, initiator 0 > sd1 at scsibus1 targ 1 lun 0: SCSI2 > 0/direct fixed > sd1: 60906MB, 512 bytes/sector, 124735488 sectors > > -- > > I think this shows that Uwe's patch will fix the error correctly. I wanted > to test with my Cubox i4Pro but it lacks an onboard eMMC chip & will > not be of any worth. Please let me know if there is any further testing > you would like to see. I would really, really love this patch to go in :) > > Ian And here is the patch: Index: sdmmc_mem.c === RCS file: /cvs/src/sys/dev/sdmmc/sdmmc_mem.c,v retrieving revision 1.21 diff -u -p -r1.21 sdmmc_mem.c --- sdmmc_mem.c 22 Apr 2015 04:02:06 -
cron: use queue(3)
Use queue(3) instead of homegrown queues and lists. This also fixes some potential memory leaks in error paths. - todd Index: usr.sbin/cron/atrun.c === RCS file: /cvs/src/usr.sbin/cron/atrun.c,v retrieving revision 1.34 diff -u -p -u -r1.34 atrun.c --- usr.sbin/cron/atrun.c 4 Nov 2015 20:28:17 - 1.34 +++ usr.sbin/cron/atrun.c 8 Nov 2015 14:40:54 - @@ -48,21 +48,20 @@ #include "funcs.h" #include "globals.h" -static void unlink_job(at_db *, atjob *); static void run_job(atjob *, char *); /* * Scan the at jobs dir and build up a list of jobs found. */ int -scan_atjobs(at_db *old_db, struct timespec *ts) +scan_atjobs(at_db **db, struct timespec *ts) { DIR *atdir = NULL; int cwd, queue, pending; time_t run_time; char *ep; - at_db new_db; - atjob *job, *tjob; + at_db *new_db, *old_db = *db; + atjob *job; struct dirent *file; struct stat statbuf; @@ -71,11 +70,11 @@ scan_atjobs(at_db *old_db, struct timesp return (0); } - if (old_db->mtime == statbuf.st_mtime) { + if (old_db != NULL && old_db->mtime == statbuf.st_mtime) { return (0); } - /* XXX - would be nice to stash the crontab cwd */ + /* XXX - use fstatat/openat instead of chdir */ if ((cwd = open(".", O_RDONLY, 0)) < 0) { log_it("CRON", getpid(), "CAN'T OPEN", "."); return (0); @@ -91,8 +90,14 @@ scan_atjobs(at_db *old_db, struct timesp return (0); } - new_db.mtime = statbuf.st_mtime;/* stash at dir mtime */ - new_db.head = new_db.tail = NULL; + if ((new_db = malloc(sizeof(*new_db))) == NULL) { + closedir(atdir); + fchdir(cwd); + close(cwd); + return (0); + } + new_db->mtime = statbuf.st_mtime; /* stash at dir mtime */ + TAILQ_INIT(_db->jobs); pending = 0; while ((file = readdir(atdir)) != NULL) { @@ -113,11 +118,11 @@ scan_atjobs(at_db *old_db, struct timesp job = malloc(sizeof(*job)); if (job == NULL) { - for (job = new_db.head; job != NULL; ) { - tjob = job; - job = job->next; - free(tjob); + while ((job = TAILQ_FIRST(_db->jobs))) { + TAILQ_REMOVE(_db->jobs, job, entries); + free(job); } + free(new_db); closedir(atdir); fchdir(cwd); close(cwd); @@ -127,32 +132,26 @@ scan_atjobs(at_db *old_db, struct timesp job->gid = statbuf.st_gid; job->queue = queue; job->run_time = run_time; - job->prev = new_db.tail; - job->next = NULL; - if (new_db.head == NULL) - new_db.head = job; - if (new_db.tail != NULL) - new_db.tail->next = job; - new_db.tail = job; + TAILQ_INSERT_TAIL(_db->jobs, job, entries); if (ts != NULL && run_time <= ts->tv_sec) pending = 1; } closedir(atdir); - /* Free up old at db */ - for (job = old_db->head; job != NULL; ) { - tjob = job; - job = job->next; - free(tjob); + /* Free up old at db and install new one */ + if (old_db != NULL) { + while ((job = TAILQ_FIRST(_db->jobs))) { + TAILQ_REMOVE(_db->jobs, job, entries); + free(job); + } + free(old_db); } + *db = new_db; /* Change back to the normal cron dir. */ fchdir(cwd); close(cwd); - /* Install the new database */ - *old_db = new_db; - return (pending); } @@ -165,9 +164,12 @@ atrun(at_db *db, double batch_maxload, t char atfile[MAX_FNAME]; struct stat statbuf; double la; - atjob *job, *batch; + atjob *job, *tjob, *batch = NULL; + + if (db == NULL) + return; - for (batch = NULL, job = db->head; job; job = job->next) { + TAILQ_FOREACH_SAFE(job, >jobs, entries, tjob) { /* Skip jobs in the future */ if (job->run_time > now) continue; @@ -175,11 +177,11 @@ atrun(at_db *db, double batch_maxload, t snprintf(atfile, sizeof(atfile), "%s/%lld.%c", AT_DIR, (long long)job->run_time, job->queue); - if (stat(atfile, ) != 0) - unlink_job(db, job);/* disapeared */ - - if
Re: Patch 3/3 - update userland to reflect DIOCRADDADDRS/DIOCRDELADDRS changes
On Wed, Oct 28, 2015 at 06:24:04PM +0100, Alexandr Nedvedicky wrote: > Index: usr.sbin/bgpd/pftable.c > === > RCS file: /cvs/src/usr.sbin/bgpd/pftable.c,v > retrieving revision 1.8 > diff -u -p -r1.8 pftable.c > --- usr.sbin/bgpd/pftable.c 21 Jan 2015 21:50:32 - 1.8 > +++ usr.sbin/bgpd/pftable.c 27 Oct 2015 23:54:49 - > @@ -57,6 +57,8 @@ pftable_change(struct pf_table *pft) > { > struct pfioc_table tio; > int ret; > + int i; > + struct pfr_addr *addr; > > if (pft->naddrs == 0 || pft->what == 0) > return (0); > @@ -67,11 +69,15 @@ pftable_change(struct pf_table *pft) > bzero(, sizeof(tio)); > strlcpy(tio.pfrio_table.pfrt_name, pft->name, > sizeof(tio.pfrio_table.pfrt_name)); > - tio.pfrio_buffer = pft->worklist; > tio.pfrio_esize = sizeof(*pft->worklist); > - tio.pfrio_size = pft->naddrs; > + tio.pfrio_size = 1; > > ret = ioctl(devpf, pft->what, ); This ioctl() uses an pfrio_buffer with 0. > + addr = pft->worklist; > + for (i = 0; (i < pft->naddrs) && (ret == 0); i++) { > + tio.pfrio_buffer = addr++; > + ret = ioctl(devpf, pft->what, ); > + } > > /* bad prefixes shouldn't cause us to die */ > if (ret == -1) { Perhaps we should not abort the loop on the first failure. Can we try to add all addresses and log a warning for each one that fails. The caller expects that pftable_change() is atomic. I am unsure what we should do in case of partial failure. Now the caller ignores the partiall success. bluhm
Re: [PATCH] add F13-F24 and colour support to console terminfo
If this is different from pccon*, you should fix those or add a variant rather than adding completely new entries. On Sun, Nov 08, 2015 at 11:55:23AM +, Tati Chevron wrote: > The terminfo entries used for X and for the console by a default install, > are broken for keyboards with function keys beyond F12, and for keyboards > with five cursor movement keys instead of the more common four. > > In addition, the VGA console supports colour, but the terminfo entry used > by default does not define the necessary escape sequences. > > Please find attached a patch against -current which defines three new > terminfo entries to fix these problems. > > --- termtypes.master.1.55.distSun Nov 8 11:40:24 2015 > +++ termtypes.master.1.55.custom Sun Nov 8 11:43:06 2015 > @@ -291,6 +291,51 @@ > # There are no guarantees anywhere. Svaha! > # > > + CUSTOM ENTRIES FOR OPENBSD-5.8 > +# > +# Three entries to allow the use of F1-F5, F13-F24 and colour on the > +# OpenBSD VGA framebuffer console, and the use of F13-F24 with the default > +# X config. > +# > +# In addition, the, 'home', key on a PC-122 keyboard is defined as, 'home', > +# on the console, to match the definition in X: > +# > +# On a standard PC keyboard, there are four cursor keys in an inverted, 'T', > +# whereas on a PC-122 keyboard there are five cursor keys: > +# > +# --- --- Legend > +# |^| |^| -- > +# --- --- > +# --- --- --- --- --- --- ^ - UP > +# |<| |V| |>| |<| |H| |>| V - DOWN > +# --- --- --- --- --- --- < - LEFT > +# --- > - RIGHT > +# |V| H - HOME > +# --- > +# > +# PC Keyboard PC-122 Keyboard > +# > +# The new entries in this file are as follows: > +# tati - OpenBSD console with F1-F24, 5-key cursor-key block, and colour. > +# tatimono - As above, but without colour support > +# tatiX - X11 xterm with F1-F24, (colour and 5-key cursor-key block were > +# already supported by the existing xterm entry. > + > +tatimono|OpenBSD console with F1-F24 without colour support, > + kf1=\E[11~, kf2=\E[12~, kf3=\E[13~, kf4=\E[14~, kf5=\E[15~, > + kf15=\E[28~, kf16=\E[29~, kf21=\E[35~, kf22=\E[36~, > + kf23=\E[37~, kf24=\E[38~, khome=\E[7~, khlp=, krdo=, use=vt220, > + > +tati|OpenBSD console with F1-F24 and colour, > + use=tatimono, use=ecma+color, > + > +tatiX|vt220-like entry that fixes behaviour of F13-F24 in X on OpenBSD, > + kf13=\E[25~, kf14=\E[26~, > + kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, > + kf19=\E[33~, kf20=\E[34~, kf21=\E[42~, kf22=\E[43~, > + kf23=\E[44~, kf24=\E[45~, khlp=, krdo=, use=xterm, > + > + > ANSI, UNIX CONSOLE, AND SPECIAL TYPES > # > # This section describes terminal classes and brands that are still > > -- > Tati Chevron > Perl and FORTRAN specialist. > SWABSIT development and migration department. > http://www.swabsit.com >
Re: [PATCH] add F13-F24 and colour support to console terminfo
On Sun, Nov 08, 2015 at 04:12:18PM +, Tati Chevron wrote: > On Sun, Nov 08, 2015 at 02:09:03PM +, Nicholas Marriott wrote: > >If this is different from pccon*, you should fix those or add a variant > >rather than adding completely new entries. > > OK. The attached diff does the following: > > * Add F13-F24 to pccon. > These were previously undefined. > * Change the sgr definition to match the vt220 entry. > This makes the, 'intense', colours work, giving us 16 instead of 8. > * Define the bold sequence. > Otherwise, E.G. 'echo foo | less', the ~ in column 0 are displayed as > reverse video instead of bold, (as they do in xterm). I think these are fine. Can you please send these upstream to Thomas Dickey or bug-ncur...@gnu.org? > * Add a new entry, 'pcconX', that adds F13-F24 to the standrd xterm entry Not this though - pccon* is for the console, not for use in xterm. I think you might want xterm-vt220? Although I don't know why our xterm function keys should be different from stock xterm. > > --- termtypes.master.1.55.distSun Nov 8 15:20:37 2015 > +++ termtypes.master Sun Nov 8 15:42:04 2015 > @@ -2184,13 +2184,16 @@ > kf4=\E[14~, kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, > kf9=\E[20~, khome=\E[7~, kich1=\E[2~, knp=\E[6~, kpp=\E[5~, > krfr=^R, > + kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, > + kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, kf20=\E[34~, > + kf21=\E[35~, kf22=\E[36~, kf23=\E[37~, kf24=\E[38~, > pccon+sgr+acs0|sgr and simple ASCII pseudographics for OpenBSD PC console, > acsc=+>\,<-\^.v0#`+a\:f\\h#i#j+k+l+m+n+o~p-q-r-s_t+u+v+w+x|y#z#{*|!}#~o, > sgr=\E[0%?%p1%p3%|%t;7%;m, sgr0=\E[m, > pccon+sgr+acs|sgr and default ASCII pseudographics for OpenBSD PC console, > acsc=++\,\,--..00``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, > enacs=\E)0$<5>, rmacs=\E(B$<5>, > - sgr=\E[0%?%p1%p3%|%t;7%;m%?%p9%t\E(0%e\E(B%;$<5>, > + > sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p4%t;5%;%?%p1%p3%|%t;7%;m%?%p9%t\E(0%e\E(B%;$<2>, > sgr0=\E[m\E(B$<5>, smacs=\E(0$<5>, > pccon+colors|ANSI colors for OpenBSD PC console, > bce, > @@ -2199,7 +2202,7 @@ > pccon+base|base capabilities for OpenBSD PC console, > am, km, mc5i, msgr, npc, nxon, xenl, xon, > cols#80, it#8, lines#24, > - bel=^G, clear=\E[H\E[J, cr=^M, cub1=^H, cud1=^J, cuf1=\E[C, > + bel=^G, bold=\E[1m, clear=\E[H\E[J, cr=^M, cub1=^H, cud1=^J, cuf1=\E[C, > cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch=\E[%p1%dP, > dch1=\E[P, dl1=\E[M, ech=\E[%p1%dX, ed=\E[J, el=\E[K, > el1=\E[1K, home=\E[H, ht=^I, hts=\EH, ich=\E[%p1%d@, > @@ -2214,6 +2217,11 @@ > use=pccon+base, use=pccon+sgr+acs, use=pccon+keys, > pccon|OpenBSD PC console, > use=pccon-m, use=pccon+colors, > +pcconX|xterm-like entry that fixes behaviour of F13-F24 in X on OpenBSD, > + kf13=\E[25~, kf14=\E[26~, > + kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, > + kf19=\E[33~, kf20=\E[34~, kf21=\E[42~, kf22=\E[43~, > + kf23=\E[44~, kf24=\E[45~, khlp=, krdo=, use=xterm, > > NetBSD consoles > # > > -- > Tati Chevron > Perl and FORTRAN specialist. > SWABSIT development and migration department. > http://www.swabsit.com
npppd(8): sync option parsing with other userland utils
Hello tech@ This patch brings npppd(8)'s option parsing in sync with all the other userland utils that don't recognize -h for help/usage (except for some games, still). Also exit(3) at the end of the usage() function and mark it as __dead. Greetings Ben Index: npppd/npppd.8 === RCS file: /cvs/src/usr.sbin/npppd/npppd/npppd.8,v retrieving revision 1.5 diff -u -p -r1.5 npppd.8 --- npppd/npppd.8 29 Jan 2013 15:42:20 - 1.5 +++ npppd/npppd.8 8 Nov 2015 20:30:35 - @@ -23,7 +23,7 @@ .Nd new Point-to-Point Protocol daemon .Sh SYNOPSIS .Nm npppd -.Op Fl dhn +.Op Fl dn .Op Fl f Ar config_file .Sh DESCRIPTION .Nm @@ -38,8 +38,6 @@ will run in the foreground and log to .Em stderr . .It Fl f Ar config_file Specify an alternative configuration file. -.It Fl h -Show the usage. .It Fl n Configtest mode. Only check the configuration file for validity. Index: npppd/npppd.c === RCS file: /cvs/src/usr.sbin/npppd/npppd/npppd.c,v retrieving revision 1.41 diff -u -p -r1.41 npppd.c --- npppd/npppd.c 24 Jun 2015 04:57:55 - 1.41 +++ npppd/npppd.c 8 Nov 2015 20:54:15 - @@ -145,7 +145,7 @@ main(int argc, char *argv[]) const char*npppd_conf0 = DEFAULT_NPPPD_CONF; struct passwd *pw; - while ((ch = getopt(argc, argv, "nf:dh")) != -1) { + while ((ch = getopt(argc, argv, "nf:d")) != -1) { switch (ch) { case 'n': nflag = 1; @@ -157,17 +157,14 @@ main(int argc, char *argv[]) debuglevel++; runasdaemon = 0; break; - case '?': - case 'h': + default: usage(); - exit(1); } } argc -= optind; argv += optind; if (argc != 0) { usage(); - exit(1); } if (nflag) { debuglevel++; @@ -225,10 +222,11 @@ main(int argc, char *argv[]) exit((!stop_by_error)? EXIT_SUCCESS : EXIT_FAILURE); } -static void -usage() +static __dead void +usage(void) { - fprintf(stderr, "usage: npppd [-dhn] [-f config_file]\n"); + fprintf(stderr, "usage: npppd [-dn] [-f config_file]\n"); + exit(1); } /** Returns the singleton npppd instance */
[patch] tcpdump print-ip print format tweaks
Change printf format strings to print unsigned values throughout print_ip.c. Precursor to future changes. Index: print-ip.c === RCS file: /cvs/src/usr.sbin/tcpdump/print-ip.c,v retrieving revision 1.44 diff -u -p -r1.44 print-ip.c --- print-ip.c 21 Aug 2015 02:07:32 - 1.44 +++ print-ip.c 8 Nov 2015 21:07:59 - @@ -127,22 +127,22 @@ static void print_mtrace(register const { register struct tr_query *tr = (struct tr_query *)(bp + 8); - printf("mtrace %d: %s to %s reply-to %s", tr->tr_qid, + printf("mtrace %u: %s to %s reply-to %s", tr->tr_qid, ipaddr_string(>tr_src), ipaddr_string(>tr_dst), ipaddr_string(>tr_raddr)); if (IN_CLASSD(ntohl(tr->tr_raddr))) - printf(" with-ttl %d", tr->tr_rttl); + printf(" with-ttl %u", tr->tr_rttl); } static void print_mresp(register const u_char *bp, register u_int len) { register struct tr_query *tr = (struct tr_query *)(bp + 8); - printf("mresp %d: %s to %s reply-to %s", tr->tr_qid, + printf("mresp %u: %s to %s reply-to %s", tr->tr_qid, ipaddr_string(>tr_src), ipaddr_string(>tr_dst), ipaddr_string(>tr_raddr)); if (IN_CLASSD(ntohl(tr->tr_raddr))) - printf(" with-ttl %d", tr->tr_rttl); + printf(" with-ttl %u", tr->tr_rttl); } static void @@ -163,12 +163,12 @@ igmp_print(register const u_char *bp, re if (*(int *)[4]) (void)printf(" [gaddr %s]", ipaddr_string([4])); if (len != 8) - (void)printf(" [len %d]", len); + (void)printf(" [len %u]", len); break; case 0x12: (void)printf("igmp report %s", ipaddr_string([4])); if (len != 8) - (void)printf(" [len %d]", len); + (void)printf(" [len %u]", len); break; case 0x16: (void)printf("igmp nreport %s", ipaddr_string([4])); @@ -179,7 +179,7 @@ igmp_print(register const u_char *bp, re case 0x13: (void)printf("igmp dvmrp"); if (len < 8) - (void)printf(" [len %d]", len); + (void)printf(" [len %u]", len); else dvmrp_print(bp, len); break; @@ -194,11 +194,11 @@ igmp_print(register const u_char *bp, re print_mtrace(bp, len); break; default: - (void)printf("igmp-%d", bp[0] & 0xf); + (void)printf("igmp-%u", bp[0] & 0xf); break; } if ((bp[0] >> 4) != 1) - (void)printf(" [v%d]", bp[0] >> 4); + (void)printf(" [v%u]", bp[0] >> 4); TCHECK2(bp[0], len); if (vflag) { @@ -233,9 +233,9 @@ ip_printroute(const char *type, register printf(" %s{", type); if ((length + 1) & 3) - printf(" [bad length %d]", length); + printf(" [bad length %u]", length); if (ptr < 3 || ((ptr + 1) & 3) || ptr > length + 1) - printf(" [bad ptr %d]", cp[2]); + printf(" [bad ptr %u]", cp[2]); type = ""; for (len = 3; len < length; len += 4) { @@ -261,7 +261,7 @@ ip_optprint(register const u_char *cp, u tt = *cp; len = (tt == IPOPT_NOP || tt == IPOPT_EOL) ? 1 : cp[1]; if (len <= 0) { - printf("[|ip op len %d]", len); + printf("[|ip op len %u]", len); return; } if ([1] >= snapend || cp + len > snapend) { @@ -273,7 +273,7 @@ ip_optprint(register const u_char *cp, u case IPOPT_EOL: printf(" EOL"); if (length > 1) - printf("-%d", length - 1); + printf("-%u", length - 1); return; case IPOPT_NOP: @@ -281,15 +281,15 @@ ip_optprint(register const u_char *cp, u break; case IPOPT_TS: - printf(" TS{%d}", len); + printf(" TS{%u}", len); break; case IPOPT_SECURITY: - printf(" SECURITY{%d}", len); + printf(" SECURITY{%u}", len); break; case IPOPT_RR: - printf(" RR{%d}=", len); + printf(" RR{%u}=", len); ip_printroute("RR", cp, len); break; @@ -302,7 +302,7 @@ ip_optprint(register const u_char *cp, u break; default: - printf(" IPOPT-%d{%d}", cp[0],
Periodically sync RTC
I would like to sync the system time periodically back to the RTC. Currently we update the RTC (1) when the time is set with clock_settime() or settimeofday(), which never happens for a typical ntpd setup, (2) before suspend, (3) when the system is properly shut down. This means if a machine has been running for a few months and it loses power, it may come back up with the time, say, 200 seconds off because of RTC drift, and then your SixXS tunnel won't come up and you can no longer reach your home network on the last day of u2k15. For example. FreeBSD uses a period of 30 minutes. I have no idea what a good number would be so I went with that. (Maybe a prime number of seconds?) FreeBSD also has a sysctl knob to change the period, which is silly. The patch below, inspired by FreeBSD, "seems to work for me", but I don't really know what I'm doing and if it's okay to just use a timeout(9) like that. Do I need a task? Any locking? I'm also uncertain where to put the hook to kick off the initial timeout_add(). Index: kern/init_main.c === RCS file: /cvs/src/sys/kern/init_main.c,v retrieving revision 1.246 diff -u -p -r1.246 init_main.c --- kern/init_main.c8 Nov 2015 20:45:57 - 1.246 +++ kern/init_main.c8 Nov 2015 21:06:47 - @@ -118,6 +118,8 @@ struct sigacts sigacts0; struct process *initprocess; struct proc *reaperproc; +void start_periodic_resettodr(void); + extern struct user *proc0paddr; struct vnode *rootvp, *swapdev_vp; @@ -550,6 +552,8 @@ main(void *framep) #if !(defined(__m88k__) && defined(MULTIPROCESSOR))/* XXX */ pool_gc_pages(NULL); #endif + + start_periodic_resettodr(); /* * proc0: nothing to do, back to sleep Index: kern/kern_time.c === RCS file: /cvs/src/sys/kern/kern_time.c,v retrieving revision 1.95 diff -u -p -r1.95 kern_time.c --- kern/kern_time.c1 Nov 2015 19:03:33 - 1.95 +++ kern/kern_time.c8 Nov 2015 16:46:46 - @@ -41,6 +41,7 @@ #include #include #include +#include #include #include @@ -792,3 +793,21 @@ ppsratecheck(struct timeval *lasttime, i return (rv); } + +#define RESETTODR_PERIOD 1800 + +void periodic_resettodr(void *); +struct timeout resettodr_to = TIMEOUT_INITIALIZER(periodic_resettodr, NULL); + +void +periodic_resettodr(void *arg __unused) +{ + resettodr(); + timeout_add_sec(_to, RESETTODR_PERIOD); +} + +void +start_periodic_resettodr(void) +{ + timeout_add_sec(_to, RESETTODR_PERIOD); +} -- Christian "naddy" Weisgerber na...@mips.inka.de
Re: [patch]apmd ? sign
> Date: Sun, 8 Nov 2015 22:42:19 +0100 > From: Fritjof Bornebusch> > On Wed, May 20, 2015 at 05:08:21PM +0200, Fritjof Bornebusch wrote: > > Ping Sorry. But I don't see the point. You think the case '?' is superfluous, others like me will see it serversas documentation. Any decent compiler will optimize them away. In the end it is just a matter of style and if there is no obvious benefit it's best to leave things as they are and avoid unnecessary churn. > > Index: apmd.c > > === > > RCS file: /cvs/src/usr.sbin/apmd/apmd.c,v > > retrieving revision 1.75 > > diff -u -p -r1.75 apmd.c > > --- apmd.c 6 Feb 2015 08:16:50 - 1.75 > > +++ apmd.c 20 May 2015 15:04:38 - > > @@ -403,7 +403,6 @@ main(int argc, char *argv[]) > > doperf = PERF_MANUAL; > > setperfpolicy("high"); > > break; > > - case '?': > > default: > > usage(); > > } > > >
[patch] tcpdump print-ipsec length checks
Fix multiple possible segfaults in the IPsec printer that could occur when EH/ESP/IPCOMP data extends past the captured length. ah_print(), esp_print(), and ipcomp_print now check if their header length will fall beyond the snapend boundry before accessing its members. ah_print() also additionally checks if the next header content will extend past the snapend boundry before printing the next payload. (This extends an existing truncation check.) Finally, changed the existing ah_print() payload printing length check to take into account that ah_hdr is not part of the payload length. This should make the orginal length check more effective/correct. Index: print-ipsec.c === RCS file: /cvs/src/usr.sbin/tcpdump/print-ipsec.c,v retrieving revision 1.22 diff -u -p -r1.22 print-ipsec.c --- print-ipsec.c 11 Oct 2015 03:23:28 - 1.22 +++ print-ipsec.c 8 Nov 2015 17:55:59 - @@ -222,7 +222,8 @@ esp_print (register const u_char *bp, re ipaddr_string(>ip_src), ipaddr_string(>ip_dst)); } - if (plen < sizeof(struct esp_hdr)) { + if (plen < sizeof(struct esp_hdr) || + bp + sizeof(struct esp_hdr) > snapend) { printf("[|esp]"); return; } @@ -270,7 +271,8 @@ ah_print (register const u_char *bp, reg ipaddr_string(>ip_src), ipaddr_string(>ip_dst)); } - if (pl_len < sizeof(struct ah_hdr)) { + if (pl_len < sizeof(struct ah_hdr) || + bp + sizeof(struct ah_hdr) > snapend) { printf("[|ah]"); return; } @@ -284,7 +286,8 @@ ah_print (register const u_char *bp, reg pl_len = (ah->ah_pl_len + 2) << 2; /* RFC2402, sec 2.2 */ - if (len <= pl_len) { + if (len - sizeof(struct ah_hdr) < pl_len || + bp + pl_len > snapend) { (void)printf("truncated"); goto out; } @@ -354,7 +357,8 @@ ipcomp_print (register const u_char *bp, printf("ipcomp %s > %s", ipaddr_string(>ip_src), ipaddr_string(>ip_dst)); - if (plen < sizeof(struct ipcomp_hdr)) { + if (plen < sizeof(struct ipcomp_hdr) || + bp + sizeof(struct ipcomp_hdr) > snapend) { printf("[|ipcomp]"); return; }
[patch] tcpdump print-atalk segfaults
Fix multiple segfaults in the AppleTalk printer when a packet structs extend past the actual captured length. Also add "const" to a struct cast to maintain consistency. Other issues to be addressed in future patches. Index: print-atalk.c === RCS file: /cvs/src/usr.sbin/tcpdump/print-atalk.c,v retrieving revision 1.29 diff -u -p -r1.29 print-atalk.c --- print-atalk.c 21 Aug 2015 02:07:32 - 1.29 +++ print-atalk.c 8 Nov 2015 21:05:17 - @@ -98,7 +98,7 @@ atalk_print(register const u_char *bp, u register const struct atDDP *dp; u_short snet; - if (length < ddpSize) { + if (length < ddpSize || !TTEST2(bp[0], sizeof(struct atDDP))) { (void)printf(" [|ddp %d]", length); return; } @@ -128,13 +128,18 @@ atalk_print_llap(register const u_char * register const struct atShortDDP *sdp; u_short snet; - lp = (struct LAP *)bp; + if (length < sizeof(struct LAP) || !TTEST2(bp[0], sizeof(struct LAP))) { + printf(" [|llap %u]", length); + return; + } + lp = (const struct LAP *)bp; bp += sizeof(*lp); length -= sizeof(*lp); switch (lp->type) { case lapShortDDP: - if (length < ddpSSize) { + if (length < ddpSSize || + !TTEST2(bp[0], sizeof(struct atShortDDP))) { (void)printf(" [|sddp %d]", length); return; } @@ -149,7 +154,7 @@ atalk_print_llap(register const u_char * break; case lapDDP: - if (length < ddpSize) { + if (length < ddpSize || !TTEST2(bp[0], sizeof(struct atDDP))) { (void)printf(" [|ddp %d]", length); return; } @@ -187,6 +192,11 @@ aarp_print(register const u_char *bp, u_ #define AT(member) ataddr_string((ap->member[1]<<8)|ap->member[2],ap->member[3]) printf("aarp "); + if (length < sizeof(struct aarp) || + !TTEST2(bp[0], sizeof(struct aarp))) { + printf(" [|aarp %u]", length); + return; + } ap = (const struct aarp *)bp; if (ntohs(ap->htype) == 1 && ntohs(ap->ptype) == ETHERTYPE_ATALK && ap->halen == 6 && ap->palen == 4 )
Re: [patch] tcpdump print-atalk segfaults
Kevin Reay: > Fix multiple segfaults in the AppleTalk printer when a packet structs > extend past the actual captured length. While you are there... In my tree, I'm still lugging along the patch below. This is strictly equivalent to mikeb@'s change "Catch up with the BPF_ALIGNMENT switch to the uint32_t" to print-{ip,ip6}.c eleven months ago, but he didn't want me to commit it without testing against actual AppleTalk traffic--which is unlikely to ever happen. Index: print-atalk.c === RCS file: /cvs/src/usr.sbin/tcpdump/print-atalk.c,v retrieving revision 1.29 diff -u -p -r1.29 print-atalk.c --- print-atalk.c 21 Aug 2015 02:07:32 - 1.29 +++ print-atalk.c 21 Aug 2015 14:55:27 - @@ -217,7 +217,7 @@ ddp_print(register const u_char *bp, reg register u_short snet, register u_char snode, u_char skt) { - if ((intptr_t)bp & (sizeof(long)-1)) { + if ((intptr_t)bp & (sizeof(u_int32_t)-1)) { static u_char *abuf = NULL; int clen = snapend - bp; if (clen > snaplen) -- Christian "naddy" Weisgerber na...@mips.inka.de
Re: [patch] return instead of exit(3) in src/bin/
On Mon, Aug 31, 2015 at 10:59:36PM +0200, Fritjof Bornebusch wrote: Ping > On Sun, Aug 30, 2015 at 08:01:02PM +0200, Fritjof Bornebusch wrote: > > As suggested by deraadt@ and tobias@ it might be better to use the *return* > > statement instead of exit(3) > > inside the *main* function, to let the stack protector do its work. > > > > This diff removes such calls in all *src/bin/* tools, except those who > > already use it. > > I think I didn't miss a call and didn't introduce any bugs. > > > > New diff with help from tobias@, as theo@ pointed me to a downside. > > > --F. > > > > > > Index: cat/cat.c > === > RCS file: /cvs/src/bin/cat/cat.c,v > retrieving revision 1.21 > diff -u -p -r1.21 cat.c > --- cat/cat.c 16 Jan 2015 06:39:28 - 1.21 > +++ cat/cat.c 31 Aug 2015 20:44:20 - > @@ -103,8 +103,7 @@ main(int argc, char *argv[]) > raw_args(argv); > if (fclose(stdout)) > err(1, "stdout"); > - exit(rval); > - /* NOTREACHED */ > + return (rval); > } > > void > Index: chio/chio.c > === > RCS file: /cvs/src/bin/chio/chio.c,v > retrieving revision 1.25 > diff -u -p -r1.25 chio.c > --- chio/chio.c 16 Mar 2014 18:38:30 - 1.25 > +++ chio/chio.c 31 Aug 2015 20:44:21 - > @@ -148,7 +148,7 @@ main(int argc, char *argv[]) > if (commands[i].cc_name == NULL) > errx(1, "unknown command: %s", *argv); > > - exit((*commands[i].cc_handler)(commands[i].cc_name, argc, argv)); > + return ((*commands[i].cc_handler)(commands[i].cc_name, argc, argv)); > } > > static int > Index: chmod/chmod.c > === > RCS file: /cvs/src/bin/chmod/chmod.c,v > retrieving revision 1.34 > diff -u -p -r1.34 chmod.c > --- chmod/chmod.c 25 Jun 2015 02:04:08 - 1.34 > +++ chmod/chmod.c 31 Aug 2015 20:44:22 - > @@ -279,7 +279,7 @@ done: > if (errno) > err(1, "fts_read"); > fts_close(ftsp); > - exit(rval); > + return (rval); > } > > /* > Index: cp/cp.c > === > RCS file: /cvs/src/bin/cp/cp.c,v > retrieving revision 1.38 > diff -u -p -r1.38 cp.c > --- cp/cp.c 7 May 2015 17:32:20 - 1.38 > +++ cp/cp.c 31 Aug 2015 20:44:22 - > @@ -224,7 +224,7 @@ main(int argc, char *argv[]) > type = FILE_TO_DIR; > } > > - exit(copy(argv, type, fts_options)); > + return (copy(argv, type, fts_options)); > } > > char * > Index: date/date.c > === > RCS file: /cvs/src/bin/date/date.c,v > retrieving revision 1.47 > diff -u -p -r1.47 date.c > --- date/date.c 17 Apr 2015 16:47:47 - 1.47 > +++ date/date.c 31 Aug 2015 20:44:22 - > @@ -143,7 +143,7 @@ main(int argc, char *argv[]) > errx(1, "conversion error"); > (void)strftime(buf, sizeof(buf), format, tp); > (void)printf("%s\n", buf); > - exit(0); > + return (0); > } > > #define ATOI2(ar) ((ar) += 2, ((ar)[-2] - '0') * 10 + ((ar)[-1] - > '0')) > Index: dd/dd.c > === > RCS file: /cvs/src/bin/dd/dd.c,v > retrieving revision 1.21 > diff -u -p -r1.21 dd.c > --- dd/dd.c 16 Jan 2015 06:39:31 - 1.21 > +++ dd/dd.c 31 Aug 2015 20:44:22 - > @@ -85,7 +85,7 @@ main(int argc, char *argv[]) > } > > dd_close(); > - exit(0); > + return (0); > } > > static void > Index: df/df.c > === > RCS file: /cvs/src/bin/df/df.c,v > retrieving revision 1.52 > diff -u -p -r1.52 df.c > --- df/df.c 16 Jan 2015 06:39:31 - 1.52 > +++ df/df.c 31 Aug 2015 20:44:23 - > @@ -175,7 +175,7 @@ main(int argc, char *argv[]) > bsdprint(mntbuf, mntsize, maxwidth); > } > > - exit(mntsize ? 0 : 1); > + return (mntsize ? 0 : 1); > } > > char * > Index: domainname/domainname.c > === > RCS file: /cvs/src/bin/domainname/domainname.c,v > retrieving revision 1.9 > diff -u -p -r1.9 domainname.c > --- domainname/domainname.c 16 Jan 2015 06:39:31 - 1.9 > +++ domainname/domainname.c 31 Aug 2015 20:44:23 - > @@ -66,7 +66,7 @@ main(int argc, char *argv[]) > err(1, "getdomainname"); > (void)printf("%s\n", domainname); > } > - exit(0); > + return (0); > } > > void > Index: expr/expr.c > === > RCS file: /cvs/src/bin/expr/expr.c,v > retrieving revision 1.20 > diff -u -p -r1.20 expr.c > --- expr/expr.c 11 Aug 2015 17:15:46 - 1.20 > +++
export directive in make
GNU make and NetBSD's bmake (which is also used by FreeBSD) support this. This is based on the implementation from bmake. Index: usr.bin/make/config.h === RCS file: /cvs/src/usr.bin/make/config.h,v retrieving revision 1.20 diff -u -p -u -r1.20 config.h --- usr.bin/make/config.h 18 Oct 2014 07:50:06 - 1.20 +++ usr.bin/make/config.h 8 Nov 2015 20:17:13 - @@ -64,6 +64,12 @@ #define SYSVVARSUB /* + * GMAKEEXPORT + * Recognize gmake like variable export directives [export =] + */ +#define GMAKEEXPORT + +/* * SUNSHCMD * Recognize SunOS and Solaris: * VAR :sh= CMD# Assign VAR to the command substitution of CMD @@ -94,6 +100,11 @@ #else #define DOFEATURE_SYSVVARSUB 0 #endif +#ifdef GMAKEEXPORT +#define DOFEATURE_GMAKEEXPORT FEATURE_GMAKEEXPORT +#else +#define DOFEATURE_GMAKEEXPORT 0 +#endif #ifdef SUNSHCMD #define DOFEATURE_SUNSHCMD FEATURE_SUNSHCMD #else @@ -101,7 +112,10 @@ #endif #ifndef DEFAULT_FEATURES -#define DEFAULT_FEATURES (FEATURE_UPPERLOWER | DOFEATURE_SYSVVARSUB | DOFEATURE_SYSVINCLUDE | DOFEATURE_SUNSHCMD | FEATURE_RECVARS | FEATURE_CONDINCLUDE) +#define DEFAULT_FEATURES (FEATURE_UPPERLOWER | DOFEATURE_SYSVVARSUB | \ +DOFEATURE_SYSVINCLUDE | DOFEATURE_SUNSHCMD | \ +FEATURE_RECVARS | FEATURE_CONDINCLUDE | \ +DOFEATURE_GMAKEEXPORT) #endif #define FEATURES(x)((DEFAULT_FEATURES & (x)) != 0) @@ -116,6 +130,7 @@ #define FEATURE_CONDINCLUDE256 #define FEATURE_ASSIGN 512 #define FEATURE_EXECMOD1024 +#define FEATURE_GMAKEEXPORT2048 /* * There are several places where expandable buffers are used (parse.c and Index: usr.bin/make/parse.c === RCS file: /cvs/src/usr.bin/make/parse.c,v retrieving revision 1.112 diff -u -p -u -r1.112 parse.c --- usr.bin/make/parse.c23 Jan 2015 22:35:57 - 1.112 +++ usr.bin/make/parse.c8 Nov 2015 20:17:13 - @@ -151,6 +151,7 @@ static bool lookup_bsd_include(const cha static void lookup_sysv_style_include(const char *, const char *, bool); static void lookup_sysv_include(const char *, const char *); static void lookup_conditional_include(const char *, const char *); +static void handle_gmake_export(char *, const char *); static bool parse_as_special_line(Buffer, Buffer, const char *); static unsigned int parse_operator(const char **); @@ -1226,6 +1227,28 @@ lookup_conditional_include(const char *f lookup_sysv_style_include(file, directive, false); } +static void +handle_gmake_export(char *line, const char *directive) +{ + char *variable = line; + char *value; + + while (isspace((unsigned char)*variable)) + variable++; + + for (value = variable; *value && *value != '='; value++) + continue; + + if (*value != '=') { + Parse_Error(PARSE_FATAL, + "Variable/Value missing from \"%s\"", directive); + return; + } + *value++ = '\0'; + + value = Var_Subst(value, NULL, false); + setenv(variable, value, 1); +} /*** *** BSD-specific . constructs @@ -1469,6 +1492,13 @@ parse_as_special_line(Buffer buf, Buffer ISSPACE(line[8]) && strchr(line, ':') == NULL) { lookup_conditional_include(line+8, "-include"); + return true; + } + if (FEATURES(FEATURE_GMAKEEXPORT) && + strncmp(line, "export", 6) == 0 && + ISSPACE(line[6]) && + strchr(line, ':') == NULL) { + handle_gmake_export((char *)line+6, "export"); return true; } return false; Index: usr.bin/make/make.1 === RCS file: /cvs/src/usr.bin/make/make.1,v retrieving revision 1.120 diff -u -p -u -r1.120 make.1 --- usr.bin/make/make.1 13 Mar 2015 19:58:41 - 1.120 +++ usr.bin/make/make.1 8 Nov 2015 20:17:13 - @@ -974,6 +974,14 @@ in .At V variable substitutions is not mandated by POSIX, though it is fairly common. +.Pp +The +.Ic export +directive can be used to export a variable to the environment, +using the syntax: +.Bd -unfilled -offset indent +.Ic export Ar NAME Ns = Ns Ar value +.Ed .Sh INCLUDE STATEMENTS, CONDITIONALS AND FOR LOOPS Makefile inclusion, conditional structures and for loops reminiscent of the C programming language are provided in -- Carlin
Re: [patch]rcs: usage functions above the main ones
On Mon, Jun 15, 2015 at 11:42:10AM +0100, Nicholas Marriott wrote: Ping ... > > this seems fine to me > > > On Sun, Jun 14, 2015 at 10:38:40PM +0200, Fritjof Bornebusch wrote: > > Hi tech@, > > > > most of the tools implements the *usage* function above the *main* function. > > This patch makes it more consistent to these tools and where the different > > *usage* > > functions are implemented in rcs in general. > > > > Any comments? > > > > Regards, > > --F. > > > > > > Index: co.c > > === > > RCS file: /cvs/src/usr.bin/rcs/co.c,v > > retrieving revision 1.121 > > diff -u -p -r1.121 co.c > > --- co.c13 Jun 2015 20:15:21 - 1.121 > > +++ co.c14 Jun 2015 20:21:41 - > > @@ -43,6 +43,17 @@ static void checkout_err_nobranch(RCSFIL > > const char *, int); > > static int checkout_file_has_diffs(RCSFILE *, RCSNUM *, const char *); > > > > +__dead void > > +checkout_usage(void) > > +{ > > + fprintf(stderr, > > + "usage: co [-TV] [-ddate] [-f[rev]] [-I[rev]] [-kmode] [-l[rev]]\n" > > + " [-M[rev]] [-p[rev]] [-q[rev]] [-r[rev]] [-sstate]\n" > > + " [-u[rev]] [-w[user]] [-xsuffixes] [-ztz] file ...\n"); > > + > > + exit(1); > > +} > > + > > int > > checkout_main(int argc, char **argv) > > { > > @@ -216,17 +227,6 @@ checkout_main(int argc, char **argv) > > } > > > > return (ret); > > -} > > - > > -__dead void > > -checkout_usage(void) > > -{ > > - fprintf(stderr, > > - "usage: co [-TV] [-ddate] [-f[rev]] [-I[rev]] [-kmode] [-l[rev]]\n" > > - " [-M[rev]] [-p[rev]] [-q[rev]] [-r[rev]] [-sstate]\n" > > - " [-u[rev]] [-w[user]] [-xsuffixes] [-ztz] file ...\n"); > > - > > - exit(1); > > } > > > > /* > > Index: ident.c > > === > > RCS file: /cvs/src/usr.bin/rcs/ident.c,v > > retrieving revision 1.30 > > diff -u -p -r1.30 ident.c > > --- ident.c 2 Oct 2014 06:23:15 - 1.30 > > +++ ident.c 14 Jun 2015 20:21:41 - > > @@ -41,6 +41,14 @@ static int flags = 0; > > static voidident_file(const char *, FILE *); > > static voidident_line(FILE *); > > > > +__dead void > > +ident_usage(void) > > +{ > > + fprintf(stderr, "usage: ident [-qV] [file ...]\n"); > > + > > + exit(1); > > +} > > + > > int > > ident_main(int argc, char **argv) > > { > > @@ -158,12 +166,4 @@ ident_line(FILE *fp) > > out: > > if (bp != NULL) > > buf_free(bp); > > -} > > - > > -__dead void > > -ident_usage(void) > > -{ > > - fprintf(stderr, "usage: ident [-qV] [file ...]\n"); > > - > > - exit(1); > > } > > Index: merge.c > > === > > RCS file: /cvs/src/usr.bin/rcs/merge.c,v > > retrieving revision 1.9 > > diff -u -p -r1.9 merge.c > > --- merge.c 10 Oct 2014 08:15:25 - 1.9 > > +++ merge.c 14 Jun 2015 20:21:41 - > > @@ -32,6 +32,15 @@ > > #include "rcsprog.h" > > #include "diff.h" > > > > +__dead void > > +merge_usage(void) > > +{ > > + fprintf(stderr, > > + "usage: merge [-EepqV] [-L label] file1 file2 file3\n"); > > + > > + exit(D_ERROR); > > +} > > + > > int > > merge_main(int argc, char **argv) > > { > > @@ -108,13 +117,4 @@ merge_main(int argc, char **argv) > > buf_free(bp); > > > > return (status); > > -} > > - > > -__dead void > > -merge_usage(void) > > -{ > > - (void)fprintf(stderr, > > - "usage: merge [-EepqV] [-L label] file1 file2 file3\n"); > > - > > - exit(D_ERROR); > > } > > Index: rcsclean.c > > === > > RCS file: /cvs/src/usr.bin/rcs/rcsclean.c,v > > retrieving revision 1.54 > > diff -u -p -r1.54 rcsclean.c > > --- rcsclean.c 16 Jan 2015 06:40:11 - 1.54 > > +++ rcsclean.c 14 Jun 2015 20:21:41 - > > @@ -43,6 +43,16 @@ static int uflag = 0; > > static int flags = 0; > > static char *locker = NULL; > > > > +__dead void > > +rcsclean_usage(void) > > +{ > > + fprintf(stderr, > > + "usage: rcsclean [-TV] [-kmode] [-n[rev]] [-q[rev]] [-r[rev]]\n" > > + "[-u[rev]] [-xsuffixes] [-ztz] [file ...]\n"); > > + > > + exit(1); > > +} > > + > > int > > rcsclean_main(int argc, char **argv) > > { > > @@ -116,16 +126,6 @@ rcsclean_main(int argc, char **argv) > > rcsclean_file(argv[i], rev_str); > > > > return (0); > > -} > > - > > -__dead void > > -rcsclean_usage(void) > > -{ > > - fprintf(stderr, > > - "usage: rcsclean [-TV] [-kmode] [-n[rev]] [-q[rev]] [-r[rev]]\n" > > - "[-u[rev]] [-xsuffixes] [-ztz] [file ...]\n"); > > - > > - exit(1); > > } > > > > static void > > Index: rcsdiff.c > > === > > RCS file: /cvs/src/usr.bin/rcs/rcsdiff.c,v > > retrieving revision 1.83 > >
[frit...@alokat.org: Re: [patch] lpr atoi -> strtonum]
- Forwarded message from Fritjof Bornebusch- Date: Sat, 26 Sep 2015 22:00:58 +0200 From: Fritjof Bornebusch To: Michael Reed Cc: tech@openbsd.org Subject: Re: [patch] lpr atoi -> strtonum On Fri, Sep 25, 2015 at 02:23:21PM -0400, Michael Reed wrote: Ping > Hi Fritjof, > Hi Michael, > I left one comment inline. > thanks. > On 09/25/15 08:18, Fritjof Bornebusch wrote: > > Hi, > > > > change atoi(3) -> strtonum(3) in lpr(1) and lprm(1). > > lprm(1) avoids negative numbers to be the first argument by using getopt(3), > > but supported values like 2.2. > > > > --F. > > > > > > Index: lpr/lpr.c > > === > > RCS file: /cvs/src/usr.sbin/lpr/lpr/lpr.c,v > > retrieving revision 1.48 > > diff -u -p -r1.48 lpr.c > > --- lpr/lpr.c 9 Feb 2015 23:00:14 - 1.48 > > +++ lpr/lpr.c 25 Sep 2015 12:08:57 - > > @@ -112,6 +112,7 @@ main(int argc, char **argv) > > char buf[PATH_MAX]; > > int i, f, ch; > > struct stat stb; > > + const char *errstr; > > > > /* > > * Simulate setuid daemon w/ PRIV_END called. > > @@ -145,11 +146,11 @@ main(int argc, char **argv) > > switch (ch) { > > > > case '#': /* n copies */ > > - if (isdigit((unsigned char)*optarg)) { > > - i = atoi(optarg); > > - if (i > 0) > > - ncopies = i; > > - } > > + i = strtonum(optarg, 0, INT_MAX, ); > > + if (errstr) > > + errx(1, "invalid quantity number"); > > + if (i > 0) > > + ncopies = i; > > I might be missing something, but why silently allow -#0 ? The default value is 1 and if -#0 is called, this default value is used. Disallow -#0 silently makes this default value useless. And other BSD versions of lpr(1) uses this default value: https://svnweb.freebsd.org/base/head/usr.sbin/lpr/lpr/lpr.c?revision=275855=co http://gitweb.dragonflybsd.org/dragonfly.git/blob_plain/HEAD:/usr.sbin/lpr/lpr/lpr.c http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/usr.sbin/lpr/lpr/lpr.c?rev=1.46=text/plain_with_tag=MAIN So I think this behavior should not be changed. The above versions redirect negative values to 1 as well, but calling -#-1 looks wrong (what should lpr(1) print, if -1 copies are requested), so I think starting from 0 is okay. > Besides that, this isn't as informative as it could be IMO; perhaps > this is better: > > case '#': /* n copies */ > ncopies = strtonum(optarg, 1, INT_MAX, ); > if (errstr) > errx(1, "number of copies %s: %s", errstr, optarg); > break; > > > break; > > > > case '4': /* troff fonts */ > > @@ -203,7 +204,9 @@ main(int argc, char **argv) > > > > case 'i': /* indent output */ > > iflag++; > > - indent = atoi(optarg); > > + indent = strtonum(optarg, 0, INT_MAX, ); > > + if (errstr) > > + errx(1, "invalid number"); > > if (indent < 0) > > indent = 8; > > break; > > Index: lprm/lprm.c > > === > > RCS file: /cvs/src/usr.sbin/lpr/lprm/lprm.c,v > > retrieving revision 1.21 > > diff -u -p -r1.21 lprm.c > > --- lprm/lprm.c 16 Jan 2015 06:40:18 - 1.21 > > +++ lprm/lprm.c 25 Sep 2015 12:08:57 - > > @@ -77,8 +77,9 @@ main(int argc, char **argv) > > { > > struct passwd *pw; > > char *cp; > > + const char *errstr; > > long l; > > - int ch; > > + int ch, i; > > > > /* > > * Simulate setuid daemon w/ PRIV_END called. > > @@ -135,7 +136,10 @@ main(int argc, char **argv) > > if (isdigit((unsigned char)*argv[0])) { > > if (requests >= MAXREQUESTS) > > fatal("Too many requests"); > > - requ[requests++] = atoi(argv[0]); > > + i = strtonum(argv[0], 0, INT_MAX, ); > > + if (errstr) > > + fatal("invalid job number"); > > + requ[requests++] = i; > > } else { > > if (users >= MAXUSERS) > > fatal("Too many users"); > > > - End forwarded message -
Re: [PATCH] add F13-F24 and colour support to console terminfo
Hi, On Sun, Nov 08, 2015 at 08:18:55PM +, Nicholas Marriott wrote: Hi I think it should be Shift-F1 etc, but since this is a general problem with the xterm entry not just on OpenBSD, I suggest you discuss it with upstream. The terminfo database is maintained as part of ncurses. OK, I'll look into that, and maintain a local patch here for X for the time being. Is there any reason why the OpenBSD installer still defaults to a terminal type of vt-220 for the VGA framebuffer console, and doesn't even suggest pccon as an alternative? -- Tati Chevron Perl and FORTRAN specialist. SWABSIT development and migration department. http://www.swabsit.com
Re: [patch]rcs: mark unlink as (void)
On Mon, Jun 15, 2015 at 09:56:18PM +0200, Fritjof Bornebusch wrote: Ping ... > Hi tech@, > > mark this unlink(2) call as *(void)*, as there is no need to check the return > value. > This makes it more consistent to all other unlink(2) calls, since they are > marked as *(void)* as > well. > > Regards, > --F. > > > Index: co.c > === > RCS file: /cvs/src/usr.bin/rcs/co.c,v > retrieving revision 1.121 > diff -u -p -r1.121 co.c > --- co.c 13 Jun 2015 20:15:21 - 1.121 > +++ co.c 15 Jun 2015 19:50:12 - > @@ -553,7 +553,7 @@ checkout_file_has_diffs(RCSFILE *rfp, RC > ret = diffreg(dst, tempfile, bp, D_FORCEASCII); > > buf_free(bp); > - unlink(tempfile); > + (void)unlink(tempfile); > free(tempfile); > > return (ret); >
remove superfluous case '?': from /sbin utils
Hello tech@ I cleaned up and split up my former diff[0] for removing superfluous case '?': /*FALLTHROUGH*/ default: usage(); Also removes one unnecessary break; This is for /sbin, more to come if there are any takers? Greetings Ben [0] https://marc.info/?l=openbsd-tech=143387215328391=2 Index: disklabel/disklabel.c === RCS file: /cvs/src/sbin/disklabel/disklabel.c,v retrieving revision 1.211 diff -u -p -r1.211 disklabel.c --- disklabel/disklabel.c 17 Oct 2015 13:27:08 - 1.211 +++ disklabel/disklabel.c 8 Nov 2015 09:38:05 - @@ -169,7 +169,6 @@ main(int argc, char *argv[]) case 'v': verbose = 1; break; - case '?': default: usage(); } Index: dmesg/dmesg.c === RCS file: /cvs/src/sbin/dmesg/dmesg.c,v retrieving revision 1.27 diff -u -p -r1.27 dmesg.c --- dmesg/dmesg.c 9 Oct 2015 01:37:06 - 1.27 +++ dmesg/dmesg.c 8 Nov 2015 09:38:05 - @@ -81,7 +81,6 @@ main(int argc, char *argv[]) case 'N': nlistf = optarg; break; - case '?': default: usage(); } Index: dumpfs/dumpfs.c === RCS file: /cvs/src/sbin/dumpfs/dumpfs.c,v retrieving revision 1.32 diff -u -p -r1.32 dumpfs.c --- dumpfs/dumpfs.c 20 Jan 2015 18:22:21 - 1.32 +++ dumpfs/dumpfs.c 8 Nov 2015 09:38:05 - @@ -89,7 +89,6 @@ main(int argc, char *argv[]) case 'm': domarshal = 1; break; - case '?': default: usage(); } Index: fsck/fsck.c === RCS file: /cvs/src/sbin/fsck/fsck.c,v retrieving revision 1.37 diff -u -p -r1.37 fsck.c --- fsck/fsck.c 29 May 2015 15:57:36 - 1.37 +++ fsck/fsck.c 8 Nov 2015 09:38:05 - @@ -163,7 +163,6 @@ main(int argc, char *argv[]) filter = NET_FILTER; break; - case '?': default: usage(); /* NOTREACHED */ Index: growfs/growfs.c === RCS file: /cvs/src/sbin/growfs/growfs.c,v retrieving revision 1.40 diff -u -p -r1.40 growfs.c --- growfs/growfs.c 20 Aug 2015 22:02:21 - 1.40 +++ growfs/growfs.c 8 Nov 2015 09:38:05 - @@ -1937,8 +1937,6 @@ main(int argc, char **argv) case 'y': ExpertFlag = 1; break; - case '?': - /* FALLTHROUGH */ default: usage(); } Index: isakmpd/isakmpd.c === RCS file: /cvs/src/sbin/isakmpd/isakmpd.c,v retrieving revision 1.103 diff -u -p -r1.103 isakmpd.c --- isakmpd/isakmpd.c 20 Aug 2015 22:02:21 - 1.103 +++ isakmpd/isakmpd.c 8 Nov 2015 09:38:05 - @@ -210,7 +210,6 @@ parse_args(int argc, char *argv[]) verbose_logging = 1; break; - case '?': default: usage(); } Index: mknod/mknod.c === RCS file: /cvs/src/sbin/mknod/mknod.c,v retrieving revision 1.18 diff -u -p -r1.18 mknod.c --- mknod/mknod.c 27 Mar 2010 09:10:02 - 1.18 +++ mknod/mknod.c 8 Nov 2015 09:38:05 - @@ -76,7 +76,6 @@ main(int argc, char *argv[]) mode = getmode(set, DEFFILEMODE); free(set); break; - case '?': default: usage(ismkfifo); } Index: mount/mount.c === RCS file: /cvs/src/sbin/mount/mount.c,v retrieving revision 1.60 diff -u -p -r1.60 mount.c --- mount/mount.c 16 Jan 2015 06:39:59 - 1.60 +++ mount/mount.c 8 Nov 2015 09:38:05 - @@ -157,7 +157,6 @@ main(int argc, char * const argv[]) if (!hasopt(options, "rw")) options = catopt(options, "rw"); break; - case '?': default: usage(); /* NOTREACHED */ Index: mount_cd9660/mount_cd9660.c === RCS file: /cvs/src/sbin/mount_cd9660/mount_cd9660.c,v retrieving revision 1.21 diff -u
Part2: remove superfluous case '?': from /usr/bin utils
Hello tech@ Part 2 for /usr/bin Also adjust getopt(3)'s optstring in midiplay.c and usbhid.c Greetings Ben Index: biff/biff.c === RCS file: /cvs/src/usr.bin/biff/biff.c,v retrieving revision 1.13 diff -u -p -r1.13 biff.c --- biff/biff.c 12 Oct 2015 20:03:24 - 1.13 +++ biff/biff.c 8 Nov 2015 09:38:05 - @@ -54,7 +54,6 @@ main(int argc, char *argv[]) while ((ch = getopt(argc, argv, "")) != -1) switch(ch) { - case '?': default: usage(); } Index: cal/cal.c === RCS file: /cvs/src/usr.bin/cal/cal.c,v retrieving revision 1.30 diff -u -p -r1.30 cal.c --- cal/cal.c 9 Oct 2015 01:37:06 - 1.30 +++ cal/cal.c 8 Nov 2015 09:38:05 - @@ -168,7 +168,6 @@ main(int argc, char *argv[]) case 'y': yflag = 1; break; - case '?': default: usage(); } Index: cap_mkdb/cap_mkdb.c === RCS file: /cvs/src/usr.bin/cap_mkdb/cap_mkdb.c,v retrieving revision 1.20 diff -u -p -r1.20 cap_mkdb.c --- cap_mkdb/cap_mkdb.c 29 Oct 2015 02:58:00 - 1.20 +++ cap_mkdb/cap_mkdb.c 8 Nov 2015 09:38:05 - @@ -92,7 +92,6 @@ main(int argc, char *argv[]) case 'i': info = 1; break; - case '?': default: usage(); } Index: chpass/chpass.c === RCS file: /cvs/src/usr.bin/chpass/chpass.c,v retrieving revision 1.41 diff -u -p -r1.41 chpass.c --- chpass/chpass.c 16 Jan 2015 06:40:06 - 1.41 +++ chpass/chpass.c 8 Nov 2015 09:38:05 - @@ -103,7 +103,6 @@ main(int argc, char *argv[]) force_yp = 1; break; #endif - case '?': default: usage(); } Index: cmp/cmp.c === RCS file: /cvs/src/usr.bin/cmp/cmp.c,v retrieving revision 1.13 diff -u -p -r1.13 cmp.c --- cmp/cmp.c 10 Oct 2015 05:35:22 - 1.13 +++ cmp/cmp.c 8 Nov 2015 09:38:05 - @@ -68,7 +68,6 @@ main(int argc, char *argv[]) case 's': /* silent run */ sflag = 1; break; - case '?': default: usage(); } Index: col/col.c === RCS file: /cvs/src/usr.bin/col/col.c,v retrieving revision 1.19 diff -u -p -r1.19 col.c --- col/col.c 9 Oct 2015 01:37:06 - 1.19 +++ col/col.c 8 Nov 2015 09:38:05 - @@ -139,7 +139,6 @@ main(int argc, char *argv[]) case 'x': /* do not compress spaces into tabs */ compress_spaces = 0; break; - case '?': default: usage(); } Index: colrm/colrm.c === RCS file: /cvs/src/usr.bin/colrm/colrm.c,v retrieving revision 1.11 diff -u -p -r1.11 colrm.c --- colrm/colrm.c 9 Oct 2015 01:37:06 - 1.11 +++ colrm/colrm.c 8 Nov 2015 09:38:05 - @@ -57,7 +57,6 @@ main(int argc, char *argv[]) while ((ch = getopt(argc, argv, "")) != -1) switch(ch) { - case '?': default: usage(); } Index: column/column.c === RCS file: /cvs/src/usr.bin/column/column.c,v retrieving revision 1.22 diff -u -p -r1.22 column.c --- column/column.c 3 Nov 2015 04:55:44 - 1.22 +++ column/column.c 8 Nov 2015 09:38:05 - @@ -96,7 +96,6 @@ main(int argc, char *argv[]) case 'x': xflag = 1; break; - case '?': default: usage(); } Index: comm/comm.c === RCS file: /cvs/src/usr.bin/comm/comm.c,v retrieving revision 1.10 diff -u -p -r1.10 comm.c --- comm/comm.c 9 Oct 2015 01:37:07 - 1.10 +++ comm/comm.c 8 Nov 2015 09:38:05 - @@ -80,7 +80,6 @@ main(int argc, char *argv[]) case 'f': compare = strcasecmp; break; - case '?': default: usage(); } Index: ctags/ctags.c ===
Part3: remove superfluous case '?': from /usr/sbin utils
Hello tech@ Part 3 for /usr/sbin Also adjust getopt(3)'s optstring in usbdevs.c and remove some unnecessary break; Greetings Ben Index: ac/ac.c === RCS file: /cvs/src/usr.sbin/ac/ac.c,v retrieving revision 1.24 diff -u -p -r1.24 ac.c --- ac/ac.c 12 Oct 2015 02:02:00 - 1.24 +++ ac/ac.c 8 Nov 2015 20:09:57 - @@ -223,10 +223,8 @@ main(int argc, char *argv[]) case 'w': fp = file(optarg); break; - case '?': default: usage(); - break; } } if (optind < argc) { Index: accton/accton.c === RCS file: /cvs/src/usr.sbin/accton/accton.c,v retrieving revision 1.8 diff -u -p -r1.8 accton.c --- accton/accton.c 27 Oct 2009 23:59:50 - 1.8 +++ accton/accton.c 8 Nov 2015 09:39:22 - @@ -50,7 +50,6 @@ main(int argc, char *argv[]) while ((ch = getopt(argc, argv, "")) != -1) switch(ch) { - case '?': default: usage(); } Index: apmd/apmd.c === RCS file: /cvs/src/usr.sbin/apmd/apmd.c,v retrieving revision 1.77 diff -u -p -r1.77 apmd.c --- apmd/apmd.c 11 Oct 2015 20:23:49 - 1.77 +++ apmd/apmd.c 8 Nov 2015 09:39:22 - @@ -402,7 +402,6 @@ main(int argc, char *argv[]) doperf = PERF_MANUAL; setperfpolicy("high"); break; - case '?': default: usage(); } Index: dev_mkdb/dev_mkdb.c === RCS file: /cvs/src/usr.sbin/dev_mkdb/dev_mkdb.c,v retrieving revision 1.15 diff -u -p -r1.15 dev_mkdb.c --- dev_mkdb/dev_mkdb.c 16 Oct 2015 13:37:44 - 1.15 +++ dev_mkdb/dev_mkdb.c 8 Nov 2015 09:39:22 - @@ -66,7 +66,6 @@ main(int argc, char *argv[]) while ((ch = getopt(argc, argv, "")) != -1) switch(ch) { - case '?': default: usage(); } Index: eeprom/main.c === RCS file: /cvs/src/usr.sbin/eeprom/main.c,v retrieving revision 1.22 diff -u -p -r1.22 main.c --- eeprom/main.c 11 Mar 2015 18:12:27 - 1.22 +++ eeprom/main.c 8 Nov 2015 09:39:22 - @@ -145,7 +145,6 @@ main(int argc, char *argv[]) break; #endif /* __sparc__ && !__sparc64__ */ - case '?': default: usage(); } Index: fdformat/fdformat.c === RCS file: /cvs/src/usr.sbin/fdformat/fdformat.c,v retrieving revision 1.20 diff -u -p -r1.20 fdformat.c --- fdformat/fdformat.c 18 Apr 2015 18:28:38 - 1.20 +++ fdformat/fdformat.c 8 Nov 2015 09:39:22 - @@ -253,7 +253,7 @@ main(int argc, char *argv[]) verify_only = 1; break; - case '?': default: + default: usage(); } Index: hotplugd/hotplugd.c === RCS file: /cvs/src/usr.sbin/hotplugd/hotplugd.c,v retrieving revision 1.12 diff -u -p -r1.12 hotplugd.c --- hotplugd/hotplugd.c 10 Jan 2010 13:20:41 - 1.12 +++ hotplugd/hotplugd.c 8 Nov 2015 09:39:22 - @@ -66,7 +66,6 @@ main(int argc, char *argv[]) case 'd': device = optarg; break; - case '?': default: usage(); /* NOTREACHED */ Index: inetd/inetd.c === RCS file: /cvs/src/usr.sbin/inetd/inetd.c,v retrieving revision 1.149 diff -u -p -r1.149 inetd.c --- inetd/inetd.c 1 Nov 2015 19:59:28 - 1.149 +++ inetd/inetd.c 8 Nov 2015 09:39:22 - @@ -316,7 +316,6 @@ main(int argc, char *argv[]) optarg); break; } - case '?': default: fprintf(stderr, "usage: inetd [-d] [-R rate] [configuration_file]\n"); Index: iostat/iostat.c === RCS file: /cvs/src/usr.sbin/iostat/iostat.c,v retrieving revision 1.39 diff -u -p -r1.39 iostat.c --- iostat/iostat.c 23 Oct 2015 08:21:27 - 1.39 +++ iostat/iostat.c 8 Nov 2015 09:39:22 - @@ -150,7 +150,6 @@ main(int argc, char *argv[]) if (errstr)
Re: [PATCH] add F13-F24 and colour support to console terminfo
Hi I think it should be Shift-F1 etc, but since this is a general problem with the xterm entry not just on OpenBSD, I suggest you discuss it with upstream. The terminfo database is maintained as part of ncurses. On Sun, Nov 08, 2015 at 07:21:02PM +, Tati Chevron wrote: > On Sun, Nov 08, 2015 at 04:50:21PM +, Nicholas Marriott wrote: > >Can you please send these upstream to Thomas Dickey or > >bug-ncur...@gnu.org? > > Done. > > >>* Add a new entry, 'pcconX', that adds F13-F24 to the standrd xterm entry > > > >Not this though - pccon* is for the console, not for use in xterm. I > >think you might want xterm-vt220? > > Hu, no, xterm-vt220 doesn't define F21-F24, and also has an incorrect > definition for the, 'home', key. > > I can make a diff for this, obviously, should I just add it as a variation? > > >Although I don't know why our xterm function keys should be different > >from stock xterm. > > Since F13-F24 don't exist on standard PC keyboards, traditionally terminal > emulators have mapped shift-F1 to F13, shift-F2 to F14, etc. > > In recent times, some 122-key terminal keyboards, which are designed to be > used with terminal emulators like that, actually send sequences such as > Shift-F1 when the physical F13 key is pressed, instead of the, 'real', > sequence. > > If you look in xterm+pcf2, which is the fragment included in the default > xterm terminfo entry that we use, you'll see that F13-F24 are indeed defined > as Shift-F1 - Shift-F12. > > Unfortunately, even this doesn't work correctly for us, because F1-F4 don't > follow the normal sequence for historical reasons. > > So, we should do something to make sure that the default terminal emulation > used for xterm on a default install, has a sensible configuration for > F13-F24. Either support the, 'real', sequences from a 122-key keyboard, or > support the shifted F1-F12 keys as F13-F24, or preferably, both. > > Shall I make a diff to fix this? > > -- > Tati Chevron > Perl and FORTRAN specialist. > SWABSIT development and migration department. > http://www.swabsit.com
Re: [patch]apmd ? sign
On Wed, May 20, 2015 at 05:08:21PM +0200, Fritjof Bornebusch wrote: Ping > > Index: apmd.c > === > RCS file: /cvs/src/usr.sbin/apmd/apmd.c,v > retrieving revision 1.75 > diff -u -p -r1.75 apmd.c > --- apmd.c6 Feb 2015 08:16:50 - 1.75 > +++ apmd.c20 May 2015 15:04:38 - > @@ -403,7 +403,6 @@ main(int argc, char *argv[]) > doperf = PERF_MANUAL; > setperfpolicy("high"); > break; > - case '?': > default: > usage(); > }
Use uninitialized in sys/kern/uipc_syscalls.c
Hello, clang reports (from a recent -current) a use uninitialized if doaccept in sys/kern/uipc_syscalls.c . If isdnssocket fails resulting in goto bad where both s and headfp have not yet been initialized, conceivably resulting in undefined effects. Regards Mark === RCS file: /cvs/src/sys/kern/uipc_syscalls.c,v retrieving revision 1.123 diff -u -p -r1.123 uipc_syscalls.c --- kern/uipc_syscalls.c1 Nov 2015 19:03:33 - 1.123 +++ kern/uipc_syscalls.c8 Nov 2015 22:30:12 - @@ -240,13 +240,13 @@ doaccept(struct proc *p, int sock, struc return (error); if ((error = getsock(p, sock, )) != 0) return (error); + s = splsoftnet(); + headfp = fp; + head = fp->f_data; if (isdnssocket((struct socket *)fp->f_data)) { error = EINVAL; goto bad; } - headfp = fp; - s = splsoftnet(); - head = fp->f_data; redo: if ((head->so_options & SO_ACCEPTCONN) == 0) { error = EINVAL;
Re: em(4) watchdog timeouts
On Mon, Nov 02, 2015 at 09:29:20PM +0100, Gregor Best wrote: > [...] > Looks good so far. I've run a few light tests and the usual load that > caused the timeouts before, haven't seen any yet. > [...] I just checked back on the router and it seems that the patch doesn't help after all :( The number of watchdog timeouts went down, but they are still there, about 35 in the last two days with network (and other) load on the router almost nonexistant. If it helps debugging this, I can give SSH access to the router, provided that reboots don't happen between 18:00 and 02:00 German time too often, since that's when we have larger amounts of visitors in our hackerspace. -- Gregor
Re: em(4) watchdog timeouts
On Sun, Nov 08, 2015 at 06:57:23PM +0100, Gregor Best wrote: > [...] > If it helps debugging this, I can give SSH access to the router, > provided that reboots don't happen between 18:00 and 02:00 German time > too often, since that's when we have larger amounts of visitors in our > hackerspace. > [...] Forgot to mention, the SSH access includes a push button monkey with a console cable at hand (me) in case something goes wrong. -- Gregor
Re: remove superfluous case '?': from /sbin utils
Benjamin Baier wrote: > Hello tech@ > > I cleaned up and split up my former diff[0] for removing superfluous > case '?': /*FALLTHROUGH*/ > default: > usage(); > > Also removes one unnecessary break; > > This is for /sbin, more to come if there are any takers? > Greetings Ben > > [0] https://marc.info/?l=openbsd-tech=143387215328391=2 Probably worth mentioning that this is inspired by Theo's comment here: https://marc.info/?l=openbsd-tech=143215393708980=2 ok mmcc@ > Index: disklabel/disklabel.c > === > RCS file: /cvs/src/sbin/disklabel/disklabel.c,v > retrieving revision 1.211 > diff -u -p -r1.211 disklabel.c > --- disklabel/disklabel.c 17 Oct 2015 13:27:08 - 1.211 > +++ disklabel/disklabel.c 8 Nov 2015 09:38:05 - > @@ -169,7 +169,6 @@ main(int argc, char *argv[]) > case 'v': > verbose = 1; > break; > - case '?': > default: > usage(); > } > Index: dmesg/dmesg.c > === > RCS file: /cvs/src/sbin/dmesg/dmesg.c,v > retrieving revision 1.27 > diff -u -p -r1.27 dmesg.c > --- dmesg/dmesg.c 9 Oct 2015 01:37:06 - 1.27 > +++ dmesg/dmesg.c 8 Nov 2015 09:38:05 - > @@ -81,7 +81,6 @@ main(int argc, char *argv[]) > case 'N': > nlistf = optarg; > break; > - case '?': > default: > usage(); > } > Index: dumpfs/dumpfs.c > === > RCS file: /cvs/src/sbin/dumpfs/dumpfs.c,v > retrieving revision 1.32 > diff -u -p -r1.32 dumpfs.c > --- dumpfs/dumpfs.c 20 Jan 2015 18:22:21 - 1.32 > +++ dumpfs/dumpfs.c 8 Nov 2015 09:38:05 - > @@ -89,7 +89,6 @@ main(int argc, char *argv[]) > case 'm': > domarshal = 1; > break; > - case '?': > default: > usage(); > } > Index: fsck/fsck.c > === > RCS file: /cvs/src/sbin/fsck/fsck.c,v > retrieving revision 1.37 > diff -u -p -r1.37 fsck.c > --- fsck/fsck.c 29 May 2015 15:57:36 - 1.37 > +++ fsck/fsck.c 8 Nov 2015 09:38:05 - > @@ -163,7 +163,6 @@ main(int argc, char *argv[]) > filter = NET_FILTER; > break; > > - case '?': > default: > usage(); > /* NOTREACHED */ > Index: growfs/growfs.c > === > RCS file: /cvs/src/sbin/growfs/growfs.c,v > retrieving revision 1.40 > diff -u -p -r1.40 growfs.c > --- growfs/growfs.c 20 Aug 2015 22:02:21 - 1.40 > +++ growfs/growfs.c 8 Nov 2015 09:38:05 - > @@ -1937,8 +1937,6 @@ main(int argc, char **argv) > case 'y': > ExpertFlag = 1; > break; > - case '?': > - /* FALLTHROUGH */ > default: > usage(); > } > Index: isakmpd/isakmpd.c > === > RCS file: /cvs/src/sbin/isakmpd/isakmpd.c,v > retrieving revision 1.103 > diff -u -p -r1.103 isakmpd.c > --- isakmpd/isakmpd.c 20 Aug 2015 22:02:21 - 1.103 > +++ isakmpd/isakmpd.c 8 Nov 2015 09:38:05 - > @@ -210,7 +210,6 @@ parse_args(int argc, char *argv[]) > verbose_logging = 1; > break; > > - case '?': > default: > usage(); > } > Index: mknod/mknod.c > === > RCS file: /cvs/src/sbin/mknod/mknod.c,v > retrieving revision 1.18 > diff -u -p -r1.18 mknod.c > --- mknod/mknod.c 27 Mar 2010 09:10:02 - 1.18 > +++ mknod/mknod.c 8 Nov 2015 09:38:05 - > @@ -76,7 +76,6 @@ main(int argc, char *argv[]) > mode = getmode(set, DEFFILEMODE); > free(set); > break; > - case '?': > default: > usage(ismkfifo); > } > Index: mount/mount.c > === > RCS file: /cvs/src/sbin/mount/mount.c,v > retrieving revision 1.60 > diff -u -p -r1.60 mount.c > --- mount/mount.c 16 Jan 2015 06:39:59 - 1.60 > +++ mount/mount.c 8 Nov 2015 09:38:05 - > @@ -157,7 +157,6 @@ main(int argc, char * const argv[]) > if (!hasopt(options, "rw")) > options = catopt(options, "rw"); > break; > -
Small cat(1) style(9) diff
Hi tech Here a small diff for cat(1). 1 - Added the argc decrement (as normal in the majority of the tree). 2 - Removed args name from function prototypes as stated in style(9). 3 - Enclosed a while in braces (this will be a bit more readeable). Regards Index: cat.c === RCS file: /cvs/src/bin/cat/cat.c,v retrieving revision 1.24 diff -u -p -r1.24 cat.c --- cat.c 4 Nov 2015 21:28:01 - 1.24 +++ cat.c 8 Nov 2015 15:51:48 - @@ -54,9 +54,9 @@ int bflag, eflag, nflag, sflag, tflag, v int rval; char *filename; -void cook_args(char *argv[]); +void cook_args(char **); void cook_buf(FILE *); -void raw_args(char *argv[]); +void raw_args(char **); void raw_cat(int); int @@ -69,7 +69,7 @@ main(int argc, char *argv[]) if (pledge("stdio rpath", NULL) == -1) err(1, "pledge"); - while ((ch = getopt(argc, argv, "benstuv")) != -1) + while ((ch = getopt(argc, argv, "benstuv")) != -1) { switch (ch) { case 'b': bflag = nflag = 1; /* -b implies -n */ @@ -98,6 +98,8 @@ main(int argc, char *argv[]) exit(1); /* NOTREACHED */ } + } + argc -= optind; argv += optind; if (bflag || eflag || nflag || sflag || tflag || vflag)
Re: unify xmalloc (was Re: [patch] cvs: retire xfree())
Alexandre Ratchov wrote: > On Sun, Nov 08, 2015 at 09:56:23AM +0800, Michael W. Bombardieri wrote: > > On Thu, Nov 05, 2015 at 03:50:29PM +0100, Tobias Stoeckmann wrote: > > > On Thu, Nov 05, 2015 at 09:50:48AM +, Nicholas Marriott wrote: > > > > I don't know why cvs and rcs xmalloc.c has ended up so different. > > > > > > It's not just about cvs and rcs: > > > > > > /usr/src/usr.bin/cvs/xmalloc.c > > > /usr/src/usr.bin/diff/xmalloc.c > > > /usr/src/usr.bin/file/xmalloc.c > > > /usr/src/usr.bin/rcs/xmalloc.c > > > /usr/src/usr.bin/ssh/xmalloc.c > > > /usr/src/usr.bin/tmux/xmalloc.c (probably not same origin) > > > > > > > > > Also note that aucat(1)'s utils.c contains xmalloc() and xfree(). > > Its version of xfree() contains no special logic so remove it? > > i'd prefer we keep xfree(), as sometimes i replace it with a > instrumented version that detects leaks and gathers statistics I don't think this is a good reason, honestly. It's easy to add a wrapper function/macro while debugging and replace all free() calls with it.
Re: [PATCH] add F13-F24 and colour support to console terminfo
On Sun, Nov 08, 2015 at 02:09:03PM +, Nicholas Marriott wrote: If this is different from pccon*, you should fix those or add a variant rather than adding completely new entries. OK. The attached diff does the following: * Add F13-F24 to pccon. These were previously undefined. * Change the sgr definition to match the vt220 entry. This makes the, 'intense', colours work, giving us 16 instead of 8. * Define the bold sequence. Otherwise, E.G. 'echo foo | less', the ~ in column 0 are displayed as reverse video instead of bold, (as they do in xterm). * Add a new entry, 'pcconX', that adds F13-F24 to the standrd xterm entry --- termtypes.master.1.55.dist Sun Nov 8 15:20:37 2015 +++ termtypes.masterSun Nov 8 15:42:04 2015 @@ -2184,13 +2184,16 @@ kf4=\E[14~, kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, khome=\E[7~, kich1=\E[2~, knp=\E[6~, kpp=\E[5~, krfr=^R, + kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, + kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, kf20=\E[34~, + kf21=\E[35~, kf22=\E[36~, kf23=\E[37~, kf24=\E[38~, pccon+sgr+acs0|sgr and simple ASCII pseudographics for OpenBSD PC console, acsc=+>\,<-\^.v0#`+a\:f\\h#i#j+k+l+m+n+o~p-q-r-s_t+u+v+w+x|y#z#{*|!}#~o, sgr=\E[0%?%p1%p3%|%t;7%;m, sgr0=\E[m, pccon+sgr+acs|sgr and default ASCII pseudographics for OpenBSD PC console, acsc=++\,\,--..00``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, enacs=\E)0$<5>, rmacs=\E(B$<5>, - sgr=\E[0%?%p1%p3%|%t;7%;m%?%p9%t\E(0%e\E(B%;$<5>, + sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p4%t;5%;%?%p1%p3%|%t;7%;m%?%p9%t\E(0%e\E(B%;$<2>, sgr0=\E[m\E(B$<5>, smacs=\E(0$<5>, pccon+colors|ANSI colors for OpenBSD PC console, bce, @@ -2199,7 +2202,7 @@ pccon+base|base capabilities for OpenBSD PC console, am, km, mc5i, msgr, npc, nxon, xenl, xon, cols#80, it#8, lines#24, - bel=^G, clear=\E[H\E[J, cr=^M, cub1=^H, cud1=^J, cuf1=\E[C, + bel=^G, bold=\E[1m, clear=\E[H\E[J, cr=^M, cub1=^H, cud1=^J, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch=\E[%p1%dP, dch1=\E[P, dl1=\E[M, ech=\E[%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K, home=\E[H, ht=^I, hts=\EH, ich=\E[%p1%d@, @@ -2214,6 +2217,11 @@ use=pccon+base, use=pccon+sgr+acs, use=pccon+keys, pccon|OpenBSD PC console, use=pccon-m, use=pccon+colors, +pcconX|xterm-like entry that fixes behaviour of F13-F24 in X on OpenBSD, + kf13=\E[25~, kf14=\E[26~, + kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, + kf19=\E[33~, kf20=\E[34~, kf21=\E[42~, kf22=\E[43~, + kf23=\E[44~, kf24=\E[45~, khlp=, krdo=, use=xterm, NetBSD consoles # -- Tati Chevron Perl and FORTRAN specialist. SWABSIT development and migration department. http://www.swabsit.com
Re: [PATCH] add F13-F24 and colour support to console terminfo
On Sun, Nov 08, 2015 at 04:50:21PM +, Nicholas Marriott wrote: Can you please send these upstream to Thomas Dickey or bug-ncur...@gnu.org? Done. * Add a new entry, 'pcconX', that adds F13-F24 to the standrd xterm entry Not this though - pccon* is for the console, not for use in xterm. I think you might want xterm-vt220? Hu, no, xterm-vt220 doesn't define F21-F24, and also has an incorrect definition for the, 'home', key. I can make a diff for this, obviously, should I just add it as a variation? Although I don't know why our xterm function keys should be different from stock xterm. Since F13-F24 don't exist on standard PC keyboards, traditionally terminal emulators have mapped shift-F1 to F13, shift-F2 to F14, etc. In recent times, some 122-key terminal keyboards, which are designed to be used with terminal emulators like that, actually send sequences such as Shift-F1 when the physical F13 key is pressed, instead of the, 'real', sequence. If you look in xterm+pcf2, which is the fragment included in the default xterm terminfo entry that we use, you'll see that F13-F24 are indeed defined as Shift-F1 - Shift-F12. Unfortunately, even this doesn't work correctly for us, because F1-F4 don't follow the normal sequence for historical reasons. So, we should do something to make sure that the default terminal emulation used for xterm on a default install, has a sensible configuration for F13-F24. Either support the, 'real', sequences from a 122-key keyboard, or support the shifted F1-F12 keys as F13-F24, or preferably, both. Shall I make a diff to fix this? -- Tati Chevron Perl and FORTRAN specialist. SWABSIT development and migration department. http://www.swabsit.com
sunfire v120 gem interfaces
Hey tech@, At my wits end here, I recently got a sunfire v120 from work for pretty cheap. Quite excited to have some non x86 hardware, I set it up as a router. However, for some reason after sometimes mere hours -- othertimes days at a time, the gem0 interface needs to be cycled: ifconfig gem0 down ifconfig gem0 up dhclient gem0 no packets pass until that has been done. At first I have been placing the blame squarely on the Hitron modem we have in the house from shaw cable, but now I've noticed the issue happen twice on the internal interface as well, gem1. All VLANs I have setup stop responding until gem1 is cycled. gem1 is just used by a collection of vlan(4) interfaces, so traffic resumes immediately after interface gem1 down/up. I've tried to turn on ifconfig gem0 debug to catch anything wierd, but there has been nothing of interest there. Dmesg attached, starting to wonder if this machine is at its EOL and the network ports are dying :( This issue occurred with the 5.7 release as well. dmesg: console is /pci@1f,0/pci@1,1/isa@7/serial@0,3f8 Copyright (c) 1982, 1986, 1989, 1991, 1993 The Regents of the University of California. All rights reserved. Copyright (c) 1995-2015 OpenBSD. All rights reserved. http://www.OpenBSD.org OpenBSD 5.8 (GENERIC) #0: Thu Oct 22 00:24:09 PDT 2015 r...@void.inter.lan:/usr/src/sys/arch/sparc64/compile/GENERIC real mem = 1073741824 (1024MB) avail mem = 1039228928 (991MB) mpath0 at root scsibus0 at mpath0: 256 targets mainbus0 at root: Sun Fire V120 (UltraSPARC-IIe 648MHz) cpu0 at mainbus0: SUNW,UltraSPARC-IIe (rev 3.3) @ 648 MHz cpu0: physical 16K instruction (32 b/l), 16K data (32 b/l), 512K external (64 b/l) psycho0 at mainbus0: SUNW,sabre, impl 0, version 0, ign 7c0 psycho0: bus range 0-2, PCI bus 0 psycho0: dvma map c000-dfff pci0 at psycho0 ppb0 at pci0 dev 1 function 1 "Sun Simba" rev 0x13 pci1 at ppb0 bus 1 ebus0 at pci1 dev 12 function 0 "Sun RIO EBus" rev 0x01 "flashprom" at ebus0 addr 0-f not configured clock1 at ebus0 addr 0-1fff: mk48t59 lom0 at ebus0 addr 20-23 ivec 0x2a: LOMlite2 rev 3.12 alipm0 at pci1 dev 3 function 0 "Acer Labs M7101 Power" rev 0x00: 74KHz clock iic0 at alipm0 "max1617" at alipm0 addr 0x18 skipped due to alipm0 bugs spdmem0 at iic0 addr 0x54: 512MB SDRAM registered ECC PC133CL2 spdmem1 at iic0 addr 0x55: 512MB SDRAM registered ECC PC133CL2 ebus1 at pci1 dev 7 function 0 "Acer Labs M1533 ISA" rev 0x00 power0 at ebus1 addr 2000-2007 ivec 0x25 com0 at ebus1 addr 3f8-3ff ivec 0x2b: ns16550a, 16 byte fifo com0: console com1 at ebus1 addr 2e8-2ef ivec 0x2b: ns16550a, 16 byte fifo gem0 at pci1 dev 12 function 1 "Sun ERI Ether" rev 0x01: ivec 0x7c6, address 00:03:ba:2b:47:70 ukphy0 at gem0 phy 1: Generic IEEE 802.3u media interface, rev. 1: OUI 0x0010dd, model 0x0002 ohci0 at pci1 dev 12 function 3 "Sun USB" rev 0x01: ivec 0x7e4, version 1.0, legacy support pciide0 at pci1 dev 13 function 0 "Acer Labs M5229 UDMA IDE" rev 0xc3: DMA, channel 0 configured to native-PCI, channel 1 configured to native-PCI pciide0: using ivec 0x7cc for native-PCI interrupt atapiscsi0 at pciide0 channel 0 drive 0 scsibus1 at atapiscsi0: 2 targets cd0 at scsibus1 targ 0 lun 0:ATAPI 5/cdrom removable cd0(pciide0:0:0): using PIO mode 4, DMA mode 2 pciide0: channel 1 disabled (no drives) gem1 at pci1 dev 5 function 1 "Sun ERI Ether" rev 0x01: ivec 0x7dc, address 00:03:ba:2b:47:71 ukphy1 at gem1 phy 1: Generic IEEE 802.3u media interface, rev. 1: OUI 0x0010dd, model 0x0002 ohci1 at pci1 dev 5 function 3 "Sun USB" rev 0x01: ivec 0x7e6, version 1.0, legacy support usb0 at ohci0: USB revision 1.0 uhub0 at usb0 "Sun OHCI root hub" rev 1.00/1.00 addr 1 usb1 at ohci1: USB revision 1.0 uhub1 at usb1 "Sun OHCI root hub" rev 1.00/1.00 addr 1 ppb1 at pci0 dev 1 function 0 "Sun Simba" rev 0x13 pci2 at ppb1 bus 2 siop0 at pci2 dev 8 function 0 "Symbios Logic 53c896" rev 0x07: ivec 0x7e0, using 8K of on-board RAM scsibus2 at siop0: 16 targets, initiator 7 sym0 at scsibus2 targ 0 lun 0: SCSI3 0/direct fixed serial.SEAGATE_ST336607LSUN36G_3JA0DGN8731804D9 sd0 at scsibus0 targ 0 lun 0: SCSI3 0/direct fixed serial.SEAGATE_ST336607LSUN36G_3JA0DGN8731804D9 sd0: 34732MB, 512 bytes/sector, 71132959 sectors probe(siop0:1:0): Check Condition (error 0x70) on opcode 0x0 SENSE KEY: Hardware Error ASC/ASCQ: Defect List Error FRU CODE: 0x7 sym1 at scsibus2 targ 1 lun 0: SCSI3 0/direct fixed serial.SEAGATE_ST336607LSUN36G_3JA0BZL12316NCUL sd1 at scsibus0 targ 1 lun 0: SCSI3 0/direct fixed serial.SEAGATE_ST336607LSUN36G_3JA0BZL12316NCUL siop1 at pci2 dev 8 function 1 "Symbios Logic 53c896" rev 0x07: ivec 0x7e0, using 8K of on-board RAM scsibus3 at siop1: 16 targets, initiator 7 siop0: target 0 now using tagged 16 bit 40.0 MHz 31 REQ/ACK offset xfers vscsi0 at
Re: sunfire v120 gem interfaces
can you get the ifconfig output when its locked up? and a copy of what systat mb is showing? cheers, dlg > On 9 Nov 2015, at 09:36, Ryan Freemanwrote: > > Hey tech@, > > At my wits end here, I recently got a sunfire v120 from work for pretty cheap. > Quite excited to have some non x86 hardware, I set it up as a router. > > However, for some reason after sometimes mere hours -- othertimes days at a > time, the gem0 interface needs to be cycled: > > ifconfig gem0 down > ifconfig gem0 up > dhclient gem0 > > no packets pass until that has been done. At first I have been placing the > blame squarely on the Hitron modem we have in the house from shaw cable, > but now I've noticed the issue happen twice on the internal interface as well, > gem1. All VLANs I have setup stop responding until gem1 is cycled. > > gem1 is just used by a collection of vlan(4) interfaces, so traffic resumes > immediately after interface gem1 down/up. > > I've tried to turn on ifconfig gem0 debug to catch anything wierd, but there > has been nothing of interest there. Dmesg attached, starting to wonder > if this machine is at its EOL and the network ports are dying :( > > This issue occurred with the 5.7 release as well. > > dmesg: > console is /pci@1f,0/pci@1,1/isa@7/serial@0,3f8 > Copyright (c) 1982, 1986, 1989, 1991, 1993 >The Regents of the University of California. All rights reserved. > Copyright (c) 1995-2015 OpenBSD. All rights reserved. http://www.OpenBSD.org > > OpenBSD 5.8 (GENERIC) #0: Thu Oct 22 00:24:09 PDT 2015 >r...@void.inter.lan:/usr/src/sys/arch/sparc64/compile/GENERIC > real mem = 1073741824 (1024MB) > avail mem = 1039228928 (991MB) > mpath0 at root > scsibus0 at mpath0: 256 targets > mainbus0 at root: Sun Fire V120 (UltraSPARC-IIe 648MHz) > cpu0 at mainbus0: SUNW,UltraSPARC-IIe (rev 3.3) @ 648 MHz > cpu0: physical 16K instruction (32 b/l), 16K data (32 b/l), 512K external (64 > b/l) > psycho0 at mainbus0: SUNW,sabre, impl 0, version 0, ign 7c0 > psycho0: bus range 0-2, PCI bus 0 > psycho0: dvma map c000-dfff > pci0 at psycho0 > ppb0 at pci0 dev 1 function 1 "Sun Simba" rev 0x13 > pci1 at ppb0 bus 1 > ebus0 at pci1 dev 12 function 0 "Sun RIO EBus" rev 0x01 > "flashprom" at ebus0 addr 0-f not configured > clock1 at ebus0 addr 0-1fff: mk48t59 > lom0 at ebus0 addr 20-23 ivec 0x2a: LOMlite2 rev 3.12 > alipm0 at pci1 dev 3 function 0 "Acer Labs M7101 Power" rev 0x00: 74KHz clock > iic0 at alipm0 > "max1617" at alipm0 addr 0x18 skipped due to alipm0 bugs > spdmem0 at iic0 addr 0x54: 512MB SDRAM registered ECC PC133CL2 > spdmem1 at iic0 addr 0x55: 512MB SDRAM registered ECC PC133CL2 > ebus1 at pci1 dev 7 function 0 "Acer Labs M1533 ISA" rev 0x00 > power0 at ebus1 addr 2000-2007 ivec 0x25 > com0 at ebus1 addr 3f8-3ff ivec 0x2b: ns16550a, 16 byte fifo > com0: console > com1 at ebus1 addr 2e8-2ef ivec 0x2b: ns16550a, 16 byte fifo > gem0 at pci1 dev 12 function 1 "Sun ERI Ether" rev 0x01: ivec 0x7c6, address > 00:03:ba:2b:47:70 > ukphy0 at gem0 phy 1: Generic IEEE 802.3u media interface, rev. 1: OUI > 0x0010dd, model 0x0002 > ohci0 at pci1 dev 12 function 3 "Sun USB" rev 0x01: ivec 0x7e4, version 1.0, > legacy support > pciide0 at pci1 dev 13 function 0 "Acer Labs M5229 UDMA IDE" rev 0xc3: DMA, > channel 0 configured to native-PCI, channel 1 configured to native-PCI > pciide0: using ivec 0x7cc for native-PCI interrupt > atapiscsi0 at pciide0 channel 0 drive 0 > scsibus1 at atapiscsi0: 2 targets > cd0 at scsibus1 targ 0 lun 0: ATAPI 5/cdrom removable > cd0(pciide0:0:0): using PIO mode 4, DMA mode 2 > pciide0: channel 1 disabled (no drives) > gem1 at pci1 dev 5 function 1 "Sun ERI Ether" rev 0x01: ivec 0x7dc, address > 00:03:ba:2b:47:71 > ukphy1 at gem1 phy 1: Generic IEEE 802.3u media interface, rev. 1: OUI > 0x0010dd, model 0x0002 > ohci1 at pci1 dev 5 function 3 "Sun USB" rev 0x01: ivec 0x7e6, version 1.0, > legacy support > usb0 at ohci0: USB revision 1.0 > uhub0 at usb0 "Sun OHCI root hub" rev 1.00/1.00 addr 1 > usb1 at ohci1: USB revision 1.0 > uhub1 at usb1 "Sun OHCI root hub" rev 1.00/1.00 addr 1 > ppb1 at pci0 dev 1 function 0 "Sun Simba" rev 0x13 > pci2 at ppb1 bus 2 > siop0 at pci2 dev 8 function 0 "Symbios Logic 53c896" rev 0x07: ivec 0x7e0, > using 8K of on-board RAM > scsibus2 at siop0: 16 targets, initiator 7 > sym0 at scsibus2 targ 0 lun 0: SCSI3 > 0/direct fixed serial.SEAGATE_ST336607LSUN36G_3JA0DGN8731804D9 > sd0 at scsibus0 targ 0 lun 0: SCSI3 0/direct > fixed serial.SEAGATE_ST336607LSUN36G_3JA0DGN8731804D9 > sd0: 34732MB, 512 bytes/sector, 71132959 sectors > probe(siop0:1:0): Check Condition (error 0x70) on opcode 0x0 >SENSE KEY: Hardware Error > ASC/ASCQ: Defect List Error > FRU CODE: 0x7 > sym1 at scsibus2 targ 1 lun 0: SCSI3 > 0/direct fixed
Re: npppd(8): sync option parsing with other userland utils
On Sun, 8 Nov 2015 22:20:33 +0100 Benjamin Baierwrote: > This patch brings npppd(8)'s option parsing in sync with all the > other userland utils that don't recognize -h for help/usage (except > for some games, still). > > Also exit(3) at the end of the usage() function and mark it as __dead. Committed with some additional tweaks below. Thanks, --- npppd.c-bak Mon Nov 9 10:11:45 2015 +++ npppd.c Mon Nov 9 10:12:12 2015 @@ -98,7 +98,7 @@ static npppd s_npppd; /* singleton */ static void npppd_reload0 (npppd *); static void npppd_update_pool_reference (npppd *); static int npppd_rd_walktree_delete(struct radish_head *); -static void usage (void); +static __dead void usage (void); static void npppd_stop_really (npppd *); static uint32_t str_hash(const void *, int); static void npppd_on_sighup (int, short, void *); @@ -163,9 +163,8 @@ main(int argc, char *argv[]) } argc -= optind; argv += optind; - if (argc != 0) { + if (argc != 0) usage(); - } if (nflag) { debuglevel++; runasdaemon = 0;
Re: [patch]diff: uninitialized values
On Wed, Jun 17, 2015 at 09:19:28PM +0200, Fritjof Bornebusch wrote: > On Wed, Jun 17, 2015 at 08:53:57PM +0200, Fritjof Bornebusch wrote: > > Hi tech@, > > > > *edp1* and *edp2* could be used uninitialized, if *goto closem;* is called. > > > > Such initializers hiding a false positive, cause the compiler does not > understand this case can never happen. > -> warning: 'edp1' may be used uninitialized in this function > -> warning: 'edp2' may be used uninitialized in this function > > Sorry for beeing not that clear. > Ping > > Regards, > > --F. > > > > > > Index: diffdir.c > > === > > RCS file: /cvs/src/usr.bin/diff/diffdir.c,v > > retrieving revision 1.43 > > diff -u -p -r1.43 diffdir.c > > --- diffdir.c 16 Jan 2015 06:40:07 - 1.43 > > +++ diffdir.c 17 Jun 2015 18:50:57 - > > @@ -48,8 +48,8 @@ static void diffit(struct dirent *, char > > void > > diffdir(char *p1, char *p2, int flags) > > { > > - struct dirent *dent1, **dp1, **edp1, **dirp1 = NULL; > > - struct dirent *dent2, **dp2, **edp2, **dirp2 = NULL; > > + struct dirent *dent1, **dp1, **edp1 = NULL, **dirp1 = NULL; > > + struct dirent *dent2, **dp2, **edp2 = NULL, **dirp2 = NULL; > > size_t dirlen1, dirlen2; > > char path1[PATH_MAX], path2[PATH_MAX]; > > int pos; > > >
Re: [patch] tcpdump print-atalk segfaults
On Sun, Nov 8, 2015 at 4:58 PM, Mike Belopuhovwrote: > Do you have a library of pcaps available somewhere? Just a small local set that I've built up for testing. Is there interest in having them online somewhere?
Re: Periodically sync RTC
Christian Weisgerber wrote: > I would like to sync the system time periodically back to the RTC. > > Currently we update the RTC > (1) when the time is set with clock_settime() or settimeofday(), which > never happens for a typical ntpd setup, > (2) before suspend, > (3) when the system is properly shut down. > > This means if a machine has been running for a few months and it > loses power, it may come back up with the time, say, 200 seconds > off because of RTC drift, and then your SixXS tunnel won't come up > and you can no longer reach your home network on the last day of > u2k15. For example. I like this, and would also add that the problem is even worse for those systems too cheap to have an RTC. Saving the filesystem time periodically would also be a wonder.
[patch] cwm: Honour size hints when resizing using keyboard
Dear daemonfishes, After using evilwm for a decade, I'm quite impressed with cwm's codebase and functionality. (I just couldn't understand one feature: what's the use of ptrmove* if you cannot click? (...Mr. Andersen?)) This tiny preliminary patch makes keyboard-based window resizing honour size hints, which mouse-based one already does, to let you resize xterm character by character. Specifically: - If resize increments are set, multiply the resize deltas by the increments. I.e., resize* commands use (moveamount * incw) for width and the obvious for height, and bigresize* ten times that. - If minimum size is set, don't resize below it. Are you interested in something like this? Would you modify the behaviour somehow (e.g., with respect to moveamount)? Is it OK to use the same MAX() macro twice and let the compiler optimize it out? If you like thie modification, I can try to explain the new behaviour in less technical prose and write a man page patch. Vadik. -- A friend is someone you call to help you move. A real friend is someone you call to help you move a body. ? cwm-incsize.diff Index: kbfunc.c === RCS file: /cvs/xenocara/app/cwm/kbfunc.c,v retrieving revision 1.118 diff -u -r1.118 kbfunc.c --- kbfunc.c 16 Sep 2015 17:58:25 - 1.118 +++ kbfunc.c 8 Nov 2015 13:18:28 - @@ -118,10 +118,10 @@ client_ptrwarp(cc); break; case CWM_RESIZE: - if ((cc->geom.w += mx) < 1) - cc->geom.w = 1; - if ((cc->geom.h += my) < 1) - cc->geom.h = 1; + if ((cc->geom.w += mx * cc->hint.incw) < MAX(1, cc->hint.minw)) + cc->geom.w = MAX(1, cc->hint.minw); + if ((cc->geom.h += my * cc->hint.inch) < MAX(1, cc->hint.minh)) + cc->geom.h = MAX(1, cc->hint.minh); client_resize(cc, 1); /* Make sure the pointer stays within the window. */
Re: Periodically sync RTC
OK I don't care if there is better machinery or numbers, this is far better than the current situation. We lost power in a DC a few months back and we had machines come up with clocks off by values between 30 seconds and 45 minutes. On 9 Nov 2015 8:04 am, "Christian Weisgerber"wrote: > I would like to sync the system time periodically back to the RTC. > > Currently we update the RTC > (1) when the time is set with clock_settime() or settimeofday(), which > never happens for a typical ntpd setup, > (2) before suspend, > (3) when the system is properly shut down. > > This means if a machine has been running for a few months and it > loses power, it may come back up with the time, say, 200 seconds > off because of RTC drift, and then your SixXS tunnel won't come up > and you can no longer reach your home network on the last day of > u2k15. For example. > > FreeBSD uses a period of 30 minutes. I have no idea what a good > number would be so I went with that. (Maybe a prime number of > seconds?) FreeBSD also has a sysctl knob to change the period, > which is silly. > > The patch below, inspired by FreeBSD, "seems to work for me", but > I don't really know what I'm doing and if it's okay to just use a > timeout(9) like that. Do I need a task? Any locking? I'm also > uncertain where to put the hook to kick off the initial timeout_add(). > > > Index: kern/init_main.c > === > RCS file: /cvs/src/sys/kern/init_main.c,v > retrieving revision 1.246 > diff -u -p -r1.246 init_main.c > --- kern/init_main.c8 Nov 2015 20:45:57 - 1.246 > +++ kern/init_main.c8 Nov 2015 21:06:47 - > @@ -118,6 +118,8 @@ struct sigacts sigacts0; > struct process *initprocess; > struct proc *reaperproc; > > +void start_periodic_resettodr(void); > + > extern struct user *proc0paddr; > > struct vnode *rootvp, *swapdev_vp; > @@ -550,6 +552,8 @@ main(void *framep) > #if !(defined(__m88k__) && defined(MULTIPROCESSOR))/* XXX */ > pool_gc_pages(NULL); > #endif > + > + start_periodic_resettodr(); > > /* > * proc0: nothing to do, back to sleep > Index: kern/kern_time.c > === > RCS file: /cvs/src/sys/kern/kern_time.c,v > retrieving revision 1.95 > diff -u -p -r1.95 kern_time.c > --- kern/kern_time.c1 Nov 2015 19:03:33 - 1.95 > +++ kern/kern_time.c8 Nov 2015 16:46:46 - > @@ -41,6 +41,7 @@ > #include > #include > #include > +#include > #include > > #include > @@ -792,3 +793,21 @@ ppsratecheck(struct timeval *lasttime, i > return (rv); > } > > + > +#define RESETTODR_PERIOD 1800 > + > +void periodic_resettodr(void *); > +struct timeout resettodr_to = TIMEOUT_INITIALIZER(periodic_resettodr, > NULL); > + > +void > +periodic_resettodr(void *arg __unused) > +{ > + resettodr(); > + timeout_add_sec(_to, RESETTODR_PERIOD); > +} > + > +void > +start_periodic_resettodr(void) > +{ > + timeout_add_sec(_to, RESETTODR_PERIOD); > +} > -- > Christian "naddy" Weisgerber na...@mips.inka.de > >
Re: remove IF_PREPEND in src/sys/dev/pci, was Re: IFQ_PREPEND
On 11/08/15 01:06, David Gwynne wrote: On 8 Nov 2015, at 8:23 AM, Miod Vallatwrote: noone has a vr? You can't expect people to use the crappiest Ethernet chip ever designed. theyre in the alix, surely someone has those still. i thought le(4) was the worst. Finally tested this patch on: vr0 at pci0 dev 9 function 0 "VIA VT6105M RhineIII" rev 0x96: irq 10, address 00:0d:b9:17:d8:90 ukphy0 at vr0 phy 1: Generic IEEE 802.3u media interface, rev. 3: OUI 0x004063, model 0x0034 graybox:fred ~> ifconfig vr0 vr0: flags=8843 mtu 1500 lladdr 00:0d:b9:17:d8:90 priority: 0 groups: egress media: Ethernet autoselect (100baseTX full-duplex) status: active inet 192.168.5.7 netmask 0xff00 broadcast 192.168.5.255 And so far there has been no obvious regressions. Thanks Fred
Re: [patch] tcpdump print-atalk segfaults
On Sun, Nov 08, 2015 at 11:44:48PM +0100, Christian Weisgerber wrote: > In my tree, I'm still lugging along the patch below. This is > strictly equivalent to mikeb@'s change "Catch up with the BPF_ALIGNMENT > switch to the uint32_t" to print-{ip,ip6}.c eleven months ago, but > he didn't want me to commit it without testing against actual > AppleTalk traffic--which is unlikely to ever happen. Looks sane to me. I've tested with my AppleTalk captures on AMD64/i386. No change in output/behaviour.
Re: [patch] tcpdump print-atalk segfaults
On 9 November 2015 at 00:51, Kevin Reaywrote: > On Sun, Nov 08, 2015 at 11:44:48PM +0100, Christian Weisgerber wrote: >> In my tree, I'm still lugging along the patch below. This is >> strictly equivalent to mikeb@'s change "Catch up with the BPF_ALIGNMENT >> switch to the uint32_t" to print-{ip,ip6}.c eleven months ago, but >> he didn't want me to commit it without testing against actual >> AppleTalk traffic--which is unlikely to ever happen. > > Looks sane to me. > > I've tested with my AppleTalk captures on AMD64/i386. No change in > output/behaviour. > Do you have a library of pcaps available somewhere?
Re: unify xmalloc (was Re: [patch] cvs: retire xfree())
Maybe we should pick this off in smaller chunks so that we don't get immobilized by a few scattered issues. ok for removing xfree from aucat? Index: abuf.c === RCS file: /cvs/src/usr.bin/aucat/abuf.c,v retrieving revision 1.26 diff -u -p -r1.26 abuf.c --- abuf.c 21 Jan 2015 08:43:55 - 1.26 +++ abuf.c 9 Nov 2015 00:40:36 - @@ -62,7 +62,7 @@ abuf_done(struct abuf *buf) } } #endif - xfree(buf->data); + free(buf->data); buf->data = (void *)0xdeadbeef; } Index: aucat.c === RCS file: /cvs/src/usr.bin/aucat/aucat.c,v retrieving revision 1.149 diff -u -p -r1.149 aucat.c --- aucat.c 27 Aug 2015 07:25:56 - 1.149 +++ aucat.c 9 Nov 2015 00:40:36 - @@ -214,7 +214,7 @@ slot_new(char *path, int mode, struct ap if (!afile_open(>afile, path, hdr, mode == SIO_PLAY ? AFILE_FREAD : AFILE_FWRITE, par, rate, cmax - cmin + 1)) { - xfree(s); + free(s); return 0; } s->cmin = cmin; @@ -413,15 +413,13 @@ slot_del(struct slot *s) } #endif abuf_done(>buf); - if (s->resampbuf) - xfree(s->resampbuf); - if (s->convbuf) - xfree(s->convbuf); + free(s->resampbuf); + free(s->convbuf); } for (ps = _list; *ps != s; ps = &(*ps)->next) ; /* nothing */ *ps = s->next; - xfree(s); + free(s); } static int @@ -672,9 +670,9 @@ dev_close(void) if (dev_mh) mio_close(dev_mh); if (dev_mode & SIO_PLAY) - xfree(dev_pbuf); + free(dev_pbuf); if (dev_mode & SIO_REC) - xfree(dev_rbuf); + free(dev_rbuf); } static void @@ -999,7 +997,7 @@ offline(void) slot_list_copy(todo, dev_pchan, dev_pbuf); slot_list_iodo(); } - xfree(dev_pbuf); + free(dev_pbuf); while (slot_list) slot_del(slot_list); return 1; @@ -1148,7 +1146,7 @@ playrec(char *dev, int mode, int bufsz, if (dev_pstate == DEV_START) dev_mmcstop(); - xfree(pfds); + free(pfds); dev_close(); while (slot_list) slot_del(slot_list); Index: utils.c === RCS file: /cvs/src/usr.bin/aucat/utils.c,v retrieving revision 1.1 diff -u -p -r1.1 utils.c --- utils.c 21 Jan 2015 08:43:55 - 1.1 +++ utils.c 9 Nov 2015 00:40:36 - @@ -158,15 +158,6 @@ xmalloc(size_t size) } /* - * free memory allocated with xmalloc() - */ -void -xfree(void *p) -{ - free(p); -} - -/* * xmalloc-style strdup(3) */ char * Index: utils.h === RCS file: /cvs/src/usr.bin/aucat/utils.h,v retrieving revision 1.1 diff -u -p -r1.1 utils.h --- utils.h 21 Jan 2015 08:43:55 - 1.1 +++ utils.h 9 Nov 2015 00:40:36 - @@ -29,7 +29,6 @@ void log_flush(void); void *xmalloc(size_t); char *xstrdup(char *); -void xfree(void *); /* * Log levels:
Re: sunfire v120 gem interfaces
On Mon, Nov 09, 2015 at 10:07:31AM +1000, David Gwynne wrote: > can you get the ifconfig output when its locked up? and a copy of what systat > mb is showing? > > cheers, > dlg Thanks David, I have setup a script to try and capture this immediately when it happens. FWIW here is the output as it is now, working: 16:35 ryan@void:~$ ifconfig lo0: flags=8049mtu 32768 priority: 0 groups: lo inet6 fe80::1%lo0 prefixlen 64 scopeid 0x4 inet6 ::1 prefixlen 128 inet 127.0.0.1 netmask 0xff00 gem0: flags=8867 mtu 1500 lladdr 00:03:ba:2b:47:70 priority: 0 groups: egress media: Ethernet autoselect (100baseTX full-duplex) status: active inet 96.54.13.103 netmask 0xfc00 broadcast 96.54.15.255 gem1: flags=8b63 mtu 1500 lladdr 00:03:ba:2b:47:71 priority: 0 media: Ethernet autoselect (100baseTX full-duplex) status: active inet 10.16.1.30 netmask 0xffe0 broadcast 10.16.1.31 inet6 fe80::203:baff:fe2b:4771%gem1 prefixlen 64 scopeid 0x2 inet6 2001:470:b:6cf::1 prefixlen 64 enc0: flags=0<> priority: 0 groups: enc status: active vlan100: flags=8843 mtu 1500 lladdr 00:03:ba:2b:47:71 description: servers priority: 0 vlan: 100 parent interface: gem1 groups: vlan status: active inet 10.21.1.30 netmask 0xffe0 broadcast 10.21.1.31 inet6 fe80::203:baff:fe2b:4771%vlan100 prefixlen 64 scopeid 0x5 inet6 2001:470:eac8:666::1 prefixlen 64 vlan101: flags=8843 mtu 1500 lladdr 00:03:ba:2b:47:71 description: workstations priority: 0 vlan: 101 parent interface: gem1 groups: vlan status: active inet 10.21.8.254 netmask 0xff80 broadcast 10.21.8.255 inet6 fe80::203:baff:fe2b:4771%vlan101 prefixlen 64 scopeid 0x6 inet6 2001:470:eac8:a::1 prefixlen 64 vlan102: flags=8843 mtu 1500 lladdr 00:03:ba:2b:47:71 description: wireless priority: 0 vlan: 102 parent interface: gem1 groups: vlan status: active inet 10.21.9.254 netmask 0xff80 broadcast 10.21.9.255 inet6 fe80::203:baff:fe2b:4771%vlan102 prefixlen 64 scopeid 0x7 inet6 2001:470:eac8:b::1 prefixlen 64 vlan2: flags=8843 mtu 1500 lladdr 00:03:ba:2b:47:71 description: transit priority: 0 vlan: 2 parent interface: gem1 groups: vlan status: active inet 172.21.1.2 netmask 0xfffc broadcast 172.21.1.3 tun0: flags=51 mtu 1500 priority: 0 groups: tun status: down inet 10.21.2.1 --> 10.21.2.2 netmask 0xfffc gif0: flags=8051 mtu 1280 priority: 0 groups: gif egress tunnel: inet 96.54.13.103 -> 216.218.226.238 inet6 fe80::203:baff:fe2b:4770%gif0 -> prefixlen 64 scopeid 0xa inet6 2001:470:a:6cf::2 -> 2001:470:a:6cf::1 prefixlen 128 pflow0: flags=41 mtu 1492 priority: 0 pflow: sender: 127.0.0.1 receiver: 127.0.0.1:9995 version: 5 groups: pflow pflog0: flags=141 mtu 33144 priority: 0 groups: pflog 16:36 ryan@void:~$ systat -b mb 8 usersLoad 0.21 0.25 0.26 Sun Nov 8 16:37:12 2015 IFACE LIVELOCKS SIZE ALIVE LWM HWM CWM System0 25648 129 2048241025 lo0 gem0 204811 4 12411 gem1 204812 4 12412 enc0 vlan100 vlan101 vlan102 vlan2 tun0 gif0 pflow0 pflog0 > > > On 9 Nov 2015, at 09:36, Ryan Freeman wrote: > > > > Hey tech@, > > > > At my
Re: unify xmalloc (was Re: [patch] cvs: retire xfree())
Michael McConville wrote: > Maybe we should pick this off in smaller chunks so that we don't get > immobilized by a few scattered issues. > > ok for removing xfree from aucat? I just realized that this one was already submitted separately. Tobias, could you split your latest diff into separate diffs for each function type (xmalloc, xcalloc, etc.)? It'd make it easier to zero in on the problematic hunks and fast-track the rest. > Index: abuf.c > === > RCS file: /cvs/src/usr.bin/aucat/abuf.c,v > retrieving revision 1.26 > diff -u -p -r1.26 abuf.c > --- abuf.c21 Jan 2015 08:43:55 - 1.26 > +++ abuf.c9 Nov 2015 00:40:36 - > @@ -62,7 +62,7 @@ abuf_done(struct abuf *buf) > } > } > #endif > - xfree(buf->data); > + free(buf->data); > buf->data = (void *)0xdeadbeef; > } > > Index: aucat.c > === > RCS file: /cvs/src/usr.bin/aucat/aucat.c,v > retrieving revision 1.149 > diff -u -p -r1.149 aucat.c > --- aucat.c 27 Aug 2015 07:25:56 - 1.149 > +++ aucat.c 9 Nov 2015 00:40:36 - > @@ -214,7 +214,7 @@ slot_new(char *path, int mode, struct ap > if (!afile_open(>afile, path, hdr, > mode == SIO_PLAY ? AFILE_FREAD : AFILE_FWRITE, > par, rate, cmax - cmin + 1)) { > - xfree(s); > + free(s); > return 0; > } > s->cmin = cmin; > @@ -413,15 +413,13 @@ slot_del(struct slot *s) > } > #endif > abuf_done(>buf); > - if (s->resampbuf) > - xfree(s->resampbuf); > - if (s->convbuf) > - xfree(s->convbuf); > + free(s->resampbuf); > + free(s->convbuf); > } > for (ps = _list; *ps != s; ps = &(*ps)->next) > ; /* nothing */ > *ps = s->next; > - xfree(s); > + free(s); > } > > static int > @@ -672,9 +670,9 @@ dev_close(void) > if (dev_mh) > mio_close(dev_mh); > if (dev_mode & SIO_PLAY) > - xfree(dev_pbuf); > + free(dev_pbuf); > if (dev_mode & SIO_REC) > - xfree(dev_rbuf); > + free(dev_rbuf); > } > > static void > @@ -999,7 +997,7 @@ offline(void) > slot_list_copy(todo, dev_pchan, dev_pbuf); > slot_list_iodo(); > } > - xfree(dev_pbuf); > + free(dev_pbuf); > while (slot_list) > slot_del(slot_list); > return 1; > @@ -1148,7 +1146,7 @@ playrec(char *dev, int mode, int bufsz, > > if (dev_pstate == DEV_START) > dev_mmcstop(); > - xfree(pfds); > + free(pfds); > dev_close(); > while (slot_list) > slot_del(slot_list); > Index: utils.c > === > RCS file: /cvs/src/usr.bin/aucat/utils.c,v > retrieving revision 1.1 > diff -u -p -r1.1 utils.c > --- utils.c 21 Jan 2015 08:43:55 - 1.1 > +++ utils.c 9 Nov 2015 00:40:36 - > @@ -158,15 +158,6 @@ xmalloc(size_t size) > } > > /* > - * free memory allocated with xmalloc() > - */ > -void > -xfree(void *p) > -{ > - free(p); > -} > - > -/* > * xmalloc-style strdup(3) > */ > char * > Index: utils.h > === > RCS file: /cvs/src/usr.bin/aucat/utils.h,v > retrieving revision 1.1 > diff -u -p -r1.1 utils.h > --- utils.h 21 Jan 2015 08:43:55 - 1.1 > +++ utils.h 9 Nov 2015 00:40:36 - > @@ -29,7 +29,6 @@ void log_flush(void); > > void *xmalloc(size_t); > char *xstrdup(char *); > -void xfree(void *); > > /* > * Log levels: >
less(1) cleanup
Here, I: 1) remove a useless comment 2) remove a needless void* cast 3) remove a bunch of NULL-checks for free() 4) simplify a little associated logic Call me a one trick pony. ok? Index: cmdbuf.c === RCS file: /cvs/src/usr.bin/less/cmdbuf.c,v retrieving revision 1.11 diff -u -p -r1.11 cmdbuf.c --- cmdbuf.c9 Nov 2015 04:10:57 - 1.11 +++ cmdbuf.c9 Nov 2015 04:38:23 - @@ -918,13 +918,8 @@ init_compl(void) char *word; char c; - /* -* Get rid of any previous tk_text. -*/ - if (tk_text != NULL) { - free(tk_text); - tk_text = NULL; - } + free(tk_text); + tk_text = NULL; /* * Find the original (uncompleted) word in the command buffer. */ @@ -939,8 +934,7 @@ init_compl(void) /* * Save the original (uncompleted) word */ - if (tk_original != NULL) - free(tk_original); + free(tk_original); tk_original = ecalloc(cp-word+1, sizeof (char)); (void) strncpy(tk_original, word, cp-word); /* @@ -954,12 +948,11 @@ init_compl(void) tk_text = fcomplete(word); } else { char *qword = shell_quote(word+1); - if (qword == NULL) { + if (qword == NULL) tk_text = fcomplete(word+1); - } else { + else tk_text = fcomplete(qword); - free(qword); - } + free(qword); } *cp = c; } Index: command.c === RCS file: /cvs/src/usr.bin/less/command.c,v retrieving revision 1.22 diff -u -p -r1.22 command.c --- command.c 7 Nov 2015 18:07:44 - 1.22 +++ command.c 9 Nov 2015 04:38:23 - @@ -198,8 +198,7 @@ exec_mca(void) */ while (*cbuf == '+' || *cbuf == ' ') cbuf++; - if (every_first_cmd != NULL) - free(every_first_cmd); + free(every_first_cmd); if (*cbuf == '\0') every_first_cmd = NULL; else Index: line.c === RCS file: /cvs/src/usr.bin/less/line.c,v retrieving revision 1.14 diff -u -p -r1.14 line.c --- line.c 6 Nov 2015 15:50:33 - 1.14 +++ line.c 9 Nov 2015 04:38:23 - @@ -98,10 +98,8 @@ expand_linebuf(void) char *new_buf = realloc(linebuf, new_size); char *new_attr = realloc(attr, new_size); if (new_buf == NULL || new_attr == NULL) { - if (new_attr != NULL) - free(new_attr); - if (new_buf != NULL) - free(new_buf); + free(new_attr); + free(new_buf); return (1); } linebuf = new_buf; Index: option.c === RCS file: /cvs/src/usr.bin/less/option.c,v retrieving revision 1.12 diff -u -p -r1.12 option.c --- option.c7 Nov 2015 18:07:44 - 1.12 +++ option.c9 Nov 2015 04:38:23 - @@ -307,8 +307,7 @@ scan_option(char *s) */ if (o->ofunc != NULL) (*o->ofunc)(INIT, str); - if (str != NULL) - free(str); + free(str); } } Index: search.c === RCS file: /cvs/src/usr.bin/less/search.c,v retrieving revision 1.11 diff -u -p -r1.11 search.c --- search.c6 Nov 2015 15:50:33 - 1.11 +++ search.c9 Nov 2015 04:38:23 - @@ -97,12 +97,10 @@ set_pattern(struct pattern_info *info, c else if (compile_pattern(pattern, search_type, >compiled) < 0) return (-1); /* Pattern compiled successfully; save the text too. */ - if (info->text != NULL) - free(info->text); + free(info->text); info->text = NULL; - if (pattern != NULL) { + if (pattern != NULL) info->text = estrdup(pattern); - } info->search_type = search_type; /* @@ -291,7 +289,7 @@ clr_hlist(struct hilite *anchor) for (hl = anchor->hl_first; hl != NULL; hl = nexthl) { nexthl = hl->hl_next; - free((void*)hl); + free(hl); } anchor->hl_first = NULL; prep_startpos = prep_endpos = -1;
Re: [patch] armv7/imx/imxesdhc.c: add imxesdhc_dump_regs
On Sun, Nov 08, 2015 at 03:49:34AM -0500, Ian Sutton wrote: > > I tried enabling bits in the ccm, enabling clocks, making various > > changes to imxesdhc itself and didn't get anywhere. Similiar story > > with the usb otg port on the cubox. > > I have made some headway. Compiling with -DSDHC_DEBUG shows imxesdhc > follows all the nessecary steps for initialization, voltage select, > CID/CSD checking, etc. Only when the driver attempts the first actual > transfer (single block read at address 0, CMD 17) does it fail: > > imxesdhc0: start cmd 17 arg=0 data=0xccd94000 dlen=512 flags=0x1c50 > proc="sdmmc0" > imxesdhc0: wait_state 1 0 ff8d8088) > imxesdhc0: interrupt status=0x0001 > imxesdhc0: intr status 0x1 error 0 > resp[0] 0x0900 > imxesdhc0: resp=0x900 datalen=512 > imxesdhc0: intr status 0x107f error 0 > imxesdhc0: software reset reg=0x600 > imxesdhc0: data transfer done (error=60) > imxesdhc0: cmd 17 done (flags=0x1c51 error=60) > root on rd0a swap on rd0b dump on rd0b > panic: cannot open disk, 0x1200/0x1202, error 2 > > This line in particular: > > imxesdhc0: intr status 0x107f error 0 > > indicates many error interrupts were received during the time the driver > was waiting for the "buffer read ready" interrupt following the single > block read command. That interupt never comes and a ETIMEDOUT is > returned (error=60 2 lines down). This is due to the "internal DMA mode" > bit being set; according to the i.MX6 reference manual this stops our > target BRR interrupt from firing (page 5601): > > "When internal DMA is not used (DMAEN bit in Transfer Type register is > not set when the command is sent), the uSDHC asserts a DMA request when > the amount of data exceeds the value set in the RD_WML register, that is > available and ready for system fetching data. At the same time, the > uSDHC sets the BRR bit. The buffer read ready interrupt will be > generated if it is enabled by software. When internal DMA is used, the > uSDHC will not inform the system before all the required number of bytes > are transferred (if no error was encountered)." > > This bit is set on line 819 in imxesdhc.c. It shouldn't be: > > 819 HWRITE4(sc, SDHC_MIX_CTRL, > 820(HREAD4(sc, SDHC_MIX_CTRL) & (0xf << 22)) | (command & 0x)); > 821 HWRITE4(sc, SDHC_CMD_XFR_TYP, command); > 822 > 823 splx(s); > 824 return 0; > > That doesn't look right. > > The rest of the driver defaults to using PIO, DMA mode must be > manually enabled with -DSDHC_DMA (It currently doesn't compile). All the > DMA mode-specific code is wrapped in #ifdefs except the line mentioned > above. Removing it advances our progress somewhat: For a point of comparison the FreeBSD i.mx6 sdhc driver is pio "DMA is not really broken, I just haven't implemented it yet" and supposedly works. It also has some comments that seem to describe errata. https://svnweb.freebsd.org/base/head/sys/arm/freescale/imx/imx_sdhci.c?revision=HEAD=co
[PATCH] add F13-F24 and colour support to console terminfo
The terminfo entries used for X and for the console by a default install, are broken for keyboards with function keys beyond F12, and for keyboards with five cursor movement keys instead of the more common four. In addition, the VGA console supports colour, but the terminfo entry used by default does not define the necessary escape sequences. Please find attached a patch against -current which defines three new terminfo entries to fix these problems. --- termtypes.master.1.55.dist Sun Nov 8 11:40:24 2015 +++ termtypes.master.1.55.customSun Nov 8 11:43:06 2015 @@ -291,6 +291,51 @@ # There are no guarantees anywhere. Svaha! # + CUSTOM ENTRIES FOR OPENBSD-5.8 +# +# Three entries to allow the use of F1-F5, F13-F24 and colour on the +# OpenBSD VGA framebuffer console, and the use of F13-F24 with the default +# X config. +# +# In addition, the, 'home', key on a PC-122 keyboard is defined as, 'home', +# on the console, to match the definition in X: +# +# On a standard PC keyboard, there are four cursor keys in an inverted, 'T', +# whereas on a PC-122 keyboard there are five cursor keys: +# +# --- --- Legend +# |^| |^| -- +# --- --- +# --- --- --- --- --- --- ^ - UP +# |<| |V| |>| |<| |H| |>| V - DOWN +# --- --- --- --- --- --- < - LEFT +# --- > - RIGHT +# |V| H - HOME +# --- +# +# PC Keyboard PC-122 Keyboard +# +# The new entries in this file are as follows: +# tati - OpenBSD console with F1-F24, 5-key cursor-key block, and colour. +# tatimono - As above, but without colour support +# tatiX - X11 xterm with F1-F24, (colour and 5-key cursor-key block were +# already supported by the existing xterm entry. + +tatimono|OpenBSD console with F1-F24 without colour support, + kf1=\E[11~, kf2=\E[12~, kf3=\E[13~, kf4=\E[14~, kf5=\E[15~, + kf15=\E[28~, kf16=\E[29~, kf21=\E[35~, kf22=\E[36~, + kf23=\E[37~, kf24=\E[38~, khome=\E[7~, khlp=, krdo=, use=vt220, + +tati|OpenBSD console with F1-F24 and colour, + use=tatimono, use=ecma+color, + +tatiX|vt220-like entry that fixes behaviour of F13-F24 in X on OpenBSD, + kf13=\E[25~, kf14=\E[26~, + kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, + kf19=\E[33~, kf20=\E[34~, kf21=\E[42~, kf22=\E[43~, + kf23=\E[44~, kf24=\E[45~, khlp=, krdo=, use=xterm, + + ANSI, UNIX CONSOLE, AND SPECIAL TYPES # # This section describes terminal classes and brands that are still -- Tati Chevron Perl and FORTRAN specialist. SWABSIT development and migration department. http://www.swabsit.com
Re: sunfire v120 gem interfaces
I had problems with my dual AC200 carp setup, in that the interfaces would periodically stop receiving packets. Transmission still worked though, so the carp wouldn't fail over... Machines are retired now, but I believe details exist in the archives somewhere. I also believe henning@ had similar issues in the past. /Alexander On November 9, 2015 12:36:33 AM GMT+01:00, Ryan Freemanwrote: >Hey tech@, > >At my wits end here, I recently got a sunfire v120 from work for pretty >cheap. >Quite excited to have some non x86 hardware, I set it up as a router. > >However, for some reason after sometimes mere hours -- othertimes days >at a >time, the gem0 interface needs to be cycled: > >ifconfig gem0 down >ifconfig gem0 up >dhclient gem0 > >no packets pass until that has been done. At first I have been >placing the >blame squarely on the Hitron modem we have in the house from shaw >cable, >but now I've noticed the issue happen twice on the internal interface >as well, >gem1. All VLANs I have setup stop responding until gem1 is cycled. > >gem1 is just used by a collection of vlan(4) interfaces, so traffic >resumes >immediately after interface gem1 down/up. > >I've tried to turn on ifconfig gem0 debug to catch anything wierd, but >there >has been nothing of interest there. Dmesg attached, starting to >wonder >if this machine is at its EOL and the network ports are dying :( > >This issue occurred with the 5.7 release as well. > >dmesg: >console is /pci@1f,0/pci@1,1/isa@7/serial@0,3f8 >Copyright (c) 1982, 1986, 1989, 1991, 1993 > The Regents of the University of California. All rights reserved. >Copyright (c) 1995-2015 OpenBSD. All rights reserved. >http://www.OpenBSD.org > >OpenBSD 5.8 (GENERIC) #0: Thu Oct 22 00:24:09 PDT 2015 >r...@void.inter.lan:/usr/src/sys/arch/sparc64/compile/GENERIC >real mem = 1073741824 (1024MB) >avail mem = 1039228928 (991MB) >mpath0 at root >scsibus0 at mpath0: 256 targets >mainbus0 at root: Sun Fire V120 (UltraSPARC-IIe 648MHz) >cpu0 at mainbus0: SUNW,UltraSPARC-IIe (rev 3.3) @ 648 MHz >cpu0: physical 16K instruction (32 b/l), 16K data (32 b/l), 512K >external (64 b/l) >psycho0 at mainbus0: SUNW,sabre, impl 0, version 0, ign 7c0 >psycho0: bus range 0-2, PCI bus 0 >psycho0: dvma map c000-dfff >pci0 at psycho0 >ppb0 at pci0 dev 1 function 1 "Sun Simba" rev 0x13 >pci1 at ppb0 bus 1 >ebus0 at pci1 dev 12 function 0 "Sun RIO EBus" rev 0x01 >"flashprom" at ebus0 addr 0-f not configured >clock1 at ebus0 addr 0-1fff: mk48t59 >lom0 at ebus0 addr 20-23 ivec 0x2a: LOMlite2 rev 3.12 >alipm0 at pci1 dev 3 function 0 "Acer Labs M7101 Power" rev 0x00: 74KHz >clock >iic0 at alipm0 >"max1617" at alipm0 addr 0x18 skipped due to alipm0 bugs >spdmem0 at iic0 addr 0x54: 512MB SDRAM registered ECC PC133CL2 >spdmem1 at iic0 addr 0x55: 512MB SDRAM registered ECC PC133CL2 >ebus1 at pci1 dev 7 function 0 "Acer Labs M1533 ISA" rev 0x00 >power0 at ebus1 addr 2000-2007 ivec 0x25 >com0 at ebus1 addr 3f8-3ff ivec 0x2b: ns16550a, 16 byte fifo >com0: console >com1 at ebus1 addr 2e8-2ef ivec 0x2b: ns16550a, 16 byte fifo >gem0 at pci1 dev 12 function 1 "Sun ERI Ether" rev 0x01: ivec 0x7c6, >address 00:03:ba:2b:47:70 >ukphy0 at gem0 phy 1: Generic IEEE 802.3u media interface, rev. 1: OUI >0x0010dd, model 0x0002 >ohci0 at pci1 dev 12 function 3 "Sun USB" rev 0x01: ivec 0x7e4, version >1.0, legacy support >pciide0 at pci1 dev 13 function 0 "Acer Labs M5229 UDMA IDE" rev 0xc3: >DMA, channel 0 configured to native-PCI, channel 1 configured to >native-PCI >pciide0: using ivec 0x7cc for native-PCI interrupt >atapiscsi0 at pciide0 channel 0 drive 0 >scsibus1 at atapiscsi0: 2 targets >cd0 at scsibus1 targ 0 lun 0: ATAPI 5/cdrom >removable >cd0(pciide0:0:0): using PIO mode 4, DMA mode 2 >pciide0: channel 1 disabled (no drives) >gem1 at pci1 dev 5 function 1 "Sun ERI Ether" rev 0x01: ivec 0x7dc, >address 00:03:ba:2b:47:71 >ukphy1 at gem1 phy 1: Generic IEEE 802.3u media interface, rev. 1: OUI >0x0010dd, model 0x0002 >ohci1 at pci1 dev 5 function 3 "Sun USB" rev 0x01: ivec 0x7e6, version >1.0, legacy support >usb0 at ohci0: USB revision 1.0 >uhub0 at usb0 "Sun OHCI root hub" rev 1.00/1.00 addr 1 >usb1 at ohci1: USB revision 1.0 >uhub1 at usb1 "Sun OHCI root hub" rev 1.00/1.00 addr 1 >ppb1 at pci0 dev 1 function 0 "Sun Simba" rev 0x13 >pci2 at ppb1 bus 2 >siop0 at pci2 dev 8 function 0 "Symbios Logic 53c896" rev 0x07: ivec >0x7e0, using 8K of on-board RAM >scsibus2 at siop0: 16 targets, initiator 7 >sym0 at scsibus2 targ 0 lun 0: SCSI3 >0/direct fixed serial.SEAGATE_ST336607LSUN36G_3JA0DGN8731804D9 >sd0 at scsibus0 targ 0 lun 0: SCSI3 >0/direct fixed serial.SEAGATE_ST336607LSUN36G_3JA0DGN8731804D9 >sd0: 34732MB, 512 bytes/sector, 71132959 sectors >probe(siop0:1:0): Check Condition (error 0x70) on opcode 0x0 >SENSE KEY: Hardware Error > ASC/ASCQ: Defect List Error >
Uninitialized timestamps set in sppp_input
Hello, In sys/net/if_spppsubr.c last activity time stamps can be set to uninitialized values. Found with clang. Regards Index: sys/net/if_spppsubr.c === RCS file: /cvs/src/sys/net/if_spppsubr.c,v retrieving revision 1.144 diff -u -p -r1.144 if_spppsubr.c --- sys/net/if_spppsubr.c 2 Nov 2015 11:19:30 - 1.144 +++ sys/net/if_spppsubr.c 9 Nov 2015 07:44:58 - @@ -509,6 +509,7 @@ sppp_input(struct ifnet *ifp, struct mbu case PPP_IP: if (sp->state[IDX_IPCP] == STATE_OPENED) { inq = + getmicrouptime(); sp->pp_last_activity = tv.tv_sec; } break; @@ -521,6 +522,7 @@ sppp_input(struct ifnet *ifp, struct mbu case PPP_IPV6: if (sp->state[IDX_IPV6CP] == STATE_OPENED) { inq = + getmicrouptime(); sp->pp_last_activity = tv.tv_sec; } break;
Re: unify xmalloc (was Re: [patch] cvs: retire xfree())
This is fine with me, I think it was better without errno, but using it can't do any harm. It is an extension TO set it, not to not set it, but I am pretty sure it only happens on platforms I don't care about :-). I suggest you check with djm or dtucker for ssh in case they do care, or there are any other problem for portable. On Sun, Nov 08, 2015 at 01:39:32AM +0100, Tobias Stoeckmann wrote: > Here's an updated diff: > > - use "overflow" error message for snprintf and friends > - use err instead of errx for out of memory conditions > - if fatal() doesn't print error string, use ": %s", strerror(errno) > > Is this okay for ssh and tmux, which are out to be very portable? > Nicholas mentioned that malloc is not required to set errno. I've also > checked the standard and it's just an extension. Although at worst, > the user sees a wrong error message... > > Index: usr.bin/cvs/xmalloc.c > === > RCS file: /cvs/src/usr.bin/cvs/xmalloc.c,v > retrieving revision 1.12 > diff -u -p -u -p -r1.12 xmalloc.c > --- usr.bin/cvs/xmalloc.c 5 Nov 2015 09:48:21 - 1.12 > +++ usr.bin/cvs/xmalloc.c 8 Nov 2015 00:27:13 - > @@ -13,6 +13,8 @@ > * called by a name other than "ssh" or "Secure Shell". > */ > > +#include > +#include > #include > #include > #include > @@ -30,7 +32,8 @@ xmalloc(size_t size) > fatal("xmalloc: zero size"); > ptr = malloc(size); > if (ptr == NULL) > - fatal("xmalloc: out of memory (allocating %lu bytes)", (u_long) > size); > + fatal("xmalloc: allocating %zu bytes: %s", > + size, strerror(errno)); > return ptr; > } > > @@ -41,12 +44,10 @@ xcalloc(size_t nmemb, size_t size) > > if (size == 0 || nmemb == 0) > fatal("xcalloc: zero size"); > - if (SIZE_MAX / nmemb < size) > - fatal("xcalloc: nmemb * size > SIZE_MAX"); > ptr = calloc(nmemb, size); > if (ptr == NULL) > - fatal("xcalloc: out of memory (allocating %lu bytes)", > - (u_long)(size * nmemb)); > + fatal("xcalloc: allocating %zu * %zu bytes: %s", > + nmemb, size, strerror(errno)); > return ptr; > } > > @@ -54,28 +55,23 @@ void * > xreallocarray(void *ptr, size_t nmemb, size_t size) > { > void *new_ptr; > - size_t new_size = nmemb * size; > > - if (new_size == 0) > - fatal("xrealloc: zero size"); > - if (SIZE_MAX / nmemb < size) > - fatal("xrealloc: nmemb * size > SIZE_MAX"); > - new_ptr = realloc(ptr, new_size); > + if (nmemb == 0 || size == 0) > + fatal("xreallocarray: zero size"); > + new_ptr = reallocarray(ptr, nmemb, size); > if (new_ptr == NULL) > - fatal("xrealloc: out of memory (new_size %lu bytes)", > - (u_long) new_size); > + fatal("xreallocarray: allocating %zu * %zu bytes: %s", > + nmemb, size, strerror(errno)); > return new_ptr; > } > > char * > xstrdup(const char *str) > { > - size_t len; > char *cp; > > - len = strlen(str) + 1; > - cp = xmalloc(len); > - strlcpy(cp, str, len); > + if ((cp = strdup(str)) == NULL) > + fatal("xstrdup: %s", strerror(errno)); > return cp; > } > > @@ -90,23 +86,26 @@ xasprintf(char **ret, const char *fmt, . > va_end(ap); > > if (i < 0 || *ret == NULL) > - fatal("xasprintf: could not allocate memory"); > + fatal("xasprintf: %s", strerror(errno)); > > - return (i); > + return i; > } > > int > -xsnprintf(char *str, size_t size, const char *fmt, ...) > +xsnprintf(char *str, size_t len, const char *fmt, ...) > { > va_list ap; > int i; > > + if (len > INT_MAX) > + fatal("xsnprintf: len > INT_MAX"); > + > va_start(ap, fmt); > - i = vsnprintf(str, size, fmt, ap); > + i = vsnprintf(str, len, fmt, ap); > va_end(ap); > > - if (i == -1 || i >= (int)size) > + if (i < 0 || i >= (int)len) > fatal("xsnprintf: overflow"); > > - return (i); > + return i; > } > Index: usr.bin/diff/xmalloc.c > === > RCS file: /cvs/src/usr.bin/diff/xmalloc.c,v > retrieving revision 1.8 > diff -u -p -u -p -r1.8 xmalloc.c > --- usr.bin/diff/xmalloc.c25 Sep 2015 16:16:26 - 1.8 > +++ usr.bin/diff/xmalloc.c8 Nov 2015 00:27:13 - > @@ -27,9 +27,11 @@ xmalloc(size_t size) > { > void *ptr; > > + if (size == 0) > + errx(2, "xmalloc: zero size"); > ptr = malloc(size); > if (ptr == NULL) > - err(2, "xmalloc %zu", size); > + err(2, "xmalloc: allocating %zu bytes", size); > return ptr; > } > > @@ -40,8 +42,7 @@ xcalloc(size_t nmemb, size_t size) > > ptr = calloc(nmemb, size); > if
Re: unify xmalloc (was Re: [patch] cvs: retire xfree())
On Sat, Nov 07, 2015 at 08:42:14PM -0500, Ted Unangst wrote: > Tobias Stoeckmann wrote: > > Is this okay for ssh and tmux, which are out to be very portable? > > Nicholas mentioned that malloc is not required to set errno. I've also > > checked the standard and it's just an extension. Although at worst, > > the user sees a wrong error message... > > Are they portable to not-posix? posix dictates that malloc set errno. It is optional in SUSv3: RETURN VALUE Upon successful completion with size not equal to 0, malloc() shall return a pointer to the allocated space. If size is 0, either a null pointer or a unique pointer that can be successfully passed to free() shall be returned. Otherwise, it shall return a null pointer ^[CX] [Option Start] and set errno to indicate the error. [Option End]