00001 /** @file 00002 00003 A brief file description 00004 00005 @section license License 00006 00007 Licensed to the Apache Software Foundation (ASF) under one 00008 or more contributor license agreements. See the NOTICE file 00009 distributed with this work for additional information 00010 regarding copyright ownership. The ASF licenses this file 00011 to you under the Apache License, Version 2.0 (the 00012 "License"); you may not use this file except in compliance 00013 with the License. You may obtain a copy of the License at 00014 00015 http://www.apache.org/licenses/LICENSE-2.0 00016 00017 Unless required by applicable law or agreed to in writing, software 00018 distributed under the License is distributed on an "AS IS" BASIS, 00019 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00020 See the License for the specific language governing permissions and 00021 limitations under the License. 00022 */ 00023 00024 /**************************************************************************** 00025 00026 SocketManager.cc 00027 ****************************************************************************/ 00028 #include "libts.h" 00029 #include "P_EventSystem.h" 00030 00031 SocketManager socketManager; 00032 00033 SocketManager::SocketManager() 00034 : pagesize(ats_pagesize()) 00035 { 00036 } 00037 00038 SocketManager::~SocketManager() 00039 { 00040 // free the hash table and values 00041 } 00042 00043 int 00044 SocketManager::ink_bind(int s, struct sockaddr const* name, int namelen, short Proto) 00045 { 00046 (void) Proto; 00047 return safe_bind(s, name, namelen); 00048 } 00049 00050 int 00051 SocketManager::close(int s) 00052 { 00053 int res; 00054 00055 if (s == 0) 00056 return -EACCES; 00057 else if (s < 0) 00058 return -EINVAL; 00059 00060 do { 00061 res = ::close(s); 00062 if (res == -1) 00063 res = -errno; 00064 } while (res == -EINTR); 00065 return res; 00066 }