Roadside units (RSUs) are public and personal wireless access points that can provide communications with infrastructure in ad hoc vehicular networks. We present CLOCS (Counting and Localization using Online Compressive Sensing), a novel system to retrieve both the number and locations of RSUs through wardriving. CLOCS employs online compressive sensing (CS), where received signal strength (RSS) values are recorded at runtime, and the number and location of RSUs are recovered immediately based on limited RSS readings. CLOCS also uses fine retrieval based on an expectation maximization method along the driving route. Extensive simulation results and experiments in a real testbed deployed in the campus of the University of California, Irvine confirm that CLOCS can successfully reduce the number of measurements for RSU recovery, while maintaining satisfactory counting and localization accuracy. In addition, data dissemination, time cost, and effects of different mobile scenarios using CLOCS are analyzed, and the impact of CLOCS on network connectivity is studied using Microsoft VanLan traces.