Electronic and structural properties of semiconductor surfaces with chemisorbed oxygen