Changeset ff381a7 in mainline for uspace/lib/nettl/src/portrng.c
- Timestamp:
- 2015-11-02T20:54:19Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- d8513177
- Parents:
- 3feeab2 (diff), 5265eea4 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/nettl/src/portrng.c
r3feeab2 rff381a7 46 46 #include <io/log.h> 47 47 48 /** Create port range. 49 * 50 * @param rpr Place to store pointer to new port range 51 * @return EOK on success, ENOMEM if out of memory 52 */ 48 53 int portrng_create(portrng_t **rpr) 49 54 { … … 62 67 } 63 68 69 /** Destroy port range. 70 * 71 * @param pr Port range 72 */ 64 73 void portrng_destroy(portrng_t *pr) 65 74 { … … 69 78 } 70 79 80 /** Allocate port number from port range. 81 * 82 * @param pr Port range 83 * @param pnum Port number to allocate specific port, or zero to allocate 84 * any valid port from range 85 * @param arg User argument to set for port 86 * @param flags Flags, @c pf_allow_system to allow ports from system range 87 * to be specified by @a pnum. 88 * @param apnum Place to store allocated port number 89 * 90 * @return EOK on success, ENOENT if no free port number found, EEXIST 91 * if @a pnum is specified but it is already allocated, 92 * EINVAL if @a pnum is specified from the system range, but 93 * @c pf_allow_system was not set. 94 */ 71 95 int portrng_alloc(portrng_t *pr, uint16_t pnum, void *arg, 72 96 portrng_flags_t flags, uint16_t *apnum) … … 113 137 if (port->pn == pnum) { 114 138 log_msg(LOG_DEFAULT, LVL_DEBUG2, "port already used"); 115 return EEXIST S;139 return EEXIST; 116 140 } 117 141 } … … 131 155 } 132 156 157 /** Find allocated port number and return its argument. 158 * 159 * @param pr Port range 160 * @param pnum Port number 161 * @param rarg Place to store user argument 162 * 163 * @return EOK on success, ENOENT if specified port number is not allocated 164 */ 133 165 int portrng_find_port(portrng_t *pr, uint16_t pnum, void **rarg) 134 166 { … … 143 175 } 144 176 177 /** Free port in port range. 178 * 179 * @param pr Port range 180 * @param pnum Port number 181 */ 145 182 void portrng_free_port(portrng_t *pr, uint16_t pnum) 146 183 { … … 158 195 } 159 196 197 /** Determine if port range is empty. 198 * 199 * @param pr Port range 200 * @return @c true if no ports are allocated from @a pr, @c false otherwise 201 */ 160 202 bool portrng_empty(portrng_t *pr) 161 203 {
Note:
See TracChangeset
for help on using the changeset viewer.