comparison libinterp/corefcn/syscalls.cc @ 31187:0a2bf14dd400

Add "const" qualifier to static variables that hold "fcntl.h" values. * syscalls.cc: Add "const" qualifier to static variables that hold "fcntl.h" values.
author Rik <rik@octave.org>
date Sat, 13 Aug 2022 16:45:48 -0700
parents 32d2b6604a9f
children e88a07dec498
comparison
equal deleted inserted replaced
31186:07e3911e24c2 31187:0a2bf14dd400
1434 Return the numerical value to pass to @code{fcntl} to return 1434 Return the numerical value to pass to @code{fcntl} to return
1435 a duplicate file descriptor. 1435 a duplicate file descriptor.
1436 @seealso{fcntl, F_GETFD, F_GETFL, F_SETFD, F_SETFL} 1436 @seealso{fcntl, F_GETFD, F_GETFL, F_SETFD, F_SETFL}
1437 @end deftypefn */) 1437 @end deftypefn */)
1438 { 1438 {
1439 static int val = octave_f_dupfd_wrapper (); 1439 static const int val = octave_f_dupfd_wrapper ();
1440 1440
1441 if (val < 0) 1441 if (val < 0)
1442 err_disabled_feature ("F_DUPFD", "F_DUPFD"); 1442 err_disabled_feature ("F_DUPFD", "F_DUPFD");
1443 1443
1444 return const_value (args, val); 1444 return const_value (args, val);
1450 Return the numerical value to pass to @code{fcntl} to return 1450 Return the numerical value to pass to @code{fcntl} to return
1451 the file descriptor flags. 1451 the file descriptor flags.
1452 @seealso{fcntl, F_DUPFD, F_GETFL, F_SETFD, F_SETFL} 1452 @seealso{fcntl, F_DUPFD, F_GETFL, F_SETFD, F_SETFL}
1453 @end deftypefn */) 1453 @end deftypefn */)
1454 { 1454 {
1455 static int val = octave_f_getfd_wrapper (); 1455 static const int val = octave_f_getfd_wrapper ();
1456 1456
1457 if (val < 0) 1457 if (val < 0)
1458 err_disabled_feature ("F_GETFD", "F_GETFD"); 1458 err_disabled_feature ("F_GETFD", "F_GETFD");
1459 1459
1460 return const_value (args, val); 1460 return const_value (args, val);
1466 Return the numerical value to pass to @code{fcntl} to return 1466 Return the numerical value to pass to @code{fcntl} to return
1467 the file status flags. 1467 the file status flags.
1468 @seealso{fcntl, F_DUPFD, F_GETFD, F_SETFD, F_SETFL} 1468 @seealso{fcntl, F_DUPFD, F_GETFD, F_SETFD, F_SETFL}
1469 @end deftypefn */) 1469 @end deftypefn */)
1470 { 1470 {
1471 static int val = octave_f_getfl_wrapper (); 1471 static const int val = octave_f_getfl_wrapper ();
1472 1472
1473 if (val < 0) 1473 if (val < 0)
1474 err_disabled_feature ("F_GETFL", "F_GETFL"); 1474 err_disabled_feature ("F_GETFL", "F_GETFL");
1475 1475
1476 return const_value (args, val); 1476 return const_value (args, val);
1482 Return the numerical value to pass to @code{fcntl} to set the file 1482 Return the numerical value to pass to @code{fcntl} to set the file
1483 descriptor flags. 1483 descriptor flags.
1484 @seealso{fcntl, F_DUPFD, F_GETFD, F_GETFL, F_SETFL} 1484 @seealso{fcntl, F_DUPFD, F_GETFD, F_GETFL, F_SETFL}
1485 @end deftypefn */) 1485 @end deftypefn */)
1486 { 1486 {
1487 static int val = octave_f_setfd_wrapper (); 1487 static const int val = octave_f_setfd_wrapper ();
1488 1488
1489 if (val < 0) 1489 if (val < 0)
1490 err_disabled_feature ("F_SETFD", "F_SETFD"); 1490 err_disabled_feature ("F_SETFD", "F_SETFD");
1491 1491
1492 return const_value (args, val); 1492 return const_value (args, val);
1498 Return the numerical value to pass to @code{fcntl} to set the file 1498 Return the numerical value to pass to @code{fcntl} to set the file
1499 status flags. 1499 status flags.
1500 @seealso{fcntl, F_DUPFD, F_GETFD, F_GETFL, F_SETFD} 1500 @seealso{fcntl, F_DUPFD, F_GETFD, F_GETFL, F_SETFD}
1501 @end deftypefn */) 1501 @end deftypefn */)
1502 { 1502 {
1503 static int val = octave_f_setfl_wrapper (); 1503 static const int val = octave_f_setfl_wrapper ();
1504 1504
1505 if (val < 0) 1505 if (val < 0)
1506 err_disabled_feature ("F_SETFL", "F_SETFL"); 1506 err_disabled_feature ("F_SETFL", "F_SETFL");
1507 1507
1508 return const_value (args, val); 1508 return const_value (args, val);
1518 @code{fcntl} to set the write mode to append. 1518 @code{fcntl} to set the write mode to append.
1519 @seealso{fcntl, O_ASYNC, O_CREAT, O_EXCL, O_NONBLOCK, O_RDONLY, O_RDWR, O_SYNC, 1519 @seealso{fcntl, O_ASYNC, O_CREAT, O_EXCL, O_NONBLOCK, O_RDONLY, O_RDWR, O_SYNC,
1520 O_TRUNC, O_WRONLY} 1520 O_TRUNC, O_WRONLY}
1521 @end deftypefn */) 1521 @end deftypefn */)
1522 { 1522 {
1523 static int val = octave_o_append_wrapper (); 1523 static const int val = octave_o_append_wrapper ();
1524 1524
1525 if (val < 0) 1525 if (val < 0)
1526 err_disabled_feature ("O_APPEND", "O_APPEND"); 1526 err_disabled_feature ("O_APPEND", "O_APPEND");
1527 1527
1528 return const_value (args, val); 1528 return const_value (args, val);
1537 @code{fcntl} to indicate asynchronous I/O. 1537 @code{fcntl} to indicate asynchronous I/O.
1538 @seealso{fcntl, O_APPEND, O_CREAT, O_EXCL, O_NONBLOCK, O_RDONLY, O_RDWR, O_SYNC, 1538 @seealso{fcntl, O_APPEND, O_CREAT, O_EXCL, O_NONBLOCK, O_RDONLY, O_RDWR, O_SYNC,
1539 O_TRUNC, O_WRONLY} 1539 O_TRUNC, O_WRONLY}
1540 @end deftypefn */) 1540 @end deftypefn */)
1541 { 1541 {
1542 static int val = octave_o_async_wrapper (); 1542 static const int val = octave_o_async_wrapper ();
1543 1543
1544 if (val < 0) 1544 if (val < 0)
1545 err_disabled_feature ("O_ASYNC", "O_ASYNC"); 1545 err_disabled_feature ("O_ASYNC", "O_ASYNC");
1546 1546
1547 return const_value (args, val); 1547 return const_value (args, val);
1557 exist. 1557 exist.
1558 @seealso{fcntl, O_APPEND, O_ASYNC, O_EXCL, O_NONBLOCK, O_RDONLY, O_RDWR, O_SYNC, 1558 @seealso{fcntl, O_APPEND, O_ASYNC, O_EXCL, O_NONBLOCK, O_RDONLY, O_RDWR, O_SYNC,
1559 O_TRUNC, O_WRONLY} 1559 O_TRUNC, O_WRONLY}
1560 @end deftypefn */) 1560 @end deftypefn */)
1561 { 1561 {
1562 static int val = octave_o_creat_wrapper (); 1562 static const int val = octave_o_creat_wrapper ();
1563 1563
1564 if (val < 0) 1564 if (val < 0)
1565 err_disabled_feature ("O_CREAT", "O_CREAT"); 1565 err_disabled_feature ("O_CREAT", "O_CREAT");
1566 1566
1567 return const_value (args, val); 1567 return const_value (args, val);
1576 @code{fcntl} to indicate that file locking is used. 1576 @code{fcntl} to indicate that file locking is used.
1577 @seealso{fcntl, O_APPEND, O_ASYNC, O_CREAT, O_NONBLOCK, O_RDONLY, O_RDWR, 1577 @seealso{fcntl, O_APPEND, O_ASYNC, O_CREAT, O_NONBLOCK, O_RDONLY, O_RDWR,
1578 O_SYNC, O_TRUNC, O_WRONLY} 1578 O_SYNC, O_TRUNC, O_WRONLY}
1579 @end deftypefn */) 1579 @end deftypefn */)
1580 { 1580 {
1581 static int val = octave_o_excl_wrapper (); 1581 static const int val = octave_o_excl_wrapper ();
1582 1582
1583 if (val < 0) 1583 if (val < 0)
1584 err_disabled_feature ("O_EXCL", "O_EXCL"); 1584 err_disabled_feature ("O_EXCL", "O_EXCL");
1585 1585
1586 return const_value (args, val); 1586 return const_value (args, val);
1596 passsed to @code{fcntl} to set non-blocking I/O. 1596 passsed to @code{fcntl} to set non-blocking I/O.
1597 @seealso{fcntl, O_APPEND, O_ASYNC, O_CREAT, O_EXCL, O_RDONLY, O_RDWR, O_SYNC, 1597 @seealso{fcntl, O_APPEND, O_ASYNC, O_CREAT, O_EXCL, O_RDONLY, O_RDWR, O_SYNC,
1598 O_TRUNC, O_WRONLY} 1598 O_TRUNC, O_WRONLY}
1599 @end deftypefn */) 1599 @end deftypefn */)
1600 { 1600 {
1601 static int val = octave_o_nonblock_wrapper (); 1601 static const int val = octave_o_nonblock_wrapper ();
1602 1602
1603 if (val < 0) 1603 if (val < 0)
1604 err_disabled_feature ("O_NONBLOCK", "O_NONBLOCK"); 1604 err_disabled_feature ("O_NONBLOCK", "O_NONBLOCK");
1605 1605
1606 return const_value (args, val); 1606 return const_value (args, val);
1615 @code{fcntl} to indicate that a file is open for reading only. 1615 @code{fcntl} to indicate that a file is open for reading only.
1616 @seealso{fcntl, O_APPEND, O_ASYNC, O_CREAT, O_EXCL, O_NONBLOCK, O_RDWR, O_SYNC, 1616 @seealso{fcntl, O_APPEND, O_ASYNC, O_CREAT, O_EXCL, O_NONBLOCK, O_RDWR, O_SYNC,
1617 O_TRUNC, O_WRONLY} 1617 O_TRUNC, O_WRONLY}
1618 @end deftypefn */) 1618 @end deftypefn */)
1619 { 1619 {
1620 static int val = octave_o_rdonly_wrapper (); 1620 static const int val = octave_o_rdonly_wrapper ();
1621 1621
1622 if (val < 0) 1622 if (val < 0)
1623 err_disabled_feature ("O_RDONLY", "O_RDONLY"); 1623 err_disabled_feature ("O_RDONLY", "O_RDONLY");
1624 1624
1625 return const_value (args, val); 1625 return const_value (args, val);
1635 writing. 1635 writing.
1636 @seealso{fcntl, O_APPEND, O_ASYNC, O_CREAT, O_EXCL, O_NONBLOCK, O_RDONLY, 1636 @seealso{fcntl, O_APPEND, O_ASYNC, O_CREAT, O_EXCL, O_NONBLOCK, O_RDONLY,
1637 O_SYNC, O_TRUNC, O_WRONLY} 1637 O_SYNC, O_TRUNC, O_WRONLY}
1638 @end deftypefn */) 1638 @end deftypefn */)
1639 { 1639 {
1640 static int val = octave_o_rdwr_wrapper (); 1640 static const int val = octave_o_rdwr_wrapper ();
1641 1641
1642 if (val < 0) 1642 if (val < 0)
1643 err_disabled_feature ("O_RDWR", "O_RDWR"); 1643 err_disabled_feature ("O_RDWR", "O_RDWR");
1644 1644
1645 return const_value (args, val); 1645 return const_value (args, val);
1654 @code{fcntl} to indicate that a file is open for synchronous I/O 1654 @code{fcntl} to indicate that a file is open for synchronous I/O
1655 @seealso{fcntl, O_APPEND, O_ASYNC, O_CREAT, O_EXCL, O_NONBLOCK, O_RDONLY, 1655 @seealso{fcntl, O_APPEND, O_ASYNC, O_CREAT, O_EXCL, O_NONBLOCK, O_RDONLY,
1656 O_RDWR, O_TRUNC, O_WRONLY} 1656 O_RDWR, O_TRUNC, O_WRONLY}
1657 @end deftypefn */) 1657 @end deftypefn */)
1658 { 1658 {
1659 static int val = octave_o_sync_wrapper (); 1659 static const int val = octave_o_sync_wrapper ();
1660 1660
1661 if (val < 0) 1661 if (val < 0)
1662 err_disabled_feature ("O_SYNC", "O_SYNC"); 1662 err_disabled_feature ("O_SYNC", "O_SYNC");
1663 1663
1664 return const_value (args, val); 1664 return const_value (args, val);
1674 when writing. 1674 when writing.
1675 @seealso{fcntl, O_APPEND, O_ASYNC, O_CREAT, O_EXCL, O_NONBLOCK, O_RDONLY, 1675 @seealso{fcntl, O_APPEND, O_ASYNC, O_CREAT, O_EXCL, O_NONBLOCK, O_RDONLY,
1676 O_RDWR, O_SYNC, O_WRONLY} 1676 O_RDWR, O_SYNC, O_WRONLY}
1677 @end deftypefn */) 1677 @end deftypefn */)
1678 { 1678 {
1679 static int val = octave_o_trunc_wrapper (); 1679 static const int val = octave_o_trunc_wrapper ();
1680 1680
1681 if (val < 0) 1681 if (val < 0)
1682 err_disabled_feature ("O_TRUNC", "O_TRUNC"); 1682 err_disabled_feature ("O_TRUNC", "O_TRUNC");
1683 1683
1684 return const_value (args, val); 1684 return const_value (args, val);
1693 @code{fcntl} to indicate that a file is open for writing only 1693 @code{fcntl} to indicate that a file is open for writing only
1694 @seealso{fcntl, O_APPEND, O_ASYNC, O_CREAT, O_EXCL, O_NONBLOCK, O_RDONLY, 1694 @seealso{fcntl, O_APPEND, O_ASYNC, O_CREAT, O_EXCL, O_NONBLOCK, O_RDONLY,
1695 O_RDWR, O_SYNC, O_TRUNC} 1695 O_RDWR, O_SYNC, O_TRUNC}
1696 @end deftypefn */) 1696 @end deftypefn */)
1697 { 1697 {
1698 static int val = octave_o_wronly_wrapper (); 1698 static const int val = octave_o_wronly_wrapper ();
1699 1699
1700 if (val < 0) 1700 if (val < 0)
1701 err_disabled_feature ("O_WRONLY", "O_WRONLY"); 1701 err_disabled_feature ("O_WRONLY", "O_WRONLY");
1702 1702
1703 return const_value (args, val); 1703 return const_value (args, val);