mixer.c (53c768e6836a32c8dcd0b0b422a169ef7a82a3ab) | mixer.c (67c89b21b95601c01bafe5a0c518d320a39111c0) |
---|---|
1/*- 2 * Copyright (c) 2021 Christos Margiolis <christos@FreeBSD.org> 3 * 4 * Permission is hereby granted, free of charge, to any person obtaining a copy 5 * of this software and associated documentation files (the "Software"), to deal 6 * in the Software without restriction, including without limitation the rights 7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 * copies of the Software, and to permit persons to whom the Software is --- 479 unchanged lines hidden (view full) --- 488 if (ioctl(m->fd, OSS_SYSINFO, &si) < 0) { 489 (void)mixer_close(m); 490 return (-1); 491 } 492 (void)mixer_close(m); 493 494 return (si.nummixers); 495} | 1/*- 2 * Copyright (c) 2021 Christos Margiolis <christos@FreeBSD.org> 3 * 4 * Permission is hereby granted, free of charge, to any person obtaining a copy 5 * of this software and associated documentation files (the "Software"), to deal 6 * in the Software without restriction, including without limitation the rights 7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 * copies of the Software, and to permit persons to whom the Software is --- 479 unchanged lines hidden (view full) --- 488 if (ioctl(m->fd, OSS_SYSINFO, &si) < 0) { 489 (void)mixer_close(m); 490 return (-1); 491 } 492 (void)mixer_close(m); 493 494 return (si.nummixers); 495} |
496 497/* 498 * Get the full path to a mixer device. 499 */ 500int 501mixer_get_path(char *buf, size_t size, int unit) 502{ 503 size_t n; 504 505 if (!(unit == -1 || (unit >= 0 && unit < mixer_get_nmixers()))) { 506 errno = EINVAL; 507 return (-1); 508 } 509 if (unit == -1) 510 n = strlcpy(buf, BASEPATH, size); 511 else 512 n = snprintf(buf, size, BASEPATH "%d", unit); 513 514 if (n >= size) { 515 errno = ENOMEM; 516 return (-1); 517 } 518 519 return (0); 520} |
|