1 | /* |
1 | /* |
2 | * libev solaris event port backend |
2 | * libev solaris event port backend |
3 | * |
3 | * |
4 | * Copyright (c) 2007,2008,2009,2010 Marc Alexander Lehmann <libev@schmorp.de> |
4 | * Copyright (c) 2007,2008,2009,2010,2011 Marc Alexander Lehmann <libev@schmorp.de> |
5 | * All rights reserved. |
5 | * All rights reserved. |
6 | * |
6 | * |
7 | * Redistribution and use in source and binary forms, with or without modifica- |
7 | * Redistribution and use in source and binary forms, with or without modifica- |
8 | * tion, are permitted provided that the following conditions are met: |
8 | * tion, are permitted provided that the following conditions are met: |
9 | * |
9 | * |
… | |
… | |
141 | { |
141 | { |
142 | /* Initialize the kernel queue */ |
142 | /* Initialize the kernel queue */ |
143 | if ((backend_fd = port_create ()) < 0) |
143 | if ((backend_fd = port_create ()) < 0) |
144 | return 0; |
144 | return 0; |
145 | |
145 | |
146 | assert (("libev: PORT_SOURCE_FD must not be zero"), PORT_SOURCE_FD); |
146 | assert (("libev: PORT_SOURCE_FD must not be zero", PORT_SOURCE_FD)); |
147 | |
147 | |
148 | fcntl (backend_fd, F_SETFD, FD_CLOEXEC); /* not sure if necessary, hopefully doesn't hurt */ |
148 | fcntl (backend_fd, F_SETFD, FD_CLOEXEC); /* not sure if necessary, hopefully doesn't hurt */ |
149 | |
149 | |
150 | backend_fudge = 1e-3; /* needed to compensate for port_getn returning early */ |
150 | backend_fudge = 1e-3; /* needed to compensate for port_getn returning early */ |
151 | backend_modify = port_modify; |
151 | backend_modify = port_modify; |